@dinachi/cli 0.10.0 → 0.11.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/CHANGELOG.md CHANGED
@@ -5,6 +5,50 @@ All notable changes to `@dinachi/cli` will be documented in this file.
5
5
  The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.11.0] - 2026-08-10
9
+
10
+ ### Added
11
+
12
+ - **Motion tokens**: `dinachi init` now writes `--motion-ease-out`,
13
+ `--motion-ease-in-out`, `--motion-ease-drawer`, `--motion-duration-fast` and
14
+ `--motion-duration-base` into `:root`. Change a duration there and every
15
+ installed component retimes together. Components inline the same values as
16
+ `var()` fallbacks, so this is a tuning surface, not a requirement: a project
17
+ that never runs `init` still animates correctly. Projects already on 0.10.0
18
+ can copy the block out of `dinachi init` to get the same control.
19
+ - **Select**: a `positionMethod` prop, defaulting to the existing `"fixed"`.
20
+ See the fix below for when to set `"absolute"`.
21
+
22
+ ### Changed
23
+
24
+ - **Button**: presses now give way slightly, `scale(0.97)` going down in 100ms
25
+ and back up in 150ms. The `link` variant is excluded.
26
+ - **Drawer**: a swipe dismissal now finishes at the speed it was thrown, and
27
+ the backdrop dims with the finger instead of holding full strength until the
28
+ drawer lets go.
29
+ - Popups, menus, tooltips and selects scale from their trigger rather than
30
+ from their own centre. Dialogs stay centred.
31
+ - Every animated component now has a `prefers-reduced-motion` path. Movement
32
+ is dropped, the fade that signals arrival is kept.
33
+
34
+ ### Fixed
35
+
36
+ - **Select on Safari**: the dropdown could open far from its trigger when any
37
+ ancestor had a `filter`, `backdrop-filter` or `transform`. Those make the
38
+ ancestor the containing block for a fixed-positioned element, which the
39
+ positioning library accounts for everywhere except WebKit. Pass
40
+ `positionMethod="absolute"` if you hit this; it resolves against the nearest
41
+ positioned ancestor, which no filter can move.
42
+ - Motion classes across nine components used Tailwind 4 only syntax, which
43
+ emits no CSS at all on Tailwind 3 rather than erroring. Those animations
44
+ never ran on a v3 project.
45
+ - **Autocomplete** and **Combobox**: the popup had no anchor width on
46
+ Tailwind 3, so it did not match its input.
47
+ - Arbitrary transition lists now name `scale` alongside `transform`. Tailwind
48
+ 4 compiles `scale-*` into its own property, so the scale was silently
49
+ excluded from the transition and snapped instead of animating.
50
+ - No component uses `ease-in` for an entrance any more.
51
+
8
52
  ## [0.10.0] - 2026-08-10
9
53
 
10
54
  ### Added
package/dist/index.js CHANGED
@@ -75,7 +75,7 @@ function getComponentRegistry() {
75
75
  name: "accordion",
76
76
  description: "A vertically stacked set of interactive headings that each reveal a section of content.",
77
77
  files: [{ name: "accordion.tsx" }, { name: "index.ts" }],
78
- dependencies: ["@base-ui/react", "lucide-react", "tailwindcss-animate"],
78
+ dependencies: ["@base-ui/react", "lucide-react"],
79
79
  utilityDependencies: ["cn"]
80
80
  },
