visits-style 1.4.1 → 1.4.2
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.
- package/dist/index.cjs.js +8 -3
- package/dist/index.es.js +9 -4
- package/dist/utils/stopPropagation.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -683,11 +683,13 @@ function Tooltip$1({
|
|
|
683
683
|
disabled
|
|
684
684
|
}) {
|
|
685
685
|
const [open, setOpen] = React.useState(false);
|
|
686
|
+
const nodeId = react.useId();
|
|
686
687
|
const {
|
|
687
688
|
refs,
|
|
688
689
|
floatingStyles,
|
|
689
690
|
context
|
|
690
691
|
} = react.useFloating({
|
|
692
|
+
nodeId,
|
|
691
693
|
open,
|
|
692
694
|
placement: position,
|
|
693
695
|
middleware: [react.shift(), react.flip(), react.offset({
|
|
@@ -710,7 +712,7 @@ function Tooltip$1({
|
|
|
710
712
|
ref: refs.setReference,
|
|
711
713
|
...getReferenceProps()
|
|
712
714
|
}),
|
|
713
|
-
/* @__PURE__ */ jsxRuntime.jsx(Portal$1, { children: open ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
715
|
+
/* @__PURE__ */ jsxRuntime.jsx(Portal$1, { children: open ? /* @__PURE__ */ jsxRuntime.jsx(TooltipWrapper, { className, ref: refs.setFloating, role: "tooltip", $color: color, style: floatingStyles, ...getFloatingProps(), children: label }) : null })
|
|
714
716
|
] });
|
|
715
717
|
}
|
|
716
718
|
const TooltipWrapper = /* @__PURE__ */ styledComponents.styled.div.withConfig({
|
|
@@ -750,6 +752,7 @@ function stopPropagation$1(e) {
|
|
|
750
752
|
return;
|
|
751
753
|
e.stopPropagation();
|
|
752
754
|
}
|
|
755
|
+
|
|
753
756
|
const Popover = React.forwardRef(({
|
|
754
757
|
position,
|
|
755
758
|
label,
|
|
@@ -765,11 +768,13 @@ const Popover = React.forwardRef(({
|
|
|
765
768
|
...rest
|
|
766
769
|
}, ref) => {
|
|
767
770
|
const [open, setOpen] = React.useState(false);
|
|
771
|
+
const nodeId = react.useId();
|
|
768
772
|
const {
|
|
769
773
|
refs,
|
|
770
774
|
floatingStyles,
|
|
771
775
|
context
|
|
772
776
|
} = react.useFloating({
|
|
777
|
+
nodeId,
|
|
773
778
|
placement: position,
|
|
774
779
|
middleware: [react.shift(), react.flip({
|
|
775
780
|
fallbackAxisSideDirection: "end"
|
|
@@ -820,10 +825,10 @@ const Popover = React.forwardRef(({
|
|
|
820
825
|
}),
|
|
821
826
|
/* @__PURE__ */ jsxRuntime.jsx(Portal$1, { children: open ? /* @__PURE__ */ jsxRuntime.jsx(react.FloatingOverlay, { "data-testid": "visits-style-shadow", onClick: handleBlur, style: {
|
|
822
827
|
zIndex: 9996
|
|
823
|
-
}, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
828
|
+
}, children: /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { role: "tooltip", ref: refs.setFloating, color, style: floatingStyles, ...getFloatingProps({
|
|
824
829
|
...rest,
|
|
825
830
|
onClick: stopPropagation$1
|
|
826
|
-
}), children }) })
|
|
831
|
+
}), children }) }) : null })
|
|
827
832
|
] });
|
|
828
833
|
});
|
|
829
834
|
Popover.displayName = "Popover";
|
package/dist/index.es.js
CHANGED
|
@@ -2,7 +2,7 @@ import { styled, css, keyframes } from 'styled-components';
|
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import React, { forwardRef, useLayoutEffect, useEffect, useRef, useMemo, useImperativeHandle, useState, cloneElement, Children, useCallback, createElement } from 'react';
|
|
4
4
|
import { getLuminance, transparentize, darken } from 'polished';
|
|
5
|
-
import { useFloating, shift, flip, offset, useInteractions, useHover, useClientPoint,
|
|
5
|
+
import { useId, useFloating, shift, flip, offset, useInteractions, useHover, useClientPoint, autoUpdate, useClick, FloatingOverlay, useDismiss, useTransitionStyles } from '@floating-ui/react';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
|
|
8
8
|
const Wrapper$6 = /* @__PURE__ */ styled.div.withConfig({
|
|
@@ -675,11 +675,13 @@ function Tooltip$1({
|
|
|
675
675
|
disabled
|
|
676
676
|
}) {
|
|
677
677
|
const [open, setOpen] = useState(false);
|
|
678
|
+
const nodeId = useId();
|
|
678
679
|
const {
|
|
679
680
|
refs,
|
|
680
681
|
floatingStyles,
|
|
681
682
|
context
|
|
682
683
|
} = useFloating({
|
|
684
|
+
nodeId,
|
|
683
685
|
open,
|
|
684
686
|
placement: position,
|
|
685
687
|
middleware: [shift(), flip(), offset({
|
|
@@ -702,7 +704,7 @@ function Tooltip$1({
|
|
|
702
704
|
ref: refs.setReference,
|
|
703
705
|
...getReferenceProps()
|
|
704
706
|
}),
|
|
705
|
-
/* @__PURE__ */ jsx(Portal$1, { children: open ? /* @__PURE__ */ jsx(
|
|
707
|
+
/* @__PURE__ */ jsx(Portal$1, { children: open ? /* @__PURE__ */ jsx(TooltipWrapper, { className, ref: refs.setFloating, role: "tooltip", $color: color, style: floatingStyles, ...getFloatingProps(), children: label }) : null })
|
|
706
708
|
] });
|
|
707
709
|
}
|
|
708
710
|
const TooltipWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
@@ -742,6 +744,7 @@ function stopPropagation$1(e) {
|
|
|
742
744
|
return;
|
|
743
745
|
e.stopPropagation();
|
|
744
746
|
}
|
|
747
|
+
|
|
745
748
|
const Popover = forwardRef(({
|
|
746
749
|
position,
|
|
747
750
|
label,
|
|
@@ -757,11 +760,13 @@ const Popover = forwardRef(({
|
|
|
757
760
|
...rest
|
|
758
761
|
}, ref) => {
|
|
759
762
|
const [open, setOpen] = useState(false);
|
|
763
|
+
const nodeId = useId();
|
|
760
764
|
const {
|
|
761
765
|
refs,
|
|
762
766
|
floatingStyles,
|
|
763
767
|
context
|
|
764
768
|
} = useFloating({
|
|
769
|
+
nodeId,
|
|
765
770
|
placement: position,
|
|
766
771
|
middleware: [shift(), flip({
|
|
767
772
|
fallbackAxisSideDirection: "end"
|
|
@@ -812,10 +817,10 @@ const Popover = forwardRef(({
|
|
|
812
817
|
}),
|
|
813
818
|
/* @__PURE__ */ jsx(Portal$1, { children: open ? /* @__PURE__ */ jsx(FloatingOverlay, { "data-testid": "visits-style-shadow", onClick: handleBlur, style: {
|
|
814
819
|
zIndex: 9996
|
|
815
|
-
}, children: /* @__PURE__ */ jsx(
|
|
820
|
+
}, children: /* @__PURE__ */ jsx(Tooltip, { role: "tooltip", ref: refs.setFloating, color, style: floatingStyles, ...getFloatingProps({
|
|
816
821
|
...rest,
|
|
817
822
|
onClick: stopPropagation$1
|
|
818
|
-
}), children }) })
|
|
823
|
+
}), children }) }) : null })
|
|
819
824
|
] });
|
|
820
825
|
});
|
|
821
826
|
Popover.displayName = "Popover";
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "visits-style",
|
|
3
3
|
"repository": "https://github.com/visits-works/visits-style",
|
|
4
4
|
"homepage": "https://github.com/visits-works/visits-style",
|
|
5
|
-
"version": "1.4.
|
|
5
|
+
"version": "1.4.2",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.cjs.js",
|
|
8
8
|
"module": "./dist/index.es.js",
|