@hanzo/commerce 7.0.8 → 7.0.10

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.
@@ -15,7 +15,7 @@ const AddToCartWidget: React.FC<{
15
15
  disabled?: boolean
16
16
  className?: string
17
17
  buttonClx?: string
18
- variant?: 'minimal' | 'primary' | 'outline'
18
+ variant?: 'minimal' | 'primary' | 'primary-smaller' | 'outline'
19
19
  onQuantityChanged?: (sku: string, oldV: number, newV: number) => void
20
20
  }> = observer(({
21
21
  item,
@@ -50,8 +50,9 @@ const AddToCartWidget: React.FC<{
50
50
  const ghost = variant === 'minimal'
51
51
  const outline = variant === 'outline'
52
52
  const primary = variant === 'primary'
53
+ const priSmaller = variant === 'primary-smaller'
53
54
 
54
- let iconClx = ghost ? 'h-4 w-4 md:h-3 md:w-3 text-muted-3 ' : 'h-5 w-7 px-1 opacity-70 '
55
+ let iconClx = ghost ? 'h-4 w-4 md:h-3 md:w-3 text-muted-3 ' : (priSmaller ? 'h-4 w-6 px-0.5 opacity-70' : 'h-5 w-7 px-1 opacity-70 ')
55
56
  iconClx += ghost ? 'group-hover:text-foreground' : 'group-hover:opacity-100'
56
57
 
57
58
  let digitClx = ghost ? 'px-2 md:px-0.5 ' : 'sm:px-2 font-semibold '
@@ -59,7 +60,7 @@ const AddToCartWidget: React.FC<{
59
60
 
60
61
  if (disabled) {
61
62
  return (
62
- <div className={cn('flex flex-row items-stretch' + ROUNDED_CLX + (!primary ? 'bg-transparent' : 'bg-primary'), className)}>
63
+ <div className={cn('flex flex-row items-stretch' + ROUNDED_CLX + (!(primary || priSmaller) ? 'bg-transparent' : 'bg-primary'), className)}>
63
64
  <div className={'text-sm flex items-center cursor-default ' + digitClx} >{item.quantity}</div>
64
65
  </div>
65
66
  )
@@ -109,20 +110,20 @@ const AddToCartWidget: React.FC<{
109
110
  <div className={cn(
110
111
  'flex flex-row items-stretch justify-between ',
111
112
  // should match 'xs' and 'default' button heights
112
- (ghost ? 'h-8' : 'h-10'),
113
+ (ghost || priSmaller ? 'h-8' : 'h-9'),
113
114
  ROUNDED_CLX,
114
- (primary ? 'bg-primary' : 'bg-transparent'),
115
+ (primary || priSmaller ? 'bg-primary' : 'bg-transparent'),
115
116
  (outline ? 'border border-muted' : ''),
116
117
  className
117
118
  )}>
118
119
  <Button
119
120
  aria-label={'Remove a ' + item.title + ' from the cart'}
120
- size={ghost ? 'xs' : 'default'}
121
- variant={primary ? 'primary' : 'ghost'}
121
+ size={ghost || priSmaller ? 'xs' : 'default'}
122
+ variant={primary || priSmaller ? 'primary' : 'ghost'}
122
123
  rounded={ghost ? 'full' : ROUNDED_VAL}
123
124
  className={cn(
124
125
  'lg:min-w-0 lg:px-2 grow justify-start group',
125
- (ghost ? 'px-1' : 'px-2'),
126
+ (ghost || priSmaller ? 'px-1' : 'px-2'),
126
127
  (outline ? 'hover:bg-transparent' : ''),
127
128
  buttonClx,
128
129
  'h-auto self-stretch' // must be smaller than normal
@@ -136,15 +137,22 @@ const AddToCartWidget: React.FC<{
136
137
  <Icons.trash className={iconClx} aria-hidden='true'/>
137
138
  )}
138
139
  </Button>
139
- <div className={'text-sm grow-0 shrink-0 flex items-center cursor-default xs:px-2 ' + digitClx} >{item.quantity}{ghost ? '' : ' in Bag'}</div>
140
+ <div className={cn(
141
+ 'grow-0 shrink-0 flex items-center cursor-default xs:px-2',
142
+ priSmaller ? 'text-xs' : 'text-sm',
143
+ digitClx
144
+ )}>
145
+ {item.quantity}{ghost ? '' : ' in Bag'}
146
+ </div>
140
147
  <Button
141
148
  aria-label={'Add another ' + item.title + ' to the cart'}
142
- size={ghost ? 'xs' : 'default'}
143
- variant={primary ? 'primary' : 'ghost'}
149
+ size={ghost || priSmaller ? 'xs' : 'default'}
150
+
151
+ variant={primary || priSmaller ? 'primary' : 'ghost'}
144
152
  rounded={ghost ? 'full' : ROUNDED_VAL}
145
153
  className={cn(
146
154
  'lg:min-w-0 lg:px-2 grow justify-end group',
147
- (ghost ? 'px-1' : 'px-2'),
155
+ (ghost || priSmaller ? 'px-1' : 'px-2'),
148
156
  (outline ? 'hover:bg-transparent' : ''),
149
157
  buttonClx,
150
158
  'h-auto self-stretch' // must be smaller than normal
@@ -158,8 +166,8 @@ const AddToCartWidget: React.FC<{
158
166
  ) : (
159
167
  <Button
160
168
  aria-label={'Add a ' + item.title + ' to cart'}
161
- size={ghost ? 'xs' : 'default'}
162
- variant={variant === 'minimal' ? 'ghost' : (variant as VariantProps<typeof buttonVariants>['variant'])}
169
+ size={ghost || priSmaller ? 'xs' : 'default'}
170
+ variant={ghost ? 'ghost' : (primary || priSmaller ? 'primary' : 'outline')}
163
171
  rounded={ROUNDED_VAL}
164
172
  className={cn(buttonClx, className)}
165
173
  onClick={inc}
@@ -214,8 +214,8 @@ const CarouselBuyCard: React.FC<{
214
214
  return (
215
215
  <div className={cn(
216
216
  'px-4 md:px-6 pt-3 pb-4 flex flex-col gap-1 items-center',
217
+ r.current?.single?.scrollable ? SCROLL.scrollHeightClx : 'h-auto',
217
218
  clx,
218
- r.current?.single?.scrollable ? SCROLL.scrollHeightClx : 'h-auto'
219
219
  )}>
220
220
  {r.current?.single ? (
221
221
  <SingleFamilySelector
@@ -81,7 +81,7 @@ const CartPanel: React.FC<PropsWithChildren & {
81
81
  cmmc.setCurrentItem(item.sku)
82
82
  }
83
83
 
84
- const Main: React.FC = observer(() => (<>
84
+ const MainStuff: React.FC = observer(() => (<>
85
85
  {cmmc.cartEmpty ? (
86
86
  <p className={cn('text-center my-3', noItemsClx)}>No items</p>
87
87
  ) : (<>
@@ -135,11 +135,11 @@ const CartPanel: React.FC<PropsWithChildren & {
135
135
  {children}
136
136
  {scrolling() ? (
137
137
  <ScrollArea className={cn('mt-2 w-full shrink py-0', listClx)}>
138
- <Main />
138
+ <MainStuff />
139
139
  </ScrollArea>
140
140
  ) : (
141
141
  <div className={cn('mt-2 w-full', listClx)}>
142
- <Main />
142
+ <MainStuff />
143
143
  </div>
144
144
  )}
145
145
  {handleCheckout && !cmmc.cartEmpty && (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/commerce",
3
- "version": "7.0.8",
3
+ "version": "7.0.10",
4
4
  "description": "e-commerce framework.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@hanzo/auth": "^2.4.10",
39
- "@hanzo/ui": "^3.8.7",
39
+ "@hanzo/ui": "^3.8.15",
40
40
  "@hookform/resolvers": "^3.3.4",
41
41
  "@radix-ui/react-radio-group": "^1.1.3",
42
42
  "firebase": "^10.8.0",