@hanzo/ui 3.7.23 → 3.8.1
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 +9 -8
- package/primitives/drawer.tsx +8 -8
- package/primitives/index.ts +12 -0
- package/primitives/navigation-menu.tsx +135 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.1",
|
|
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/",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"@radix-ui/react-dialog": "^1.0.5",
|
|
52
52
|
"@radix-ui/react-icons": "^1.3.0",
|
|
53
53
|
"@radix-ui/react-label": "^2.0.2",
|
|
54
|
+
"@radix-ui/react-navigation-menu": "^1.1.3",
|
|
54
55
|
"@radix-ui/react-popover": "^1.0.6",
|
|
55
56
|
"@radix-ui/react-progress": "^1.0.3",
|
|
56
57
|
"@radix-ui/react-radio-group": "^1.1.3",
|
|
@@ -70,7 +71,7 @@
|
|
|
70
71
|
"class-variance-authority": "^0.7.0",
|
|
71
72
|
"clsx": "^2.1.0",
|
|
72
73
|
"cmdk": "^0.2.0",
|
|
73
|
-
"embla-carousel-react": "8.
|
|
74
|
+
"embla-carousel-react": "8.1.1",
|
|
74
75
|
"input-otp": "^1.0.1",
|
|
75
76
|
"lodash.castarray": "^4.4.0",
|
|
76
77
|
"lodash.isplainobject": "^4.0.6",
|
|
@@ -83,14 +84,14 @@
|
|
|
83
84
|
"tailwind-merge": "^2.3.0",
|
|
84
85
|
"tailwindcss-animate": "^1.0.7",
|
|
85
86
|
"tailwindcss-interaction-media": "^0.1.0",
|
|
86
|
-
"@hanzo/
|
|
87
|
+
"@hanzo/vaul-fork": "0.99.21"
|
|
87
88
|
},
|
|
88
89
|
"peerDependencies": {
|
|
89
90
|
"@hookform/resolvers": "^3.3.2",
|
|
90
|
-
"embla-carousel": "^8.
|
|
91
|
+
"embla-carousel": "^8.1.1",
|
|
91
92
|
"lucide-react": "^0.344.0",
|
|
92
|
-
"mobx": "^6.12.
|
|
93
|
-
"next": "14.
|
|
93
|
+
"mobx": "^6.12.3",
|
|
94
|
+
"next": "14.2.3",
|
|
94
95
|
"next-themes": "^0.2.1",
|
|
95
96
|
"react": "^18.3.1",
|
|
96
97
|
"react-dom": "^18.3.1",
|
|
@@ -107,8 +108,8 @@
|
|
|
107
108
|
"@types/mdx": "^2.0.13",
|
|
108
109
|
"@types/react": "^18.3.1",
|
|
109
110
|
"@types/react-dom": "^18.3.0",
|
|
110
|
-
"embla-carousel": "^8.
|
|
111
|
+
"embla-carousel": "^8.1.1",
|
|
111
112
|
"tailwindcss": "^3.4.3",
|
|
112
|
-
"typescript": "5.
|
|
113
|
+
"typescript": "5.4.5"
|
|
113
114
|
}
|
|
114
115
|
}
|
package/primitives/drawer.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import * as React from 'react'
|
|
4
|
-
import { Drawer as DrawerPrimitive, useDrawerContext } from '@hanzo/
|
|
4
|
+
import { Drawer as DrawerPrimitive, useDrawerContext } from '@hanzo/vaul-fork'
|
|
5
5
|
|
|
6
6
|
import { cn } from '../util'
|
|
7
7
|
|
|
@@ -39,14 +39,14 @@ const DrawerContent = React.forwardRef<
|
|
|
39
39
|
overlayClx?: string
|
|
40
40
|
defaultHandle?: boolean
|
|
41
41
|
}
|
|
42
|
-
>(({
|
|
43
|
-
className,
|
|
44
|
-
children,
|
|
45
|
-
overlayClx='',
|
|
42
|
+
>(({
|
|
43
|
+
className,
|
|
44
|
+
children,
|
|
45
|
+
overlayClx='',
|
|
46
46
|
defaultHandle=true,
|
|
47
|
-
...props
|
|
47
|
+
...props
|
|
48
48
|
}, ref) => {
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
return (
|
|
51
51
|
<DrawerPortal>
|
|
52
52
|
{/* If no or same z index, overlay should precede content */}
|
|
@@ -55,7 +55,7 @@ const DrawerContent = React.forwardRef<
|
|
|
55
55
|
ref={ref}
|
|
56
56
|
className={cn('fixed left-0 right-0 bottom-0 z-modal',
|
|
57
57
|
'mt-24 flex flex-col rounded-t-[10px] pt-6 border bg-background',
|
|
58
|
-
// 'h-[80%]'
|
|
58
|
+
// 'h-[80%]'
|
|
59
59
|
className
|
|
60
60
|
)}
|
|
61
61
|
{...props}
|
package/primitives/index.ts
CHANGED
|
@@ -105,6 +105,18 @@ export {
|
|
|
105
105
|
InputOTPSlot,
|
|
106
106
|
} from './input-otp'
|
|
107
107
|
|
|
108
|
+
export {
|
|
109
|
+
navigationMenuTriggerStyle,
|
|
110
|
+
NavigationMenu,
|
|
111
|
+
NavigationMenuList,
|
|
112
|
+
NavigationMenuItem,
|
|
113
|
+
NavigationMenuContent,
|
|
114
|
+
NavigationMenuTrigger,
|
|
115
|
+
NavigationMenuLink,
|
|
116
|
+
NavigationMenuIndicator,
|
|
117
|
+
NavigationMenuViewport,
|
|
118
|
+
} from './navigation-menu'
|
|
119
|
+
|
|
108
120
|
export {
|
|
109
121
|
Popover,
|
|
110
122
|
PopoverAnchor,
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu'
|
|
4
|
+
import { cva } from 'class-variance-authority'
|
|
5
|
+
import { ChevronDown } from 'lucide-react'
|
|
6
|
+
|
|
7
|
+
import { cn } from '../util'
|
|
8
|
+
|
|
9
|
+
const NavigationMenu = React.forwardRef<
|
|
10
|
+
React.ElementRef<typeof NavigationMenuPrimitive.Root>,
|
|
11
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>
|
|
12
|
+
>(({ className, children, ...props }, ref) => (
|
|
13
|
+
<NavigationMenuPrimitive.Root
|
|
14
|
+
ref={ref}
|
|
15
|
+
className={cn(
|
|
16
|
+
'relative z-10 flex max-w-max flex-1 items-center justify-center',
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
>
|
|
21
|
+
{children}
|
|
22
|
+
<NavigationMenuViewport />
|
|
23
|
+
</NavigationMenuPrimitive.Root>
|
|
24
|
+
))
|
|
25
|
+
NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName
|
|
26
|
+
|
|
27
|
+
const NavigationMenuList = React.forwardRef<
|
|
28
|
+
React.ElementRef<typeof NavigationMenuPrimitive.List>,
|
|
29
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>
|
|
30
|
+
>(({ className, ...props }, ref) => (
|
|
31
|
+
<NavigationMenuPrimitive.List
|
|
32
|
+
ref={ref}
|
|
33
|
+
className={cn(
|
|
34
|
+
'group flex flex-1 list-none items-center justify-center space-x-1',
|
|
35
|
+
className
|
|
36
|
+
)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
))
|
|
40
|
+
NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName
|
|
41
|
+
|
|
42
|
+
const NavigationMenuItem = NavigationMenuPrimitive.Item
|
|
43
|
+
|
|
44
|
+
const navigationMenuTriggerStyle = cva(
|
|
45
|
+
'group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 ' +
|
|
46
|
+
'text-sm font-medium transition-colors hover:bg-level-1 text-foreground hover:text-accent ' +
|
|
47
|
+
'focus:bg-level-1 focus:text-accent focus:outline-none disabled:pointer-events-none disabled:opacity-50 ' +
|
|
48
|
+
'data-[active]:bg-level-1/50 data-[state=open]:bg-level-1/50'
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
const NavigationMenuTrigger = React.forwardRef<
|
|
52
|
+
React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
|
|
53
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>
|
|
54
|
+
>(({ className, children, ...props }, ref) => (
|
|
55
|
+
<NavigationMenuPrimitive.Trigger
|
|
56
|
+
ref={ref}
|
|
57
|
+
className={cn(navigationMenuTriggerStyle(), 'group', className)}
|
|
58
|
+
{...props}
|
|
59
|
+
>
|
|
60
|
+
{children}{' '}
|
|
61
|
+
<ChevronDown
|
|
62
|
+
className='relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180'
|
|
63
|
+
aria-hidden='true'
|
|
64
|
+
/>
|
|
65
|
+
</NavigationMenuPrimitive.Trigger>
|
|
66
|
+
))
|
|
67
|
+
NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName
|
|
68
|
+
|
|
69
|
+
const NavigationMenuContent = React.forwardRef<
|
|
70
|
+
React.ElementRef<typeof NavigationMenuPrimitive.Content>,
|
|
71
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>
|
|
72
|
+
>(({ className, ...props }, ref) => (
|
|
73
|
+
<NavigationMenuPrimitive.Content
|
|
74
|
+
ref={ref}
|
|
75
|
+
className={cn(
|
|
76
|
+
'left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 ',
|
|
77
|
+
'data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ',
|
|
78
|
+
className
|
|
79
|
+
)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
))
|
|
83
|
+
NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName
|
|
84
|
+
|
|
85
|
+
const NavigationMenuLink = NavigationMenuPrimitive.Link
|
|
86
|
+
|
|
87
|
+
const NavigationMenuViewport = React.forwardRef<
|
|
88
|
+
React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,
|
|
89
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>
|
|
90
|
+
>(({ className, ...props }, ref) => (
|
|
91
|
+
<div className={cn('absolute left-0 top-full flex justify-center')}>
|
|
92
|
+
<NavigationMenuPrimitive.Viewport
|
|
93
|
+
className={cn(
|
|
94
|
+
'origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border ',
|
|
95
|
+
'bg-background text-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]',
|
|
96
|
+
className
|
|
97
|
+
)}
|
|
98
|
+
ref={ref}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
))
|
|
103
|
+
NavigationMenuViewport.displayName =
|
|
104
|
+
NavigationMenuPrimitive.Viewport.displayName
|
|
105
|
+
|
|
106
|
+
const NavigationMenuIndicator = React.forwardRef<
|
|
107
|
+
React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,
|
|
108
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>
|
|
109
|
+
>(({ className, ...props }, ref) => (
|
|
110
|
+
<NavigationMenuPrimitive.Indicator
|
|
111
|
+
ref={ref}
|
|
112
|
+
className={cn(
|
|
113
|
+
'top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden',
|
|
114
|
+
'data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in',
|
|
115
|
+
className
|
|
116
|
+
)}
|
|
117
|
+
{...props}
|
|
118
|
+
>
|
|
119
|
+
<div className='relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md' />
|
|
120
|
+
</NavigationMenuPrimitive.Indicator>
|
|
121
|
+
))
|
|
122
|
+
NavigationMenuIndicator.displayName =
|
|
123
|
+
NavigationMenuPrimitive.Indicator.displayName
|
|
124
|
+
|
|
125
|
+
export {
|
|
126
|
+
navigationMenuTriggerStyle,
|
|
127
|
+
NavigationMenu,
|
|
128
|
+
NavigationMenuList,
|
|
129
|
+
NavigationMenuItem,
|
|
130
|
+
NavigationMenuContent,
|
|
131
|
+
NavigationMenuTrigger,
|
|
132
|
+
NavigationMenuLink,
|
|
133
|
+
NavigationMenuIndicator,
|
|
134
|
+
NavigationMenuViewport,
|
|
135
|
+
}
|