@behavioral-agentic-design-system/core 0.15.0 → 0.17.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/package.json +8 -2
- package/scripts/a11y-lint.cjs +229 -0
- package/scripts/build-tokens.cjs +3 -3
- package/scripts/check-stories.mjs +109 -0
- package/scripts/fix-stories.mjs +785 -0
- package/scripts/generate-stories.cjs +101 -0
- package/scripts/oklch-to-hex.cjs +156 -0
- package/scripts/wcag-audit.cjs +444 -0
- package/src/app/preview/components/page.tsx +538 -51
- package/src/components/dev-identity-badge.tsx +1 -1
- package/src/components/ui/button-group.tsx +57 -0
- package/src/components/ui/calendar.tsx +4 -0
- package/src/components/ui/circular-progress.tsx +120 -0
- package/src/components/ui/code.tsx +55 -0
- package/src/components/ui/copy-button.tsx +114 -0
- package/src/components/ui/empty-state.tsx +115 -0
- package/src/components/ui/index.ts +0 -1
- package/src/components/ui/indicator.tsx +146 -0
- package/src/components/ui/list.tsx +70 -0
- package/src/components/ui/multi-select.tsx +196 -0
- package/src/components/ui/native-select.tsx +68 -0
- package/src/components/ui/navigation-menu.tsx +23 -0
- package/src/components/ui/sheet.tsx +23 -6
- package/src/components/ui/spinner.tsx +14 -3
- package/src/components/ui/tags-input.tsx +210 -69
- package/src/hooks/use-global-primary-color.ts +1 -1
- package/src/styles.css +2 -2
- package/src/components/ui/bottom-sheet.tsx +0 -133
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils"
|
|
5
|
+
|
|
6
|
+
// ─── List root ────────────────────────────────────────────────────────────────
|
|
7
|
+
|
|
8
|
+
const listVariants = cva("flex flex-col list-none p-0 m-0", {
|
|
9
|
+
variants: {
|
|
10
|
+
spacing: {
|
|
11
|
+
sm: "gap-1",
|
|
12
|
+
default: "gap-2",
|
|
13
|
+
lg: "gap-3",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
spacing: "default",
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export interface ListProps
|
|
22
|
+
extends React.ComponentPropsWithoutRef<"ul">,
|
|
23
|
+
VariantProps<typeof listVariants> {
|
|
24
|
+
/** "ul" (default) or "ol" — controls the semantic element rendered */
|
|
25
|
+
type?: "ul" | "ol"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function List({ className, type = "ul", spacing, children, ...props }: ListProps) {
|
|
29
|
+
const Tag = type as React.ElementType
|
|
30
|
+
return (
|
|
31
|
+
<Tag
|
|
32
|
+
data-slot="list"
|
|
33
|
+
className={cn(listVariants({ spacing }), className)}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
</Tag>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// ─── ListItem ─────────────────────────────────────────────────────────────────
|
|
42
|
+
|
|
43
|
+
export interface ListItemProps extends React.ComponentPropsWithoutRef<"li"> {
|
|
44
|
+
/** Optional icon rendered before the text — sized at 16 px and aligned to the first line */
|
|
45
|
+
icon?: React.ReactNode
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function ListItem({ className, icon, children, ...props }: ListItemProps) {
|
|
49
|
+
return (
|
|
50
|
+
<li
|
|
51
|
+
data-slot="list-item"
|
|
52
|
+
className={cn("flex items-start gap-2 text-sm leading-relaxed", className)}
|
|
53
|
+
{...props}
|
|
54
|
+
>
|
|
55
|
+
{icon ? (
|
|
56
|
+
<span
|
|
57
|
+
data-slot="list-item-icon"
|
|
58
|
+
className="mt-0.5 shrink-0 text-muted-foreground [&>svg]:size-4 [&>svg]:stroke-[1.5]"
|
|
59
|
+
>
|
|
60
|
+
{icon}
|
|
61
|
+
</span>
|
|
62
|
+
) : null}
|
|
63
|
+
<span data-slot="list-item-content" className="flex-1 min-w-0">
|
|
64
|
+
{children}
|
|
65
|
+
</span>
|
|
66
|
+
</li>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { List, listVariants, ListItem }
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { CheckIcon, ChevronsUpDownIcon, XIcon } from "lucide-react"
|
|
5
|
+
import { cn } from "../../lib/utils"
|
|
6
|
+
import { Badge } from "./badge"
|
|
7
|
+
import {
|
|
8
|
+
Command,
|
|
9
|
+
CommandEmpty,
|
|
10
|
+
CommandGroup,
|
|
11
|
+
CommandInput,
|
|
12
|
+
CommandItem,
|
|
13
|
+
CommandList,
|
|
14
|
+
} from "./command"
|
|
15
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./popover"
|
|
16
|
+
|
|
17
|
+
export interface MultiSelectOption {
|
|
18
|
+
value: string
|
|
19
|
+
label: string
|
|
20
|
+
disabled?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface MultiSelectProps {
|
|
24
|
+
options: MultiSelectOption[]
|
|
25
|
+
value?: string[]
|
|
26
|
+
onValueChange?: (values: string[]) => void
|
|
27
|
+
placeholder?: string
|
|
28
|
+
searchPlaceholder?: string
|
|
29
|
+
emptyText?: string
|
|
30
|
+
disabled?: boolean
|
|
31
|
+
maxCount?: number
|
|
32
|
+
className?: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function MultiSelect({
|
|
36
|
+
options,
|
|
37
|
+
value = [],
|
|
38
|
+
onValueChange,
|
|
39
|
+
placeholder = "Select options...",
|
|
40
|
+
searchPlaceholder = "Search...",
|
|
41
|
+
emptyText = "No results found.",
|
|
42
|
+
disabled = false,
|
|
43
|
+
maxCount,
|
|
44
|
+
className,
|
|
45
|
+
}: MultiSelectProps) {
|
|
46
|
+
const [open, setOpen] = React.useState(false)
|
|
47
|
+
|
|
48
|
+
function toggle(optValue: string) {
|
|
49
|
+
const next = value.includes(optValue)
|
|
50
|
+
? value.filter((v) => v !== optValue)
|
|
51
|
+
: [...value, optValue]
|
|
52
|
+
onValueChange?.(next)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function removeAt(optValue: string, e: React.MouseEvent) {
|
|
56
|
+
e.stopPropagation()
|
|
57
|
+
onValueChange?.(value.filter((v) => v !== optValue))
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const selectedOptions = options.filter((o) => value.includes(o.value))
|
|
61
|
+
const visibleSelected = maxCount
|
|
62
|
+
? selectedOptions.slice(0, maxCount)
|
|
63
|
+
: selectedOptions
|
|
64
|
+
const overflowCount =
|
|
65
|
+
maxCount && selectedOptions.length > maxCount
|
|
66
|
+
? selectedOptions.length - maxCount
|
|
67
|
+
: 0
|
|
68
|
+
|
|
69
|
+
const triggerLabel =
|
|
70
|
+
value.length > 0
|
|
71
|
+
? `${value.length} option${value.length === 1 ? "" : "s"} selected`
|
|
72
|
+
: placeholder
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
76
|
+
{/*
|
|
77
|
+
* Architecture: absolutely-positioned transparent <button> is the PopoverTrigger,
|
|
78
|
+
* filling the visual container via inset-0. This satisfies axe because:
|
|
79
|
+
* 1. aria-expanded / aria-controls from Radix land on a <button> — valid per ARIA.
|
|
80
|
+
* 2. X-remove <button> pills live in a sibling z-10 span, NOT nested inside the
|
|
81
|
+
* trigger button — no axe nested-interactive violation.
|
|
82
|
+
* DOM order: trigger button first → Tab lands on the trigger before X buttons.
|
|
83
|
+
* Focus ring: has-[:focus-visible] on the container lights up for both the trigger
|
|
84
|
+
* button and individual X buttons, keeping the whole component visually in focus.
|
|
85
|
+
*/}
|
|
86
|
+
<div
|
|
87
|
+
data-slot="multi-select"
|
|
88
|
+
className={cn(
|
|
89
|
+
"relative flex w-full min-h-9 h-auto items-center justify-between gap-1 rounded-md border border-input bg-background px-3 py-1.5 text-sm font-medium shadow-xs",
|
|
90
|
+
"cursor-default select-none",
|
|
91
|
+
"hover:bg-accent/50",
|
|
92
|
+
"has-[:focus-visible]:outline-none has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50 has-[:focus-visible]:border-ring",
|
|
93
|
+
disabled && "pointer-events-none cursor-not-allowed opacity-50",
|
|
94
|
+
className
|
|
95
|
+
)}
|
|
96
|
+
style={{
|
|
97
|
+
transitionDuration: "var(--duration-fast)",
|
|
98
|
+
transitionTimingFunction: "var(--ease-out)",
|
|
99
|
+
}}
|
|
100
|
+
>
|
|
101
|
+
{/* Trigger: absolute-fill transparent button — first in DOM for correct tab order */}
|
|
102
|
+
<PopoverTrigger asChild>
|
|
103
|
+
<button
|
|
104
|
+
type="button"
|
|
105
|
+
aria-haspopup="listbox"
|
|
106
|
+
aria-label={triggerLabel}
|
|
107
|
+
disabled={disabled}
|
|
108
|
+
tabIndex={disabled ? -1 : 0}
|
|
109
|
+
className="absolute inset-0 z-0 rounded-md focus-visible:outline-none"
|
|
110
|
+
/>
|
|
111
|
+
</PopoverTrigger>
|
|
112
|
+
|
|
113
|
+
{/* Pills + placeholder: z-10 so they render above the trigger button.
|
|
114
|
+
pointer-events-none lets clicks on badge labels fall through to the
|
|
115
|
+
trigger button; X buttons restore pointer-events-auto for themselves. */}
|
|
116
|
+
<span className="relative z-10 flex flex-wrap gap-1 min-w-0 flex-1 pointer-events-none">
|
|
117
|
+
{visibleSelected.length > 0 ? (
|
|
118
|
+
<>
|
|
119
|
+
{visibleSelected.map((opt) => (
|
|
120
|
+
<Badge
|
|
121
|
+
key={opt.value}
|
|
122
|
+
variant="secondary"
|
|
123
|
+
className="gap-1 pr-1 font-normal py-0 min-h-6"
|
|
124
|
+
>
|
|
125
|
+
<span className="truncate max-w-[120px]">{opt.label}</span>
|
|
126
|
+
<button
|
|
127
|
+
type="button"
|
|
128
|
+
aria-label={`Remove ${opt.label}`}
|
|
129
|
+
onClick={(e) => removeAt(opt.value, e)}
|
|
130
|
+
className="pointer-events-auto h-6 w-6 flex items-center justify-center rounded-sm opacity-60 hover:opacity-100 outline-none focus-visible:ring-1 focus-visible:ring-ring transition-opacity"
|
|
131
|
+
style={{
|
|
132
|
+
transitionDuration: "var(--duration-fast)",
|
|
133
|
+
transitionTimingFunction: "var(--ease-out)",
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
<XIcon size={10} strokeWidth={1.5} />
|
|
137
|
+
</button>
|
|
138
|
+
</Badge>
|
|
139
|
+
))}
|
|
140
|
+
{overflowCount > 0 && (
|
|
141
|
+
<Badge variant="secondary" className="font-normal">
|
|
142
|
+
+{overflowCount} more
|
|
143
|
+
</Badge>
|
|
144
|
+
)}
|
|
145
|
+
</>
|
|
146
|
+
) : (
|
|
147
|
+
<span className="text-muted-foreground">{placeholder}</span>
|
|
148
|
+
)}
|
|
149
|
+
</span>
|
|
150
|
+
|
|
151
|
+
{/* Chevron: z-10 and pointer-events-none — the trigger button beneath handles clicks */}
|
|
152
|
+
<ChevronsUpDownIcon
|
|
153
|
+
strokeWidth={1.5}
|
|
154
|
+
className="relative z-10 ml-2 size-4 shrink-0 opacity-50 pointer-events-none transition-[opacity,transform]"
|
|
155
|
+
style={{
|
|
156
|
+
transitionDuration: "var(--duration-fast)",
|
|
157
|
+
transitionTimingFunction: "var(--ease-out)",
|
|
158
|
+
}}
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
<PopoverContent className="w-[var(--radix-popover-trigger-width)] min-w-[200px] p-0">
|
|
162
|
+
<Command>
|
|
163
|
+
<CommandInput placeholder={searchPlaceholder} />
|
|
164
|
+
<CommandList>
|
|
165
|
+
<CommandEmpty>{emptyText}</CommandEmpty>
|
|
166
|
+
<CommandGroup>
|
|
167
|
+
{options.map((option) => (
|
|
168
|
+
<CommandItem
|
|
169
|
+
key={option.value}
|
|
170
|
+
value={option.value}
|
|
171
|
+
disabled={option.disabled}
|
|
172
|
+
onSelect={() => toggle(option.value)}
|
|
173
|
+
>
|
|
174
|
+
<CheckIcon
|
|
175
|
+
strokeWidth={1.5}
|
|
176
|
+
className={cn(
|
|
177
|
+
"mr-2 size-4 shrink-0 transition-opacity",
|
|
178
|
+
value.includes(option.value) ? "opacity-100" : "opacity-0"
|
|
179
|
+
)}
|
|
180
|
+
style={{
|
|
181
|
+
transitionDuration: "var(--duration-fast)",
|
|
182
|
+
transitionTimingFunction: "var(--ease-out)",
|
|
183
|
+
}}
|
|
184
|
+
/>
|
|
185
|
+
{option.label}
|
|
186
|
+
</CommandItem>
|
|
187
|
+
))}
|
|
188
|
+
</CommandGroup>
|
|
189
|
+
</CommandList>
|
|
190
|
+
</Command>
|
|
191
|
+
</PopoverContent>
|
|
192
|
+
</Popover>
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export { MultiSelect }
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
import { ChevronDown } from "lucide-react"
|
|
4
|
+
|
|
5
|
+
import { cn } from "../../lib/utils"
|
|
6
|
+
|
|
7
|
+
const nativeSelectVariants = cva(
|
|
8
|
+
"w-full min-w-0 appearance-none rounded-md border border-input bg-transparent shadow-xs outline-none text-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 dark:bg-input/30 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
size: {
|
|
12
|
+
sm: "h-8 px-2.5 pr-8 py-1 text-sm",
|
|
13
|
+
default: "h-9 px-3 pr-9 py-1 text-base md:text-sm",
|
|
14
|
+
lg: "h-10 px-4 pr-10 py-2 text-base",
|
|
15
|
+
xl: "h-11 px-4 pr-11 py-2 text-base",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
size: "default",
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
const chevronSizeMap: Record<string, string> = {
|
|
25
|
+
sm: "size-3.5 right-2.5",
|
|
26
|
+
default: "size-4 right-3",
|
|
27
|
+
lg: "size-4 right-3",
|
|
28
|
+
xl: "size-4 right-3.5",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function NativeSelect({
|
|
32
|
+
className,
|
|
33
|
+
size,
|
|
34
|
+
children,
|
|
35
|
+
...props
|
|
36
|
+
}: Omit<React.ComponentProps<"select">, "size"> &
|
|
37
|
+
VariantProps<typeof nativeSelectVariants>) {
|
|
38
|
+
const resolvedSize = size ?? "default"
|
|
39
|
+
const chevronClasses = chevronSizeMap[resolvedSize] ?? chevronSizeMap["default"]
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div data-slot="native-select" className="relative w-full">
|
|
43
|
+
<select
|
|
44
|
+
data-slot="native-select-element"
|
|
45
|
+
data-size={resolvedSize}
|
|
46
|
+
className={cn(nativeSelectVariants({ size, className }))}
|
|
47
|
+
style={{
|
|
48
|
+
transitionProperty: "color, box-shadow",
|
|
49
|
+
transitionDuration: "var(--duration-fast)",
|
|
50
|
+
transitionTimingFunction: "var(--ease-out)",
|
|
51
|
+
}}
|
|
52
|
+
{...props}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
</select>
|
|
56
|
+
<ChevronDown
|
|
57
|
+
strokeWidth={1.5}
|
|
58
|
+
aria-hidden
|
|
59
|
+
className={cn(
|
|
60
|
+
"pointer-events-none absolute top-1/2 -translate-y-1/2 text-muted-foreground",
|
|
61
|
+
chevronClasses
|
|
62
|
+
)}
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { NativeSelect, nativeSelectVariants }
|
|
@@ -57,8 +57,18 @@ function NavigationMenuItem({
|
|
|
57
57
|
function NavigationMenuTrigger({
|
|
58
58
|
className,
|
|
59
59
|
children,
|
|
60
|
+
onClick,
|
|
61
|
+
onPointerEnter,
|
|
60
62
|
...props
|
|
61
63
|
}: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {
|
|
64
|
+
// Radix opens this on hover, but a click on an already-open trigger toggles
|
|
65
|
+
// it closed — so "hover then click" flickers the panel open→closed and feels
|
|
66
|
+
// buggy. Swallow ONLY the click that lands right after a hover-open: record
|
|
67
|
+
// the hover timestamp, then preventDefault on a click within 700ms while the
|
|
68
|
+
// panel is open. Because Radix composes the prop handler before its internal
|
|
69
|
+
// toggle (with checkForDefaultPrevented), preventing the default skips the
|
|
70
|
+
// close. Keyboard Enter-to-close still works — it has no recent pointer-enter.
|
|
71
|
+
const hoverOpenedAt = React.useRef(0)
|
|
62
72
|
return (
|
|
63
73
|
<NavigationMenuPrimitive.Trigger
|
|
64
74
|
data-slot="navigation-menu-trigger"
|
|
@@ -66,6 +76,19 @@ function NavigationMenuTrigger({
|
|
|
66
76
|
"group inline-flex h-9 w-max items-center justify-center gap-1 rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-hidden disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50",
|
|
67
77
|
className
|
|
68
78
|
)}
|
|
79
|
+
onPointerEnter={(event) => {
|
|
80
|
+
hoverOpenedAt.current = event.timeStamp
|
|
81
|
+
onPointerEnter?.(event)
|
|
82
|
+
}}
|
|
83
|
+
onClick={(event) => {
|
|
84
|
+
if (
|
|
85
|
+
event.currentTarget.dataset.state === "open" &&
|
|
86
|
+
event.timeStamp - hoverOpenedAt.current < 700
|
|
87
|
+
) {
|
|
88
|
+
event.preventDefault()
|
|
89
|
+
}
|
|
90
|
+
onClick?.(event)
|
|
91
|
+
}}
|
|
69
92
|
{...props}
|
|
70
93
|
>
|
|
71
94
|
{children}
|
|
@@ -50,10 +50,17 @@ function SheetContent({
|
|
|
50
50
|
children,
|
|
51
51
|
side = "right",
|
|
52
52
|
showCloseButton = true,
|
|
53
|
+
showHandle = side === "bottom",
|
|
53
54
|
...props
|
|
54
55
|
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
55
56
|
side?: "top" | "right" | "bottom" | "left"
|
|
56
57
|
showCloseButton?: boolean
|
|
58
|
+
/**
|
|
59
|
+
* Bottom sheets only: render the centered grab-handle affordance at the top
|
|
60
|
+
* (the visual signal users read as "this panel came from the bottom").
|
|
61
|
+
* Defaults to `true` when `side="bottom"`, ignored for every other side.
|
|
62
|
+
*/
|
|
63
|
+
showHandle?: boolean
|
|
57
64
|
}) {
|
|
58
65
|
// Apply the active portal theme scope to the content's className so any
|
|
59
66
|
// theme-scoped CSS variables a consumer uses (`--shell-chrome-bg-rgb`,
|
|
@@ -74,22 +81,32 @@ function SheetContent({
|
|
|
74
81
|
side === "top" &&
|
|
75
82
|
"inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
76
83
|
side === "bottom" &&
|
|
77
|
-
|
|
84
|
+
// Bottom sheets get the full mobile treatment: rounded top, capped
|
|
85
|
+
// height with internal scroll so a tall sheet keeps its footer
|
|
86
|
+
// reachable (svh tracks the dynamic viewport), safe-area padding,
|
|
87
|
+
// and gap-0 so header/content/footer own their own spacing.
|
|
88
|
+
"inset-x-0 bottom-0 h-auto max-h-[85svh] gap-0 overflow-y-auto rounded-t-xl border-t pb-[max(1rem,env(safe-area-inset-bottom))] data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
78
89
|
portalThemeClass,
|
|
79
90
|
className
|
|
80
91
|
)}
|
|
81
92
|
{...props}
|
|
82
93
|
>
|
|
94
|
+
{side === "bottom" && showHandle && (
|
|
95
|
+
<div
|
|
96
|
+
aria-hidden="true"
|
|
97
|
+
className="mx-auto mt-3 mb-1 h-1.5 w-12 shrink-0 rounded-full bg-muted-foreground/30"
|
|
98
|
+
/>
|
|
99
|
+
)}
|
|
83
100
|
{children}
|
|
84
101
|
{showCloseButton && (
|
|
85
102
|
<SheetPrimitive.Close
|
|
86
103
|
data-slot="sheet-close"
|
|
87
104
|
// Matches the Dialog close button: top-4 right-4, rounded-xs, a 32px
|
|
88
|
-
// (size-8) X glyph, opacity-70→100 on hover
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
//
|
|
105
|
+
// (size-8) X glyph, opacity-70→100 on hover — so Sheet (every side,
|
|
106
|
+
// including bottom) reads as one family with Dialog. The one
|
|
107
|
+
// intentional difference from Dialog: a 44px (size-11) hit target
|
|
108
|
+
// wrapping the 32px glyph, so it clears BADS's touch-target floor —
|
|
109
|
+
// invisible since there's no box fill.
|
|
93
110
|
className="absolute top-4 right-4 inline-flex size-11 items-center justify-center rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-8"
|
|
94
111
|
style={{ strokeWidth: '1.5px' }}
|
|
95
112
|
>
|
|
@@ -49,6 +49,11 @@ function Spinner({
|
|
|
49
49
|
viewBox="0 0 24 24"
|
|
50
50
|
aria-hidden="true"
|
|
51
51
|
>
|
|
52
|
+
{/* Track and arc are concentric circles at the same radius and the
|
|
53
|
+
same 1.5 stroke width, so the spinner reads as one ring with a
|
|
54
|
+
moving highlight — not a thin track against a heavier filled arc.
|
|
55
|
+
pathLength={100} normalizes the circumference so strokeDasharray
|
|
56
|
+
"30 70" is exactly a 30% arc regardless of size. */}
|
|
52
57
|
<circle
|
|
53
58
|
className="opacity-25"
|
|
54
59
|
cx="12"
|
|
@@ -57,10 +62,16 @@ function Spinner({
|
|
|
57
62
|
stroke="currentColor"
|
|
58
63
|
strokeWidth="1.5"
|
|
59
64
|
/>
|
|
60
|
-
<
|
|
65
|
+
<circle
|
|
61
66
|
className="opacity-75"
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
cx="12"
|
|
68
|
+
cy="12"
|
|
69
|
+
r="10"
|
|
70
|
+
stroke="currentColor"
|
|
71
|
+
strokeWidth="1.5"
|
|
72
|
+
strokeLinecap="round"
|
|
73
|
+
pathLength={100}
|
|
74
|
+
strokeDasharray="30 70"
|
|
64
75
|
/>
|
|
65
76
|
</svg>
|
|
66
77
|
</span>
|