@silicajs/ui 0.1.0 → 0.1.2
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 +13 -4
- package/postcss.config.mjs +1 -1
- package/src/components/avatar.tsx +109 -0
- package/src/components/badge.tsx +9 -9
- package/src/components/breadcrumb.tsx +18 -21
- package/src/components/button.tsx +7 -7
- package/src/components/card.tsx +15 -15
- package/src/components/collapsible.tsx +6 -6
- package/src/components/command.tsx +30 -30
- package/src/components/dialog.tsx +24 -25
- package/src/components/dropdown-menu.tsx +47 -43
- package/src/components/input-group.tsx +25 -25
- package/src/components/input.tsx +6 -6
- package/src/components/scroll-area.tsx +8 -8
- package/src/components/separator.tsx +6 -6
- package/src/components/sheet.tsx +22 -23
- package/src/components/sidebar.tsx +124 -124
- package/src/components/skeleton.tsx +3 -3
- package/src/components/textarea.tsx +5 -5
- package/src/components/toc-list.tsx +5 -2
- package/src/components/tooltip.tsx +9 -9
- package/src/hooks/use-mobile.ts +13 -11
- package/src/lib/utils.ts +3 -3
- package/src/styles/globals.css +100 -2
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog"
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
5
5
|
|
|
6
|
-
import { cn } from "@silicajs/ui/lib/utils"
|
|
7
|
-
import { Button } from "@silicajs/ui/components/button"
|
|
8
|
-
import { XIcon } from "lucide-react"
|
|
6
|
+
import { cn } from "@silicajs/ui/lib/utils";
|
|
7
|
+
import { Button } from "@silicajs/ui/components/button";
|
|
8
|
+
import { XIcon } from "lucide-react";
|
|
9
9
|
|
|
10
10
|
function Dialog({ ...props }: DialogPrimitive.Root.Props) {
|
|
11
|
-
return <DialogPrimitive.Root data-slot="dialog" {...props}
|
|
11
|
+
return <DialogPrimitive.Root data-slot="dialog" {...props} />;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) {
|
|
15
|
-
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props}
|
|
15
|
+
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function DialogPortal({ ...props }: DialogPrimitive.Portal.Props) {
|
|
19
|
-
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props}
|
|
19
|
+
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function DialogClose({ ...props }: DialogPrimitive.Close.Props) {
|
|
23
|
-
return <DialogPrimitive.Close data-slot="dialog-close" {...props}
|
|
23
|
+
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
function DialogOverlay({
|
|
@@ -32,11 +32,11 @@ function DialogOverlay({
|
|
|
32
32
|
data-slot="dialog-overlay"
|
|
33
33
|
className={cn(
|
|
34
34
|
"fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
|
|
35
|
-
className
|
|
35
|
+
className,
|
|
36
36
|
)}
|
|
37
37
|
{...props}
|
|
38
38
|
/>
|
|
39
|
-
)
|
|
39
|
+
);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
function DialogContent({
|
|
@@ -45,7 +45,7 @@ function DialogContent({
|
|
|
45
45
|
showCloseButton = true,
|
|
46
46
|
...props
|
|
47
47
|
}: DialogPrimitive.Popup.Props & {
|
|
48
|
-
showCloseButton?: boolean
|
|
48
|
+
showCloseButton?: boolean;
|
|
49
49
|
}) {
|
|
50
50
|
return (
|
|
51
51
|
<DialogPortal>
|
|
@@ -54,7 +54,7 @@ function DialogContent({
|
|
|
54
54
|
data-slot="dialog-content"
|
|
55
55
|
className={cn(
|
|
56
56
|
"fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
57
|
-
className
|
|
57
|
+
className,
|
|
58
58
|
)}
|
|
59
59
|
{...props}
|
|
60
60
|
>
|
|
@@ -70,14 +70,13 @@ function DialogContent({
|
|
|
70
70
|
/>
|
|
71
71
|
}
|
|
72
72
|
>
|
|
73
|
-
<XIcon
|
|
74
|
-
/>
|
|
73
|
+
<XIcon />
|
|
75
74
|
<span className="sr-only">Close</span>
|
|
76
75
|
</DialogPrimitive.Close>
|
|
77
76
|
)}
|
|
78
77
|
</DialogPrimitive.Popup>
|
|
79
78
|
</DialogPortal>
|
|
80
|
-
)
|
|
79
|
+
);
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
@@ -87,7 +86,7 @@ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
87
86
|
className={cn("flex flex-col gap-2", className)}
|
|
88
87
|
{...props}
|
|
89
88
|
/>
|
|
90
|
-
)
|
|
89
|
+
);
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
function DialogFooter({
|
|
@@ -96,14 +95,14 @@ function DialogFooter({
|
|
|
96
95
|
children,
|
|
97
96
|
...props
|
|
98
97
|
}: React.ComponentProps<"div"> & {
|
|
99
|
-
showCloseButton?: boolean
|
|
98
|
+
showCloseButton?: boolean;
|
|
100
99
|
}) {
|
|
101
100
|
return (
|
|
102
101
|
<div
|
|
103
102
|
data-slot="dialog-footer"
|
|
104
103
|
className={cn(
|
|
105
104
|
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
106
|
-
className
|
|
105
|
+
className,
|
|
107
106
|
)}
|
|
108
107
|
{...props}
|
|
109
108
|
>
|
|
@@ -114,7 +113,7 @@ function DialogFooter({
|
|
|
114
113
|
</DialogPrimitive.Close>
|
|
115
114
|
)}
|
|
116
115
|
</div>
|
|
117
|
-
)
|
|
116
|
+
);
|
|
118
117
|
}
|
|
119
118
|
|
|
120
119
|
function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
|
|
@@ -124,7 +123,7 @@ function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
|
|
|
124
123
|
className={cn("font-heading leading-none font-medium", className)}
|
|
125
124
|
{...props}
|
|
126
125
|
/>
|
|
127
|
-
)
|
|
126
|
+
);
|
|
128
127
|
}
|
|
129
128
|
|
|
130
129
|
function DialogDescription({
|
|
@@ -136,11 +135,11 @@ function DialogDescription({
|
|
|
136
135
|
data-slot="dialog-description"
|
|
137
136
|
className={cn(
|
|
138
137
|
"text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
|
|
139
|
-
className
|
|
138
|
+
className,
|
|
140
139
|
)}
|
|
141
140
|
{...props}
|
|
142
141
|
/>
|
|
143
|
-
)
|
|
142
|
+
);
|
|
144
143
|
}
|
|
145
144
|
|
|
146
145
|
export {
|
|
@@ -154,4 +153,4 @@ export {
|
|
|
154
153
|
DialogPortal,
|
|
155
154
|
DialogTitle,
|
|
156
155
|
DialogTrigger,
|
|
157
|
-
}
|
|
156
|
+
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { Menu as MenuPrimitive } from "@base-ui/react/menu"
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Menu as MenuPrimitive } from "@base-ui/react/menu";
|
|
5
5
|
|
|
6
|
-
import { cn } from "@silicajs/ui/lib/utils"
|
|
7
|
-
import { ChevronRightIcon, CheckIcon } from "lucide-react"
|
|
6
|
+
import { cn } from "@silicajs/ui/lib/utils";
|
|
7
|
+
import { ChevronRightIcon, CheckIcon } from "lucide-react";
|
|
8
8
|
|
|
9
9
|
function DropdownMenu({ ...props }: MenuPrimitive.Root.Props) {
|
|
10
|
-
return <MenuPrimitive.Root data-slot="dropdown-menu" {...props}
|
|
10
|
+
return <MenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function DropdownMenuPortal({ ...props }: MenuPrimitive.Portal.Props) {
|
|
14
|
-
return <MenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props}
|
|
14
|
+
return <MenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function DropdownMenuTrigger({ ...props }: MenuPrimitive.Trigger.Props) {
|
|
18
|
-
return <MenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props}
|
|
18
|
+
return <MenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} />;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
function DropdownMenuContent({
|
|
@@ -41,16 +41,19 @@ function DropdownMenuContent({
|
|
|
41
41
|
>
|
|
42
42
|
<MenuPrimitive.Popup
|
|
43
43
|
data-slot="dropdown-menu-content"
|
|
44
|
-
className={cn(
|
|
44
|
+
className={cn(
|
|
45
|
+
"z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
46
|
+
className,
|
|
47
|
+
)}
|
|
45
48
|
{...props}
|
|
46
49
|
/>
|
|
47
50
|
</MenuPrimitive.Positioner>
|
|
48
51
|
</MenuPrimitive.Portal>
|
|
49
|
-
)
|
|
52
|
+
);
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
function DropdownMenuGroup({ ...props }: MenuPrimitive.Group.Props) {
|
|
53
|
-
return <MenuPrimitive.Group data-slot="dropdown-menu-group" {...props}
|
|
56
|
+
return <MenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />;
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
function DropdownMenuLabel({
|
|
@@ -58,7 +61,7 @@ function DropdownMenuLabel({
|
|
|
58
61
|
inset,
|
|
59
62
|
...props
|
|
60
63
|
}: MenuPrimitive.GroupLabel.Props & {
|
|
61
|
-
inset?: boolean
|
|
64
|
+
inset?: boolean;
|
|
62
65
|
}) {
|
|
63
66
|
return (
|
|
64
67
|
<MenuPrimitive.GroupLabel
|
|
@@ -66,11 +69,11 @@ function DropdownMenuLabel({
|
|
|
66
69
|
data-inset={inset}
|
|
67
70
|
className={cn(
|
|
68
71
|
"px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-8",
|
|
69
|
-
className
|
|
72
|
+
className,
|
|
70
73
|
)}
|
|
71
74
|
{...props}
|
|
72
75
|
/>
|
|
73
|
-
)
|
|
76
|
+
);
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
function DropdownMenuItem({
|
|
@@ -79,8 +82,8 @@ function DropdownMenuItem({
|
|
|
79
82
|
variant = "default",
|
|
80
83
|
...props
|
|
81
84
|
}: MenuPrimitive.Item.Props & {
|
|
82
|
-
inset?: boolean
|
|
83
|
-
variant?: "default" | "destructive"
|
|
85
|
+
inset?: boolean;
|
|
86
|
+
variant?: "default" | "destructive";
|
|
84
87
|
}) {
|
|
85
88
|
return (
|
|
86
89
|
<MenuPrimitive.Item
|
|
@@ -88,16 +91,16 @@ function DropdownMenuItem({
|
|
|
88
91
|
data-inset={inset}
|
|
89
92
|
data-variant={variant}
|
|
90
93
|
className={cn(
|
|
91
|
-
"group/dropdown-menu-item relative flex
|
|
92
|
-
className
|
|
94
|
+
"group/dropdown-menu-item relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
|
|
95
|
+
className,
|
|
93
96
|
)}
|
|
94
97
|
{...props}
|
|
95
98
|
/>
|
|
96
|
-
)
|
|
99
|
+
);
|
|
97
100
|
}
|
|
98
101
|
|
|
99
102
|
function DropdownMenuSub({ ...props }: MenuPrimitive.SubmenuRoot.Props) {
|
|
100
|
-
return <MenuPrimitive.SubmenuRoot data-slot="dropdown-menu-sub" {...props}
|
|
103
|
+
return <MenuPrimitive.SubmenuRoot data-slot="dropdown-menu-sub" {...props} />;
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
function DropdownMenuSubTrigger({
|
|
@@ -106,22 +109,22 @@ function DropdownMenuSubTrigger({
|
|
|
106
109
|
children,
|
|
107
110
|
...props
|
|
108
111
|
}: MenuPrimitive.SubmenuTrigger.Props & {
|
|
109
|
-
inset?: boolean
|
|
112
|
+
inset?: boolean;
|
|
110
113
|
}) {
|
|
111
114
|
return (
|
|
112
115
|
<MenuPrimitive.SubmenuTrigger
|
|
113
116
|
data-slot="dropdown-menu-sub-trigger"
|
|
114
117
|
data-inset={inset}
|
|
115
118
|
className={cn(
|
|
116
|
-
"flex
|
|
117
|
-
className
|
|
119
|
+
"flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
120
|
+
className,
|
|
118
121
|
)}
|
|
119
122
|
{...props}
|
|
120
123
|
>
|
|
121
124
|
{children}
|
|
122
125
|
<ChevronRightIcon className="ml-auto" />
|
|
123
126
|
</MenuPrimitive.SubmenuTrigger>
|
|
124
|
-
)
|
|
127
|
+
);
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
function DropdownMenuSubContent({
|
|
@@ -135,14 +138,17 @@ function DropdownMenuSubContent({
|
|
|
135
138
|
return (
|
|
136
139
|
<DropdownMenuContent
|
|
137
140
|
data-slot="dropdown-menu-sub-content"
|
|
138
|
-
className={cn(
|
|
141
|
+
className={cn(
|
|
142
|
+
"w-auto min-w-[96px] rounded-md bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
143
|
+
className,
|
|
144
|
+
)}
|
|
139
145
|
align={align}
|
|
140
146
|
alignOffset={alignOffset}
|
|
141
147
|
side={side}
|
|
142
148
|
sideOffset={sideOffset}
|
|
143
149
|
{...props}
|
|
144
150
|
/>
|
|
145
|
-
)
|
|
151
|
+
);
|
|
146
152
|
}
|
|
147
153
|
|
|
148
154
|
function DropdownMenuCheckboxItem({
|
|
@@ -152,15 +158,15 @@ function DropdownMenuCheckboxItem({
|
|
|
152
158
|
inset,
|
|
153
159
|
...props
|
|
154
160
|
}: MenuPrimitive.CheckboxItem.Props & {
|
|
155
|
-
inset?: boolean
|
|
161
|
+
inset?: boolean;
|
|
156
162
|
}) {
|
|
157
163
|
return (
|
|
158
164
|
<MenuPrimitive.CheckboxItem
|
|
159
165
|
data-slot="dropdown-menu-checkbox-item"
|
|
160
166
|
data-inset={inset}
|
|
161
167
|
className={cn(
|
|
162
|
-
"relative flex
|
|
163
|
-
className
|
|
168
|
+
"relative flex items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
169
|
+
className,
|
|
164
170
|
)}
|
|
165
171
|
checked={checked}
|
|
166
172
|
{...props}
|
|
@@ -170,13 +176,12 @@ function DropdownMenuCheckboxItem({
|
|
|
170
176
|
data-slot="dropdown-menu-checkbox-item-indicator"
|
|
171
177
|
>
|
|
172
178
|
<MenuPrimitive.CheckboxItemIndicator>
|
|
173
|
-
<CheckIcon
|
|
174
|
-
/>
|
|
179
|
+
<CheckIcon />
|
|
175
180
|
</MenuPrimitive.CheckboxItemIndicator>
|
|
176
181
|
</span>
|
|
177
182
|
{children}
|
|
178
183
|
</MenuPrimitive.CheckboxItem>
|
|
179
|
-
)
|
|
184
|
+
);
|
|
180
185
|
}
|
|
181
186
|
|
|
182
187
|
function DropdownMenuRadioGroup({ ...props }: MenuPrimitive.RadioGroup.Props) {
|
|
@@ -185,7 +190,7 @@ function DropdownMenuRadioGroup({ ...props }: MenuPrimitive.RadioGroup.Props) {
|
|
|
185
190
|
data-slot="dropdown-menu-radio-group"
|
|
186
191
|
{...props}
|
|
187
192
|
/>
|
|
188
|
-
)
|
|
193
|
+
);
|
|
189
194
|
}
|
|
190
195
|
|
|
191
196
|
function DropdownMenuRadioItem({
|
|
@@ -194,15 +199,15 @@ function DropdownMenuRadioItem({
|
|
|
194
199
|
inset,
|
|
195
200
|
...props
|
|
196
201
|
}: MenuPrimitive.RadioItem.Props & {
|
|
197
|
-
inset?: boolean
|
|
202
|
+
inset?: boolean;
|
|
198
203
|
}) {
|
|
199
204
|
return (
|
|
200
205
|
<MenuPrimitive.RadioItem
|
|
201
206
|
data-slot="dropdown-menu-radio-item"
|
|
202
207
|
data-inset={inset}
|
|
203
208
|
className={cn(
|
|
204
|
-
"relative flex
|
|
205
|
-
className
|
|
209
|
+
"relative flex items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
210
|
+
className,
|
|
206
211
|
)}
|
|
207
212
|
{...props}
|
|
208
213
|
>
|
|
@@ -211,13 +216,12 @@ function DropdownMenuRadioItem({
|
|
|
211
216
|
data-slot="dropdown-menu-radio-item-indicator"
|
|
212
217
|
>
|
|
213
218
|
<MenuPrimitive.RadioItemIndicator>
|
|
214
|
-
<CheckIcon
|
|
215
|
-
/>
|
|
219
|
+
<CheckIcon />
|
|
216
220
|
</MenuPrimitive.RadioItemIndicator>
|
|
217
221
|
</span>
|
|
218
222
|
{children}
|
|
219
223
|
</MenuPrimitive.RadioItem>
|
|
220
|
-
)
|
|
224
|
+
);
|
|
221
225
|
}
|
|
222
226
|
|
|
223
227
|
function DropdownMenuSeparator({
|
|
@@ -230,7 +234,7 @@ function DropdownMenuSeparator({
|
|
|
230
234
|
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
231
235
|
{...props}
|
|
232
236
|
/>
|
|
233
|
-
)
|
|
237
|
+
);
|
|
234
238
|
}
|
|
235
239
|
|
|
236
240
|
function DropdownMenuShortcut({
|
|
@@ -242,11 +246,11 @@ function DropdownMenuShortcut({
|
|
|
242
246
|
data-slot="dropdown-menu-shortcut"
|
|
243
247
|
className={cn(
|
|
244
248
|
"ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground",
|
|
245
|
-
className
|
|
249
|
+
className,
|
|
246
250
|
)}
|
|
247
251
|
{...props}
|
|
248
252
|
/>
|
|
249
|
-
)
|
|
253
|
+
);
|
|
250
254
|
}
|
|
251
255
|
|
|
252
256
|
export {
|
|
@@ -265,4 +269,4 @@ export {
|
|
|
265
269
|
DropdownMenuSub,
|
|
266
270
|
DropdownMenuSubTrigger,
|
|
267
271
|
DropdownMenuSubContent,
|
|
268
|
-
}
|
|
272
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
5
|
|
|
6
|
-
import { cn } from "@silicajs/ui/lib/utils"
|
|
7
|
-
import { Button } from "@silicajs/ui/components/button"
|
|
8
|
-
import { Input } from "@silicajs/ui/components/input"
|
|
9
|
-
import { Textarea } from "@silicajs/ui/components/textarea"
|
|
6
|
+
import { cn } from "@silicajs/ui/lib/utils";
|
|
7
|
+
import { Button } from "@silicajs/ui/components/button";
|
|
8
|
+
import { Input } from "@silicajs/ui/components/input";
|
|
9
|
+
import { Textarea } from "@silicajs/ui/components/textarea";
|
|
10
10
|
|
|
11
11
|
function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
12
12
|
return (
|
|
@@ -15,11 +15,11 @@ function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
15
15
|
role="group"
|
|
16
16
|
className={cn(
|
|
17
17
|
"group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",
|
|
18
|
-
className
|
|
18
|
+
className,
|
|
19
19
|
)}
|
|
20
20
|
{...props}
|
|
21
21
|
/>
|
|
22
|
-
)
|
|
22
|
+
);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const inputGroupAddonVariants = cva(
|
|
@@ -40,8 +40,8 @@ const inputGroupAddonVariants = cva(
|
|
|
40
40
|
defaultVariants: {
|
|
41
41
|
align: "inline-start",
|
|
42
42
|
},
|
|
43
|
-
}
|
|
44
|
-
)
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
45
|
|
|
46
46
|
function InputGroupAddon({
|
|
47
47
|
className,
|
|
@@ -56,13 +56,13 @@ function InputGroupAddon({
|
|
|
56
56
|
className={cn(inputGroupAddonVariants({ align }), className)}
|
|
57
57
|
onClick={(e) => {
|
|
58
58
|
if ((e.target as HTMLElement).closest("button")) {
|
|
59
|
-
return
|
|
59
|
+
return;
|
|
60
60
|
}
|
|
61
|
-
e.currentTarget.parentElement?.querySelector("input")?.focus()
|
|
61
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
62
62
|
}}
|
|
63
63
|
{...props}
|
|
64
64
|
/>
|
|
65
|
-
)
|
|
65
|
+
);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
const inputGroupButtonVariants = cva(
|
|
@@ -80,8 +80,8 @@ const inputGroupButtonVariants = cva(
|
|
|
80
80
|
defaultVariants: {
|
|
81
81
|
size: "xs",
|
|
82
82
|
},
|
|
83
|
-
}
|
|
84
|
-
)
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
85
|
|
|
86
86
|
function InputGroupButton({
|
|
87
87
|
className,
|
|
@@ -91,7 +91,7 @@ function InputGroupButton({
|
|
|
91
91
|
...props
|
|
92
92
|
}: Omit<React.ComponentProps<typeof Button>, "size" | "type"> &
|
|
93
93
|
VariantProps<typeof inputGroupButtonVariants> & {
|
|
94
|
-
type?: "button" | "submit" | "reset"
|
|
94
|
+
type?: "button" | "submit" | "reset";
|
|
95
95
|
}) {
|
|
96
96
|
return (
|
|
97
97
|
<Button
|
|
@@ -101,7 +101,7 @@ function InputGroupButton({
|
|
|
101
101
|
className={cn(inputGroupButtonVariants({ size }), className)}
|
|
102
102
|
{...props}
|
|
103
103
|
/>
|
|
104
|
-
)
|
|
104
|
+
);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
|
|
@@ -109,11 +109,11 @@ function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
|
|
|
109
109
|
<span
|
|
110
110
|
className={cn(
|
|
111
111
|
"flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
112
|
-
className
|
|
112
|
+
className,
|
|
113
113
|
)}
|
|
114
114
|
{...props}
|
|
115
115
|
/>
|
|
116
|
-
)
|
|
116
|
+
);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
function InputGroupInput({
|
|
@@ -125,11 +125,11 @@ function InputGroupInput({
|
|
|
125
125
|
data-slot="input-group-control"
|
|
126
126
|
className={cn(
|
|
127
127
|
"flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
|
|
128
|
-
className
|
|
128
|
+
className,
|
|
129
129
|
)}
|
|
130
130
|
{...props}
|
|
131
131
|
/>
|
|
132
|
-
)
|
|
132
|
+
);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
function InputGroupTextarea({
|
|
@@ -141,11 +141,11 @@ function InputGroupTextarea({
|
|
|
141
141
|
data-slot="input-group-control"
|
|
142
142
|
className={cn(
|
|
143
143
|
"flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
|
|
144
|
-
className
|
|
144
|
+
className,
|
|
145
145
|
)}
|
|
146
146
|
{...props}
|
|
147
147
|
/>
|
|
148
|
-
)
|
|
148
|
+
);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
export {
|
|
@@ -155,4 +155,4 @@ export {
|
|
|
155
155
|
InputGroupText,
|
|
156
156
|
InputGroupInput,
|
|
157
157
|
InputGroupTextarea,
|
|
158
|
-
}
|
|
158
|
+
};
|
package/src/components/input.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { Input as InputPrimitive } from "@base-ui/react/input"
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Input as InputPrimitive } from "@base-ui/react/input";
|
|
3
3
|
|
|
4
|
-
import { cn } from "@silicajs/ui/lib/utils"
|
|
4
|
+
import { cn } from "@silicajs/ui/lib/utils";
|
|
5
5
|
|
|
6
6
|
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
7
7
|
return (
|
|
@@ -10,11 +10,11 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
|
10
10
|
data-slot="input"
|
|
11
11
|
className={cn(
|
|
12
12
|
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
13
|
-
className
|
|
13
|
+
className,
|
|
14
14
|
)}
|
|
15
15
|
{...props}
|
|
16
16
|
/>
|
|
17
|
-
)
|
|
17
|
+
);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export { Input }
|
|
20
|
+
export { Input };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area"
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
|
|
5
5
|
|
|
6
|
-
import { cn } from "@silicajs/ui/lib/utils"
|
|
6
|
+
import { cn } from "@silicajs/ui/lib/utils";
|
|
7
7
|
|
|
8
8
|
function ScrollArea({
|
|
9
9
|
className,
|
|
@@ -25,7 +25,7 @@ function ScrollArea({
|
|
|
25
25
|
<ScrollBar />
|
|
26
26
|
<ScrollAreaPrimitive.Corner />
|
|
27
27
|
</ScrollAreaPrimitive.Root>
|
|
28
|
-
)
|
|
28
|
+
);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
function ScrollBar({
|
|
@@ -40,7 +40,7 @@ function ScrollBar({
|
|
|
40
40
|
orientation={orientation}
|
|
41
41
|
className={cn(
|
|
42
42
|
"flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",
|
|
43
|
-
className
|
|
43
|
+
className,
|
|
44
44
|
)}
|
|
45
45
|
{...props}
|
|
46
46
|
>
|
|
@@ -49,7 +49,7 @@ function ScrollBar({
|
|
|
49
49
|
className="relative flex-1 rounded-full bg-border"
|
|
50
50
|
/>
|
|
51
51
|
</ScrollAreaPrimitive.Scrollbar>
|
|
52
|
-
)
|
|
52
|
+
);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
export { ScrollArea, ScrollBar }
|
|
55
|
+
export { ScrollArea, ScrollBar };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
|
-
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator"
|
|
3
|
+
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
|
|
4
4
|
|
|
5
|
-
import { cn } from "@silicajs/ui/lib/utils"
|
|
5
|
+
import { cn } from "@silicajs/ui/lib/utils";
|
|
6
6
|
|
|
7
7
|
function Separator({
|
|
8
8
|
className,
|
|
@@ -15,11 +15,11 @@ function Separator({
|
|
|
15
15
|
orientation={orientation}
|
|
16
16
|
className={cn(
|
|
17
17
|
"shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
|
|
18
|
-
className
|
|
18
|
+
className,
|
|
19
19
|
)}
|
|
20
20
|
{...props}
|
|
21
21
|
/>
|
|
22
|
-
)
|
|
22
|
+
);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export { Separator }
|
|
25
|
+
export { Separator };
|