@hanzo/ui 3.0.1 → 3.0.3
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/{tailwind-indicator.tsx → breakpoint-indicator.tsx} +2 -2
- package/primitives/button.tsx +2 -0
- package/primitives/card.tsx +1 -1
- package/primitives/index.ts +5 -3
- package/primitives/popover.tsx +3 -1
- package/primitives/sheet.tsx +2 -2
- package/tailwind/tailwind.config.hanzo-preset.js +5 -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const BreakpointIndicator: React.FC = () => {
|
|
4
4
|
|
|
5
5
|
if (process.env.NODE_ENV === "production") return null
|
|
6
6
|
|
|
@@ -16,4 +16,4 @@ const TailwindIndicator: React.FC = () => {
|
|
|
16
16
|
)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export default
|
|
19
|
+
export default BreakpointIndicator
|
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
|
@@ -65,7 +65,7 @@ export {
|
|
|
65
65
|
TableCaption,
|
|
66
66
|
} from './table'
|
|
67
67
|
|
|
68
|
-
export { default as
|
|
68
|
+
export { default as BreakpointIndicator } from './breakpoint-indicator'
|
|
69
69
|
|
|
70
70
|
export {
|
|
71
71
|
type ToastProps,
|
|
@@ -94,9 +94,11 @@ export {
|
|
|
94
94
|
|
|
95
95
|
export {
|
|
96
96
|
Popover,
|
|
97
|
-
|
|
97
|
+
PopoverAnchor,
|
|
98
|
+
PopoverArrow,
|
|
99
|
+
PopoverClose,
|
|
98
100
|
PopoverContent,
|
|
99
|
-
|
|
101
|
+
PopoverTrigger,
|
|
100
102
|
} from './popover'
|
|
101
103
|
|
|
102
104
|
export {
|
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/primitives/sheet.tsx
CHANGED
|
@@ -36,8 +36,8 @@ const sheetVariants = cva(
|
|
|
36
36
|
{
|
|
37
37
|
variants: {
|
|
38
38
|
side: {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
top: 'inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',
|
|
40
|
+
bottom: 'inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom',
|
|
41
41
|
left: 'inset-y-0 left-0 h-full w-5/6 sm:w-2/3 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm',
|
|
42
42
|
right:
|
|
43
43
|
'inset-y-0 right-0 h-full w-5/6 sm:w-2/3 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm',
|
|
@@ -11,7 +11,6 @@ import fontFamily from './fontFamily.tailwind'
|
|
|
11
11
|
import typographyPlugin from './typo-plugin'
|
|
12
12
|
|
|
13
13
|
export default {
|
|
14
|
-
presets: [],
|
|
15
14
|
darkMode: ["class"],
|
|
16
15
|
content: [],
|
|
17
16
|
safelist,
|
|
@@ -35,6 +34,7 @@ export default {
|
|
|
35
34
|
bounce: 'bounce 1s infinite',
|
|
36
35
|
"accordion-down": "accordion-down 0.2s ease-out",
|
|
37
36
|
"accordion-up": "accordion-up 0.2s ease-out",
|
|
37
|
+
"mobile-menu-open": "opacity-in 300ms ease-in",
|
|
38
38
|
},
|
|
39
39
|
aria: {
|
|
40
40
|
checked: 'checked="true"',
|
|
@@ -536,6 +536,10 @@ export default {
|
|
|
536
536
|
from: { height: "var(--radix-accordion-content-height)" },
|
|
537
537
|
to: { height: 0 },
|
|
538
538
|
},
|
|
539
|
+
"opacity-in": {
|
|
540
|
+
from: { opacity: '0' },
|
|
541
|
+
to: { opacity: '1' }
|
|
542
|
+
},
|
|
539
543
|
},
|
|
540
544
|
letterSpacing: {
|
|
541
545
|
tighter: '-0.05em',
|
package/util/index.ts
CHANGED