@vvedantb/ui 0.52.0 → 0.54.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.
@@ -32,6 +32,7 @@ export { BulkActionBar } from "./ui/bulk-action-bar.js";
32
32
  export { CopyLinkMenuItem } from "./ui/copy-link-menu-item.js";
33
33
  export { ToggleSearch } from "./ui/toggle-search.js";
34
34
  export { MotionProvider } from "./motion/motion-provider.js";
35
+ export { useReducedMotionSetting } from "./motion/reduced-motion.js";
35
36
  export { MarqueeOnHover } from "./ui/marquee-on-hover.js";
36
37
  export { RelativeDateTime } from "./ui/relative-date-time.js";
37
38
  export { ImageLightbox } from "./ui/image-lightbox.js";
package/dist/src/index.js CHANGED
@@ -28,6 +28,7 @@ export { BulkActionBar } from "./ui/bulk-action-bar.js";
28
28
  export { CopyLinkMenuItem } from "./ui/copy-link-menu-item.js";
29
29
  export { ToggleSearch } from "./ui/toggle-search.js";
30
30
  export { MotionProvider } from "./motion/motion-provider.js";
31
+ export { useReducedMotionSetting } from "./motion/reduced-motion.js";
31
32
  export { MarqueeOnHover } from "./ui/marquee-on-hover.js";
32
33
  export { RelativeDateTime } from "./ui/relative-date-time.js";
33
34
  export { ImageLightbox } from "./ui/image-lightbox.js";
@@ -1,7 +1,7 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import { Button } from "../ui/button.js";
3
3
  import { pageTitleClass } from "../ui/page-title.js";
4
- import { useMediaQuery } from "../hooks/use-media-query.js";
4
+ import { useReducedMotionSetting } from "../motion/reduced-motion.js";
5
5
  import { cn } from "../utils/cn.js";
6
6
  import { landingShellClass, productHeroSocialProofClass } from "./marketing-classes.js";
7
7
  import { PROJECT_V_HOME_URL } from "./projectV.js";
