@aurora-ds/components 0.24.6 → 0.24.7

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.
@@ -6,4 +6,9 @@ export type MenuProps = {
6
6
  children: ReactNode;
7
7
  anchorOrigin?: AnchorOrigin;
8
8
  width?: CSSProperties['width'];
9
+ /**
10
+ * Désactive l'animation/transition d'apparition du menu
11
+ * @default false
12
+ */
13
+ disableAnimation?: boolean;
9
14
  };
@@ -1,4 +1,13 @@
1
+ import { CSSProperties } from 'react';
1
2
  import { AnchorOrigin, AnchorPosition } from '@hooks/useAnchorPosition.types';
3
+ type MenuStyleParams = {
4
+ isFadingIn: boolean;
5
+ anchorOrigin: AnchorOrigin;
6
+ position: AnchorPosition;
7
+ width?: CSSProperties['width'];
8
+ disableAnimation?: boolean;
9
+ };
2
10
  export declare const MENU_STYLES: {
3
- root: (isFadingIn: boolean, anchorOrigin: AnchorOrigin, position: AnchorPosition, width?: import("csstype").Property.Width<string | number> | undefined) => string;
11
+ root: (args_0: MenuStyleParams) => string;
4
12
  };
13
+ export {};
package/dist/cjs/index.js CHANGED
@@ -1405,7 +1405,7 @@ const SelectItem = ({ option, isSelected = false, onSelect }) => {
1405
1405
  SelectItem.displayName = 'SelectItem';
1406
1406
 
1407
1407
  const MENU_STYLES = theme.createStyles((theme) => ({
1408
- root: (isFadingIn, anchorOrigin, position, width) => ({
1408
+ root: ({ isFadingIn, anchorOrigin, position, width, disableAnimation = false }) => ({
1409
1409
  position: 'fixed',
1410
1410
  zIndex: theme.zIndex.popover,
1411
1411
  marginTop: theme.spacing.xs,
@@ -1417,10 +1417,10 @@ const MENU_STYLES = theme.createStyles((theme) => ({
1417
1417
  maxHeight: MENU_ITEM_SIZE * 8,
1418
1418
  overflowY: 'auto',
1419
1419
  width,
1420
- opacity: isFadingIn ? 1 : 0,
1421
- transform: isFadingIn ? 'scale(1)' : 'scale(0.95)',
1420
+ opacity: disableAnimation ? 1 : (isFadingIn ? 1 : 0),
1421
+ transform: disableAnimation ? 'scale(1)' : (isFadingIn ? 'scale(1)' : 'scale(0.95)'),
1422
1422
  transformOrigin: anchorOrigin === 'right' ? 'top right' : 'top left',
1423
- transition: `opacity ${DEFAULT_TRANSITION_DURATION_MS}ms ease-out, transform ${DEFAULT_TRANSITION_DURATION_MS}ms ease-out`,
1423
+ transition: disableAnimation ? 'none' : `opacity ${DEFAULT_TRANSITION_DURATION_MS}ms ease-out, transform ${DEFAULT_TRANSITION_DURATION_MS}ms ease-out`,
1424
1424
  top: position?.top ?? 0,
1425
1425
  left: position?.left ?? 0,
1426
1426
  visibility: position ? 'visible' : 'hidden',
@@ -1554,7 +1554,7 @@ const useTransitionRender = (isOpen, duration = DEFAULT_TRANSITION_DURATION_MS)
1554
1554
  };
1555
1555
  };
1556
1556
 
1557
- const Menu = ({ anchor, onClose, children, anchorOrigin = 'right', width }) => {
1557
+ const Menu = ({ anchor, onClose, children, anchorOrigin = 'right', width, disableAnimation = false }) => {
1558
1558
  // refs
1559
1559
  const menuRef = React.useRef(null);
1560
1560
  const anchorRef = React.useRef(null);
@@ -1579,7 +1579,7 @@ const Menu = ({ anchor, onClose, children, anchorOrigin = 'right', width }) => {
1579
1579
  if (!isVisible) {
1580
1580
  return null;
1581
1581
  }
1582
- return reactDom.createPortal(jsxRuntime.jsx("div", { ref: menuRef, className: MENU_STYLES.root(isFadingIn, anchorOrigin, position, width), children: children }), document.body);
1582
+ return reactDom.createPortal(jsxRuntime.jsx("div", { ref: menuRef, className: MENU_STYLES.root({ isFadingIn, anchorOrigin, position, width, disableAnimation }), children: children }), document.body);
1583
1583
  };
1584
1584
  Menu.displayName = 'Menu';
1585
1585