@sniptide/ui 0.1.1 → 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.
Files changed (38) hide show
  1. package/README.md +26 -7
  2. package/package.json +13 -31
  3. package/src/components/alert-dialog.tsx +3 -3
  4. package/src/components/avatar.tsx +1 -1
  5. package/src/components/badge.tsx +1 -1
  6. package/src/components/button.tsx +72 -13
  7. package/src/components/checkbox.tsx +24 -0
  8. package/src/components/combobox.tsx +127 -0
  9. package/src/components/dialog.tsx +3 -3
  10. package/src/components/dropdown-menu.tsx +35 -8
  11. package/src/components/form-error.tsx +33 -0
  12. package/src/components/input.tsx +1 -1
  13. package/src/components/kbd.tsx +1 -1
  14. package/src/components/logo.tsx +173 -31
  15. package/src/components/popover.tsx +40 -0
  16. package/src/components/progress.tsx +1 -1
  17. package/src/components/reveal.tsx +51 -0
  18. package/src/components/segmented-control.tsx +2 -2
  19. package/src/components/select.tsx +3 -3
  20. package/src/components/sheet.tsx +60 -4
  21. package/src/components/skeleton.tsx +15 -0
  22. package/src/components/spinner.tsx +33 -0
  23. package/src/components/step-slider.tsx +83 -0
  24. package/src/components/stripes.tsx +22 -12
  25. package/src/components/success-check.tsx +27 -0
  26. package/src/components/switch.tsx +2 -2
  27. package/src/components/table.tsx +124 -7
  28. package/src/components/tabs.tsx +1 -1
  29. package/src/components/textarea.tsx +1 -1
  30. package/src/components/toast.tsx +140 -0
  31. package/src/components/tooltip.tsx +1 -1
  32. package/src/fonts/OFL.txt +93 -0
  33. package/src/fonts/PaperMono-Regular.ttf +0 -0
  34. package/src/fonts/PaperMono[wght].ttf +0 -0
  35. package/src/lib/confetti.ts +112 -0
  36. package/src/lib/logo-paths.ts +17 -0
  37. package/src/styles/globals.css +121 -20
  38. package/src/styles/shadcn.css +677 -0
