@modul/mbui 0.0.4-beta-pv-52894-c406e9b6 → 0.0.4-beta-pv-52894-6d5156ce
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modul/mbui",
|
|
3
|
-
"version": "0.0.4-beta-pv-52894-
|
|
3
|
+
"version": "0.0.4-beta-pv-52894-6d5156ce",
|
|
4
4
|
"packageManager": "yarn@3.5.1",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"@radix-ui/react-collapsible": "1.1.0",
|
|
26
26
|
"@radix-ui/react-dropdown-menu": "2.1.1",
|
|
27
27
|
"@radix-ui/react-popover": "^1.1.1",
|
|
28
|
+
"@radix-ui/react-select": "2.1.1",
|
|
28
29
|
"@radix-ui/react-slider": "^1.2.0",
|
|
29
30
|
"@radix-ui/react-slot": "1.1.0",
|
|
30
31
|
"@radix-ui/react-tabs": "^1.1.0",
|
|
@@ -38,7 +39,8 @@
|
|
|
38
39
|
"react-imask": "7.1.3",
|
|
39
40
|
"tailwind-merge": "^2.3.0",
|
|
40
41
|
"tailwindcss": "^3.4.4",
|
|
41
|
-
"tailwindcss-animate": "^1.0.7"
|
|
42
|
+
"tailwindcss-animate": "^1.0.7",
|
|
43
|
+
"vaul": "0.9.1"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
46
|
"@babel/core": "^7.9.0",
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { Drawer as DrawerPrimitive } from 'vaul'
|
|
5
|
+
import { cn } from '../@/lib/utils'
|
|
6
|
+
|
|
7
|
+
const Drawer = ({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Root>) => <DrawerPrimitive.Root {...props} />
|
|
8
|
+
Drawer.displayName = 'Drawer'
|
|
9
|
+
|
|
10
|
+
const DrawerTrigger = DrawerPrimitive.Trigger
|
|
11
|
+
|
|
12
|
+
const DrawerPortal = DrawerPrimitive.Portal
|
|
13
|
+
|
|
14
|
+
const DrawerClose = DrawerPrimitive.Close
|
|
15
|
+
|
|
16
|
+
const DrawerFooter: React.FC = () => (
|
|
17
|
+
<div className="p-[16px] cursor-pointer">
|
|
18
|
+
<svg
|
|
19
|
+
className="block mx-auto"
|
|
20
|
+
width="38"
|
|
21
|
+
height="10"
|
|
22
|
+
viewBox="0 0 38 10"
|
|
23
|
+
fill="none"
|
|
24
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
25
|
+
>
|
|
26
|
+
<path
|
|
27
|
+
d="M0 7.39774C0 8.68678 1.25226 9.60455 2.48147 9.21638L17.7955 4.38038C18.5794 4.13282 19.4206 4.13282 20.2045 4.38038L35.5185 9.21638C36.7477 9.60455 38 8.68678 38 7.39774C38 6.56568 37.4606 5.82966 36.6671 5.5791L20.2045 0.380377C19.4206 0.132817 18.5794 0.132817 17.7955 0.380377L1.33286 5.5791C0.539422 5.82966 0 6.56568 0 7.39774Z"
|
|
28
|
+
fill="#243036"
|
|
29
|
+
fill-opacity="0.24"
|
|
30
|
+
/>
|
|
31
|
+
</svg>
|
|
32
|
+
</div>
|
|
33
|
+
)
|
|
34
|
+
type DrawerListProps = {
|
|
35
|
+
children: React.ReactNode
|
|
36
|
+
}
|
|
37
|
+
const DrawerList: React.FC<DrawerListProps> = ({ children }) => {
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
role="listbox"
|
|
41
|
+
className="px-[12px] py-[20px]"
|
|
42
|
+
>
|
|
43
|
+
{children}
|
|
44
|
+
</div>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
type DrawerListItemProps = {
|
|
48
|
+
value: string
|
|
49
|
+
label: string | JSX.Element
|
|
50
|
+
isSelected?: boolean
|
|
51
|
+
}
|
|
52
|
+
const DrawerListItem: React.FC<DrawerListItemProps> = ({ label, value, isSelected }) => {
|
|
53
|
+
return (
|
|
54
|
+
<div
|
|
55
|
+
role="option"
|
|
56
|
+
aria-labelledby=""
|
|
57
|
+
aria-selected={isSelected}
|
|
58
|
+
className="flex"
|
|
59
|
+
tabIndex={0}
|
|
60
|
+
>
|
|
61
|
+
<div className="shrink-0">
|
|
62
|
+
<p
|
|
63
|
+
className="font-medium text-[14px] text-muted leading-[1.4]"
|
|
64
|
+
id=""
|
|
65
|
+
>
|
|
66
|
+
{label}
|
|
67
|
+
</p>
|
|
68
|
+
<p className="font-bold text-[20px] leading-[1.2]">{value}</p>
|
|
69
|
+
</div>
|
|
70
|
+
{isSelected && <span></span>}
|
|
71
|
+
</div>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
// const Drawer
|
|
75
|
+
const DrawerContent = React.forwardRef<
|
|
76
|
+
React.ElementRef<typeof DrawerPrimitive.Content>,
|
|
77
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
|
|
78
|
+
>(({ className, children, ...props }, ref) => (
|
|
79
|
+
<DrawerPortal>
|
|
80
|
+
<DrawerPrimitive.Content
|
|
81
|
+
ref={ref}
|
|
82
|
+
className={cn('fixed inset-x-0 top-0 flex h-auto flex-col bg-app', className)}
|
|
83
|
+
{...props}
|
|
84
|
+
>
|
|
85
|
+
{children}
|
|
86
|
+
<DrawerFooter />
|
|
87
|
+
</DrawerPrimitive.Content>
|
|
88
|
+
</DrawerPortal>
|
|
89
|
+
))
|
|
90
|
+
DrawerContent.displayName = 'DrawerContent'
|
|
91
|
+
|
|
92
|
+
export { Drawer, DrawerTrigger, DrawerClose, DrawerContent, DrawerList, DrawerListItem }
|