@wix/editor-react-components 1.2516.0 → 1.2518.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.
@@ -12,7 +12,7 @@ export interface AnimatedSvgProps {
12
12
  }
13
13
  export interface AnimatedIconBuilderProps {
14
14
  /** DOM `id` on the root element. */
15
- id: string;
15
+ id?: string;
16
16
  /** Hover animation length in seconds. Rewritten into every `<animate>` tag's `dur` attribute on render. Default `0.2`. */
17
17
  duration?: number;
18
18
  /** The active SVG (start ↔ end morph). At runtime only `svgContent` is read; the other `VectorArt` fields are passed through. */
@@ -2,8 +2,9 @@ import { default as React, PropsWithChildren } from 'react';
2
2
  import { MenuOrientationType, MenuAnimationNameType, DropdownAnimationNameType, Translations } from './constants';
3
3
  import { MenuItemProps as MenuItemData, ActiveAnchor } from '../../../types/vendored/editor-elements-definitions';
4
4
  import { IMenuItemSDKAction, IMenuItemsPropsSDKActions } from '../../../common/sdk/props-factories/menuItemsPropsSDKFactory';
5
- import { A11y, Direction } from '@wix/editor-react-types';
5
+ import { A11y, Direction, VectorArt } from '@wix/editor-react-types';
6
6
  import { ButtonProps } from '../Button/Button';
7
+ import { AnimatedSvgRef } from '../AnimatedIcon/types';
7
8
  import { SdkFunctionMouseHoverProps } from '../../../utils/functions/sdkFunctionCallbackProps';
8
9
  import { AnimationState } from './components/MenuContent/MenuItem/useAnimationState';
9
10
  export type MenuItemType = MenuItemData & {
@@ -26,6 +27,10 @@ export type MenuDropdownElementProps = {
26
27
  export type MenuNavbarElementProps = {
27
28
  item?: {
28
29
  className?: string;
30
+ elementProps?: {
31
+ animatedIcon?: AnimatedIconElementProps;
32
+ itemLabel?: ItemLabelElementProps;
33
+ };
29
34
  };
30
35
  scrollButton?: {
31
36
  className?: string;
@@ -35,6 +40,20 @@ export type MenuNavbarElementProps = {
35
40
  export type HamburgerMenuElementProps = {
36
41
  hamburgerCloseButton?: ButtonProps;
37
42
  };
43
+ export type BuilderAnimationIconProps = {
44
+ className?: string;
45
+ 'data-testid'?: string;
46
+ };
47
+ export type BuilderAnimationIconComponent = React.ForwardRefExoticComponent<BuilderAnimationIconProps & React.RefAttributes<AnimatedSvgRef>>;
48
+ export interface AnimatedIconElementProps {
49
+ svg?: VectorArt;
50
+ duration?: number;
51
+ svgLastAnimatedSelected?: VectorArt;
52
+ className?: string;
53
+ }
54
+ export interface ItemLabelElementProps {
55
+ className?: string;
56
+ }
38
57
  export type HamburgerMenuProps = {
39
58
  className?: string;
40
59
  isOpen?: boolean;
@@ -139,6 +158,7 @@ export type IMenuContentProps = Partial<IMenuItemsPropsSDKActions> & {
139
158
  submenuDirection?: Direction;
140
159
  submenuToggleIdPrefix?: string;
141
160
  menuElementProps?: MenuNavbarElementProps;
161
+ BuilderAnimationIcon?: BuilderAnimationIconComponent;
142
162
  };
143
163
  export type IMenuItemProps = Partial<IMenuItemsPropsSDKActions> & {
144
164
  item: PropsWithChildren<MenuItemData & {
@@ -152,6 +172,7 @@ export type IMenuItemProps = Partial<IMenuItemsPropsSDKActions> & {
152
172
  submenuDirection?: Direction;
153
173
  submenuToggleIdPrefix?: string;
154
174
  menuElementProps?: MenuNavbarElementProps;
175
+ BuilderAnimationIcon?: BuilderAnimationIconComponent;
155
176
  } & Translations;
156
177
  export type ScrollControlsProps = {
157
178
  isScrollForwardButtonShown: boolean;
@@ -5,7 +5,7 @@ import { U as UrlDefinition } from "../chunks/index12.js";
5
5
  import { d as defineService } from "../chunks/index8.js";
6
6
  import { T as TranslationsDefinition } from "../chunks/index6.js";
7
7
  import { M as MenuAnimationName, d as defaultTranslations, a as MenuOrientation, A as AnimationPhase, V as VerticalDropdownDisplay, D as DropdownAnimationName, H as HamburgerMenuAnimationName, b as MenuParts, s as selectors, c as DesignStates, u as useAnimationState, e as ARIA_LABEL_NAMESPACE, t as translationsKeys } from "../chunks/constants27.js";
8
- import React__default, { createContext, useContext, useRef, useCallback, useMemo, useState, useEffect, useLayoutEffect } from "react";
8
+ import React__default, { createContext, useContext, useRef, useCallback, useMemo, useState, useEffect, useLayoutEffect, forwardRef } from "react";
9
9
  import { p as presetWrapperStyles } from "../chunks/presetWrapper.module.js";
10
10
  import { g as getItemDepthSelector, r as rootItemDepthLevel, s as subItemDepthLevel, a as subSubItemDepthLevel } from "../chunks/utils3.js";
11
11
  import { d as debounce } from "../chunks/performanceUtils.js";
@@ -14,6 +14,7 @@ import { i as isEmptyObject, a as getDataAttributes } from "../chunks/dataUtils.
14
14
  import { u as useResizeObserver } from "../chunks/useResizeObserver.js";
15
15
  import { d as directionStyles } from "../chunks/direction.module.js";
16
16
  import { E as EnvironmentDefinition } from "../chunks/index2.js";
17
+ import AnimatedIconWithReducedMotion from "../AnimatedIcon/component.js";
17
18
  import { B as Button } from "../chunks/Button.js";
18
19
  import { f as convertA11yKeysToHtmlFormat } from "../chunks/a11y.js";
19
20
  const AnchorsDefinition = defineService("@wix/viewer-service-anchors");
@@ -374,6 +375,7 @@ const itemWrapper = "itemWrapper__sn71X";
374
375
  const labelContainer = "labelContainer__E4y-p";
375
376
  const label = "label__BBchK";
376
377
  const dropdownToggleButton = "dropdownToggleButton__nisoC";
378
+ const labelWrapper = "labelWrapper__u5Jgh";
377
379
  const horizontalDropdown = "horizontalDropdown__TETsA";
378
380
  const coverAllSpace = "coverAllSpace__Iwj6W";
379
381
  const srOnly = "srOnly__AGv2l";
@@ -393,6 +395,7 @@ const classes$6 = {
393
395
  labelContainer,
394
396
  label,
395
397
  dropdownToggleButton,
398
+ labelWrapper,
396
399
  horizontalDropdown,
397
400
  coverAllSpace,
398
401
  srOnly,
@@ -738,7 +741,105 @@ const MenuItemDropdownIcon = ({
738
741
  button
739
742
  ] }) : button;
740
743
  };
744
+ const SELECTION_ANIMATION_SETTLE_DELAY_MS = 0;
745
+ const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
746
+ function useIconAnimation({
747
+ BuilderAnimationIcon,
748
+ isCurrentPage,
749
+ isOpen,
750
+ onMouseEnter,
751
+ onMouseLeave
752
+ }) {
753
+ const iconAnimatedRef = useRef(null);
754
+ const isAnimatedForwardRef = useRef(null);
755
+ const prevIsImmediateRef = useRef(null);
756
+ const prevIsSelectedRef = useRef(null);
757
+ const pendingTimeoutRef = useRef(null);
758
+ const [isHovered, setIsHovered] = useState(false);
759
+ const onMouseEnterRef = useRef(onMouseEnter);
760
+ onMouseEnterRef.current = onMouseEnter;
761
+ const onMouseLeaveRef = useRef(onMouseLeave);
762
+ onMouseLeaveRef.current = onMouseLeave;
763
+ const cancelPending = useCallback(() => {
764
+ if (pendingTimeoutRef.current !== null) {
765
+ clearTimeout(pendingTimeoutRef.current);
766
+ pendingTimeoutRef.current = null;
767
+ }
768
+ }, []);
769
+ useIsomorphicLayoutEffect(() => {
770
+ var _a;
771
+ if (!BuilderAnimationIcon) {
772
+ cancelPending();
773
+ isAnimatedForwardRef.current = null;
774
+ prevIsImmediateRef.current = null;
775
+ prevIsSelectedRef.current = null;
776
+ return cancelPending;
777
+ }
778
+ const applyAnimation = (forward) => {
779
+ var _a2, _b;
780
+ isAnimatedForwardRef.current = forward;
781
+ if (forward) {
782
+ (_a2 = iconAnimatedRef.current) == null ? void 0 : _a2.runAnimationForward();
783
+ } else {
784
+ (_b = iconAnimatedRef.current) == null ? void 0 : _b.runAnimationBackward();
785
+ }
786
+ };
787
+ const isImmediate = isHovered || isOpen;
788
+ const isSelected = isCurrentPage;
789
+ const shouldBeForward = isImmediate || isSelected;
790
+ if (isAnimatedForwardRef.current === null) {
791
+ isAnimatedForwardRef.current = shouldBeForward;
792
+ prevIsImmediateRef.current = isImmediate;
793
+ prevIsSelectedRef.current = isSelected;
794
+ if (shouldBeForward) {
795
+ (_a = iconAnimatedRef.current) == null ? void 0 : _a.runAnimationForward();
796
+ }
797
+ return cancelPending;
798
+ }
799
+ if (prevIsImmediateRef.current !== isImmediate) {
800
+ prevIsImmediateRef.current = isImmediate;
801
+ cancelPending();
802
+ if (isAnimatedForwardRef.current !== shouldBeForward) {
803
+ applyAnimation(shouldBeForward);
804
+ }
805
+ return cancelPending;
806
+ }
807
+ if (prevIsSelectedRef.current === isSelected) {
808
+ cancelPending();
809
+ return cancelPending;
810
+ }
811
+ prevIsSelectedRef.current = isSelected;
812
+ if (isImmediate || isAnimatedForwardRef.current === shouldBeForward) {
813
+ cancelPending();
814
+ return cancelPending;
815
+ }
816
+ cancelPending();
817
+ pendingTimeoutRef.current = setTimeout(() => {
818
+ pendingTimeoutRef.current = null;
819
+ applyAnimation(isSelected);
820
+ }, SELECTION_ANIMATION_SETTLE_DELAY_MS);
821
+ return cancelPending;
822
+ }, [BuilderAnimationIcon, cancelPending, isCurrentPage, isHovered, isOpen]);
823
+ const handleMouseEnter = useCallback(
824
+ (event) => {
825
+ var _a;
826
+ setIsHovered(true);
827
+ (_a = onMouseEnterRef.current) == null ? void 0 : _a.call(onMouseEnterRef, event);
828
+ },
829
+ []
830
+ );
831
+ const handleMouseLeave = useCallback(
832
+ (event) => {
833
+ var _a;
834
+ setIsHovered(false);
835
+ (_a = onMouseLeaveRef.current) == null ? void 0 : _a.call(onMouseLeaveRef, event);
836
+ },
837
+ []
838
+ );
839
+ return { iconAnimatedRef, handleMouseEnter, handleMouseLeave };
840
+ }
741
841
  const MenuItemLabel = (props) => {
842
+ var _a, _b, _c, _d;
742
843
  const {
743
844
  item: item2,
744
845
  currentItem,
@@ -756,12 +857,14 @@ const MenuItemLabel = (props) => {
756
857
  isOpen,
757
858
  dropdownAnimationState,
758
859
  submenuToggleId,
759
- itemClassName
860
+ itemClassName,
861
+ BuilderAnimationIcon
760
862
  } = props;
761
863
  const isCurrentPage = isCurrentItem(item2, currentItem);
762
864
  const { label: label2, link } = item2;
763
865
  const hasLink = !isEmptyObject(link);
764
866
  const linkRef = useRef(null);
867
+ const itemLabelClassName = (_d = (_c = (_b = (_a = props.menuElementProps) == null ? void 0 : _a.item) == null ? void 0 : _b.elementProps) == null ? void 0 : _c.itemLabel) == null ? void 0 : _d.className;
765
868
  const labelContainerClassNames = clsx(
766
869
  selectors.item,
767
870
  classes$6.labelContainer,
@@ -770,6 +873,15 @@ const MenuItemLabel = (props) => {
770
873
  );
771
874
  const isInteractive = (hasSubItems || hasLink) && !isCurrentPage;
772
875
  const isDropdownIconOpen = isOpen && dropdownAnimationState.phase !== AnimationPhase.ExitActive;
876
+ const mouseEnterAction = createSDKAction(item2, isCurrentPage, onItemMouseIn);
877
+ const mouseLeaveAction = createSDKAction(item2, isCurrentPage, onItemMouseOut);
878
+ const { iconAnimatedRef, handleMouseEnter, handleMouseLeave } = useIconAnimation({
879
+ BuilderAnimationIcon,
880
+ isCurrentPage,
881
+ isOpen,
882
+ onMouseEnter: mouseEnterAction,
883
+ onMouseLeave: mouseLeaveAction
884
+ });
773
885
  return /* @__PURE__ */ jsxs(
774
886
  "div",
775
887
  {
@@ -779,8 +891,8 @@ const MenuItemLabel = (props) => {
779
891
  "data-preview": partToPreviewStateMap == null ? void 0 : partToPreviewStateMap.item,
780
892
  "data-interactive": isInteractive,
781
893
  onClick: createSDKAction(item2, isCurrentPage, onItemClick),
782
- onMouseEnter: createSDKAction(item2, isCurrentPage, onItemMouseIn),
783
- onMouseLeave: createSDKAction(item2, isCurrentPage, onItemMouseOut),
894
+ onMouseEnter: handleMouseEnter,
895
+ onMouseLeave: handleMouseLeave,
784
896
  onDoubleClick: createSDKAction(item2, isCurrentPage, onItemDblClick),
785
897
  children: [
786
898
  /* @__PURE__ */ jsx(
@@ -793,15 +905,35 @@ const MenuItemLabel = (props) => {
793
905
  ...isCurrentPage && {
794
906
  "aria-current": "page"
795
907
  },
796
- children: /* @__PURE__ */ jsx("div", { className: classes$6.label, "data-part": MenuParts.Label, children: label2 })
908
+ children: /* @__PURE__ */ jsxs("span", { className: classes$6.labelWrapper, children: [
909
+ BuilderAnimationIcon && /* @__PURE__ */ jsx(
910
+ BuilderAnimationIcon,
911
+ {
912
+ ref: iconAnimatedRef,
913
+ "data-testid": "menu-builder-animation-icon"
914
+ }
915
+ ),
916
+ /* @__PURE__ */ jsx(
917
+ "span",
918
+ {
919
+ className: clsx(
920
+ selectors.itemLabel,
921
+ classes$6.label,
922
+ itemLabelClassName
923
+ ),
924
+ "data-part": MenuParts.Label,
925
+ children: label2
926
+ }
927
+ )
928
+ ] })
797
929
  }
798
930
  ),
799
931
  hasDropdownMenu && ["default", "srOnly"].map((variant) => {
800
- var _a;
932
+ var _a2;
801
933
  return /* @__PURE__ */ jsx(
802
934
  MenuItemDropdownIcon,
803
935
  {
804
- ariaLabel: (_a = translations.dropdownButtonAriaLabel) == null ? void 0 : _a.replace(
936
+ ariaLabel: (_a2 = translations.dropdownButtonAriaLabel) == null ? void 0 : _a2.replace(
805
937
  "<%= itemName %>",
806
938
  label2
807
939
  ),
@@ -1783,7 +1915,8 @@ const MenuContent = (props) => {
1783
1915
  onItemClick,
1784
1916
  onItemDblClick,
1785
1917
  submenuToggleIdPrefix,
1786
- menuElementProps
1918
+ menuElementProps,
1919
+ BuilderAnimationIcon
1787
1920
  } = props;
1788
1921
  const {
1789
1922
  items,
@@ -1885,7 +2018,8 @@ const MenuContent = (props) => {
1885
2018
  getAnimationPackage,
1886
2019
  submenuDirection,
1887
2020
  submenuToggleIdPrefix,
1888
- menuElementProps
2021
+ menuElementProps,
2022
+ BuilderAnimationIcon
1889
2023
  },
1890
2024
  item2.id
1891
2025
  )) }),
@@ -1905,14 +2039,18 @@ const MenuContent = (props) => {
1905
2039
  ) });
1906
2040
  };
1907
2041
  const navbar$1 = "navbar__H6ySL";
2042
+ const itemIcon = "itemIcon__zQPE-";
1908
2043
  const rtl = "rtl__7sC1t";
1909
2044
  const ltr = "ltr__r9AkY";
1910
2045
  const classes$1 = {
1911
2046
  navbar: navbar$1,
2047
+ itemIcon,
1912
2048
  rtl,
1913
2049
  ltr
1914
2050
  };
2051
+ const DEFAULT_ANIMATED_ICON_DURATION = 0.2;
1915
2052
  const NavbarMenu = (props) => {
2053
+ var _a;
1916
2054
  const { getLanguageDirection } = useService(
1917
2055
  EnvironmentDefinition
1918
2056
  );
@@ -1921,13 +2059,39 @@ const NavbarMenu = (props) => {
1921
2059
  id,
1922
2060
  className,
1923
2061
  submenuDirection,
2062
+ elementProps,
1924
2063
  direction = siteDirection,
1925
2064
  onItemClick,
1926
2065
  onItemDblClick,
1927
2066
  onItemMouseIn,
1928
- onItemMouseOut,
1929
- elementProps
2067
+ onItemMouseOut
1930
2068
  } = props;
2069
+ const { item: item2 } = elementProps ?? {};
2070
+ const animatedIconProps = (_a = item2 == null ? void 0 : item2.elementProps) == null ? void 0 : _a.animatedIcon;
2071
+ const animatedIconPropsRef = useRef(animatedIconProps);
2072
+ animatedIconPropsRef.current = animatedIconProps;
2073
+ const BuilderAnimationIcon = useMemo(() => {
2074
+ const AnimatedIconWithProps = forwardRef(({ className: iconClassName, ...iconProps }, ref) => {
2075
+ var _a2, _b, _c;
2076
+ return /* @__PURE__ */ jsx(
2077
+ AnimatedIconWithReducedMotion,
2078
+ {
2079
+ ...iconProps,
2080
+ duration: ((_a2 = animatedIconPropsRef.current) == null ? void 0 : _a2.duration) ?? DEFAULT_ANIMATED_ICON_DURATION,
2081
+ svg: (_b = animatedIconPropsRef.current) == null ? void 0 : _b.svg,
2082
+ className: clsx(
2083
+ selectors.animatedIcon,
2084
+ classes$1.itemIcon,
2085
+ (_c = animatedIconPropsRef.current) == null ? void 0 : _c.className,
2086
+ iconClassName
2087
+ ),
2088
+ ref
2089
+ }
2090
+ );
2091
+ });
2092
+ AnimatedIconWithProps.displayName = "NavbarAnimatedIcon";
2093
+ return AnimatedIconWithProps;
2094
+ }, []);
1931
2095
  return /* @__PURE__ */ jsx(
1932
2096
  MenuContent,
1933
2097
  {
@@ -1942,6 +2106,7 @@ const NavbarMenu = (props) => {
1942
2106
  direction,
1943
2107
  submenuDirection,
1944
2108
  onItemClick,
2109
+ BuilderAnimationIcon: (animatedIconProps == null ? void 0 : animatedIconProps.svg) ? BuilderAnimationIcon : void 0,
1945
2110
  onItemDblClick,
1946
2111
  onItemMouseIn,
1947
2112
  onItemMouseOut,
@@ -0,0 +1,17 @@
1
+ import { default as React, RefObject } from 'react';
2
+ import { AnimatedSvgRef } from '../../../../AnimatedIcon/types';
3
+ import { BuilderAnimationIconComponent } from '../../../Menu.types';
4
+ type UseIconAnimationOptions = {
5
+ BuilderAnimationIcon: BuilderAnimationIconComponent | undefined;
6
+ isCurrentPage: boolean;
7
+ isOpen: boolean;
8
+ onMouseEnter?: (event: React.MouseEvent<HTMLDivElement>) => void;
9
+ onMouseLeave?: (event: React.MouseEvent<HTMLDivElement>) => void;
10
+ };
11
+ type UseIconAnimationResult = {
12
+ iconAnimatedRef: RefObject<AnimatedSvgRef>;
13
+ handleMouseEnter: (event: React.MouseEvent<HTMLDivElement>) => void;
14
+ handleMouseLeave: (event: React.MouseEvent<HTMLDivElement>) => void;
15
+ };
16
+ export declare function useIconAnimation({ BuilderAnimationIcon, isCurrentPage, isOpen, onMouseEnter, onMouseLeave, }: UseIconAnimationOptions): UseIconAnimationResult;
17
+ export {};
@@ -1,3 +1,4 @@
1
+ import { ACTIONS } from '@wix/component-protocol/schema';
1
2
  export declare const MenuOrientation: {
2
3
  readonly Horizontal: "horizontal";
3
4
  readonly Vertical: "vertical";
@@ -131,7 +132,10 @@ export declare const DisplayNames: {
131
132
  justifyContent: string;
132
133
  background: string;
133
134
  columnGap: string;
135
+ };
136
+ cssCustomProperties: {
134
137
  'item-icon-size': string;
138
+ 'item-icon-gap': string;
135
139
  };
136
140
  displayGroups: {
137
141
  iconGroup: string;
@@ -141,6 +145,12 @@ export declare const DisplayNames: {
141
145
  selected: string;
142
146
  };
143
147
  };
148
+ itemLabel: {
149
+ elementDisplayName: string;
150
+ };
151
+ itemIcon: {
152
+ elementDisplayName: string;
153
+ };
144
154
  dropdown: {
145
155
  elementDisplayName: string;
146
156
  cssCustomProperties: {
@@ -216,6 +226,10 @@ export declare const DisplayNames: {
216
226
  elementDisplayName: string;
217
227
  };
218
228
  };
229
+ export declare const menuBuiltInActions: {
230
+ readonly elements: typeof ACTIONS.ACTION_NAME.design;
231
+ };
232
+ export declare const MENU_ANIMATED_ICON_SPEC: "sp.erc.menuAnimatedIcon";
219
233
  export declare const selectors: {
220
234
  menu: string;
221
235
  navbar: string;
@@ -224,6 +238,8 @@ export declare const selectors: {
224
238
  dropdownItem: string;
225
239
  dropdownSubItem: string;
226
240
  scrollButton: string;
241
+ animatedIcon: string;
242
+ itemLabel: string;
227
243
  hamburgerMenu: string;
228
244
  hamburgerMenuContent: string;
229
245
  hamburgerMenuHeaderContent: string;
@@ -239,6 +255,8 @@ export declare const elementKeys: {
239
255
  subItem: string;
240
256
  scrollButton: string;
241
257
  dropdown: string;
258
+ animatedIcon: string;
259
+ itemLabel: string;
242
260
  };
243
261
  export declare const presets: {
244
262
  horizontalScrollNavbar: string;
@@ -73,7 +73,7 @@
73
73
  line-height: var(--item-line-height);
74
74
  }
75
75
  [data-open]:not([data-animation-state=exitActive]):not([data-animation-state=exitDone]) > .itemWrapper__sn71X > .labelContainer__E4y-p path, .labelContainer__E4y-p[data-interactive=true]:hover path, .labelContainer__E4y-p[data-preview=hover] path, .labelContainer__E4y-p.hover__tD6A4 path, .labelContainer__E4y-p.menu__item--hover path {
76
- fill: var(--item-hover-icon-color, var(--item-icon-color, currentcolor));
76
+ fill: var(--fill, var(--item-hover-icon-color, var(--item-icon-color, currentcolor)));
77
77
  }
78
78
  .labelContainer__E4y-p[data-selected], .labelContainer__E4y-p[data-preview=selected], .labelContainer__E4y-p.selected__qC-k6, .labelContainer__E4y-p.menu__item--selected {
79
79
  background: var(--item-selected-background, var(--item-background));
@@ -89,7 +89,7 @@
89
89
  line-height: var(--item-line-height);
90
90
  }
91
91
  .labelContainer__E4y-p[data-selected] path, .labelContainer__E4y-p[data-preview=selected] path, .labelContainer__E4y-p.selected__qC-k6 path, .labelContainer__E4y-p.menu__item--selected path {
92
- fill: var(--item-selected-icon-color, var(--item-icon-color, currentcolor));
92
+ fill: var(--fill, var(--item-selected-icon-color, var(--item-icon-color, currentcolor)));
93
93
  }
94
94
  .labelContainer__E4y-p > a::before {
95
95
  content: "";
@@ -131,6 +131,13 @@
131
131
  }
132
132
  }
133
133
 
134
+ .labelWrapper__u5Jgh {
135
+ display: flex;
136
+ align-items: center;
137
+ min-width: 0;
138
+ gap: var(--item-icon-gap, 0);
139
+ }
140
+
134
141
  @media (forced-colors: active) {
135
142
  .dropdownToggleButton__nisoC,
136
143
  .dropdownToggleButton__nisoC svg,
@@ -766,6 +773,12 @@
766
773
  --sr-only-item-icon-display: none;
767
774
  }
768
775
 
776
+ .itemIcon__zQPE- {
777
+ display: flex;
778
+ align-items: center;
779
+ flex-shrink: 0;
780
+ }
781
+
769
782
  .rtl__7sC1t {
770
783
  --scroll-button-transform: scaleX(-1);
771
784
  }
@@ -887,6 +900,30 @@
887
900
  .fallbackDirection__HeRgn:not([dir]) {
888
901
  direction: var(--wix-opt-in-direction);
889
902
  }
903
+ .animatedIcon__3o5ii {
904
+ --size: 16px;
905
+ --fill: #000000;
906
+ --rotation: 0deg;
907
+ }
908
+ .animatedIcon__3o5ii {
909
+ display: block;
910
+ width: inherit;
911
+ height: inherit;
912
+ width: var(--size);
913
+ height: var(--size);
914
+ }
915
+ .animatedIcon__3o5ii svg {
916
+ width: var(--size);
917
+ height: var(--size);
918
+ display: block;
919
+ fill: var(--fill);
920
+ transform: rotate(var(--rotation));
921
+ }
922
+ @media (forced-colors: active) {
923
+ .animatedIcon__3o5ii svg {
924
+ fill: currentColor;
925
+ }
926
+ }
890
927
  .rootDirection__PPhdq {
891
928
  direction: var(--btn-direction);
892
929
  }
@@ -1011,28 +1048,4 @@
1011
1048
 
1012
1049
  .button__i8gkO {
1013
1050
  min-width: min-content !important;
1014
- }
1015
- .animatedIcon__3o5ii {
1016
- --size: 16px;
1017
- --fill: #000000;
1018
- --rotation: 0deg;
1019
- }
1020
- .animatedIcon__3o5ii {
1021
- display: block;
1022
- width: inherit;
1023
- height: inherit;
1024
- width: var(--size);
1025
- height: var(--size);
1026
- }
1027
- .animatedIcon__3o5ii svg {
1028
- width: var(--size);
1029
- height: var(--size);
1030
- display: block;
1031
- fill: var(--fill);
1032
- transform: rotate(var(--rotation));
1033
- }
1034
- @media (forced-colors: active) {
1035
- .animatedIcon__3o5ii svg {
1036
- fill: currentColor;
1037
- }
1038
1051
  }
@@ -1,5 +1,5 @@
1
1
  import { E as ELEMENTS, C as CSS_PROPERTIES, b as DISPLAY_GROUPS, N as NativeStateType, a as ACTIONS, D as DATA, L as LAYOUT, I as INTERACTIONS, A as Archetype } from "../chunks/chunk-6KMOHX3X.js";
2
- import { c as DesignStates, f as DisplayNames, s as selectors, g as DropdownAnchorPositions, h as DropdownAppliedStyleProperties, i as elementKeys, j as states, p as presets } from "../chunks/constants27.js";
2
+ import { c as DesignStates, f as DisplayNames, s as selectors, g as DropdownAnchorPositions, h as DropdownAppliedStyleProperties, i as elementKeys, j as MENU_ANIMATED_ICON_SPEC, k as states, p as presets, m as menuBuiltInActions } from "../chunks/constants27.js";
3
3
  import { w as withSpec } from "../chunks/manifest.js";
4
4
  import { I as IS_SUPPORT_DESIGN_STATE_SPEC } from "../chunks/specs.js";
5
5
  import { c as manifestMouseHover } from "../chunks/manifestSdkMixins.js";
@@ -509,6 +509,53 @@ const scrollButtonConfig = {
509
509
  }
510
510
  }
511
511
  };
512
+ const animatedIconConfig = {
513
+ spec: MENU_ANIMATED_ICON_SPEC,
514
+ elementType: ELEMENTS.ELEMENT_TYPE.refElement,
515
+ [ELEMENTS.ELEMENT_TYPE.refElement]: {
516
+ displayName: DisplayNames.itemIcon.elementDisplayName,
517
+ selector: `.${selectors.animatedIcon}`,
518
+ type: "wixEditorElements.AnimatedIcon",
519
+ behaviors: {
520
+ selectable: false,
521
+ removable: true
522
+ },
523
+ cssProperties: {
524
+ display: {
525
+ defaultValue: CSS_PROPERTIES.DISPLAY_VALUE.none
526
+ }
527
+ }
528
+ }
529
+ };
530
+ const itemLabelDisplayConfig = {
531
+ displayValues: [
532
+ CSS_PROPERTIES.DISPLAY_VALUE.none,
533
+ CSS_PROPERTIES.DISPLAY_VALUE.flex
534
+ ]
535
+ };
536
+ const itemLabelConfig = {
537
+ elementType: ELEMENTS.ELEMENT_TYPE.inlineElement,
538
+ [ELEMENTS.ELEMENT_TYPE.inlineElement]: {
539
+ selector: `.${selectors.itemLabel}`,
540
+ displayName: DisplayNames.itemLabel.elementDisplayName,
541
+ behaviors: {
542
+ selectable: false,
543
+ removable: true
544
+ },
545
+ cssProperties: {
546
+ display: {
547
+ display: itemLabelDisplayConfig
548
+ },
549
+ font: { defaultValue: "14px sans-serif" },
550
+ color: { defaultValue: "rgba(0, 0, 0, 1)" },
551
+ textDecorationLine: { defaultValue: "none" },
552
+ textTransform: { defaultValue: "none" },
553
+ letterSpacing: { defaultValue: "normal" },
554
+ textShadow: { defaultValue: "none" },
555
+ textAlign: { defaultValue: "center" }
556
+ }
557
+ }
558
+ };
512
559
  const itemConfig = {
513
560
  elementType: ELEMENTS.ELEMENT_TYPE.inlineElement,
514
561
  [ELEMENTS.ELEMENT_TYPE.inlineElement]: {
@@ -569,14 +616,21 @@ const itemConfig = {
569
616
  }
570
617
  },
571
618
  cssCustomProperties: {
572
- // Icon
573
619
  "item-icon-size": {
574
- displayName: DisplayNames.item.cssProperties["item-icon-size"],
620
+ displayName: DisplayNames.item.cssCustomProperties["item-icon-size"],
575
621
  cssPropertyType: CSS_PROPERTIES.CSS_PROPERTY_TYPE.length
576
622
  },
577
623
  "item-icon-color": {
578
624
  cssPropertyType: CSS_PROPERTIES.CSS_PROPERTY_TYPE.color
625
+ },
626
+ "item-icon-gap": {
627
+ displayName: DisplayNames.item.cssCustomProperties["item-icon-gap"],
628
+ cssPropertyType: CSS_PROPERTIES.CSS_PROPERTY_TYPE.columnGap
579
629
  }
630
+ },
631
+ elements: {
632
+ [elementKeys.itemLabel]: itemLabelConfig,
633
+ [elementKeys.animatedIcon]: animatedIconConfig
580
634
  }
581
635
  }
582
636
  };
@@ -1217,6 +1271,15 @@ const manifest = {
1217
1271
  }
1218
1272
  }
1219
1273
  },
1274
+ elements: {
1275
+ execution: {
1276
+ actionType: ACTIONS.ACTION_TYPE.forward,
1277
+ forward: {
1278
+ elementPath: `.self.${elementKeys.navbar}.${elementKeys.item}`,
1279
+ actionName: menuBuiltInActions.elements
1280
+ }
1281
+ }
1282
+ },
1220
1283
  design: {
1221
1284
  displayName: DisplayNames.root.actions.design
1222
1285
  },
@@ -1240,7 +1303,7 @@ const manifest = {
1240
1303
  execution: {
1241
1304
  actionType: ACTIONS.ACTION_TYPE.forward,
1242
1305
  forward: {
1243
- elementPath: `.self.${elementKeys.hamburgerOpenButton}.animatedIcon`,
1306
+ elementPath: `.self.${elementKeys.navbar}.${elementKeys.item}.${elementKeys.animatedIcon}`,
1244
1307
  actionName: ACTIONS.ACTION_NAME.custom,
1245
1308
  custom: "animatedIcon"
1246
1309
  }
@@ -1379,6 +1442,7 @@ const manifest = {
1379
1442
  "@wix/viewer-service-url"
1380
1443
  ],
1381
1444
  dependencies: {
1445
+ componentDependencies: ["@wix/editor-react-components/AnimatedIcon"],
1382
1446
  serviceDependencies: [
1383
1447
  "@wix/viewer-service-anchors",
1384
1448
  "@wix/viewer-service-environment",
@@ -0,0 +1,2 @@
1
+ import { ElementItem } from '@wix/component-protocol/schema';
2
+ export declare const animatedIconConfig: ElementItem;
@@ -1,2 +1,5 @@
1
- import { ElementItem } from '@wix/component-protocol/schema';
1
+ import { ElementItem, CssPropertyItem } from '@wix/component-protocol/schema';
2
+ export declare const itemLabelDisplayConfig: CssPropertyItem["display"];
3
+ export declare const HIDDEN_ITEM_TEXT_CSS_PROPERTIES: readonly ["font", "color", "textDecorationLine", "textTransform", "letterSpacing", "textShadow"];
4
+ export declare const itemLabelConfig: ElementItem;
2
5
  export declare const itemConfig: ElementItem;
@@ -8,6 +8,8 @@ type HorizontalHugNavbarProps = {
8
8
  isDropdownAnchorScreen: boolean;
9
9
  isDropdownAnchorMenuItem: boolean;
10
10
  dropdownColumnsNumber: string;
11
+ hideItemIconGap: boolean;
12
+ isIconHidden: boolean;
11
13
  };
12
14
  export declare const getHorizontalHugNavbarManifestOverrides: (props: HorizontalHugNavbarProps) => Partial<EditorElement>;
13
15
  export {};
@@ -9,6 +9,8 @@ type HorizontalScrollNavbarProps = {
9
9
  isDropdownAnchorScreen: boolean;
10
10
  isDropdownAnchorMenuItem: boolean;
11
11
  dropdownColumnsNumber: string;
12
+ hideItemIconGap: boolean;
13
+ isIconHidden: boolean;
12
14
  };
13
15
  export declare const getHorizontalScrollNavbarManifestOverrides: (props: HorizontalScrollNavbarProps) => Partial<EditorElement>;
14
16
  export {};
@@ -7,6 +7,8 @@ export type VerticalNavbarProps = {
7
7
  isDropdownItemFitToText: boolean;
8
8
  dropdownColumnsNumber: string;
9
9
  isVerticalDropdownAlwaysOpen: boolean;
10
+ hideItemIconGap: boolean;
11
+ isIconHidden: boolean;
10
12
  };
11
- export declare const getVerticalNavbarElementManifestOverrides: ({ hasDropdownItems, hasDropdownContent, hasDropdownSubItems, isItemFitToText, isDropdownItemFitToText, dropdownColumnsNumber, }: VerticalNavbarProps) => ElementItem;
13
+ export declare const getVerticalNavbarElementManifestOverrides: ({ hasDropdownItems, hasDropdownContent, hasDropdownSubItems, isItemFitToText, isDropdownItemFitToText, dropdownColumnsNumber, hideItemIconGap, }: VerticalNavbarProps) => ElementItem;
12
14
  export declare const getVerticalNavbarManifestOverrides: (props: VerticalNavbarProps) => Partial<EditorElement>;
@@ -207,8 +207,11 @@ const DisplayNames = {
207
207
  cssProperties: {
208
208
  justifyContent: "Text alignment",
209
209
  background: "Background",
210
- columnGap: "Space between menu items and icons",
211
- "item-icon-size": "Size"
210
+ columnGap: "Space between items and chevrons"
211
+ },
212
+ cssCustomProperties: {
213
+ "item-icon-size": "Size",
214
+ "item-icon-gap": "Space between items and icons"
212
215
  },
213
216
  displayGroups: {
214
217
  iconGroup: "Icons"
@@ -218,6 +221,12 @@ const DisplayNames = {
218
221
  selected: "Selected"
219
222
  }
220
223
  },
224
+ itemLabel: {
225
+ elementDisplayName: "Item's text"
226
+ },
227
+ itemIcon: {
228
+ elementDisplayName: "Item's icon"
229
+ },
221
230
  dropdown: {
222
231
  elementDisplayName: "Dropdowns",
223
232
  cssCustomProperties: {
@@ -293,6 +302,10 @@ const DisplayNames = {
293
302
  elementDisplayName: "Close Button"
294
303
  }
295
304
  };
305
+ const menuBuiltInActions = {
306
+ elements: "elements"
307
+ };
308
+ const MENU_ANIMATED_ICON_SPEC = "sp.erc.menuAnimatedIcon";
296
309
  const selectors = {
297
310
  menu: "menu",
298
311
  navbar: "navbar",
@@ -301,6 +314,8 @@ const selectors = {
301
314
  dropdownItem: "dropdown-item",
302
315
  dropdownSubItem: "dropdown-sub-item",
303
316
  scrollButton: "scroll-button",
317
+ animatedIcon: "animated-icon",
318
+ itemLabel: "item-label",
304
319
  hamburgerMenu: "hamburger-menu",
305
320
  hamburgerMenuContent: "hamburger-menu-content",
306
321
  hamburgerMenuHeaderContent: "hamburger-menu-header-content",
@@ -315,7 +330,9 @@ const elementKeys = {
315
330
  item: "item",
316
331
  subItem: "subItem",
317
332
  scrollButton: "scrollButton",
318
- dropdown: "dropdown"
333
+ dropdown: "dropdown",
334
+ animatedIcon: "animatedIcon",
335
+ itemLabel: "itemLabel"
319
336
  };
320
337
  const presets = {
321
338
  horizontalScrollNavbar: "horizontalScrollNavbar",
@@ -418,7 +435,9 @@ export {
418
435
  DropdownAnchorPositions as g,
419
436
  DropdownAppliedStyleProperties as h,
420
437
  elementKeys as i,
421
- states as j,
438
+ MENU_ANIMATED_ICON_SPEC as j,
439
+ states as k,
440
+ menuBuiltInActions as m,
422
441
  presets as p,
423
442
  selectors as s,
424
443
  translationsKeys as t,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/editor-react-components",
3
- "version": "1.2516.0",
3
+ "version": "1.2518.0",
4
4
  "description": "React components for the Wix Editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -82,7 +82,7 @@
82
82
  "@wix/sdk": "^1.21.15",
83
83
  "@wix/services-manager-react": "^0.1.27",
84
84
  "@wix/site-service-rendering-context": "^1.0.1",
85
- "@wix/site-ui": "1.229.0",
85
+ "@wix/site-ui": "1.230.0",
86
86
  "@wix/video": "^1.106.0",
87
87
  "@wix/viewer-service-consent-policy": "^1.0.101",
88
88
  "@wix/web-bi-logger": "^2.1.29",
@@ -197,5 +197,5 @@
197
197
  "registry": "https://registry.npmjs.org/",
198
198
  "access": "public"
199
199
  },
200
- "falconPackageHash": "154f5226086e9159b97a83e8062c4f974ae8463455844bacfa4002ad"
200
+ "falconPackageHash": "bf859fd1cc36cbc4e9cd924d4e5a0c59ac4e9ac9fe182e46f1e5e8fc"
201
201
  }