@behavioral-agentic-design-system/core 0.27.0 → 0.29.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 (113) hide show
  1. package/package.json +5 -5
  2. package/scripts/a11y-lint.cjs +78 -9
  3. package/scripts/build-tokens.cjs +273 -15
  4. package/scripts/wcag-audit.cjs +37 -7
  5. package/src/api/layers/file.ts +1 -0
  6. package/src/app/font-ready.tsx +6 -5
  7. package/src/app/layout.tsx +54 -3
  8. package/src/app/preview/components/page.tsx +5735 -2500
  9. package/src/app/preview/layout.tsx +4 -1
  10. package/src/app/preview/showcase-filter.tsx +66 -0
  11. package/src/app/preview/tab-replay.tsx +63 -0
  12. package/src/app/shell.tsx +91 -18
  13. package/src/components/customize/save-bar.tsx +19 -6
  14. package/src/components/docs-tab.tsx +36 -24
  15. package/src/components/layers-tab.tsx +37 -5
  16. package/src/components/ui/ai-badge.tsx +74 -0
  17. package/src/components/ui/alert.tsx +12 -0
  18. package/src/components/ui/badge.tsx +19 -0
  19. package/src/components/ui/chat-bubble.tsx +298 -0
  20. package/src/components/ui/chat-marker.tsx +120 -0
  21. package/src/components/ui/checkbox.tsx +9 -1
  22. package/src/components/ui/clipboard.tsx +291 -0
  23. package/src/components/ui/close-button.tsx +71 -0
  24. package/src/components/ui/combobox.tsx +62 -3
  25. package/src/components/ui/container.tsx +65 -0
  26. package/src/components/ui/copy-button.tsx +5 -1
  27. package/src/components/ui/data-table.tsx +388 -0
  28. package/src/components/ui/date-field.tsx +368 -0
  29. package/src/components/ui/drawer.tsx +334 -0
  30. package/src/components/ui/file-button.tsx +145 -0
  31. package/src/components/ui/floating-indicator.tsx +217 -0
  32. package/src/components/ui/focus-trap.tsx +184 -0
  33. package/src/components/ui/format-byte.tsx +113 -0
  34. package/src/components/ui/index.ts +28 -0
  35. package/src/components/ui/input.tsx +38 -3
  36. package/src/components/ui/keyboard-shortcut.tsx +146 -0
  37. package/src/components/ui/loading-dots.tsx +99 -0
  38. package/src/components/ui/mark.tsx +69 -0
  39. package/src/components/ui/month-picker.tsx +296 -0
  40. package/src/components/ui/multi-select.tsx +15 -13
  41. package/src/components/ui/nav-link.tsx +200 -0
  42. package/src/components/ui/navigation-rail.tsx +256 -0
  43. package/src/components/ui/notification.tsx +20 -0
  44. package/src/components/ui/password-input.tsx +34 -1
  45. package/src/components/ui/progress.tsx +15 -1
  46. package/src/components/ui/prose.tsx +62 -0
  47. package/src/components/ui/result.tsx +151 -0
  48. package/src/components/ui/rolling-number.tsx +201 -0
  49. package/src/components/ui/simple-grid.tsx +110 -0
  50. package/src/components/ui/skeleton.tsx +52 -3
  51. package/src/components/ui/squircle.tsx +274 -0
  52. package/src/components/ui/stack.tsx +105 -0
  53. package/src/components/ui/status-badge.tsx +93 -0
  54. package/src/components/ui/tabs.tsx +34 -7
  55. package/src/components/ui/tag.tsx +46 -5
  56. package/src/components/ui/theme-icon.tsx +138 -0
  57. package/src/components/ui/timeline.tsx +27 -10
  58. package/src/components/ui/tooltip.tsx +12 -1
  59. package/src/components/ui/tree-select.tsx +386 -0
  60. package/src/components/ui/typing-indicator.tsx +2 -2
  61. package/src/components/ui/word-rotate.tsx +6 -1
  62. package/src/components/ui/year-picker.tsx +307 -0
  63. package/src/data/docs-index.ts +10 -0
  64. package/src/hooks/use-global-primary-color.ts +57 -6
  65. package/src/stories/AiBadge.stories.tsx +67 -0
  66. package/src/stories/Alert.stories.tsx +31 -1
  67. package/src/stories/Badge.stories.tsx +63 -6
  68. package/src/stories/ChatBubble.stories.tsx +222 -0
  69. package/src/stories/ChatMarker.stories.tsx +59 -0
  70. package/src/stories/Checkbox.stories.tsx +5 -0
  71. package/src/stories/Clipboard.stories.tsx +136 -0
  72. package/src/stories/CloseButton.stories.tsx +65 -0
  73. package/src/stories/Combobox.stories.tsx +74 -3
  74. package/src/stories/Container.stories.tsx +134 -0
  75. package/src/stories/CopyButton.stories.tsx +2 -0
  76. package/src/stories/DataTable.stories.tsx +271 -0
  77. package/src/stories/DateField.stories.tsx +114 -0
  78. package/src/stories/Drawer.stories.tsx +211 -0
  79. package/src/stories/FileButton.stories.tsx +117 -0
  80. package/src/stories/FloatingIndicator.stories.tsx +343 -0
  81. package/src/stories/FocusTrap.stories.tsx +218 -0
  82. package/src/stories/FormatByte.stories.tsx +142 -0
  83. package/src/stories/Input.stories.tsx +91 -0
  84. package/src/stories/KeyboardShortcut.stories.tsx +87 -0
  85. package/src/stories/LoadingDots.stories.tsx +73 -0
  86. package/src/stories/Mark.stories.tsx +84 -0
  87. package/src/stories/MonthPicker.stories.tsx +99 -0
  88. package/src/stories/MultiSelect.stories.tsx +3 -1
  89. package/src/stories/NavLink.stories.tsx +213 -0
  90. package/src/stories/NavigationRail.stories.tsx +413 -0
  91. package/src/stories/Notification.stories.tsx +53 -0
  92. package/src/stories/PasswordInput.stories.tsx +21 -0
  93. package/src/stories/Progress.stories.tsx +38 -0
  94. package/src/stories/Prose.stories.tsx +232 -0
  95. package/src/stories/Result.stories.tsx +145 -0
  96. package/src/stories/RollingNumber.stories.tsx +226 -0
  97. package/src/stories/SimpleGrid.stories.tsx +130 -0
  98. package/src/stories/Skeleton.stories.tsx +62 -1
  99. package/src/stories/Squircle.stories.tsx +127 -0
  100. package/src/stories/Stack.stories.tsx +139 -0
  101. package/src/stories/StatusBadge.stories.tsx +125 -0
  102. package/src/stories/Tabs.stories.tsx +56 -1
  103. package/src/stories/Tag.stories.tsx +31 -0
  104. package/src/stories/ThemeIcon.stories.tsx +97 -0
  105. package/src/stories/Timeline.stories.tsx +69 -0
  106. package/src/stories/Tooltip.stories.tsx +18 -0
  107. package/src/stories/TreeSelect.stories.tsx +222 -0
  108. package/src/stories/TypingIndicator.stories.tsx +1 -0
  109. package/src/stories/WordRotate.stories.tsx +1 -0
  110. package/src/stories/YearPicker.stories.tsx +100 -0
  111. package/src/styles.css +289 -15
  112. package/src/tokens.json +96 -1
  113. package/LICENSE +0 -21
