@wix/editor-react-components 1.2480.0 → 1.2481.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.
@@ -3282,6 +3282,7 @@ function tvControllerFactory({
3282
3282
  };
3283
3283
  return controller;
3284
3284
  }
3285
+ const isActivationKey = (event) => event.key === " " || event.key === "Enter";
3285
3286
  function useTransparentVideo(props) {
3286
3287
  const {
3287
3288
  a11y,
@@ -3378,6 +3379,16 @@ function useTransparentVideo(props) {
3378
3379
  (_b = videoRef.current) == null ? void 0 : _b.play();
3379
3380
  }
3380
3381
  }, [playingState, isPlaying, shouldReplay]);
3382
+ const onKeyDownHandler = useCallback(
3383
+ (event) => {
3384
+ if (isActivationKey(event)) {
3385
+ event.stopPropagation();
3386
+ event.preventDefault();
3387
+ onClickHandler();
3388
+ }
3389
+ },
3390
+ [onClickHandler]
3391
+ );
3381
3392
  const onMouseEnterHandler = useCallback(() => {
3382
3393
  var _a;
3383
3394
  if (playingState === VideoPlayingState.ended && !shouldReplay) {
@@ -3400,6 +3411,16 @@ function useTransparentVideo(props) {
3400
3411
  },
3401
3412
  []
3402
3413
  );
3414
+ const onAudioToggleKeyDownHandler = useCallback(
3415
+ (event) => {
3416
+ if (isActivationKey(event)) {
3417
+ event.stopPropagation();
3418
+ event.preventDefault();
3419
+ setIsMuted((prev) => !prev);
3420
+ }
3421
+ },
3422
+ []
3423
+ );
3403
3424
  return {
3404
3425
  a11y,
3405
3426
  className,
@@ -3409,7 +3430,9 @@ function useTransparentVideo(props) {
3409
3430
  id,
3410
3431
  shouldMuteVideo,
3411
3432
  onAudioToggleClickHandler,
3433
+ onAudioToggleKeyDownHandler,
3412
3434
  onClickHandler,
3435
+ onKeyDownHandler,
3413
3436
  onMouseEnterHandler,
3414
3437
  onMouseOutHandler,
3415
3438
  shouldAutoplay,
@@ -3510,7 +3533,9 @@ function TransparentVideo(props) {
3510
3533
  isPlaying,
3511
3534
  shouldMuteVideo,
3512
3535
  onAudioToggleClickHandler,
3536
+ onAudioToggleKeyDownHandler,
3513
3537
  onClickHandler,
3538
+ onKeyDownHandler,
3514
3539
  onMouseEnterHandler,
3515
3540
  onMouseOutHandler,
3516
3541
  shouldAutoplay,
@@ -3538,7 +3563,10 @@ function TransparentVideo(props) {
3538
3563
  className: clsx(styles.mainWrapper, className, "wixui-transparent-video"),
3539
3564
  "data-has-alpha": "true",
3540
3565
  "data-playing": shouldAutoplay ? "" : void 0,
3566
+ tabIndex: 0,
3567
+ "aria-label": (a11y == null ? void 0 : a11y.ariaLabel) || void 0,
3541
3568
  onClick: onClickHandler,
3569
+ onKeyDown: onKeyDownHandler,
3542
3570
  onMouseEnter: onMouseEnterHandler,
3543
3571
  onMouseLeave: onMouseOutHandler,
3544
3572
  children: [
@@ -3584,7 +3612,11 @@ function TransparentVideo(props) {
3584
3612
  "div",
3585
3613
  {
3586
3614
  className: clsx(styles.audioToggle),
3615
+ tabIndex: 0,
3616
+ "aria-label": isMuted ? "Unmute video" : "Mute video",
3587
3617
  onClick: onAudioToggleClickHandler,
3618
+ onKeyDown: onAudioToggleKeyDownHandler,
3619
+ "data-testid": "audio-toggle",
3588
3620
  children: isMuted ? /* @__PURE__ */ jsx(MutedIcon, {}) : /* @__PURE__ */ jsx(UnMutedIcon, {})
3589
3621
  }
3590
3622
  ),
@@ -3592,6 +3624,10 @@ function TransparentVideo(props) {
3592
3624
  "div",
3593
3625
  {
3594
3626
  className: clsx(styles.playWrapper, { [styles.isShown]: !isPlaying }),
3627
+ tabIndex: 0,
3628
+ "aria-label": (a11y == null ? void 0 : a11y.ariaLabel) || void 0,
3629
+ onKeyDown: onKeyDownHandler,
3630
+ "data-testid": "play-button",
3595
3631
  children: isPlaying ? /* @__PURE__ */ jsx(PauseIcon, {}) : /* @__PURE__ */ jsx(PlayIcon, {})
3596
3632
  }
3597
3633
  )
@@ -12,6 +12,9 @@
12
12
  .mainWrapper__gc4Bd:hover .playWrapper__yH3ix svg {
13
13
  transform: scale(1.05);
14
14
  }
15
+ .mainWrapper__gc4Bd:focus-visible .playWrapper__yH3ix {
16
+ opacity: 1;
17
+ }
15
18
 
16
19
  .videoWrapper__e-kgj {
17
20
  width: 100%;
@@ -52,7 +55,7 @@
52
55
  opacity: 0;
53
56
  transition: opacity 500ms ease;
54
57
  }
55
- .playWrapper__yH3ix.isShown__QBpcz, .playWrapper__yH3ix:hover {
58
+ .playWrapper__yH3ix.isShown__QBpcz, .playWrapper__yH3ix:hover, .playWrapper__yH3ix:focus-visible {
56
59
  opacity: 1;
57
60
  }
58
61
  .playWrapper__yH3ix svg {
@@ -66,6 +69,9 @@
66
69
  bottom: 0;
67
70
  right: 0;
68
71
  }
72
+ .audioToggle__k2EqB:focus-visible {
73
+ opacity: 1;
74
+ }
69
75
 
70
76
  .filterEffectSvg__B9Lye {
71
77
  height: 0;
@@ -1,4 +1,4 @@
1
- import { MouseEvent } from 'react';
1
+ import { KeyboardEvent, MouseEvent } from 'react';
2
2
  import { TransparentVideoProps, VideoEndType } from './TransparentVideo.types';
3
3
  export declare function useTransparentVideo(props: TransparentVideoProps): {
4
4
  a11y: Pick<typeof import('@wix/ambassador-devcenter-v1-component-type-data/types').A11yAttributes, "ariaLabel"> | undefined;
@@ -9,7 +9,9 @@ export declare function useTransparentVideo(props: TransparentVideoProps): {
9
9
  id: string;
10
10
  shouldMuteVideo: boolean;
11
11
  onAudioToggleClickHandler: (event: MouseEvent<HTMLDivElement>) => void;
12
+ onAudioToggleKeyDownHandler: (event: KeyboardEvent<HTMLDivElement>) => void;
12
13
  onClickHandler: () => void;
14
+ onKeyDownHandler: (event: KeyboardEvent<HTMLDivElement>) => void;
13
15
  onMouseEnterHandler: () => void;
14
16
  onMouseOutHandler: () => void;
15
17
  shouldAutoplay: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/editor-react-components",
3
- "version": "1.2480.0",
3
+ "version": "1.2481.0",
4
4
  "description": "React components for the Wix Editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -197,5 +197,5 @@
197
197
  "registry": "https://registry.npmjs.org/",
198
198
  "access": "public"
199
199
  },
200
- "falconPackageHash": "69893529805957b9c1fc5462a9b8964610b9dfd35cd23a5d3de3dc4d"
200
+ "falconPackageHash": "bd03f80f2453c294fc1ddd539364db5cdc495b4518e54b05a5028acb"
201
201
  }