@hanzo/ui 3.0.4 → 3.0.5
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/package.json +3 -2
- package/primitives/drawer.tsx +116 -0
- package/primitives/index.ts +14 -0
- package/primitives/sheet.tsx +1 -1
- package/tailwind/colors.tailwind.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/ui",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
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/",
|
|
@@ -65,7 +65,8 @@
|
|
|
65
65
|
"react-intersection-observer": "^9.7.0",
|
|
66
66
|
"tailwind-merge": "^2.2.0",
|
|
67
67
|
"tailwindcss-animate": "^1.0.6",
|
|
68
|
-
"tailwindcss-interaction-media": "^0.1.0"
|
|
68
|
+
"tailwindcss-interaction-media": "^0.1.0",
|
|
69
|
+
"vaul": "^0.2.0"
|
|
69
70
|
},
|
|
70
71
|
"peerDependencies": {
|
|
71
72
|
"@hookform/resolvers": "^3.3.2",
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { Drawer as DrawerPrimitive } from 'vaul'
|
|
5
|
+
|
|
6
|
+
import { cn } from '../util'
|
|
7
|
+
|
|
8
|
+
const Drawer = ({
|
|
9
|
+
shouldScaleBackground = true,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
|
|
12
|
+
<DrawerPrimitive.Root
|
|
13
|
+
shouldScaleBackground={shouldScaleBackground}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
)
|
|
17
|
+
Drawer.displayName = 'Drawer'
|
|
18
|
+
|
|
19
|
+
const DrawerTrigger = DrawerPrimitive.Trigger
|
|
20
|
+
const DrawerPortal = DrawerPrimitive.Portal
|
|
21
|
+
const DrawerClose = DrawerPrimitive.Close
|
|
22
|
+
|
|
23
|
+
const DrawerOverlay = React.forwardRef<
|
|
24
|
+
React.ElementRef<typeof DrawerPrimitive.Overlay>,
|
|
25
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
|
|
26
|
+
>(({ className, ...props }, ref) => (
|
|
27
|
+
<DrawerPrimitive.Overlay
|
|
28
|
+
ref={ref}
|
|
29
|
+
className={cn('fixed inset-0 z-20 bg-background', className)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
))
|
|
33
|
+
DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName
|
|
34
|
+
|
|
35
|
+
const DrawerContent = React.forwardRef<
|
|
36
|
+
React.ElementRef<typeof DrawerPrimitive.Content>,
|
|
37
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
|
|
38
|
+
>(({ className, children, ...props }, ref) => (
|
|
39
|
+
<DrawerPortal>
|
|
40
|
+
<DrawerOverlay />
|
|
41
|
+
<DrawerPrimitive.Content
|
|
42
|
+
ref={ref}
|
|
43
|
+
className={cn(
|
|
44
|
+
'fixed inset-x-0 bottom-0 z-20 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background',
|
|
45
|
+
className
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
>
|
|
49
|
+
<div className='mx-auto mt-4 h-2 w-[100px] rounded-full bg-level-1' />
|
|
50
|
+
{children}
|
|
51
|
+
</DrawerPrimitive.Content>
|
|
52
|
+
</DrawerPortal>
|
|
53
|
+
))
|
|
54
|
+
DrawerContent.displayName = 'DrawerContent'
|
|
55
|
+
|
|
56
|
+
const DrawerHeader = ({
|
|
57
|
+
className,
|
|
58
|
+
...props
|
|
59
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
60
|
+
<div
|
|
61
|
+
className={cn('grid gap-1.5 p-4 text-center sm:text-left', className)}
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
)
|
|
65
|
+
DrawerHeader.displayName = 'DrawerHeader'
|
|
66
|
+
|
|
67
|
+
const DrawerFooter = ({
|
|
68
|
+
className,
|
|
69
|
+
...props
|
|
70
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
71
|
+
<div
|
|
72
|
+
className={cn('mt-auto flex flex-col gap-2 p-4', className)}
|
|
73
|
+
{...props}
|
|
74
|
+
/>
|
|
75
|
+
)
|
|
76
|
+
DrawerFooter.displayName = 'DrawerFooter'
|
|
77
|
+
|
|
78
|
+
const DrawerTitle = React.forwardRef<
|
|
79
|
+
React.ElementRef<typeof DrawerPrimitive.Title>,
|
|
80
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
|
|
81
|
+
>(({ className, ...props }, ref) => (
|
|
82
|
+
<DrawerPrimitive.Title
|
|
83
|
+
ref={ref}
|
|
84
|
+
className={cn(
|
|
85
|
+
'text-lg font-semibold leading-none tracking-tight',
|
|
86
|
+
className
|
|
87
|
+
)}
|
|
88
|
+
{...props}
|
|
89
|
+
/>
|
|
90
|
+
))
|
|
91
|
+
DrawerTitle.displayName = DrawerPrimitive.Title.displayName
|
|
92
|
+
|
|
93
|
+
const DrawerDescription = React.forwardRef<
|
|
94
|
+
React.ElementRef<typeof DrawerPrimitive.Description>,
|
|
95
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
|
|
96
|
+
>(({ className, ...props }, ref) => (
|
|
97
|
+
<DrawerPrimitive.Description
|
|
98
|
+
ref={ref}
|
|
99
|
+
className={cn('text-sm text-muted', className)}
|
|
100
|
+
{...props}
|
|
101
|
+
/>
|
|
102
|
+
))
|
|
103
|
+
DrawerDescription.displayName = DrawerPrimitive.Description.displayName
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
Drawer,
|
|
107
|
+
DrawerPortal,
|
|
108
|
+
DrawerOverlay,
|
|
109
|
+
DrawerTrigger,
|
|
110
|
+
DrawerClose,
|
|
111
|
+
DrawerContent,
|
|
112
|
+
DrawerHeader,
|
|
113
|
+
DrawerFooter,
|
|
114
|
+
DrawerTitle,
|
|
115
|
+
DrawerDescription,
|
|
116
|
+
}
|
package/primitives/index.ts
CHANGED
|
@@ -25,6 +25,20 @@ export {
|
|
|
25
25
|
DialogDescription,
|
|
26
26
|
} from './dialog'
|
|
27
27
|
|
|
28
|
+
export {
|
|
29
|
+
Drawer,
|
|
30
|
+
DrawerPortal,
|
|
31
|
+
DrawerOverlay,
|
|
32
|
+
DrawerTrigger,
|
|
33
|
+
DrawerClose,
|
|
34
|
+
DrawerContent,
|
|
35
|
+
DrawerHeader,
|
|
36
|
+
DrawerFooter,
|
|
37
|
+
DrawerTitle,
|
|
38
|
+
DrawerDescription,
|
|
39
|
+
} from './drawer'
|
|
40
|
+
|
|
41
|
+
|
|
28
42
|
export {
|
|
29
43
|
useFormField,
|
|
30
44
|
Form,
|
package/primitives/sheet.tsx
CHANGED
|
@@ -54,7 +54,7 @@ interface SheetContentProps
|
|
|
54
54
|
VariantProps<typeof sheetVariants> {}
|
|
55
55
|
|
|
56
56
|
const closeUIclx = 'rounded-sm opacity-70 ring-offset-background ' +
|
|
57
|
-
'transition-opacity hover:opacity-100 disabled:pointer-events-none data-[state=open]:bg-
|
|
57
|
+
'transition-opacity hover:opacity-100 disabled:pointer-events-none data-[state=open]:bg-primary'
|
|
58
58
|
|
|
59
59
|
const SheetContent = React.forwardRef<
|
|
60
60
|
React.ElementRef<typeof SheetPrimitive.Content>,
|
|
@@ -33,6 +33,10 @@ export default ({ colors }) => ({
|
|
|
33
33
|
lux: "var(--hz-ui-secondary)", // in case there are two configs
|
|
34
34
|
hover: "var(--hz-ui-secondary-hover)",
|
|
35
35
|
fg: "var(--hz-ui-secondary-fg)",
|
|
36
|
+
'0': 'var(--hz-ui-secondary-0)',
|
|
37
|
+
'1': 'var(--hz-ui-secondary-1)',
|
|
38
|
+
'2': 'var(--hz-ui-secondary-2)',
|
|
39
|
+
'3': 'var(--hz-ui-secondary-3)',
|
|
36
40
|
},
|
|
37
41
|
destructive: {
|
|
38
42
|
DEFAULT: "var(--hz-ui-destructive)",
|