@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.
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
 
3
- import type { Dimensions, LinkDef, TShirtDimensions } from '../../types'
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 '../../primitives'
14
+ } from '../../../primitives'
16
15
 
17
- import { Icons } from '../../primitives'
16
+ import type { CardBlock } from '../../def'
18
17
 
19
- import {
20
- getSpecifierData,
21
- getPrimaryStartingWith,
22
- getDim,
23
- } from '../../util/specifier'
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
- const getSmallIconDim = (s: string): Dimensions | undefined => (
61
- getSpecifierData<Dimensions>(
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) => (<ArrowLinkElement def={def} key={key} />)}
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
  {
2
2
  "name": "@hanzo/ui",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "Library that contains shared UI primitives, support for a common design system, and other boilerplate support.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -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
  }
@@ -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:p-8 border-b", className)}
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
  ))
@@ -94,9 +94,11 @@ export {
94
94
 
95
95
  export {
96
96
  Popover,
97
- PopoverTrigger,
97
+ PopoverAnchor,
98
+ PopoverArrow,
99
+ PopoverClose,
98
100
  PopoverContent,
99
- PopoverAnchor
101
+ PopoverTrigger,
100
102
  } from './popover'
101
103
 
102
104
  export {
@@ -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 }
@@ -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,
package/util/index.ts CHANGED
@@ -78,4 +78,3 @@ export const ldMerge = (
78
78
  export const capitalize = (str: string): string => (
79
79
  str.charAt(0).toUpperCase() + str.slice(1)
80
80
  )
81
-