@wix/editor-react-components 1.2657.0 → 1.2659.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.
@@ -1,3 +1,4 @@
1
+ import { Direction } from '@wix/editor-react-types';
1
2
  import { FC, RefObject } from 'react';
2
3
  type PauseButtonProps = {
3
4
  testId?: string;
@@ -6,6 +7,7 @@ type PauseButtonProps = {
6
7
  pauseAriaLabel?: string;
7
8
  resumeAriaLabel?: string;
8
9
  ariaControls?: string;
10
+ direction?: Direction;
9
11
  onPause?: () => void;
10
12
  onResume?: () => void;
11
13
  buttonRef?: RefObject<HTMLButtonElement>;
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { Direction, A11y } from '@wix/editor-react-types';
3
- import { IndicatorMode } from './types';
3
+ import { IndicatorMode, PauseButtonVisibility } from './types';
4
4
  import { ButtonProps } from '../Button/Button';
5
5
  import { SdkFunctionClickableProps, SdkFunctionMouseHoverProps } from '../../../utils/functions/sdkFunctionCallbackProps';
6
6
  export type SlideIndicatorsElementProps = {
@@ -27,7 +27,9 @@ type SlideshowDataProps = SdkFunctionClickableProps & SdkFunctionMouseHoverProps
27
27
  activeSlide?: number;
28
28
  direction?: Direction;
29
29
  elementProps?: SlideshowElementProps;
30
+ /** @deprecated use pauseButtonVisibility instead */
30
31
  showPauseButton?: boolean;
32
+ pauseButtonVisibility?: PauseButtonVisibility;
31
33
  a11y?: A11y;
32
34
  onChange?: (event?: React.SyntheticEvent) => void;
33
35
  onPlay?: () => void;
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { useState, useRef, useEffect, useCallback, useMemo } from "react";
3
3
  import { c as clsx } from "../chunks/clsx.js";
4
- import { M as MOVEMENT_DIRECTION, A as AUTOPLAY_STATE, s as slideshowDataDefaults, a as semanticClassNames, b as ARIA_LABEL_NAMESPACE, S as SLIDESHOW_SLIDE_LTR_DIRECTION_EXPERIMENT, D as DefaultTranslations, T as TranslationKeys } from "../chunks/Slideshow.semanticClassNames.js";
4
+ import { M as MOVEMENT_DIRECTION, A as AUTOPLAY_STATE, P as PAUSE_BUTTON_VISIBILITY, s as slideshowDataDefaults, a as semanticClassNames, b as ARIA_LABEL_NAMESPACE, S as SLIDESHOW_SLIDE_LTR_DIRECTION_EXPERIMENT, D as DefaultTranslations, T as TranslationKeys } from "../chunks/Slideshow.semanticClassNames.js";
5
5
  import { u as useHasDisplayedElement } from "../chunks/useHasDisplayedElement.js";
6
6
  import { B as Button } from "../chunks/Button.js";
7
7
  import { p as presetWrapperStyles } from "../chunks/presetWrapper.module.js";
@@ -121,7 +121,21 @@ const useVisibilityProps = (props) => {
121
121
  return {};
122
122
  }, [props.isHidden, props.hidden]);
123
123
  };
124
+ const getEffectivePauseButtonVisibility = ({
125
+ pauseButtonVisibility,
126
+ showPauseButton
127
+ }) => {
128
+ if (pauseButtonVisibility) {
129
+ return pauseButtonVisibility;
130
+ }
131
+ if (showPauseButton !== void 0) {
132
+ return showPauseButton ? PAUSE_BUTTON_VISIBILITY.ALWAYS : PAUSE_BUTTON_VISIBILITY.NEVER;
133
+ }
134
+ return slideshowDataDefaults.pauseButtonVisibility;
135
+ };
124
136
  const slideshowContainer = "slideshowContainer__HjS5a";
137
+ const pauseButtonOnHover = "pauseButtonOnHover__pNnSH";
138
+ const pauseButton = "pauseButton__Z1YBT";
125
139
  const slideshowWrapper = "slideshowWrapper__d5icE";
126
140
  const slide = "slide__r2Vp3";
127
141
  const active = "active__a4phe";
@@ -161,11 +175,12 @@ const modeMax5 = "modeMax5__lcwad";
161
175
  const distance1 = "distance1__dz5-d";
162
176
  const distance2 = "distance2__1bx8G";
163
177
  const indicatorButton = "indicatorButton__cC3tw";
164
- const pauseButton = "pauseButton__Z1YBT";
165
178
  const controlsWrapper = "controlsWrapper__Hm0pN";
166
179
  const controlsWrapperContent = "controlsWrapperContent__4zh-j";
167
180
  const styles = {
168
181
  slideshowContainer,
182
+ pauseButtonOnHover,
183
+ pauseButton,
169
184
  slideshowWrapper,
170
185
  slide,
171
186
  active,
@@ -212,7 +227,6 @@ const styles = {
212
227
  distance1,
213
228
  distance2,
214
229
  indicatorButton,
215
- pauseButton,
216
230
  controlsWrapper,
217
231
  controlsWrapperContent
218
232
  };
@@ -502,6 +516,7 @@ const PauseButton = ({
502
516
  pauseAriaLabel,
503
517
  resumeAriaLabel,
504
518
  ariaControls,
519
+ direction,
505
520
  onPause = () => {
506
521
  },
507
522
  onResume = () => {
@@ -521,6 +536,7 @@ const PauseButton = ({
521
536
  type: "button",
522
537
  "aria-label": isPaused ? resumeAriaLabel : pauseAriaLabel,
523
538
  "aria-controls": ariaControls,
539
+ ...direction && { dir: direction },
524
540
  onClick: handleStateChange,
525
541
  children: isPaused ? /* @__PURE__ */ jsx(PlayIcon, {}) : /* @__PURE__ */ jsx(PauseIcon, {})
526
542
  }
@@ -549,7 +565,8 @@ const Slideshow = (props) => {
549
565
  isHidden,
550
566
  hidden,
551
567
  direction,
552
- showPauseButton = slideshowDataDefaults.showPauseButton,
568
+ showPauseButton,
569
+ pauseButtonVisibility,
553
570
  rawAutoplay = true,
554
571
  a11y,
555
572
  nextButtonLabel,
@@ -589,7 +606,11 @@ const Slideshow = (props) => {
589
606
  useEffect(() => {
590
607
  setIsPaused(reducedMotion);
591
608
  }, [reducedMotion]);
592
- const shouldShowPauseButton = rawAutoplay && (showPauseButton || autoplay && forcePauseButton);
609
+ const effectivePauseButtonVisibility = getEffectivePauseButtonVisibility({
610
+ pauseButtonVisibility,
611
+ showPauseButton
612
+ });
613
+ const shouldShowPauseButton = rawAutoplay && (effectivePauseButtonVisibility !== PAUSE_BUTTON_VISIBILITY.NEVER || autoplay && forcePauseButton);
593
614
  const {
594
615
  activeSlideIndex,
595
616
  lastActiveSlideIndex,
@@ -692,7 +713,8 @@ const Slideshow = (props) => {
692
713
  className,
693
714
  styles.slideshowContainer,
694
715
  semanticClassNames.root,
695
- directionStyles.fallbackDirection
716
+ directionStyles.fallbackDirection,
717
+ effectivePauseButtonVisibility === PAUSE_BUTTON_VISIBILITY.ON_HOVER && !forcePauseButton && styles.pauseButtonOnHover
696
718
  ),
697
719
  onFocus: pauseOnHover && autoplay ? handleFocusEnter : void 0,
698
720
  onBlur: pauseOnHover && autoplay ? handleFocusLeave : void 0,
@@ -788,7 +810,8 @@ const Slideshow = (props) => {
788
810
  pauseAriaLabel: t("pauseButton"),
789
811
  resumeAriaLabel: t("playButton"),
790
812
  className: semanticClassNames.pauseButton,
791
- ariaControls: id
813
+ ariaControls: id,
814
+ direction
792
815
  }
793
816
  )
794
817
  ]
@@ -1,3 +1,8 @@
1
+ export declare const PAUSE_BUTTON_VISIBILITY: {
2
+ readonly ALWAYS: "always";
3
+ readonly ON_HOVER: "onHover";
4
+ readonly NEVER: "never";
5
+ };
1
6
  export declare const DisplayNames: {
2
7
  readonly root: {
3
8
  readonly elementDisplayName: "Slideshow";
@@ -19,6 +24,7 @@ export declare const DisplayNames: {
19
24
  readonly slides: "Slide";
20
25
  readonly activeSlide: "Active slide";
21
26
  readonly showPauseButton: "Show pause & play button";
27
+ readonly pauseButtonVisibility: "Show pause & play button";
22
28
  readonly nextButtonLabel: "Next navigation button text";
23
29
  readonly prevButtonLabel: "Previous navigation button text";
24
30
  };
@@ -35,6 +41,7 @@ export declare const DisplayNames: {
35
41
  readonly 'navigation-buttons-alignment': "Navigation button alignment";
36
42
  readonly 'slide-indicators-position': "Slide indicator position";
37
43
  readonly 'controls-padding': "Padding";
44
+ readonly 'pause-button-position': "Pause & play button position";
38
45
  };
39
46
  };
40
47
  readonly transitionType: {
@@ -109,6 +116,21 @@ export declare const DisplayNames: {
109
116
  readonly all: "All";
110
117
  };
111
118
  };
119
+ readonly pauseButtonVisibility: {
120
+ readonly options: {
121
+ readonly always: "Always";
122
+ readonly onHover: "On hover";
123
+ readonly never: "Never";
124
+ };
125
+ };
126
+ readonly pauseButtonPosition: {
127
+ readonly options: {
128
+ readonly topStart: "Top start";
129
+ readonly topEnd: "Top end";
130
+ readonly bottomStart: "Bottom start";
131
+ readonly bottomEnd: "Bottom end";
132
+ };
133
+ };
112
134
  };
113
135
  export declare const slideshowDataDefaults: {
114
136
  readonly autoplay: true;
@@ -120,6 +142,7 @@ export declare const slideshowDataDefaults: {
120
142
  readonly activeSlide: 0;
121
143
  readonly transitionDuration: 0;
122
144
  readonly showPauseButton: true;
145
+ readonly pauseButtonVisibility: "always";
123
146
  readonly nextButtonLabel: "Next";
124
147
  readonly prevButtonLabel: "Previous";
125
148
  };
@@ -148,6 +171,7 @@ export declare const slideshowCssCustomPropertiesDefaults: {
148
171
  readonly 'navigation-buttons-alignment': "center";
149
172
  readonly 'slide-indicators-position': "end";
150
173
  readonly 'controls-padding': "0px";
174
+ readonly 'pause-button-position': "bottom-end";
151
175
  };
152
176
  export declare const orientationFields: readonly ["orientation"];
153
177
  export declare const navigationButtonsPositionFields: readonly ["navigation-buttons-position-together-horizontal", "navigation-buttons-position-together-vertical", "navigation-buttons-position-separated-horizontal", "navigation-buttons-position-separated-vertical"];
@@ -1,5 +1,10 @@
1
- @charset "UTF-8";.slideshowContainer__HjS5a {
1
+ @charset "UTF-8";@property --pause-button-position {
2
+ syntax: "*";
3
+ inherits: false;
4
+ }
5
+ .slideshowContainer__HjS5a {
2
6
  --display: grid;
7
+ container-name: slideshow;
3
8
  grid-template-columns: 1fr;
4
9
  grid-template-rows: 1fr;
5
10
  overflow: hidden;
@@ -9,6 +14,15 @@
9
14
  opacity: 1;
10
15
  }
11
16
 
17
+ .pauseButtonOnHover__pNnSH .pauseButton__Z1YBT {
18
+ opacity: 0;
19
+ pointer-events: none;
20
+ }
21
+ .pauseButtonOnHover__pNnSH:hover .pauseButton__Z1YBT, .pauseButtonOnHover__pNnSH:has(:focus-visible) .pauseButton__Z1YBT {
22
+ opacity: 1;
23
+ pointer-events: auto;
24
+ }
25
+
12
26
  .slideshowWrapper__d5icE {
13
27
  grid-area: 1/1;
14
28
  position: relative;
@@ -436,6 +450,38 @@
436
450
  outline-offset: 1px;
437
451
  }
438
452
 
453
+ @container slideshow style(--pause-button-position: top-start) {
454
+ .pauseButton__Z1YBT {
455
+ inset-block-start: 0;
456
+ inset-block-end: auto;
457
+ inset-inline-start: 0;
458
+ inset-inline-end: auto;
459
+ }
460
+ }
461
+ @container slideshow style(--pause-button-position: top-end) {
462
+ .pauseButton__Z1YBT {
463
+ inset-block-start: 0;
464
+ inset-block-end: auto;
465
+ inset-inline-start: auto;
466
+ inset-inline-end: 0;
467
+ }
468
+ }
469
+ @container slideshow style(--pause-button-position: bottom-start) {
470
+ .pauseButton__Z1YBT {
471
+ inset-block-start: auto;
472
+ inset-block-end: 0;
473
+ inset-inline-start: 0;
474
+ inset-inline-end: auto;
475
+ }
476
+ }
477
+ @container slideshow style(--pause-button-position: bottom-end) {
478
+ .pauseButton__Z1YBT {
479
+ inset-block-start: auto;
480
+ inset-block-end: 0;
481
+ inset-inline-start: auto;
482
+ inset-inline-end: 0;
483
+ }
484
+ }
439
485
  .controlsWrapper__Hm0pN {
440
486
  height: 100%;
441
487
  width: 100%;
@@ -305,7 +305,28 @@ const manifest = {
305
305
  showPauseButton: {
306
306
  dataType: DATA.DATA_TYPE.booleanValue,
307
307
  displayName: DisplayNames.root.data.showPauseButton,
308
- defaultValue: slideshowDataDefaults.showPauseButton
308
+ defaultValue: slideshowDataDefaults.showPauseButton,
309
+ deprecated: true
310
+ },
311
+ pauseButtonVisibility: {
312
+ dataType: DATA.DATA_TYPE.textEnum,
313
+ displayName: DisplayNames.root.data.pauseButtonVisibility,
314
+ [DATA.DATA_TYPE.textEnum]: {
315
+ options: [
316
+ {
317
+ value: "always",
318
+ displayName: DisplayNames.pauseButtonVisibility.options.always
319
+ },
320
+ {
321
+ value: "onHover",
322
+ displayName: DisplayNames.pauseButtonVisibility.options.onHover
323
+ },
324
+ {
325
+ value: "never",
326
+ displayName: DisplayNames.pauseButtonVisibility.options.never
327
+ }
328
+ ]
329
+ }
309
330
  },
310
331
  nextButtonLabel: {
311
332
  dataType: DATA.DATA_TYPE.text,
@@ -331,7 +352,7 @@ const manifest = {
331
352
  "loop",
332
353
  "autoplayDelay",
333
354
  "pauseOnHover",
334
- "showPauseButton",
355
+ "pauseButtonVisibility",
335
356
  "transitionType",
336
357
  "transitionDirection",
337
358
  "slides",
@@ -982,6 +1003,32 @@ const manifest = {
982
1003
  cssPropertyType: CSS_PROPERTIES.CSS_PROPERTY_TYPE.padding,
983
1004
  displayName: DisplayNames.root.cssCustomProperties["controls-padding"],
984
1005
  defaultValue: slideshowCssCustomPropertiesDefaults["controls-padding"]
1006
+ },
1007
+ "pause-button-position": {
1008
+ cssPropertyType: CSS_PROPERTIES.CSS_PROPERTY_TYPE.customEnum,
1009
+ displayName: DisplayNames.root.cssCustomProperties["pause-button-position"],
1010
+ defaultValue: slideshowCssCustomPropertiesDefaults["pause-button-position"],
1011
+ customEnum: {
1012
+ cssPropertyType: CSS_PROPERTIES.CSS_PROPERTY_TYPE.string,
1013
+ options: [
1014
+ {
1015
+ value: "top-start",
1016
+ displayName: DisplayNames.pauseButtonPosition.options.topStart
1017
+ },
1018
+ {
1019
+ value: "top-end",
1020
+ displayName: DisplayNames.pauseButtonPosition.options.topEnd
1021
+ },
1022
+ {
1023
+ value: "bottom-start",
1024
+ displayName: DisplayNames.pauseButtonPosition.options.bottomStart
1025
+ },
1026
+ {
1027
+ value: "bottom-end",
1028
+ displayName: DisplayNames.pauseButtonPosition.options.bottomEnd
1029
+ }
1030
+ ]
1031
+ }
985
1032
  }
986
1033
  },
987
1034
  interactions: {
@@ -1,4 +1,5 @@
1
- import { AUTOPLAY_STATE, MOVEMENT_DIRECTION } from './constants';
1
+ import { AUTOPLAY_STATE, MOVEMENT_DIRECTION, PAUSE_BUTTON_VISIBILITY } from './constants';
2
2
  export type AutoplayState = (typeof AUTOPLAY_STATE)[keyof typeof AUTOPLAY_STATE];
3
3
  export type MovementDirection = (typeof MOVEMENT_DIRECTION)[keyof typeof MOVEMENT_DIRECTION];
4
+ export type PauseButtonVisibility = (typeof PAUSE_BUTTON_VISIBILITY)[keyof typeof PAUSE_BUTTON_VISIBILITY];
4
5
  export type IndicatorMode = 'max-5' | 'all';
@@ -0,0 +1,5 @@
1
+ import { PauseButtonVisibility } from './types';
2
+ export declare const getEffectivePauseButtonVisibility: ({ pauseButtonVisibility, showPauseButton, }: {
3
+ pauseButtonVisibility?: PauseButtonVisibility;
4
+ showPauseButton?: boolean;
5
+ }) => PauseButtonVisibility;
@@ -1,3 +1,8 @@
1
+ const PAUSE_BUTTON_VISIBILITY = {
2
+ ALWAYS: "always",
3
+ ON_HOVER: "onHover",
4
+ NEVER: "never"
5
+ };
1
6
  const DisplayNames = {
2
7
  root: {
3
8
  elementDisplayName: "Slideshow",
@@ -19,6 +24,7 @@ const DisplayNames = {
19
24
  slides: "Slide",
20
25
  activeSlide: "Active slide",
21
26
  showPauseButton: "Show pause & play button",
27
+ pauseButtonVisibility: "Show pause & play button",
22
28
  nextButtonLabel: "Next navigation button text",
23
29
  prevButtonLabel: "Previous navigation button text"
24
30
  },
@@ -33,7 +39,8 @@ const DisplayNames = {
33
39
  "navigation-buttons-arrangement": "Navigation button arrangement",
34
40
  "navigation-buttons-alignment": "Navigation button alignment",
35
41
  "slide-indicators-position": "Slide indicator position",
36
- "controls-padding": "Padding"
42
+ "controls-padding": "Padding",
43
+ "pause-button-position": "Pause & play button position"
37
44
  }
38
45
  },
39
46
  transitionType: {
@@ -104,6 +111,21 @@ const DisplayNames = {
104
111
  max5: "Max 5",
105
112
  all: "All"
106
113
  }
114
+ },
115
+ pauseButtonVisibility: {
116
+ options: {
117
+ always: "Always",
118
+ onHover: "On hover",
119
+ never: "Never"
120
+ }
121
+ },
122
+ pauseButtonPosition: {
123
+ options: {
124
+ topStart: "Top start",
125
+ topEnd: "Top end",
126
+ bottomStart: "Bottom start",
127
+ bottomEnd: "Bottom end"
128
+ }
107
129
  }
108
130
  };
109
131
  const slideshowDataDefaults = {
@@ -116,6 +138,7 @@ const slideshowDataDefaults = {
116
138
  activeSlide: 0,
117
139
  transitionDuration: 0,
118
140
  showPauseButton: true,
141
+ pauseButtonVisibility: PAUSE_BUTTON_VISIBILITY.ALWAYS,
119
142
  nextButtonLabel: "Next",
120
143
  prevButtonLabel: "Previous"
121
144
  };
@@ -131,7 +154,8 @@ const slideshowCssCustomPropertiesDefaults = {
131
154
  "icon-placement-vertical": "vertically-stacked",
132
155
  "navigation-buttons-arrangement": "separated",
133
156
  "navigation-buttons-alignment": "center",
134
- "controls-padding": "0px"
157
+ "controls-padding": "0px",
158
+ "pause-button-position": "bottom-end"
135
159
  };
136
160
  const ARIA_LABEL_NAMESPACE = "slideshow";
137
161
  const TranslationKeys = {
@@ -164,6 +188,7 @@ export {
164
188
  AUTOPLAY_STATE as A,
165
189
  DefaultTranslations as D,
166
190
  MOVEMENT_DIRECTION as M,
191
+ PAUSE_BUTTON_VISIBILITY as P,
167
192
  SLIDESHOW_SLIDE_LTR_DIRECTION_EXPERIMENT as S,
168
193
  TranslationKeys as T,
169
194
  semanticClassNames as a,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/editor-react-components",
3
- "version": "1.2657.0",
3
+ "version": "1.2659.0",
4
4
  "description": "React components for the Wix Editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -84,7 +84,7 @@
84
84
  "@wix/site-service-business-logger": "^1.0.2",
85
85
  "@wix/site-service-configuration": "^1.0.1",
86
86
  "@wix/site-service-rendering-context": "^1.0.1",
87
- "@wix/site-ui": "1.271.0",
87
+ "@wix/site-ui": "1.272.0",
88
88
  "@wix/video": "^1.106.0",
89
89
  "@wix/viewer-service-consent-policy": "^1.0.103",
90
90
  "@wix/web-bi-logger": "^2.1.29",
@@ -199,5 +199,5 @@
199
199
  "registry": "https://registry.npmjs.org/",
200
200
  "access": "public"
201
201
  },
202
- "falconPackageHash": "fb02b2c92875285518068d32b57be3735d55d0b85eeb224debe146ae"
202
+ "falconPackageHash": "964231dc10030a3fc76168e59d496d03e79fe1c2659f0d491ee25860"
203
203
  }