@dilipod/ui 0.1.1 → 0.2.0
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/dist/index.d.mts +70 -2
- package/dist/index.d.ts +70 -2
- package/dist/index.js +2202 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2189 -42
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/accordion.stories.tsx +66 -0
- package/src/components/accordion.tsx +58 -0
- package/src/components/input.stories.tsx +57 -0
- package/src/components/input.tsx +26 -0
- package/src/components/label.stories.tsx +39 -0
- package/src/components/label.tsx +27 -0
- package/src/components/navigation-menu.stories.tsx +88 -0
- package/src/components/navigation-menu.tsx +130 -0
- package/src/components/separator.stories.tsx +50 -0
- package/src/components/separator.tsx +32 -0
- package/src/components/sheet.tsx +5 -0
- package/src/components/textarea.stories.tsx +49 -0
- package/src/components/textarea.tsx +25 -0
- package/src/index.ts +33 -0
package/package.json
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import {
|
|
3
|
+
Accordion,
|
|
4
|
+
AccordionItem,
|
|
5
|
+
AccordionTrigger,
|
|
6
|
+
AccordionContent,
|
|
7
|
+
} from './accordion'
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof Accordion> = {
|
|
10
|
+
title: 'Components/Accordion',
|
|
11
|
+
component: Accordion,
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default meta
|
|
16
|
+
type Story = StoryObj<typeof Accordion>
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
render: () => (
|
|
20
|
+
<Accordion type="single" collapsible className="w-full">
|
|
21
|
+
<AccordionItem value="item-1">
|
|
22
|
+
<AccordionTrigger>Is it accessible?</AccordionTrigger>
|
|
23
|
+
<AccordionContent>
|
|
24
|
+
Yes. It adheres to the WAI-ARIA design pattern.
|
|
25
|
+
</AccordionContent>
|
|
26
|
+
</AccordionItem>
|
|
27
|
+
<AccordionItem value="item-2">
|
|
28
|
+
<AccordionTrigger>Is it styled?</AccordionTrigger>
|
|
29
|
+
<AccordionContent>
|
|
30
|
+
Yes. It comes with default styles that match the Dilipod design system.
|
|
31
|
+
</AccordionContent>
|
|
32
|
+
</AccordionItem>
|
|
33
|
+
<AccordionItem value="item-3">
|
|
34
|
+
<AccordionTrigger>Is it animated?</AccordionTrigger>
|
|
35
|
+
<AccordionContent>
|
|
36
|
+
Yes. It's animated by default, but you can disable it if needed.
|
|
37
|
+
</AccordionContent>
|
|
38
|
+
</AccordionItem>
|
|
39
|
+
</Accordion>
|
|
40
|
+
),
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const Multiple: Story = {
|
|
44
|
+
render: () => (
|
|
45
|
+
<Accordion type="multiple" className="w-full">
|
|
46
|
+
<AccordionItem value="item-1">
|
|
47
|
+
<AccordionTrigger>First Item</AccordionTrigger>
|
|
48
|
+
<AccordionContent>
|
|
49
|
+
This is the content for the first accordion item.
|
|
50
|
+
</AccordionContent>
|
|
51
|
+
</AccordionItem>
|
|
52
|
+
<AccordionItem value="item-2">
|
|
53
|
+
<AccordionTrigger>Second Item</AccordionTrigger>
|
|
54
|
+
<AccordionContent>
|
|
55
|
+
This is the content for the second accordion item.
|
|
56
|
+
</AccordionContent>
|
|
57
|
+
</AccordionItem>
|
|
58
|
+
<AccordionItem value="item-3">
|
|
59
|
+
<AccordionTrigger>Third Item</AccordionTrigger>
|
|
60
|
+
<AccordionContent>
|
|
61
|
+
This is the content for the third accordion item.
|
|
62
|
+
</AccordionContent>
|
|
63
|
+
</AccordionItem>
|
|
64
|
+
</Accordion>
|
|
65
|
+
),
|
|
66
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion'
|
|
5
|
+
import { CaretDown } from '../icons'
|
|
6
|
+
|
|
7
|
+
import { cn } from '../lib/utils'
|
|
8
|
+
|
|
9
|
+
const Accordion = AccordionPrimitive.Root
|
|
10
|
+
|
|
11
|
+
const AccordionItem = React.forwardRef<
|
|
12
|
+
React.ElementRef<typeof AccordionPrimitive.Item>,
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
|
|
14
|
+
>(({ className, ...props }, ref) => (
|
|
15
|
+
<AccordionPrimitive.Item
|
|
16
|
+
ref={ref}
|
|
17
|
+
className={cn('border-b border-gray-200', className)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
))
|
|
21
|
+
AccordionItem.displayName = 'AccordionItem'
|
|
22
|
+
|
|
23
|
+
const AccordionTrigger = React.forwardRef<
|
|
24
|
+
React.ElementRef<typeof AccordionPrimitive.Trigger>,
|
|
25
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
|
|
26
|
+
>(({ className, children, ...props }, ref) => (
|
|
27
|
+
<AccordionPrimitive.Header className="flex">
|
|
28
|
+
<AccordionPrimitive.Trigger
|
|
29
|
+
ref={ref}
|
|
30
|
+
className={cn(
|
|
31
|
+
'flex flex-1 items-center justify-between py-4 font-medium text-[var(--black)] transition-all hover:underline [&[data-state=open]>svg]:rotate-180',
|
|
32
|
+
className
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
<CaretDown className="h-4 w-4 shrink-0 text-gray-500 transition-transform duration-200" />
|
|
38
|
+
</AccordionPrimitive.Trigger>
|
|
39
|
+
</AccordionPrimitive.Header>
|
|
40
|
+
))
|
|
41
|
+
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
|
|
42
|
+
|
|
43
|
+
const AccordionContent = React.forwardRef<
|
|
44
|
+
React.ElementRef<typeof AccordionPrimitive.Content>,
|
|
45
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
|
|
46
|
+
>(({ className, children, ...props }, ref) => (
|
|
47
|
+
<AccordionPrimitive.Content
|
|
48
|
+
ref={ref}
|
|
49
|
+
className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
|
|
50
|
+
{...props}
|
|
51
|
+
>
|
|
52
|
+
<div className={cn('pb-4 pt-0', className)}>{children}</div>
|
|
53
|
+
</AccordionPrimitive.Content>
|
|
54
|
+
))
|
|
55
|
+
|
|
56
|
+
AccordionContent.displayName = AccordionPrimitive.Content.displayName
|
|
57
|
+
|
|
58
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Input } from './input'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Input> = {
|
|
5
|
+
title: 'Components/Input',
|
|
6
|
+
component: Input,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {
|
|
9
|
+
type: {
|
|
10
|
+
control: 'select',
|
|
11
|
+
options: ['text', 'email', 'password', 'number', 'tel', 'url'],
|
|
12
|
+
},
|
|
13
|
+
disabled: {
|
|
14
|
+
control: 'boolean',
|
|
15
|
+
},
|
|
16
|
+
placeholder: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default meta
|
|
23
|
+
type Story = StoryObj<typeof Input>
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
placeholder: 'Enter text...',
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const Email: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
type: 'email',
|
|
34
|
+
placeholder: 'email@example.com',
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const Password: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
type: 'password',
|
|
41
|
+
placeholder: 'Enter password',
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const Disabled: Story = {
|
|
46
|
+
args: {
|
|
47
|
+
placeholder: 'Disabled input',
|
|
48
|
+
disabled: true,
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const WithValue: Story = {
|
|
53
|
+
args: {
|
|
54
|
+
value: 'Sample text',
|
|
55
|
+
readOnly: true,
|
|
56
|
+
},
|
|
57
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { cn } from '../lib/utils'
|
|
5
|
+
|
|
6
|
+
export interface InputProps
|
|
7
|
+
extends React.InputHTMLAttributes<HTMLInputElement> {}
|
|
8
|
+
|
|
9
|
+
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
10
|
+
({ className, type, ...props }, ref) => {
|
|
11
|
+
return (
|
|
12
|
+
<input
|
|
13
|
+
type={type}
|
|
14
|
+
className={cn(
|
|
15
|
+
'flex h-10 w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-base text-[var(--black)] ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-[var(--black)] placeholder:text-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--cyan)] focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm transition-colors',
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
ref={ref}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
Input.displayName = 'Input'
|
|
25
|
+
|
|
26
|
+
export { Input }
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Label } from './label'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Label> = {
|
|
5
|
+
title: 'Components/Label',
|
|
6
|
+
component: Label,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {
|
|
9
|
+
htmlFor: {
|
|
10
|
+
control: 'text',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default meta
|
|
16
|
+
type Story = StoryObj<typeof Label>
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
children: 'Label',
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const WithHtmlFor: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
children: 'Email Address',
|
|
27
|
+
htmlFor: 'email',
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const Required: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
children: (
|
|
34
|
+
<>
|
|
35
|
+
Name <span className="text-red-500">*</span>
|
|
36
|
+
</>
|
|
37
|
+
),
|
|
38
|
+
},
|
|
39
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as LabelPrimitive from '@radix-ui/react-label'
|
|
5
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
6
|
+
|
|
7
|
+
import { cn } from '../lib/utils'
|
|
8
|
+
|
|
9
|
+
const labelVariants = cva(
|
|
10
|
+
'text-sm font-medium leading-none text-[var(--black)] peer-disabled:cursor-not-allowed peer-disabled:opacity-70'
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
const Label = React.forwardRef<
|
|
14
|
+
React.ElementRef<typeof LabelPrimitive.Root>,
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
|
|
16
|
+
VariantProps<typeof labelVariants>
|
|
17
|
+
>(({ className, ...props }, ref) => (
|
|
18
|
+
<LabelPrimitive.Root
|
|
19
|
+
ref={ref}
|
|
20
|
+
className={cn(labelVariants(), className)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
))
|
|
24
|
+
Label.displayName = LabelPrimitive.Root.displayName
|
|
25
|
+
|
|
26
|
+
export type { LabelProps } from '@radix-ui/react-label'
|
|
27
|
+
export { Label }
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import {
|
|
3
|
+
NavigationMenu,
|
|
4
|
+
NavigationMenuContent,
|
|
5
|
+
NavigationMenuItem,
|
|
6
|
+
NavigationMenuLink,
|
|
7
|
+
NavigationMenuList,
|
|
8
|
+
NavigationMenuTrigger,
|
|
9
|
+
} from './navigation-menu'
|
|
10
|
+
|
|
11
|
+
const meta: Meta<typeof NavigationMenu> = {
|
|
12
|
+
title: 'Components/NavigationMenu',
|
|
13
|
+
component: NavigationMenu,
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default meta
|
|
18
|
+
type Story = StoryObj<typeof NavigationMenu>
|
|
19
|
+
|
|
20
|
+
export const Default: Story = {
|
|
21
|
+
render: () => (
|
|
22
|
+
<NavigationMenu>
|
|
23
|
+
<NavigationMenuList>
|
|
24
|
+
<NavigationMenuItem>
|
|
25
|
+
<NavigationMenuTrigger>Getting started</NavigationMenuTrigger>
|
|
26
|
+
<NavigationMenuContent>
|
|
27
|
+
<ul className="grid gap-3 p-6 md:w-[400px] lg:w-[500px] lg:grid-cols-[.75fr_1fr]">
|
|
28
|
+
<li className="row-span-3">
|
|
29
|
+
<NavigationMenuLink asChild>
|
|
30
|
+
<a
|
|
31
|
+
className="flex h-full w-full select-none flex-col justify-end rounded-md bg-gradient-to-b from-gray-50 to-gray-100 p-6 no-underline outline-none focus:shadow-md"
|
|
32
|
+
href="/"
|
|
33
|
+
>
|
|
34
|
+
<div className="mb-2 mt-4 text-lg font-medium">
|
|
35
|
+
Dilipod UI
|
|
36
|
+
</div>
|
|
37
|
+
<p className="text-sm leading-tight text-gray-600">
|
|
38
|
+
Beautifully designed components built with Radix UI and
|
|
39
|
+
Tailwind CSS.
|
|
40
|
+
</p>
|
|
41
|
+
</a>
|
|
42
|
+
</NavigationMenuLink>
|
|
43
|
+
</li>
|
|
44
|
+
<li>
|
|
45
|
+
<NavigationMenuLink asChild>
|
|
46
|
+
<a
|
|
47
|
+
className="block select-none space-y-1 rounded-md p-3 leading-none no-underline outline-none transition-colors hover:bg-gray-100 hover:text-gray-900 focus:bg-gray-100 focus:text-gray-900"
|
|
48
|
+
href="/"
|
|
49
|
+
>
|
|
50
|
+
<div className="text-sm font-medium leading-none">
|
|
51
|
+
Introduction
|
|
52
|
+
</div>
|
|
53
|
+
<p className="line-clamp-2 text-sm leading-snug text-gray-600">
|
|
54
|
+
Re-usable components built using Radix UI and Tailwind CSS.
|
|
55
|
+
</p>
|
|
56
|
+
</a>
|
|
57
|
+
</NavigationMenuLink>
|
|
58
|
+
</li>
|
|
59
|
+
<li>
|
|
60
|
+
<NavigationMenuLink asChild>
|
|
61
|
+
<a
|
|
62
|
+
className="block select-none space-y-1 rounded-md p-3 leading-none no-underline outline-none transition-colors hover:bg-gray-100 hover:text-gray-900 focus:bg-gray-100 focus:text-gray-900"
|
|
63
|
+
href="/"
|
|
64
|
+
>
|
|
65
|
+
<div className="text-sm font-medium leading-none">
|
|
66
|
+
Installation
|
|
67
|
+
</div>
|
|
68
|
+
<p className="line-clamp-2 text-sm leading-snug text-gray-600">
|
|
69
|
+
How to install dependencies and structure your app.
|
|
70
|
+
</p>
|
|
71
|
+
</a>
|
|
72
|
+
</NavigationMenuLink>
|
|
73
|
+
</li>
|
|
74
|
+
</ul>
|
|
75
|
+
</NavigationMenuContent>
|
|
76
|
+
</NavigationMenuItem>
|
|
77
|
+
<NavigationMenuItem>
|
|
78
|
+
<NavigationMenuLink
|
|
79
|
+
className="group inline-flex h-10 w-max items-center justify-center rounded-md bg-white px-4 py-2 text-sm font-medium transition-colors hover:bg-gray-100 hover:text-gray-900 focus:bg-gray-100 focus:text-gray-900 focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-gray-100/50 data-[state=open]:bg-gray-100/50"
|
|
80
|
+
href="/"
|
|
81
|
+
>
|
|
82
|
+
Components
|
|
83
|
+
</NavigationMenuLink>
|
|
84
|
+
</NavigationMenuItem>
|
|
85
|
+
</NavigationMenuList>
|
|
86
|
+
</NavigationMenu>
|
|
87
|
+
),
|
|
88
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu'
|
|
5
|
+
import { cva } from 'class-variance-authority'
|
|
6
|
+
import { CaretDown } from '../icons'
|
|
7
|
+
|
|
8
|
+
import { cn } from '../lib/utils'
|
|
9
|
+
|
|
10
|
+
const NavigationMenu = React.forwardRef<
|
|
11
|
+
React.ElementRef<typeof NavigationMenuPrimitive.Root>,
|
|
12
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>
|
|
13
|
+
>(({ className, children, ...props }, ref) => (
|
|
14
|
+
<NavigationMenuPrimitive.Root
|
|
15
|
+
ref={ref}
|
|
16
|
+
className={cn(
|
|
17
|
+
'relative z-10 flex max-w-max flex-1 items-center justify-center',
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
{children}
|
|
23
|
+
<NavigationMenuViewport />
|
|
24
|
+
</NavigationMenuPrimitive.Root>
|
|
25
|
+
))
|
|
26
|
+
NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName
|
|
27
|
+
|
|
28
|
+
const NavigationMenuList = React.forwardRef<
|
|
29
|
+
React.ElementRef<typeof NavigationMenuPrimitive.List>,
|
|
30
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>
|
|
31
|
+
>(({ className, ...props }, ref) => (
|
|
32
|
+
<NavigationMenuPrimitive.List
|
|
33
|
+
ref={ref}
|
|
34
|
+
className={cn(
|
|
35
|
+
'group flex flex-1 list-none items-center justify-center space-x-1',
|
|
36
|
+
className
|
|
37
|
+
)}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
))
|
|
41
|
+
NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName
|
|
42
|
+
|
|
43
|
+
const NavigationMenuItem = NavigationMenuPrimitive.Item
|
|
44
|
+
|
|
45
|
+
const navigationMenuTriggerStyle = cva(
|
|
46
|
+
'group inline-flex h-10 w-max items-center justify-center rounded-md bg-white px-4 py-2 text-sm font-medium text-[var(--black)] transition-colors hover:bg-gray-100 hover:text-[var(--black)] focus:bg-gray-100 focus:text-[var(--black)] focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=open]:text-[var(--black)] data-[state=open]:bg-gray-100/50 data-[state=open]:hover:bg-gray-100 data-[state=open]:focus:bg-gray-100'
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
const NavigationMenuTrigger = React.forwardRef<
|
|
50
|
+
React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
|
|
51
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>
|
|
52
|
+
>(({ className, children, ...props }, ref) => (
|
|
53
|
+
<NavigationMenuPrimitive.Trigger
|
|
54
|
+
ref={ref}
|
|
55
|
+
className={cn(navigationMenuTriggerStyle(), 'group', className)}
|
|
56
|
+
{...props}
|
|
57
|
+
>
|
|
58
|
+
{children}{' '}
|
|
59
|
+
<CaretDown
|
|
60
|
+
className="relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180"
|
|
61
|
+
aria-hidden="true"
|
|
62
|
+
/>
|
|
63
|
+
</NavigationMenuPrimitive.Trigger>
|
|
64
|
+
))
|
|
65
|
+
NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName
|
|
66
|
+
|
|
67
|
+
const NavigationMenuContent = React.forwardRef<
|
|
68
|
+
React.ElementRef<typeof NavigationMenuPrimitive.Content>,
|
|
69
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>
|
|
70
|
+
>(({ className, ...props }, ref) => (
|
|
71
|
+
<NavigationMenuPrimitive.Content
|
|
72
|
+
ref={ref}
|
|
73
|
+
className={cn(
|
|
74
|
+
'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 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',
|
|
75
|
+
className
|
|
76
|
+
)}
|
|
77
|
+
{...props}
|
|
78
|
+
/>
|
|
79
|
+
))
|
|
80
|
+
NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName
|
|
81
|
+
|
|
82
|
+
const NavigationMenuLink = NavigationMenuPrimitive.Link
|
|
83
|
+
|
|
84
|
+
const NavigationMenuViewport = React.forwardRef<
|
|
85
|
+
React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,
|
|
86
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>
|
|
87
|
+
>(({ className, ...props }, ref) => (
|
|
88
|
+
<div className={cn('absolute left-0 top-full flex justify-center')}>
|
|
89
|
+
<NavigationMenuPrimitive.Viewport
|
|
90
|
+
className={cn(
|
|
91
|
+
'origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border border-gray-200 bg-white text-[var(--black)] 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)]',
|
|
92
|
+
className
|
|
93
|
+
)}
|
|
94
|
+
ref={ref}
|
|
95
|
+
{...props}
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
))
|
|
99
|
+
NavigationMenuViewport.displayName =
|
|
100
|
+
NavigationMenuPrimitive.Viewport.displayName
|
|
101
|
+
|
|
102
|
+
const NavigationMenuIndicator = React.forwardRef<
|
|
103
|
+
React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,
|
|
104
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>
|
|
105
|
+
>(({ className, ...props }, ref) => (
|
|
106
|
+
<NavigationMenuPrimitive.Indicator
|
|
107
|
+
ref={ref}
|
|
108
|
+
className={cn(
|
|
109
|
+
'top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in',
|
|
110
|
+
className
|
|
111
|
+
)}
|
|
112
|
+
{...props}
|
|
113
|
+
>
|
|
114
|
+
<div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-gray-200 shadow-md" />
|
|
115
|
+
</NavigationMenuPrimitive.Indicator>
|
|
116
|
+
))
|
|
117
|
+
NavigationMenuIndicator.displayName =
|
|
118
|
+
NavigationMenuPrimitive.Indicator.displayName
|
|
119
|
+
|
|
120
|
+
export {
|
|
121
|
+
navigationMenuTriggerStyle,
|
|
122
|
+
NavigationMenu,
|
|
123
|
+
NavigationMenuList,
|
|
124
|
+
NavigationMenuItem,
|
|
125
|
+
NavigationMenuContent,
|
|
126
|
+
NavigationMenuTrigger,
|
|
127
|
+
NavigationMenuLink,
|
|
128
|
+
NavigationMenuIndicator,
|
|
129
|
+
NavigationMenuViewport,
|
|
130
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Separator } from './separator'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Separator> = {
|
|
5
|
+
title: 'Components/Separator',
|
|
6
|
+
component: Separator,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {
|
|
9
|
+
orientation: {
|
|
10
|
+
control: 'select',
|
|
11
|
+
options: ['horizontal', 'vertical'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default meta
|
|
17
|
+
type Story = StoryObj<typeof Separator>
|
|
18
|
+
|
|
19
|
+
export const Horizontal: Story = {
|
|
20
|
+
render: () => (
|
|
21
|
+
<div className="w-full">
|
|
22
|
+
<div className="space-y-1">
|
|
23
|
+
<h4 className="text-sm font-medium leading-none">Radix Primitives</h4>
|
|
24
|
+
<p className="text-sm text-gray-500">
|
|
25
|
+
An open-source UI component library.
|
|
26
|
+
</p>
|
|
27
|
+
</div>
|
|
28
|
+
<Separator className="my-4" />
|
|
29
|
+
<div className="flex h-5 items-center space-x-4 text-sm">
|
|
30
|
+
<div>Blog</div>
|
|
31
|
+
<Separator orientation="vertical" />
|
|
32
|
+
<div>Docs</div>
|
|
33
|
+
<Separator orientation="vertical" />
|
|
34
|
+
<div>Source</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
),
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const Vertical: Story = {
|
|
41
|
+
render: () => (
|
|
42
|
+
<div className="flex h-5 items-center space-x-4 text-sm">
|
|
43
|
+
<div>Blog</div>
|
|
44
|
+
<Separator orientation="vertical" />
|
|
45
|
+
<div>Docs</div>
|
|
46
|
+
<Separator orientation="vertical" />
|
|
47
|
+
<div>Source</div>
|
|
48
|
+
</div>
|
|
49
|
+
),
|
|
50
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator'
|
|
5
|
+
|
|
6
|
+
import { cn } from '../lib/utils'
|
|
7
|
+
|
|
8
|
+
const Separator = React.forwardRef<
|
|
9
|
+
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
10
|
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
11
|
+
>(
|
|
12
|
+
(
|
|
13
|
+
{ className, orientation = 'horizontal', decorative = true, ...props },
|
|
14
|
+
ref
|
|
15
|
+
) => (
|
|
16
|
+
<SeparatorPrimitive.Root
|
|
17
|
+
ref={ref}
|
|
18
|
+
decorative={decorative}
|
|
19
|
+
orientation={orientation}
|
|
20
|
+
className={cn(
|
|
21
|
+
'shrink-0 bg-gray-200',
|
|
22
|
+
orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
)
|
|
29
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName
|
|
30
|
+
|
|
31
|
+
export type { SeparatorProps } from '@radix-ui/react-separator'
|
|
32
|
+
export { Separator }
|
package/src/components/sheet.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
'use client'
|
|
2
3
|
|
|
3
4
|
import * as React from 'react'
|
|
@@ -19,6 +20,7 @@ const SheetOverlay = React.forwardRef<
|
|
|
19
20
|
React.ElementRef<typeof SheetPrimitive.Overlay>,
|
|
20
21
|
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
|
|
21
22
|
>(({ className, ...props }, ref) => (
|
|
23
|
+
// @ts-ignore - Radix Dialog Overlay accepts className at runtime
|
|
22
24
|
<SheetPrimitive.Overlay
|
|
23
25
|
className={cn(
|
|
24
26
|
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
@@ -65,6 +67,7 @@ const SheetContent = React.forwardRef<
|
|
|
65
67
|
{...props}
|
|
66
68
|
>
|
|
67
69
|
{children}
|
|
70
|
+
{/* @ts-expect-error - Radix Dialog Close accepts className and children at runtime */}
|
|
68
71
|
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-[var(--cyan)] focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-gray-100">
|
|
69
72
|
<X className="h-4 w-4" />
|
|
70
73
|
<span className="sr-only">Close</span>
|
|
@@ -106,6 +109,7 @@ const SheetTitle = React.forwardRef<
|
|
|
106
109
|
React.ElementRef<typeof SheetPrimitive.Title>,
|
|
107
110
|
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
|
|
108
111
|
>(({ className, ...props }, ref) => (
|
|
112
|
+
// @ts-ignore - Radix Dialog Title accepts className at runtime
|
|
109
113
|
<SheetPrimitive.Title
|
|
110
114
|
ref={ref}
|
|
111
115
|
className={cn('text-lg font-semibold text-[var(--black)]', className)}
|
|
@@ -118,6 +122,7 @@ const SheetDescription = React.forwardRef<
|
|
|
118
122
|
React.ElementRef<typeof SheetPrimitive.Description>,
|
|
119
123
|
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
|
|
120
124
|
>(({ className, ...props }, ref) => (
|
|
125
|
+
// @ts-ignore - Radix Dialog Description accepts className at runtime
|
|
121
126
|
<SheetPrimitive.Description
|
|
122
127
|
ref={ref}
|
|
123
128
|
className={cn('text-sm text-gray-500', className)}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Textarea } from './textarea'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Textarea> = {
|
|
5
|
+
title: 'Components/Textarea',
|
|
6
|
+
component: Textarea,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {
|
|
9
|
+
rows: {
|
|
10
|
+
control: 'number',
|
|
11
|
+
},
|
|
12
|
+
disabled: {
|
|
13
|
+
control: 'boolean',
|
|
14
|
+
},
|
|
15
|
+
placeholder: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default meta
|
|
22
|
+
type Story = StoryObj<typeof Textarea>
|
|
23
|
+
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
placeholder: 'Enter your message...',
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const WithRows: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
placeholder: 'Enter your message...',
|
|
33
|
+
rows: 6,
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const Disabled: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
placeholder: 'Disabled textarea',
|
|
40
|
+
disabled: true,
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const WithValue: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
value: 'This is a sample textarea with some content.',
|
|
47
|
+
readOnly: true,
|
|
48
|
+
},
|
|
49
|
+
}
|