@shopify/shop-minis-react 0.0.16 → 0.0.17

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 (131) hide show
  1. package/README.md +14 -10
  2. package/dist/components/atoms/button.js +28 -73
  3. package/dist/components/atoms/button.js.map +1 -1
  4. package/dist/components/atoms/favorite-button.js +21 -0
  5. package/dist/components/atoms/favorite-button.js.map +1 -0
  6. package/dist/components/atoms/icon-button.js +38 -0
  7. package/dist/components/atoms/icon-button.js.map +1 -0
  8. package/dist/components/atoms/touchable.js +14 -14
  9. package/dist/components/atoms/touchable.js.map +1 -1
  10. package/dist/components/commerce/merchant-card.js +1 -8
  11. package/dist/components/commerce/merchant-card.js.map +1 -1
  12. package/dist/components/commerce/product-card.js +79 -109
  13. package/dist/components/commerce/product-card.js.map +1 -1
  14. package/dist/components/commerce/product-link.js +36 -55
  15. package/dist/components/commerce/product-link.js.map +1 -1
  16. package/dist/components/ui/accordion.js.map +1 -0
  17. package/dist/components/{atoms → ui}/alert-dialog.js +1 -1
  18. package/dist/components/ui/alert-dialog.js.map +1 -0
  19. package/dist/components/ui/alert.js.map +1 -0
  20. package/dist/components/ui/badge.js.map +1 -0
  21. package/dist/components/ui/button.js +68 -0
  22. package/dist/components/ui/button.js.map +1 -0
  23. package/dist/components/ui/card.js.map +1 -0
  24. package/dist/components/{atoms → ui}/carousel.js +23 -23
  25. package/dist/components/ui/carousel.js.map +1 -0
  26. package/dist/components/ui/checkbox.js.map +1 -0
  27. package/dist/components/ui/dialog.js.map +1 -0
  28. package/dist/components/{atoms → ui}/drawer.js +25 -22
  29. package/dist/components/ui/drawer.js.map +1 -0
  30. package/dist/components/ui/input.js.map +1 -0
  31. package/dist/components/ui/label.js.map +1 -0
  32. package/dist/components/ui/progress.js.map +1 -0
  33. package/dist/components/ui/radio-group.js.map +1 -0
  34. package/dist/components/ui/resizable.js.map +1 -0
  35. package/dist/components/ui/scroll-area.js.map +1 -0
  36. package/dist/components/ui/select.js.map +1 -0
  37. package/dist/components/ui/separator.js.map +1 -0
  38. package/dist/components/ui/sheet.js.map +1 -0
  39. package/dist/components/ui/sonner.js.map +1 -0
  40. package/dist/index.js +189 -218
  41. package/dist/index.js.map +1 -1
  42. package/package.json +6 -9
  43. package/src/components/atoms/button.tsx +10 -66
  44. package/src/components/atoms/favorite-button.tsx +22 -0
  45. package/src/components/atoms/icon-button.tsx +42 -0
  46. package/src/components/atoms/touchable.tsx +5 -1
  47. package/src/components/commerce/merchant-card.tsx +1 -12
  48. package/src/components/commerce/product-card.tsx +4 -32
  49. package/src/components/commerce/product-link.tsx +9 -29
  50. package/src/components/index.ts +22 -20
  51. package/src/components/{atoms → ui}/alert-dialog.tsx +1 -1
  52. package/src/components/ui/button.tsx +77 -0
  53. package/src/components/{atoms → ui}/carousel.tsx +11 -11
  54. package/src/components/{atoms → ui}/drawer.tsx +2 -1
  55. package/src/index.css +8 -2
  56. package/src/styles/globals.css +41 -0
  57. package/src/styles/theme.css +102 -0
  58. package/dist/_virtual/index3.js +0 -6
  59. package/dist/_virtual/index3.js.map +0 -1
  60. package/dist/_virtual/index4.js +0 -5
  61. package/dist/_virtual/index4.js.map +0 -1
  62. package/dist/_virtual/use-sync-external-store-shim.development.js +0 -5
  63. package/dist/_virtual/use-sync-external-store-shim.development.js.map +0 -1
  64. package/dist/_virtual/use-sync-external-store-shim.production.js +0 -5
  65. package/dist/_virtual/use-sync-external-store-shim.production.js.map +0 -1
  66. package/dist/components/atoms/accordion.js.map +0 -1
  67. package/dist/components/atoms/alert-dialog.js.map +0 -1
  68. package/dist/components/atoms/alert.js.map +0 -1
  69. package/dist/components/atoms/avatar.js +0 -54
  70. package/dist/components/atoms/avatar.js.map +0 -1
  71. package/dist/components/atoms/badge.js.map +0 -1
  72. package/dist/components/atoms/card.js.map +0 -1
  73. package/dist/components/atoms/carousel.js.map +0 -1
  74. package/dist/components/atoms/checkbox.js.map +0 -1
  75. package/dist/components/atoms/dialog.js.map +0 -1
  76. package/dist/components/atoms/drawer.js.map +0 -1
  77. package/dist/components/atoms/input.js.map +0 -1
  78. package/dist/components/atoms/label.js.map +0 -1
  79. package/dist/components/atoms/progress.js.map +0 -1
  80. package/dist/components/atoms/radio-group.js.map +0 -1
  81. package/dist/components/atoms/resizable.js.map +0 -1
  82. package/dist/components/atoms/scroll-area.js.map +0 -1
  83. package/dist/components/atoms/select.js.map +0 -1
  84. package/dist/components/atoms/separator.js.map +0 -1
  85. package/dist/components/atoms/sheet.js.map +0 -1
  86. package/dist/components/atoms/sonner.js.map +0 -1
  87. package/dist/shop-minis-react/node_modules/.pnpm/@radix-ui_react-avatar@1.1.10_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1._hkz57sehyui4ndfh3rsqwxftli/node_modules/@radix-ui/react-avatar/dist/index.js +0 -77
  88. package/dist/shop-minis-react/node_modules/.pnpm/@radix-ui_react-avatar@1.1.10_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1._hkz57sehyui4ndfh3rsqwxftli/node_modules/@radix-ui/react-avatar/dist/index.js.map +0 -1
  89. package/dist/shop-minis-react/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +0 -16
  90. package/dist/shop-minis-react/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js.map +0 -1
  91. package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -68
  92. package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +0 -1
  93. package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -56
  94. package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +0 -1
  95. package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/shim/index.js +0 -11
  96. package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/shim/index.js.map +0 -1
  97. package/src/base.css +0 -273
  98. package/tailwind.config.js +0 -3
  99. /package/dist/components/{atoms → ui}/accordion.js +0 -0
  100. /package/dist/components/{atoms → ui}/alert.js +0 -0
  101. /package/dist/components/{atoms → ui}/badge.js +0 -0
  102. /package/dist/components/{atoms → ui}/card.js +0 -0
  103. /package/dist/components/{atoms → ui}/checkbox.js +0 -0
  104. /package/dist/components/{atoms → ui}/dialog.js +0 -0
  105. /package/dist/components/{atoms → ui}/input.js +0 -0
  106. /package/dist/components/{atoms → ui}/label.js +0 -0
  107. /package/dist/components/{atoms → ui}/progress.js +0 -0
  108. /package/dist/components/{atoms → ui}/radio-group.js +0 -0
  109. /package/dist/components/{atoms → ui}/resizable.js +0 -0
  110. /package/dist/components/{atoms → ui}/scroll-area.js +0 -0
  111. /package/dist/components/{atoms → ui}/select.js +0 -0
  112. /package/dist/components/{atoms → ui}/separator.js +0 -0
  113. /package/dist/components/{atoms → ui}/sheet.js +0 -0
  114. /package/dist/components/{atoms → ui}/sonner.js +0 -0
  115. /package/src/components/{atoms → ui}/accordion.tsx +0 -0
  116. /package/src/components/{atoms → ui}/alert.tsx +0 -0
  117. /package/src/components/{atoms → ui}/avatar.tsx +0 -0
  118. /package/src/components/{atoms → ui}/badge.tsx +0 -0
  119. /package/src/components/{atoms → ui}/card.tsx +0 -0
  120. /package/src/components/{atoms → ui}/checkbox.tsx +0 -0
  121. /package/src/components/{atoms → ui}/dialog.tsx +0 -0
  122. /package/src/components/{atoms → ui}/input.tsx +0 -0
  123. /package/src/components/{atoms → ui}/label.tsx +0 -0
  124. /package/src/components/{atoms → ui}/progress.tsx +0 -0
  125. /package/src/components/{atoms → ui}/radio-group.tsx +0 -0
  126. /package/src/components/{atoms → ui}/resizable.tsx +0 -0
  127. /package/src/components/{atoms → ui}/scroll-area.tsx +0 -0
  128. /package/src/components/{atoms → ui}/select.tsx +0 -0
  129. /package/src/components/{atoms → ui}/separator.tsx +0 -0
  130. /package/src/components/{atoms → ui}/sheet.tsx +0 -0
  131. /package/src/components/{atoms → ui}/sonner.tsx +0 -0
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shopify/shop-minis-react",
3
3
  "license": "SEE LICENSE IN LICENSE.txt",
