@robomous/ui-core 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -7
- package/dist/{primitives → components}/alert.js +1 -1
- package/dist/{primitives → components}/badge.js +1 -1
- package/dist/{primitives → components}/button.d.ts +1 -1
- package/dist/{primitives → components}/button.js +4 -1
- package/dist/{primitives → components}/card.d.ts +1 -1
- package/dist/{primitives → components}/card.js +2 -2
- package/dist/{primitives → components}/combobox.js +4 -4
- package/dist/{primitives → components}/dialog.js +1 -1
- package/dist/{primitives → components}/dropdown-menu.js +12 -7
- package/dist/{primitives → components}/field.js +2 -4
- package/dist/{primitives → components}/input-group.js +1 -1
- package/dist/{primitives → components}/input.js +1 -1
- package/dist/{primitives → components}/label.js +1 -1
- package/dist/components/progress.js +7 -0
- package/dist/{primitives → components}/select.d.ts +3 -1
- package/dist/{primitives → components}/select.js +7 -4
- package/dist/{primitives → components}/separator.js +1 -1
- package/dist/{primitives → components}/sheet.js +1 -1
- package/dist/{primitives → components}/skeleton.js +1 -1
- package/dist/{primitives → components}/sonner.js +17 -12
- package/dist/{primitives → components}/table.d.ts +1 -1
- package/dist/{primitives → components}/table.js +3 -3
- package/dist/{primitives → components}/tabs.js +1 -1
- package/dist/{primitives → components}/textarea.js +1 -1
- package/dist/{primitives → components}/tooltip.js +1 -1
- package/dist/gates/index.d.ts +28 -0
- package/dist/gates/index.js +142 -0
- package/dist/index.d.ts +31 -32
- package/dist/index.js +32 -33
- package/dist/{tokens.d.ts → theme/tokens.d.ts} +5 -5
- package/dist/{tokens.js → theme/tokens.js} +12 -12
- package/package.json +23 -12
- package/{shadcn → src/components}/alert.tsx +14 -21
- package/src/{primitives → components}/badge.tsx +15 -21
- package/src/{primitives → components}/button.tsx +13 -10
- package/{shadcn → src/components}/card.tsx +16 -31
- package/src/{primitives → components}/combobox.test.tsx +15 -2
- package/src/{primitives → components}/combobox.tsx +45 -74
- package/src/{primitives/primitives.test.tsx → components/components.test.tsx} +106 -69
- package/src/{primitives → components}/dialog.tsx +31 -54
- package/src/{primitives → components}/dropdown-menu.tsx +51 -65
- package/src/{primitives → components}/field.tsx +48 -62
- package/src/{primitives → components}/input-group.tsx +37 -49
- package/{shadcn → src/components}/input.tsx +5 -5
- package/{shadcn → src/components}/label.tsx +7 -10
- package/src/{primitives → components}/progress.tsx +7 -6
- package/{shadcn → src/components}/select.tsx +40 -40
- package/{shadcn → src/components}/separator.tsx +7 -7
- package/src/{primitives → components}/sheet.tsx +27 -44
- package/{shadcn → src/components}/skeleton.tsx +3 -3
- package/src/{primitives → components}/sonner.test.tsx +12 -4
- package/src/components/sonner.tsx +67 -0
- package/{shadcn → src/components}/table.tsx +17 -44
- package/{shadcn → src/components}/tabs.tsx +16 -26
- package/{shadcn → src/components}/textarea.tsx +5 -5
- package/{shadcn → src/components}/tooltip.tsx +12 -16
- package/src/gates/design.test.ts +188 -0
- package/src/gates/index.test.ts +11 -0
- package/src/gates/index.ts +165 -0
- package/src/gates/tokens.test.ts +215 -0
- package/src/harness.test.tsx +1 -1
- package/src/index.ts +63 -33
- package/src/theme/imports.test.ts +160 -0
- package/src/{statusTone.test.ts → theme/statusTone.test.ts} +5 -1
- package/src/{styles.css → theme/styles.css} +45 -31
- package/src/theme/tailwind.css +646 -0
- package/src/{tokens.test.ts → theme/tokens.test.ts} +30 -23
- package/src/{tokens.ts → theme/tokens.ts} +12 -12
- package/components.json +0 -13
- package/dist/lib/button.d.ts +0 -1
- package/dist/lib/button.js +0 -4
- package/dist/lib/cn.d.ts +0 -18
- package/dist/lib/cn.js +0 -21
- package/dist/lib/menu.d.ts +0 -1
- package/dist/lib/menu.js +0 -16
- package/dist/lib/progress.d.ts +0 -3
- package/dist/lib/progress.js +0 -6
- package/dist/lib/select.d.ts +0 -1
- package/dist/lib/select.js +0 -3
- package/dist/primitives/progress.js +0 -7
- package/gates/canonical.test.mjs +0 -71
- package/gates/extensions.test.mjs +0 -373
- package/gates/index.d.mts +0 -51
- package/gates/index.mjs +0 -514
- package/gates/tokens.test.mjs +0 -276
- package/shadcn/README.md +0 -13
- package/shadcn/badge.tsx +0 -49
- package/shadcn/button.tsx +0 -67
- package/shadcn/combobox.tsx +0 -299
- package/shadcn/dialog.tsx +0 -166
- package/shadcn/dropdown-menu.tsx +0 -267
- package/shadcn/field.tsx +0 -236
- package/shadcn/input-group.tsx +0 -154
- package/shadcn/progress.tsx +0 -29
- package/shadcn/sheet.tsx +0 -145
- package/shadcn/sonner.tsx +0 -49
- package/src/lib/button.ts +0 -4
- package/src/lib/cn.test.ts +0 -33
- package/src/lib/cn.ts +0 -23
- package/src/lib/menu.ts +0 -16
- package/src/lib/progress.ts +0 -6
- package/src/lib/select.ts +0 -4
- package/src/primitives/alert.tsx +0 -76
- package/src/primitives/card.tsx +0 -103
- package/src/primitives/input.tsx +0 -19
- package/src/primitives/label.tsx +0 -22
- package/src/primitives/select.tsx +0 -190
- package/src/primitives/separator.tsx +0 -28
- package/src/primitives/skeleton.tsx +0 -13
- package/src/primitives/sonner.tsx +0 -65
- package/src/primitives/table.tsx +0 -114
- package/src/primitives/tabs.tsx +0 -88
- package/src/primitives/textarea.tsx +0 -18
- package/src/primitives/tooltip.tsx +0 -57
- /package/dist/{primitives → components}/alert.d.ts +0 -0
- /package/dist/{primitives → components}/badge.d.ts +0 -0
- /package/dist/{primitives → components}/combobox.d.ts +0 -0
- /package/dist/{primitives → components}/dialog.d.ts +0 -0
- /package/dist/{primitives → components}/dropdown-menu.d.ts +0 -0
- /package/dist/{primitives → components}/field.d.ts +0 -0
- /package/dist/{primitives → components}/input-group.d.ts +0 -0
- /package/dist/{primitives → components}/input.d.ts +0 -0
- /package/dist/{primitives → components}/label.d.ts +0 -0
- /package/dist/{primitives → components}/progress.d.ts +0 -0
- /package/dist/{primitives → components}/separator.d.ts +0 -0
- /package/dist/{primitives → components}/sheet.d.ts +0 -0
- /package/dist/{primitives → components}/skeleton.d.ts +0 -0
- /package/dist/{primitives → components}/sonner.d.ts +0 -0
- /package/dist/{primitives → components}/tabs.d.ts +0 -0
- /package/dist/{primitives → components}/textarea.d.ts +0 -0
- /package/dist/{primitives → components}/tooltip.d.ts +0 -0
- /package/dist/{statusTone.d.ts → theme/statusTone.d.ts} +0 -0
- /package/dist/{statusTone.js → theme/statusTone.js} +0 -0
- /package/src/{statusTone.ts → theme/statusTone.ts} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
-
import { Slot } from "radix-ui"
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { Slot } from "radix-ui";
|
|
4
4
|
|
|
5
|
-
import { cn } from "
|
|
5
|
+
import { cn } from "cn";
|
|
6
6
|
|
|
7
7
|
const buttonVariants = cva(
|
|
8
8
|
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
@@ -32,14 +32,17 @@ const buttonVariants = cva(
|
|
|
32
32
|
"icon-sm":
|
|
33
33
|
"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
|
|
34
34
|
"icon-lg": "size-9",
|
|
35
|
+
// A link button is inline prose, not a boxed control: no height of its
|
|
36
|
+
// own and no padding, so it sits inside a sentence or a table cell.
|
|
37
|
+
inline: "h-auto p-0",
|
|
35
38
|
},
|
|
36
39
|
},
|
|
37
40
|
defaultVariants: {
|
|
38
41
|
variant: "default",
|
|
39
42
|
size: "default",
|
|
40
43
|
},
|
|
41
|
-
}
|
|
42
|
-
)
|
|
44
|
+
},
|
|
45
|
+
);
|
|
43
46
|
|
|
44
47
|
function Button({
|
|
45
48
|
className,
|
|
@@ -49,9 +52,9 @@ function Button({
|
|
|
49
52
|
...props
|
|
50
53
|
}: React.ComponentProps<"button"> &
|
|
51
54
|
VariantProps<typeof buttonVariants> & {
|
|
52
|
-
asChild?: boolean
|
|
55
|
+
asChild?: boolean;
|
|
53
56
|
}) {
|
|
54
|
-
const Comp = asChild ? Slot.Root : "button"
|
|
57
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
55
58
|
|
|
56
59
|
return (
|
|
57
60
|
<Comp
|
|
@@ -61,7 +64,7 @@ function Button({
|
|
|
61
64
|
className={cn(buttonVariants({ variant, size, className }))}
|
|
62
65
|
{...props}
|
|
63
66
|
/>
|
|
64
|
-
)
|
|
67
|
+
);
|
|
65
68
|
}
|
|
66
69
|
|
|
67
|
-
export { Button, buttonVariants }
|
|
70
|
+
export { Button, buttonVariants };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from "react"
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
import { cn } from "
|
|
3
|
+
import { cn } from "cn";
|
|
4
4
|
|
|
5
5
|
function Card({
|
|
6
6
|
className,
|
|
@@ -13,11 +13,11 @@ function Card({
|
|
|
13
13
|
data-size={size}
|
|
14
14
|
className={cn(
|
|
15
15
|
"group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
|
16
|
-
className
|
|
16
|
+
className,
|
|
17
17
|
)}
|
|
18
18
|
{...props}
|
|
19
19
|
/>
|
|
20
|
-
)
|
|
20
|
+
);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
@@ -26,11 +26,11 @@ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
26
26
|
data-slot="card-header"
|
|
27
27
|
className={cn(
|
|
28
28
|
"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",
|
|
29
|
-
className
|
|
29
|
+
className,
|
|
30
30
|
)}
|
|
31
31
|
{...props}
|
|
32
32
|
/>
|
|
33
|
-
)
|
|
33
|
+
);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
@@ -39,11 +39,11 @@ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
39
39
|
data-slot="card-title"
|
|
40
40
|
className={cn(
|
|
41
41
|
"font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",
|
|
42
|
-
className
|
|
42
|
+
className,
|
|
43
43
|
)}
|
|
44
44
|
{...props}
|
|
45
45
|
/>
|
|
46
|
-
)
|
|
46
|
+
);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
@@ -53,30 +53,23 @@ function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
53
53
|
className={cn("text-sm text-muted-foreground", className)}
|
|
54
54
|
{...props}
|
|
55
55
|
/>
|
|
56
|
-
)
|
|
56
|
+
);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
60
60
|
return (
|
|
61
61
|
<div
|
|
62
62
|
data-slot="card-action"
|
|
63
|
-
className={cn(
|
|
64
|
-
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
65
|
-
className
|
|
66
|
-
)}
|
|
63
|
+
className={cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className)}
|
|
67
64
|
{...props}
|
|
68
65
|
/>
|
|
69
|
-
)
|
|
66
|
+
);
|
|
70
67
|
}
|
|
71
68
|
|
|
72
69
|
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
73
70
|
return (
|
|
74
|
-
<div
|
|
75
|
-
|
|
76
|
-
className={cn("px-(--card-spacing)", className)}
|
|
77
|
-
{...props}
|
|
78
|
-
/>
|
|
79
|
-
)
|
|
71
|
+
<div data-slot="card-content" className={cn("px-(--card-spacing)", className)} {...props} />
|
|
72
|
+
);
|
|
80
73
|
}
|
|
81
74
|
|
|
82
75
|
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
@@ -85,19 +78,11 @@ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
85
78
|
data-slot="card-footer"
|
|
86
79
|
className={cn(
|
|
87
80
|
"flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",
|
|
88
|
-
className
|
|
81
|
+
className,
|
|
89
82
|
)}
|
|
90
83
|
{...props}
|
|
91
84
|
/>
|
|
92
|
-
)
|
|
85
|
+
);
|
|
93
86
|
}
|
|
94
87
|
|
|
95
|
-
export {
|
|
96
|
-
Card,
|
|
97
|
-
CardHeader,
|
|
98
|
-
CardFooter,
|
|
99
|
-
CardTitle,
|
|
100
|
-
CardAction,
|
|
101
|
-
CardDescription,
|
|
102
|
-
CardContent,
|
|
103
|
-
}
|
|
88
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent };
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { render, screen } from "@testing-library/react";
|
|
2
2
|
import userEvent from "@testing-library/user-event";
|
|
3
3
|
import { describe, expect, it } from "vitest";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Combobox,
|
|
6
|
+
ComboboxContent,
|
|
7
|
+
ComboboxEmpty,
|
|
8
|
+
ComboboxInput,
|
|
9
|
+
ComboboxItem,
|
|
10
|
+
ComboboxList,
|
|
11
|
+
} from "./combobox";
|
|
5
12
|
|
|
6
13
|
const FRUIT = ["apple", "banana", "cherry"];
|
|
7
14
|
|
|
@@ -11,7 +18,13 @@ function Demo() {
|
|
|
11
18
|
<ComboboxInput placeholder="Pick" aria-label="Fruit" />
|
|
12
19
|
<ComboboxContent>
|
|
13
20
|
<ComboboxEmpty>No matches</ComboboxEmpty>
|
|
14
|
-
<ComboboxList>
|
|
21
|
+
<ComboboxList>
|
|
22
|
+
{(item: string) => (
|
|
23
|
+
<ComboboxItem key={item} value={item}>
|
|
24
|
+
{item}
|
|
25
|
+
</ComboboxItem>
|
|
26
|
+
)}
|
|
27
|
+
</ComboboxList>
|
|
15
28
|
</ComboboxContent>
|
|
16
29
|
</Combobox>
|
|
17
30
|
);
|
|
@@ -1,29 +1,20 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { Combobox as ComboboxPrimitive } from "@base-ui/react"
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Combobox as ComboboxPrimitive } from "@base-ui/react";
|
|
5
5
|
|
|
6
|
-
import { cn } from "
|
|
7
|
-
import { Button } from "./button.js"
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
InputGroupAddon,
|
|
11
|
-
InputGroupButton,
|
|
12
|
-
InputGroupInput,
|
|
13
|
-
} from "./input-group.js"
|
|
14
|
-
import { ChevronDownIcon, XIcon, CheckIcon } from "lucide-react"
|
|
6
|
+
import { cn } from "cn";
|
|
7
|
+
import { Button } from "./button.js";
|
|
8
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "./input-group.js";
|
|
9
|
+
import { ChevronDownIcon, XIcon, CheckIcon } from "lucide-react";
|
|
15
10
|
|
|
16
|
-
const Combobox = ComboboxPrimitive.Root
|
|
11
|
+
const Combobox = ComboboxPrimitive.Root;
|
|
17
12
|
|
|
18
13
|
function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {
|
|
19
|
-
return <ComboboxPrimitive.Value data-slot="combobox-value" {...props}
|
|
14
|
+
return <ComboboxPrimitive.Value data-slot="combobox-value" {...props} />;
|
|
20
15
|
}
|
|
21
16
|
|
|
22
|
-
function ComboboxTrigger({
|
|
23
|
-
className,
|
|
24
|
-
children,
|
|
25
|
-
...props
|
|
26
|
-
}: ComboboxPrimitive.Trigger.Props) {
|
|
17
|
+
function ComboboxTrigger({ className, children, ...props }: ComboboxPrimitive.Trigger.Props) {
|
|
27
18
|
return (
|
|
28
19
|
<ComboboxPrimitive.Trigger
|
|
29
20
|
data-slot="combobox-trigger"
|
|
@@ -33,7 +24,7 @@ function ComboboxTrigger({
|
|
|
33
24
|
{children}
|
|
34
25
|
<ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
|
|
35
26
|
</ComboboxPrimitive.Trigger>
|
|
36
|
-
)
|
|
27
|
+
);
|
|
37
28
|
}
|
|
38
29
|
|
|
39
30
|
function ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {
|
|
@@ -46,7 +37,7 @@ function ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {
|
|
|
46
37
|
>
|
|
47
38
|
<XIcon className="pointer-events-none" />
|
|
48
39
|
</ComboboxPrimitive.Clear>
|
|
49
|
-
)
|
|
40
|
+
);
|
|
50
41
|
}
|
|
51
42
|
|
|
52
43
|
function ComboboxInput({
|
|
@@ -57,15 +48,12 @@ function ComboboxInput({
|
|
|
57
48
|
showClear = false,
|
|
58
49
|
...props
|
|
59
50
|
}: ComboboxPrimitive.Input.Props & {
|
|
60
|
-
showTrigger?: boolean
|
|
61
|
-
showClear?: boolean
|
|
51
|
+
showTrigger?: boolean;
|
|
52
|
+
showClear?: boolean;
|
|
62
53
|
}) {
|
|
63
54
|
return (
|
|
64
55
|
<InputGroup className={cn("w-auto", className)}>
|
|
65
|
-
<ComboboxPrimitive.Input
|
|
66
|
-
render={<InputGroupInput disabled={disabled} />}
|
|
67
|
-
{...props}
|
|
68
|
-
/>
|
|
56
|
+
<ComboboxPrimitive.Input render={<InputGroupInput disabled={disabled} />} {...props} />
|
|
69
57
|
<InputGroupAddon align="inline-end">
|
|
70
58
|
{showTrigger && (
|
|
71
59
|
<InputGroupButton
|
|
@@ -83,7 +71,7 @@ function ComboboxInput({
|
|
|
83
71
|
</InputGroupAddon>
|
|
84
72
|
{children}
|
|
85
73
|
</InputGroup>
|
|
86
|
-
)
|
|
74
|
+
);
|
|
87
75
|
}
|
|
88
76
|
|
|
89
77
|
function ComboboxContent({
|
|
@@ -112,12 +100,15 @@ function ComboboxContent({
|
|
|
112
100
|
<ComboboxPrimitive.Popup
|
|
113
101
|
data-slot="combobox-content"
|
|
114
102
|
data-chips={!!anchor}
|
|
115
|
-
className={cn(
|
|
103
|
+
className={cn(
|
|
104
|
+
"group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) 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-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none 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",
|
|
105
|
+
className,
|
|
106
|
+
)}
|
|
116
107
|
{...props}
|
|
117
108
|
/>
|
|
118
109
|
</ComboboxPrimitive.Positioner>
|
|
119
110
|
</ComboboxPrimitive.Portal>
|
|
120
|
-
)
|
|
111
|
+
);
|
|
121
112
|
}
|
|
122
113
|
|
|
123
114
|
function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {
|
|
@@ -126,24 +117,20 @@ function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {
|
|
|
126
117
|
data-slot="combobox-list"
|
|
127
118
|
className={cn(
|
|
128
119
|
"no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0",
|
|
129
|
-
className
|
|
120
|
+
className,
|
|
130
121
|
)}
|
|
131
122
|
{...props}
|
|
132
123
|
/>
|
|
133
|
-
)
|
|
124
|
+
);
|
|
134
125
|
}
|
|
135
126
|
|
|
136
|
-
function ComboboxItem({
|
|
137
|
-
className,
|
|
138
|
-
children,
|
|
139
|
-
...props
|
|
140
|
-
}: ComboboxPrimitive.Item.Props) {
|
|
127
|
+
function ComboboxItem({ className, children, ...props }: ComboboxPrimitive.Item.Props) {
|
|
141
128
|
return (
|
|
142
129
|
<ComboboxPrimitive.Item
|
|
143
130
|
data-slot="combobox-item"
|
|
144
131
|
className={cn(
|
|
145
132
|
"relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
146
|
-
className
|
|
133
|
+
className,
|
|
147
134
|
)}
|
|
148
135
|
{...props}
|
|
149
136
|
>
|
|
@@ -156,36 +143,27 @@ function ComboboxItem({
|
|
|
156
143
|
<CheckIcon className="pointer-events-none" />
|
|
157
144
|
</ComboboxPrimitive.ItemIndicator>
|
|
158
145
|
</ComboboxPrimitive.Item>
|
|
159
|
-
)
|
|
146
|
+
);
|
|
160
147
|
}
|
|
161
148
|
|
|
162
149
|
function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {
|
|
163
150
|
return (
|
|
164
|
-
<ComboboxPrimitive.Group
|
|
165
|
-
|
|
166
|
-
className={cn(className)}
|
|
167
|
-
{...props}
|
|
168
|
-
/>
|
|
169
|
-
)
|
|
151
|
+
<ComboboxPrimitive.Group data-slot="combobox-group" className={cn(className)} {...props} />
|
|
152
|
+
);
|
|
170
153
|
}
|
|
171
154
|
|
|
172
|
-
function ComboboxLabel({
|
|
173
|
-
className,
|
|
174
|
-
...props
|
|
175
|
-
}: ComboboxPrimitive.GroupLabel.Props) {
|
|
155
|
+
function ComboboxLabel({ className, ...props }: ComboboxPrimitive.GroupLabel.Props) {
|
|
176
156
|
return (
|
|
177
157
|
<ComboboxPrimitive.GroupLabel
|
|
178
158
|
data-slot="combobox-label"
|
|
179
159
|
className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
|
|
180
160
|
{...props}
|
|
181
161
|
/>
|
|
182
|
-
)
|
|
162
|
+
);
|
|
183
163
|
}
|
|
184
164
|
|
|
185
165
|
function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {
|
|
186
|
-
return
|
|
187
|
-
<ComboboxPrimitive.Collection data-slot="combobox-collection" {...props} />
|
|
188
|
-
)
|
|
166
|
+
return <ComboboxPrimitive.Collection data-slot="combobox-collection" {...props} />;
|
|
189
167
|
}
|
|
190
168
|
|
|
191
169
|
function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {
|
|
@@ -194,41 +172,37 @@ function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {
|
|
|
194
172
|
data-slot="combobox-empty"
|
|
195
173
|
className={cn(
|
|
196
174
|
"hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex",
|
|
197
|
-
className
|
|
175
|
+
className,
|
|
198
176
|
)}
|
|
199
177
|
{...props}
|
|
200
178
|
/>
|
|
201
|
-
)
|
|
179
|
+
);
|
|
202
180
|
}
|
|
203
181
|
|
|
204
|
-
function ComboboxSeparator({
|
|
205
|
-
className,
|
|
206
|
-
...props
|
|
207
|
-
}: ComboboxPrimitive.Separator.Props) {
|
|
182
|
+
function ComboboxSeparator({ className, ...props }: ComboboxPrimitive.Separator.Props) {
|
|
208
183
|
return (
|
|
209
184
|
<ComboboxPrimitive.Separator
|
|
210
185
|
data-slot="combobox-separator"
|
|
211
186
|
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
212
187
|
{...props}
|
|
213
188
|
/>
|
|
214
|
-
)
|
|
189
|
+
);
|
|
215
190
|
}
|
|
216
191
|
|
|
217
192
|
function ComboboxChips({
|
|
218
193
|
className,
|
|
219
194
|
...props
|
|
220
|
-
}: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &
|
|
221
|
-
ComboboxPrimitive.Chips.Props) {
|
|
195
|
+
}: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> & ComboboxPrimitive.Chips.Props) {
|
|
222
196
|
return (
|
|
223
197
|
<ComboboxPrimitive.Chips
|
|
224
198
|
data-slot="combobox-chips"
|
|
225
199
|
className={cn(
|
|
226
200
|
"flex min-h-8 flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40",
|
|
227
|
-
className
|
|
201
|
+
className,
|
|
228
202
|
)}
|
|
229
203
|
{...props}
|
|
230
204
|
/>
|
|
231
|
-
)
|
|
205
|
+
);
|
|
232
206
|
}
|
|
233
207
|
|
|
234
208
|
function ComboboxChip({
|
|
@@ -237,14 +211,14 @@ function ComboboxChip({
|
|
|
237
211
|
showRemove = true,
|
|
238
212
|
...props
|
|
239
213
|
}: ComboboxPrimitive.Chip.Props & {
|
|
240
|
-
showRemove?: boolean
|
|
214
|
+
showRemove?: boolean;
|
|
241
215
|
}) {
|
|
242
216
|
return (
|
|
243
217
|
<ComboboxPrimitive.Chip
|
|
244
218
|
data-slot="combobox-chip"
|
|
245
219
|
className={cn(
|
|
246
220
|
"flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0",
|
|
247
|
-
className
|
|
221
|
+
className,
|
|
248
222
|
)}
|
|
249
223
|
{...props}
|
|
250
224
|
>
|
|
@@ -259,24 +233,21 @@ function ComboboxChip({
|
|
|
259
233
|
</ComboboxPrimitive.ChipRemove>
|
|
260
234
|
)}
|
|
261
235
|
</ComboboxPrimitive.Chip>
|
|
262
|
-
)
|
|
236
|
+
);
|
|
263
237
|
}
|
|
264
238
|
|
|
265
|
-
function ComboboxChipsInput({
|
|
266
|
-
className,
|
|
267
|
-
...props
|
|
268
|
-
}: ComboboxPrimitive.Input.Props) {
|
|
239
|
+
function ComboboxChipsInput({ className, ...props }: ComboboxPrimitive.Input.Props) {
|
|
269
240
|
return (
|
|
270
241
|
<ComboboxPrimitive.Input
|
|
271
242
|
data-slot="combobox-chip-input"
|
|
272
243
|
className={cn("min-w-16 flex-1 outline-none", className)}
|
|
273
244
|
{...props}
|
|
274
245
|
/>
|
|
275
|
-
)
|
|
246
|
+
);
|
|
276
247
|
}
|
|
277
248
|
|
|
278
249
|
function useComboboxAnchor() {
|
|
279
|
-
return React.useRef<HTMLDivElement | null>(null)
|
|
250
|
+
return React.useRef<HTMLDivElement | null>(null);
|
|
280
251
|
}
|
|
281
252
|
|
|
282
253
|
export {
|
|
@@ -296,4 +267,4 @@ export {
|
|
|
296
267
|
ComboboxTrigger,
|
|
297
268
|
ComboboxValue,
|
|
298
269
|
useComboboxAnchor,
|
|
299
|
-
}
|
|
270
|
+
};
|