@hanzo/ui 3.0.1 → 3.0.2
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.
- package/blocks/components/{card-block.tsx → card-block/index.tsx} +12 -54
- package/blocks/components/card-block/link-out-button.tsx +20 -0
- package/blocks/components/card-block/util.ts +28 -0
- package/package.json +1 -1
- package/primitives/button.tsx +2 -0
- package/primitives/card.tsx +1 -1
- package/primitives/index.ts +4 -2
- package/primitives/popover.tsx +3 -1
- package/tailwind/tailwind.config.hanzo-preset.js +0 -1
- package/util/index.ts +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { LinkDef, TShirtDimensions } from '../../../types'
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
ApplyTypography,
|
|
@@ -10,63 +10,21 @@ import {
|
|
|
10
10
|
CardFooter,
|
|
11
11
|
CardHeader,
|
|
12
12
|
CardTitle,
|
|
13
|
-
LinkElement,
|
|
14
13
|
type TypographySize
|
|
15
|
-
} from '
|
|
14
|
+
} from '../../../primitives'
|
|
16
15
|
|
|
17
|
-
import {
|
|
16
|
+
import type { CardBlock } from '../../def'
|
|
18
17
|
|
|
19
|
-
import
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} from '
|
|
24
|
-
|
|
25
|
-
import type { Block, CardBlock } from '../def'
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
import ImageBlockComponent from './image-block'
|
|
29
|
-
import VideoBlockComponent from './video-block'
|
|
30
|
-
import CTABlockComponent from './cta-block'
|
|
31
|
-
import type BlockComponentProps from './block-component-props'
|
|
32
|
-
import { cn } from '../../util'
|
|
33
|
-
|
|
34
|
-
const ArrowLinkElement: React.FC<{
|
|
35
|
-
def: LinkDef,
|
|
36
|
-
}> = ({
|
|
37
|
-
def
|
|
38
|
-
}) => (
|
|
39
|
-
<LinkElement
|
|
40
|
-
def={def}
|
|
41
|
-
className='justify-between'
|
|
42
|
-
variant='link'
|
|
43
|
-
icon={<Icons.linkOut className='w-[18px] h-[18px]' />}
|
|
44
|
-
iconAfter
|
|
45
|
-
/>
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
const getTypographySize = (s: string): TypographySize => (
|
|
49
|
-
getSpecifierData<TypographySize>(
|
|
50
|
-
s,
|
|
51
|
-
(s: string) => (getPrimaryStartingWith(s, 'typography')),
|
|
52
|
-
(s: string): TypographySize | undefined => {
|
|
53
|
-
const subTokenArray = s.split('-')
|
|
54
|
-
return subTokenArray[subTokenArray.length - 1] as TypographySize
|
|
55
|
-
},
|
|
56
|
-
'responsive'
|
|
57
|
-
) as TypographySize
|
|
58
|
-
)
|
|
18
|
+
import ImageBlockComponent from '../image-block'
|
|
19
|
+
import VideoBlockComponent from '../video-block'
|
|
20
|
+
import CTABlockComponent from '../cta-block'
|
|
21
|
+
import type BlockComponentProps from '../block-component-props'
|
|
22
|
+
import { cn } from '../../../util'
|
|
59
23
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
s,
|
|
63
|
-
(s: string) => (getPrimaryStartingWith(s, 'small-icon')),
|
|
64
|
-
getDim,
|
|
65
|
-
)
|
|
66
|
-
)
|
|
24
|
+
import { getTypographySize } from './util'
|
|
25
|
+
import LinkOutButton from './link-out-button'
|
|
67
26
|
|
|
68
|
-
const CardBlockComponent: React.FC<
|
|
69
|
-
BlockComponentProps & {
|
|
27
|
+
const CardBlockComponent: React.FC<BlockComponentProps & {
|
|
70
28
|
contentClassName?: string
|
|
71
29
|
}> = ({
|
|
72
30
|
block,
|
|
@@ -181,7 +139,7 @@ const CardBlockComponent: React.FC<
|
|
|
181
139
|
}>
|
|
182
140
|
<CTABlockComponent
|
|
183
141
|
block={card.cta}
|
|
184
|
-
renderLink={(def: LinkDef, key: any) => (<
|
|
142
|
+
renderLink={(def: LinkDef, key: any) => (<LinkOutButton def={def} key={key} />)}
|
|
185
143
|
/>
|
|
186
144
|
</CardFooter>
|
|
187
145
|
) : ( // default
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import type { LinkDef } from '../../../types'
|
|
4
|
+
import { LinkElement, Icons } from '../../../primitives'
|
|
5
|
+
|
|
6
|
+
const ArrowLinkElement: React.FC<{
|
|
7
|
+
def: LinkDef,
|
|
8
|
+
}> = ({
|
|
9
|
+
def
|
|
10
|
+
}) => (
|
|
11
|
+
<LinkElement
|
|
12
|
+
def={def}
|
|
13
|
+
className='justify-between'
|
|
14
|
+
variant='link'
|
|
15
|
+
icon={<Icons.linkOut className='w-[18px] h-[18px]' />}
|
|
16
|
+
iconAfter
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
export default ArrowLinkElement
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Dimensions } from '../../../types'
|
|
2
|
+
import type {TypographySize } from '../../../primitives'
|
|
3
|
+
import {
|
|
4
|
+
getSpecifierData,
|
|
5
|
+
getPrimaryStartingWith,
|
|
6
|
+
getDim,
|
|
7
|
+
} from '../../../util/specifier'
|
|
8
|
+
|
|
9
|
+
export const getTypographySize = (s: string): TypographySize => (
|
|
10
|
+
getSpecifierData<TypographySize>(
|
|
11
|
+
s,
|
|
12
|
+
(s: string) => (getPrimaryStartingWith(s, 'typography')),
|
|
13
|
+
(s: string): TypographySize | undefined => {
|
|
14
|
+
const subTokenArray = s.split('-')
|
|
15
|
+
return subTokenArray[subTokenArray.length - 1] as TypographySize
|
|
16
|
+
},
|
|
17
|
+
'responsive'
|
|
18
|
+
) as TypographySize
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
export const getSmallIconDim = (s: string): Dimensions | undefined => (
|
|
22
|
+
getSpecifierData<Dimensions>(
|
|
23
|
+
s,
|
|
24
|
+
(s: string) => (getPrimaryStartingWith(s, 'small-icon')),
|
|
25
|
+
getDim,
|
|
26
|
+
)
|
|
27
|
+
)
|
|
28
|
+
|
package/package.json
CHANGED
package/primitives/button.tsx
CHANGED
|
@@ -54,6 +54,7 @@ const buttonVariants = cva(
|
|
|
54
54
|
|
|
55
55
|
type ButtonVariants = keyof typeof variant
|
|
56
56
|
type ButtonSizes = keyof typeof size
|
|
57
|
+
type ButtonRounded = keyof typeof rounded
|
|
57
58
|
|
|
58
59
|
interface ButtonProps extends
|
|
59
60
|
React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
@@ -82,5 +83,6 @@ export {
|
|
|
82
83
|
type ButtonProps,
|
|
83
84
|
type ButtonVariants,
|
|
84
85
|
type ButtonSizes,
|
|
86
|
+
type ButtonRounded,
|
|
85
87
|
buttonVariants,
|
|
86
88
|
}
|
package/primitives/card.tsx
CHANGED
|
@@ -27,7 +27,7 @@ const CardHeader = React.forwardRef<
|
|
|
27
27
|
>(({ className, ...props }, ref) => (
|
|
28
28
|
<div
|
|
29
29
|
ref={ref}
|
|
30
|
-
className={cn("flex flex-col p-4 lg:p-6 xl:
|
|
30
|
+
className={cn("flex flex-col p-4 lg:p-5 xl:px-6 xl:py-5 border-b", className)}
|
|
31
31
|
{...props}
|
|
32
32
|
/>
|
|
33
33
|
))
|
package/primitives/index.ts
CHANGED
package/primitives/popover.tsx
CHANGED
|
@@ -6,7 +6,9 @@ import { cn } from '../util'
|
|
|
6
6
|
|
|
7
7
|
const Popover = PopoverPrimitive.Root
|
|
8
8
|
const PopoverTrigger = PopoverPrimitive.Trigger
|
|
9
|
+
const PopoverClose = PopoverPrimitive.Close
|
|
9
10
|
const PopoverAnchor = PopoverPrimitive.Anchor
|
|
11
|
+
const PopoverArrow = PopoverPrimitive.Arrow
|
|
10
12
|
|
|
11
13
|
const PopoverContent = React.forwardRef<
|
|
12
14
|
React.ElementRef<typeof PopoverPrimitive.Content>,
|
|
@@ -32,4 +34,4 @@ const PopoverContent = React.forwardRef<
|
|
|
32
34
|
))
|
|
33
35
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName
|
|
34
36
|
|
|
35
|
-
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }
|
|
37
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor, PopoverClose, PopoverArrow }
|
package/util/index.ts
CHANGED