@camox/ui 0.6.0 → 0.7.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/package.json +5 -47
- package/src/components/alert-dialog.tsx +62 -35
- package/src/components/alert.tsx +18 -5
- package/src/components/avatar.tsx +8 -11
- package/src/components/badge.tsx +26 -16
- package/src/components/breadcrumb.tsx +26 -25
- package/src/components/button-group.tsx +23 -23
- package/src/components/button.tsx +26 -26
- package/src/components/command.tsx +53 -48
- package/src/components/dialog.tsx +40 -32
- package/src/components/dropdown-menu.tsx +137 -107
- package/src/components/input-group.tsx +146 -0
- package/src/components/input.tsx +4 -5
- package/src/components/kbd.tsx +1 -3
- package/src/components/label.tsx +2 -5
- package/src/components/panel.tsx +56 -25
- package/src/components/popover.tsx +55 -15
- package/src/components/select.tsx +86 -67
- package/src/components/separator.tsx +4 -11
- package/src/components/sheet.tsx +32 -37
- package/src/components/skeleton.tsx +1 -1
- package/src/components/switch.tsx +11 -7
- package/src/components/tabs.tsx +37 -16
- package/src/components/textarea.tsx +2 -4
- package/src/components/toggle.tsx +12 -14
- package/src/components/tooltip.tsx +29 -32
- package/src/styles/globals.css +1 -1
- package/src/components/accordion.tsx +0 -58
- package/src/components/checkbox.tsx +0 -27
- package/src/components/control-group.tsx +0 -58
- package/src/components/frame.tsx +0 -146
- package/src/components/input-base.tsx +0 -189
- package/src/components/resizable.tsx +0 -46
- package/src/hooks/use-mobile.ts +0 -19
|
@@ -1,65 +1,69 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { Menu as MenuPrimitive } from "@base-ui/react/menu";
|
|
2
|
+
import { ChevronRightIcon, CheckIcon } from "lucide-react";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
5
|
import { cn } from "../lib/utils";
|
|
6
6
|
|
|
7
|
-
function DropdownMenu({ ...props }:
|
|
8
|
-
return <
|
|
7
|
+
function DropdownMenu({ ...props }: MenuPrimitive.Root.Props) {
|
|
8
|
+
return <MenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
function DropdownMenuPortal({
|
|
12
|
-
...props
|
|
13
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
|
|
14
|
-
return <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />;
|
|
11
|
+
function DropdownMenuPortal({ ...props }: MenuPrimitive.Portal.Props) {
|
|
12
|
+
return <MenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />;
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
function DropdownMenuTrigger({
|
|
18
|
-
...props
|
|
19
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
|
|
20
|
-
return <DropdownMenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} />;
|
|
15
|
+
function DropdownMenuTrigger({ ...props }: MenuPrimitive.Trigger.Props) {
|
|
16
|
+
return <MenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} />;
|
|
21
17
|
}
|
|
22
18
|
|
|
23
19
|
function DropdownMenuContent({
|
|
24
|
-
|
|
20
|
+
align = "start",
|
|
21
|
+
alignOffset = 0,
|
|
22
|
+
side = "bottom",
|
|
25
23
|
sideOffset = 4,
|
|
24
|
+
className,
|
|
26
25
|
...props
|
|
27
|
-
}:
|
|
26
|
+
}: MenuPrimitive.Popup.Props &
|
|
27
|
+
Pick<MenuPrimitive.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset">) {
|
|
28
28
|
return (
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
|
|
29
|
+
<MenuPrimitive.Portal>
|
|
30
|
+
<MenuPrimitive.Positioner
|
|
31
|
+
className="isolate z-50 outline-none"
|
|
32
|
+
align={align}
|
|
33
|
+
alignOffset={alignOffset}
|
|
34
|
+
side={side}
|
|
32
35
|
sideOffset={sideOffset}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
>
|
|
37
|
+
<MenuPrimitive.Popup
|
|
38
|
+
data-slot="dropdown-menu-content"
|
|
39
|
+
className={cn(
|
|
40
|
+
"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",
|
|
41
|
+
className,
|
|
42
|
+
)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
</MenuPrimitive.Positioner>
|
|
46
|
+
</MenuPrimitive.Portal>
|
|
40
47
|
);
|
|
41
48
|
}
|
|
42
49
|
|
|
43
|
-
function DropdownMenuGroup({ ...props }:
|
|
44
|
-
return <
|
|
50
|
+
function DropdownMenuGroup({ ...props }: MenuPrimitive.Group.Props) {
|
|
51
|
+
return <MenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />;
|
|
45
52
|
}
|
|
46
53
|
|
|
47
|
-
function
|
|
54
|
+
function DropdownMenuLabel({
|
|
48
55
|
className,
|
|
49
56
|
inset,
|
|
50
|
-
variant = "default",
|
|
51
57
|
...props
|
|
52
|
-
}:
|
|
58
|
+
}: MenuPrimitive.GroupLabel.Props & {
|
|
53
59
|
inset?: boolean;
|
|
54
|
-
variant?: "default" | "destructive";
|
|
55
60
|
}) {
|
|
56
61
|
return (
|
|
57
|
-
<
|
|
58
|
-
data-slot="dropdown-menu-
|
|
62
|
+
<MenuPrimitive.GroupLabel
|
|
63
|
+
data-slot="dropdown-menu-label"
|
|
59
64
|
data-inset={inset}
|
|
60
|
-
data-variant={variant}
|
|
61
65
|
className={cn(
|
|
62
|
-
"
|
|
66
|
+
"px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-8",
|
|
63
67
|
className,
|
|
64
68
|
)}
|
|
65
69
|
{...props}
|
|
@@ -67,139 +71,165 @@ function DropdownMenuItem({
|
|
|
67
71
|
);
|
|
68
72
|
}
|
|
69
73
|
|
|
70
|
-
function
|
|
74
|
+
function DropdownMenuItem({
|
|
71
75
|
className,
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
inset,
|
|
77
|
+
variant = "default",
|
|
74
78
|
...props
|
|
75
|
-
}:
|
|
79
|
+
}: MenuPrimitive.Item.Props & {
|
|
80
|
+
inset?: boolean;
|
|
81
|
+
variant?: "default" | "destructive";
|
|
82
|
+
}) {
|
|
76
83
|
return (
|
|
77
|
-
<
|
|
78
|
-
data-slot="dropdown-menu-
|
|
84
|
+
<MenuPrimitive.Item
|
|
85
|
+
data-slot="dropdown-menu-item"
|
|
86
|
+
data-inset={inset}
|
|
87
|
+
data-variant={variant}
|
|
79
88
|
className={cn(
|
|
80
|
-
"
|
|
89
|
+
"group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent 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:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
|
|
81
90
|
className,
|
|
82
91
|
)}
|
|
83
|
-
checked={checked}
|
|
84
92
|
{...props}
|
|
85
|
-
|
|
86
|
-
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
87
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
88
|
-
<CheckIcon className="size-4" />
|
|
89
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
90
|
-
</span>
|
|
91
|
-
{children}
|
|
92
|
-
</DropdownMenuPrimitive.CheckboxItem>
|
|
93
|
+
/>
|
|
93
94
|
);
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
function
|
|
97
|
-
...props
|
|
98
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
|
|
99
|
-
return <DropdownMenuPrimitive.RadioGroup data-slot="dropdown-menu-radio-group" {...props} />;
|
|
97
|
+
function DropdownMenuSub({ ...props }: MenuPrimitive.SubmenuRoot.Props) {
|
|
98
|
+
return <MenuPrimitive.SubmenuRoot data-slot="dropdown-menu-sub" {...props} />;
|
|
100
99
|
}
|
|
101
100
|
|
|
102
|
-
function
|
|
101
|
+
function DropdownMenuSubTrigger({
|
|
103
102
|
className,
|
|
103
|
+
inset,
|
|
104
104
|
children,
|
|
105
105
|
...props
|
|
106
|
-
}:
|
|
106
|
+
}: MenuPrimitive.SubmenuTrigger.Props & {
|
|
107
|
+
inset?: boolean;
|
|
108
|
+
}) {
|
|
107
109
|
return (
|
|
108
|
-
<
|
|
109
|
-
data-slot="dropdown-menu-
|
|
110
|
+
<MenuPrimitive.SubmenuTrigger
|
|
111
|
+
data-slot="dropdown-menu-sub-trigger"
|
|
112
|
+
data-inset={inset}
|
|
110
113
|
className={cn(
|
|
111
|
-
"
|
|
114
|
+
"flex cursor-default 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",
|
|
112
115
|
className,
|
|
113
116
|
)}
|
|
114
117
|
{...props}
|
|
115
118
|
>
|
|
116
|
-
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
117
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
118
|
-
<CircleIcon className="size-2 fill-current" />
|
|
119
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
120
|
-
</span>
|
|
121
119
|
{children}
|
|
122
|
-
|
|
120
|
+
<ChevronRightIcon className="ml-auto" />
|
|
121
|
+
</MenuPrimitive.SubmenuTrigger>
|
|
123
122
|
);
|
|
124
123
|
}
|
|
125
124
|
|
|
126
|
-
function
|
|
125
|
+
function DropdownMenuSubContent({
|
|
126
|
+
align = "start",
|
|
127
|
+
alignOffset = -3,
|
|
128
|
+
side = "right",
|
|
129
|
+
sideOffset = 0,
|
|
127
130
|
className,
|
|
128
|
-
inset,
|
|
129
131
|
...props
|
|
130
|
-
}: React.ComponentProps<typeof
|
|
131
|
-
inset?: boolean;
|
|
132
|
-
}) {
|
|
132
|
+
}: React.ComponentProps<typeof DropdownMenuContent>) {
|
|
133
133
|
return (
|
|
134
|
-
<
|
|
135
|
-
data-slot="dropdown-menu-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
<DropdownMenuContent
|
|
135
|
+
data-slot="dropdown-menu-sub-content"
|
|
136
|
+
className={cn(
|
|
137
|
+
"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",
|
|
138
|
+
className,
|
|
139
|
+
)}
|
|
140
|
+
align={align}
|
|
141
|
+
alignOffset={alignOffset}
|
|
142
|
+
side={side}
|
|
143
|
+
sideOffset={sideOffset}
|
|
138
144
|
{...props}
|
|
139
145
|
/>
|
|
140
146
|
);
|
|
141
147
|
}
|
|
142
148
|
|
|
143
|
-
function
|
|
149
|
+
function DropdownMenuCheckboxItem({
|
|
144
150
|
className,
|
|
151
|
+
children,
|
|
152
|
+
checked,
|
|
153
|
+
inset,
|
|
145
154
|
...props
|
|
146
|
-
}:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
data-slot="dropdown-menu-separator"
|
|
150
|
-
className={cn("bg-border -mx-1 my-1 h-px", className)}
|
|
151
|
-
{...props}
|
|
152
|
-
/>
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">) {
|
|
155
|
+
}: MenuPrimitive.CheckboxItem.Props & {
|
|
156
|
+
inset?: boolean;
|
|
157
|
+
}) {
|
|
157
158
|
return (
|
|
158
|
-
<
|
|
159
|
-
data-slot="dropdown-menu-
|
|
160
|
-
|
|
159
|
+
<MenuPrimitive.CheckboxItem
|
|
160
|
+
data-slot="dropdown-menu-checkbox-item"
|
|
161
|
+
data-inset={inset}
|
|
162
|
+
className={cn(
|
|
163
|
+
"relative flex cursor-default 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",
|
|
164
|
+
className,
|
|
165
|
+
)}
|
|
166
|
+
checked={checked}
|
|
161
167
|
{...props}
|
|
162
|
-
|
|
168
|
+
>
|
|
169
|
+
<span
|
|
170
|
+
className="pointer-events-none absolute right-2 flex items-center justify-center"
|
|
171
|
+
data-slot="dropdown-menu-checkbox-item-indicator"
|
|
172
|
+
>
|
|
173
|
+
<MenuPrimitive.CheckboxItemIndicator>
|
|
174
|
+
<CheckIcon />
|
|
175
|
+
</MenuPrimitive.CheckboxItemIndicator>
|
|
176
|
+
</span>
|
|
177
|
+
{children}
|
|
178
|
+
</MenuPrimitive.CheckboxItem>
|
|
163
179
|
);
|
|
164
180
|
}
|
|
165
181
|
|
|
166
|
-
function
|
|
167
|
-
return <
|
|
182
|
+
function DropdownMenuRadioGroup({ ...props }: MenuPrimitive.RadioGroup.Props) {
|
|
183
|
+
return <MenuPrimitive.RadioGroup data-slot="dropdown-menu-radio-group" {...props} />;
|
|
168
184
|
}
|
|
169
185
|
|
|
170
|
-
function
|
|
186
|
+
function DropdownMenuRadioItem({
|
|
171
187
|
className,
|
|
172
|
-
inset,
|
|
173
188
|
children,
|
|
189
|
+
inset,
|
|
174
190
|
...props
|
|
175
|
-
}:
|
|
191
|
+
}: MenuPrimitive.RadioItem.Props & {
|
|
176
192
|
inset?: boolean;
|
|
177
193
|
}) {
|
|
178
194
|
return (
|
|
179
|
-
<
|
|
180
|
-
data-slot="dropdown-menu-
|
|
195
|
+
<MenuPrimitive.RadioItem
|
|
196
|
+
data-slot="dropdown-menu-radio-item"
|
|
181
197
|
data-inset={inset}
|
|
182
198
|
className={cn(
|
|
183
|
-
"
|
|
199
|
+
"relative flex cursor-default 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",
|
|
184
200
|
className,
|
|
185
201
|
)}
|
|
186
202
|
{...props}
|
|
187
203
|
>
|
|
204
|
+
<span
|
|
205
|
+
className="pointer-events-none absolute right-2 flex items-center justify-center"
|
|
206
|
+
data-slot="dropdown-menu-radio-item-indicator"
|
|
207
|
+
>
|
|
208
|
+
<MenuPrimitive.RadioItemIndicator>
|
|
209
|
+
<CheckIcon />
|
|
210
|
+
</MenuPrimitive.RadioItemIndicator>
|
|
211
|
+
</span>
|
|
188
212
|
{children}
|
|
189
|
-
|
|
190
|
-
</DropdownMenuPrimitive.SubTrigger>
|
|
213
|
+
</MenuPrimitive.RadioItem>
|
|
191
214
|
);
|
|
192
215
|
}
|
|
193
216
|
|
|
194
|
-
function
|
|
195
|
-
className,
|
|
196
|
-
...props
|
|
197
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
|
|
217
|
+
function DropdownMenuSeparator({ className, ...props }: MenuPrimitive.Separator.Props) {
|
|
198
218
|
return (
|
|
199
|
-
<
|
|
200
|
-
data-slot="dropdown-menu-
|
|
219
|
+
<MenuPrimitive.Separator
|
|
220
|
+
data-slot="dropdown-menu-separator"
|
|
221
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
222
|
+
{...props}
|
|
223
|
+
/>
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">) {
|
|
228
|
+
return (
|
|
229
|
+
<span
|
|
230
|
+
data-slot="dropdown-menu-shortcut"
|
|
201
231
|
className={cn(
|
|
202
|
-
"
|
|
232
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground",
|
|
203
233
|
className,
|
|
204
234
|
)}
|
|
205
235
|
{...props}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
|
|
6
|
+
import { cn } from "../lib/utils";
|
|
7
|
+
import { Button } from "./button";
|
|
8
|
+
import { Input } from "./input";
|
|
9
|
+
import { Textarea } from "./textarea";
|
|
10
|
+
|
|
11
|
+
function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
12
|
+
return (
|
|
13
|
+
<div
|
|
14
|
+
data-slot="input-group"
|
|
15
|
+
role="group"
|
|
16
|
+
className={cn(
|
|
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,
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const inputGroupAddonVariants = cva(
|
|
26
|
+
"flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
|
|
27
|
+
{
|
|
28
|
+
variants: {
|
|
29
|
+
align: {
|
|
30
|
+
"inline-start": "order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]",
|
|
31
|
+
"inline-end": "order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]",
|
|
32
|
+
"block-start":
|
|
33
|
+
"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
|
|
34
|
+
"block-end":
|
|
35
|
+
"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
defaultVariants: {
|
|
39
|
+
align: "inline-start",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
function InputGroupAddon({
|
|
45
|
+
className,
|
|
46
|
+
align = "inline-start",
|
|
47
|
+
...props
|
|
48
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
|
|
49
|
+
return (
|
|
50
|
+
<div
|
|
51
|
+
role="group"
|
|
52
|
+
data-slot="input-group-addon"
|
|
53
|
+
data-align={align}
|
|
54
|
+
className={cn(inputGroupAddonVariants({ align }), className)}
|
|
55
|
+
onClick={(e) => {
|
|
56
|
+
if ((e.target as HTMLElement).closest("button")) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
60
|
+
}}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const inputGroupButtonVariants = cva("flex items-center gap-2 text-sm shadow-none", {
|
|
67
|
+
variants: {
|
|
68
|
+
size: {
|
|
69
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
70
|
+
sm: "",
|
|
71
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
72
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
defaultVariants: {
|
|
76
|
+
size: "xs",
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
function InputGroupButton({
|
|
81
|
+
className,
|
|
82
|
+
type = "button",
|
|
83
|
+
variant = "ghost",
|
|
84
|
+
size = "xs",
|
|
85
|
+
...props
|
|
86
|
+
}: Omit<React.ComponentProps<typeof Button>, "size" | "type"> &
|
|
87
|
+
VariantProps<typeof inputGroupButtonVariants> & {
|
|
88
|
+
type?: "button" | "submit" | "reset";
|
|
89
|
+
}) {
|
|
90
|
+
return (
|
|
91
|
+
<Button
|
|
92
|
+
type={type}
|
|
93
|
+
data-size={size}
|
|
94
|
+
variant={variant}
|
|
95
|
+
className={cn(inputGroupButtonVariants({ size }), className)}
|
|
96
|
+
{...props}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
|
|
102
|
+
return (
|
|
103
|
+
<span
|
|
104
|
+
className={cn(
|
|
105
|
+
"flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
106
|
+
className,
|
|
107
|
+
)}
|
|
108
|
+
{...props}
|
|
109
|
+
/>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function InputGroupInput({ className, ...props }: React.ComponentProps<"input">) {
|
|
114
|
+
return (
|
|
115
|
+
<Input
|
|
116
|
+
data-slot="input-group-control"
|
|
117
|
+
className={cn(
|
|
118
|
+
"flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
|
|
119
|
+
className,
|
|
120
|
+
)}
|
|
121
|
+
{...props}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function InputGroupTextarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
|
127
|
+
return (
|
|
128
|
+
<Textarea
|
|
129
|
+
data-slot="input-group-control"
|
|
130
|
+
className={cn(
|
|
131
|
+
"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",
|
|
132
|
+
className,
|
|
133
|
+
)}
|
|
134
|
+
{...props}
|
|
135
|
+
/>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export {
|
|
140
|
+
InputGroup,
|
|
141
|
+
InputGroupAddon,
|
|
142
|
+
InputGroupButton,
|
|
143
|
+
InputGroupText,
|
|
144
|
+
InputGroupInput,
|
|
145
|
+
InputGroupTextarea,
|
|
146
|
+
};
|
package/src/components/input.tsx
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
+
import { Input as InputPrimitive } from "@base-ui/react/input";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
4
5
|
|
|
5
6
|
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
6
7
|
return (
|
|
7
|
-
<
|
|
8
|
+
<InputPrimitive
|
|
8
9
|
type={type}
|
|
9
10
|
data-slot="input"
|
|
10
11
|
className={cn(
|
|
11
|
-
|
|
12
|
-
INPUT_FOCUS_STYLES,
|
|
13
|
-
"file:text-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 h-9 w-full min-w-0 px-3 py-1 file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none",
|
|
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",
|
|
14
13
|
className,
|
|
15
14
|
)}
|
|
16
15
|
{...props}
|
package/src/components/kbd.tsx
CHANGED
|
@@ -5,9 +5,7 @@ function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
|
|
|
5
5
|
<kbd
|
|
6
6
|
data-slot="kbd"
|
|
7
7
|
className={cn(
|
|
8
|
-
"
|
|
9
|
-
"[&_svg:not([class*='size-'])]:size-3",
|
|
10
|
-
"[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",
|
|
8
|
+
"pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",
|
|
11
9
|
className,
|
|
12
10
|
)}
|
|
13
11
|
{...props}
|
package/src/components/label.tsx
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
4
1
|
import * as React from "react";
|
|
5
2
|
|
|
6
3
|
import { cn } from "../lib/utils";
|
|
7
4
|
|
|
8
|
-
function Label({ className, ...props }: React.ComponentProps<
|
|
5
|
+
function Label({ className, ...props }: React.ComponentProps<"label">) {
|
|
9
6
|
return (
|
|
10
|
-
<
|
|
7
|
+
<label
|
|
11
8
|
data-slot="label"
|
|
12
9
|
className={cn(
|
|
13
10
|
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|