@sniptide/ui 0.0.0-stage → 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/LICENSE +661 -0
- package/README.md +48 -2
- package/package.json +55 -4
- package/postcss.config.mjs +6 -0
- package/src/components/alert-dialog.tsx +59 -0
- package/src/components/avatar.tsx +25 -0
- package/src/components/badge.tsx +30 -0
- package/src/components/button.tsx +56 -0
- package/src/components/dialog.tsx +45 -0
- package/src/components/dropdown-menu.tsx +118 -0
- package/src/components/input.tsx +17 -0
- package/src/components/kbd.tsx +17 -0
- package/src/components/label.tsx +15 -0
- package/src/components/logo.tsx +48 -0
- package/src/components/progress.tsx +14 -0
- package/src/components/segmented-control.tsx +49 -0
- package/src/components/select.tsx +68 -0
- package/src/components/separator.tsx +18 -0
- package/src/components/sheet.tsx +32 -0
- package/src/components/stripes.tsx +65 -0
- package/src/components/switch.tsx +21 -0
- package/src/components/table.tsx +45 -0
- package/src/components/tabs.tsx +32 -0
- package/src/components/textarea.tsx +17 -0
- package/src/components/tooltip.tsx +32 -0
- package/src/hooks/.gitkeep +0 -0
- package/src/lib/.gitkeep +0 -0
- package/src/lib/utils.ts +1 -0
- package/src/styles/globals.css +133 -0
package/README.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @sniptide/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Sniptide's shared React components (shadcn on Base UI), brand pieces (`Logo`, `Stripes`) and the
|
|
4
|
+
Tailwind v4 theme. The Sniptide app uses it from this monorepo; the website installs it from npm.
|
|
5
|
+
|
|
6
|
+
The package ships TypeScript source, so the consuming Next.js app compiles it.
|
|
7
|
+
|
|
8
|
+
## Use it in a Next.js app
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
bun add @sniptide/ui
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
// next.config.ts
|
|
16
|
+
const nextConfig = { transpilePackages: ["@sniptide/ui"] }
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
// postcss.config.mjs
|
|
21
|
+
export { default } from "@sniptide/ui/postcss.config"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
// app/layout.tsx
|
|
26
|
+
import "@sniptide/ui/globals.css"
|
|
27
|
+
import { Button } from "@sniptide/ui/components/button"
|
|
28
|
+
import { Logo } from "@sniptide/ui/components/logo"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The theme reads three font variables, so set them on `<html>` (for example with `next/font`):
|
|
32
|
+
`--font-sans` (Inter), `--font-mono` (JetBrains Mono) and `--font-heading` (Stack Sans Notch).
|
|
33
|
+
|
|
34
|
+
`globals.css` already tells Tailwind to scan this package's components; your own files are found
|
|
35
|
+
by Tailwind's automatic source detection.
|
|
36
|
+
|
|
37
|
+
## Releasing
|
|
38
|
+
|
|
39
|
+
Bump `version` in `package.json` and merge to `main`. The `Publish @sniptide/ui` workflow stages
|
|
40
|
+
any version that isn't on npm yet (Trusted Publishing, no token). Approve it with 2FA to publish:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm stage list @sniptide/ui
|
|
44
|
+
npm stage approve <stage-id>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
AGPL-3.0-only, like the rest of Sniptide.
|
package/package.json
CHANGED
|
@@ -1,6 +1,57 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sniptide/ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Sniptide's shared React components and Tailwind theme, used by the app and the website.",
|
|
5
|
+
"license": "AGPL-3.0-only",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Dino-Kupinic/sniptide.git",
|
|
10
|
+
"directory": "packages/ui"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"postcss.config.mjs",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"lint": "biome lint .",
|
|
23
|
+
"format": "biome format --write .",
|
|
24
|
+
"typecheck": "tsc --noEmit"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"react": "^19.2.0",
|
|
28
|
+
"react-dom": "^19.2.0"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@base-ui/react": "^1.8.0",
|
|
32
|
+
"@tailwindcss/postcss": "^4",
|
|
33
|
+
"class-variance-authority": "^0.7.1",
|
|
34
|
+
"cn": "^0.2.6",
|
|
35
|
+
"lucide-react": "^1.43.0",
|
|
36
|
+
"shadcn": "^4.21.0",
|
|
37
|
+
"tailwindcss": "^4",
|
|
38
|
+
"tw-animate-css": "^1.4.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@turbo/gen": "^2.9.15",
|
|
42
|
+
"@types/node": "^26.5.0",
|
|
43
|
+
"@types/react": "^19",
|
|
44
|
+
"@types/react-dom": "^19",
|
|
45
|
+
"@workspace/typescript": "0.0.0",
|
|
46
|
+
"react": "19.2.8",
|
|
47
|
+
"react-dom": "19.2.8",
|
|
48
|
+
"typescript": "^5"
|
|
49
|
+
},
|
|
50
|
+
"exports": {
|
|
51
|
+
"./globals.css": "./src/styles/globals.css",
|
|
52
|
+
"./postcss.config": "./postcss.config.mjs",
|
|
53
|
+
"./lib/*": "./src/lib/*.ts",
|
|
54
|
+
"./components/*": "./src/components/*.tsx",
|
|
55
|
+
"./hooks/*": "./src/hooks/*.ts"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog"
|
|
4
|
+
import { cn } from "cn"
|
|
5
|
+
|
|
6
|
+
// Confirmation dialog for destructive actions (delete forever, empty trash). Square, with the
|
|
7
|
+
// hard offset shadow the popovers use.
|
|
8
|
+
const AlertDialog = AlertDialogPrimitive.Root
|
|
9
|
+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
|
|
10
|
+
const AlertDialogClose = AlertDialogPrimitive.Close
|
|
11
|
+
|
|
12
|
+
function AlertDialogContent({ className, children, ...props }: AlertDialogPrimitive.Popup.Props) {
|
|
13
|
+
return (
|
|
14
|
+
<AlertDialogPrimitive.Portal>
|
|
15
|
+
<AlertDialogPrimitive.Backdrop className="fixed inset-0 z-50 bg-foreground/20 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0" />
|
|
16
|
+
<AlertDialogPrimitive.Popup
|
|
17
|
+
className={cn(
|
|
18
|
+
"fixed top-1/2 left-1/2 z-50 flex w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 flex-col gap-4 border border-foreground bg-popover p-6 text-popover-foreground shadow-[8px_8px_0_0_var(--foreground)] outline-none transition-[scale,opacity] duration-150 data-ending-style:scale-[0.98] data-ending-style:opacity-0 data-starting-style:scale-[0.98] data-starting-style:opacity-0",
|
|
19
|
+
className,
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</AlertDialogPrimitive.Popup>
|
|
25
|
+
</AlertDialogPrimitive.Portal>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function AlertDialogTitle({ className, ...props }: AlertDialogPrimitive.Title.Props) {
|
|
30
|
+
return (
|
|
31
|
+
<AlertDialogPrimitive.Title
|
|
32
|
+
className={cn("font-heading text-xl font-bold tracking-[-0.02em] uppercase", className)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function AlertDialogDescription({ className, ...props }: AlertDialogPrimitive.Description.Props) {
|
|
39
|
+
return (
|
|
40
|
+
<AlertDialogPrimitive.Description
|
|
41
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function AlertDialogFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
48
|
+
return <div className={cn("mt-2 flex justify-end gap-2", className)} {...props} />
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
AlertDialog,
|
|
53
|
+
AlertDialogClose,
|
|
54
|
+
AlertDialogContent,
|
|
55
|
+
AlertDialogDescription,
|
|
56
|
+
AlertDialogFooter,
|
|
57
|
+
AlertDialogTitle,
|
|
58
|
+
AlertDialogTrigger,
|
|
59
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar"
|
|
2
|
+
import { cn } from "cn"
|
|
3
|
+
|
|
4
|
+
function Avatar({ className, ...props }: AvatarPrimitive.Root.Props) {
|
|
5
|
+
return (
|
|
6
|
+
<AvatarPrimitive.Root
|
|
7
|
+
data-slot="avatar"
|
|
8
|
+
className={cn(
|
|
9
|
+
"inline-flex size-8 shrink-0 items-center justify-center overflow-hidden bg-foreground text-xs font-semibold text-background select-none",
|
|
10
|
+
className,
|
|
11
|
+
)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props) {
|
|
18
|
+
return <AvatarPrimitive.Image className={cn("size-full object-cover", className)} {...props} />
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function AvatarFallback(props: AvatarPrimitive.Fallback.Props) {
|
|
22
|
+
return <AvatarPrimitive.Fallback {...props} />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { Avatar, AvatarFallback, AvatarImage }
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
2
|
+
import { cn } from "cn"
|
|
3
|
+
import type * as React from "react"
|
|
4
|
+
|
|
5
|
+
const badgeVariants = cva(
|
|
6
|
+
"inline-flex h-6 shrink-0 items-center gap-1 px-2 text-[13px] leading-none font-medium whitespace-nowrap",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
outline: "border border-foreground/80 text-foreground",
|
|
11
|
+
solid: "bg-foreground text-background",
|
|
12
|
+
primary: "bg-primary text-primary-foreground",
|
|
13
|
+
muted: "border border-border text-muted-foreground",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
variant: "outline",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
function Badge({
|
|
23
|
+
className,
|
|
24
|
+
variant,
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants>) {
|
|
27
|
+
return <span data-slot="badge" className={cn(badgeVariants({ variant }), className)} {...props} />
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { Badge, badgeVariants }
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
import { cn } from "cn"
|
|
4
|
+
|
|
5
|
+
const buttonVariants = cva(
|
|
6
|
+
"group/button inline-flex shrink-0 items-center justify-center 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/30 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",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/85",
|
|
11
|
+
inverted: "bg-foreground text-background hover:bg-foreground/85",
|
|
12
|
+
outline:
|
|
13
|
+
"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-transparent dark:hover:bg-input/30",
|
|
14
|
+
secondary:
|
|
15
|
+
"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
16
|
+
ghost:
|
|
17
|
+
"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
18
|
+
destructive:
|
|
19
|
+
"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
20
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
default:
|
|
24
|
+
"h-8 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5",
|
|
25
|
+
xs: "h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3",
|
|
26
|
+
sm: "h-7 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
27
|
+
lg: "h-9 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
|
|
28
|
+
icon: "size-8",
|
|
29
|
+
"icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3",
|
|
30
|
+
"icon-sm": "size-7",
|
|
31
|
+
"icon-lg": "size-9",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
variant: "default",
|
|
36
|
+
size: "default",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
function Button({
|
|
42
|
+
className,
|
|
43
|
+
variant = "default",
|
|
44
|
+
size = "default",
|
|
45
|
+
...props
|
|
46
|
+
}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
|
|
47
|
+
return (
|
|
48
|
+
<ButtonPrimitive
|
|
49
|
+
data-slot="button"
|
|
50
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { Button, buttonVariants }
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog"
|
|
4
|
+
import { cn } from "cn"
|
|
5
|
+
|
|
6
|
+
const Dialog = DialogPrimitive.Root
|
|
7
|
+
const DialogTrigger = DialogPrimitive.Trigger
|
|
8
|
+
const DialogClose = DialogPrimitive.Close
|
|
9
|
+
|
|
10
|
+
function DialogContent({ className, children, ...props }: DialogPrimitive.Popup.Props) {
|
|
11
|
+
return (
|
|
12
|
+
<DialogPrimitive.Portal>
|
|
13
|
+
<DialogPrimitive.Backdrop className="fixed inset-0 z-50 bg-foreground/20 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0" />
|
|
14
|
+
<DialogPrimitive.Popup
|
|
15
|
+
className={cn(
|
|
16
|
+
"fixed top-1/2 left-1/2 z-50 flex w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 flex-col gap-4 border border-foreground bg-popover p-6 text-popover-foreground shadow-[8px_8px_0_0_var(--foreground)] outline-none transition-[scale,opacity] duration-150 data-ending-style:scale-[0.98] data-ending-style:opacity-0 data-starting-style:scale-[0.98] data-starting-style:opacity-0",
|
|
17
|
+
className,
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
>
|
|
21
|
+
{children}
|
|
22
|
+
</DialogPrimitive.Popup>
|
|
23
|
+
</DialogPrimitive.Portal>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
|
|
28
|
+
return (
|
|
29
|
+
<DialogPrimitive.Title
|
|
30
|
+
className={cn("font-heading text-xl font-bold tracking-[-0.02em] uppercase", className)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function DialogDescription({ className, ...props }: DialogPrimitive.Description.Props) {
|
|
37
|
+
return (
|
|
38
|
+
<DialogPrimitive.Description
|
|
39
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogTitle, DialogTrigger }
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Menu as MenuPrimitive } from "@base-ui/react/menu"
|
|
4
|
+
import { cn } from "cn"
|
|
5
|
+
import { CheckIcon } from "lucide-react"
|
|
6
|
+
import type * as React from "react"
|
|
7
|
+
|
|
8
|
+
const DropdownMenu = MenuPrimitive.Root
|
|
9
|
+
const DropdownMenuTrigger = MenuPrimitive.Trigger
|
|
10
|
+
const DropdownMenuGroup = MenuPrimitive.Group
|
|
11
|
+
|
|
12
|
+
function DropdownMenuContent({
|
|
13
|
+
className,
|
|
14
|
+
align = "start",
|
|
15
|
+
sideOffset = 6,
|
|
16
|
+
side,
|
|
17
|
+
...props
|
|
18
|
+
}: MenuPrimitive.Popup.Props &
|
|
19
|
+
Pick<MenuPrimitive.Positioner.Props, "align" | "sideOffset" | "side">) {
|
|
20
|
+
return (
|
|
21
|
+
<MenuPrimitive.Portal>
|
|
22
|
+
<MenuPrimitive.Positioner className="z-50" align={align} side={side} sideOffset={sideOffset}>
|
|
23
|
+
<MenuPrimitive.Popup
|
|
24
|
+
data-slot="dropdown-menu-content"
|
|
25
|
+
className={cn(
|
|
26
|
+
"min-w-48 py-1 border border-foreground bg-popover text-popover-foreground shadow-[4px_4px_0_0_var(--foreground)] outline-none origin-[var(--transform-origin)] transition-[scale,opacity] duration-100 data-starting-style:scale-[0.98] data-starting-style:opacity-0 data-ending-style:scale-[0.98] data-ending-style:opacity-0",
|
|
27
|
+
className,
|
|
28
|
+
)}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
</MenuPrimitive.Positioner>
|
|
32
|
+
</MenuPrimitive.Portal>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function DropdownMenuItem({
|
|
37
|
+
className,
|
|
38
|
+
variant = "default",
|
|
39
|
+
...props
|
|
40
|
+
}: MenuPrimitive.Item.Props & { variant?: "default" | "destructive" }) {
|
|
41
|
+
return (
|
|
42
|
+
<MenuPrimitive.Item
|
|
43
|
+
data-slot="dropdown-menu-item"
|
|
44
|
+
data-variant={variant}
|
|
45
|
+
className={cn(
|
|
46
|
+
"flex h-8 cursor-default items-center gap-2 px-3 text-sm outline-none select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-muted data-[variant=destructive]:text-destructive [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-muted-foreground",
|
|
47
|
+
className,
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function DropdownMenuCheckboxItem({
|
|
55
|
+
className,
|
|
56
|
+
children,
|
|
57
|
+
...props
|
|
58
|
+
}: MenuPrimitive.CheckboxItem.Props) {
|
|
59
|
+
return (
|
|
60
|
+
<MenuPrimitive.CheckboxItem
|
|
61
|
+
data-slot="dropdown-menu-checkbox-item"
|
|
62
|
+
className={cn(
|
|
63
|
+
"flex h-8 cursor-default items-center gap-2 pr-3 pl-2 text-sm outline-none select-none data-highlighted:bg-muted [&_svg]:size-4 [&_svg]:shrink-0",
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
66
|
+
{...props}
|
|
67
|
+
>
|
|
68
|
+
<span className="flex size-4 items-center justify-center border border-input in-data-checked:border-foreground in-data-checked:bg-foreground">
|
|
69
|
+
<MenuPrimitive.CheckboxItemIndicator className="text-background">
|
|
70
|
+
<CheckIcon className="size-3" strokeWidth={3} />
|
|
71
|
+
</MenuPrimitive.CheckboxItemIndicator>
|
|
72
|
+
</span>
|
|
73
|
+
{children}
|
|
74
|
+
</MenuPrimitive.CheckboxItem>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const DropdownMenuRadioGroup = MenuPrimitive.RadioGroup
|
|
79
|
+
|
|
80
|
+
function DropdownMenuRadioItem({ className, children, ...props }: MenuPrimitive.RadioItem.Props) {
|
|
81
|
+
return (
|
|
82
|
+
<MenuPrimitive.RadioItem
|
|
83
|
+
data-slot="dropdown-menu-radio-item"
|
|
84
|
+
className={cn(
|
|
85
|
+
"grid h-8 cursor-default grid-cols-[1fr_1rem] items-center gap-2 px-3 text-sm outline-none select-none data-highlighted:bg-muted",
|
|
86
|
+
className,
|
|
87
|
+
)}
|
|
88
|
+
{...props}
|
|
89
|
+
>
|
|
90
|
+
<span>{children}</span>
|
|
91
|
+
<MenuPrimitive.RadioItemIndicator>
|
|
92
|
+
<CheckIcon className="size-4" />
|
|
93
|
+
</MenuPrimitive.RadioItemIndicator>
|
|
94
|
+
</MenuPrimitive.RadioItem>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// A plain heading row. Use MenuPrimitive.GroupLabel inside a DropdownMenuGroup for labelled groups.
|
|
99
|
+
function DropdownMenuLabel({ className, ...props }: React.ComponentProps<"div">) {
|
|
100
|
+
return <div className={cn("px-3 py-1.5 text-xs text-muted-foreground", className)} {...props} />
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function DropdownMenuSeparator({ className, ...props }: MenuPrimitive.Separator.Props) {
|
|
104
|
+
return <MenuPrimitive.Separator className={cn("my-1 h-px bg-border", className)} {...props} />
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
DropdownMenu,
|
|
109
|
+
DropdownMenuCheckboxItem,
|
|
110
|
+
DropdownMenuContent,
|
|
111
|
+
DropdownMenuGroup,
|
|
112
|
+
DropdownMenuItem,
|
|
113
|
+
DropdownMenuLabel,
|
|
114
|
+
DropdownMenuRadioGroup,
|
|
115
|
+
DropdownMenuRadioItem,
|
|
116
|
+
DropdownMenuSeparator,
|
|
117
|
+
DropdownMenuTrigger,
|
|
118
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Input as InputPrimitive } from "@base-ui/react/input"
|
|
2
|
+
import { cn } from "cn"
|
|
3
|
+
|
|
4
|
+
function Input({ className, ...props }: InputPrimitive.Props) {
|
|
5
|
+
return (
|
|
6
|
+
<InputPrimitive
|
|
7
|
+
data-slot="input"
|
|
8
|
+
className={cn(
|
|
9
|
+
"h-10 w-full min-w-0 border border-input bg-background px-3 text-sm text-foreground outline-none transition-colors placeholder:text-muted-foreground focus-visible:border-2 focus-visible:border-primary focus-visible:px-[11px] disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive",
|
|
10
|
+
className,
|
|
11
|
+
)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Input }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cn } from "cn"
|
|
2
|
+
import type * as React from "react"
|
|
3
|
+
|
|
4
|
+
function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
|
|
5
|
+
return (
|
|
6
|
+
<kbd
|
|
7
|
+
data-slot="kbd"
|
|
8
|
+
className={cn(
|
|
9
|
+
"inline-flex h-5 min-w-5 items-center justify-center gap-0.5 bg-muted px-1 font-mono text-[11px] text-muted-foreground in-data-[slot=button]:bg-white/15 in-data-[slot=button]:text-current",
|
|
10
|
+
className,
|
|
11
|
+
)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Kbd }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cn } from "cn"
|
|
2
|
+
import type * as React from "react"
|
|
3
|
+
|
|
4
|
+
function Label({ className, ...props }: React.ComponentProps<"label">) {
|
|
5
|
+
return (
|
|
6
|
+
// biome-ignore lint/a11y/noLabelWithoutControl: consumers pass htmlFor or nest the control
|
|
7
|
+
<label
|
|
8
|
+
data-slot="label"
|
|
9
|
+
className={cn("text-[13px] leading-[18px] font-medium text-foreground", className)}
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { Label }
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { cn } from "@sniptide/ui/lib/utils"
|
|
2
|
+
|
|
3
|
+
// Sniptide mark from the Paper brand page. Fills follow the theme so it works in dark mode.
|
|
4
|
+
export function LogoMark({ className }: { className?: string }) {
|
|
5
|
+
return (
|
|
6
|
+
<svg
|
|
7
|
+
viewBox="0 0 160 160"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
aria-hidden="true"
|
|
10
|
+
className={cn("size-7 shrink-0", className)}
|
|
11
|
+
>
|
|
12
|
+
<g className="fill-foreground">
|
|
13
|
+
<rect x="0" y="0" width="80" height="32" />
|
|
14
|
+
<rect x="43.6" y="96" width="80" height="32" />
|
|
15
|
+
<rect x="123.6" y="128" width="36.4" height="32" />
|
|
16
|
+
<rect x="0" y="64" width="4" height="64" />
|
|
17
|
+
<rect x="6" y="64" width="3" height="64" />
|
|
18
|
+
<rect x="10" y="64" width="2" height="64" />
|
|
19
|
+
<rect x="43.6" y="32" width="4" height="64" />
|
|
20
|
+
<rect x="49" y="32" width="3" height="64" />
|
|
21
|
+
<rect x="53" y="32" width="2" height="64" />
|
|
22
|
+
<rect x="156" y="32" width="4" height="32" />
|
|
23
|
+
<rect x="151" y="32" width="3" height="32" />
|
|
24
|
+
<rect x="156" y="96" width="4" height="32" />
|
|
25
|
+
<rect x="151" y="96" width="3" height="32" />
|
|
26
|
+
<rect x="80" y="156" width="43.6" height="4" />
|
|
27
|
+
<rect x="80" y="151" width="43.6" height="3" />
|
|
28
|
+
</g>
|
|
29
|
+
<g className="fill-primary">
|
|
30
|
+
<rect x="80" y="0" width="80" height="32" />
|
|
31
|
+
<rect x="0" y="32" width="36.4" height="32" />
|
|
32
|
+
<rect x="80" y="64" width="80" height="32" />
|
|
33
|
+
<rect x="0" y="128" width="80" height="32" />
|
|
34
|
+
</g>
|
|
35
|
+
</svg>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function Logo({ className }: { className?: string }) {
|
|
40
|
+
return (
|
|
41
|
+
<span className={cn("flex items-center gap-2.5", className)}>
|
|
42
|
+
<LogoMark />
|
|
43
|
+
<span className="font-heading text-[25px] leading-7 font-bold tracking-[-0.01em]">
|
|
44
|
+
SNIPTIDE
|
|
45
|
+
</span>
|
|
46
|
+
</span>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Progress as ProgressPrimitive } from "@base-ui/react/progress"
|
|
2
|
+
import { cn } from "cn"
|
|
3
|
+
|
|
4
|
+
function Progress({ className, ...props }: ProgressPrimitive.Root.Props) {
|
|
5
|
+
return (
|
|
6
|
+
<ProgressPrimitive.Root data-slot="progress" className={cn("w-full", className)} {...props}>
|
|
7
|
+
<ProgressPrimitive.Track className="block h-1 w-full overflow-hidden bg-border">
|
|
8
|
+
<ProgressPrimitive.Indicator className="block h-full bg-primary transition-[width]" />
|
|
9
|
+
</ProgressPrimitive.Track>
|
|
10
|
+
</ProgressPrimitive.Root>
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { Progress }
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Radio } from "@base-ui/react/radio"
|
|
4
|
+
import { RadioGroup } from "@base-ui/react/radio-group"
|
|
5
|
+
import { cn } from "cn"
|
|
6
|
+
|
|
7
|
+
// Single-choice control from the Paper designs (Visibility: Private / Unlisted / Public).
|
|
8
|
+
// A radio group underneath, so arrow keys move between options.
|
|
9
|
+
function SegmentedControl<Value extends string>({
|
|
10
|
+
value,
|
|
11
|
+
onValueChange,
|
|
12
|
+
options,
|
|
13
|
+
className,
|
|
14
|
+
itemClassName,
|
|
15
|
+
...props
|
|
16
|
+
}: {
|
|
17
|
+
value: Value
|
|
18
|
+
onValueChange: (value: Value) => void
|
|
19
|
+
options: { value: Value; label: React.ReactNode }[]
|
|
20
|
+
className?: string
|
|
21
|
+
itemClassName?: string
|
|
22
|
+
"aria-label"?: string
|
|
23
|
+
"aria-labelledby"?: string
|
|
24
|
+
disabled?: boolean
|
|
25
|
+
}) {
|
|
26
|
+
return (
|
|
27
|
+
<RadioGroup
|
|
28
|
+
value={value}
|
|
29
|
+
onValueChange={(next) => onValueChange(next as Value)}
|
|
30
|
+
className={cn("flex gap-0.5 bg-muted p-[3px]", className)}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
{options.map((option) => (
|
|
34
|
+
<Radio.Root
|
|
35
|
+
key={option.value}
|
|
36
|
+
value={option.value}
|
|
37
|
+
className={cn(
|
|
38
|
+
"flex-1 py-[5px] text-center text-[13px] leading-[18px] text-muted-foreground outline-none select-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40 data-checked:bg-background data-checked:font-medium data-checked:text-foreground data-checked:shadow-[0_1px_2px_rgb(0_0_0/0.08)] data-disabled:opacity-50",
|
|
39
|
+
itemClassName,
|
|
40
|
+
)}
|
|
41
|
+
>
|
|
42
|
+
{option.label}
|
|
43
|
+
</Radio.Root>
|
|
44
|
+
))}
|
|
45
|
+
</RadioGroup>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { SegmentedControl }
|