@@ -14,7 +14,7 @@ function UserCountProof(t0) {
14
14
  const {
15
15
  count
16
16
  } = t0;
17
- const reducedMotion = useMediaQuery("(prefers-reduced-motion: reduce)");
17
+ const reducedMotion = useReducedMotionSetting();
18
18
  const t1 = !reducedMotion && "animate-pulse";
19
19
  let t2;
20
20
  if ($[0] !== t1) {
@@ -265,23 +265,22 @@ html:has(#top) {
265
265
  }
266
266
  }
267
267
 
268
+ /* Reduced motion follows the root `MotionProvider reducedMotion` setting
269
+ (`html[data-reduced-motion]`), as in motion.css. */
268
270
  @media (prefers-reduced-motion: reduce) {
269
- html:has(#top) {
271
+ html:not([data-reduced-motion="never"]):has(#top) {
270
272
  scroll-behavior: auto;
271
273
  }
272
274
 
273
- .landing-graph-dash,
274
- .landing-preview-pulse,
275
- .landing-pulse-dot,
276
- .landing-ambient-drift,
277
- .landing-ambient-node-a,
278
- .landing-ambient-node-b,
279
- .landing-ambient-node-c,
280
- .landing-ambient-node-d,
281
- .landing-ambient-node-e,
282
- .landing-ambient-node-f,
283
- .landing-ambient-node-g,
284
- .landing-ambient-node-h {
275
+ html:not([data-reduced-motion="never"]) :is(.landing-graph-dash, .landing-preview-pulse, .landing-pulse-dot, .landing-ambient-drift, .landing-ambient-node-a, .landing-ambient-node-b, .landing-ambient-node-c, .landing-ambient-node-d, .landing-ambient-node-e, .landing-ambient-node-f, .landing-ambient-node-g, .landing-ambient-node-h) {
285
276
  animation: none !important;
286
277
  }
287
278
  }
279
+
280
+ html[data-reduced-motion="always"]:has(#top) {
281
+ scroll-behavior: auto;
282
+ }
283
+
284
+ html[data-reduced-motion="always"] :is(.landing-graph-dash, .landing-preview-pulse, .landing-pulse-dot, .landing-ambient-drift, .landing-ambient-node-a, .landing-ambient-node-b, .landing-ambient-node-c, .landing-ambient-node-d, .landing-ambient-node-e, .landing-ambient-node-f, .landing-ambient-node-g, .landing-ambient-node-h) {
285
+ animation: none !important;
286
+ }
@@ -1,6 +1,8 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import { LazyMotion, MotionConfig, domMax } from "motion/react";
3
- import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useLayoutEffect } from "react";
4
+ import { ReducedMotionContext } from "./reduced-motion.js";
5
+
4
6
  /**
5
7
  * The app-wide Motion setup that `m.*` components (in this package and the
6
8
  * app) need: one lazy feature bundle under `strict`, so a stray `motion.*`
@@ -10,10 +12,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
10
12
  * (`layoutId` shared highlights); `domAnimation` is smaller if the app has
11
13
  * none. Under `strict` a missing feature silently skips the animation.
12
14
  * `reducedMotion` defaults to `"user"` (follow the OS setting); pass `"never"`
13
- * to always animate.
15
+ * to always animate. It governs the whole package, not only `m.*`: dialogs,
16
+ * sheets, the `motion-reduce:` variant and motion.css read it too, through
17
+ * `html[data-reduced-motion]` (stamped here, kept after unmount) and context.
14
18
  */
19
+ import { jsx as _jsx } from "react/jsx-runtime";
15
20
  export function MotionProvider(t0) {
16
- const $ = _c(6);
21
+ const $ = _c(12);
17
22
  const {
18
23
  children,
19
24
  features: t1,
@@ -22,29 +27,56 @@ export function MotionProvider(t0) {
22
27
  const features = t1 === undefined ? domMax : t1;
23
28
  const reducedMotion = t2 === undefined ? "user" : t2;
24
29
  let t3;
25
- if ($[0] !== children || $[1] !== reducedMotion) {
26
- t3 = /*#__PURE__*/_jsx(MotionConfig, {
30
+ let t4;
31
+ if ($[0] !== reducedMotion) {
32
+ t3 = () => {
33
+ document.documentElement.dataset.reducedMotion = reducedMotion;
34
+ };
35
+ t4 = [reducedMotion];
36
+ $[0] = reducedMotion;
37
+ $[1] = t3;
38
+ $[2] = t4;
39
+ } else {
40
+ t3 = $[1];
41
+ t4 = $[2];
42
+ }
43
+ useLayoutEffect(t3, t4);
44
+ let t5;
45
+ if ($[3] !== children || $[4] !== reducedMotion) {
46
+ t5 = /*#__PURE__*/_jsx(MotionConfig, {
27
47
  reducedMotion: reducedMotion,
28
48
  children: children
29
49
  });
30
- $[0] = children;
31
- $[1] = reducedMotion;
32
- $[2] = t3;
50
+ $[3] = children;
51
+ $[4] = reducedMotion;
52
+ $[5] = t5;
33
53
  } else {
34
- t3 = $[2];
54
+ t5 = $[5];
35
55
  }
36
- let t4;
37
- if ($[3] !== features || $[4] !== t3) {
38
- t4 = /*#__PURE__*/_jsx(LazyMotion, {
56
+ let t6;
57
+ if ($[6] !== features || $[7] !== t5) {
58
+ t6 = /*#__PURE__*/_jsx(LazyMotion, {
39
59
  features: features,
40
60
  strict: true,
41
- children: t3
61
+ children: t5
62
+ });
63
+ $[6] = features;
64
+ $[7] = t5;
65
+ $[8] = t6;
66
+ } else {
67
+ t6 = $[8];
68
+ }
69
+ let t7;
70
+ if ($[9] !== reducedMotion || $[10] !== t6) {
71
+ t7 = /*#__PURE__*/_jsx(ReducedMotionContext, {
72
+ value: reducedMotion,
73
+ children: t6
42
74
  });
43
- $[3] = features;
44
- $[4] = t3;
45
- $[5] = t4;
75
+ $[9] = reducedMotion;
76
+ $[10] = t6;
77
+ $[11] = t7;
46
78
  } else {
47
- t4 = $[5];
79
+ t7 = $[11];
48
80
  }
49
- return t4;
81
+ return t7;
50
82
  }
@@ -0,0 +1,50 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { createContext, use } from "react";
3
+ import { useMediaQuery } from "../hooks/use-media-query.js";
4
+
5
+ /**
6
+ * Whether the package's own motion follows the OS "reduce motion" setting.
7
+ * Set once at the root with `MotionProvider reducedMotion` (the same option as
8
+ * Motion's `MotionConfig` and HeroUI's provider):
9
+ * - `"user"` (default): follow `prefers-reduced-motion`.
10
+ * - `"always"`: always reduce.
11
+ * - `"never"`: always animate; the app owns its own "motion off" switch.
12
+ *
13
+ * `MotionProvider` stamps it on `html[data-reduced-motion]` for CSS and for
14
+ * non-React code, and provides it through context for components.
15
+ */
16
+
17
+ export const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
18
+ export const ReducedMotionContext = /*#__PURE__*/createContext("user");
19
+ function resolve(setting, osReduces) {
20
+ if (setting === "never") return false;
21
+ if (setting === "always") return true;
22
+ return osReduces;
23
+ }
24
+ function documentSetting() {
25
+ const value = document.documentElement.dataset.reducedMotion;
26
+ return value === "always" || value === "never" ? value : "user";
27
+ }
28
+
29
+ /** Outside React (event handlers, DOM helpers): reads `html[data-reduced-motion]`. */
30
+ export function prefersReducedMotion() {
31
+ if (typeof window === "undefined") return false;
32
+ return resolve(documentSetting(), window.matchMedia(REDUCED_MOTION_QUERY).matches);
33
+ }
34
+
35
+ /** In a component: the root setting from `MotionProvider`, then the OS query. */
36
+ export function useReducedMotionSetting() {
37
+ const $ = _c(3);
38
+ const setting = use(ReducedMotionContext);
39
+ const osReduces = useMediaQuery(REDUCED_MOTION_QUERY);
40
+ let t0;
41
+ if ($[0] !== osReduces || $[1] !== setting) {
42
+ t0 = resolve(setting, osReduces);
43
+ $[0] = osReduces;
44
+ $[1] = setting;
45
+ $[2] = t0;
46
+ } else {
47
+ t0 = $[2];
48
+ }
49
+ return t0;
50
+ }
@@ -6,6 +6,7 @@ import { CountPop } from "./count-pop.js";
6
6
  import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "./dropdown-menu.js";
7
7
  import { Separator } from "./separator.js";
8
8
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js";
9
+ import { useUiConfig } from "./ui-config.js";
9
10
  import { IconDots, IconX } from "@tabler/icons-react";
10
11
 
11
12
  /**
@@ -13,82 +14,222 @@ import { IconDots, IconX } from "@tabler/icons-react";
13
14
  * handler it should run, so confirm dialogs, Alt-to-skip and any per-surface
14
15
  * bookkeeping stay with the caller that owns that state.
15
16
  */
17
+
18
+ /**
19
+ * How a bar button shows its label:
20
+ * - `"inline"` (default): icon and label; the label hides below `sm`
21
+ * (HeroUI "responsive labels").
22
+ * - `"tooltip"`: icon-only at every width; the label shows in a tooltip.
23
+ */
16
24
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
25
+ const barButtonToneClass = action => action.destructive ? "text-destructive hover:bg-destructive/10 hover:text-destructive" : "text-muted-foreground hover:bg-surface-secondary hover:text-foreground";
26
+
27
+ /**
28
+ * An icon-only button with its label in a tooltip. The tooltip trigger is a
29
+ * wrapper span, so the tooltip still shows while the button is disabled (a
30
+ * disabled button gets no pointer events).
31
+ */
32
+ function TooltipBarButton(t0) {
33
+ const $ = _c(21);
34
+ const {
35
+ action,
36
+ disabled
37
+ } = t0;
38
+ const Icon = action.icon;
39
+ const t1 = action.label;
40
+ const t2 = action.onClick;
41
+ let t3;
42
+ if ($[0] !== action) {
43
+ t3 = barButtonToneClass(action);
44
+ $[0] = action;
45
+ $[1] = t3;
46
+ } else {
47
+ t3 = $[1];
48
+ }
49
+ const t4 = `motion-press relative inline-flex size-9 items-center justify-center rounded-lg active:scale-[0.96] disabled:pointer-events-none disabled:opacity-30 ${t3}`;
50
+ let t5;
51
+ if ($[2] !== Icon) {
52
+ t5 = /*#__PURE__*/_jsx(Icon, {
53
+ size: 17
54
+ });
55
+ $[2] = Icon;
56
+ $[3] = t5;
57
+ } else {
58
+ t5 = $[3];
59
+ }
60
+ let t6;
61
+ if ($[4] !== action.showSkipHint) {
62
+ t6 = action.showSkipHint ? /*#__PURE__*/_jsx(ConfirmSkipHint, {
63
+ className: "absolute -right-1 -top-1"
64
+ }) : null;
65
+ $[4] = action.showSkipHint;
66
+ $[5] = t6;
67
+ } else {
68
+ t6 = $[5];
69
+ }
70
+ let t7;
71
+ if ($[6] !== action.label || $[7] !== action.onClick || $[8] !== disabled || $[9] !== t4 || $[10] !== t5 || $[11] !== t6) {
72
+ t7 = /*#__PURE__*/_jsx(TooltipTrigger, {
73
+ asChild: true,
74
+ children: /*#__PURE__*/_jsx("span", {
75
+ className: "inline-flex shrink-0",
76
+ children: /*#__PURE__*/_jsxs("button", {
77
+ type: "button",
78
+ "aria-label": t1,
79
+ onClick: t2,
80
+ disabled: disabled,
81
+ className: t4,
82
+ children: [t5, t6]
83
+ })
84
+ })
85
+ });
86
+ $[6] = action.label;
87
+ $[7] = action.onClick;
88
+ $[8] = disabled;
89
+ $[9] = t4;
90
+ $[10] = t5;
91
+ $[11] = t6;
92
+ $[12] = t7;
93
+ } else {
94
+ t7 = $[12];
95
+ }
96
+ let t8;
97
+ if ($[13] !== action.label || $[14] !== action.showSkipHint) {
98
+ t8 = action.showSkipHint ? skipConfirmTitle(action.label) : action.label;
99
+ $[13] = action.label;
100
+ $[14] = action.showSkipHint;
101
+ $[15] = t8;
102
+ } else {
103
+ t8 = $[15];
104
+ }
105
+ let t9;
106
+ if ($[16] !== t8) {
107
+ t9 = /*#__PURE__*/_jsx(TooltipContent, {
108
+ side: "top",
109
+ className: "text-xs",
110
+ sideOffset: 8,
111
+ children: t8
112
+ });
113
+ $[16] = t8;
114
+ $[17] = t9;
115
+ } else {
116
+ t9 = $[17];
117
+ }
118
+ let t10;
119
+ if ($[18] !== t7 || $[19] !== t9) {
120
+ t10 = /*#__PURE__*/_jsxs(Tooltip, {
121
+ children: [t7, t9]
122
+ });
123
+ $[18] = t7;
124
+ $[19] = t9;
125
+ $[20] = t10;
126
+ } else {
127
+ t10 = $[20];
128
+ }
129
+ return t10;
130
+ }
131
+
17
132
  /**
18
133
  * A single labelled button inside the action bar. The label collapses to
19
134
  * icon-only below the `sm` breakpoint (HeroUI "responsive labels" pattern).
20
135
  */
21
136
  function BarButton(t0) {
22
- const $ = _c(18);
137
+ const $ = _c(23);
23
138
  const {
24
139
  action,
25
- disabled
140
+ disabled,
141
+ labels
26
142
  } = t0;
143
+ if (labels === "tooltip") {
144
+ let t1;
145
+ if ($[0] !== action || $[1] !== disabled) {
146
+ t1 = /*#__PURE__*/_jsx(TooltipBarButton, {
147
+ action: action,
148
+ disabled: disabled
149
+ });
150
+ $[0] = action;
151
+ $[1] = disabled;
152
+ $[2] = t1;
153
+ } else {
154
+ t1 = $[2];
155
+ }
156
+ return t1;
157
+ }
27
158
  const Icon = action.icon;
28
- let t1;
29
- if ($[0] !== action.label || $[1] !== action.showSkipHint) {
30
- t1 = action.showSkipHint ? skipConfirmTitle(action.label) : action.label;
31
- $[0] = action.label;
32
- $[1] = action.showSkipHint;
33
- $[2] = t1;
159
+ const t1 = action.label;
160
+ let t2;
161
+ if ($[3] !== action.label || $[4] !== action.showSkipHint) {
162
+ t2 = action.showSkipHint ? skipConfirmTitle(action.label) : action.label;
163
+ $[3] = action.label;
164
+ $[4] = action.showSkipHint;
165
+ $[5] = t2;
34
166
  } else {
35
- t1 = $[2];
167
+ t2 = $[5];
36
168
  }
37
- const t2 = `motion-press inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg px-2.5 text-sm font-medium active:scale-[0.96] disabled:pointer-events-none disabled:opacity-30 ${action.destructive ? "text-destructive hover:bg-destructive/10 hover:text-destructive" : "text-muted-foreground hover:bg-surface-secondary hover:text-foreground"}`;
38
- let t3;
39
- if ($[3] !== Icon) {
40
- t3 = /*#__PURE__*/_jsx(Icon, {
169
+ const t3 = action.onClick;
170
+ let t4;
171
+ if ($[6] !== action) {
172
+ t4 = barButtonToneClass(action);
173
+ $[6] = action;
174
+ $[7] = t4;
175
+ } else {
176
+ t4 = $[7];
177
+ }
178
+ const t5 = `motion-press inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg px-2.5 text-sm font-medium active:scale-[0.96] disabled:pointer-events-none disabled:opacity-30 ${t4}`;
179
+ let t6;
180
+ if ($[8] !== Icon) {
181
+ t6 = /*#__PURE__*/_jsx(Icon, {
41
182
  size: 17
42
183
  });
43
- $[3] = Icon;
44
- $[4] = t3;
184
+ $[8] = Icon;
185
+ $[9] = t6;
45
186
  } else {
46
- t3 = $[4];
187
+ t6 = $[9];
47
188
  }
48
- const t4 = action.shortLabel ?? action.label;
49
- let t5;
50
- if ($[5] !== t4) {
51
- t5 = /*#__PURE__*/_jsx("span", {
189
+ const t7 = action.shortLabel ?? action.label;
190
+ let t8;
191
+ if ($[10] !== t7) {
192
+ t8 = /*#__PURE__*/_jsx("span", {
52
193
  className: "hidden sm:inline",
53
- children: t4
194
+ children: t7
54
195
  });
55
- $[5] = t4;
56
- $[6] = t5;
196
+ $[10] = t7;
197
+ $[11] = t8;
57
198
  } else {
58
- t5 = $[6];
199
+ t8 = $[11];
59
200
  }
60
- let t6;
61
- if ($[7] !== action.showSkipHint) {
62
- t6 = action.showSkipHint ? /*#__PURE__*/_jsx(ConfirmSkipHint, {}) : null;
63
- $[7] = action.showSkipHint;
64
- $[8] = t6;
201
+ let t9;
202
+ if ($[12] !== action.showSkipHint) {
203
+ t9 = action.showSkipHint ? /*#__PURE__*/_jsx(ConfirmSkipHint, {}) : null;
204
+ $[12] = action.showSkipHint;
205
+ $[13] = t9;
65
206
  } else {
66
- t6 = $[8];
207
+ t9 = $[13];
67
208
  }
68
- let t7;
69
- if ($[9] !== action.label || $[10] !== action.onClick || $[11] !== disabled || $[12] !== t1 || $[13] !== t2 || $[14] !== t3 || $[15] !== t5 || $[16] !== t6) {
70
- t7 = /*#__PURE__*/_jsxs("button", {
209
+ let t10;
210
+ if ($[14] !== action.label || $[15] !== action.onClick || $[16] !== disabled || $[17] !== t2 || $[18] !== t5 || $[19] !== t6 || $[20] !== t8 || $[21] !== t9) {
211
+ t10 = /*#__PURE__*/_jsxs("button", {
71
212
  type: "button",
72
- "aria-label": action.label,
73
- title: t1,
74
- onClick: action.onClick,
213
+ "aria-label": t1,
214
+ title: t2,
215
+ onClick: t3,
75
216
  disabled: disabled,
76
- className: t2,
77
- children: [t3, t5, t6]
217
+ className: t5,
218
+ children: [t6, t8, t9]
78
219
  });
79
- $[9] = action.label;
80
- $[10] = action.onClick;
81
- $[11] = disabled;
82
- $[12] = t1;
83
- $[13] = t2;
84
- $[14] = t3;
85
- $[15] = t5;
86
- $[16] = t6;
87
- $[17] = t7;
220
+ $[14] = action.label;
221
+ $[15] = action.onClick;
222
+ $[16] = disabled;
223
+ $[17] = t2;
224
+ $[18] = t5;
225
+ $[19] = t6;
226
+ $[20] = t8;
227
+ $[21] = t9;
228
+ $[22] = t10;
88
229
  } else {
89
- t7 = $[17];
230
+ t10 = $[22];
90
231
  }
91
- return t7;
232
+ return t10;
92
233
  }
93
234
 
94
235
  /**
@@ -98,7 +239,7 @@ function BarButton(t0) {
98
239
  * the destructive slot on the right. Behaviour arrives as `onClick` per action.
99
240
  */
100
241
  export function BulkActionBar(t0) {
101
- const $ = _c(15);
242
+ const $ = _c(16);
102
243
  const {
103
244
  isSelecting,
104
245
  selectedCount,
@@ -109,12 +250,15 @@ export function BulkActionBar(t0) {
109
250
  primaryActions,
110
251
  moreActions,
111
252
  destructiveAction,
112
- barKey
253
+ barKey,
254
+ labels: labelsProp
113
255
  } = t0;
256
+ const configLabels = useUiConfig("BulkActionBar")?.labels;
257
+ const labels = labelsProp ?? configLabels ?? "inline";
114
258
  const hasSelection = selectedCount > 0;
115
259
  const allSelected = totalCount > 0 && selectedCount >= totalCount;
116
260
  let t1;
117
- if ($[0] !== allSelected || $[1] !== barKey || $[2] !== destructiveAction || $[3] !== hasSelection || $[4] !== isSelecting || $[5] !== moreActions || $[6] !== onClearSelection || $[7] !== onExitSelect || $[8] !== onSelectAll || $[9] !== primaryActions || $[10] !== selectedCount || $[11] !== totalCount) {
261
+ if ($[0] !== allSelected || $[1] !== barKey || $[2] !== destructiveAction || $[3] !== hasSelection || $[4] !== isSelecting || $[5] !== labels || $[6] !== moreActions || $[7] !== onClearSelection || $[8] !== onExitSelect || $[9] !== onSelectAll || $[10] !== primaryActions || $[11] !== selectedCount || $[12] !== totalCount) {
118
262
  t1 = isSelecting && /*#__PURE__*/_jsx(m.div, {
119
263
  className: "absolute inset-x-0 bottom-3 z-20 flex justify-center px-4 pb-[env(safe-area-inset-bottom)]",
120
264
  initial: {
@@ -151,6 +295,7 @@ export function BulkActionBar(t0) {
151
295
  orientation: "vertical",
152
296
  className: "mx-1.5 h-5 shrink-0 bg-border"
153
297
  }), primaryActions.map(action => /*#__PURE__*/_jsx(BarButton, {
298
+ labels: labels,
154
299
  action: action,
155
300
  disabled: !hasSelection
156
301
  }, action.key)), moreActions && moreActions.length > 0 && /*#__PURE__*/_jsxs(DropdownMenu, {
@@ -185,6 +330,7 @@ export function BulkActionBar(t0) {
185
330
  orientation: "vertical",
186
331
  className: "mx-1.5 h-5 shrink-0 bg-border"
187
332
  }), /*#__PURE__*/_jsx(BarButton, {
333
+ labels: labels,
188
334
  action: destructiveAction,
189
335
  disabled: !hasSelection
190
336
  })]
@@ -218,27 +364,28 @@ export function BulkActionBar(t0) {
218
364
  $[2] = destructiveAction;
219
365
  $[3] = hasSelection;
220
366
  $[4] = isSelecting;
221
- $[5] = moreActions;
222
- $[6] = onClearSelection;
223
- $[7] = onExitSelect;
224
- $[8] = onSelectAll;
225
- $[9] = primaryActions;
226
- $[10] = selectedCount;
227
- $[11] = totalCount;
228
- $[12] = t1;
367
+ $[5] = labels;
368
+ $[6] = moreActions;
369
+ $[7] = onClearSelection;
370
+ $[8] = onExitSelect;
371
+ $[9] = onSelectAll;
372
+ $[10] = primaryActions;
373
+ $[11] = selectedCount;
374
+ $[12] = totalCount;
375
+ $[13] = t1;
229
376
  } else {
230
- t1 = $[12];
377
+ t1 = $[13];
231
378
  }
232
379
  let t2;
233
- if ($[13] !== t1) {
380
+ if ($[14] !== t1) {
234
381
  t2 = /*#__PURE__*/_jsx(AnimatePresence, {
235
382
  initial: false,
236
383
  children: t1
237
384
  });
238
- $[13] = t1;
239
- $[14] = t2;
385
+ $[14] = t1;
386
+ $[15] = t2;
240
387
  } else {
241
- t2 = $[14];
388
+ t2 = $[15];
242
389
  }
243
390
  return t2;
244
391
  }
@@ -1,11 +1,12 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import * as React from "react";
3
+ import { prefersReducedMotion } from "../motion/reduced-motion.js";
3
4
 
4
5
  /** Phones, plus short landscape viewports such as 844×390. */
5
6
  export const COMPACT_OVERLAY_QUERY = "(max-width: 639px), (max-height: 500px)";
6
- export function prefersReducedMotion() {
7
- return typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
8
- }
7
+
8
+ /** The root `MotionProvider reducedMotion` setting, then the OS query. */
9
+ export { prefersReducedMotion };
9
10
  export function useCompactOverlay() {
10
11
  const $ = _c(2);
11
12
  const [compact, setCompact] = React.useState(false);
@@ -106,22 +106,35 @@
106
106
  }
107
107
  }
108
108
 
109
+ /*
110
+ * Reduced motion follows the root `MotionProvider reducedMotion` setting
111
+ * (`html[data-reduced-motion]`): the OS query unless it is `"never"`, and
112
+ * always when it is `"always"`.
113
+ */
109
114
  @media (prefers-reduced-motion: reduce) {
110
- .ui-page-enter,
111
- .ui-enter,
112
- .ui-enter-up,
113
- .ui-stagger > * {
115
+ html:not([data-reduced-motion="never"]) :is(.ui-page-enter, .ui-enter, .ui-enter-up, .ui-stagger > *) {
114
116
  animation-duration: 1ms;
115
117
  animation-name: ui-fade-only;
116
118
  }
117
119
 
118
- ::view-transition-group(*),
119
- ::view-transition-old(*),
120
- ::view-transition-new(*) {
120
+ html:not([data-reduced-motion="never"])::view-transition-group(*),
121
+ html:not([data-reduced-motion="never"])::view-transition-old(*),
122
+ html:not([data-reduced-motion="never"])::view-transition-new(*) {
121
123
  animation: none !important;
122
124
  }
123
125
  }
124
126
 
127
+ html[data-reduced-motion="always"] :is(.ui-page-enter, .ui-enter, .ui-enter-up, .ui-stagger > *) {
128
+ animation-duration: 1ms;
129
+ animation-name: ui-fade-only;
130
+ }
131
+
132
+ html[data-reduced-motion="always"]::view-transition-group(*),
133
+ html[data-reduced-motion="always"]::view-transition-old(*),
134
+ html[data-reduced-motion="always"]::view-transition-new(*) {
135
+ animation: none !important;
136
+ }
137
+
125
138
  /*
126
139
  * PageMotionProvider `disabled` sets `html[data-page-motion="off"]`. Page and
127
140
  * route enters, list stagger, `animate-in` / `animate-out`, the modal and
@@ -10,6 +10,20 @@
10
10
  * --motion-ease-emphasized: cubic-bezier(0.2, 0.8, 0.2, 1)
11
11
  */
12
12
 
13
+ /* `motion-reduce:` follows the root `MotionProvider reducedMotion` setting
14
+ (`html[data-reduced-motion]`), not only the OS: `"never"` turns it off,
15
+ `"always"` turns it on, `"user"` (or no provider) keeps the media query. */
16
+ @custom-variant motion-reduce {
17
+ @media (prefers-reduced-motion: reduce) {
18
+ html:not([data-reduced-motion="never"]) & {
19
+ @slot;
20
+ }
21
+ }
22
+ html[data-reduced-motion="always"] & {
23
+ @slot;
24
+ }
25
+ }
26
+
13
27
  /* Extends sub-40px controls to a 40x40px tap target without changing layout.
14
28
  Only force `relative` when the element is otherwise static: absolute /
15
29
  fixed / sticky already form a containing block for ::after. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vvedantb/ui",
3
- "version": "0.52.0",
3
+ "version": "0.54.0",
4
4
  "license": "MIT",
5
5
  "description": "Shared React 19 UI for web apps: one main JavaScript entry (primitives, shell pieces, app helpers including the Convex and Clerk provider, VITE env parsing and ensure-user, artifact viewers over the @vvedantb/server artifacts core, native tokens), third-party brand logos (also @vvedantb/ui/logos), motion-driven animated SVG icons (@vvedantb/ui/icons/animated), a client entry without @vvedantb/server, convex or Clerk for Chrome extensions, design-token CSS, shared Tailwind v4 CSS, a Tailwind preset and packaged Instrument Sans fonts.",
6
6
  "type": "module",
package/src/client.ts CHANGED
@@ -38,11 +38,12 @@ export { RollingNumber } from "./ui/rolling-number";
38
38
  export { ConfettiBurst } from "./ui/confetti-burst";
39
39
  export { SendQueueIcon } from "./ui/send-queue-icon";
40
40
  export { BulkActionBar } from "./ui/bulk-action-bar";
41
- export type { BulkActionBarProps, BulkBarAction } from "./ui/bulk-action-bar";
41
+ export type { BulkActionBarConfig, BulkActionBarProps, BulkBarAction, BulkBarLabels } from "./ui/bulk-action-bar";
42
42
  export { CopyLinkMenuItem } from "./ui/copy-link-menu-item";
43
43
  export { ToggleSearch } from "./ui/toggle-search";
44
44
  export type { ToggleSearchProps, ToggleSearchVariant } from "./ui/toggle-search";
45
45
  export { MotionProvider } from "./motion/motion-provider";
46
+ export { useReducedMotionSetting, type ReducedMotion } from "./motion/reduced-motion";
46
47
  export { MarqueeOnHover } from "./ui/marquee-on-hover";
47
48
  export { RelativeDateTime } from "./ui/relative-date-time";
48
49
  export type { RelativeDateTimeProps } from "./ui/relative-date-time";
package/src/index.ts CHANGED
@@ -34,11 +34,12 @@ export { RollingNumber } from "./ui/rolling-number";
34
34
  export { ConfettiBurst } from "./ui/confetti-burst";
35
35
  export { SendQueueIcon } from "./ui/send-queue-icon";
36
36
  export { BulkActionBar } from "./ui/bulk-action-bar";
37
- export type { BulkActionBarProps, BulkBarAction } from "./ui/bulk-action-bar";
37
+ export type { BulkActionBarConfig, BulkActionBarProps, BulkBarAction, BulkBarLabels } from "./ui/bulk-action-bar";
38
38
  export { CopyLinkMenuItem } from "./ui/copy-link-menu-item";
39
39
  export { ToggleSearch } from "./ui/toggle-search";
40
40
  export type { ToggleSearchProps, ToggleSearchVariant } from "./ui/toggle-search";
41
41
  export { MotionProvider } from "./motion/motion-provider";
42
+ export { useReducedMotionSetting, type ReducedMotion } from "./motion/reduced-motion";
42
43
  export { MarqueeOnHover } from "./ui/marquee-on-hover";
43
44
  export { RelativeDateTime } from "./ui/relative-date-time";
44
45
  export type { RelativeDateTimeProps } from "./ui/relative-date-time";
@@ -1,7 +1,7 @@
1
1
  import type { ComponentProps, MouseEventHandler, ReactNode } from "react";
2
2
  import { Button } from "../ui/button";
3
3
  import { pageTitleClass } from "../ui/page-title";
4
- import { useMediaQuery } from "../hooks/use-media-query";
4
+ import { useReducedMotionSetting } from "../motion/reduced-motion";
5
5
  import { cn } from "../utils/cn";
6
6
  import { landingShellClass, productHeroSocialProofClass } from "./marketing-classes";
7
7
  import { PROJECT_V_HOME_URL } from "./projectV";
@@ -63,7 +63,7 @@ export type ProductHeroProps = {
63
63
  const titleClass = `text-balance text-4xl sm:text-5xl lg:text-6xl ${pageTitleClass.replace(/\btext-xl\s*/, "")}`;
64
64
 
65
65
  function UserCountProof({ count }: { count: number }) {
66
- const reducedMotion = useMediaQuery("(prefers-reduced-motion: reduce)");
66
+ const reducedMotion = useReducedMotionSetting();
67
67
  return (
68
68
  <p className={productHeroSocialProofClass} data-testid="user-count">
69
69
  <span data-testid="user-count-dot" aria-hidden="true" className={cn("size-2 rounded-full bg-success", !reducedMotion && "animate-pulse")} />
@@ -265,23 +265,22 @@ html:has(#top) {
265
265
  }
266
266
  }
267
267
 
268
+ /* Reduced motion follows the root `MotionProvider reducedMotion` setting
269
+ (`html[data-reduced-motion]`), as in motion.css. */
268
270
  @media (prefers-reduced-motion: reduce) {
269
- html:has(#top) {
271
+ html:not([data-reduced-motion="never"]):has(#top) {
270
272
  scroll-behavior: auto;
271
273
  }
272
274
 
273
- .landing-graph-dash,
274
- .landing-preview-pulse,
275
- .landing-pulse-dot,
276
- .landing-ambient-drift,
277
- .landing-ambient-node-a,
278
- .landing-ambient-node-b,
279
- .landing-ambient-node-c,
280
- .landing-ambient-node-d,
281
- .landing-ambient-node-e,
282
- .landing-ambient-node-f,
283
- .landing-ambient-node-g,
284
- .landing-ambient-node-h {
275
+ html:not([data-reduced-motion="never"]) :is(.landing-graph-dash, .landing-preview-pulse, .landing-pulse-dot, .landing-ambient-drift, .landing-ambient-node-a, .landing-ambient-node-b, .landing-ambient-node-c, .landing-ambient-node-d, .landing-ambient-node-e, .landing-ambient-node-f, .landing-ambient-node-g, .landing-ambient-node-h) {
285
276
  animation: none !important;
286
277
  }
287
278
  }
279
+
280
+ html[data-reduced-motion="always"]:has(#top) {
281
+ scroll-behavior: auto;
282
+ }
283
+
284
+ html[data-reduced-motion="always"] :is(.landing-graph-dash, .landing-preview-pulse, .landing-pulse-dot, .landing-ambient-drift, .landing-ambient-node-a, .landing-ambient-node-b, .landing-ambient-node-c, .landing-ambient-node-d, .landing-ambient-node-e, .landing-ambient-node-f, .landing-ambient-node-g, .landing-ambient-node-h) {
285
+ animation: none !important;
286
+ }
@@ -1,5 +1,6 @@
1
1
  import { LazyMotion, MotionConfig, domMax, type FeatureBundle } from "motion/react";
2
- import type { ReactNode } from "react";
2
+ import { useLayoutEffect, type ReactNode } from "react";
3
+ import { ReducedMotionContext, type ReducedMotion } from "./reduced-motion";
3
4
 
4
5
  /**
5
6
  * The app-wide Motion setup that `m.*` components (in this package and the
@@ -10,7 +11,9 @@ import type { ReactNode } from "react";
10
11
  * (`layoutId` shared highlights); `domAnimation` is smaller if the app has
11
12
  * none. Under `strict` a missing feature silently skips the animation.
12
13
  * `reducedMotion` defaults to `"user"` (follow the OS setting); pass `"never"`
13
- * to always animate.
14
+ * to always animate. It governs the whole package, not only `m.*`: dialogs,
15
+ * sheets, the `motion-reduce:` variant and motion.css read it too, through
16
+ * `html[data-reduced-motion]` (stamped here, kept after unmount) and context.
14
17
  */
15
18
  export function MotionProvider({
16
19
  children,
@@ -19,11 +22,17 @@ export function MotionProvider({
19
22
  }: {
20
23
  children: ReactNode;
21
24
  features?: FeatureBundle;
22
- reducedMotion?: "user" | "always" | "never";
25
+ reducedMotion?: ReducedMotion;
23
26
  }) {
27
+ useLayoutEffect(() => {
28
+ document.documentElement.dataset.reducedMotion = reducedMotion;
29
+ }, [reducedMotion]);
30
+
24
31
  return (
25
- <LazyMotion features={features} strict>
26
- <MotionConfig reducedMotion={reducedMotion}>{children}</MotionConfig>
27
- </LazyMotion>
32
+ <ReducedMotionContext value={reducedMotion}>
33
+ <LazyMotion features={features} strict>
34
+ <MotionConfig reducedMotion={reducedMotion}>{children}</MotionConfig>
35
+ </LazyMotion>
36
+ </ReducedMotionContext>
28
37
  );
29
38
  }
@@ -0,0 +1,43 @@
1
+ import { createContext, use } from "react";
2
+ import { useMediaQuery } from "../hooks/use-media-query";
3
+
4
+ /**
5
+ * Whether the package's own motion follows the OS "reduce motion" setting.
6
+ * Set once at the root with `MotionProvider reducedMotion` (the same option as
7
+ * Motion's `MotionConfig` and HeroUI's provider):
8
+ * - `"user"` (default): follow `prefers-reduced-motion`.
9
+ * - `"always"`: always reduce.
10
+ * - `"never"`: always animate; the app owns its own "motion off" switch.
11
+ *
12
+ * `MotionProvider` stamps it on `html[data-reduced-motion]` for CSS and for
13
+ * non-React code, and provides it through context for components.
14
+ */
15
+ export type ReducedMotion = "user" | "always" | "never";
16
+
17
+ export const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
18
+
19
+ export const ReducedMotionContext = createContext<ReducedMotion>("user");
20
+
21
+ function resolve(setting: ReducedMotion, osReduces: boolean): boolean {
22
+ if (setting === "never") return false;
23
+ if (setting === "always") return true;
24
+ return osReduces;
25
+ }
26
+
27
+ function documentSetting(): ReducedMotion {
28
+ const value = document.documentElement.dataset.reducedMotion;
29
+ return value === "always" || value === "never" ? value : "user";
30
+ }
31
+
32
+ /** Outside React (event handlers, DOM helpers): reads `html[data-reduced-motion]`. */
33
+ export function prefersReducedMotion(): boolean {
34
+ if (typeof window === "undefined") return false;
35
+ return resolve(documentSetting(), window.matchMedia(REDUCED_MOTION_QUERY).matches);
36
+ }
37
+
38
+ /** In a component: the root setting from `MotionProvider`, then the OS query. */
39
+ export function useReducedMotionSetting(): boolean {
40
+ const setting = use(ReducedMotionContext);
41
+ const osReduces = useMediaQuery(REDUCED_MOTION_QUERY);
42
+ return resolve(setting, osReduces);
43
+ }
@@ -10,6 +10,7 @@ import {
10
10
  } from "./dropdown-menu";
11
11
  import { Separator } from "./separator";
12
12
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip";
13
+ import { useUiConfig } from "./ui-config";
13
14
  import { IconDots, IconX } from "@tabler/icons-react";
14
15
  import type { ComponentType } from "react";
15
16
 
@@ -22,7 +23,7 @@ export interface BulkBarAction {
22
23
  key: string;
23
24
  /** Full label used in the More menu and for accessibility. */
24
25
  label: string;
25
- /** Shorter label shown inline in the bar (defaults to `label`). */
26
+ /** Shorter label shown inline in the bar (defaults to `label`). Unused with `labels="tooltip"`. */
26
27
  shortLabel?: string;
27
28
  icon: ComponentType<{ size: number; className?: string }>;
28
29
  destructive?: boolean;
@@ -31,6 +32,19 @@ export interface BulkBarAction {
31
32
  onClick: () => void;
32
33
  }
33
34
 
35
+ /**
36
+ * How a bar button shows its label:
37
+ * - `"inline"` (default): icon and label; the label hides below `sm`
38
+ * (HeroUI "responsive labels").
39
+ * - `"tooltip"`: icon-only at every width; the label shows in a tooltip.
40
+ */
41
+ export type BulkBarLabels = "inline" | "tooltip";
42
+
43
+ export interface BulkActionBarConfig {
44
+ /** Default `labels` for every bar in the app. A `labels` prop wins. */
45
+ labels?: BulkBarLabels;
46
+ }
47
+
34
48
  export interface BulkActionBarProps {
35
49
  isSelecting: boolean;
36
50
  selectedCount: number;
@@ -43,6 +57,51 @@ export interface BulkActionBarProps {
43
57
  destructiveAction?: BulkBarAction;
44
58
  /** Motion key for the presence animation, e.g. "quick-tasks-bulk-bar". */
45
59
  barKey: string;
60
+ /** Label style for the action buttons (see `BulkBarLabels`). */
61
+ labels?: BulkBarLabels;
62
+ }
63
+
64
+ const barButtonToneClass = (action: BulkBarAction) =>
65
+ action.destructive
66
+ ? "text-destructive hover:bg-destructive/10 hover:text-destructive"
67
+ : "text-muted-foreground hover:bg-surface-secondary hover:text-foreground";
68
+
69
+ /**
70
+ * An icon-only button with its label in a tooltip. The tooltip trigger is a
71
+ * wrapper span, so the tooltip still shows while the button is disabled (a
72
+ * disabled button gets no pointer events).
73
+ */
74
+ function TooltipBarButton({
75
+ action,
76
+ disabled,
77
+ }: {
78
+ action: BulkBarAction;
79
+ disabled: boolean;
80
+ }) {
81
+ const Icon = action.icon;
82
+ return (
83
+ <Tooltip>
84
+ <TooltipTrigger asChild>
85
+ <span className="inline-flex shrink-0">
86
+ <button
87
+ type="button"
88
+ aria-label={action.label}
89
+ onClick={action.onClick}
90
+ disabled={disabled}
91
+ className={`motion-press relative inline-flex size-9 items-center justify-center rounded-lg active:scale-[0.96] disabled:pointer-events-none disabled:opacity-30 ${barButtonToneClass(action)}`}
92
+ >
93
+ <Icon size={17} />
94
+ {action.showSkipHint ? (
95
+ <ConfirmSkipHint className="absolute -right-1 -top-1" />
96
+ ) : null}
97
+ </button>
98
+ </span>
99
+ </TooltipTrigger>
100
+ <TooltipContent side="top" className="text-xs" sideOffset={8}>
101
+ {action.showSkipHint ? skipConfirmTitle(action.label) : action.label}
102
+ </TooltipContent>
103
+ </Tooltip>
104
+ );
46
105
  }
47
106
 
48
107
  /**
@@ -52,10 +111,15 @@ export interface BulkActionBarProps {
52
111
  function BarButton({
53
112
  action,
54
113
  disabled,
114
+ labels,
55
115
  }: {
56
116
  action: BulkBarAction;
57
117
  disabled: boolean;
118
+ labels: BulkBarLabels;
58
119
  }) {
120
+ if (labels === "tooltip") {
121
+ return <TooltipBarButton action={action} disabled={disabled} />;
122
+ }
59
123
  const Icon = action.icon;
60
124
  return (
61
125
  <button
@@ -69,11 +133,7 @@ function BarButton({
69
133
  // `motion-press`, not `transition-colors`: the destructive Delete takes
70
134
  // this same branch, so the highest-consequence control in the bar was the
71
135
  // one with no acknowledgement at all before its confirm dialog appeared.
72
- className={`motion-press inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg px-2.5 text-sm font-medium active:scale-[0.96] disabled:pointer-events-none disabled:opacity-30 ${
73
- action.destructive
74
- ? "text-destructive hover:bg-destructive/10 hover:text-destructive"
75
- : "text-muted-foreground hover:bg-surface-secondary hover:text-foreground"
76
- }`}
136
+ className={`motion-press inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg px-2.5 text-sm font-medium active:scale-[0.96] disabled:pointer-events-none disabled:opacity-30 ${barButtonToneClass(action)}`}
77
137
  >
78
138
  <Icon size={17} />
79
139
  <span className="hidden sm:inline">
@@ -101,7 +161,10 @@ export function BulkActionBar({
101
161
  moreActions,
102
162
  destructiveAction,
103
163
  barKey,
164
+ labels: labelsProp,
104
165
  }: BulkActionBarProps) {
166
+ const configLabels = useUiConfig("BulkActionBar")?.labels;
167
+ const labels = labelsProp ?? configLabels ?? "inline";
105
168
  const hasSelection = selectedCount > 0;
106
169
  const allSelected = totalCount > 0 && selectedCount >= totalCount;
107
170
 
@@ -150,6 +213,7 @@ export function BulkActionBar({
150
213
  {/* Content: primary actions + More dropdown */}
151
214
  {primaryActions.map((action) => (
152
215
  <BarButton
216
+ labels={labels}
153
217
  key={action.key}
154
218
  action={action}
155
219
  disabled={!hasSelection}
@@ -193,6 +257,7 @@ export function BulkActionBar({
193
257
  className="mx-1.5 h-5 shrink-0 bg-border"
194
258
  />
195
259
  <BarButton
260
+ labels={labels}
196
261
  action={destructiveAction}
197
262
  disabled={!hasSelection}
198
263
  />
@@ -1,14 +1,11 @@
1
1
  import * as React from "react";
2
+ import { prefersReducedMotion } from "../motion/reduced-motion";
2
3
 
3
4
  /** Phones, plus short landscape viewports such as 844×390. */
4
5
  export const COMPACT_OVERLAY_QUERY = "(max-width: 639px), (max-height: 500px)";
5
6
 
6
- export function prefersReducedMotion(): boolean {
7
- return (
8
- typeof window !== "undefined" &&
9
- window.matchMedia("(prefers-reduced-motion: reduce)").matches
10
- );
11
- }
7
+ /** The root `MotionProvider reducedMotion` setting, then the OS query. */
8
+ export { prefersReducedMotion };
12
9
 
13
10
  export function useCompactOverlay(): boolean {
14
11
  const [compact, setCompact] = React.useState(false);
@@ -2,6 +2,7 @@ import * as React from "react";
2
2
  import type { ClassValue } from "clsx";
3
3
  import { cn } from "../utils/cn";
4
4
  import type { AccordionConfig } from "./accordion";
5
+ import type { BulkActionBarConfig } from "./bulk-action-bar";
5
6
  import type { ActivityQuestionCardConfig } from "../ai-elements/activity-question";
6
7
  import type { ActivityTasksConfig } from "../ai-elements/activity-shared";
7
8
  import type { ArtifactConfig } from "../ai-elements/artifact";
@@ -82,6 +83,7 @@ export interface UiConfig {
82
83
  Artifact?: ArtifactConfig;
83
84
  Attachments?: AttachmentsConfig;
84
85
  Badge?: BadgeConfig;
86
+ BulkActionBar?: BulkActionBarConfig;
85
87
  Button?: ButtonConfig;
86
88
  ButtonGroup?: ButtonGroupConfig;
87
89
  Calendar?: CalendarConfig;
@@ -106,22 +106,35 @@
106
106
  }
107
107
  }
108
108
 
109
+ /*
110
+ * Reduced motion follows the root `MotionProvider reducedMotion` setting
111
+ * (`html[data-reduced-motion]`): the OS query unless it is `"never"`, and
112
+ * always when it is `"always"`.
113
+ */
109
114
  @media (prefers-reduced-motion: reduce) {
110
- .ui-page-enter,
111
- .ui-enter,
112
- .ui-enter-up,
113
- .ui-stagger > * {
115
+ html:not([data-reduced-motion="never"]) :is(.ui-page-enter, .ui-enter, .ui-enter-up, .ui-stagger > *) {
114
116
  animation-duration: 1ms;
115
117
  animation-name: ui-fade-only;
116
118
  }
117
119
 
118
- ::view-transition-group(*),
119
- ::view-transition-old(*),
120
- ::view-transition-new(*) {
120
+ html:not([data-reduced-motion="never"])::view-transition-group(*),
121
+ html:not([data-reduced-motion="never"])::view-transition-old(*),
122
+ html:not([data-reduced-motion="never"])::view-transition-new(*) {
121
123
  animation: none !important;
122
124
  }
123
125
  }
124
126
 
127
+ html[data-reduced-motion="always"] :is(.ui-page-enter, .ui-enter, .ui-enter-up, .ui-stagger > *) {
128
+ animation-duration: 1ms;
129
+ animation-name: ui-fade-only;
130
+ }
131
+
132
+ html[data-reduced-motion="always"]::view-transition-group(*),
133
+ html[data-reduced-motion="always"]::view-transition-old(*),
134
+ html[data-reduced-motion="always"]::view-transition-new(*) {
135
+ animation: none !important;
136
+ }
137
+
125
138
  /*
126
139
  * PageMotionProvider `disabled` sets `html[data-page-motion="off"]`. Page and
127
140
  * route enters, list stagger, `animate-in` / `animate-out`, the modal and
@@ -10,6 +10,20 @@
10
10
  * --motion-ease-emphasized: cubic-bezier(0.2, 0.8, 0.2, 1)
11
11
  */
12
12
 
13
+ /* `motion-reduce:` follows the root `MotionProvider reducedMotion` setting
14
+ (`html[data-reduced-motion]`), not only the OS: `"never"` turns it off,
15
+ `"always"` turns it on, `"user"` (or no provider) keeps the media query. */
16
+ @custom-variant motion-reduce {
17
+ @media (prefers-reduced-motion: reduce) {
18
+ html:not([data-reduced-motion="never"]) & {
19
+ @slot;
20
+ }
21
+ }
22
+ html[data-reduced-motion="always"] & {
23
+ @slot;
24
+ }
25
+ }
26
+
13
27
  /* Extends sub-40px controls to a 40x40px tap target without changing layout.
14
28
  Only force `relative` when the element is otherwise static: absolute /
15
29
  fixed / sticky already form a containing block for ::after. */