@@ -0,0 +1,291 @@
1
+ "use client"
2
+
3
+ // Clipboard — compound widget that renders the copyable VALUE inline (as a
4
+ // read-only input) alongside a copy trigger with the CopyButton success
5
+ // animation. The expected UI for API key panels, invite links, embed codes,
6
+ // webhook URLs, CLI snippets, and share links. Distinct from CopyButton,
7
+ // which is a standalone button that copies a string prop without showing it.
8
+ //
9
+ // The trigger composes the CopyButton primitive — it owns the clipboard
10
+ // write, the icon-swap success animation, and the aria-live announcement
11
+ // (registry antiPattern: never hand-roll a copy state; a visually-dead Copy
12
+ // button shipped once, 2026-07-06).
13
+
14
+ import * as React from "react"
15
+
16
+ import { cn } from "../../lib/utils"
17
+ import { CopyButton, type CopyButtonProps } from "./copy-button"
18
+ import { Label } from "./label"
19
+
20
+ // ─── Context ──────────────────────────────────────────────────────────────────
21
+
22
+ type ClipboardContextValue = {
23
+ value: string
24
+ copied: boolean
25
+ disabled: boolean
26
+ inputId: string
27
+ copiedDuration: number
28
+ onCopied: (value: string) => void
29
+ /** True when a ClipboardLabel is mounted — the input drops its fallback aria-label. */
30
+ hasLabel: boolean
31
+ registerLabel: () => () => void
32
+ }
33
+
34
+ const ClipboardContext = React.createContext<ClipboardContextValue | null>(null)
35
+
36
+ function useClipboardContext(part: string): ClipboardContextValue {
37
+ const ctx = React.useContext(ClipboardContext)
38
+ if (!ctx) {
39
+ throw new Error(`<${part}> must be used within <Clipboard>`)
40
+ }
41
+ return ctx
42
+ }
43
+
44
+ // ─── Root ─────────────────────────────────────────────────────────────────────
45
+
46
+ // Omit the DOM clipboard event handlers: React.ComponentProps<"div"> already
47
+ // types `onCopy` as ClipboardEventHandler, which conflicts with our
48
+ // (value: string) => void callback (same TS2430 class as correction #004,
49
+ // where `title?: ReactNode` collided with HTMLAttributes' `title: string`).
50
+ export type ClipboardProps = Omit<
51
+ React.ComponentProps<"div">,
52
+ "onCopy" | "onCopyCapture"
53
+ > & {
54
+ /** The text value shown in the input and written to the clipboard. Required. */
55
+ value: string
56
+ /** Milliseconds the copied state is held before resetting. Default 2000. */
57
+ copiedDuration?: number
58
+ /** Called after a successful clipboard write. */
59
+ onCopy?: (value: string) => void
60
+ /** Disables both the input and the trigger. */
61
+ disabled?: boolean
62
+ }
63
+
64
+ function Clipboard({
65
+ value,
66
+ copiedDuration = 2000,
67
+ onCopy,
68
+ disabled = false,
69
+ className,
70
+ children,
71
+ ...props
72
+ }: ClipboardProps) {
73
+ const inputId = React.useId()
74
+ const [copied, setCopied] = React.useState(false)
75
+ const [labelCount, setLabelCount] = React.useState(0)
76
+ const resetTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null)
77
+
78
+ React.useEffect(() => {
79
+ return () => {
80
+ if (resetTimer.current) clearTimeout(resetTimer.current)
81
+ }
82
+ }, [])
83
+
84
+ const onCopied = React.useCallback(
85
+ (copiedValue: string) => {
86
+ setCopied(true)
87
+ onCopy?.(copiedValue)
88
+ if (resetTimer.current) clearTimeout(resetTimer.current)
89
+ resetTimer.current = setTimeout(() => setCopied(false), copiedDuration)
90
+ },
91
+ [onCopy, copiedDuration]
92
+ )
93
+
94
+ const registerLabel = React.useCallback(() => {
95
+ setLabelCount((n) => n + 1)
96
+ return () => setLabelCount((n) => n - 1)
97
+ }, [])
98
+
99
+ const ctx = React.useMemo<ClipboardContextValue>(
100
+ () => ({
101
+ value,
102
+ copied,
103
+ disabled,
104
+ inputId,
105
+ copiedDuration,
106
+ onCopied,
107
+ hasLabel: labelCount > 0,
108
+ registerLabel,
109
+ }),
110
+ [value, copied, disabled, inputId, copiedDuration, onCopied, labelCount, registerLabel]
111
+ )
112
+
113
+ return (
114
+ <ClipboardContext.Provider value={ctx}>
115
+ <div
116
+ role="group"
117
+ data-slot="clipboard"
118
+ data-copied={copied ? "true" : undefined}
119
+ data-disabled={disabled ? "true" : undefined}
120
+ className={cn("flex w-full min-w-0 flex-col gap-3", className)}
121
+ {...props}
122
+ >
123
+ {children}
124
+ </div>
125
+ </ClipboardContext.Provider>
126
+ )
127
+ }
128
+
129
+ // ─── Label ────────────────────────────────────────────────────────────────────
130
+
131
+ function ClipboardLabel({
132
+ className,
133
+ ...props
134
+ }: React.ComponentProps<typeof Label>) {
135
+ const { inputId, registerLabel } = useClipboardContext("ClipboardLabel")
136
+
137
+ // Registering tells the input a visible label exists, so it drops its
138
+ // fallback aria-label instead of overriding the visible name.
139
+ React.useEffect(() => registerLabel(), [registerLabel])
140
+
141
+ return (
142
+ <Label
143
+ data-slot="clipboard-label"
144
+ htmlFor={inputId}
145
+ className={className}
146
+ {...props}
147
+ />
148
+ )
149
+ }
150
+
151
+ // ─── Control ──────────────────────────────────────────────────────────────────
152
+ //
153
+ // The row holding input + trigger. min-w-0 + overflow-hidden so the truncating
154
+ // input can actually shrink below its content width (correction #001), and so
155
+ // the pair never stretches oddly as a lone flex-column child (correction #005).
156
+
157
+ function ClipboardControl({
158
+ className,
159
+ ...props
160
+ }: React.ComponentProps<"div">) {
161
+ return (
162
+ <div
163
+ data-slot="clipboard-control"
164
+ className={cn(
165
+ "flex w-full min-w-0 items-center gap-2 overflow-hidden",
166
+ className
167
+ )}
168
+ {...props}
169
+ />
170
+ )
171
+ }
172
+
173
+ // ─── Input ────────────────────────────────────────────────────────────────────
174
+ //
175
+ // Read-only display of the copyable value. Focusable so keyboard users can
176
+ // select-all + ⌘C manually; select-on-focus makes that a single keystroke.
177
+ // h-11 matches the 44px trigger so the pair reads as one control row.
178
+
179
+ export type ClipboardInputProps = Omit<
180
+ React.ComponentProps<"input">,
181
+ "value" | "defaultValue" | "readOnly" | "type"
182
+ >
183
+
184
+ function ClipboardInput({
185
+ className,
186
+ onFocus,
187
+ "aria-label": ariaLabel,
188
+ disabled,
189
+ ...props
190
+ }: ClipboardInputProps) {
191
+ const { value, copied, disabled: rootDisabled, inputId, hasLabel } =
192
+ useClipboardContext("ClipboardInput")
193
+ const isDisabled = disabled ?? rootDisabled
194
+
195
+ return (
196
+ <input
197
+ type="text"
198
+ readOnly
199
+ id={inputId}
200
+ value={value}
201
+ data-slot="clipboard-input"
202
+ data-copied={copied ? "true" : undefined}
203
+ // Full value survives truncation on hover / long-press (correction #001).
204
+ title={value}
205
+ // Only fall back to an aria-label when no visible ClipboardLabel exists —
206
+ // an aria-label would otherwise override the visible label's name.
207
+ aria-label={ariaLabel ?? (hasLabel ? undefined : "Copyable value")}
208
+ disabled={isDisabled}
209
+ onFocus={(event) => {
210
+ // Select-on-focus: one Tab puts the whole value in the selection so
211
+ // ⌘C / Ctrl+C works without the trigger.
212
+ event.currentTarget.select()
213
+ onFocus?.(event)
214
+ }}
215
+ className={cn(
216
+ "h-11 flex-1 truncate rounded-md border px-3 py-2 font-mono text-sm",
217
+ "min-w-0 bg-transparent shadow-xs outline-none dark:bg-input/30",
218
+ "text-foreground selection:bg-primary selection:text-primary-foreground",
219
+ "transition-[color,box-shadow,border-color]",
220
+ "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
221
+ // Copied feedback on the value itself: border tints to the ring token
222
+ // for the copied window, then eases back.
223
+ copied ? "border-ring" : "border-input",
224
+ // Disabled uses explicit muted tokens, never opacity-50 on a text
225
+ // container (correction #003 — blended opacity breaks the 7:1 floor).
226
+ "disabled:pointer-events-none disabled:cursor-not-allowed disabled:border-border/50 disabled:bg-muted/30 disabled:text-muted-foreground",
227
+ className
228
+ )}
229
+ style={{
230
+ transitionDuration: "var(--duration-fast)",
231
+ transitionTimingFunction: "var(--ease-out)",
232
+ }}
233
+ {...props}
234
+ />
235
+ )
236
+ }
237
+
238
+ // ─── Trigger ──────────────────────────────────────────────────────────────────
239
+ //
240
+ // Composes CopyButton: it owns the clipboard write (with execCommand
241
+ // fallback), the Copy→Check swap animation, and the aria-live announcement.
242
+ // Defaults to the 44px CTA size (size="xl") per the CTA size contract.
243
+
244
+ export type ClipboardTriggerProps = Omit<CopyButtonProps, "value"> & {
245
+ /** Rarely needed — copies a different string than the one displayed. */
246
+ value?: string
247
+ }
248
+
249
+ function ClipboardTrigger({
250
+ value: valueOverride,
251
+ onCopy,
252
+ children,
253
+ variant = "outline",
254
+ size,
255
+ className,
256
+ disabled,
257
+ "aria-label": ariaLabel,
258
+ ...props
259
+ }: ClipboardTriggerProps) {
260
+ const { value, disabled: rootDisabled, copiedDuration, onCopied } =
261
+ useClipboardContext("ClipboardTrigger")
262
+
263
+ // Default to labeled "Copy" at the 44px CTA size. Icon-only mode: pass an
264
+ // icon-* size and no children — CopyButton then supplies its own
265
+ // aria-label ("Copy" / "Copied") unless one is passed here.
266
+ const resolvedSize = size ?? "xl"
267
+
268
+ return (
269
+ <CopyButton
270
+ data-slot="clipboard-trigger"
271
+ value={valueOverride ?? value}
272
+ copiedDuration={copiedDuration}
273
+ variant={variant}
274
+ size={resolvedSize}
275
+ disabled={disabled ?? rootDisabled}
276
+ aria-label={ariaLabel}
277
+ className={cn("shrink-0", className)}
278
+ onCopy={(copiedValue) => {
279
+ onCopied(copiedValue)
280
+ onCopy?.(copiedValue)
281
+ }}
282
+ {...props}
283
+ >
284
+ {children === undefined && !String(resolvedSize).startsWith("icon")
285
+ ? "Copy"
286
+ : children}
287
+ </CopyButton>
288
+ )
289
+ }
290
+
291
+ export { Clipboard, ClipboardLabel, ClipboardControl, ClipboardInput, ClipboardTrigger }
@@ -0,0 +1,71 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { XIcon } from "lucide-react";
5
+ import type { VariantProps } from "class-variance-authority";
6
+ import { cn } from "../../lib/utils";
7
+ import { Button, buttonVariants } from "./button";
8
+
9
+ // ─── CloseButton ───────────────────────────────────────────────────────────────
10
+ //
11
+ // Standardized dismiss affordance: a ghost icon Button with a built-in
12
+ // 1.5-stroke X and a guaranteed accessible name (default aria-label "Close",
13
+ // always overridable). Exists so every hand-rolled close X — dismissible
14
+ // banners, filter pills, side panels, inline previews — ships with the
15
+ // accessible name and the system stroke weight by default, instead of
16
+ // re-triggering the "icon-only button with no accessible name" a11y-lint
17
+ // finding one surface at a time.
18
+ //
19
+ // Inherits Button's focus ring, disabled handling, and hover/press color
20
+ // motion (transition-colors) wholesale. Cross-system references: Mantine
21
+ // CloseButton, Chakra UI CloseButton.
22
+ //
23
+ // NOT for: Dialog/Sheet content (they ship their own corner X — don't double
24
+ // up), or destructive deletion (that's Button variant="destructive" behind an
25
+ // AlertDialog confirm).
26
+
27
+ type IconSize = "icon-xs" | "icon-sm" | "icon" | "icon-lg" | "icon-xl";
28
+
29
+ export interface CloseButtonProps
30
+ extends Omit<React.ComponentPropsWithoutRef<"button">, "children">,
31
+ Pick<VariantProps<typeof buttonVariants>, "variant"> {
32
+ /**
33
+ * Icon-button size from the Button scale. Default "icon" (36px) — the
34
+ * Dialog/Sheet corner-chrome register (documented dense-chrome exception
35
+ * to the 44px floor). When the close IS the surface's primary
36
+ * flow-changing dismiss affordance, use "icon-lg" (40px) or "icon-xl"
37
+ * (44px, meets SC 2.5.5 Enhanced).
38
+ */
39
+ size?: IconSize;
40
+ }
41
+
42
+ export const CloseButton = React.forwardRef<
43
+ HTMLButtonElement,
44
+ CloseButtonProps
45
+ >(
46
+ (
47
+ {
48
+ className,
49
+ variant = "ghost",
50
+ size = "icon",
51
+ "aria-label": ariaLabel = "Close",
52
+ type = "button",
53
+ ...props
54
+ },
55
+ ref
56
+ ) => (
57
+ <Button
58
+ ref={ref}
59
+ data-slot="close-button"
60
+ type={type}
61
+ variant={variant}
62
+ size={size}
63
+ aria-label={ariaLabel}
64
+ className={cn("shrink-0", className)}
65
+ {...props}
66
+ >
67
+ <XIcon strokeWidth={1.5} aria-hidden="true" />
68
+ </Button>
69
+ )
70
+ );
71
+ CloseButton.displayName = "CloseButton";
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from "react"
4
- import { CheckIcon, ChevronsUpDownIcon } from "lucide-react"
4
+ import { CheckIcon, ChevronsUpDownIcon, PlusIcon } from "lucide-react"
5
5
 
