@hanzo/commerce 7.6.4 → 7.7.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 (87) hide show
  1. package/components/add-to-cart-widget.tsx +19 -13
  2. package/components/buy/buy-card.tsx +17 -7
  3. package/components/buy/carousel-buy-card.tsx +3 -2
  4. package/components/buy/multi-family/all-variants-carousel.tsx +3 -5
  5. package/components/buy/multi-family/family-carousel/index.tsx +2 -4
  6. package/components/buy/multi-family/family-carousel/slide.tsx +3 -4
  7. package/components/buy/single-family-selector.tsx +6 -5
  8. package/components/buy/title-and-byline.tsx +4 -3
  9. package/components/cart/cart-panel/cart-line-item.tsx +5 -4
  10. package/components/cart/cart-panel/index.tsx +7 -4
  11. package/components/cart/cart-panel/promo-code.tsx +3 -7
  12. package/components/cart/cart-panel/total-area.tsx +3 -2
  13. package/components/checkout/payment-step-form/cc-button.tsx +3 -2
  14. package/components/checkout/payment-step-form/contact-form.tsx +2 -4
  15. package/components/checkout/payment-step-form/index.tsx +6 -2
  16. package/components/checkout/payment-step-form/methods/bank-transfer.tsx +4 -2
  17. package/components/checkout/payment-step-form/methods/card.tsx +2 -4
  18. package/components/checkout/payment-step-form/methods/crypto.tsx +12 -13
  19. package/components/checkout/shipping-step-form.tsx +2 -6
  20. package/components/item/product-card.tsx +9 -8
  21. package/components/item-selector/button.tsx +37 -12
  22. package/components/item-selector/carousel/index.tsx +4 -5
  23. package/components/item-selector/carousel/slider.tsx +4 -7
  24. package/components/item-selector/quantity-indicator.tsx +3 -1
  25. package/components/node-tabs/index.tsx +39 -40
  26. package/dist/client.js.map +1 -1
  27. package/dist/components/Icons.d.ts +15 -15
  28. package/dist/components/add-to-cart-widget.js +13 -9
  29. package/dist/components/add-to-cart-widget.js.map +1 -1
  30. package/dist/components/buy/buy-card.js +13 -6
  31. package/dist/components/buy/buy-card.js.map +1 -1
  32. package/dist/components/buy/carousel-buy-card.js +1 -1
  33. package/dist/components/buy/carousel-buy-card.js.map +1 -1
  34. package/dist/components/buy/multi-family/all-variants-carousel.js +3 -4
  35. package/dist/components/buy/multi-family/all-variants-carousel.js.map +1 -1
  36. package/dist/components/buy/multi-family/family-carousel/index.js +1 -2
  37. package/dist/components/buy/multi-family/family-carousel/index.js.map +1 -1
  38. package/dist/components/buy/multi-family/family-carousel/slide.js +1 -2
  39. package/dist/components/buy/multi-family/family-carousel/slide.js.map +1 -1
  40. package/dist/components/buy/single-family-selector.js +2 -3
  41. package/dist/components/buy/single-family-selector.js.map +1 -1
  42. package/dist/components/buy/title-and-byline.js +1 -2
  43. package/dist/components/buy/title-and-byline.js.map +1 -1
  44. package/dist/components/cart/cart-panel/cart-line-item.js +3 -4
  45. package/dist/components/cart/cart-panel/cart-line-item.js.map +1 -1
  46. package/dist/components/cart/cart-panel/index.js +3 -4
  47. package/dist/components/cart/cart-panel/index.js.map +1 -1
  48. package/dist/components/cart/cart-panel/promo-code.js +1 -2
  49. package/dist/components/cart/cart-panel/promo-code.js.map +1 -1
  50. package/dist/components/cart/cart-panel/total-area.js +1 -1
  51. package/dist/components/cart/cart-panel/total-area.js.map +1 -1
  52. package/dist/components/checkout/payment-step-form/cc-button.js +1 -1
  53. package/dist/components/checkout/payment-step-form/cc-button.js.map +1 -1
  54. package/dist/components/checkout/payment-step-form/contact-form.js +1 -2
  55. package/dist/components/checkout/payment-step-form/contact-form.js.map +1 -1
  56. package/dist/components/checkout/payment-step-form/index.js +1 -1
  57. package/dist/components/checkout/payment-step-form/index.js.map +1 -1
  58. package/dist/components/checkout/payment-step-form/methods/bank-transfer.js +1 -1
  59. package/dist/components/checkout/payment-step-form/methods/bank-transfer.js.map +1 -1
  60. package/dist/components/checkout/payment-step-form/methods/card.js +1 -2
  61. package/dist/components/checkout/payment-step-form/methods/card.js.map +1 -1
  62. package/dist/components/checkout/payment-step-form/methods/crypto.js +2 -2
  63. package/dist/components/checkout/payment-step-form/methods/crypto.js.map +1 -1
  64. package/dist/components/checkout/shipping-step-form.js +1 -2
  65. package/dist/components/checkout/shipping-step-form.js.map +1 -1
  66. package/dist/components/item/product-card.js +2 -3
  67. package/dist/components/item/product-card.js.map +1 -1
  68. package/dist/components/item-selector/button.js +28 -5
  69. package/dist/components/item-selector/button.js.map +1 -1
  70. package/dist/components/item-selector/carousel/index.d.ts +1 -1
  71. package/dist/components/item-selector/carousel/index.js +3 -4
  72. package/dist/components/item-selector/carousel/index.js.map +1 -1
  73. package/dist/components/item-selector/carousel/slider.js +2 -2
  74. package/dist/components/item-selector/carousel/slider.js.map +1 -1
  75. package/dist/components/item-selector/quantity-indicator.js +1 -1
  76. package/dist/components/item-selector/quantity-indicator.js.map +1 -1
  77. package/dist/components/node-tabs/index.d.ts +6 -1
  78. package/dist/components/node-tabs/index.js +13 -24
  79. package/dist/components/node-tabs/index.js.map +1 -1
  80. package/dist/metering.js.map +1 -1
  81. package/dist/service/debug.js.map +1 -1
  82. package/dist/util/item-selector-options-accessor.d.ts +1 -1
  83. package/dist/util/item-selector-options-accessor.js.map +1 -1
  84. package/dist/util/multi-family-selector-options-accessor.d.ts +1 -1
  85. package/dist/util/multi-family-selector-options-accessor.js.map +1 -1
  86. package/package.json +4 -4
  87. package/hanzo-ui.d.ts +0 -108
