@preset.nz/ux-kit 0.1.0 → 0.1.1
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/README.md +27 -0
- package/THIRD_PARTY_NOTICES.md +253 -0
- package/package.json +9 -10
- package/src/chat/index.ts +9 -0
- package/src/chat/message.tsx +80 -0
- package/src/chat/prompt-input.tsx +121 -0
- package/src/chat/reasoning.tsx +182 -0
- package/src/chat/scroller.tsx +147 -0
- package/src/chat/suggestion.tsx +65 -0
- package/src/chat/tool.tsx +143 -0
- package/src/chat/types.ts +8 -0
- package/src/components/avatar.tsx +1 -1
- package/src/components/badge.tsx +4 -6
- package/src/components/breadcrumb.tsx +8 -10
- package/src/components/button.tsx +1 -1
- package/src/components/card.tsx +4 -21
- package/src/components/checkbox.tsx +3 -5
- package/src/components/color-field.tsx +20 -7
- package/src/components/color-swatch.tsx +3 -3
- package/src/components/context-menu.tsx +13 -13
- package/src/components/dialog.tsx +5 -9
- package/src/components/dropdown-menu.tsx +13 -13
- package/src/components/empty-state.tsx +6 -3
- package/src/components/input.tsx +2 -2
- package/src/components/label.tsx +3 -2
- package/src/components/navigation-menu.tsx +16 -10
- package/src/components/number-field.tsx +30 -26
- package/src/components/popover.tsx +3 -10
- package/src/components/select.tsx +16 -28
- package/src/components/separator.tsx +2 -6
- package/src/components/sheet.tsx +16 -8
- package/src/components/side-panel.tsx +31 -8
- package/src/components/sidebar.tsx +15 -52
- package/src/components/skeleton.tsx +1 -1
- package/src/components/slider.tsx +4 -8
- package/src/components/snackbar.tsx +36 -34
- package/src/components/status-bar.tsx +10 -3
- package/src/components/tabs.tsx +3 -6
- package/src/components/textarea.tsx +2 -2
- package/src/components/toggle-group.tsx +4 -4
- package/src/components/toggle.tsx +1 -1
- package/src/components/toolbar.tsx +8 -11
- package/src/components/tooltip.tsx +1 -1
- package/src/graphics/adsr.ts +21 -13
- package/src/graphics/curve-editor.tsx +56 -14
- package/src/graphics/curve-edits.ts +20 -3
- package/src/graphics/index.ts +6 -6
- package/src/graphics/scale.ts +4 -1
- package/src/graphics/use-canvas.ts +1 -1
- package/src/graphics/use-tokens.ts +4 -1
- package/src/index.css +1 -1
- package/src/index.ts +3 -5
- package/src/lib/use-mobile.ts +1 -1
- package/src/lib/utils.ts +1 -1
- package/src/shadcn-tailwind.css +665 -0
package/src/components/card.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React from "react"
|
|
1
|
+
import type * as React from "react"
|
|
2
2
|
|
|
3
3
|
import { cn } from "../lib/utils"
|
|
4
4
|
|
|
@@ -52,23 +52,14 @@ function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
52
52
|
return (
|
|
53
53
|
<div
|
|
54
54
|
data-slot="card-action"
|
|
55
|
-
className={cn(
|
|
56
|
-
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
57
|
-
className,
|
|
58
|
-
)}
|
|
55
|
+
className={cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className)}
|
|
59
56
|
{...props}
|
|
60
57
|
/>
|
|
61
58
|
)
|
|
62
59
|
}
|
|
63
60
|
|
|
64
61
|
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
65
|
-
return (
|
|
66
|
-
<div
|
|
67
|
-
data-slot="card-content"
|
|
68
|
-
className={cn("px-4", className)}
|
|
69
|
-
{...props}
|
|
70
|
-
/>
|
|
71
|
-
)
|
|
62
|
+
return <div data-slot="card-content" className={cn("px-4", className)} {...props} />
|
|
72
63
|
}
|
|
73
64
|
|
|
74
65
|
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
@@ -81,12 +72,4 @@ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
81
72
|
)
|
|
82
73
|
}
|
|
83
74
|
|
|
84
|
-
export {
|
|
85
|
-
Card,
|
|
86
|
-
CardHeader,
|
|
87
|
-
CardFooter,
|
|
88
|
-
CardTitle,
|
|
89
|
-
CardAction,
|
|
90
|
-
CardDescription,
|
|
91
|
-
CardContent,
|
|
92
|
-
}
|
|
75
|
+
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle }
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox"
|
|
2
|
-
|
|
3
|
-
import { cn } from "../lib/utils"
|
|
4
2
|
import { CheckIcon } from "@phosphor-icons/react"
|
|
3
|
+
import { cn } from "../lib/utils"
|
|
5
4
|
|
|
6
5
|
function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
|
|
7
6
|
return (
|
|
@@ -9,7 +8,7 @@ function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
|
|
|
9
8
|
data-slot="checkbox"
|
|
10
9
|
className={cn(
|
|
11
10
|
"peer relative flex size-4 shrink-0 items-center justify-center rounded-none border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",
|
|
12
|
-
className
|
|
11
|
+
className,
|
|
13
12
|
)}
|
|
14
13
|
{...props}
|
|
15
14
|
>
|
|
@@ -17,8 +16,7 @@ function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
|
|
|
17
16
|
data-slot="checkbox-indicator"
|
|
18
17
|
className="grid place-content-center text-current transition-none [&>svg]:size-3.5"
|
|
19
18
|
>
|
|
20
|
-
<CheckIcon
|
|
21
|
-
/>
|
|
19
|
+
<CheckIcon />
|
|
22
20
|
</CheckboxPrimitive.Indicator>
|
|
23
21
|
</CheckboxPrimitive.Root>
|
|
24
22
|
)
|
|
@@ -35,8 +35,7 @@ function toHex({ r, g, b, a }: Rgba, withAlpha: boolean): string {
|
|
|
35
35
|
return `#${p(r)}${p(g)}${p(b)}${withAlpha ? p(a * 255) : ""}`
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
interface ColorFieldProps
|
|
39
|
-
extends Omit<React.ComponentProps<"div">, "onChange" | "defaultValue"> {
|
|
38
|
+
interface ColorFieldProps extends Omit<React.ComponentProps<"div">, "onChange" | "defaultValue"> {
|
|
40
39
|
/** #rrggbb or #rrggbbaa. `null` shows the empty chip and a dash. */
|
|
41
40
|
value: string | null
|
|
42
41
|
/** Called with a normalised lowercase hex, or null from the clear button. */
|
|
@@ -109,7 +108,9 @@ function ColorField({
|
|
|
109
108
|
const pct = Number(alphaDraft)
|
|
110
109
|
setAlphaDraft(null)
|
|
111
110
|
if (!Number.isFinite(pct)) return
|
|
112
|
-
|
|
111
|
+
const base = rgba ?? parseHex(fallback)
|
|
112
|
+
if (!base) return
|
|
113
|
+
emit({ ...base, a: Math.min(100, Math.max(0, pct)) / 100 })
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
const pick = (hex: string, session = false) => {
|
|
@@ -126,7 +127,10 @@ function ColorField({
|
|
|
126
127
|
return (
|
|
127
128
|
<div data-slot="color-field" className={cn("flex flex-col gap-1", className)} {...props}>
|
|
128
129
|
{label ? (
|
|
129
|
-
<label
|
|
130
|
+
<label
|
|
131
|
+
htmlFor={inputId}
|
|
132
|
+
className="text-[11px] font-medium tracking-wide text-muted-foreground"
|
|
133
|
+
>
|
|
130
134
|
{label}
|
|
131
135
|
</label>
|
|
132
136
|
) : null}
|
|
@@ -143,7 +147,11 @@ function ColorField({
|
|
|
143
147
|
<input
|
|
144
148
|
type="color"
|
|
145
149
|
aria-label={`${swatchLabel} picker`}
|
|
146
|
-
value={
|
|
150
|
+
value={
|
|
151
|
+
rgba
|
|
152
|
+
? toHex(rgba, false)
|
|
153
|
+
: toHex(parseHex(fallback) ?? { r: 0, g: 0, b: 0, a: 1 }, false)
|
|
154
|
+
}
|
|
147
155
|
onChange={(e) => pick(e.target.value, true)}
|
|
148
156
|
onFocus={onPickStart}
|
|
149
157
|
onBlur={() => {
|
|
@@ -163,6 +171,7 @@ function ColorField({
|
|
|
163
171
|
</PopoverTrigger>
|
|
164
172
|
<PopoverContent align="start" className="w-auto gap-2 p-2">
|
|
165
173
|
{presets?.length || clearable ? (
|
|
174
|
+
// biome-ignore lint/a11y/useSemanticElements: a div keeps the swatch grid layout; role="group" labels it
|
|
166
175
|
<div className="grid grid-cols-7 gap-1" role="group" aria-label="Presets">
|
|
167
176
|
{presets?.map((c) => (
|
|
168
177
|
<button
|
|
@@ -191,7 +200,11 @@ function ColorField({
|
|
|
191
200
|
<input
|
|
192
201
|
type="color"
|
|
193
202
|
aria-label={`${swatchLabel} picker`}
|
|
194
|
-
value={
|
|
203
|
+
value={
|
|
204
|
+
rgba
|
|
205
|
+
? toHex(rgba, false)
|
|
206
|
+
: toHex(parseHex(fallback) ?? { r: 0, g: 0, b: 0, a: 1 }, false)
|
|
207
|
+
}
|
|
195
208
|
onChange={(e) => pick(e.target.value, true)}
|
|
196
209
|
onFocus={onPickStart}
|
|
197
210
|
onBlur={() => {
|
|
@@ -244,5 +257,5 @@ function ColorField({
|
|
|
244
257
|
)
|
|
245
258
|
}
|
|
246
259
|
|
|
247
|
-
export { ColorField, parseHex, toHex }
|
|
248
260
|
export type { ColorFieldProps }
|
|
261
|
+
export { ColorField, parseHex, toHex }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React from "react"
|
|
1
|
+
import type * as React from "react"
|
|
2
2
|
|
|
3
3
|
import { cn } from "../lib/utils"
|
|
4
4
|
|
|
@@ -38,7 +38,7 @@ function ColorSwatch({
|
|
|
38
38
|
size === "lg" && "size-6",
|
|
39
39
|
shape === "round" ? "rounded-full" : "rounded-xs",
|
|
40
40
|
!color && "border-dashed border-muted-foreground/60",
|
|
41
|
-
className
|
|
41
|
+
className,
|
|
42
42
|
)}
|
|
43
43
|
style={color ? { background: CHECKER, ...style } : style}
|
|
44
44
|
{...props}
|
|
@@ -48,5 +48,5 @@ function ColorSwatch({
|
|
|
48
48
|
)
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export { ColorSwatch }
|
|
52
51
|
export type { ColorSwatchProps }
|
|
52
|
+
export { ColorSwatch }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
1
|
import { ContextMenu as ContextMenuPrimitive } from "@base-ui/react/context-menu"
|
|
3
2
|
import { CaretRightIcon, CheckIcon } from "@phosphor-icons/react"
|
|
3
|
+
import type * as React from "react"
|
|
4
4
|
|
|
5
5
|
import { cn } from "../lib/utils"
|
|
6
6
|
|
|
@@ -44,7 +44,7 @@ function ContextMenuContent({
|
|
|
44
44
|
data-slot="context-menu-content"
|
|
45
45
|
className={cn(
|
|
46
46
|
"z-50 max-h-(--available-height) min-w-36 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=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",
|
|
47
|
-
className
|
|
47
|
+
className,
|
|
48
48
|
)}
|
|
49
49
|
{...props}
|
|
50
50
|
/>
|
|
@@ -68,7 +68,7 @@ function ContextMenuLabel({
|
|
|
68
68
|
data-inset={inset}
|
|
69
69
|
className={cn(
|
|
70
70
|
"px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-8",
|
|
71
|
-
className
|
|
71
|
+
className,
|
|
72
72
|
)}
|
|
73
73
|
{...props}
|
|
74
74
|
/>
|
|
@@ -91,7 +91,7 @@ function ContextMenuItem({
|
|
|
91
91
|
data-variant={variant}
|
|
92
92
|
className={cn(
|
|
93
93
|
"group/context-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-highlighted:bg-accent data-highlighted: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",
|
|
94
|
-
className
|
|
94
|
+
className,
|
|
95
95
|
)}
|
|
96
96
|
{...props}
|
|
97
97
|
/>
|
|
@@ -114,7 +114,7 @@ function ContextMenuSubTrigger({
|
|
|
114
114
|
data-inset={inset}
|
|
115
115
|
className={cn(
|
|
116
116
|
"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-highlighted:bg-accent data-highlighted:text-accent-foreground data-inset:pl-8 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
117
|
-
className
|
|
117
|
+
className,
|
|
118
118
|
)}
|
|
119
119
|
{...props}
|
|
120
120
|
>
|
|
@@ -157,7 +157,7 @@ function ContextMenuCheckboxItem({
|
|
|
157
157
|
data-inset={inset}
|
|
158
158
|
className={cn(
|
|
159
159
|
"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 data-highlighted:bg-accent data-highlighted: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",
|
|
160
|
-
className
|
|
160
|
+
className,
|
|
161
161
|
)}
|
|
162
162
|
{...props}
|
|
163
163
|
>
|
|
@@ -190,7 +190,7 @@ function ContextMenuRadioItem({
|
|
|
190
190
|
data-inset={inset}
|
|
191
191
|
className={cn(
|
|
192
192
|
"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 data-highlighted:bg-accent data-highlighted: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",
|
|
193
|
-
className
|
|
193
|
+
className,
|
|
194
194
|
)}
|
|
195
195
|
{...props}
|
|
196
196
|
>
|
|
@@ -223,7 +223,7 @@ function ContextMenuShortcut({ className, ...props }: React.ComponentProps<"span
|
|
|
223
223
|
data-slot="context-menu-shortcut"
|
|
224
224
|
className={cn(
|
|
225
225
|
"ml-auto text-xs tracking-widest text-muted-foreground group-focus/context-menu-item:text-accent-foreground",
|
|
226
|
-
className
|
|
226
|
+
className,
|
|
227
227
|
)}
|
|
228
228
|
{...props}
|
|
229
229
|
/>
|
|
@@ -232,18 +232,18 @@ function ContextMenuShortcut({ className, ...props }: React.ComponentProps<"span
|
|
|
232
232
|
|
|
233
233
|
export {
|
|
234
234
|
ContextMenu,
|
|
235
|
-
|
|
236
|
-
ContextMenuTrigger,
|
|
235
|
+
ContextMenuCheckboxItem,
|
|
237
236
|
ContextMenuContent,
|
|
238
237
|
ContextMenuGroup,
|
|
239
|
-
ContextMenuLabel,
|
|
240
238
|
ContextMenuItem,
|
|
241
|
-
|
|
239
|
+
ContextMenuLabel,
|
|
240
|
+
ContextMenuPortal,
|
|
242
241
|
ContextMenuRadioGroup,
|
|
243
242
|
ContextMenuRadioItem,
|
|
244
243
|
ContextMenuSeparator,
|
|
245
244
|
ContextMenuShortcut,
|
|
246
245
|
ContextMenuSub,
|
|
247
|
-
ContextMenuSubTrigger,
|
|
248
246
|
ContextMenuSubContent,
|
|
247
|
+
ContextMenuSubTrigger,
|
|
248
|
+
ContextMenuTrigger,
|
|
249
249
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
1
|
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog"
|
|
3
2
|
import { XIcon } from "@phosphor-icons/react"
|
|
3
|
+
import type * as React from "react"
|
|
4
4
|
|
|
5
5
|
import { cn } from "../lib/utils"
|
|
6
6
|
import { Button } from "./button"
|
|
@@ -27,7 +27,7 @@ function DialogOverlay({ className, ...props }: DialogPrimitive.Backdrop.Props)
|
|
|
27
27
|
data-slot="dialog-overlay"
|
|
28
28
|
className={cn(
|
|
29
29
|
"fixed inset-0 isolate z-50 bg-foreground/15 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",
|
|
30
|
-
className
|
|
30
|
+
className,
|
|
31
31
|
)}
|
|
32
32
|
{...props}
|
|
33
33
|
/>
|
|
@@ -49,7 +49,7 @@ function DialogContent({
|
|
|
49
49
|
data-slot="dialog-content"
|
|
50
50
|
className={cn(
|
|
51
51
|
"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",
|
|
52
|
-
className
|
|
52
|
+
className,
|
|
53
53
|
)}
|
|
54
54
|
{...props}
|
|
55
55
|
>
|
|
@@ -70,11 +70,7 @@ function DialogContent({
|
|
|
70
70
|
|
|
71
71
|
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
72
72
|
return (
|
|
73
|
-
<div
|
|
74
|
-
data-slot="dialog-header"
|
|
75
|
-
className={cn("flex flex-col gap-2", className)}
|
|
76
|
-
{...props}
|
|
77
|
-
/>
|
|
73
|
+
<div data-slot="dialog-header" className={cn("flex flex-col gap-2", className)} {...props} />
|
|
78
74
|
)
|
|
79
75
|
}
|
|
80
76
|
|
|
@@ -116,7 +112,7 @@ function DialogDescription({ className, ...props }: DialogPrimitive.Description.
|
|
|
116
112
|
data-slot="dialog-description"
|
|
117
113
|
className={cn(
|
|
118
114
|
"text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
|
|
119
|
-
className
|
|
115
|
+
className,
|
|
120
116
|
)}
|
|
121
117
|
{...props}
|
|
122
118
|
/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
1
|
import { Menu as MenuPrimitive } from "@base-ui/react/menu"
|
|
3
2
|
import { CaretRightIcon, CheckIcon } from "@phosphor-icons/react"
|
|
3
|
+
import type * as React from "react"
|
|
4
4
|
|
|
5
5
|
import { cn } from "../lib/utils"
|
|
6
6
|
|
|
@@ -44,7 +44,7 @@ function DropdownMenuContent({
|
|
|
44
44
|
data-slot="dropdown-menu-content"
|
|
45
45
|
className={cn(
|
|
46
46
|
"z-50 max-h-(--available-height) min-w-36 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=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",
|
|
47
|
-
className
|
|
47
|
+
className,
|
|
48
48
|
)}
|
|
49
49
|
{...props}
|
|
50
50
|
/>
|
|
@@ -68,7 +68,7 @@ function DropdownMenuLabel({
|
|
|
68
68
|
data-inset={inset}
|
|
69
69
|
className={cn(
|
|
70
70
|
"px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-8",
|
|
71
|
-
className
|
|
71
|
+
className,
|
|
72
72
|
)}
|
|
73
73
|
{...props}
|
|
74
74
|
/>
|
|
@@ -91,7 +91,7 @@ function DropdownMenuItem({
|
|
|
91
91
|
data-variant={variant}
|
|
92
92
|
className={cn(
|
|
93
93
|
"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-highlighted:bg-accent data-highlighted: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",
|
|
94
|
-
className
|
|
94
|
+
className,
|
|
95
95
|
)}
|
|
96
96
|
{...props}
|
|
97
97
|
/>
|
|
@@ -114,7 +114,7 @@ function DropdownMenuSubTrigger({
|
|
|
114
114
|
data-inset={inset}
|
|
115
115
|
className={cn(
|
|
116
116
|
"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-highlighted:bg-accent data-highlighted:text-accent-foreground data-inset:pl-8 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
117
|
-
className
|
|
117
|
+
className,
|
|
118
118
|
)}
|
|
119
119
|
{...props}
|
|
120
120
|
>
|
|
@@ -157,7 +157,7 @@ function DropdownMenuCheckboxItem({
|
|
|
157
157
|
data-inset={inset}
|
|
158
158
|
className={cn(
|
|
159
159
|
"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 data-highlighted:bg-accent data-highlighted: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",
|
|
160
|
-
className
|
|
160
|
+
className,
|
|
161
161
|
)}
|
|
162
162
|
{...props}
|
|
163
163
|
>
|
|
@@ -190,7 +190,7 @@ function DropdownMenuRadioItem({
|
|
|
190
190
|
data-inset={inset}
|
|
191
191
|
className={cn(
|
|
192
192
|
"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 data-highlighted:bg-accent data-highlighted: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",
|
|
193
|
-
className
|
|
193
|
+
className,
|
|
194
194
|
)}
|
|
195
195
|
{...props}
|
|
196
196
|
>
|
|
@@ -223,7 +223,7 @@ function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"spa
|
|
|
223
223
|
data-slot="dropdown-menu-shortcut"
|
|
224
224
|
className={cn(
|
|
225
225
|
"ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground",
|
|
226
|
-
className
|
|
226
|
+
className,
|
|
227
227
|
)}
|
|
228
228
|
{...props}
|
|
229
229
|
/>
|
|
@@ -232,18 +232,18 @@ function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"spa
|
|
|
232
232
|
|
|
233
233
|
export {
|
|
234
234
|
DropdownMenu,
|
|
235
|
-
|
|
236
|
-
DropdownMenuTrigger,
|
|
235
|
+
DropdownMenuCheckboxItem,
|
|
237
236
|
DropdownMenuContent,
|
|
238
237
|
DropdownMenuGroup,
|
|
239
|
-
DropdownMenuLabel,
|
|
240
238
|
DropdownMenuItem,
|
|
241
|
-
|
|
239
|
+
DropdownMenuLabel,
|
|
240
|
+
DropdownMenuPortal,
|
|
242
241
|
DropdownMenuRadioGroup,
|
|
243
242
|
DropdownMenuRadioItem,
|
|
244
243
|
DropdownMenuSeparator,
|
|
245
244
|
DropdownMenuShortcut,
|
|
246
245
|
DropdownMenuSub,
|
|
247
|
-
DropdownMenuSubTrigger,
|
|
248
246
|
DropdownMenuSubContent,
|
|
247
|
+
DropdownMenuSubTrigger,
|
|
248
|
+
DropdownMenuTrigger,
|
|
249
249
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React from "react"
|
|
1
|
+
import type * as React from "react"
|
|
2
2
|
|
|
3
3
|
import { cn } from "../lib/utils"
|
|
4
4
|
|
|
@@ -17,7 +17,10 @@ function EmptyState({ icon, title, description, action, className, ...props }: E
|
|
|
17
17
|
return (
|
|
18
18
|
<div
|
|
19
19
|
data-slot="empty-state"
|
|
20
|
-
className={cn(
|
|
20
|
+
className={cn(
|
|
21
|
+
"flex h-full flex-col items-center justify-center gap-2 p-8 text-center",
|
|
22
|
+
className,
|
|
23
|
+
)}
|
|
21
24
|
{...props}
|
|
22
25
|
>
|
|
23
26
|
{icon ? <div className="text-muted-foreground [&_svg]:size-8">{icon}</div> : null}
|
|
@@ -28,5 +31,5 @@ function EmptyState({ icon, title, description, action, className, ...props }: E
|
|
|
28
31
|
)
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
export { EmptyState }
|
|
32
34
|
export type { EmptyStateProps }
|
|
35
|
+
export { EmptyState }
|
package/src/components/input.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
1
|
import { Input as InputPrimitive } from "@base-ui/react/input"
|
|
2
|
+
import type * as React from "react"
|
|
3
3
|
|
|
4
4
|
import { cn } from "../lib/utils"
|
|
5
5
|
|
|
@@ -10,7 +10,7 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
|
10
10
|
data-slot="input"
|
|
11
11
|
className={cn(
|
|
12
12
|
"h-8 w-full min-w-0 rounded-none border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
13
|
-
className
|
|
13
|
+
className,
|
|
14
14
|
)}
|
|
15
15
|
{...props}
|
|
16
16
|
/>
|
package/src/components/label.tsx
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import * as React from "react"
|
|
1
|
+
import type * as React from "react"
|
|
2
2
|
|
|
3
3
|
import { cn } from "../lib/utils"
|
|
4
4
|
|
|
5
5
|
function Label({ className, ...props }: React.ComponentProps<"label">) {
|
|
6
6
|
return (
|
|
7
|
+
// biome-ignore lint/a11y/noLabelWithoutControl: a primitive: the consumer supplies htmlFor or wraps the control
|
|
7
8
|
<label
|
|
8
9
|
data-slot="label"
|
|
9
10
|
className={cn(
|
|
10
11
|
"flex items-center gap-2 text-xs leading-none select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
11
|
-
className
|
|
12
|
+
className,
|
|
12
13
|
)}
|
|
13
14
|
{...props}
|
|
14
15
|
/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NavigationMenu as NavigationMenuPrimitive } from "@base-ui/react/navigation-menu"
|
|
2
|
-
import { cva } from "class-variance-authority"
|
|
3
2
|
import { CaretDownIcon } from "@phosphor-icons/react"
|
|
3
|
+
import { cva } from "class-variance-authority"
|
|
4
4
|
|
|
5
5
|
import { cn } from "../lib/utils"
|
|
6
6
|
|
|
@@ -16,7 +16,10 @@ function NavigationMenu({
|
|
|
16
16
|
return (
|
|
17
17
|
<NavigationMenuPrimitive.Root
|
|
18
18
|
data-slot="navigation-menu"
|
|
19
|
-
className={cn(
|
|
19
|
+
className={cn(
|
|
20
|
+
"group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
20
23
|
{...props}
|
|
21
24
|
>
|
|
22
25
|
{children}
|
|
@@ -46,7 +49,7 @@ function NavigationMenuItem({ className, ...props }: NavigationMenuPrimitive.Ite
|
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
const navigationMenuTriggerStyle = cva(
|
|
49
|
-
"group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium outline-none transition-[color,box-shadow] hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-popup-open:bg-accent/50 data-popup-open:text-accent-foreground data-popup-open:hover:bg-accent data-popup-open:focus:bg-accent"
|
|
52
|
+
"group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium outline-none transition-[color,box-shadow] hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-popup-open:bg-accent/50 data-popup-open:text-accent-foreground data-popup-open:hover:bg-accent data-popup-open:focus:bg-accent",
|
|
50
53
|
)
|
|
51
54
|
|
|
52
55
|
function NavigationMenuTrigger({
|
|
@@ -79,7 +82,7 @@ function NavigationMenuContent({ className, ...props }: NavigationMenuPrimitive.
|
|
|
79
82
|
data-slot="navigation-menu-content"
|
|
80
83
|
className={cn(
|
|
81
84
|
"w-full p-2 pr-2.5 transition-opacity duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0 md:w-auto **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none",
|
|
82
|
-
className
|
|
85
|
+
className,
|
|
83
86
|
)}
|
|
84
87
|
{...props}
|
|
85
88
|
/>
|
|
@@ -103,7 +106,7 @@ function NavigationMenuPositioner({
|
|
|
103
106
|
alignOffset={alignOffset}
|
|
104
107
|
className={cn(
|
|
105
108
|
"isolate z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom] duration-200",
|
|
106
|
-
className
|
|
109
|
+
className,
|
|
107
110
|
)}
|
|
108
111
|
{...props}
|
|
109
112
|
>
|
|
@@ -111,7 +114,10 @@ function NavigationMenuPositioner({
|
|
|
111
114
|
data-slot="navigation-menu-popup"
|
|
112
115
|
className="relative h-(--popup-height) w-(--popup-width) origin-(--transform-origin) overflow-hidden rounded-md border bg-popover text-popover-foreground shadow transition-[width,height,opacity,scale] duration-200 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0"
|
|
113
116
|
>
|
|
114
|
-
<NavigationMenuPrimitive.Viewport
|
|
117
|
+
<NavigationMenuPrimitive.Viewport
|
|
118
|
+
data-slot="navigation-menu-viewport"
|
|
119
|
+
className="relative size-full overflow-hidden"
|
|
120
|
+
/>
|
|
115
121
|
</NavigationMenuPrimitive.Popup>
|
|
116
122
|
</NavigationMenuPrimitive.Positioner>
|
|
117
123
|
</NavigationMenuPrimitive.Portal>
|
|
@@ -125,7 +131,7 @@ function NavigationMenuLink({ className, ...props }: NavigationMenuPrimitive.Lin
|
|
|
125
131
|
data-slot="navigation-menu-link"
|
|
126
132
|
className={cn(
|
|
127
133
|
"flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 data-active:bg-accent/50 data-active:text-accent-foreground data-active:hover:bg-accent data-active:focus:bg-accent [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
128
|
-
className
|
|
134
|
+
className,
|
|
129
135
|
)}
|
|
130
136
|
{...props}
|
|
131
137
|
/>
|
|
@@ -134,11 +140,11 @@ function NavigationMenuLink({ className, ...props }: NavigationMenuPrimitive.Lin
|
|
|
134
140
|
|
|
135
141
|
export {
|
|
136
142
|
NavigationMenu,
|
|
137
|
-
NavigationMenuList,
|
|
138
|
-
NavigationMenuItem,
|
|
139
143
|
NavigationMenuContent,
|
|
140
|
-
|
|
144
|
+
NavigationMenuItem,
|
|
141
145
|
NavigationMenuLink,
|
|
146
|
+
NavigationMenuList,
|
|
142
147
|
NavigationMenuPositioner,
|
|
148
|
+
NavigationMenuTrigger,
|
|
143
149
|
navigationMenuTriggerStyle,
|
|
144
150
|
}
|