package/README.md CHANGED
@@ -29,20 +29,39 @@ import { Logo } from "@sniptide/ui/components/logo"
29
29
  ```
30
30
 
31
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).
32
+ `--font-sans` (Inter), `--font-mono` (Paper Mono) and `--font-heading` (Archivo).
33
+ The Paper Mono fonts in `src/fonts` come from the
34
+ [v1.000 release](https://github.com/paper-design/paper-mono/releases/tag/v1.000). The included
35
+ `OFL.txt` contains their SIL Open Font License 1.1.
36
+ The logo uses vector outlines and does not need a font.
33
37
 
34
38
  `globals.css` already tells Tailwind to scan this package's components; your own files are found
35
39
  by Tailwind's automatic source detection.
36
40
 
41
+ ## Feedback states
42
+
43
+ Every async action ends in the same three states, built from these pieces:
44
+
45
+ - **Loading:** `<Button loading={pending}>` shows a `Spinner` in place of the button's icon, ignores
46
+ clicks and sets `aria-busy`. Use `Skeleton` for content that is still on its way.
47
+ - **Success:** `SuccessCheck` is a check that draws itself in (a copy button swaps its icon for it).
48
+ Actions without a button of their own, like menu items, call `toast.success(...)`. Mount
49
+ `<Toaster />` once in the root layout.
50
+ - **Error:** `FormError` for a failure next to the thing that failed (`banner` on top of a form,
51
+ `inline` under a field), `toast.error(...)` for actions with no place for a message.
52
+
53
+ Spinners fall back to a slow pulse and the check and skeletons stop animating when the visitor
54
+ prefers reduced motion.
55
+
37
56
  ## Releasing
38
57
 
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:
58
+ Merges to `main` automatically release this package after CI passes when its packed contents
59
+ change. Conventional Commits choose the version bump. The workflow verifies the package in an
60
+ isolated consumer, then publishes through npm Trusted Publishing with provenance.
41
61
 
42
- ```bash
43
- npm stage list @sniptide/ui
44
- npm stage approve <stage-id>
45
- ```
62
+ The source package version is a development default; npm records the released version. No manual
63
+ version bump or stage approval is needed. See [automatic npm releases](../../docs/npm-publishing.md)
64
+ for one-time owner configuration and retries.
46
65
 
47
66
  ## License
48
67
 
package/package.json CHANGED
@@ -1,16 +1,25 @@
1
1
  {
2
2
  "name": "@sniptide/ui",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
+ "gitHead": "509688aa4d3fceec3896a69503086ce183fe8286",
4
5
  "description": "Sniptide's shared React components and Tailwind theme, used by the app and the website.",
5
6
  "license": "AGPL-3.0-only",
6
7
  "type": "module",
7
8
  "repository": {
8
9
  "type": "git",
9
- "url": "git+https://github.com/Dino-Kupinic/sniptide.git",
10
+ "url": "https://github.com/Dino-Kupinic/sniptide.git",
10
11
  "directory": "packages/ui"
11
12
  },
12
- "publishConfig": {
13
- "access": "public"
13
+ "peerDependencies": {
14
+ "react": "^19.2.0",
15
+ "react-dom": "^19.2.0"
16
+ },
17
+ "exports": {
18
+ "./globals.css": "./src/styles/globals.css",
19
+ "./postcss.config": "./postcss.config.mjs",
20
+ "./lib/*": "./src/lib/*.ts",
21
+ "./components/*": "./src/components/*.tsx",
22
+ "./hooks/*": "./src/hooks/*.ts"
14
23
  },
15
24
  "files": [
16
25
  "src",
@@ -18,40 +27,13 @@
18
27
  "README.md",
19
28
  "LICENSE"
20
29
  ],
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
30
  "dependencies": {
31
31
  "@base-ui/react": "^1.8.0",
32
32
  "@tailwindcss/postcss": "^4",
33
33
  "class-variance-authority": "^0.7.1",
34
34
  "cn": "^0.2.6",
35
35
  "lucide-react": "^1.43.0",
36
- "shadcn": "^4.21.0",
37
36
  "tailwindcss": "^4",
38
37
  "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
38
  }
57
39
  }
@@ -12,10 +12,10 @@ const AlertDialogClose = AlertDialogPrimitive.Close
12
12
  function AlertDialogContent({ className, children, ...props }: AlertDialogPrimitive.Popup.Props) {
13
13
  return (
14
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" />
15
+ <AlertDialogPrimitive.Backdrop className="fixed inset-0 z-50 bg-foreground/20 transition-opacity dark:bg-black/60 duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0" />
16
16
  <AlertDialogPrimitive.Popup
17
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",
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 overflow-hidden rounded-lg border border-border bg-popover p-6 text-popover-foreground shadow-(--dialog-shadow) 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
19
  className,
20
20
  )}
21
21
  {...props}
@@ -29,7 +29,7 @@ function AlertDialogContent({ className, children, ...props }: AlertDialogPrimit
29
29
  function AlertDialogTitle({ className, ...props }: AlertDialogPrimitive.Title.Props) {
30
30
  return (
31
31
  <AlertDialogPrimitive.Title
32
- className={cn("font-heading text-xl font-bold tracking-[-0.02em] uppercase", className)}
32
+ className={cn("font-heading text-xl font-bold tracking-[-0.02em]", className)}
33
33
  {...props}
34
34
  />
35
35
  )
@@ -6,7 +6,7 @@ function Avatar({ className, ...props }: AvatarPrimitive.Root.Props) {
6
6
  <AvatarPrimitive.Root
7
7
  data-slot="avatar"
8
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",
9
+ "rounded-md inline-flex size-8 shrink-0 items-center justify-center overflow-hidden bg-foreground text-xs font-semibold text-background select-none",
10
10
  className,
11
11
  )}
12
12
  {...props}
@@ -3,7 +3,7 @@ import { cn } from "cn"
3
3
  import type * as React from "react"
4
4
 
5
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",
6
+ "inline-flex h-6 shrink-0 rounded-md items-center gap-1 px-2 text-[13px] leading-none font-medium whitespace-nowrap",
7
7
  {
8
8
  variants: {
9
9
  variant: {
@@ -1,23 +1,55 @@
1
1
  import { Button as ButtonPrimitive } from "@base-ui/react/button"
2
+ import { Spinner } from "@sniptide/ui/components/spinner"
2
3
  import { cva, type VariantProps } from "class-variance-authority"
3
4
  import { cn } from "cn"
4
5
 
6
+ // Raised variants sit on a 2px edge in a darker shade (--depth) and are 2px shorter, so face
7
+ // and edge together are as tall as the size. Hover lifts the face 1px and a
8
+ // press pushes it down onto the edge. Popup triggers skip the press so their menu doesn't jump.
9
+ // The press lands in 60ms so even a quick click shows it, and the release springs back with a
10
+ // slight overshoot. Under reduced motion the states switch without moving. A disabled button sits
11
+ // down on its edge, so a greyed face never rests on a coloured edge.
12
+ const raised =
13
+ "duration-200 ease-[cubic-bezier(0.34,1.56,0.64,1)] active:duration-[60ms] active:ease-out motion-reduce:transition-colors shadow-[0_2px_0_0_var(--depth)] not-disabled:hover:-translate-y-px not-disabled:hover:shadow-[0_3px_0_0_var(--depth)] not-aria-[haspopup]:active:translate-y-[2px] not-aria-[haspopup]:active:shadow-none aria-expanded:translate-y-0 aria-expanded:shadow-[0_2px_0_0_var(--depth)] disabled:translate-y-[2px] disabled:shadow-none"
14
+ const flat = "active:not-aria-[haspopup]:translate-y-px"
15
+ const raisedVariants: ("default" | "inverted" | "outline" | "secondary" | "destructive")[] = [
16
+ "default",
17
+ "inverted",
18
+ "outline",
19
+ "secondary",
20
+ "destructive",
21
+ ]
22
+
5
23
  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",
24
+ "group/button inline-flex shrink-0 items-center rounded-lg justify-center border border-transparent 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 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 data-loading:[&_svg:not([data-slot=spinner])]:hidden",
7
25
  {
8
26
  variants: {
9
27
  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:
28
+ default: [
29
+ raised,
30
+ "bg-primary text-primary-foreground [--depth:color-mix(in_oklch,var(--primary),black_38%)] hover:bg-[color-mix(in_oklch,var(--primary),white_8%)]",
31
+ ],
32
+ inverted: [
33
+ raised,
34
+ "bg-foreground text-background [--depth:color-mix(in_oklch,var(--foreground),var(--background)_55%)] dark:[--depth:color-mix(in_oklch,var(--foreground),black_45%)] hover:bg-foreground/90",
35
+ ],
36
+ outline: [
37
+ raised,
38
+ "border-border bg-background [--depth:var(--border)] dark:[--depth:color-mix(in_oklch,var(--border),var(--foreground)_22%)] hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-card dark:hover:bg-muted",
39
+ ],
40
+ secondary: [
41
+ raised,
42
+ "bg-secondary [--depth:color-mix(in_oklch,var(--secondary),var(--foreground)_14%)] text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
43
+ ],
44
+ ghost: [
45
+ flat,
17
46
  "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",
47
+ ],
48
+ destructive: [
49
+ raised,
50
+ "bg-destructive/10 [--depth:color-mix(in_oklch,var(--destructive)_30%,transparent)] 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",
51
+ ],
52
+ link: [flat, "text-link underline-offset-4 hover:underline"],
21
53
  },
22
54
  size: {
23
55
  default:
@@ -25,12 +57,26 @@ const buttonVariants = cva(
25
57
  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
58
  sm: "h-7 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
27
59
  lg: "h-9 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
60
+ // Touch size for the primary action in mobile bars and sheets.
61
+ xl: "h-10 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
28
62
  icon: "size-8",
29
63
  "icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3",
30
64
  "icon-sm": "size-7",
31
65
  "icon-lg": "size-9",
32
66
  },
33
67
  },
68
+ // Raised variants are 2px shorter than their size, so face and edge together fill it.
69
+ compoundVariants: [
70
+ { variant: raisedVariants, size: "default", className: "h-[30px]" },
71
+ { variant: raisedVariants, size: "xs", className: "h-[22px]" },
72
+ { variant: raisedVariants, size: "sm", className: "h-[26px]" },
73
+ { variant: raisedVariants, size: "lg", className: "h-[34px]" },
74
+ { variant: raisedVariants, size: "xl", className: "h-[38px]" },
75
+ { variant: raisedVariants, size: "icon", className: "h-[30px] w-8" },
76
+ { variant: raisedVariants, size: "icon-xs", className: "h-[22px] w-6" },
77
+ { variant: raisedVariants, size: "icon-sm", className: "h-[26px] w-7" },
78
+ { variant: raisedVariants, size: "icon-lg", className: "h-[34px] w-9" },
79
+ ],
34
80
  defaultVariants: {
35
81
  variant: "default",
36
82
  size: "default",
@@ -38,18 +84,31 @@ const buttonVariants = cva(
38
84
  },
39
85
  )
40
86
 
87
+ // `loading` is the shared in-flight state: a spinner stands in for the button's icon, the button
88
+ // stays focused and ignores clicks, and screen readers hear aria-busy. Keep the label as it is, or
89
+ // swap it for a "Saving…" style one.
41
90
  function Button({
42
91
  className,
43
92
  variant = "default",
44
93
  size = "default",
94
+ loading = false,
95
+ disabled,
96
+ children,
45
97
  ...props
46
- }: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
98
+ }: ButtonPrimitive.Props & VariantProps<typeof buttonVariants> & { loading?: boolean }) {
47
99
  return (
48
100
  <ButtonPrimitive
49
101
  data-slot="button"
102
+ data-loading={loading ? "" : undefined}
103
+ aria-busy={loading || undefined}
104
+ disabled={disabled || loading}
105
+ focusableWhenDisabled={loading}
50
106
  className={cn(buttonVariants({ variant, size, className }))}
51
107
  {...props}
52
- />
108
+ >
109
+ {loading ? <Spinner /> : null}
110
+ {children}
111
+ </ButtonPrimitive>
53
112
  )
54
113
  }
55
114
 
@@ -0,0 +1,24 @@
1
+ "use client"
2
+
3
+ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox"
4
+ import { cn } from "cn"
5
+ import { CheckIcon } from "lucide-react"
6
+
7
+ function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
8
+ return (
9
+ <CheckboxPrimitive.Root
10
+ data-slot="checkbox"
11
+ className={cn(
12
+ "flex size-4 shrink-0 items-center justify-center rounded-sm border border-input bg-background text-primary-foreground outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/30 data-checked:border-primary data-checked:bg-primary data-disabled:border-border data-disabled:bg-muted",
13
+ className,
14
+ )}
15
+ {...props}
16
+ >
17
+ <CheckboxPrimitive.Indicator className="flex items-center justify-center">
18
+ <CheckIcon className="size-3" strokeWidth={3} />
19
+ </CheckboxPrimitive.Indicator>
20
+ </CheckboxPrimitive.Root>
21
+ )
22
+ }
23
+
24
+ export { Checkbox }
@@ -0,0 +1,127 @@
1
+ "use client"
2
+
3
+ import { Combobox as ComboboxPrimitive } from "@base-ui/react/combobox"
4
+ import { cn } from "cn"
5
+ import { CheckIcon, SearchIcon } from "lucide-react"
6
+ import type * as React from "react"
7
+
8
+ // A searchable menu: a trigger opens a popup with a search field above a filtered list. Built on
9
+ // Base UI's Combobox with the input inside the popup, and styled like DropdownMenu.
10
+
11
+ const Combobox = ComboboxPrimitive.Root
12
+ const ComboboxTrigger = ComboboxPrimitive.Trigger
13
+ const ComboboxCollection = ComboboxPrimitive.Collection
14
+
15
+ function ComboboxContent({
16
+ className,
17
+ align = "start",
18
+ sideOffset = 6,
19
+ side,
20
+ ...props
21
+ }: ComboboxPrimitive.Popup.Props &
22
+ Pick<ComboboxPrimitive.Positioner.Props, "align" | "sideOffset" | "side">) {
23
+ return (
24
+ <ComboboxPrimitive.Portal>
25
+ <ComboboxPrimitive.Positioner
26
+ className="z-50"
27
+ align={align}
28
+ side={side}
29
+ sideOffset={sideOffset}
30
+ >
31
+ <ComboboxPrimitive.Popup
32
+ data-slot="combobox-content"
33
+ className={cn(
34
+ "flex w-60 max-w-(--available-width) flex-col overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-(--float-shadow) outline-none origin-(--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",
35
+ className,
36
+ )}
37
+ {...props}
38
+ />
39
+ </ComboboxPrimitive.Positioner>
40
+ </ComboboxPrimitive.Portal>
41
+ )
42
+ }
43
+
44
+ // The search field, set on a hairline above the list.
45
+ function ComboboxSearch({ className, ...props }: ComboboxPrimitive.Input.Props) {
46
+ return (
47
+ <div className="flex h-10 shrink-0 items-center gap-2 border-b border-border px-3">
48
+ <SearchIcon aria-hidden="true" className="size-4 shrink-0 text-muted-foreground" />
49
+ <ComboboxPrimitive.Input
50
+ data-slot="combobox-search"
51
+ className={cn(
52
+ "h-full min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground any-pointer-coarse:text-base",
53
+ className,
54
+ )}
55
+ {...props}
56
+ />
57
+ </div>
58
+ )
59
+ }
60
+
61
+ function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {
62
+ return (
63
+ <ComboboxPrimitive.Empty
64
+ className={cn("px-3 py-4 text-sm text-muted-foreground empty:hidden", className)}
65
+ {...props}
66
+ />
67
+ )
68
+ }
69
+
70
+ function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {
71
+ return (
72
+ <ComboboxPrimitive.List
73
+ data-slot="combobox-list"
74
+ className={cn(
75
+ "scrollbar-subtle max-h-[min(20rem,calc(var(--available-height)-2.5rem))] overflow-y-auto overscroll-contain p-1 scroll-py-1 outline-none data-empty:hidden",
76
+ className,
77
+ )}
78
+ {...props}
79
+ />
80
+ )
81
+ }
82
+
83
+ // A group of items. Groups after the first sit below a hairline, which only shows while both
84
+ // groups have matches.
85
+ function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {
86
+ return (
87
+ <ComboboxPrimitive.Group
88
+ data-slot="combobox-group"
89
+ className={cn("block [&+&]:mt-1 [&+&]:border-t [&+&]:border-border [&+&]:pt-1", className)}
90
+ {...props}
91
+ />
92
+ )
93
+ }
94
+
95
+ function ComboboxItem({
96
+ className,
97
+ children,
98
+ ...props
99
+ }: ComboboxPrimitive.Item.Props & { children?: React.ReactNode }) {
100
+ return (
101
+ <ComboboxPrimitive.Item
102
+ data-slot="combobox-item"
103
+ className={cn(
104
+ "flex h-8 cursor-default items-center gap-2 rounded-md px-3 text-sm outline-none select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-muted",
105
+ className,
106
+ )}
107
+ {...props}
108
+ >
109
+ {children}
110
+ <ComboboxPrimitive.ItemIndicator className="ml-auto">
111
+ <CheckIcon className="size-4 text-muted-foreground" />
112
+ </ComboboxPrimitive.ItemIndicator>
113
+ </ComboboxPrimitive.Item>
114
+ )
115
+ }
116
+
117
+ export {
118
+ Combobox,
119
+ ComboboxCollection,
120
+ ComboboxContent,
121
+ ComboboxEmpty,
122
+ ComboboxGroup,
123
+ ComboboxItem,
124
+ ComboboxList,
125
+ ComboboxSearch,
126
+ ComboboxTrigger,
127
+ }
@@ -10,10 +10,10 @@ const DialogClose = DialogPrimitive.Close
10
10
  function DialogContent({ className, children, ...props }: DialogPrimitive.Popup.Props) {
11
11
  return (
12
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" />
13
+ <DialogPrimitive.Backdrop className="fixed inset-0 z-50 bg-foreground/20 transition-opacity dark:bg-black/60 duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0" />
14
14
  <DialogPrimitive.Popup
15
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",
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 overflow-hidden rounded-lg border border-border bg-popover p-6 text-popover-foreground shadow-(--dialog-shadow) 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
17
  className,
18
18
  )}
19
19
  {...props}
@@ -27,7 +27,7 @@ function DialogContent({ className, children, ...props }: DialogPrimitive.Popup.
27
27
  function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
28
28
  return (
29
29
  <DialogPrimitive.Title
30
- className={cn("font-heading text-xl font-bold tracking-[-0.02em] uppercase", className)}
30
+ className={cn("font-heading text-xl font-bold tracking-[-0.02em]", className)}
31
31
  {...props}
32
32
  />
33
33
  )
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Menu as MenuPrimitive } from "@base-ui/react/menu"
4
4
  import { cn } from "cn"
5
- import { CheckIcon } from "lucide-react"
5
+ import { CheckIcon, ChevronRightIcon } from "lucide-react"
6
6
  import type * as React from "react"
7
7
 
8
8
  const DropdownMenu = MenuPrimitive.Root
@@ -23,7 +23,7 @@ function DropdownMenuContent({
23
23
  <MenuPrimitive.Popup
24
24
  data-slot="dropdown-menu-content"
25
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",
26
+ "min-w-48 rounded-lg p-1 border border-border bg-popover text-popover-foreground shadow-(--float-shadow) 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
27
  className,
28
28
  )}
29
29
  {...props}
@@ -43,7 +43,7 @@ function DropdownMenuItem({
43
43
  data-slot="dropdown-menu-item"
44
44
  data-variant={variant}
45
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",
46
+ "flex h-8 cursor-default items-center gap-2 rounded-md 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
47
  className,
48
48
  )}
49
49
  {...props}
@@ -60,12 +60,12 @@ function DropdownMenuCheckboxItem({
60
60
  <MenuPrimitive.CheckboxItem
61
61
  data-slot="dropdown-menu-checkbox-item"
62
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",
63
+ "flex h-8 cursor-default items-center gap-2 rounded-md pr-3 pl-2 text-sm outline-none select-none data-highlighted:bg-muted [&_svg]:size-4 [&_svg]:shrink-0",
64
64
  className,
65
65
  )}
66
66
  {...props}
67
67
  >
68
- <span className="flex size-4 items-center justify-center border border-input in-data-checked:border-foreground in-data-checked:bg-foreground">
68
+ <span className="flex size-4 items-center justify-center rounded-sm border border-input in-data-checked:border-foreground in-data-checked:bg-foreground">
69
69
  <MenuPrimitive.CheckboxItemIndicator className="text-background">
70
70
  <CheckIcon className="size-3" strokeWidth={3} />
71
71
  </MenuPrimitive.CheckboxItemIndicator>
@@ -82,7 +82,7 @@ function DropdownMenuRadioItem({ className, children, ...props }: MenuPrimitive.
82
82
  <MenuPrimitive.RadioItem
83
83
  data-slot="dropdown-menu-radio-item"
84
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",
85
+ "grid h-8 cursor-default grid-cols-[1fr_1rem] items-center gap-2 rounded-md px-3 text-sm outline-none select-none data-highlighted:bg-muted",
86
86
  className,
87
87
  )}
88
88
  {...props}
@@ -97,11 +97,36 @@ function DropdownMenuRadioItem({ className, children, ...props }: MenuPrimitive.
97
97
 
98
98
  // A plain heading row. Use MenuPrimitive.GroupLabel inside a DropdownMenuGroup for labelled groups.
99
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} />
100
+ return <div className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)} {...props} />
101
+ }
102
+
103
+ // A nested menu: wrap a DropdownMenuSubTrigger and a DropdownMenuContent in DropdownMenuSub.
104
+ const DropdownMenuSub = MenuPrimitive.SubmenuRoot
105
+
106
+ function DropdownMenuSubTrigger({
107
+ className,
108
+ children,
109
+ ...props
110
+ }: MenuPrimitive.SubmenuTrigger.Props) {
111
+ return (
112
+ <MenuPrimitive.SubmenuTrigger
113
+ data-slot="dropdown-menu-sub-trigger"
114
+ className={cn(
115
+ "flex h-8 cursor-default items-center gap-2 rounded-md px-3 text-sm outline-none select-none data-highlighted:bg-muted data-popup-open:bg-muted [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-muted-foreground",
116
+ className,
117
+ )}
118
+ {...props}
119
+ >
120
+ {children}
121
+ <ChevronRightIcon className="ml-auto" />
122
+ </MenuPrimitive.SubmenuTrigger>
123
+ )
101
124
  }
102
125
 
103
126
  function DropdownMenuSeparator({ className, ...props }: MenuPrimitive.Separator.Props) {
104
- return <MenuPrimitive.Separator className={cn("my-1 h-px bg-border", className)} {...props} />
127
+ return (
128
+ <MenuPrimitive.Separator className={cn("-mx-1 my-1 h-px bg-border", className)} {...props} />
129
+ )
105
130
  }
106
131
 
107
132
  export {
@@ -114,5 +139,7 @@ export {
114
139
  DropdownMenuRadioGroup,
115
140
  DropdownMenuRadioItem,
116
141
  DropdownMenuSeparator,
142
+ DropdownMenuSub,
143
+ DropdownMenuSubTrigger,
117
144
  DropdownMenuTrigger,
118
145
  }
@@ -0,0 +1,33 @@
1
+ import { cn } from "cn"
2
+
3
+ // The one error message. `banner` is the boxed message at the top of a form or page, `inline` the
4
+ // plain line under a field or beside a button. Both are announced to screen readers when they appear.
5
+ function FormError({
6
+ message,
7
+ variant = "banner",
8
+ className,
9
+ ...props
10
+ }: Omit<React.ComponentProps<"p">, "children"> & {
11
+ message: string | null | undefined
12
+ variant?: "banner" | "inline"
13
+ }) {
14
+ if (!message) return null
15
+
16
+ return (
17
+ <p
18
+ data-slot="form-error"
19
+ role="alert"
20
+ className={cn(
21
+ variant === "banner"
22
+ ? "rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-[13px] text-destructive"
23
+ : "text-[13px] text-destructive",
24
+ className,
25
+ )}
26
+ {...props}
27
+ >
28
+ {message}
29
+ </p>
30
+ )
31
+ }
32
+
33
+ export { FormError }
@@ -6,7 +6,7 @@ function Input({ className, ...props }: InputPrimitive.Props) {
6
6
  <InputPrimitive
7
7
  data-slot="input"
8
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",
9
+ "h-10 w-full min-w-0 rounded-lg 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
10
  className,
11
11
  )}
12
12
  {...props}
@@ -6,7 +6,7 @@ function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
6
6
  <kbd
7
7
  data-slot="kbd"
8
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",
9
+ "inline-flex h-5 min-w-5 rounded-sm 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
10
  className,
11
11
  )}
12
12
  {...props}