4
- "version": "0.0.16",
4
+ "version": "0.0.17",
5
5
  "sideEffects": false,
6
6
  "type": "module",
7
7
  "engines": {
@@ -18,7 +18,6 @@
18
18
  "files": [
19
19
  "src/**/*.{ts,tsx,css}",
20
20
  "dist/**/*",
21
- "tailwind.config.js",
22
21
  "README.md",
23
22
  "LICENSE.txt"
24
23
  ],
@@ -28,10 +27,8 @@
28
27
  "import": "./src/index.ts",
29
28
  "types": "./src/index.ts"
30
29
  },
31
- "./mocks": "./src/mocks.ts",
32
30
  "./styles": "./src/index.css",
33
- "./tailwind": "./tailwind.config.js",
34
- "./tailwind.config": "./tailwind.config.js",
31
+ "./mocks": "./src/mocks.ts",
35
32
  "./src/*": "./src/*"
36
33
  },
37
34
  "peerDependencies": {
@@ -41,13 +38,14 @@
41
38
  "typescript": ">=5.0.0"
42
39
  },
43
40
  "dependencies": {
41
+ "@shopify/shop-minis-platform": "0.0.3",
44
42
  "@tailwindcss/vite": "4.1.8",
45
43
  "@types/url-parse": "1.4.9",
46
44
  "@vitejs/plugin-react": "4.5.1",
47
- "@shopify/shop-minis-platform": "0.0.3",
48
45
  "class-variance-authority": "0.7.1",
49
46
  "clsx": "2.1.1",
50
47
  "embla-carousel-react": "8.6.0",
48
+ "lodash": "4.17.21",
51
49
  "lucide-react": "0.513.0",
52
50
  "motion": "12.17.3",
53
51
  "next-themes": "0.4.6",
@@ -58,13 +56,12 @@
58
56
  "tailwindcss": "4.1.8",
59
57
  "tw-animate-css": "1.3.4",
60
58
  "url-parse": "1.5.10",
61
- "vaul": "1.1.2",
62
- "lodash": "4.17.21"
59
+ "vaul": "1.1.2"
63
60
  },