81
81
  "alert-dialog": {
@@ -139,7 +139,7 @@ function getComponentRegistry() {
139
139
  name: "collapsible",
140
140
  description: "A collapsible panel controlled by a button.",
141
141
  files: [{ name: "collapsible.tsx" }, { name: "index.ts" }],
142
- dependencies: ["@base-ui/react", "tailwindcss-animate"],
142
+ dependencies: ["@base-ui/react"],
143
143
  utilityDependencies: ["cn"]
144
144
  },
145
145
  combobox: {
@@ -1403,6 +1403,15 @@ function getThemeCSS(tailwindMajor, mode, preservedThemeVars = []) {
1403
1403
  --sidebar-border: oklch(0.9407 0.0045 134.8505);
1404
1404
  --sidebar-ring: oklch(0.5916 0.218 0.5844);
1405
1405
  --radius: 1.05rem;
1406
+ /* Every component inlines these same values as a var() fallback, so motion works
1407
+ without them. Declaring them here is what lets a project retune the feel of every
1408
+ installed component from one place. The --motion- prefix avoids Tailwind v4's own
1409
+ --ease-out and --duration-* theme variables. */
1410
+ --motion-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
1411
+ --motion-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
1412
+ --motion-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
1413
+ --motion-duration-fast: 150ms;
1414
+ --motion-duration-base: 200ms;
1406
1415
  /* Softer and tighter than Tailwind's defaults, which every component's shadow-sm,
1407
1416
  shadow-md and shadow-lg then picks up. Without these the popovers and dialogs a
1408
1417
  user installs are shadowed harder than the same components on the docs site. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dinachi/cli",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "CLI for adding Dinachi UI components to your project",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -44,7 +44,7 @@ const AccordionTrigger = React.forwardRef<
44
44
  <BaseAccordion.Trigger
45
45
  ref={ref}
46
46
  className={cn(
47
- "flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline",
47
+ "flex flex-1 items-center justify-between py-4 font-medium transition-colors hover:underline",
48
48
  "[&[data-panel-open]>svg]:rotate-180",
49
49
  "disabled:pointer-events-none disabled:opacity-50",
50
50
  className
@@ -52,7 +52,7 @@ const AccordionTrigger = React.forwardRef<
52
52
  {...props}
53
53
  >
54
54
  {children}
55
- <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
55
+ <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))] motion-reduce:transition-none" />
56
56
  </BaseAccordion.Trigger>
57
57
  ));
58
58
  AccordionTrigger.displayName = "AccordionTrigger";
@@ -65,10 +65,9 @@ const AccordionPanel = React.forwardRef<
65
65
  ref={ref}
66
66
  className={cn(
67
67
  "overflow-hidden text-sm h-[var(--accordion-panel-height)]",
68
- "transition-[height] duration-200 ease-in-out",
68
+ "transition-[height] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
69
69
  "data-[starting-style]:h-0 data-[ending-style]:h-0",
70
- "data-[open]:animate-in data-[open]:slide-down-from-top",
71
- "data-[closed]:animate-out data-[closed]:slide-up-to-top",
70
+ "motion-reduce:transition-none",
72
71
  className
73
72
  )}
74
73
  {...props}
@@ -17,7 +17,8 @@ const AlertDialogBackdrop = React.forwardRef<
17
17
  className={cn(
18
18
  "fixed inset-0 z-50 bg-black/80",
19
19
  "data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
20
- "transition-all duration-150",
20
+ "transition-opacity duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
21
+ "data-[ending-style]:duration-[var(--motion-duration-fast,150ms)]",
21
22
  className
22
23
  )}
23
24
  {...props}
@@ -48,9 +49,15 @@ const AlertDialogPopup = React.forwardRef<
48
49
  ref={ref}
49
50
  className={cn(
50
51
  "w-[95%] max-w-lg gap-4 rounded-lg border bg-background p-6 shadow-lg",
52
+ // An alert dialog is not anchored to its trigger, so scaling from the centre is
53
+ // correct here in a way it is not for a popover.
51
54
  "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
52
55
  "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
53
- "transition-all duration-150",
56
+ "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
57
+ "transition-[transform,scale,opacity] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
58
+ // Slower in than out. The user is deciding on the way in and has already decided
59
+ // on the way out.
60
+ "data-[ending-style]:duration-[var(--motion-duration-fast,150ms)]",
54
61
  className
55
62
  )}
56
63
  {...props}
@@ -81,10 +81,12 @@ const AutocompleteContent = React.forwardRef<
81
81
  <AutocompletePrimitive.Popup
82
82
  ref={ref}
83
83
  className={cn(
84
- "relative z-50 min-w-(--anchor-width) overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
85
- "origin-(--transform-origin) outline-none",
86
- "data-starting-style:animate-in data-starting-style:fade-in-0 data-starting-style:zoom-in-95",
87
- "data-ending-style:animate-out data-ending-style:fade-out-0 data-ending-style:zoom-out-95",
84
+ "relative z-50 min-w-[var(--anchor-width)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
85
+ "origin-[var(--transform-origin)] outline-none",
86
+ "transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
87
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
88
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
89
+ "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
88
90
  className
89
91
  )}
90
92
  {...props}
@@ -4,7 +4,23 @@ import { cva, type VariantProps } from "class-variance-authority"
4
4
  import { cn } from "@/lib/utils"
5
5
 
6
6
  const buttonVariants = cva(
7
- "inline-flex items-center cursor-pointer justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
7
+ [
8
+ "inline-flex items-center cursor-pointer justify-center whitespace-nowrap rounded-md text-sm font-medium",
9
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
10
+ // `transform` and `scale` are both named because Tailwind 3 compiles scale-* into
11
+ // `transform` while Tailwind 4 compiles it into `scale`, and a copied component has
12
+ // no say in which major its project runs.
13
+ "transition-[color,background-color,border-color,transform,scale] duration-[var(--motion-duration-fast,150ms)]",
14
+ // The button gives way under the press and comes back when released. 0.97 is small
15
+ // enough to read as the surface yielding rather than the button resizing.
16
+ "active:scale-[0.97]",
17
+ // Faster down than up: the press is the system answering the user, the release is
18
+ // the button settling. Equal timings in both directions read as mushy.
19
+ "active:duration-100",
20
+ // The colour change on hover and press already carries the feedback, so dropping
21
+ // the movement costs nothing.
22
+ "motion-reduce:active:scale-100",
23
+ ],
8
24
  {
9
25
  variants: {
10
26
  variant: {
@@ -16,7 +32,8 @@ const buttonVariants = cva(
16
32
  secondary:
17
33
  "bg-secondary text-secondary-foreground hover:bg-secondary/80",
18
34
  ghost: "hover:bg-accent hover:text-accent-foreground",
19
- link: "text-primary underline-offset-4 hover:underline",
35
+ // A run of text is not a surface, so there is nothing to press into.
36
+ link: "text-primary underline-offset-4 hover:underline active:scale-100",
20
37
  },
21
38
  size: {
22
39
  default: "h-10 px-4 py-2",
@@ -38,16 +38,12 @@ const CollapsiblePanel = React.forwardRef<
38
38
  <BaseCollapsible.Panel
39
39
  ref={ref}
40
40
  className={cn(
41
- "overflow-hidden text-sm transition-all",
41
+ "overflow-hidden text-sm h-[var(--collapsible-panel-height)]",
42
+ "transition-[height] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
42
43
  "data-[ending-style]:h-0 data-[starting-style]:h-0",
43
- "data-[open]:animate-in data-[open]:slide-down-from-top",
44
- "data-[closed]:animate-out data-[closed]:slide-up-to-top",
44
+ "motion-reduce:transition-none",
45
45
  className
46
46
  )}
47
- style={{
48
- "--collapsible-panel-height": "var(--collapsible-panel-height)",
49
- "--collapsible-panel-width": "var(--collapsible-panel-width)",
50
- } as React.CSSProperties}
51
47
  {...props}
52
48
  />
53
49
  ))
@@ -81,10 +81,12 @@ const ComboboxContent = React.forwardRef<
81
81
  <ComboboxPrimitive.Popup
82
82
  ref={ref}
83
83
  className={cn(
84
- "relative z-50 min-w-(--anchor-width) overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
85
- "origin-(--transform-origin) outline-none",
86
- "data-starting-style:animate-in data-starting-style:fade-in-0 data-starting-style:zoom-in-95",
87
- "data-ending-style:animate-out data-ending-style:fade-out-0 data-ending-style:zoom-out-95",
84
+ "relative z-50 min-w-[var(--anchor-width)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
85
+ "origin-[var(--transform-origin)] outline-none",
86
+ "transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
87
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
88
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
89
+ "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
88
90
  className
89
91
  )}
90
92
  {...props}
@@ -49,10 +49,12 @@ const ContextMenuContent = React.forwardRef<
49
49
  ref={ref}
50
50
  className={cn(
51
51
  "z-50 min-w-48 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",
52
- "origin-(--transform-origin)",
52
+ "origin-[var(--transform-origin)]",
53
53
  "outline-none focus:outline-none focus-visible:outline-none",
54
- "data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
55
- "data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
54
+ "transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
55
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
56
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
57
+ "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
56
58
  className
57
59
  )}
58
60
  {...props}
@@ -246,10 +248,12 @@ const ContextMenuSubContent = React.forwardRef<
246
248
  ref={ref}
247
249
  className={cn(
248
250
  "z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",
249
- "origin-(--transform-origin)",
251
+ "origin-[var(--transform-origin)]",
250
252
  "outline-none focus:outline-none focus-visible:outline-none",
251
- "data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
252
- "data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
253
+ "transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
254
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
255
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
256
+ "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
253
257
  className
254
258
  )}
255
259
  {...props}
@@ -17,7 +17,8 @@ const DialogBackdrop = React.forwardRef<
17
17
  className={cn(
18
18
  "fixed inset-0 z-50 bg-black/80",
19
19
  "data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
20
- "transition-all duration-150",
20
+ "transition-opacity duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
21
+ "data-[ending-style]:duration-[var(--motion-duration-fast,150ms)]",
21
22
  className
22
23
  )}
23
24
  {...props}
@@ -48,9 +49,15 @@ const DialogPopup = React.forwardRef<
48
49
  ref={ref}
49
50
  className={cn(
50
51
  "w-[95%] max-w-lg gap-4 rounded-lg border bg-background p-6 shadow-lg",
52
+ // A dialog is not anchored to its trigger, so scaling from the centre is correct
53
+ // here in a way it is not for a popover.
51
54
  "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
52
55
  "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
53
- "transition-all duration-150",
56
+ "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
57
+ "transition-[transform,scale,opacity] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
58
+ // Slower in than out. The user is deciding on the way in and has already decided
59
+ // on the way out.
60
+ "data-[ending-style]:duration-[var(--motion-duration-fast,150ms)]",
54
61
  className
55
62
  )}
56
63
  {...props}
@@ -18,8 +18,15 @@ const DrawerBackdrop = React.forwardRef<
18
18
  ref={ref}
19
19
  className={cn(
20
20
  "fixed inset-0 z-50 bg-black/50",
21
+ // Base UI writes --drawer-swipe-progress on this element as the drag runs: 0 while
22
+ // the drawer is open, 1 once it has travelled far enough to be gone. Reading it
23
+ // here is what makes the dim follow the finger instead of holding full strength
24
+ // until the drawer lets go.
25
+ "opacity-[calc(1_-_var(--drawer-swipe-progress,0))]",
21
26
  "data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
22
- "transition-opacity duration-200",
27
+ "transition-opacity duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-drawer,cubic-bezier(0.32,0.72,0,1))]",
28
+ // During the drag the opacity is the finger's to set, not a transition's.
29
+ "data-[swiping]:transition-none",
23
30
  className
24
31
  )}
25
32
  {...props}
@@ -41,7 +48,16 @@ const DrawerContent = React.forwardRef<
41
48
  <DrawerPrimitive.Popup
42
49
  ref={ref}
43
50
  className={cn(
44
- "fixed z-50 flex flex-col gap-4 border bg-background p-6 shadow-lg transition duration-200",
51
+ "fixed z-50 flex flex-col gap-4 border bg-background p-6 shadow-lg",
52
+ // A surface that travels in from an edge gets the drawer curve, which decays
53
+ // more slowly than the standard one and reads as weight rather than snap.
54
+ "transition-transform duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-drawer,cubic-bezier(0.32,0.72,0,1))]",
55
+ // Base UI resolves a flick into --drawer-swipe-strength, a multiplier on how
56
+ // long the rest of the journey should take: below 1 for a fast flick, above 1
57
+ // for a slow drag released past the threshold. Without it every dismissal
58
+ // takes the same 200ms and the drawer ignores how hard it was thrown. It is
59
+ // registered with an initial value of 1, so a click-driven close is unchanged.
60
+ "data-[ending-style]:duration-[calc(var(--motion-duration-base,200ms)_*_var(--drawer-swipe-strength,1))]",
45
61
  side === "top" &&
46
62
  "inset-x-0 top-0 border-b data-[starting-style]:-translate-y-full data-[ending-style]:-translate-y-full",
47
63
  side === "bottom" &&
@@ -50,6 +66,12 @@ const DrawerContent = React.forwardRef<
50
66
  "inset-y-0 left-0 h-full w-3/4 max-w-sm border-r data-[starting-style]:-translate-x-full data-[ending-style]:-translate-x-full",
51
67
  side === "right" &&
52
68
  "inset-y-0 right-0 h-full w-3/4 max-w-sm border-l data-[starting-style]:translate-x-full data-[ending-style]:translate-x-full",
69
+ // A drawer's whole entrance is travel, so there is nothing left once the
70
+ // movement is dropped. It fades in place instead, which still marks the
71
+ // arrival without sweeping a full panel across the viewport.
72
+ "motion-reduce:transition-opacity",
73
+ "motion-reduce:data-[starting-style]:translate-x-0 motion-reduce:data-[starting-style]:translate-y-0 motion-reduce:data-[starting-style]:opacity-0",
74
+ "motion-reduce:data-[ending-style]:translate-x-0 motion-reduce:data-[ending-style]:translate-y-0 motion-reduce:data-[ending-style]:opacity-0",
53
75
  className
54
76
  )}
55
77
  {...props}
@@ -400,8 +400,15 @@ function shellClass(
400
400
  // press feedback as a pointer one, and so the button lifts on the frame the hold
401
401
  // completes. Quicker in than out: the press is the interface answering the user,
402
402
  // the release is only it relaxing.
403
+ // `useReducedMotion` samples the OS setting at mount, so the class is dropped here
404
+ // only for a preference that was already set. `motion-reduce` catches the same
405
+ // preference turned on while the page is open, which the hook would not see.
403
406
  !reducedMotion &&
404
- "transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] data-[holding]:duration-100 data-[holding]:scale-[0.97]",
407
+ cn(
408
+ "transition-transform duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
409
+ "data-[holding]:duration-100 data-[holding]:scale-[0.97]",
410
+ "motion-reduce:data-[holding]:scale-100"
411
+ ),
405
412
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
406
413
  "disabled:pointer-events-none disabled:opacity-50",
407
414
  SHAPE[variant],
@@ -57,9 +57,11 @@ const MenuContent = React.forwardRef<
57
57
  ref={ref}
58
58
  className={cn(
59
59
  "z-50 min-w-40 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
60
- "origin-(--transform-origin) outline-none",
61
- "data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
62
- "data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
60
+ "origin-[var(--transform-origin)] outline-none",
61
+ "transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
62
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
63
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
64
+ "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
63
65
  className
64
66
  )}
65
67
  {...props}
@@ -246,9 +248,11 @@ const MenuSubContent = React.forwardRef<
246
248
  ref={ref}
247
249
  className={cn(
248
250
  "z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
249
- "origin-(--transform-origin) outline-none",
250
- "data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
251
- "data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
251
+ "origin-[var(--transform-origin)] outline-none",
252
+ "transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
253
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
254
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
255
+ "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
252
256
  className
253
257
  )}
254
258
  {...props}
@@ -71,10 +71,12 @@ const MenubarContent = React.forwardRef<
71
71
  ref={ref}
72
72
  className={cn(
73
73
  "z-50 min-w-48 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
74
- "origin-(--transform-origin)",
74
+ "origin-[var(--transform-origin)]",
75
75
  "outline-none focus:outline-none focus-visible:outline-none",
76
- "data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
77
- "data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
76
+ "transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
77
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
78
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
79
+ "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
78
80
  className
79
81
  )}
80
82
  {...props}
@@ -249,10 +251,12 @@ const MenubarSubContent = React.forwardRef<
249
251
  ref={ref}
250
252
  className={cn(
251
253
  "z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",
252
- "origin-(--transform-origin)",
254
+ "origin-[var(--transform-origin)]",
253
255
  "outline-none focus:outline-none focus-visible:outline-none",
254
- "data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
255
- "data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
256
+ "transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
257
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
258
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
259
+ "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
256
260
  className
257
261
  )}
258
262
  {...props}
@@ -30,7 +30,7 @@ const MeterIndicator = React.forwardRef<
30
30
  >(({ className, ...props }, ref) => (
31
31
  <MeterPrimitive.Indicator
32
32
  ref={ref}
33
- className={cn("h-full rounded-full bg-primary transition-[width] duration-200", className)}
33
+ className={cn("h-full rounded-full bg-primary transition-[width] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))] motion-reduce:transition-none", className)}
34
34
  {...props}
35
35
  />
36
36
  ))
@@ -68,7 +68,7 @@ const NavigationMenuTrigger = React.forwardRef<
68
68
  {children}{" "}
69
69
  <BaseNavigationMenu.Icon
70
70
  render={
71
- <ChevronDown className="relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[popup-open]:rotate-180" />
71
+ <ChevronDown className="relative top-[1px] ml-1 h-3 w-3 transition-transform duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))] motion-reduce:transition-none group-data-[popup-open]:rotate-180" />
72
72
  }
73
73
  />
74
74
  </BaseNavigationMenu.Trigger>
@@ -83,8 +83,8 @@ const NavigationMenuContent = React.forwardRef<
83
83
  ref={ref}
84
84
  className={cn(
85
85
  "left-0 top-0 w-full",
86
- "data-[starting-style]:animate-in data-[starting-style]:fade-in",
87
- "data-[ending-style]:animate-out data-[ending-style]:fade-out",
86
+ "transition-opacity duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
87
+ "data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
88
88
  className
89
89
  )}
90
90
  {...props}
@@ -133,8 +133,11 @@ const NavigationMenuPopup = React.forwardRef<
133
133
  <BaseNavigationMenu.Popup
134
134
  ref={ref}
135
135
  className={cn(
136
- "data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-90",
137
- "data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-90",
136
+ "origin-[var(--transform-origin)]",
137
+ "transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
138
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
139
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
140
+ "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
138
141
  className
139
142
  )}
140
143
  {...props}
@@ -204,7 +207,7 @@ const NavigationMenuBackdrop = React.forwardRef<
204
207
  className={cn(
205
208
  "fixed inset-0 z-40 bg-black/40 pointer-events-none",
206
209
  "data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
207
- "transition-opacity duration-150",
210
+ "transition-opacity duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
208
211
  className
209
212
  )}
210
213
  {...props}
@@ -39,7 +39,8 @@ const OTPFieldInput = React.forwardRef<
39
39
  <OTPFieldPrimitive.Input
40
40
  ref={ref}
41
41
  className={cn(
42
- "relative h-10 w-10 border-y border-r border-input bg-background text-center text-sm shadow-sm outline-none transition-all",
42
+ "relative h-10 w-10 border-y border-r border-input bg-background text-center text-sm shadow-sm outline-none",
43
+ "transition-[color,background-color,border-color,box-shadow] duration-[var(--motion-duration-fast,150ms)]",
43
44
  "first:rounded-l-md first:border-l last:rounded-r-md",
44
45
  "focus-visible:z-10 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50",
45
46
  "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
@@ -31,10 +31,11 @@ const PopoverPopup = React.forwardRef<
31
31
  ref={ref}
32
32
  className={cn(
33
33
  "rounded-lg border bg-popover px-6 py-4 text-popover-foreground shadow-lg outline-none",
34
- "origin-(--transform-origin)",
35
- "data-starting-style:scale-90 data-starting-style:opacity-0",
36
- "data-ending-style:scale-90 data-ending-style:opacity-0",
37
- "transition-[transform,opacity] duration-150",
34
+ "origin-[var(--transform-origin)]",
35
+ "transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
36
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
37
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
38
+ "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
38
39
  className
39
40
  )}
40
41
  {...props}
@@ -165,8 +166,8 @@ const PopoverBackdrop = React.forwardRef<
165
166
  ref={ref}
166
167
  className={cn(
167
168
  "fixed inset-0 z-40 bg-black/50",
168
- "data-starting-style:opacity-0 data-ending-style:opacity-0",
169
- "transition-opacity duration-150",
169
+ "data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
170
+ "transition-opacity duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
170
171
  className
171
172
  )}
172
173
  {...props}
@@ -64,9 +64,10 @@ const PreviewCardPopup = React.forwardRef<
64
64
  className={cn(
65
65
  "flex w-[280px] origin-[var(--transform-origin)] flex-col gap-3 rounded-lg bg-secondary/80 p-4 shadow-lg shadow-secondary/20",
66
66
  "outline outline-1 outline-border",
67
- "transition-[scale,opacity] duration-200",
67
+ "transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
68
68
  "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
69
69
  "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
70
+ "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
70
71
  "backdrop-blur-sm dark:shadow-none dark:-outline-offset-1",
71
72
  className
72
73
  )}
@@ -30,7 +30,7 @@ const ProgressIndicator = React.forwardRef<
30
30
  >(({ className, ...props }, ref) => (
31
31
  <ProgressPrimitive.Indicator
32
32
  ref={ref}
33
- className={cn("h-full rounded-full bg-primary transition-[width] duration-200", className)}
33
+ className={cn("h-full rounded-full bg-primary transition-[width] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))] motion-reduce:transition-none", className)}
34
34
  {...props}
35
35
  />
36
36
  ))
@@ -38,21 +38,35 @@ const SelectContent = React.forwardRef<
38
38
  readonly alignItemWithTrigger?: boolean
39
39
  readonly sideOffset?: number
40
40
  readonly portal?: boolean
41
+ /**
42
+ * Set this to `"absolute"` if the dropdown lands away from its trigger in Safari.
43
+ * A `filter`, `backdrop-filter` or `transform` on any ancestor makes that ancestor
44
+ * the containing block for a fixed-positioned descendant, and the positioning
45
+ * library skips those two filter properties on WebKit — so it measures against the
46
+ * viewport while Safari lays out against the ancestor. `"absolute"` resolves
47
+ * against the nearest positioned ancestor instead, which no filter can change.
48
+ */
49
+ readonly positionMethod?: "absolute" | "fixed"
41
50
  }
42
- >(({ className, children, alignItemWithTrigger = false, sideOffset = 4, portal = false, ...props }, ref) => {
51
+ >(({ className, children, alignItemWithTrigger = false, sideOffset = 4, portal = false, positionMethod = "fixed", ...props }, ref) => {
43
52
  const content = (
44
53
  <SelectPrimitive.Positioner
45
54
  sideOffset={sideOffset}
46
55
  alignItemWithTrigger={alignItemWithTrigger}
47
- positionMethod="fixed"
56
+ positionMethod={positionMethod}
57
+ // The stacking context that keeps sibling form controls from painting over an
58
+ // open dropdown comes from this z-index, not from the position method.
48
59
  className="z-50"
49
60
  >
50
61
  <SelectPrimitive.Popup
51
62
  ref={ref}
52
63
  className={cn(
53
64
  "relative max-h-96 min-w-[var(--anchor-width)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
54
- "data-[open]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:fade-in-0 data-[closed]:zoom-out-95 data-[open]:zoom-in-95",
55
- "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
65
+ "origin-[var(--transform-origin)]",
66
+ "transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
67
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
68
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
69
+ "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
56
70
  !alignItemWithTrigger &&
57
71
  "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
58
72
  className
@@ -73,10 +73,11 @@ const SliderThumb = React.forwardRef<
73
73
  <BaseSlider.Thumb
74
74
  ref={ref}
75
75
  className={cn(
76
- "block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors",
76
+ "block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background",
77
+ "transition-[color,background-color,border-color,transform,scale] duration-150",
77
78
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
78
79
  "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
79
- "data-[dragging]:scale-110",
80
+ "data-[dragging]:scale-110 motion-reduce:data-[dragging]:scale-100",
80
81
  className
81
82
  )}
82
83
  {...props}
@@ -12,7 +12,7 @@ const Switch = React.forwardRef<
12
12
  <SwitchPrimitive.Root
13
13
  ref={ref}
14
14
  className={cn(
15
- "inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors",
15
+ "inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-[var(--motion-duration-fast,150ms)]",
16
16
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
17
17
  "disabled:cursor-not-allowed disabled:opacity-50",
18
18
  "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
@@ -32,7 +32,9 @@ const SwitchThumb = React.forwardRef<
32
32
  <SwitchPrimitive.Thumb
33
33
  ref={ref}
34
34
  className={cn(
35
- "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",
35
+ "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0",
36
+ "transition-transform duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
37
+ "motion-reduce:transition-none",
36
38
  "data-[checked]:translate-x-5 data-[unchecked]:translate-x-0",
37
39
  "data-[disabled]:opacity-80",
38
40
  className
@@ -36,7 +36,8 @@ const TabsTrigger = React.forwardRef<
36
36
  <BaseTabs.Tab
37
37
  ref={ref}
38
38
  className={cn(
39
- "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all",
39
+ "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background",
40
+ "transition-[color,background-color,box-shadow] duration-[var(--motion-duration-fast,150ms)]",
40
41
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
41
42
  "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
42
43
  "data-[active]:bg-muted data-[active]:text-foreground data-[active]:shadow-sm",
@@ -71,7 +72,14 @@ const TabsIndicator = React.forwardRef<
71
72
  <BaseTabs.Indicator
72
73
  ref={ref}
73
74
  className={cn(
74
- "absolute bottom-0 left-0 z-10 h-1 w-[var(--active-tab-width)] -translate-y-1/2 translate-x-[var(--active-tab-left)] rounded-sm bg-muted-foreground transition-all duration-200 ease-in-out",
75
+ "absolute bottom-0 left-0 z-10 h-1 w-[var(--active-tab-width)] -translate-y-1/2 translate-x-[var(--active-tab-left)] rounded-sm bg-muted-foreground",
76
+ // The indicator moves between two on-screen positions rather than entering, so it
77
+ // takes the in-out curve. Width is a layout property, but the indicator is
78
+ // absolutely positioned and therefore out of flow, so animating it reflows only
79
+ // itself. Naming the three properties keeps `all` from animating its colour and
80
+ // shadow on every tab change as well.
81
+ "transition-[transform,translate,width] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-in-out,cubic-bezier(0.77,0,0.175,1))]",
82
+ "motion-reduce:transition-none",
75
83
  className
76
84
  )}
77
85
  {...props}
@@ -8,7 +8,7 @@ import { cn } from "@/lib/utils"
8
8
  const toggleVariants = cva(
9
9
  [
10
10
  "inline-flex items-center justify-center rounded-md text-sm font-medium",
11
- "ring-offset-background transition-all duration-200 ease-in-out",
11
+ "ring-offset-background transition-colors duration-[var(--motion-duration-fast,150ms)]",
12
12
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
13
13
  "disabled:pointer-events-none disabled:opacity-50",
14
14
  "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
@@ -60,10 +60,16 @@ const TooltipPopup: React.ForwardRefExoticComponent<
60
60
  <BaseTooltip.Popup
61
61
  ref={ref}
62
62
  className={cn(
63
- "origin-(--transform-origin) rounded-md px-3 py-1.5 text-sm shadow-md",
64
- "transition-[transform,scale,opacity] duration-200",
65
- "data-ending-style:scale-95 data-ending-style:opacity-0",
66
- "data-starting-style:scale-95 data-starting-style:opacity-0",
63
+ "origin-[var(--transform-origin)] rounded-md px-3 py-1.5 text-sm shadow-md",
64
+ "transition-[transform,scale,opacity] duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
65
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
66
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
67
+ "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
68
+ // Base UI sets data-instant when the open came from an adjacent trigger while a
69
+ // tooltip was already up, from keyboard focus, or from Escape. All three are
70
+ // cases where the animation is the only thing standing between the user and the
71
+ // content they asked for.
72
+ "data-[instant]:duration-0",
67
73
  variantStyles[variant],
68
74
  className
69
75
  )}