visits-style 1.4.4 → 1.4.6
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.
|
@@ -64,7 +64,7 @@ declare const _default: import("styled-components").IStyledComponent<"web", {
|
|
|
64
64
|
'aria-colindextext'?: string | undefined;
|
|
65
65
|
'aria-colspan'?: number | undefined;
|
|
66
66
|
'aria-controls'?: string | undefined;
|
|
67
|
-
'aria-current'?: boolean | "page" | "time" | "
|
|
67
|
+
'aria-current'?: boolean | "page" | "time" | "step" | "true" | "false" | "location" | "date" | undefined;
|
|
68
68
|
'aria-describedby'?: string | undefined;
|
|
69
69
|
'aria-description'?: string | undefined;
|
|
70
70
|
'aria-details'?: string | undefined;
|
|
@@ -64,7 +64,7 @@ declare const _default: import("styled-components").IStyledComponent<"web", {
|
|
|
64
64
|
'aria-colindextext'?: string | undefined;
|
|
65
65
|
'aria-colspan'?: number | undefined;
|
|
66
66
|
'aria-controls'?: string | undefined;
|
|
67
|
-
'aria-current'?: boolean | "page" | "time" | "
|
|
67
|
+
'aria-current'?: boolean | "page" | "time" | "step" | "true" | "false" | "location" | "date" | undefined;
|
|
68
68
|
'aria-describedby'?: string | undefined;
|
|
69
69
|
'aria-description'?: string | undefined;
|
|
70
70
|
'aria-details'?: string | undefined;
|
|
@@ -64,7 +64,7 @@ declare const _default: import("styled-components").IStyledComponent<"web", {
|
|
|
64
64
|
'aria-colindextext'?: string | undefined;
|
|
65
65
|
'aria-colspan'?: number | undefined;
|
|
66
66
|
'aria-controls'?: string | undefined;
|
|
67
|
-
'aria-current'?: boolean | "page" | "time" | "
|
|
67
|
+
'aria-current'?: boolean | "page" | "time" | "step" | "true" | "false" | "location" | "date" | undefined;
|
|
68
68
|
'aria-describedby'?: string | undefined;
|
|
69
69
|
'aria-description'?: string | undefined;
|
|
70
70
|
'aria-details'?: string | undefined;
|
|
@@ -64,7 +64,7 @@ declare const _default: import("styled-components").IStyledComponent<"web", {
|
|
|
64
64
|
'aria-colindextext'?: string | undefined;
|
|
65
65
|
'aria-colspan'?: number | undefined;
|
|
66
66
|
'aria-controls'?: string | undefined;
|
|
67
|
-
'aria-current'?: boolean | "page" | "time" | "
|
|
67
|
+
'aria-current'?: boolean | "page" | "time" | "step" | "true" | "false" | "location" | "date" | undefined;
|
|
68
68
|
'aria-describedby'?: string | undefined;
|
|
69
69
|
'aria-description'?: string | undefined;
|
|
70
70
|
'aria-details'?: string | undefined;
|
package/dist/index.cjs.js
CHANGED
|
@@ -756,6 +756,7 @@ function stopPropagation$1(e) {
|
|
|
756
756
|
if (!e)
|
|
757
757
|
return;
|
|
758
758
|
e.stopPropagation();
|
|
759
|
+
e.preventDefault();
|
|
759
760
|
}
|
|
760
761
|
|
|
761
762
|
const Popover = React.forwardRef(({
|
|
@@ -774,6 +775,8 @@ const Popover = React.forwardRef(({
|
|
|
774
775
|
}, ref) => {
|
|
775
776
|
const [open, setOpen] = React.useState(false);
|
|
776
777
|
const nodeId = react.useId();
|
|
778
|
+
const openRef = React.useRef(onOpen);
|
|
779
|
+
const closeRef = React.useRef(onClose);
|
|
777
780
|
const {
|
|
778
781
|
refs,
|
|
779
782
|
floatingStyles,
|
|
@@ -791,33 +794,37 @@ const Popover = React.forwardRef(({
|
|
|
791
794
|
onOpenChange: setOpen,
|
|
792
795
|
whileElementsMounted: react.autoUpdate
|
|
793
796
|
});
|
|
794
|
-
const handleFocus = (e) => {
|
|
797
|
+
const handleFocus = React.useCallback((e) => {
|
|
795
798
|
stopPropagation$1(e);
|
|
796
799
|
setOpen(true);
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
};
|
|
800
|
-
const handleBlur = (e) => {
|
|
800
|
+
}, []);
|
|
801
|
+
const handleBlur = React.useCallback((e) => {
|
|
801
802
|
stopPropagation$1(e);
|
|
802
803
|
setOpen(false);
|
|
803
|
-
|
|
804
|
-
onClose();
|
|
805
|
-
};
|
|
804
|
+
}, []);
|
|
806
805
|
React.useEffect(() => {
|
|
807
806
|
if (disabled && open) {
|
|
808
807
|
setOpen(false);
|
|
809
808
|
}
|
|
810
809
|
}, [disabled, open]);
|
|
810
|
+
React.useEffect(() => {
|
|
811
|
+
if (!open)
|
|
812
|
+
return;
|
|
813
|
+
openRef.current?.();
|
|
814
|
+
return () => closeRef.current?.();
|
|
815
|
+
}, [open]);
|
|
811
816
|
React.useImperativeHandle(ref, () => ({
|
|
812
817
|
open: handleFocus,
|
|
813
818
|
close: handleBlur
|
|
814
|
-
}));
|
|
819
|
+
}), [handleFocus, handleBlur]);
|
|
815
820
|
const {
|
|
816
821
|
getFloatingProps,
|
|
817
822
|
getReferenceProps
|
|
818
823
|
} = react.useInteractions([react.useClick(context, {
|
|
819
824
|
enabled: !disabled
|
|
820
825
|
})]);
|
|
826
|
+
openRef.current = onOpen;
|
|
827
|
+
closeRef.current = onClose;
|
|
821
828
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
822
829
|
React.cloneElement(React.Children.only(label), {
|
|
823
830
|
ref: refs.setReference,
|
package/dist/index.es.js
CHANGED
|
@@ -748,6 +748,7 @@ function stopPropagation$1(e) {
|
|
|
748
748
|
if (!e)
|
|
749
749
|
return;
|
|
750
750
|
e.stopPropagation();
|
|
751
|
+
e.preventDefault();
|
|
751
752
|
}
|
|
752
753
|
|
|
753
754
|
const Popover = forwardRef(({
|
|
@@ -766,6 +767,8 @@ const Popover = forwardRef(({
|
|
|
766
767
|
}, ref) => {
|
|
767
768
|
const [open, setOpen] = useState(false);
|
|
768
769
|
const nodeId = useId();
|
|
770
|
+
const openRef = useRef(onOpen);
|
|
771
|
+
const closeRef = useRef(onClose);
|
|
769
772
|
const {
|
|
770
773
|
refs,
|
|
771
774
|
floatingStyles,
|
|
@@ -783,33 +786,37 @@ const Popover = forwardRef(({
|
|
|
783
786
|
onOpenChange: setOpen,
|
|
784
787
|
whileElementsMounted: autoUpdate
|
|
785
788
|
});
|
|
786
|
-
const handleFocus = (e) => {
|
|
789
|
+
const handleFocus = useCallback((e) => {
|
|
787
790
|
stopPropagation$1(e);
|
|
788
791
|
setOpen(true);
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
};
|
|
792
|
-
const handleBlur = (e) => {
|
|
792
|
+
}, []);
|
|
793
|
+
const handleBlur = useCallback((e) => {
|
|
793
794
|
stopPropagation$1(e);
|
|
794
795
|
setOpen(false);
|
|
795
|
-
|
|
796
|
-
onClose();
|
|
797
|
-
};
|
|
796
|
+
}, []);
|
|
798
797
|
useEffect(() => {
|
|
799
798
|
if (disabled && open) {
|
|
800
799
|
setOpen(false);
|
|
801
800
|
}
|
|
802
801
|
}, [disabled, open]);
|
|
802
|
+
useEffect(() => {
|
|
803
|
+
if (!open)
|
|
804
|
+
return;
|
|
805
|
+
openRef.current?.();
|
|
806
|
+
return () => closeRef.current?.();
|
|
807
|
+
}, [open]);
|
|
803
808
|
useImperativeHandle(ref, () => ({
|
|
804
809
|
open: handleFocus,
|
|
805
810
|
close: handleBlur
|
|
806
|
-
}));
|
|
811
|
+
}), [handleFocus, handleBlur]);
|
|
807
812
|
const {
|
|
808
813
|
getFloatingProps,
|
|
809
814
|
getReferenceProps
|
|
810
815
|
} = useInteractions([useClick(context, {
|
|
811
816
|
enabled: !disabled
|
|
812
817
|
})]);
|
|
818
|
+
openRef.current = onOpen;
|
|
819
|
+
closeRef.current = onClose;
|
|
813
820
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
814
821
|
cloneElement(Children.only(label), {
|
|
815
822
|
ref: refs.setReference,
|
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.6",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.cjs.js",
|
|
8
8
|
"module": "./dist/index.es.js",
|
|
@@ -24,10 +24,11 @@
|
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": ">=18.2.0",
|
|
26
26
|
"react-dom": ">=18.2.0",
|
|
27
|
-
"styled-components": ">=6.0.
|
|
27
|
+
"styled-components": ">=6.0.5"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@floating-ui/react": "^0.
|
|
30
|
+
"@floating-ui/react": "^0.25.0",
|
|
31
|
+
"eslint-config-react-app": "^7.0.1",
|
|
31
32
|
"polished": "^4.2.2"
|
|
32
33
|
}
|
|
33
34
|
}
|