64
61
  "devDependencies": {
65
62
  "@shopify/generate-docs": "^0.16.6",
66
63
  "@types/node": "^20.12.1",
67
- "@types/react": "^19.1.2",
64
+ "@types/react": "^19.1.6",
68
65
  "@types/react-dom": "^19.1.2",
69
66
  "react": "^19.1.0",
70
67
  "react-dom": "^19.1.0",
@@ -1,71 +1,13 @@
1
- import * as React from 'react'
1
+ import React from 'react'
2
2
 
3
- import {cva, type VariantProps} from 'class-variance-authority'
4
- import {Slot as SlotPrimitive} from 'radix-ui'
3
+ import {VariantProps} from 'class-variance-authority'
5
4
 
6
5
  import {cn} from '../../lib/utils'
6
+ import {BaseButton, buttonVariants} from '../ui/button'
7
7
 
8
8
  import {Touchable} from './touchable'
9
9
 
10
- const buttonVariants = cva(
11
- "flex w-full items-center justify-center gap-3 whitespace-nowrap rounded-xl text-base font-semibold disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-5 shrink-0 [&_svg]:shrink-0",
12
- {
13
- variants: {
14
- variant: {
15
- primary:
16
- 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
17
- secondary: 'bg-slate-900 text-white shadow-xs hover:bg-slate-800',
18
- tertiary:
19
- 'bg-slate-100 text-slate-900 shadow-xs hover:bg-slate-200 dark:bg-slate-800 dark:text-slate-100 dark:hover:bg-slate-700',
20
- blurred:
21
- 'bg-black/20 text-white shadow-xs hover:bg-black/30 backdrop-blur-md border border-white/20',
22
- text: 'bg-transparent text-foreground hover:bg-accent hover:text-accent-foreground',
23
- borderless: 'bg-transparent text-primary hover:text-primary/80',
24
- borderlessUnbranded:
25
- 'bg-transparent text-foreground hover:text-foreground/80',
26
- outlined:
27
- 'border border-border bg-background text-foreground shadow-xs hover:bg-accent hover:text-accent-foreground',
28
- dangerous:
29
- 'bg-destructive text-white shadow-xs hover:bg-destructive/90',
30
- 'outlined-dangerous':
31
- 'border border-destructive bg-transparent text-destructive shadow-xs hover:bg-destructive/10',
32
- },
33
- size: {
34
- default: 'h-9 px-4 py-2 has-[>svg]:px-3',
35
- sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',
36
- lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
37
- icon: 'size-9',
38
- },
39
- },
40
- defaultVariants: {
41
- variant: 'primary',
42
- size: 'default',
43
- },
44
- }
45
- )
46
-
47
- function BaseButton({
48
- className,
49
- variant,
50
- size,
51
- asChild = false,
52
- ...props
53
- }: React.ComponentProps<'button'> &
54
- VariantProps<typeof buttonVariants> & {
55
- asChild?: boolean
56
- }) {
57
- const Comp = asChild ? SlotPrimitive.Slot : 'button'
58
-
59
- return (
60
- <Comp
61
- data-slot="button"
62
- className={cn(buttonVariants({variant, size, className}))}
63
- {...props}
64
- />
65
- )
66
- }
67
-
68
- function Button({
10
+ export function Button({
69
11
  className,
70
12
  variant,
71
13
  size,
@@ -81,14 +23,18 @@ function Button({
81
23
  [onClick]
82
24
  )
83
25
 
26
+ const wrapperClassName = cn(
27
+ variant === 'icon' ? 'flex w-auto' : 'flex w-full'
28
+ )
29
+
84
30
  return (
85
31
  <Touchable
86
32
  onClick={handleClick}
87
33
  stopPropagation={stopPropagation}
88
- className={size === 'icon' ? 'flex w-auto' : 'flex w-full'}
34
+ className={wrapperClassName}
89
35
  >
90
36
  <BaseButton
91
- className={className}
37
+ className={cn(className, wrapperClassName)}
92
38
  variant={variant}
93
39
  size={size}
94
40
  {...props}
@@ -96,5 +42,3 @@ function Button({
96
42
  </Touchable>
97
43
  )
98
44
  }
99
-
100
- export {Button, buttonVariants}
@@ -0,0 +1,22 @@
1
+ import {Heart} from 'lucide-react'
2
+
3
+ import {IconButton} from './icon-button'
4
+
5
+ export function FavoriteButton({
6
+ onClick,
7
+ filled = false,
8
+ }: {
9
+ onClick?: () => void
10
+ filled?: boolean
11
+ }) {
12
+ return (
13
+ <IconButton
14
+ Icon={Heart}
15
+ filled={filled}
16
+ onClick={onClick}
17
+ buttonStyles={
18
+ filled ? 'bg-primary' : 'bg-button-overlay/30 backdrop-blur-sm'
19
+ }
20
+ />
21
+ )
22
+ }
@@ -0,0 +1,42 @@
1
+ import {LucideIcon} from 'lucide-react'
2
+
3
+ import {cn} from '../../lib/utils'
4
+
5
+ import {Button} from './button'
6
+
7
+ export function IconButton({
8
+ onClick,
9
+ filled = false,
10
+ size = 'default',
11
+ Icon,
12
+ buttonStyles,
13
+ iconStyles,
14
+ }: {
15
+ onClick?: () => void
16
+ filled?: boolean
17
+ size?: 'default' | 'sm' | 'lg'
18
+ Icon: LucideIcon
19
+ buttonStyles?: string
20
+ iconStyles?: string
21
+ }) {
22
+ const sizeMap = {
23
+ sm: 'size-3',
24
+ default: 'size-4',
25
+ lg: 'size-6',
26
+ }
27
+
28
+ return (
29
+ <Button
30
+ onClick={onClick}
31
+ variant="icon"
32
+ size={size}
33
+ className={cn('bg-primary', buttonStyles)}
34
+ stopPropagation
35
+ >
36
+ <Icon
37
+ fill={filled ? 'currentColor' : 'none'}
38
+ className={cn('text-primary-foreground', sizeMap[size], iconStyles)}
39
+ />
40
+ </Button>
41
+ )
42
+ }
@@ -14,6 +14,10 @@ export const Touchable = ({
14
14
  const ref = React.useRef<HTMLDivElement>(null)
15
15
  const controls = useAnimationControls()
16
16
 
17
+ // Filter out props that shouldn't be passed to motion.div
18
+ // Any other custom props that get added to the component interface should be filtered here
19
+ const {ref: _, ...motionProps} = props
20
+
17
21
  const handleClick = React.useCallback(
18
22
  (event: React.MouseEvent<HTMLDivElement>) => {
19
23
  if (stopPropagation) event.stopPropagation()
@@ -75,7 +79,7 @@ export const Touchable = ({
75
79
  style={{
76
80
  touchAction: stopPropagation ? 'manipulation' : undefined,
77
81
  }}
78
- {...props} // TODO: We may need to filter out some props, as we only need motion props
82
+ {...motionProps}
79
83
  >
80
84
  {children}
81
85
  </motion.div>
@@ -250,15 +250,4 @@ export const MerchantCardPrimitive = Object.assign(MerchantCardRoot, {
250
250
  Rating: MerchantCardRating,
251
251
  })
252
252
 
253
- export {
254
- // Composed component
255
- MerchantCard,
256
- // Primitive components for custom composition
257
- MerchantCardRoot,
258
- MerchantCardImageContainer,
259
- MerchantCardImage,
260
- MerchantCardLogo,
261
- MerchantCardInfo,
262
- MerchantCardName,
263
- MerchantCardRating,
264
- }
253
+ export {MerchantCard}
@@ -9,9 +9,9 @@ import {useShopNavigation} from '../../hooks/navigation/useShopNavigation'
9
9
  import {useSavedProductsActions} from '../../hooks/user/useSavedProductsActions'
10
10
  import {formatMoney} from '../../lib/formatMoney'
11
11
  import {cn} from '../../lib/utils'
12
- import {Badge} from '../atoms/badge'
13
- import {Button} from '../atoms/button'
12
+ import {FavoriteButton} from '../atoms/favorite-button'
14
13
  import {Touchable} from '../atoms/touchable'
14
+ import {Badge} from '../ui/badge'
15
15
 
16
16
  const productCardVariants = cva(
17
17
  'relative w-full overflow-hidden rounded-xl border border-gray-200',
@@ -167,21 +167,7 @@ function ProductCardFavoriteButton({
167
167
  }) {
168
168
  return (
169
169
  <div className={cn('absolute bottom-3 right-3 z-10', className)} {...props}>
170
- <Button
171
- onClick={onPress}
172
- variant="secondary"
173
- size="icon"
174
- className={cn(
175
- 'h-8 w-8 rounded-full border-0 shadow-sm',
176
- filled ? 'bg-primary' : 'bg-grayscale-l6/60 backdrop-blur-sm'
177
- )}
178
- stopPropagation
179
- >
180
- <Heart
181
- fill={filled ? 'currentColor' : 'none'}
182
- className="h-4 w-4 text-white"
183
- />
184
- </Button>
170
+ <FavoriteButton onClick={onPress} filled={filled} />
185
171
  </div>
186
172
  )
187
173
  }
@@ -416,18 +402,4 @@ function ProductCard({
416
402
  )
417
403
  }
418
404
 
419
- export {
420
- // Composed component
421
- ProductCard,
422
- // Primitive components for custom composition
423
- ProductCardRoot,
424
- ProductCardImageContainer,
425
- ProductCardImage,
426
- ProductCardBadge,
427
- ProductCardFavoriteButton,
428
- ProductCardInfo,
429
- ProductCardTitle,
430
- ProductCardPrice,
431
- ProductCardCurrentPrice,
432
- ProductCardOriginalPrice,
433
- }
405
+ export {ProductCard}
@@ -2,16 +2,16 @@ import * as React from 'react'
2
2
 
3
3
  import {type Product} from '@shopify/shop-minis-platform'
4
4
  import {cva, type VariantProps} from 'class-variance-authority'
5
- import {Heart, Star} from 'lucide-react'
5
+ import {Star} from 'lucide-react'
6
6
  import {Slot as SlotPrimitive} from 'radix-ui'
7
7
 
8
8
  import {useShopNavigation} from '../../hooks/navigation/useShopNavigation'
9
9
  import {useSavedProductsActions} from '../../hooks/user/useSavedProductsActions'
10
10
  import {formatMoney} from '../../lib/formatMoney'
11
11
  import {cn} from '../../lib/utils'
12
- import {Button} from '../atoms/button'
13
- import {Card, CardContent, CardAction} from '../atoms/card'
12
+ import {FavoriteButton} from '../atoms/favorite-button'
14
13
  import {Touchable} from '../atoms/touchable'
14
+ import {Card, CardContent, CardAction} from '../ui/card'
15
15
 
16
16
  const productLinkVariants = cva('', {
17
17
  variants: {
@@ -193,11 +193,11 @@ function ProductLinkRating({className, ...props}: React.ComponentProps<'div'>) {
193
193
 
194
194
  function ProductLinkActions({
195
195
  className,
196
- onActionPress,
196
+ onPress,
197
197
  filled = false,
198
198
  ...props
199
199
  }: React.ComponentProps<typeof CardAction> & {
200
- onActionPress?: () => void
200
+ onPress?: () => void
201
201
  filled?: boolean
202
202
  }) {
203
203
  return (
@@ -207,20 +207,14 @@ function ProductLinkActions({
207
207
  >
208
208
  <Touchable
209
209
  stopPropagation
210
- onClick={onActionPress}
210
+ onClick={onPress}
211
211
  whileTap={{opacity: 0.7, scale: 0.95}}
212
212
  transition={{
213
213
  opacity: {type: 'tween', duration: 0.08, ease: 'easeInOut'},
214
214
  scale: {type: 'tween', duration: 0.08, ease: 'easeInOut'},
215
215
  }}
216
216
  >
217
- <Button
218
- variant="borderless"
219
- size="icon"
220
- className="h-auto w-auto p-0 hover:bg-transparent"
221
- >
222
- <Heart fill={filled ? 'currentColor' : 'none'} className="h-4 w-4" />
223
- </Button>
217
+ <FavoriteButton filled={filled} onClick={onPress} />
224
218
  </Touchable>
225
219
  </CardAction>
226
220
  )
@@ -368,24 +362,10 @@ function ProductLink({product}: ProductLinkProps) {
368
362
 
369
363
  <ProductLinkActions
370
364
  filled={isFavoritedLocal}
371
- onActionPress={handleActionPress}
365
+ onPress={handleActionPress}
372
366
  />
373
367
  </ProductLinkRoot>
374
368
  )
375
369
  }
376
370
 
377
- export {
378
- // Composed component
379
- ProductLink,
380
- // Primitive components for custom composition
381
- ProductLinkRoot,
382
- ProductLinkImage,
383
- ProductLinkInfo,
384
- ProductLinkTitle,
385
- ProductLinkPrice,
386
- ProductLinkCurrentPrice,
387
- ProductLinkOriginalPrice,
388
- ProductLinkDiscountPrice,
389
- ProductLinkRating,
390
- ProductLinkActions,
391
- }
371
+ export {ProductLink}
@@ -4,24 +4,26 @@ export * from './commerce/product-card'
4
4
  export * from './commerce/product-link'
5
5
  export * from './commerce/merchant-card'
6
6
 
7
- export * from './atoms/accordion'
8
- export * from './atoms/alert'
9
- export * from './atoms/alert-dialog'
10
- export * from './atoms/avatar'
11
- export * from './atoms/badge'
12
7
  export * from './atoms/button'
13
- export * from './atoms/card'
14
- export * from './atoms/carousel'
15
- export * from './atoms/checkbox'
16
- export * from './atoms/dialog'
17
- export * from './atoms/drawer'
18
- export * from './atoms/input'
19
- export * from './atoms/label'
20
- export * from './atoms/progress'
21
- export * from './atoms/radio-group'
22
- export * from './atoms/resizable'
23
- export * from './atoms/scroll-area'
24
- export * from './atoms/select'
25
- export * from './atoms/separator'
26
- export * from './atoms/sheet'
27
- export * from './atoms/sonner'
8
+ export * from './atoms/favorite-button'
9
+ export * from './atoms/icon-button'
10
+ export * from './atoms/touchable'
11
+
12
+ export * from './ui/accordion'
13
+ export * from './ui/alert'
14
+ export * from './ui/alert-dialog'
15
+ export * from './ui/card'
16
+ export * from './ui/carousel'
17
+ export * from './ui/checkbox'
18
+ export * from './ui/dialog'
19
+ export * from './ui/drawer'
20
+ export * from './ui/input'
21
+ export * from './ui/label'
22
+ export * from './ui/progress'
23
+ export * from './ui/radio-group'
24
+ export * from './ui/resizable'
25
+ export * from './ui/scroll-area'
26
+ export * from './ui/select'
27
+ export * from './ui/separator'
28
+ export * from './ui/sheet'
29
+ export * from './ui/sonner'
@@ -130,7 +130,7 @@ function AlertDialogCancel({
130
130
  }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
131
131
  return (
132
132
  <AlertDialogPrimitive.Cancel
133
- className={cn(buttonVariants({variant: 'outlined'}), className)}
133
+ className={cn(buttonVariants({variant: 'outline'}), className)}
134
134
  {...props}
135
135
  />
136
136
  )
@@ -0,0 +1,77 @@
1
+ import * as React from 'react'
2
+
3
+ import {cva, type VariantProps} from 'class-variance-authority'
4
+ import {Slot as SlotPrimitive} from 'radix-ui'
5
+
6
+ import {cn} from '../../lib/utils'
7
+
8
+ const buttonVariants = cva(
9
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:bg-disabled disabled:text-disabled-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none aria-invalid:border-destructive",
10
+ {
11
+ variants: {
12
+ variant: {
13
+ default: 'bg-primary text-primary-foreground',
14
+ secondary: 'bg-secondary text-secondary-foreground',
15
+ tertiary: 'bg-tertiary text-tertiary-foreground',
16
+ destructive: 'bg-destructive text-white dark:bg-destructive/60',
17
+ outline: 'border bg-background dark:bg-input/30 dark:border-input',
18
+ ghost: '',
19
+ link: 'text-primary underline-offset-4',
20
+ icon: 'flex rounded-full items-center justify-center p-0 aspect-square',
21
+ },
22
+ size: {
23
+ default:
24
+ 'min-h-[32px] rounded-lg px-3 py-2 text-sm leading-[18px] has-[>svg]:px-3',
25
+ sm: 'min-h-[20px] rounded-lg gap-1.5 px-3 py-1 text-xs leading-4 has-[>svg]:px-2.5',
26
+ lg: 'min-h-[44px] rounded-xl px-3 py-3 text-base leading-6 has-[>svg]:px-4',
27
+ },
28
+ },
29
+ compoundVariants: [
30
+ {
31
+ variant: 'icon',
32
+ size: 'default',
33
+ className:
34
+ 'size-8 min-h-0 p-0 rounded-full gap-0 px-0 py-0 has-[>svg]:px-0',
35
+ },
36
+ {
37
+ variant: 'icon',
38
+ size: 'sm',
39
+ className:
40
+ 'size-6 min-h-0 p-0 rounded-full gap-0 px-0 py-0 has-[>svg]:px-0',
41
+ },
42
+ {
43
+ variant: 'icon',
44
+ size: 'lg',
45
+ className:
46
+ 'size-10 min-h-0 p-0 rounded-full gap-0 px-0 py-0 has-[>svg]:px-0',
47
+ },
48
+ ],
49
+ defaultVariants: {
50
+ variant: 'default',
51
+ size: 'default',
52
+ },
53
+ }
54
+ )
55
+
56
+ function BaseButton({
57
+ className,
58
+ variant,
59
+ size,
60
+ asChild = false,
61
+ ...props
62
+ }: React.ComponentProps<'button'> &
63
+ VariantProps<typeof buttonVariants> & {
64
+ asChild?: boolean
65
+ }) {
66
+ const Comp = asChild ? SlotPrimitive.Slot : 'button'
67
+
68
+ return (
69
+ <Comp
70
+ data-slot="button"
71
+ className={cn(buttonVariants({variant, size, className}))}
72
+ {...props}
73
+ />
74
+ )
75
+ }
76
+
77
+ export {BaseButton, buttonVariants}
@@ -7,7 +7,7 @@ import {ArrowLeft, ArrowRight} from 'lucide-react'
7
7
 
8
8
  import {cn} from '../../lib/utils'
9
9
 
10
- import {Button} from './button'
10
+ import {BaseButton} from './button'
11
11
 
12
12
  type CarouselApi = UseEmblaCarouselType[1]
13
13
  type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
@@ -173,14 +173,14 @@ function CarouselItem({className, ...props}: React.ComponentProps<'div'>) {
173
173
 
174
174
  function CarouselPrevious({
175
175
  className,
176
- variant = 'outlined',
177
- size = 'icon',
176
+ variant = 'icon',
177
+ size = 'default',
178
178
  ...props
179
- }: React.ComponentProps<typeof Button>) {
179
+ }: React.ComponentProps<typeof BaseButton>) {
180
180
  const {orientation, scrollPrev, canScrollPrev} = useCarousel()
181
181
 
182
182
  return (
183
- <Button
183
+ <BaseButton
184
184
  data-slot="carousel-previous"
185
185
  variant={variant}
186
186
  size={size}
@@ -197,20 +197,20 @@ function CarouselPrevious({
197
197
  >
198
198
  <ArrowLeft />
199
199
  <span className="sr-only">Previous slide</span>
200
- </Button>
200
+ </BaseButton>
201
201
  )
202
202
  }
203
203
 
204
204
  function CarouselNext({
205
205
  className,
206
- variant = 'outlined',
207
- size = 'icon',
206
+ variant = 'icon',
207
+ size = 'default',
208
208
  ...props
209
- }: React.ComponentProps<typeof Button>) {
209
+ }: React.ComponentProps<typeof BaseButton>) {
210
210
  const {orientation, scrollNext, canScrollNext} = useCarousel()
211
211
 
212
212
  return (
213
- <Button
213
+ <BaseButton
214
214
  data-slot="carousel-next"
215
215
  variant={variant}
216
216
  size={size}
@@ -227,7 +227,7 @@ function CarouselNext({
227
227
  >
228
228
  <ArrowRight />
229
229
  <span className="sr-only">Next slide</span>
230
- </Button>
230
+ </BaseButton>
231
231
  )
232
232
  }
233
233
 
@@ -48,7 +48,8 @@ function DrawerContent({
48
48
  ...props
49
49
  }: React.ComponentProps<typeof DrawerPrimitive.Content>) {
50
50
  return (
51
- <DrawerPortal data-slot="drawer-portal">
51
+ // vaul's Portal type incorrectly excludes children
52
+ <DrawerPortal {...({} as any)}>
52
53
  <DrawerOverlay />
53
54
  <DrawerPrimitive.Content
54
55
  data-slot="drawer-content"
package/src/index.css CHANGED
@@ -1,2 +1,8 @@
1
- @import './base.css';
2
- @source '../node_modules/@shopify/shop-minis-react/src/**/*.{js,ts,jsx,tsx}';
1
+ @import 'tailwindcss';
2
+ @import 'tw-animate-css';
3
+
4
+ @import './styles/theme.css';
5
+ @import './styles/globals.css';
6
+
7
+ /* When consumed as npm package, this path resolves from the consuming app's location */
8
+ @source '../node_modules/@shopify/shop-minis-react/src';
@@ -0,0 +1,41 @@
1
+ /* Global styles and browser behavior */
2
+
3
+ /* Essential base styles */
4
+ @layer base {
5
+ * {
6
+ @apply border-border outline-ring/50;
7
+ }
8
+ body {
9
+ @apply bg-background text-foreground;
10
+ }
11
+ }
12
+
13
+ /* Touch and selection styles */
14
+ html,
15
+ body {
16
+ touch-action: manipulation;
17
+ }
18
+
19
+ /* Disable text selection */
20
+ body {
21
+ -webkit-user-select: none;
22
+ -moz-user-select: none;
23
+ -ms-user-select: none;
24
+ user-select: none;
25
+ }
26
+
27
+ /* Re-enable text selection for input fields */
28
+ input,
29
+ textarea {
30
+ -webkit-user-select: text;
31
+ -moz-user-select: text;
32
+ -ms-user-select: text;
33
+ user-select: text;
34
+ }
35
+
36
+ /* Disable image drag */
37
+ img,
38
+ .no-drag {
39
+ -webkit-user-drag: none;
40
+ user-drag: none;
41
+ }