visits-style 1.4.4 → 1.4.5

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" | "true" | "false" | "step" | "location" | "date" | undefined;
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" | "true" | "false" | "step" | "location" | "date" | undefined;
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" | "true" | "false" | "step" | "location" | "date" | undefined;
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" | "true" | "false" | "step" | "location" | "date" | undefined;
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
@@ -774,6 +774,8 @@ const Popover = React.forwardRef(({
774
774
  }, ref) => {
775
775
  const [open, setOpen] = React.useState(false);
776
776
  const nodeId = react.useId();
777
+ const openRef = React.useRef(onOpen);
778
+ const closeRef = React.useRef(onClose);
777
779
  const {
778
780
  refs,
779
781
  floatingStyles,
@@ -791,33 +793,37 @@ const Popover = React.forwardRef(({
791
793
  onOpenChange: setOpen,
792
794
  whileElementsMounted: react.autoUpdate
793
795
  });
794
- const handleFocus = (e) => {
796
+ const handleFocus = React.useCallback((e) => {
795
797
  stopPropagation$1(e);
796
798
  setOpen(true);
797
- if (onOpen)
798
- onOpen();
799
- };
800
- const handleBlur = (e) => {
799
+ }, []);
800
+ const handleBlur = React.useCallback((e) => {
801
801
  stopPropagation$1(e);
802
802
  setOpen(false);
803
- if (onClose)
804
- onClose();
805
- };
803
+ }, []);
806
804
  React.useEffect(() => {
807
805
  if (disabled && open) {
808
806
  setOpen(false);
809
807
  }
810
808
  }, [disabled, open]);
809
+ React.useEffect(() => {
810
+ if (!open)
811
+ return;
812
+ openRef.current?.();
813
+ return () => closeRef.current?.();
814
+ }, [open]);
811
815
  React.useImperativeHandle(ref, () => ({
812
816
  open: handleFocus,
813
817
  close: handleBlur
814
- }));
818
+ }), [handleFocus, handleBlur]);
815
819
  const {
816
820
  getFloatingProps,
817
821
  getReferenceProps
818
822
  } = react.useInteractions([react.useClick(context, {
819
823
  enabled: !disabled
820
824
  })]);
825
+ openRef.current = onOpen;
826
+ closeRef.current = onClose;
821
827
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
822
828
  React.cloneElement(React.Children.only(label), {
823
829
  ref: refs.setReference,
package/dist/index.es.js CHANGED
@@ -766,6 +766,8 @@ const Popover = forwardRef(({
766
766
  }, ref) => {
767
767
  const [open, setOpen] = useState(false);
768
768
  const nodeId = useId();
769
+ const openRef = useRef(onOpen);
770
+ const closeRef = useRef(onClose);
769
771
  const {
770
772
  refs,
771
773
  floatingStyles,
@@ -783,33 +785,37 @@ const Popover = forwardRef(({
783
785
  onOpenChange: setOpen,
784
786
  whileElementsMounted: autoUpdate
785
787
  });
786
- const handleFocus = (e) => {
788
+ const handleFocus = useCallback((e) => {
787
789
  stopPropagation$1(e);
788
790
  setOpen(true);
789
- if (onOpen)
790
- onOpen();
791
- };
792
- const handleBlur = (e) => {
791
+ }, []);
792
+ const handleBlur = useCallback((e) => {
793
793
  stopPropagation$1(e);
794
794
  setOpen(false);
795
- if (onClose)
796
- onClose();
797
- };
795
+ }, []);
798
796
  useEffect(() => {
799
797
  if (disabled && open) {
800
798
  setOpen(false);
801
799
  }
802
800
  }, [disabled, open]);
801
+ useEffect(() => {
802
+ if (!open)
803
+ return;
804
+ openRef.current?.();
805
+ return () => closeRef.current?.();
806
+ }, [open]);
803
807
  useImperativeHandle(ref, () => ({
804
808
  open: handleFocus,
805
809
  close: handleBlur
806
- }));
810
+ }), [handleFocus, handleBlur]);
807
811
  const {
808
812
  getFloatingProps,
809
813
  getReferenceProps
810
814
  } = useInteractions([useClick(context, {
811
815
  enabled: !disabled
812
816
  })]);
817
+ openRef.current = onOpen;
818
+ closeRef.current = onClose;
813
819
  return /* @__PURE__ */ jsxs(Fragment, { children: [
814
820
  cloneElement(Children.only(label), {
815
821
  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.4",
5
+ "version": "1.4.5",
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.2"
27
+ "styled-components": ">=6.0.5"
28
28
  },
29
29
  "dependencies": {
30
- "@floating-ui/react": "^0.24.5",
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
  }