@coinbase/cds-web 8.44.1 → 8.45.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
@@ -8,6 +8,18 @@ All notable changes to this project will be documented in this file.
8
8
 
9
9
  <!-- template-start -->
10
10
 
11
+ ## 8.45.0 (2/12/2026 PST)
12
+
13
+ #### 🚀 Updates
14
+
15
+ - Add reduce motion support for Tray. [[#386](https://github.com/coinbase/cds/pull/386)]
16
+
17
+ ## 8.44.2 (2/10/2026 PST)
18
+
19
+ #### 🐞 Fixes
20
+
21
+ - Fix Tray drag elastic. [[#385](https://github.com/coinbase/cds/pull/385)]
22
+
11
23
  ## 8.44.1 (2/10/2026 PST)
12
24
 
13
25
  #### 🐞 Fixes
@@ -91,6 +91,11 @@ export type TrayBaseProps = {
91
91
  * @default true
92
92
  */
93
93
  restoreFocusOnUnmount?: boolean;
94
+ /**
95
+ * When true, the tray will use opacity animation instead of transform animation.
96
+ * This is useful for supporting reduced motion for accessibility.
97
+ */
98
+ reduceMotion?: boolean;
94
99
  /**
95
100
  * Sets an accessible label for the close button.
96
101
  * On web, maps to `aria-label` and defines a string value that labels an interactive element.
@@ -188,6 +193,11 @@ export declare const Tray: React.MemoExoticComponent<
188
193
  * @default true
189
194
  */
190
195
  restoreFocusOnUnmount?: boolean;
196
+ /**
197
+ * When true, the tray will use opacity animation instead of transform animation.
198
+ * This is useful for supporting reduced motion for accessibility.
199
+ */
200
+ reduceMotion?: boolean;
191
201
  /**
192
202
  * Sets an accessible label for the close button.
193
203
  * On web, maps to `aria-label` and defines a string value that labels an interactive element.
@@ -1 +1 @@
1
- {"version":3,"file":"Tray.d.ts","sourceRoot":"","sources":["../../../src/overlays/tray/Tray.tsx"],"names":[],"mappings":"AAAA,OAAO,KASN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAa,MAAM,sBAAsB,CAAC;AAoBlG,O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=
6
6
  import React, { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
7
7
  import { DISMISSAL_DRAG_THRESHOLD, DISMISSAL_VELOCITY_THRESHOLD } from '@coinbase/cds-common/animation/drawer';
8
8
  import { OverlayContentContext } from '@coinbase/cds-common/overlays/OverlayContentContext';
9
- import { domMax, LazyMotion, m as motion, useAnimate, useDragControls } from 'framer-motion';
9
+ import { domMax, LazyMotion, m as motion, MotionConfig, useAnimate, useDragControls } from 'framer-motion';
10
10
  import { IconButton } from '../../buttons';
11
11
  import { cx } from '../../cx';
12
12
  import { useDimensions } from '../../hooks/useDimensions';
@@ -108,6 +108,7 @@ export const Tray = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tray(_ref
108
108
  accessibilityLabelledBy,
109
109
  focusTabIndexElements,
110
110
  restoreFocusOnUnmount = true,
111
+ reduceMotion,
111
112
  closeAccessibilityLabel = 'Close',
112
113
  closeAccessibilityHint,
113
114
  styles,
@@ -144,16 +145,24 @@ export const Tray = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tray(_ref
144
145
  }, [onVisibilityChange]);
145
146
  const handleClose = useCallback(() => {
146
147
  if (!scope.current) return;
147
- animate(scope.current, isSideTray ? {
148
- x: pin === 'right' ? '100%' : '-100%'
149
- } : {
150
- y: pin === 'bottom' ? '100%' : '-100%'
151
- }, animationConfig.slideOut.transition).then(() => {
148
+ let finalAnimationValue;
149
+ if (reduceMotion) {
150
+ finalAnimationValue = {
151
+ opacity: 0
152
+ };
153
+ } else {
154
+ finalAnimationValue = isSideTray ? {
155
+ x: pin === 'right' ? '100%' : '-100%'
156
+ } : {
157
+ y: pin === 'bottom' ? '100%' : '-100%'
158
+ };
159
+ }
160
+ animate(scope.current, finalAnimationValue, animationConfig.slideOut.transition).then(() => {
152
161
  setIsOpen(false);
153
162
  onClose === null || onClose === void 0 || onClose();
154
163
  onCloseComplete === null || onCloseComplete === void 0 || onCloseComplete();
155
164
  });
156
- }, [animate, scope, isSideTray, pin, onClose, onCloseComplete]);
165
+ }, [animate, scope, isSideTray, pin, onClose, onCloseComplete, reduceMotion]);
157
166
  const handleSwipeClose = useCallback(() => {
158
167
  if (!scope.current) return;
159
168
  animate(scope.current, {
@@ -195,16 +204,30 @@ export const Tray = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tray(_ref
195
204
  });
196
205
  }
197
206
  }, [trayHeight, handleSwipeClose, animate, scope]);
198
- const initialAnimationValue = useMemo(() => isSideTray ? {
199
- x: pin === 'right' ? '100%' : '-100%'
200
- } : {
201
- y: pin === 'bottom' ? '100%' : '-100%'
202
- }, [isSideTray, pin]);
203
- const animateValue = useMemo(() => isSideTray ? {
204
- x: 0
205
- } : {
206
- y: 0
207
- }, [isSideTray]);
207
+ const initialAnimationValue = useMemo(() => {
208
+ if (reduceMotion) {
209
+ return {
210
+ opacity: 0
211
+ };
212
+ }
213
+ return isSideTray ? {
214
+ x: pin === 'right' ? '100%' : '-100%'
215
+ } : {
216
+ y: pin === 'bottom' ? '100%' : '-100%'
217
+ };
218
+ }, [isSideTray, pin, reduceMotion]);
219
+ const animateValue = useMemo(() => {
220
+ if (reduceMotion) {
221
+ return {
222
+ opacity: 1
223
+ };
224
+ }
225
+ return isSideTray ? {
226
+ x: 0
227
+ } : {
228
+ y: 0
229
+ };
230
+ }, [isSideTray, reduceMotion]);
208
231
 
209
232
  // Handle bar only shows for bottom-pinned trays (matching mobile behavior)
210
233
  const shouldShowHandleBar = showHandleBar && pin === 'bottom';
@@ -263,120 +286,123 @@ export const Tray = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tray(_ref
263
286
  onClick: handleOverlayClick,
264
287
  style: styles === null || styles === void 0 ? void 0 : styles.overlay,
265
288
  testID: "tray-overlay"
266
- }), /*#__PURE__*/_jsx(DragMotionProvider, {
267
- enabled: !preventDismiss,
268
- children: /*#__PURE__*/_jsx(FocusTrap, {
269
- focusTabIndexElements: focusTabIndexElements,
270
- onEscPress: preventDismiss ? undefined : handleClose,
271
- restoreFocusOnUnmount: restoreFocusOnUnmount,
272
- children: /*#__PURE__*/_jsx(MotionVStack, {
273
- ref: scope,
274
- accessibilityLabel: accessibilityLabel,
275
- accessibilityLabelledBy: accessibilityLabelledBy,
276
- animate: animateValue,
277
- "aria-modal": "true",
278
- bordered: theme.activeColorScheme === 'dark',
279
- className: cx(trayContainerBaseCss, trayContainerPinCss, trayClassNames.container, classNames === null || classNames === void 0 ? void 0 : classNames.container),
280
- "data-testid": "tray",
281
- drag: !preventDismiss ? 'y' : undefined,
282
- dragConstraints: {
283
- top: 0,
284
- bottom: 0
285
- },
286
- dragControls: dragControls,
287
- dragElastic: {
288
- top: 0.5,
289
- bottom: 0.5
290
- },
291
- dragListener: false,
292
- elevation: 2,
293
- id: id,
294
- initial: initialAnimationValue,
295
- onClick: e => e.stopPropagation(),
296
- onDragEnd: !preventDismiss ? handleDragEnd : undefined,
297
- pin: pin,
298
- role: role,
299
- style: _objectSpread({
300
- maxHeight: isSideTray ? undefined : verticalDrawerPercentageOfView,
301
- touchAction: !preventDismiss && pin === 'bottom' ? 'none' : undefined
302
- }, styles === null || styles === void 0 ? void 0 : styles.container),
303
- tabIndex: 0,
304
- transition: animationConfig.slideIn.transition,
305
- width: isSideTray ? 'min(400px, 100vw)' : undefined,
306
- children: /*#__PURE__*/_jsxs(VStack, {
307
- ref: observeTraySize,
308
- flexGrow: 1,
309
- maxWidth: isSideTray ? undefined : '70em',
310
- minHeight: 0,
311
- width: "100%",
312
- children: [(shouldShowTitle || headerContent || shouldShowHandleBar) && /*#__PURE__*/_jsxs(VStack, {
313
- className: cx(shouldShrinkPadding && trayHeaderBorderBaseCss, shouldShrinkPadding && hasScrolledDown && trayHeaderBorderVisibleCss, trayClassNames.header, classNames === null || classNames === void 0 ? void 0 : classNames.header),
314
- flexShrink: 0,
315
- overflow: "hidden",
316
- paddingBottom: shouldShrinkPadding ? 0.75 : 1,
317
- paddingTop: !shouldShrinkPadding ? 3 : shouldShowHandleBar ? 0 : isSideTray ? 4 : 2,
318
- style: styles === null || styles === void 0 ? void 0 : styles.header,
319
- children: [shouldShowHandleBar && (preventDismiss ? /*#__PURE__*/_jsx(HandleBar, {
320
- classNames: {
321
- root: cx(trayClassNames.handleBar, classNames === null || classNames === void 0 ? void 0 : classNames.handleBar),
322
- handle: cx(trayClassNames.handleBarHandle, classNames === null || classNames === void 0 ? void 0 : classNames.handleBarHandle)
323
- },
324
- styles: {
325
- root: styles === null || styles === void 0 ? void 0 : styles.handleBar,
326
- handle: styles === null || styles === void 0 ? void 0 : styles.handleBarHandle
327
- }
328
- }) : /*#__PURE__*/_jsx(HandleBar, {
329
- accessibilityHint: closeAccessibilityHint,
330
- accessibilityLabel: closeAccessibilityLabel,
331
- classNames: {
332
- root: cx(trayClassNames.handleBar, classNames === null || classNames === void 0 ? void 0 : classNames.handleBar),
333
- handle: cx(trayClassNames.handleBarHandle, classNames === null || classNames === void 0 ? void 0 : classNames.handleBarHandle)
334
- },
335
- onClose: handleClose,
336
- onPointerDown: e => {
337
- dragControls.start(e);
338
- },
339
- styles: {
340
- root: styles === null || styles === void 0 ? void 0 : styles.handleBar,
341
- handle: _objectSpread(_objectSpread({}, styles === null || styles === void 0 ? void 0 : styles.handleBarHandle), {}, {
342
- touchAction: 'none'
343
- })
344
- }
345
- })), shouldShowTitle && /*#__PURE__*/_jsxs(HStack, {
346
- alignItems: isSideTray ? 'flex-start' : 'center',
347
- justifyContent: title ? 'space-between' : 'flex-end',
348
- paddingX: horizontalPadding,
349
- children: [title && (typeof title === 'string' ? /*#__PURE__*/_jsx(Text, {
350
- className: cx(trayClassNames.title, classNames === null || classNames === void 0 ? void 0 : classNames.title),
351
- font: "title3",
352
- style: styles === null || styles === void 0 ? void 0 : styles.title,
353
- children: title
354
- }) : title), shouldShowCloseButton && /*#__PURE__*/_jsx(IconButton, {
355
- transparent: true,
356
- accessibilityHint: closeAccessibilityHint,
357
- accessibilityLabel: closeAccessibilityLabel,
358
- className: cx(trayClassNames.closeButton, classNames === null || classNames === void 0 ? void 0 : classNames.closeButton),
359
- margin: isSideTray ? -1.5 : undefined,
360
- name: "close",
361
- onClick: handleClose,
362
- style: styles === null || styles === void 0 ? void 0 : styles.closeButton,
363
- testID: "tray-close-button"
364
- })]
365
- }), headerContent]
366
- }), /*#__PURE__*/_jsx(VStack, {
367
- ref: contentRef,
368
- className: cx(trayClassNames.content, classNames === null || classNames === void 0 ? void 0 : classNames.content),
289
+ }), /*#__PURE__*/_jsx(MotionConfig, {
290
+ reducedMotion: reduceMotion ? 'always' : undefined,
291
+ children: /*#__PURE__*/_jsx(DragMotionProvider, {
292
+ enabled: !preventDismiss,
293
+ children: /*#__PURE__*/_jsx(FocusTrap, {
294
+ focusTabIndexElements: focusTabIndexElements,
295
+ onEscPress: preventDismiss ? undefined : handleClose,
296
+ restoreFocusOnUnmount: restoreFocusOnUnmount,
297
+ children: /*#__PURE__*/_jsx(MotionVStack, {
298
+ ref: scope,
299
+ accessibilityLabel: accessibilityLabel,
300
+ accessibilityLabelledBy: accessibilityLabelledBy,
301
+ animate: animateValue,
302
+ "aria-modal": "true",
303
+ bordered: theme.activeColorScheme === 'dark',
304
+ className: cx(trayContainerBaseCss, trayContainerPinCss, trayClassNames.container, classNames === null || classNames === void 0 ? void 0 : classNames.container),
305
+ "data-testid": "tray",
306
+ drag: !preventDismiss ? 'y' : undefined,
307
+ dragConstraints: {
308
+ top: 0,
309
+ bottom: 0
310
+ },
311
+ dragControls: dragControls,
312
+ dragElastic: {
313
+ top: 0,
314
+ bottom: 0.5
315
+ },
316
+ dragListener: false,
317
+ elevation: 2,
318
+ id: id,
319
+ initial: initialAnimationValue,
320
+ onClick: e => e.stopPropagation(),
321
+ onDragEnd: !preventDismiss ? handleDragEnd : undefined,
322
+ pin: pin,
323
+ role: role,
324
+ style: _objectSpread({
325
+ maxHeight: isSideTray ? undefined : verticalDrawerPercentageOfView,
326
+ touchAction: !preventDismiss && pin === 'bottom' ? 'none' : undefined
327
+ }, styles === null || styles === void 0 ? void 0 : styles.container),
328
+ tabIndex: 0,
329
+ transition: animationConfig.slideIn.transition,
330
+ width: isSideTray ? 'min(400px, 100vw)' : undefined,
331
+ children: /*#__PURE__*/_jsxs(VStack, {
332
+ ref: observeTraySize,
369
333
  flexGrow: 1,
334
+ maxWidth: isSideTray ? undefined : '70em',
370
335
  minHeight: 0,
371
- overflow: "hidden",
372
- paddingBottom: shouldShrinkPadding ? 0 : 2,
373
- paddingTop: shouldShrinkPadding ? 0 : 1,
374
- paddingX: horizontalPadding,
375
- style: _objectSpread({
376
- overflowY: 'auto'
377
- }, styles === null || styles === void 0 ? void 0 : styles.content),
378
- children: content
379
- }), footerContent]
336
+ width: "100%",
337
+ children: [(shouldShowTitle || headerContent || shouldShowHandleBar) && /*#__PURE__*/_jsxs(VStack, {
338
+ className: cx(shouldShrinkPadding && trayHeaderBorderBaseCss, shouldShrinkPadding && hasScrolledDown && trayHeaderBorderVisibleCss, trayClassNames.header, classNames === null || classNames === void 0 ? void 0 : classNames.header),
339
+ flexShrink: 0,
340
+ overflow: "hidden",
341
+ paddingBottom: shouldShrinkPadding ? 0.75 : 1,
342
+ paddingTop: !shouldShrinkPadding ? 3 : shouldShowHandleBar ? 0 : isSideTray ? 4 : 2,
343
+ style: styles === null || styles === void 0 ? void 0 : styles.header,
344
+ children: [shouldShowHandleBar && (preventDismiss ? /*#__PURE__*/_jsx(HandleBar, {
345
+ classNames: {
346
+ root: cx(trayClassNames.handleBar, classNames === null || classNames === void 0 ? void 0 : classNames.handleBar),
347
+ handle: cx(trayClassNames.handleBarHandle, classNames === null || classNames === void 0 ? void 0 : classNames.handleBarHandle)
348
+ },
349
+ styles: {
350
+ root: styles === null || styles === void 0 ? void 0 : styles.handleBar,
351
+ handle: styles === null || styles === void 0 ? void 0 : styles.handleBarHandle
352
+ }
353
+ }) : /*#__PURE__*/_jsx(HandleBar, {
354
+ accessibilityHint: closeAccessibilityHint,
355
+ accessibilityLabel: closeAccessibilityLabel,
356
+ classNames: {
357
+ root: cx(trayClassNames.handleBar, classNames === null || classNames === void 0 ? void 0 : classNames.handleBar),
358
+ handle: cx(trayClassNames.handleBarHandle, classNames === null || classNames === void 0 ? void 0 : classNames.handleBarHandle)
359
+ },
360
+ onClose: handleClose,
361
+ onPointerDown: e => {
362
+ dragControls.start(e);
363
+ },
364
+ styles: {
365
+ root: styles === null || styles === void 0 ? void 0 : styles.handleBar,
366
+ handle: _objectSpread(_objectSpread({}, styles === null || styles === void 0 ? void 0 : styles.handleBarHandle), {}, {
367
+ touchAction: 'none'
368
+ })
369
+ }
370
+ })), shouldShowTitle && /*#__PURE__*/_jsxs(HStack, {
371
+ alignItems: isSideTray ? 'flex-start' : 'center',
372
+ justifyContent: title ? 'space-between' : 'flex-end',
373
+ paddingX: horizontalPadding,
374
+ children: [title && (typeof title === 'string' ? /*#__PURE__*/_jsx(Text, {
375
+ className: cx(trayClassNames.title, classNames === null || classNames === void 0 ? void 0 : classNames.title),
376
+ font: "title3",
377
+ style: styles === null || styles === void 0 ? void 0 : styles.title,
378
+ children: title
379
+ }) : title), shouldShowCloseButton && /*#__PURE__*/_jsx(IconButton, {
380
+ transparent: true,
381
+ accessibilityHint: closeAccessibilityHint,
382
+ accessibilityLabel: closeAccessibilityLabel,
383
+ className: cx(trayClassNames.closeButton, classNames === null || classNames === void 0 ? void 0 : classNames.closeButton),
384
+ margin: isSideTray ? -1.5 : undefined,
385
+ name: "close",
386
+ onClick: handleClose,
387
+ style: styles === null || styles === void 0 ? void 0 : styles.closeButton,
388
+ testID: "tray-close-button"
389
+ })]
390
+ }), headerContent]
391
+ }), /*#__PURE__*/_jsx(VStack, {
392
+ ref: contentRef,
393
+ className: cx(trayClassNames.content, classNames === null || classNames === void 0 ? void 0 : classNames.content),
394
+ flexGrow: 1,
395
+ minHeight: 0,
396
+ overflow: "hidden",
397
+ paddingBottom: shouldShrinkPadding ? 0 : 2,
398
+ paddingTop: shouldShrinkPadding ? 0 : 1,
399
+ paddingX: horizontalPadding,
400
+ style: _objectSpread({
401
+ overflowY: 'auto'
402
+ }, styles === null || styles === void 0 ? void 0 : styles.content),
403
+ children: content
404
+ }), footerContent]
405
+ })
380
406
  })
381
407
  })
382
408
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-web",
3
- "version": "8.44.1",
3
+ "version": "8.45.0",
4
4
  "description": "Coinbase Design System - Web",
5
5
  "repository": {
6
6
  "type": "git",
@@ -207,7 +207,7 @@
207
207
  "react-dom": "^18.3.1"
208
208
  },
209
209
  "dependencies": {
210
- "@coinbase/cds-common": "^8.44.1",
210
+ "@coinbase/cds-common": "^8.45.0",
211
211
  "@coinbase/cds-icons": "^5.11.0",
212
212
  "@coinbase/cds-illustrations": "^4.31.0",
213
213
  "@coinbase/cds-lottie-files": "^3.3.4",