@dilipod/ui 0.2.7 → 0.2.9
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/components/dialog.d.ts +20 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/sidebar.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +116 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +108 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/card.tsx +1 -1
- package/src/components/checkbox.tsx +5 -5
- package/src/components/dialog.tsx +122 -0
- package/src/components/sidebar.tsx +17 -13
- package/src/components/toast.tsx +2 -2
- package/src/index.ts +14 -0
package/package.json
CHANGED
package/src/components/card.tsx
CHANGED
|
@@ -23,14 +23,14 @@ const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
|
|
|
23
23
|
/>
|
|
24
24
|
<div
|
|
25
25
|
className={cn(
|
|
26
|
-
'w-
|
|
27
|
-
'peer-checked:bg-
|
|
28
|
-
'peer-focus-visible:outline-none
|
|
29
|
-
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
26
|
+
'w-5 h-5 border border-gray-300 rounded-[2px] flex items-center justify-center transition-colors',
|
|
27
|
+
'peer-checked:bg-[var(--black)] peer-checked:border-[var(--black)]',
|
|
28
|
+
'peer-focus-visible:outline-none',
|
|
29
|
+
'peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
|
|
30
30
|
className
|
|
31
31
|
)}
|
|
32
32
|
>
|
|
33
|
-
{checked && <Check className="h-3 w-3 text-white" weight="bold" />}
|
|
33
|
+
{checked && <Check className="h-3.5 w-3.5 text-white" weight="bold" />}
|
|
34
34
|
</div>
|
|
35
35
|
</label>
|
|
36
36
|
)
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog'
|
|
5
|
+
import { X } from '@phosphor-icons/react'
|
|
6
|
+
|
|
7
|
+
import { cn } from '../lib/utils'
|
|
8
|
+
|
|
9
|
+
const Dialog = DialogPrimitive.Root
|
|
10
|
+
|
|
11
|
+
const DialogTrigger = DialogPrimitive.Trigger
|
|
12
|
+
|
|
13
|
+
const DialogPortal = DialogPrimitive.Portal
|
|
14
|
+
|
|
15
|
+
const DialogClose = DialogPrimitive.Close
|
|
16
|
+
|
|
17
|
+
const DialogOverlay = React.forwardRef<
|
|
18
|
+
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
|
19
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
20
|
+
>(({ className, ...props }, ref) => (
|
|
21
|
+
<DialogPrimitive.Overlay
|
|
22
|
+
ref={ref}
|
|
23
|
+
className={cn(
|
|
24
|
+
'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',
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
))
|
|
30
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
|
|
31
|
+
|
|
32
|
+
const DialogContent = React.forwardRef<
|
|
33
|
+
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
34
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
|
35
|
+
>(({ className, children, ...props }, ref) => (
|
|
36
|
+
<DialogPortal>
|
|
37
|
+
<DialogOverlay />
|
|
38
|
+
<DialogPrimitive.Content
|
|
39
|
+
ref={ref}
|
|
40
|
+
className={cn(
|
|
41
|
+
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
|
|
42
|
+
className
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
>
|
|
46
|
+
{children}
|
|
47
|
+
<DialogPrimitive.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">
|
|
48
|
+
<X className="h-4 w-4" />
|
|
49
|
+
<span className="sr-only">Close</span>
|
|
50
|
+
</DialogPrimitive.Close>
|
|
51
|
+
</DialogPrimitive.Content>
|
|
52
|
+
</DialogPortal>
|
|
53
|
+
))
|
|
54
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName
|
|
55
|
+
|
|
56
|
+
const DialogHeader = ({
|
|
57
|
+
className,
|
|
58
|
+
...props
|
|
59
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
60
|
+
<div
|
|
61
|
+
className={cn(
|
|
62
|
+
'flex flex-col space-y-1.5 text-center sm:text-left',
|
|
63
|
+
className
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
)
|
|
68
|
+
DialogHeader.displayName = 'DialogHeader'
|
|
69
|
+
|
|
70
|
+
const DialogFooter = ({
|
|
71
|
+
className,
|
|
72
|
+
...props
|
|
73
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
74
|
+
<div
|
|
75
|
+
className={cn(
|
|
76
|
+
'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
|
|
77
|
+
className
|
|
78
|
+
)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
DialogFooter.displayName = 'DialogFooter'
|
|
83
|
+
|
|
84
|
+
const DialogTitle = React.forwardRef<
|
|
85
|
+
React.ElementRef<typeof DialogPrimitive.Title>,
|
|
86
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
87
|
+
>(({ className, ...props }, ref) => (
|
|
88
|
+
<DialogPrimitive.Title
|
|
89
|
+
ref={ref}
|
|
90
|
+
className={cn(
|
|
91
|
+
'text-lg font-semibold leading-none tracking-tight text-[var(--black)]',
|
|
92
|
+
className
|
|
93
|
+
)}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
))
|
|
97
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName
|
|
98
|
+
|
|
99
|
+
const DialogDescription = React.forwardRef<
|
|
100
|
+
React.ElementRef<typeof DialogPrimitive.Description>,
|
|
101
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
102
|
+
>(({ className, ...props }, ref) => (
|
|
103
|
+
<DialogPrimitive.Description
|
|
104
|
+
ref={ref}
|
|
105
|
+
className={cn('text-sm text-muted-foreground', className)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
))
|
|
109
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName
|
|
110
|
+
|
|
111
|
+
export {
|
|
112
|
+
Dialog,
|
|
113
|
+
DialogPortal,
|
|
114
|
+
DialogOverlay,
|
|
115
|
+
DialogClose,
|
|
116
|
+
DialogTrigger,
|
|
117
|
+
DialogContent,
|
|
118
|
+
DialogHeader,
|
|
119
|
+
DialogFooter,
|
|
120
|
+
DialogTitle,
|
|
121
|
+
DialogDescription,
|
|
122
|
+
}
|
|
@@ -119,7 +119,7 @@ const Sidebar = React.forwardRef<HTMLElement, SidebarProps>(
|
|
|
119
119
|
<aside
|
|
120
120
|
ref={ref}
|
|
121
121
|
className={cn(
|
|
122
|
-
'flex h-full w-60 flex-col border-r bg-background/50',
|
|
122
|
+
'relative flex h-full w-60 flex-col border-r bg-background/50',
|
|
123
123
|
className
|
|
124
124
|
)}
|
|
125
125
|
{...props}
|
|
@@ -166,7 +166,7 @@ const Sidebar = React.forwardRef<HTMLElement, SidebarProps>(
|
|
|
166
166
|
{children}
|
|
167
167
|
|
|
168
168
|
{/* Bottom Navigation */}
|
|
169
|
-
{(bottomNav.length > 0 || helpLink
|
|
169
|
+
{(bottomNav.length > 0 || helpLink) && (
|
|
170
170
|
<div className="px-3 pb-3 space-y-1 border-t pt-3">
|
|
171
171
|
{bottomNav.map((item) => (
|
|
172
172
|
<SidebarNavItem
|
|
@@ -176,17 +176,6 @@ const Sidebar = React.forwardRef<HTMLElement, SidebarProps>(
|
|
|
176
176
|
LinkComponent={LinkComponent}
|
|
177
177
|
/>
|
|
178
178
|
))}
|
|
179
|
-
{assistantButton && (
|
|
180
|
-
<button
|
|
181
|
-
onClick={assistantButton.onClick}
|
|
182
|
-
className="flex w-full items-center gap-3 rounded-sm px-3 py-2 text-sm bg-[var(--cyan)]/10 text-[var(--black)] hover:bg-[var(--cyan)]/20 transition-colors font-medium"
|
|
183
|
-
>
|
|
184
|
-
{assistantButton.icon && (
|
|
185
|
-
<assistantButton.icon className="h-4 w-4 text-[var(--cyan)]" />
|
|
186
|
-
)}
|
|
187
|
-
{assistantButton.label}
|
|
188
|
-
</button>
|
|
189
|
-
)}
|
|
190
179
|
{helpLink && (
|
|
191
180
|
<a
|
|
192
181
|
href={helpLink.href}
|
|
@@ -200,6 +189,21 @@ const Sidebar = React.forwardRef<HTMLElement, SidebarProps>(
|
|
|
200
189
|
)}
|
|
201
190
|
</div>
|
|
202
191
|
)}
|
|
192
|
+
|
|
193
|
+
{/* Floating Assistant Button */}
|
|
194
|
+
{assistantButton && (
|
|
195
|
+
<div className="absolute bottom-4 left-4">
|
|
196
|
+
<button
|
|
197
|
+
onClick={assistantButton.onClick}
|
|
198
|
+
className="flex h-10 w-10 items-center justify-center rounded-full bg-[var(--cyan)] text-white shadow-lg hover:bg-[var(--cyan)]/90 transition-colors"
|
|
199
|
+
title={assistantButton.label}
|
|
200
|
+
>
|
|
201
|
+
{assistantButton.icon && (
|
|
202
|
+
<assistantButton.icon className="h-5 w-5" />
|
|
203
|
+
)}
|
|
204
|
+
</button>
|
|
205
|
+
</div>
|
|
206
|
+
)}
|
|
203
207
|
</aside>
|
|
204
208
|
)
|
|
205
209
|
}
|
package/src/components/toast.tsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import * as ToastPrimitives from '@radix-ui/react-toast'
|
|
5
5
|
import { cva, type VariantProps } from 'class-variance-authority'
|
|
6
|
-
import { X,
|
|
6
|
+
import { X, Check, WarningCircle, Info } from '@phosphor-icons/react'
|
|
7
7
|
import { cn } from '../lib/utils'
|
|
8
8
|
|
|
9
9
|
const ToastProvider = ToastPrimitives.Provider
|
|
@@ -120,7 +120,7 @@ type ToastActionElement = React.ReactElement<typeof ToastAction>
|
|
|
120
120
|
const ToastIcon = ({ variant }: { variant?: 'default' | 'success' | 'error' | 'warning' }) => {
|
|
121
121
|
switch (variant) {
|
|
122
122
|
case 'success':
|
|
123
|
-
return <
|
|
123
|
+
return <Check size={20} weight="bold" className="text-emerald-600" />
|
|
124
124
|
case 'error':
|
|
125
125
|
return <WarningCircle size={20} weight="fill" className="text-red-600" />
|
|
126
126
|
case 'warning':
|
package/src/index.ts
CHANGED
|
@@ -139,6 +139,20 @@ export {
|
|
|
139
139
|
export { Divider } from './components/divider'
|
|
140
140
|
export type { DividerProps } from './components/divider'
|
|
141
141
|
|
|
142
|
+
// Dialog Components
|
|
143
|
+
export {
|
|
144
|
+
Dialog,
|
|
145
|
+
DialogPortal,
|
|
146
|
+
DialogOverlay,
|
|
147
|
+
DialogClose,
|
|
148
|
+
DialogTrigger,
|
|
149
|
+
DialogContent,
|
|
150
|
+
DialogHeader,
|
|
151
|
+
DialogFooter,
|
|
152
|
+
DialogTitle,
|
|
153
|
+
DialogDescription,
|
|
154
|
+
} from './components/dialog'
|
|
155
|
+
|
|
142
156
|
// Toast Components
|
|
143
157
|
export {
|
|
144
158
|
ToastProvider,
|