@hanzo/commerce 7.0.9 → 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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/commerce",
3
- "version": "7.0.9",
3
+ "version": "7.0.10",
4
4
  "description": "e-commerce framework.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",