@@ -3,9 +3,12 @@ import React, { useEffect, useRef } from 'react'
3
3
  import { reaction, type IReactionDisposer } from 'mobx'
4
4
  import { observer } from 'mobx-react-lite'
5
5
 
6
- import { Button, buttonVariants } from '@hanzo/ui/primitives'
7
- import { cn, type VariantProps } from '@hanzo/ui/util'
8
-
6
+ import {
7
+ Button,
8
+ buttonVariants,
9
+ cn,
10
+ sx,
11
+ } from '@hanzo/ui'
9
12
  import Icons from './Icons'
10
13
  import type { LineItem } from '../types'
11
14
  import { sendFBEvent, sendGAEvent } from '../util/analytics'
@@ -43,9 +46,12 @@ const AddToCartWidget: React.FC<{
43
46
  }
44
47
  }, [])
45
48
 
46
- const ROUNDED_VAL = 'lg'
47
- // no need to safelist, since its used widely
48
- const ROUNDED_CLX = ` rounded-${ROUNDED_VAL} `
49
+ // `rounded-lg` written out, not interpolated. The note that used to sit here
50
+ // said safelisting was unnecessary "since its used widely" — which is true
51
+ // only for as long as some OTHER file in whatever the consumer scans spells it
52
+ // literally. Tailwind reads source text; a template literal is not a class
53
+ // name, so this one was borrowing a rule it did not ask for.
54
+ const ROUNDED_CLX = ' rounded-lg ' // the class
49
55
 
50
56
  const ghost = variant === 'minimal'
51
57
  const outline = variant === 'outline'
