@behavioral-agentic-design-system/core 0.28.0 → 0.30.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 +2 -2
- package/scripts/a11y-lint.cjs +78 -9
- package/scripts/build-tokens.cjs +273 -15
- package/scripts/wcag-audit.cjs +67 -11
- package/src/api/layers/file.ts +1 -0
- package/src/app/font-ready.tsx +6 -5
- package/src/app/layout.tsx +54 -3
- package/src/app/preview/components/page.tsx +5679 -3073
- package/src/app/preview/health/page.tsx +201 -0
- package/src/app/preview/layout.tsx +4 -1
- package/src/app/preview/showcase-filter.tsx +66 -0
- package/src/app/preview/tab-replay.tsx +63 -0
- package/src/app/shell.tsx +74 -18
- package/src/components/customize/save-bar.tsx +19 -6
- package/src/components/docs-tab.tsx +36 -24
- package/src/components/layers-tab.tsx +37 -5
- package/src/components/ui/alert.tsx +12 -0
- package/src/components/ui/badge.tsx +19 -0
- package/src/components/ui/button.tsx +10 -0
- package/src/components/ui/chat-marker.tsx +120 -0
- package/src/components/ui/checkbox.tsx +9 -1
- package/src/components/ui/close-button.tsx +71 -0
- package/src/components/ui/combobox.tsx +62 -3
- package/src/components/ui/container.tsx +65 -0
- package/src/components/ui/date-field.tsx +368 -0
- package/src/components/ui/drawer.tsx +334 -0
- package/src/components/ui/file-button.tsx +145 -0
- package/src/components/ui/floating-indicator.tsx +217 -0
- package/src/components/ui/format-byte.tsx +113 -0
- package/src/components/ui/index.ts +21 -0
- package/src/components/ui/input-clear-button.tsx +52 -0
- package/src/components/ui/input.tsx +39 -20
- package/src/components/ui/keyboard-shortcut.tsx +146 -0
- package/src/components/ui/loading-dots.tsx +99 -0
- package/src/components/ui/month-picker.tsx +296 -0
- package/src/components/ui/multi-select.tsx +35 -19
- package/src/components/ui/nav-link.tsx +200 -0
- package/src/components/ui/navigation-rail.tsx +256 -0
- package/src/components/ui/notification.tsx +20 -0
- package/src/components/ui/password-input.tsx +34 -1
- package/src/components/ui/progress.tsx +15 -1
- package/src/components/ui/prose.tsx +62 -0
- package/src/components/ui/questionnaire.tsx +334 -0
- package/src/components/ui/result.tsx +151 -0
- package/src/components/ui/rolling-number.tsx +1 -0
- package/src/components/ui/sidebar.tsx +5 -0
- package/src/components/ui/simple-grid.tsx +110 -0
- package/src/components/ui/skeleton.tsx +52 -3
- package/src/components/ui/squircle.tsx +274 -0
- package/src/components/ui/stack.tsx +105 -0
- package/src/components/ui/status-badge.tsx +93 -0
- package/src/components/ui/tabs.tsx +34 -7
- package/src/components/ui/tag.tsx +46 -5
- package/src/components/ui/textarea.tsx +5 -0
- package/src/components/ui/theme-icon.tsx +138 -0
- package/src/components/ui/timeline.tsx +27 -10
- package/src/components/ui/tooltip.tsx +12 -1
- package/src/components/ui/tree-select.tsx +386 -0
- package/src/components/ui/year-picker.tsx +307 -0
- package/src/data/docs-index.ts +12 -0
- package/src/hooks/use-global-primary-color.ts +57 -6
- package/src/lib/get-icon-color.ts +66 -0
- package/src/stories/Alert.stories.tsx +31 -1
- package/src/stories/Badge.stories.tsx +63 -6
- package/src/stories/Button.stories.tsx +3 -0
- package/src/stories/ChatMarker.stories.tsx +59 -0
- package/src/stories/Checkbox.stories.tsx +5 -0
- package/src/stories/CloseButton.stories.tsx +65 -0
- package/src/stories/Combobox.stories.tsx +74 -3
- package/src/stories/Container.stories.tsx +134 -0
- package/src/stories/DateField.stories.tsx +114 -0
- package/src/stories/Drawer.stories.tsx +211 -0
- package/src/stories/FileButton.stories.tsx +117 -0
- package/src/stories/FloatingIndicator.stories.tsx +343 -0
- package/src/stories/FormatByte.stories.tsx +142 -0
- package/src/stories/Input.stories.tsx +94 -0
- package/src/stories/InputClearButton.stories.tsx +53 -0
- package/src/stories/KeyboardShortcut.stories.tsx +87 -0
- package/src/stories/LoadingDots.stories.tsx +73 -0
- package/src/stories/MonthPicker.stories.tsx +99 -0
- package/src/stories/MultiSelect.stories.tsx +7 -1
- package/src/stories/NavLink.stories.tsx +213 -0
- package/src/stories/NavigationRail.stories.tsx +413 -0
- package/src/stories/Notification.stories.tsx +53 -0
- package/src/stories/PasswordInput.stories.tsx +21 -0
- package/src/stories/Progress.stories.tsx +38 -0
- package/src/stories/Prose.stories.tsx +232 -0
- package/src/stories/Questionnaire.stories.tsx +287 -0
- package/src/stories/Result.stories.tsx +145 -0
- package/src/stories/RollingNumber.stories.tsx +1 -1
- package/src/stories/Sidebar.stories.tsx +2 -0
- package/src/stories/SimpleGrid.stories.tsx +130 -0
- package/src/stories/Skeleton.stories.tsx +62 -1
- package/src/stories/Squircle.stories.tsx +127 -0
- package/src/stories/Stack.stories.tsx +140 -0
- package/src/stories/StatusBadge.stories.tsx +125 -0
- package/src/stories/Tabs.stories.tsx +56 -1
- package/src/stories/Tag.stories.tsx +31 -0
- package/src/stories/Textarea.stories.tsx +2 -0
- package/src/stories/ThemeIcon.stories.tsx +97 -0
- package/src/stories/Timeline.stories.tsx +69 -0
- package/src/stories/Tooltip.stories.tsx +18 -0
- package/src/stories/TreeSelect.stories.tsx +222 -0
- package/src/stories/YearPicker.stories.tsx +100 -0
- package/src/styles.css +289 -15
- package/src/tokens.json +96 -1
|
@@ -3,39 +3,80 @@ import { X } from "lucide-react"
|
|
|
3
3
|
import { cn } from "../../lib/utils"
|
|
4
4
|
|
|
5
5
|
const tagVariants = cva(
|
|
6
|
-
"inline-flex items-center
|
|
6
|
+
"inline-flex items-center rounded-full font-medium transition-colors",
|
|
7
7
|
{
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
10
10
|
default: "bg-primary text-primary-foreground",
|
|
11
|
+
// TODO(token-discipline): success/warning/error/info use hardcoded
|
|
12
|
+
// Tailwind palette utilities rather than semantic tokens. Pre-existing
|
|
13
|
+
// issue kept byte-identical here (fixing it changes existing rendering);
|
|
14
|
+
// migrate to semantic tokens in a dedicated pass.
|
|
11
15
|
success: "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-100",
|
|
12
16
|
warning: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-100",
|
|
13
17
|
error: "bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-100",
|
|
14
18
|
info: "bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-100",
|
|
15
19
|
},
|
|
20
|
+
size: {
|
|
21
|
+
xs: "gap-0.5 px-1.5 py-0.5 text-xs",
|
|
22
|
+
sm: "gap-1 px-2 py-0.5 text-xs",
|
|
23
|
+
md: "gap-1 px-3 py-1 text-sm",
|
|
24
|
+
lg: "gap-1.5 px-4 py-1.5 text-sm font-semibold",
|
|
25
|
+
},
|
|
16
26
|
},
|
|
17
27
|
defaultVariants: {
|
|
18
28
|
variant: "default",
|
|
29
|
+
size: "md",
|
|
19
30
|
},
|
|
20
31
|
}
|
|
21
32
|
)
|
|
22
33
|
|
|
34
|
+
// Close-button scaling per size. At xs/sm the icon drops to size-3 (12px) and
|
|
35
|
+
// the button carries an explicit 20px (min-h-5/min-w-5) hit area — larger than
|
|
36
|
+
// the bare 16px icon target md ships today, but still below the 44px SC 2.5.5
|
|
37
|
+
// Enhanced floor. Known, documented exception (mirrors the registry entry's
|
|
38
|
+
// targetSize note): Tag is passive display chrome (metadata labels,
|
|
39
|
+
// notification tags), not a flow-changing CTA, so the CTA size contract does
|
|
40
|
+
// not apply. Where tags are user-managed on touch, provide a list-level
|
|
41
|
+
// removal path.
|
|
42
|
+
const closeButtonBySize = {
|
|
43
|
+
xs: { button: "ml-0.5 flex min-h-5 min-w-5 items-center justify-center", icon: "size-3" },
|
|
44
|
+
sm: { button: "ml-0.5 flex min-h-5 min-w-5 items-center justify-center", icon: "size-3" },
|
|
45
|
+
md: { button: "ml-1", icon: "size-4" },
|
|
46
|
+
lg: { button: "ml-1", icon: "size-4" },
|
|
47
|
+
} as const
|
|
48
|
+
|
|
23
49
|
interface TagProps extends React.ComponentProps<"div">, VariantProps<typeof tagVariants> {
|
|
24
50
|
label: string
|
|
25
51
|
onClose?: () => void
|
|
26
52
|
}
|
|
27
53
|
|
|
28
|
-
function Tag({ className, variant, label, onClose, ...props }: TagProps) {
|
|
54
|
+
function Tag({ className, variant, size, label, onClose, style, ...props }: TagProps) {
|
|
55
|
+
const resolvedSize = size ?? "md"
|
|
56
|
+
const closeButton = closeButtonBySize[resolvedSize]
|
|
29
57
|
return (
|
|
30
|
-
<div
|
|
58
|
+
<div
|
|
59
|
+
data-size={resolvedSize}
|
|
60
|
+
className={cn(tagVariants({ variant, size }), className)}
|
|
61
|
+
style={{
|
|
62
|
+
transitionDuration: "var(--duration-fast)",
|
|
63
|
+
transitionTimingFunction: "var(--ease-out)",
|
|
64
|
+
...style,
|
|
65
|
+
}}
|
|
66
|
+
{...props}
|
|
67
|
+
>
|
|
31
68
|
<span>{label}</span>
|
|
32
69
|
{onClose && (
|
|
33
70
|
<button
|
|
34
71
|
onClick={onClose}
|
|
35
|
-
className="
|
|
72
|
+
className={cn("transition-opacity hover:opacity-70", closeButton.button)}
|
|
73
|
+
style={{
|
|
74
|
+
transitionDuration: "var(--duration-fast)",
|
|
75
|
+
transitionTimingFunction: "var(--ease-out)",
|
|
76
|
+
}}
|
|
36
77
|
aria-label="Remove tag"
|
|
37
78
|
>
|
|
38
|
-
<X className=
|
|
79
|
+
<X className={closeButton.icon} strokeWidth={1.5} />
|
|
39
80
|
</button>
|
|
40
81
|
)}
|
|
41
82
|
</div>
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
// Textarea holds the character-count in React.useState, so it cannot render in
|
|
4
|
+
// a server component at all. See the note in button.tsx for why the components
|
|
5
|
+
// that merely forward an optional callback are left server-renderable.
|
|
1
6
|
import * as React from "react"
|
|
2
7
|
|
|
3
8
|
import { cn } from "../../lib/utils"
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { MoonIcon, SunIcon } from "lucide-react"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
|
|
8
|
+
export interface ThemeIconProps
|
|
9
|
+
extends Omit<React.ComponentProps<"span">, "children"> {
|
|
10
|
+
/** Size in pixels for both icons. Default 16. */
|
|
11
|
+
size?: number
|
|
12
|
+
/** Override the icon to show in light mode. Default: <Sun> */
|
|
13
|
+
lightIcon?: React.ReactNode
|
|
14
|
+
/** Override the icon to show in dark mode. Default: <Moon> */
|
|
15
|
+
darkIcon?: React.ReactNode
|
|
16
|
+
/** strokeWidth forwarded to the default Sun/Moon icons. Default 1.5 */
|
|
17
|
+
strokeWidth?: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type ResolvedTheme = "light" | "dark"
|
|
21
|
+
|
|
22
|
+
const DARK_QUERY = "(prefers-color-scheme: dark)"
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Resolve the active theme from the document, in precedence order:
|
|
26
|
+
*
|
|
27
|
+
* 1. An explicit `data-theme="dark" | "light"` stamp on `<html>` (the
|
|
28
|
+
* three-state theme contract — an explicit user choice stamps the
|
|
29
|
+
* attribute; "system" stamps nothing).
|
|
30
|
+
* 2. The `dark` class on `<html>` — how BADS' own shell (and most Tailwind
|
|
31
|
+
* consumers) flip modes.
|
|
32
|
+
* 3. The `prefers-color-scheme` media query as the system-preference
|
|
33
|
+
* fallback when nothing is stamped.
|
|
34
|
+
*/
|
|
35
|
+
function readTheme(): ResolvedTheme {
|
|
36
|
+
const root = document.documentElement
|
|
37
|
+
const attr = root.getAttribute("data-theme")
|
|
38
|
+
if (attr === "dark") return "dark"
|
|
39
|
+
if (attr === "light") return "light"
|
|
40
|
+
if (root.classList.contains("dark")) return "dark"
|
|
41
|
+
if (
|
|
42
|
+
typeof window.matchMedia === "function" &&
|
|
43
|
+
window.matchMedia(DARK_QUERY).matches
|
|
44
|
+
) {
|
|
45
|
+
return "dark"
|
|
46
|
+
}
|
|
47
|
+
return "light"
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Subscribe to every signal that can change the resolved theme: the `class`
|
|
52
|
+
* and `data-theme` attributes on `<html>` (MutationObserver) and the system
|
|
53
|
+
* color-scheme media query.
|
|
54
|
+
*/
|
|
55
|
+
function subscribeToTheme(onChange: () => void): () => void {
|
|
56
|
+
const observer = new MutationObserver(onChange)
|
|
57
|
+
observer.observe(document.documentElement, {
|
|
58
|
+
attributes: true,
|
|
59
|
+
attributeFilter: ["class", "data-theme"],
|
|
60
|
+
})
|
|
61
|
+
const mql =
|
|
62
|
+
typeof window.matchMedia === "function"
|
|
63
|
+
? window.matchMedia(DARK_QUERY)
|
|
64
|
+
: null
|
|
65
|
+
mql?.addEventListener?.("change", onChange)
|
|
66
|
+
return () => {
|
|
67
|
+
observer.disconnect()
|
|
68
|
+
mql?.removeEventListener?.("change", onChange)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// On the server there is no document to read — resolve to null and render a
|
|
73
|
+
// neutral placeholder (both icons at opacity 0, container size reserved) so
|
|
74
|
+
// hydration never flashes the wrong icon.
|
|
75
|
+
const getServerTheme = (): ResolvedTheme | null => null
|
|
76
|
+
|
|
77
|
+
// Token-driven crossfade timing — the CSS vars resolve at runtime against
|
|
78
|
+
// :root in the generated styles.css, so token changes propagate via
|
|
79
|
+
// `pnpm build:tokens`. (The base layer's prefers-reduced-motion override
|
|
80
|
+
// collapses the transition to 0.01ms for users who opt out.)
|
|
81
|
+
const crossfadeStyle: React.CSSProperties = {
|
|
82
|
+
transitionDuration: "var(--duration-base)",
|
|
83
|
+
transitionTimingFunction: "var(--ease-spring)",
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Renders the icon for the active theme mode — a sun in light mode, a moon in
|
|
88
|
+
* dark mode — crossfading between the two with a contained spring rotation
|
|
89
|
+
* when the theme flips. The reusable atom inside a ThemeToggle: it only reads
|
|
90
|
+
* the theme, it never sets it, and it is decorative (`aria-hidden`) — the
|
|
91
|
+
* wrapping control must carry its own accessible label.
|
|
92
|
+
*/
|
|
93
|
+
function ThemeIcon({
|
|
94
|
+
size = 16,
|
|
95
|
+
lightIcon,
|
|
96
|
+
darkIcon,
|
|
97
|
+
strokeWidth = 1.5,
|
|
98
|
+
className,
|
|
99
|
+
style,
|
|
100
|
+
...props
|
|
101
|
+
}: ThemeIconProps) {
|
|
102
|
+
const theme = React.useSyncExternalStore(
|
|
103
|
+
subscribeToTheme,
|
|
104
|
+
readTheme,
|
|
105
|
+
getServerTheme,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
const layerClass = (active: boolean, exitRotation: string) =>
|
|
109
|
+
cn(
|
|
110
|
+
"absolute inset-0 flex items-center justify-center transition-[opacity,transform]",
|
|
111
|
+
active ? "rotate-0 scale-100 opacity-100" : cn("scale-75 opacity-0", exitRotation),
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<span
|
|
116
|
+
data-slot="theme-icon"
|
|
117
|
+
data-resolved-theme={theme ?? "pending"}
|
|
118
|
+
aria-hidden="true"
|
|
119
|
+
{...props}
|
|
120
|
+
className={cn(
|
|
121
|
+
"relative inline-flex shrink-0 items-center justify-center align-middle",
|
|
122
|
+
className,
|
|
123
|
+
)}
|
|
124
|
+
// Runtime-numeric sizing (like Lucide's own `size` prop), not a design
|
|
125
|
+
// token — the icon box must match whatever pixel size the caller picked.
|
|
126
|
+
style={{ width: size, height: size, ...style }}
|
|
127
|
+
>
|
|
128
|
+
<span className={layerClass(theme === "light", "-rotate-90")} style={crossfadeStyle}>
|
|
129
|
+
{lightIcon ?? <SunIcon size={size} strokeWidth={strokeWidth} />}
|
|
130
|
+
</span>
|
|
131
|
+
<span className={layerClass(theme === "dark", "rotate-90")} style={crossfadeStyle}>
|
|
132
|
+
{darkIcon ?? <MoonIcon size={size} strokeWidth={strokeWidth} />}
|
|
133
|
+
</span>
|
|
134
|
+
</span>
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export { ThemeIcon }
|
|
@@ -9,7 +9,7 @@ import { cn } from "../../lib/utils";
|
|
|
9
9
|
|
|
10
10
|
export type TimelineStatus = "default" | "complete" | "active" | "pending";
|
|
11
11
|
|
|
12
|
-
export type TimelineOrientation = "vertical" | "alternate";
|
|
12
|
+
export type TimelineOrientation = "vertical" | "alternate" | "horizontal";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Orientation flows from the Timeline root to each TimelineItem via context so
|
|
@@ -54,6 +54,10 @@ export interface TimelineProps extends React.HTMLAttributes<HTMLOListElement> {
|
|
|
54
54
|
* alternating columns don't fit. Alternation is CSS-only — the `<ol>`/`<li>`
|
|
55
55
|
* DOM and reading order stay top-to-bottom for screen readers and keyboard
|
|
56
56
|
* users regardless of orientation.
|
|
57
|
+
* - `"horizontal"` — items arranged in a horizontal row with dots at the top
|
|
58
|
+
* and content below. A connector line runs through all dot centers. Scrolls
|
|
59
|
+
* horizontally when items overflow the container. Reduced-motion safe via
|
|
60
|
+
* the base-layer prefers-reduced-motion rule.
|
|
57
61
|
*/
|
|
58
62
|
orientation?: TimelineOrientation;
|
|
59
63
|
}
|
|
@@ -68,8 +72,14 @@ export function Timeline({
|
|
|
68
72
|
<TimelineOrientationContext.Provider value={orientation}>
|
|
69
73
|
<ol
|
|
70
74
|
data-slot="timeline"
|
|
71
|
-
data-orientation={orientation
|
|
72
|
-
className={cn(
|
|
75
|
+
data-orientation={orientation !== "vertical" ? orientation : undefined}
|
|
76
|
+
className={cn(
|
|
77
|
+
"relative",
|
|
78
|
+
orientation === "horizontal"
|
|
79
|
+
? "flex flex-row items-start overflow-x-auto"
|
|
80
|
+
: "space-y-0",
|
|
81
|
+
className
|
|
82
|
+
)}
|
|
73
83
|
{...props}
|
|
74
84
|
>
|
|
75
85
|
{children}
|
|
@@ -123,18 +133,21 @@ export function TimelineItem({
|
|
|
123
133
|
|
|
124
134
|
// "alternate" repositions dot/connector onto a centered spine and flips the
|
|
125
135
|
// content column per :nth-child odd/even — CSS-only, gated on md:+ so narrow
|
|
126
|
-
// viewports keep the vertical layout.
|
|
127
|
-
//
|
|
136
|
+
// viewports keep the vertical layout. "horizontal" switches to a flex-row
|
|
137
|
+
// layout with dots centered above content. When "vertical" (the default),
|
|
138
|
+
// every conditional below is false and the rendered output is identical to
|
|
128
139
|
// previous releases.
|
|
129
140
|
const orientation = React.useContext(TimelineOrientationContext);
|
|
130
141
|
const alternate = orientation === "alternate";
|
|
142
|
+
const horizontal = orientation === "horizontal";
|
|
131
143
|
|
|
132
144
|
return (
|
|
133
145
|
<li
|
|
134
146
|
data-slot="timeline-item"
|
|
135
147
|
data-status={status}
|
|
136
148
|
className={cn(
|
|
137
|
-
"group relative
|
|
149
|
+
"group relative",
|
|
150
|
+
horizontal ? "pt-8 flex-1" : "pb-6 pl-8 last:pb-0",
|
|
138
151
|
alternate && "md:pl-0",
|
|
139
152
|
className
|
|
140
153
|
)}
|
|
@@ -146,10 +159,12 @@ export function TimelineItem({
|
|
|
146
159
|
aria-hidden
|
|
147
160
|
data-slot="timeline-connector"
|
|
148
161
|
className={cn(
|
|
149
|
-
"absolute left-[9px] top-5 bottom-0 w-px",
|
|
150
162
|
"group-last:hidden",
|
|
163
|
+
horizontal
|
|
164
|
+
? "absolute left-0 right-0 top-[14px] h-px"
|
|
165
|
+
: "absolute left-[9px] top-5 bottom-0 w-px",
|
|
151
166
|
status === "pending" ? "bg-border/30" : "bg-border",
|
|
152
|
-
alternate && "md:left-1/2 md:-translate-x-1/2"
|
|
167
|
+
!horizontal && alternate && "md:left-1/2 md:-translate-x-1/2"
|
|
153
168
|
)}
|
|
154
169
|
style={{
|
|
155
170
|
transitionProperty: "background-color",
|
|
@@ -164,7 +179,8 @@ export function TimelineItem({
|
|
|
164
179
|
data-slot="timeline-dot"
|
|
165
180
|
className={cn(
|
|
166
181
|
dotVariants({ status }),
|
|
167
|
-
|
|
182
|
+
horizontal && "left-1/2 -translate-x-1/2",
|
|
183
|
+
!horizontal && alternate && "md:left-1/2 md:-translate-x-1/2"
|
|
168
184
|
)}
|
|
169
185
|
style={{
|
|
170
186
|
transitionProperty: "background-color, border-color",
|
|
@@ -181,7 +197,8 @@ export function TimelineItem({
|
|
|
181
197
|
data-slot="timeline-content"
|
|
182
198
|
className={cn(
|
|
183
199
|
"min-w-0 pt-0.5",
|
|
184
|
-
|
|
200
|
+
horizontal && "text-center",
|
|
201
|
+
!horizontal && alternate &&
|
|
185
202
|
"md:w-1/2 md:group-odd:pr-8 md:group-odd:text-right md:group-even:ml-auto md:group-even:pl-8"
|
|
186
203
|
)}
|
|
187
204
|
>
|
|
@@ -37,7 +37,18 @@ function TooltipContent({
|
|
|
37
37
|
children,
|
|
38
38
|
...props
|
|
39
39
|
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
40
|
-
//
|
|
40
|
+
// INVERTED SURFACE — read before styling children. TooltipContent is
|
|
41
|
+
// deliberately inverted (`bg-foreground text-background`) so the box reads as
|
|
42
|
+
// solid high-contrast in both light and dark mode. That inversion is a trap
|
|
43
|
+
// for consumer children: any normal-surface semantic token used inside — most
|
|
44
|
+
// commonly `text-muted-foreground` — is calibrated to pair against
|
|
45
|
+
// `--background`/`--muted`, but here it renders against `--foreground` (now
|
|
46
|
+
// the box's background), collapsing to ~2:1 and failing WCAG. For de-emphasized
|
|
47
|
+
// text inside a tooltip, use `text-background/70`–`/80` (measures AAA against
|
|
48
|
+
// the inverted surface); for hairlines use `border-background/20`, not
|
|
49
|
+
// `border-border`. Same class of bug as the portal-scope rule below, but here
|
|
50
|
+
// the surface itself is inverted, so even ordinary fork-local tokens misfire.
|
|
51
|
+
// See use-portal-theme-class.ts for the portal-scope mechanism.
|
|
41
52
|
const portalThemeClass = usePortalThemeClass()
|
|
42
53
|
return (
|
|
43
54
|
<TooltipPrimitive.Portal>
|