6
6
  import { cn } from "../../lib/utils"
7
7
  import { Button } from "./button"
@@ -12,6 +12,7 @@ import {
12
12
  CommandInput,
13
13
  CommandItem,
14
14
  CommandList,
15
+ CommandSeparator,
15
16
  } from "./command"
16
17
  import { Popover, PopoverContent, PopoverTrigger } from "./popover"
17
18
 
@@ -30,6 +31,17 @@ export interface ComboboxProps {
30
31
  emptyText?: string
31
32
  disabled?: boolean
32
33
  className?: string
34
+ /**
35
+ * When true, shows a "Create [typed text]" option at the bottom of the dropdown
36
+ * if the typed text does not exactly match any existing option label.
37
+ * Pair with `onCreateOption` to handle the creation event.
38
+ */
39
+ creatable?: boolean
40
+ /**
41
+ * Called with the trimmed text the user typed when they select the "Create" item.
42
+ * Use this to add the new option to the `options` array and update `value`.
43
+ */
44
+ onCreateOption?: (value: string) => void
33
45
  }
34
46
 
35
47
  function Combobox({
@@ -41,13 +53,30 @@ function Combobox({
41
53
  emptyText = "No results found.",
42
54
  disabled = false,
43
55
  className,
56
+ creatable = false,
57
+ onCreateOption,
44
58
  }: ComboboxProps) {
45
59
  const [open, setOpen] = React.useState(false)
60
+ const [inputValue, setInputValue] = React.useState("")
46
61
 
47
62
  const selected = options.find((o) => o.value === value)
48
63
 
64
+ // Derived values for creatable — computed unconditionally but only used when
65
+ // creatable=true, so there is no cost to the non-creatable code path.
66
+ const trimmedInput = inputValue.trim()
67
+ const hasExactMatch =
68
+ trimmedInput.length > 0 &&
69
+ options.some((o) => o.label.toLowerCase() === trimmedInput.toLowerCase())
70
+ const showCreateItem = creatable && trimmedInput.length > 0 && !hasExactMatch
71
+
49
72
  return (
50
- <Popover open={open} onOpenChange={setOpen}>
73
+ <Popover
74
+ open={open}
75
+ onOpenChange={(isOpen) => {
76
+ setOpen(isOpen)
77
+ if (!isOpen) setInputValue("")
78
+ }}
79
+ >
51
80
  <PopoverTrigger asChild>
52
81
  <Button
53
82
  data-slot="combobox"
@@ -72,7 +101,12 @@ function Combobox({
72
101
  </PopoverTrigger>
73
102
  <PopoverContent className="w-[var(--radix-popover-trigger-width)] min-w-[200px] p-0">
74
103
  <Command>
75
- <CommandInput placeholder={searchPlaceholder} />
104
+ <CommandInput
105
+ placeholder={searchPlaceholder}
106
+ {...(creatable
107
+ ? { value: inputValue, onValueChange: setInputValue }
108
+ : {})}
109
+ />
76
110
  <CommandList>
77
111
  <CommandEmpty>{emptyText}</CommandEmpty>
78
112
  <CommandGroup>
@@ -97,6 +131,31 @@ function Combobox({
97
131
  </CommandItem>
98
132
  ))}
99
133
  </CommandGroup>
134
+ {showCreateItem && (
135
+ <>
136
+ <CommandSeparator />
137
+ <CommandGroup>
138
+ <CommandItem
139
+ // forceMount bypasses cmdk's text-match filter so the Create
140
+ // item is always visible while the user is typing a new value.
141
+ forceMount
142
+ value={`__create__${trimmedInput}`}
143
+ onSelect={() => {
144
+ onCreateOption?.(trimmedInput)
145
+ onValueChange?.(trimmedInput)
146
+ setInputValue("")
147
+ setOpen(false)
148
+ }}
149
+ >
150
+ <PlusIcon
151
+ strokeWidth={1.5}
152
+ className="mr-2 size-4 shrink-0 text-muted-foreground"
153
+ />
154
+ Create &ldquo;{trimmedInput}&rdquo;
155
+ </CommandItem>
156
+ </CommandGroup>
157
+ </>
158
+ )}
100
159
  </CommandList>
101
160
  </Command>
102
161
  </PopoverContent>
@@ -0,0 +1,65 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { cva, type VariantProps } from "class-variance-authority";
5
+ import { cn } from "../../lib/utils";
6
+
7
+ // ─── Container ─────────────────────────────────────────────────────────────────
8
+ //
9
+ // Centered max-width content wrapper. Replaces the ad-hoc
10
+ // `<div className="mx-auto w-full max-w-6xl px-4">` boilerplate with a
11
+ // token-keyed size scale, so every screen picks its content width from the
12
+ // same five stops instead of guessing between max-w-5xl / 6xl / 7xl.
13
+ //
14
+ // Layout-only primitive (same class as Stack/Group): no ARIA, no interaction,
15
+ // no motion. Cross-system references: Mantine Container, MUI Container,
16
+ // Chakra Container.
17
+
18
+ const containerVariants = cva("mx-auto w-full", {
19
+ variants: {
20
+ /**
21
+ * Maximum content width. sm → 672px (reading column), md → 896px (forms,
22
+ * article + aside), lg → 1152px (standard app/marketing content, default),
23
+ * xl → 1280px (wide dashboards), full → no cap (edge-to-edge sections
24
+ * that still want the shared gutters).
25
+ */
26
+ size: {
27
+ sm: "max-w-2xl",
28
+ md: "max-w-4xl",
29
+ lg: "max-w-6xl",
30
+ xl: "max-w-7xl",
31
+ full: "max-w-full",
32
+ },
33
+ },
34
+ defaultVariants: {
35
+ size: "lg",
36
+ },
37
+ });
38
+
39
+ export interface ContainerProps
40
+ extends React.HTMLAttributes<HTMLDivElement>,
41
+ VariantProps<typeof containerVariants> {
42
+ /**
43
+ * Horizontal padding (px-4, sm:px-6) so content never touches the viewport
44
+ * edge on small screens. Default: true. Set false when a parent already
45
+ * provides page gutters (avoid double gutters from nested Containers —
46
+ * prefer not nesting at all).
47
+ */
48
+ gutters?: boolean;
49
+ }
50
+
51
+ export const Container = React.forwardRef<HTMLDivElement, ContainerProps>(
52
+ ({ className, size, gutters = true, ...props }, ref) => (
53
+ <div
54
+ ref={ref}
55
+ data-slot="container"
56
+ className={cn(
57
+ containerVariants({ size }),
58
+ gutters && "px-4 sm:px-6",
59
+ className
60
+ )}
61
+ {...props}
62
+ />
63
+ )
64
+ );
65
+ Container.displayName = "Container";
@@ -8,7 +8,11 @@ import type { VariantProps } from "class-variance-authority"
8
8
 
9
9
  export type CopyButtonProps = Omit<
10
10
  React.ComponentPropsWithoutRef<"button">,
11
- "onClick" | "value" | "children"
11
+ // "onCopy" is also omitted: the DOM ClipboardEventHandler would otherwise
12
+ // intersect with our (value: string) => void callback, giving consumers a
13
+ // string | ClipboardEvent union parameter (correction #004 class — surfaced
14
+ // by ClipboardTrigger's composition, 2026-08-06).
15
+ "onClick" | "value" | "children" | "onCopy"
12
16
  > &
13
17
  VariantProps<typeof buttonVariants> & {
14
18
  /** The text value to copy to the clipboard. Required. */