@@ -111,7 +117,7 @@ const AddToCartWidget: React.FC<{
111
117
  return ( item.isInCart ? (
112
118
  <div className={cn(
113
119
  'flex flex-row items-stretch justify-between ',
114
- // should match 'xs' and 'default' button heights
120
+ // should match 'sm' and 'default' button heights
115
121
  (ghost || priSmaller ? 'h-8' : 'h-9'),
116
122
  ROUNDED_CLX,
117
123
  (primary || priSmaller ? 'bg-primary' : 'bg-transparent'),
@@ -120,9 +126,9 @@ const AddToCartWidget: React.FC<{
120
126
  )}>
121
127
  <Button
122
128
  aria-label={'Remove a ' + item.title + ' from the cart'}
123
- size={ghost || priSmaller ? 'xs' : 'default'}
129
+ size={ghost || priSmaller ? 'sm' : 'default'}
124
130
  variant={primary || priSmaller ? 'primary' : 'ghost'}
125
- rounded={ghost ? 'full' : ROUNDED_VAL}
131
+ {...sx(ghost ? 'rounded-full' : 'rounded-lg')}
126
132
  className={cn(
127
133
  'lg:min-w-0 lg:px-2 grow justify-start group',
128
134
  (ghost || priSmaller ? 'px-1' : 'px-2'),
@@ -151,10 +157,10 @@ const AddToCartWidget: React.FC<{
151
157
  itemProp='potentialAction'
152
158
  itemScope
153
159
  itemType='https://schema.org/AddAction'
154
- size={ghost || priSmaller ? 'xs' : 'default'}
160
+ size={ghost || priSmaller ? 'sm' : 'default'}
155
161
 
156
162
  variant={primary || priSmaller ? 'primary' : 'ghost'}
157
- rounded={ghost ? 'full' : ROUNDED_VAL}
163
+ {...sx(ghost ? 'rounded-full' : 'rounded-lg')}
158
164
  className={cn(
159
165
  'lg:min-w-0 lg:px-2 grow justify-end group',
160
166
  (ghost || priSmaller ? 'px-1' : 'px-2'),
@@ -174,9 +180,9 @@ const AddToCartWidget: React.FC<{
174
180
  itemProp='potentialAction'
175
181
  itemScope
176
182
  itemType='https://schema.org/AddAction'
177
- size={ghost || priSmaller ? 'xs' : 'default'}
183
+ size={ghost || priSmaller ? 'sm' : 'default'}
178
184
  variant={ghost ? 'ghost' : (primary || priSmaller ? 'primary' : 'outline')}
179
- rounded={ROUNDED_VAL}
185
+ {...sx('rounded-lg')}
180
186
  className={cn(buttonClx, className)}
181
187
  onClick={inc}
182
188
  >
@@ -3,9 +3,11 @@ import React, { useRef, useEffect, type ComponentType } from 'react'
3
3
  import { reaction, type IReactionDisposer } from 'mobx'
4
4
  import { observer } from 'mobx-react-lite'
5
5
 
6
- import { cn } from '@hanzo/ui/util'
7
- import { ApplyTypography, MediaStack } from '@hanzo/ui/primitives'
8
-
6
+ import {
7
+ cn,
8
+ ApplyTypography,
9
+ MediaStack,
10
+ } from '@hanzo/ui'
9
11
  import type {
10
12
  ItemSelectorProps,
11
13
  ItemSelectorCompProps,
@@ -207,11 +209,19 @@ const BuyCard: React.FC<{
207
209
  </ApplyTypography>
208
210
  <NodeTabs
209
211
  className={cn(
210
- 'grid gap-0 align-stretch justify-normal ' + `grid-cols-${inst.current.requestedNode.subNodes!.length}`,
212
+ 'grid gap-0 align-stretch justify-normal',
211
213
  'border-b-2 rounded-lg border-level-3 mb-4 -mr-2 -ml-2 max-w-[460px] h-10', // height is needed for iPhone bug
212
214
  (scroll ? 'shrink-0' : ''),
213
- famWidgetClx
214
- )}
215
+ famWidgetClx
216
+ )}
217
+ // One column per sub-node. The count used to be interpolated into a
218
+ // column-count utility in the className, and Tailwind's extractor never
219
+ // saw it: the extractor reads source text, and a template literal is not
220
+ // a class name. The element got `display:grid` with the default
221
+ // `grid-template-columns: none`, so every family tab row stacked in a
222
+ // single column. `repeat(n, minmax(0, 1fr))` is exactly what the utility
223
+ // would have compiled to, and it holds for any n.
224
+ style={{ gridTemplateColumns: `repeat(${inst.current.requestedNode.subNodes!.length}, minmax(0, 1fr))` }}
215
225
  mobile={mobile}
216
226
  mutator={allVariants ?
217
227
  {
@@ -234,7 +244,7 @@ const BuyCard: React.FC<{
234
244
  <TitleArea title={famTitle} clx=''/>
235
245
  )}
236
246
  {(cmmc.currentItem && showItemMedia) && (
237
- <MediaStack media={cmmc.currentItem} constrainTo={{w: 200, h: 200}} clx={(scroll ? 'shrink-0' : '')}/>
247
+ <MediaStack media={cmmc.currentItem} constrainTo={{w: 200, h: 200}} className={(scroll ? 'shrink-0' : '')}/>
238
248
  )}
239
249
  {itemsToShow && (
240
250
  <Selector
@@ -7,8 +7,9 @@ import React, {
7
7
  } from 'react'
8
8
  import { observer } from 'mobx-react-lite'
9
9
 
10
- import { cn } from '@hanzo/ui/util'
11
-
10
+ import {
11
+ cn,
12
+ } from '@hanzo/ui'
12
13
  import type {
13
14
  ItemSelectorProps,
14
15
  LineItem,
@@ -3,9 +3,8 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'
3
3
  import { reaction } from 'mobx'
4
4
  import { observer } from 'mobx-react-lite'
5
5
 
6
- import { cn } from '@hanzo/ui/util'
7
-
8
6
  import {
7
+ cn,
9
8
  ApplyTypography,
10
9
  type CarouselApi,
11
10
  Carousel,
@@ -14,8 +13,7 @@ import {
14
13
  CarouselPrevious,
15
14
  CarouselNext,
16
15
  MediaStack,
17
- } from '@hanzo/ui/primitives'
18
-
16
+ } from '@hanzo/ui'
19
17
  import type { MultiFamilySelectorProps, LineItem } from '../../../types'
20
18
  import {
21
19
  formatCurrencyValue,
@@ -238,7 +236,7 @@ const AllVariantsCarousel: React.FC<MultiFamilySelectorProps> = ({
238
236
  <CarouselContent>
239
237
  {r.current.items.map((item) => (
240
238
  <CarouselItem key={item.sku} className={cn('p-2 flex flex-col justify-center items-center', itemClx)}>
241
- <MediaStack media={item} constrainTo={mediaConstraint} clx='my-4'/>
239
+ <MediaStack media={item} constrainTo={mediaConstraint} className='my-4'/>
242
240
  </CarouselItem>
243
241
  ))}
244
242
  </CarouselContent>
@@ -1,17 +1,15 @@
1
1
  'use client'
2
2
  import React, { useCallback, useRef } from 'react'
3
3
 
4
- import { cn } from '@hanzo/ui/util'
5
-
6
4
  import {
5
+ cn,
7
6
  type CarouselApi,
8
7
  Carousel,
9
8
  CarouselContent,
10
9
  CarouselItem,
11
10
  CarouselPrevious,
12
11
  CarouselNext,
13
- } from '@hanzo/ui/primitives'
14
-
12
+ } from '@hanzo/ui'
15
13
  import type { MultiFamilySelectorProps } from '../../../../types'
16
14
 
17
15
  import FamilySlide from './slide'
@@ -3,14 +3,13 @@ import React from 'react'
3
3
 
4
4
  import {
5
5
  ApplyTypography,
6
- MediaStack
7
- } from '@hanzo/ui/primitives'
6
+ MediaStack,
7
+ cn,
8
+ } from '@hanzo/ui'
8
9
  import type { Dimensions } from '@hanzo/ui/types'
9
10
 
10
11
  import type { ItemSelectorOptions, Family, LineItem, ItemSelector } from '../../../../types'
11
12
  import { ButtonItemSelector } from '../../..'
12
- import { cn } from '@hanzo/ui/util'
13
-
14
13
  const FamilySlide: React.FC<Omit<ItemSelector, 'items'> & {
15
14
  family: Family
16
15
  mediaConstraint: Dimensions
@@ -1,7 +1,11 @@
1
1
  import React from 'react'
2
2
  import { observer } from 'mobx-react-lite'
3
3
 
4
- import { MediaStack, Skeleton } from '@hanzo/ui/primitives'
4
+ import {
5
+ MediaStack,
6
+ Skeleton,
7
+ cn,
8
+ } from '@hanzo/ui'
5
9
  import type { Dimensions } from '@hanzo/ui/types'
6
10
 
7
11
  import { useCommerce } from '../..'
@@ -9,9 +13,6 @@ import { useCommerce } from '../..'
9
13
  import type { ItemSelectorOptions, ItemSelectorProps, LineItem } from '../../types'
10
14
  import TitleAndByline from './title-and-byline'
11
15
  import { accessItemOptions } from '../../util'
12
- import { cn } from '@hanzo/ui/util'
13
-
14
-
15
16
  const DEF_MEDIA_CONSTRAINT = {w: 200, h: 200}
16
17
 
17
18
  const SingleFamilySelector: React.FC<{
@@ -61,7 +62,7 @@ const SingleFamilySelector: React.FC<{
61
62
  <MediaStack
62
63
  media={cmmc.currentItem!}
63
64
  constrainTo={mediaConstraint}
64
- clx={'mb-2 ' + (scrollable ? 'shrink-0' : '')}
65
+ className={'mb-2 ' + (scrollable ? 'shrink-0' : '')}
65
66
  />
66
67
  ) : (
67
68
  <Skeleton className={'w-[200px] h-[200px] my-2 ' + (scrollable ? 'shrink-0' : '')}/>
@@ -1,8 +1,9 @@
1
1
  import React from 'react'
2
2
 
3
- import { ApplyTypography } from '@hanzo/ui/primitives'
4
- import { cn } from '@hanzo/ui/util'
5
-
3
+ import {
4
+ ApplyTypography,
5
+ cn,
6
+ } from '@hanzo/ui'
6
7
  const TitleAndByline: React.FC<{
7
8
  title: string | undefined
8
9
  byline?: string | undefined
@@ -3,9 +3,10 @@
3
3
  import React from 'react'
4
4
  import { observer } from 'mobx-react-lite'
5
5
 
6
- import { cn } from '@hanzo/ui/util'
7
- import { Image } from '@hanzo/ui/primitives'
8
-
6
+ import {
7
+ cn,
8
+ MediaStack,
9
+ } from '@hanzo/ui'
9
10
  import type { LineItem } from '../../../types'
10
11
  import { formatCurrencyValue } from '../../../util'
11
12
  import AddToCartWidget from '../../add-to-cart-widget'
@@ -53,7 +54,7 @@ const CartLineItem: React.FC<{
53
54
  >
54
55
  <div className='flex flex-row justify-between items-center gap-1' >
55
56
  {item.img ? (
56
- <Image def={item.img} constrainTo={{w: imgSizePx, h: imgSizePx}} />
57
+ <MediaStack media={item} constrainTo={{w: imgSizePx, h: imgSizePx}} />
57
58
  ) : ( // placeholder so things align
58
59
  <div style={{height: imgSizePx, width: imgSizePx}} className='bg-level-3'/>
59
60
  )}
@@ -3,9 +3,12 @@ import React, { useLayoutEffect, type PropsWithChildren } from 'react'
3
3
  import { reaction } from 'mobx'
4
4
  import { observer } from 'mobx-react-lite'
5
5
 
6
- import { Button, ScrollArea } from '@hanzo/ui/primitives'
7
- import { cn } from '@hanzo/ui/util'
8
-
6
+ import {
7
+ Button,
8
+ ScrollArea,
9
+ cn,
10
+ sx,
11
+ } from '@hanzo/ui'
9
12
  import type { LineItem } from '../../../types'
10
13
  import { useCommerce } from '../../../service/context'
11
14
  import { sendFBEvent, sendGAEvent } from '../../../util/analytics'
@@ -141,7 +144,7 @@ const CartPanel: React.FC<PropsWithChildren & {
141
144
  <Button
142
145
  onClick={_handleCheckout}
143
146
  variant='primary'
144
- rounded='lg'
147
+ {...sx('rounded-lg')}
145
148
  className={cn('mt-12 mx-auto w-full sm:max-w-[220px]', buttonClx)}
146
149
  >
147
150
  Checkout
@@ -9,18 +9,14 @@ import * as z from 'zod'
9
9
  import { zodResolver } from '@hookform/resolvers/zod'
10
10
  import { Check } from 'lucide-react'
11
11
 
12
- import {
13
- Button,
14
- Input
15
- } from '@hanzo/ui/primitives'
16
-
17
12
  import {
13
+ Button,
14
+ Input,
18
15
  Form,
19
16
  FormControl,
20
17
  FormField,
21
18
  FormItem,
22
- } from '@hanzo/ui/form'
23
-
19
+ } from '@hanzo/ui'
24
20
  import { useCommerce } from '../../../service/context'
25
21
  import type { Promo } from '../../../types'
26
22
  import getPromoFromApi from '../../../util/promo-codes'
@@ -2,8 +2,9 @@
2
2
  import React, { Suspense } from 'react'
3
3
  import { observer } from 'mobx-react-lite'
4
4
 
5
- import { cn } from '@hanzo/ui/util'
6
-
5
+ import {
6
+ cn,
7
+ } from '@hanzo/ui'
7
8
  import { formatCurrencyValue } from '../../../util'
8
9
  import PromoCode from './promo-code'
9
10
  import { useCommerce } from '../../../service/context'
@@ -1,5 +1,6 @@
1
- import { Button } from '@hanzo/ui/primitives'
2
-
1
+ import {
2
+ Button,
3
+ } from '@hanzo/ui'
3
4
  import PaymentMethods from './card-icon-row'
4
5
  import type { PropsWithChildren } from 'react'
5
6
 
@@ -1,13 +1,11 @@
1
- import { Input } from '@hanzo/ui/primitives'
2
-
3
1
  import {
2
+ Input,
4
3
  Form,
5
4
  FormControl,
6
5
  FormField,
7
6
  FormItem,
8
7
  FormMessage,
9
- } from '@hanzo/ui/form'
10
-
8
+ } from '@hanzo/ui'
11
9
  import type { ContactFormType } from '../../../types'
12
10
 
13
11
  const ContactForm: React.FC<{
@@ -6,8 +6,12 @@ import { zodResolver } from '@hookform/resolvers/zod'
6
6
  import * as z from 'zod'
7
7
  import { useForm } from 'react-hook-form'
8
8
 
9
- import { Tabs, TabsContent, TabsList, TabsTrigger } from '@hanzo/ui/primitives'
10
-
9
+ import {
10
+ Tabs,
11
+ TabsContent,
12
+ TabsList,
13
+ TabsTrigger,
14
+ } from '@hanzo/ui'
11
15
  import { useCommerce } from '../../../service/context'
12
16
  import { sendFBEvent, sendGAEvent } from '../../../util/analytics'
13
17
  import type { CheckoutStepComponentProps, TransactionStatus } from '../../../types'
@@ -3,8 +3,10 @@
3
3
  import React from 'react'
4
4
  import { Copy } from 'lucide-react'
5
5
 
6
- import { Button, toast } from '@hanzo/ui/primitives'
7
-
6
+ import {
7
+ Button,
8
+ toast,
9
+ } from '@hanzo/ui'
8
10
  import type { PaymentMethodComponentProps } from '../../../../types'
9
11
 
10
12
  import ContactForm from '../contact-form'
@@ -11,10 +11,8 @@ import {
11
11
  Button,
12
12
  Separator,
13
13
  Skeleton,
14
- } from '@hanzo/ui/primitives'
15
-
16
- import { cn } from '@hanzo/ui/util'
17
-
14
+ cn,
15
+ } from '@hanzo/ui'
18
16
  import { useCommerce } from '../../../../service/context'
19
17
  import { processSquareCardPayment } from '../../../../util'
20
18
  import type { PaymentMethodComponentProps } from '../../../../types'
@@ -6,18 +6,17 @@ import { observer } from 'mobx-react-lite'
6
6
 
7
7
  import { ethers } from 'ethers'
8
8
 
9
- import {
10
- Button,
11
- Input,
12
- Select,
13
- SelectContent,
14
- SelectGroup,
15
- SelectItem,
16
- SelectTrigger,
17
- SelectValue,
18
- toast
19
- } from '@hanzo/ui/primitives'
20
-
9
+ import {
10
+ Button,
11
+ Input,
12
+ Select,
13
+ SelectContent,
14
+ SelectGroup,
15
+ SelectItem,
16
+ SelectTrigger,
17
+ SelectValue,
18
+ toast,
19
+ } from '@hanzo/ui'
21
20
  import Eth from '../crypto-icons/eth'
22
21
  import { useCommerce } from '../../../../service/context'
23
22
  import type { PaymentMethodComponentProps } from '../../../../types'
@@ -178,7 +177,7 @@ const PayWithCrypto: React.FC<PaymentMethodComponentProps> = observer(({
178
177
  <div className='flex gap-2 grid grid-cols-3'>
179
178
  <Select onValueChange={(token) => {/*ONLY ETH setSelectedToken(token) */}} defaultValue='eth'>
180
179
  <SelectTrigger>
181
- <SelectValue defaultValue='eth' />
180
+ <SelectValue />
182
181
  </SelectTrigger>
183
182
  <SelectContent>
184
183
  <SelectGroup>
@@ -11,17 +11,13 @@ import {
11
11
  SelectContent,
12
12
  SelectItem,
13
13
  SelectTrigger,
14
- SelectValue
15
- } from '@hanzo/ui/primitives'
16
-
17
- import {
14
+ SelectValue,
18
15
  Form,
19
16
  FormControl,
20
17
  FormField,
21
18
  FormItem,
22
19
  FormMessage,
23
- } from '@hanzo/ui/form'
24
-
20
+ } from '@hanzo/ui'
25
21
  import { useCommerce } from '../../service/context'
26
22
 
27
23
  import countries from '../../util/countries'
@@ -1,16 +1,14 @@
1
1
  import React from 'react'
2
2
 
3
- import {
3
+ import {
4
4
  Card,
5
5
  CardContent,
6
6
  CardFooter,
7
7
  CardHeader,
8
8
  CardTitle,
9
- MediaStack
10
- } from '@hanzo/ui/primitives'
11
-
12
- import { cn } from '@hanzo/ui/util'
13
-
9
+ MediaStack,
10
+ cn,
11
+ } from '@hanzo/ui'
14
12
  import { formatCurrencyValue } from '../../util'
15
13
  import type { LineItem } from '../../types'
16
14
 
@@ -29,7 +27,10 @@ const ProductCard: React.FC<ProductCardProps> = ({
29
27
  itemScope
30
28
  itemType='https://schema.org/Product'
31
29
  className={cn('max-h-[360px] lg:min-w-[200px] max-w-[260px] overflow-hidden', className)}
32
- {...props}
30
+ // A div's whole attribute set, spread onto a cross-platform component that
31
+ // names a few of them differently. The element a Card renders IS a div, and
32
+ // it is the one these reach.
33
+ {...(props as object)}
33
34
  >
34
35
  {/* Standard schema.org Product microdata. Neutral and analytics-agnostic:
35
36
  track.js `annotate`, GA4 Merchant, or any reader picks up the item with
@@ -38,7 +39,7 @@ const ProductCard: React.FC<ProductCardProps> = ({
38
39
  <meta itemProp='name' content={item.title} />
39
40
  <meta itemProp='sku' content={item.sku} />
40
41
  <CardHeader className='w-full border-b p-6 min-h-[180px] max-h-[240px] relative'>
41
- <MediaStack media={item} constrainTo={{w: 700, h:700}} clx='p-6' />
42
+ <MediaStack media={item} constrainTo={{w: 700, h:700}} className='p-6' />
42
43
  </CardHeader>
43
44
  <CardContent className='grid gap-2.5 p-4'>
44
45
  <CardTitle className='text-sm sm:text-base flex flex-col justify-start items-center line-clap-3'>
@@ -4,13 +4,13 @@ import { observer } from 'mobx-react-lite'
4
4
 
5
5
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
6
6
 
7
- import {
8
- Image,
9
- Label,
10
- RadioGroup,
11
- ScrollArea
12
- } from '@hanzo/ui/primitives'
13
- import { cn } from '@hanzo/ui/util'
7
+ import {
8
+ Label,
9
+ RadioGroup,
10
+ ScrollArea,
11
+ cn,
12
+ MediaStack,
13
+ } from '@hanzo/ui'
14
14
  import type { Dimensions } from '@hanzo/ui/types'
15
15
 
16
16
  import type { ItemSelectorProps, LineItem } from '../../types'
@@ -20,6 +20,25 @@ import QuantityIndicator from './quantity-indicator'
20
20
 
21
21
  const DEFAULT_CONSTRAINT = {h: 36, w: 72} // // Apple suggest 42px for clickability
22
22
 
23
+ // `ImageDef.rounded` is a corner of the radius scale, spelled by whoever wrote
24
+ // the catalog. It used to be pasted straight into a class — `rounded-${...}` —
25
+ // and Tailwind reads source text, so no such rule was ever generated: setting
26
+ // `rounded: 'full'` produced LESS rounding than leaving it unset, because the
27
+ // truthy branch handed back a class name with nothing behind it while the
28
+ // default branch at least said `rounded-sm`. Writing the scale out is what makes
29
+ // the extractor see it. Anything off the scale falls back to the default, which
30
+ // is what the old code did by accident for every value.
31
+ const ROUNDED: Record<string, string> = {
32
+ none: 'rounded-none',
33
+ sm: 'rounded-sm',
34
+ md: 'rounded-md',
35
+ lg: 'rounded-lg',
36
+ xl: 'rounded-xl',
37
+ '2xl': 'rounded-2xl',
38
+ '3xl': 'rounded-3xl',
39
+ full: 'rounded-full',
40
+ }
41
+
23
42
  const ImageRadioGroupItem = React.forwardRef<
24
43
  React.ElementRef<typeof RadioGroupPrimitive.Item>,
25
44
  Omit<React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>, 'value' | 'id'> & {
@@ -44,14 +63,14 @@ const ImageRadioGroupItem = React.forwardRef<
44
63
  'focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
45
64
  className,
46
65
  'overflow-hidden',
47
- img?.rounded ? `rounded-${img.rounded}` : 'rounded-sm'
66
+ (img?.rounded && ROUNDED[img.rounded]) || 'rounded-sm'
48
67
  )}
49
68
  {...props}
50
69
  id={item.sku}
51
70
  value={item.sku}
52
71
  >
53
72
  {img ? (
54
- <Image def={img} constrainTo={constrainTo} preload className=''/>
73
+ <MediaStack media={{img}} constrainTo={constrainTo} />
55
74
  ) : ( // placeholder so things align
56
75
  <div style={{height: constrainTo.h, width: constrainTo.w}}/>
57
76
  )}
@@ -151,12 +170,18 @@ const ButtonItemSelector: React.FC<ItemSelectorProps> = observer(({
151
170
 
152
171
  return showButtonIfOnlyOne || items.length > 1 ? (
153
172
  <RadioGroup
154
- className={cn(
155
- (scrollable ? 'shrink min-h-0 gap-0' : (mobile ? 'gap-3' : 'gap-1')),
156
- (horizButtons ? `grid grid-cols-${items.length} gap-1` : 'flex flex-col'),
173
+ className={cn(
174
+ (scrollable ? 'shrink min-h-0 gap-0' : (mobile ? 'gap-3' : 'gap-1')),
175
+ (horizButtons ? 'grid gap-1' : 'flex flex-col'),
157
176
  (mobile && showText) ? 'min-w-pr-50' : '',
158
177
  clx,
159
178
  )}
179
+ // One column per item, same as the family tabs: the count is data, and
180
+ // data cannot be a class name. Interpolating it produced a rule only when
181
+ // the number happened to be 3, because two other files in this package
182
+ // spell that one literally — so this laid out correctly in a three-option
183
+ // selector and stacked in every other.
184
+ style={horizButtons ? { gridTemplateColumns: `repeat(${items.length}, minmax(0, 1fr))` } : undefined}
160
185
  onValueChange={selectSku}
161
186
  value={itemRef.item ? itemRef.item.sku : ''}
162
187
  data-vaul-no-drag
@@ -3,10 +3,8 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'
3
3
  import { reaction } from 'mobx'
4
4
  import { observer } from 'mobx-react-lite'
5
5
 
6
- import { cn } from '@hanzo/ui/util'
7
- import type { Dimensions } from '@hanzo/ui/types'
8
-
9
6
  import {
7
+ cn,
10
8
  ApplyTypography,
11
9
  type CarouselOptions,
12
10
  type CarouselApi,
@@ -16,7 +14,8 @@ import {
16
14
  CarouselPrevious,
17
15
  CarouselNext,
18
16
  MediaStack,
19
- } from '@hanzo/ui/primitives'
17
+ } from '@hanzo/ui'
18
+ import type { Dimensions } from '@hanzo/ui/types'
20
19
 
21
20
  import type { ItemSelectorProps, LineItem } from '../../../types'
22
21
  import { formatCurrencyValue, accessItemOptions } from '../../../util'
@@ -43,7 +42,7 @@ const ItemSlide: React.FC<{
43
42
  clx=''
44
43
  }) => (
45
44
  <CarouselItem className={cn('p-2 flex flex-col justify-center items-center', clx)}>
46
- <MediaStack media={item} constrainTo={constrainTo} clx='my-4' />
45
+ <MediaStack media={item} constrainTo={constrainTo} className='my-4' />
47
46
  </CarouselItem>
48
47
  )
49
48
 
@@ -1,8 +1,9 @@
1
1
  'use client'
2
2
  import React, { useEffect, useState } from 'react'
3
3
 
4
- import { Slider } from '@hanzo/ui/primitives'
5
-
4
+ import {
5
+ Slider,
6
+ } from '@hanzo/ui'
6
7
  const ItemCarouselSlider: React.FC<{
7
8
  clx?: string
8
9
  setScrollTo: (scrollTo: (index: number) => void) => void
@@ -22,11 +23,7 @@ const ItemCarouselSlider: React.FC<{
22
23
 
23
24
  return (
24
25
  <Slider
25
- className={clx}
26
- thumbClx='w-8 border-muted border-2 bg-level-1 focus-visible:ring-0 focus-visible:ring-offset-0 transition-none'
27
- trackBgClx='bg-level-3'
28
- rangeBgClx='bg-level-3'
29
- thumbSlidingClx='bg-muted-2'
26
+ className={clx}
30
27
  defaultValue={[0]}
31
28
  min={0}
32
29
  max={numStops - 1}