@axa-fr/design-system-slash-react 1.0.6-alpha.1 → 1.0.6-alpha.12

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,5 +1,5 @@
1
- import { Placement } from "@popperjs/core";
2
1
  import React from "react";
2
+ import { Placement } from "@floating-ui/react";
3
3
  type PropsAnimatedPopover = {
4
4
  placement: Placement;
5
5
  children: React.ReactNode;
@@ -1,29 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React from "react";
3
- import { usePopper } from "react-popper";
2
+ import React, { useRef } from "react";
3
+ import { arrow, FloatingArrow, offset, useFloating, } from "@floating-ui/react";
4
4
  import { getComponentClassName } from "../utilities";
5
5
  const defaultClassName = "af-popover__container";
6
6
  export const AnimatedPopover = ({ placement, children, isOpen, target, className, classModifier, onMouseEnter, onMouseLeave, }) => {
7
7
  const componentClassName = getComponentClassName(className, classModifier, defaultClassName);
8
8
  const [referenceElement, setReferenceElement] = React.useState(null);
9
9
  const [popperElement, setPopperElement] = React.useState(null);
10
- const [arrowElement, setArrowElement] = React.useState(null);
11
- const { styles, attributes } = usePopper(referenceElement, popperElement, {
12
- modifiers: [
13
- {
14
- name: "arrow",
15
- options: {
16
- element: arrowElement,
17
- },
18
- },
19
- {
20
- name: "offset",
21
- options: {
22
- offset: [0, 8],
23
- },
24
- },
25
- ],
10
+ const arrowRef = useRef(null);
11
+ const { floatingStyles, context } = useFloating({
26
12
  placement,
13
+ elements: { reference: referenceElement, floating: popperElement },
14
+ middleware: [offset(12), arrow({ element: arrowRef })],
27
15
  });
28
- return (_jsxs("div", { className: componentClassName, children: [_jsx("div", { ref: setReferenceElement, className: "af-popover__container-over", role: "presentation", children: target }), isOpen && (_jsxs("div", { ref: setPopperElement, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, style: styles.popper, "data-popper-placement": placement, className: "af-popover__container-pop", ...attributes.popper, children: [_jsx("div", { children: children }), _jsx("div", { ref: setArrowElement, style: styles.arrow, className: "af-popover__arrow" })] }))] }));
16
+ return (_jsxs("div", { className: componentClassName, children: [_jsx("div", { ref: setReferenceElement, className: "af-popover__container-over", role: "presentation", children: target }), isOpen && (_jsxs("div", { ref: setPopperElement, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, style: floatingStyles, "data-popper-placement": placement, className: "af-popover__container-pop", children: [_jsx("div", { children: children }), _jsx(FloatingArrow, { ref: arrowRef, context: context, fill: "white" })] }))] }));
29
17
  };
@@ -1,5 +1,5 @@
1
- import { Placement } from "@popperjs/core";
2
1
  import React from "react";
2
+ import { Placement } from "@floating-ui/react";
3
3
  import { PopoverModes } from "./Popover.types";
4
4
  type Props = {
5
5
  className?: string;
@@ -1,4 +1,4 @@
1
- import { Placement } from "@popperjs/core";
1
+ import { Placement } from "@floating-ui/react";
2
2
  export type PopoverModes = "hover" | "click";
3
3
  export type PopoverProps = {
4
4
  className?: string;
@@ -1,5 +1,5 @@
1
- import { Placement } from "@popperjs/core";
2
1
  import React from "react";
2
+ import { Placement } from "@floating-ui/react";
3
3
  import "@axa-fr/design-system-slash-css/dist/Popover/Popover.scss";
4
4
  type Props = {
5
5
  placement?: Placement;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { AnimatedPopover } from "./AnimatedPopover";
3
3
  import "@axa-fr/design-system-slash-css/dist/Popover/Popover.scss";
4
4
  const defaultClassName = "af-popover__container";
5
- const PopoverBase = ({ children, isOpen, placement = "auto", className = defaultClassName, classModifier, element, onMouseEnter, onMouseLeave, }) => {
5
+ const PopoverBase = ({ children, isOpen, placement = "right", className = defaultClassName, classModifier, element, onMouseEnter, onMouseLeave, }) => {
6
6
  return (_jsx(AnimatedPopover, { target: children, placement: placement, isOpen: isOpen, className: className, classModifier: classModifier, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: element }));
7
7
  };
8
8
  export { PopoverBase };
@@ -1,3 +1,3 @@
1
1
  export { Popover } from "./Popover";
2
- export { type Placement } from "@popperjs/core";
2
+ export { type Placement } from "@floating-ui/react";
3
3
  export { type PopoverModes } from "./Popover.types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-slash-react",
3
- "version": "1.0.6-alpha.1",
3
+ "version": "1.0.6-alpha.12",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "homepage": "https://github.com/AxaFrance/design-system#readme",
47
47
  "peerDependencies": {
48
- "@axa-fr/design-system-slash-css": "1.0.6-alpha.1",
48
+ "@axa-fr/design-system-slash-css": "1.0.6-alpha.12",
49
49
  "@material-symbols/svg-400": ">= 0.19.0",
50
50
  "react": ">= 18"
51
51
  },
@@ -55,15 +55,14 @@
55
55
  }
56
56
  },
57
57
  "dependencies": {
58
+ "@floating-ui/react": "^0.27.2",
58
59
  "@fontsource/source-sans-pro": "^5.0.8",
59
- "@popperjs/core": "^2.11.8",
60
60
  "@tanem/svg-injector": "^10.1.68",
61
61
  "classnames": "^2.5.1",
62
62
  "dompurify": "^3.1.5",
63
63
  "rc-slider": "^11.1.7",
64
64
  "react-dropzone": "^11.5.3",
65
- "react-popper": "^2.3.0",
66
- "react-select": "^5.8.0"
65
+ "react-select": "^5.9.0"
67
66
  },
68
67
  "devDependencies": {
69
68
  "@chromatic-com/storybook": "^2.0.2",