@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
package/shadcn/sheet.tsx
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { Dialog as SheetPrimitive } from "radix-ui"
|
|
3
|
-
|
|
4
|
-
import { cn } from "@/lib/cn"
|
|
5
|
-
import { Button } from "@/primitives/button"
|
|
6
|
-
import { XIcon } from "lucide-react"
|
|
7
|
-
|
|
8
|
-
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
9
|
-
return <SheetPrimitive.Root data-slot="sheet" {...props} />
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function SheetTrigger({
|
|
13
|
-
...props
|
|
14
|
-
}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
15
|
-
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function SheetClose({
|
|
19
|
-
...props
|
|
20
|
-
}: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
|
21
|
-
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function SheetPortal({
|
|
25
|
-
...props
|
|
26
|
-
}: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
27
|
-
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function SheetOverlay({
|
|
31
|
-
className,
|
|
32
|
-
...props
|
|
33
|
-
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
34
|
-
return (
|
|
35
|
-
<SheetPrimitive.Overlay
|
|
36
|
-
data-slot="sheet-overlay"
|
|
37
|
-
className={cn(
|
|
38
|
-
"fixed inset-0 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",
|
|
39
|
-
className
|
|
40
|
-
)}
|
|
41
|
-
{...props}
|
|
42
|
-
/>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function SheetContent({
|
|
47
|
-
className,
|
|
48
|
-
children,
|
|
49
|
-
side = "right",
|
|
50
|
-
showCloseButton = true,
|
|
51
|
-
...props
|
|
52
|
-
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
53
|
-
side?: "top" | "right" | "bottom" | "left"
|
|
54
|
-
showCloseButton?: boolean
|
|
55
|
-
}) {
|
|
56
|
-
return (
|
|
57
|
-
<SheetPortal>
|
|
58
|
-
<SheetOverlay />
|
|
59
|
-
<SheetPrimitive.Content
|
|
60
|
-
data-slot="sheet-content"
|
|
61
|
-
data-side={side}
|
|
62
|
-
className={cn(
|
|
63
|
-
"fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10",
|
|
64
|
-
className
|
|
65
|
-
)}
|
|
66
|
-
{...props}
|
|
67
|
-
>
|
|
68
|
-
{children}
|
|
69
|
-
{showCloseButton && (
|
|
70
|
-
<SheetPrimitive.Close data-slot="sheet-close" asChild>
|
|
71
|
-
<Button
|
|
72
|
-
variant="ghost"
|
|
73
|
-
className="absolute top-3 right-3"
|
|
74
|
-
size="icon-sm"
|
|
75
|
-
>
|
|
76
|
-
<XIcon
|
|
77
|
-
/>
|
|
78
|
-
<span className="sr-only">Close</span>
|
|
79
|
-
</Button>
|
|
80
|
-
</SheetPrimitive.Close>
|
|
81
|
-
)}
|
|
82
|
-
</SheetPrimitive.Content>
|
|
83
|
-
</SheetPortal>
|
|
84
|
-
)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
88
|
-
return (
|
|
89
|
-
<div
|
|
90
|
-
data-slot="sheet-header"
|
|
91
|
-
className={cn("flex flex-col gap-0.5 p-4", className)}
|
|
92
|
-
{...props}
|
|
93
|
-
/>
|
|
94
|
-
)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
98
|
-
return (
|
|
99
|
-
<div
|
|
100
|
-
data-slot="sheet-footer"
|
|
101
|
-
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
102
|
-
{...props}
|
|
103
|
-
/>
|
|
104
|
-
)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function SheetTitle({
|
|
108
|
-
className,
|
|
109
|
-
...props
|
|
110
|
-
}: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
|
111
|
-
return (
|
|
112
|
-
<SheetPrimitive.Title
|
|
113
|
-
data-slot="sheet-title"
|
|
114
|
-
className={cn(
|
|
115
|
-
"font-heading text-base font-medium text-foreground",
|
|
116
|
-
className
|
|
117
|
-
)}
|
|
118
|
-
{...props}
|
|
119
|
-
/>
|
|
120
|
-
)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function SheetDescription({
|
|
124
|
-
className,
|
|
125
|
-
...props
|
|
126
|
-
}: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
127
|
-
return (
|
|
128
|
-
<SheetPrimitive.Description
|
|
129
|
-
data-slot="sheet-description"
|
|
130
|
-
className={cn("text-sm text-muted-foreground", className)}
|
|
131
|
-
{...props}
|
|
132
|
-
/>
|
|
133
|
-
)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export {
|
|
137
|
-
Sheet,
|
|
138
|
-
SheetTrigger,
|
|
139
|
-
SheetClose,
|
|
140
|
-
SheetContent,
|
|
141
|
-
SheetHeader,
|
|
142
|
-
SheetFooter,
|
|
143
|
-
SheetTitle,
|
|
144
|
-
SheetDescription,
|
|
145
|
-
}
|
package/shadcn/sonner.tsx
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { useTheme } from "next-themes"
|
|
4
|
-
import { Toaster as Sonner, type ToasterProps } from "sonner"
|
|
5
|
-
import { CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon, Loader2Icon } from "lucide-react"
|
|
6
|
-
|
|
7
|
-
const Toaster = ({ ...props }: ToasterProps) => {
|
|
8
|
-
const { theme = "system" } = useTheme()
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<Sonner
|
|
12
|
-
theme={theme as ToasterProps["theme"]}
|
|
13
|
-
className="toaster group"
|
|
14
|
-
icons={{
|
|
15
|
-
success: (
|
|
16
|
-
<CircleCheckIcon className="size-4" />
|
|
17
|
-
),
|
|
18
|
-
info: (
|
|
19
|
-
<InfoIcon className="size-4" />
|
|
20
|
-
),
|
|
21
|
-
warning: (
|
|
22
|
-
<TriangleAlertIcon className="size-4" />
|
|
23
|
-
),
|
|
24
|
-
error: (
|
|
25
|
-
<OctagonXIcon className="size-4" />
|
|
26
|
-
),
|
|
27
|
-
loading: (
|
|
28
|
-
<Loader2Icon className="size-4 animate-spin" />
|
|
29
|
-
),
|
|
30
|
-
}}
|
|
31
|
-
style={
|
|
32
|
-
{
|
|
33
|
-
"--normal-bg": "var(--popover)",
|
|
34
|
-
"--normal-text": "var(--popover-foreground)",
|
|
35
|
-
"--normal-border": "var(--border)",
|
|
36
|
-
"--border-radius": "var(--radius)",
|
|
37
|
-
} as React.CSSProperties
|
|
38
|
-
}
|
|
39
|
-
toastOptions={{
|
|
40
|
-
classNames: {
|
|
41
|
-
toast: "cn-toast",
|
|
42
|
-
},
|
|
43
|
-
}}
|
|
44
|
-
{...props}
|
|
45
|
-
/>
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { Toaster }
|
package/src/lib/button.ts
DELETED
package/src/lib/cn.test.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `cn` — the generic merge cases. No custom `tailwind-merge` configuration
|
|
3
|
-
* lives behind this one (the shadcn preset's names do not collide with a
|
|
4
|
-
* stock class group the way v1's `--text-*` scale did), so there is nothing
|
|
5
|
-
* scale-specific left to pin here.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { describe, expect, it } from "vitest";
|
|
9
|
-
|
|
10
|
-
import { cn } from "./cn";
|
|
11
|
-
|
|
12
|
-
describe("cn", () => {
|
|
13
|
-
it("lets a caller override a stock utility", () => {
|
|
14
|
-
expect(cn("px-4", "px-6")).toBe("px-6");
|
|
15
|
-
expect(cn("rounded-md", "rounded-full")).toBe("rounded-full");
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it("keeps utilities that do not conflict", () => {
|
|
19
|
-
expect(cn("flex", "items-center").split(" ").sort()).toEqual(["flex", "items-center"]);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it("drops falsy input rather than emitting it", () => {
|
|
23
|
-
expect(cn("flex", false, undefined, null, "gap-2")).toBe("flex gap-2");
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("keeps a semantic colour beside a layout utility", () => {
|
|
27
|
-
expect(cn("bg-primary", "rounded-lg").split(" ").sort()).toEqual(["bg-primary", "rounded-lg"]);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("lets a caller override a semantic background colour", () => {
|
|
31
|
-
expect(cn("bg-primary", "bg-destructive")).toBe("bg-destructive");
|
|
32
|
-
});
|
|
33
|
-
});
|
package/src/lib/cn.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `cn` — merge class names, last conflicting utility wins.
|
|
3
|
-
*
|
|
4
|
-
* `clsx` handles the conditionals; `tailwind-merge` handles the part a naive
|
|
5
|
-
* join gets wrong. Without it `cn("px-4", props.className)` with `px-6`
|
|
6
|
-
* passed in emits both, and which one applies is decided by the order
|
|
7
|
-
* Tailwind happened to write them into the stylesheet — so a caller's
|
|
8
|
-
* override works or does not depending on a rule nobody can see. That is why
|
|
9
|
-
* the `className` prop on every primitive here is a real extension point
|
|
10
|
-
* rather than a suggestion.
|
|
11
|
-
*
|
|
12
|
-
* The shadcn preset's own vocabulary needs no custom `tailwind-merge`
|
|
13
|
-
* configuration — unlike v1's `--text-*` scale, none of its names collide
|
|
14
|
-
* with a stock Tailwind class group — so this is the bare merge, the same
|
|
15
|
-
* shape the CLI scratch's own `lib/utils.ts` ships.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import { clsx, type ClassValue } from "clsx";
|
|
19
|
-
import { twMerge } from "tailwind-merge";
|
|
20
|
-
|
|
21
|
-
export function cn(...inputs: readonly ClassValue[]): string {
|
|
22
|
-
return twMerge(clsx(inputs));
|
|
23
|
-
}
|
package/src/lib/menu.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// What every `DropdownMenuContent` call site adds to the canonical surface, in
|
|
2
|
-
// one constant because both halves are the same rule — a menu that behaves like
|
|
3
|
-
// a menu (DESIGN.md, Motion).
|
|
4
|
-
//
|
|
5
|
-
// `data-closed:animate-none!`: a menu surface leaves on the frame it is
|
|
6
|
-
// dismissed. While Radix runs an exit animation the dismissable layer stays
|
|
7
|
-
// mounted, and a press that should open the next menu is swallowed as the
|
|
8
|
-
// dismissal of this one.
|
|
9
|
-
//
|
|
10
|
-
// `w-auto`: a menu sizes to its items, not to its trigger. Canonical carries
|
|
11
|
-
// `w-(--radix-dropdown-menu-trigger-width) min-w-32`, which pins the surface to
|
|
12
|
-
// the trigger — behind an icon-sized button that is the 128px floor, and every
|
|
13
|
-
// item longer than that wraps (the row actions on ModelsScreen, the Annotate
|
|
14
|
-
// picker). `min-w-32` survives as the floor it was meant to be, because
|
|
15
|
-
// tailwind-merge replaces only the `w-*` in the same utility group.
|
|
16
|
-
export const menuSurface = "data-closed:animate-none! w-auto";
|
package/src/lib/progress.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// Canonical `Progress` reads `value` only to size the indicator and never
|
|
2
|
-
// forwards it to Radix's `Root`, so the number a screen reader would announce
|
|
3
|
-
// is otherwise never rendered at all — a caller that needs it says so again here.
|
|
4
|
-
export function progressAria(value: number): { readonly "aria-valuenow": number } {
|
|
5
|
-
return { "aria-valuenow": value };
|
|
6
|
-
}
|
package/src/lib/select.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// A two-line option needs the closed trigger to grow and to stop clamping its
|
|
2
|
-
// value; both overrides name canonical's own variants so the merge replaces them.
|
|
3
|
-
export const twoLineTrigger =
|
|
4
|
-
"data-[size=default]:h-auto min-h-8 *:data-[slot=select-value]:line-clamp-none";
|
package/src/primitives/alert.tsx
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
-
|
|
4
|
-
import { cn } from "../lib/cn.js"
|
|
5
|
-
|
|
6
|
-
const alertVariants = cva(
|
|
7
|
-
"group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",
|
|
8
|
-
{
|
|
9
|
-
variants: {
|
|
10
|
-
variant: {
|
|
11
|
-
default: "bg-card text-card-foreground",
|
|
12
|
-
destructive:
|
|
13
|
-
"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
defaultVariants: {
|
|
17
|
-
variant: "default",
|
|
18
|
-
},
|
|
19
|
-
}
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
function Alert({
|
|
23
|
-
className,
|
|
24
|
-
variant,
|
|
25
|
-
...props
|
|
26
|
-
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
|
|
27
|
-
return (
|
|
28
|
-
<div
|
|
29
|
-
data-slot="alert"
|
|
30
|
-
role="alert"
|
|
31
|
-
className={cn(alertVariants({ variant }), className)}
|
|
32
|
-
{...props}
|
|
33
|
-
/>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
38
|
-
return (
|
|
39
|
-
<div
|
|
40
|
-
data-slot="alert-title"
|
|
41
|
-
className={cn(
|
|
42
|
-
"font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",
|
|
43
|
-
className
|
|
44
|
-
)}
|
|
45
|
-
{...props}
|
|
46
|
-
/>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function AlertDescription({
|
|
51
|
-
className,
|
|
52
|
-
...props
|
|
53
|
-
}: React.ComponentProps<"div">) {
|
|
54
|
-
return (
|
|
55
|
-
<div
|
|
56
|
-
data-slot="alert-description"
|
|
57
|
-
className={cn(
|
|
58
|
-
"text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",
|
|
59
|
-
className
|
|
60
|
-
)}
|
|
61
|
-
{...props}
|
|
62
|
-
/>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function AlertAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
67
|
-
return (
|
|
68
|
-
<div
|
|
69
|
-
data-slot="alert-action"
|
|
70
|
-
className={cn("absolute top-2 right-2", className)}
|
|
71
|
-
{...props}
|
|
72
|
-
/>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export { Alert, AlertTitle, AlertDescription, AlertAction }
|
package/src/primitives/card.tsx
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
|
|
3
|
-
import { cn } from "../lib/cn.js"
|
|
4
|
-
|
|
5
|
-
function Card({
|
|
6
|
-
className,
|
|
7
|
-
size = "default",
|
|
8
|
-
...props
|
|
9
|
-
}: React.ComponentProps<"div"> & { size?: "default" | "sm" }) {
|
|
10
|
-
return (
|
|
11
|
-
<div
|
|
12
|
-
data-slot="card"
|
|
13
|
-
data-size={size}
|
|
14
|
-
className={cn(
|
|
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
|
|
17
|
-
)}
|
|
18
|
-
{...props}
|
|
19
|
-
/>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
24
|
-
return (
|
|
25
|
-
<div
|
|
26
|
-
data-slot="card-header"
|
|
27
|
-
className={cn(
|
|
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
|
|
30
|
-
)}
|
|
31
|
-
{...props}
|
|
32
|
-
/>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
37
|
-
return (
|
|
38
|
-
<div
|
|
39
|
-
data-slot="card-title"
|
|
40
|
-
className={cn(
|
|
41
|
-
"font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",
|
|
42
|
-
className
|
|
43
|
-
)}
|
|
44
|
-
{...props}
|
|
45
|
-
/>
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
50
|
-
return (
|
|
51
|
-
<div
|
|
52
|
-
data-slot="card-description"
|
|
53
|
-
className={cn("text-sm text-muted-foreground", className)}
|
|
54
|
-
{...props}
|
|
55
|
-
/>
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
60
|
-
return (
|
|
61
|
-
<div
|
|
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
|
-
)}
|
|
67
|
-
{...props}
|
|
68
|
-
/>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
73
|
-
return (
|
|
74
|
-
<div
|
|
75
|
-
data-slot="card-content"
|
|
76
|
-
className={cn("px-(--card-spacing)", className)}
|
|
77
|
-
{...props}
|
|
78
|
-
/>
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
83
|
-
return (
|
|
84
|
-
<div
|
|
85
|
-
data-slot="card-footer"
|
|
86
|
-
className={cn(
|
|
87
|
-
"flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",
|
|
88
|
-
className
|
|
89
|
-
)}
|
|
90
|
-
{...props}
|
|
91
|
-
/>
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export {
|
|
96
|
-
Card,
|
|
97
|
-
CardHeader,
|
|
98
|
-
CardFooter,
|
|
99
|
-
CardTitle,
|
|
100
|
-
CardAction,
|
|
101
|
-
CardDescription,
|
|
102
|
-
CardContent,
|
|
103
|
-
}
|
package/src/primitives/input.tsx
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
|
|
3
|
-
import { cn } from "../lib/cn.js"
|
|
4
|
-
|
|
5
|
-
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
6
|
-
return (
|
|
7
|
-
<input
|
|
8
|
-
type={type}
|
|
9
|
-
data-slot="input"
|
|
10
|
-
className={cn(
|
|
11
|
-
"h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 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:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
12
|
-
className
|
|
13
|
-
)}
|
|
14
|
-
{...props}
|
|
15
|
-
/>
|
|
16
|
-
)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { Input }
|
package/src/primitives/label.tsx
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { Label as LabelPrimitive } from "radix-ui"
|
|
3
|
-
|
|
4
|
-
import { cn } from "../lib/cn.js"
|
|
5
|
-
|
|
6
|
-
function Label({
|
|
7
|
-
className,
|
|
8
|
-
...props
|
|
9
|
-
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
10
|
-
return (
|
|
11
|
-
<LabelPrimitive.Root
|
|
12
|
-
data-slot="label"
|
|
13
|
-
className={cn(
|
|
14
|
-
"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",
|
|
15
|
-
className
|
|
16
|
-
)}
|
|
17
|
-
{...props}
|
|
18
|
-
/>
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { Label }
|