@autoguru/overdrive 4.37.0 → 4.37.1
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.
|
@@ -28,7 +28,7 @@ export const StickyBox = _ref => {
|
|
|
28
28
|
const [withShadow, setWithShadow] = useState(false);
|
|
29
29
|
useEffect(() => {
|
|
30
30
|
var _containerRef$current;
|
|
31
|
-
if (!((_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 && _containerRef$current.parentElement) || !
|
|
31
|
+
if (!((_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 && _containerRef$current.parentElement) || !window) return void 0;
|
|
32
32
|
const parentElement = containerRef.current.parentElement;
|
|
33
33
|
const onScroll = () => {
|
|
34
34
|
setWithShadow(parentElement.scrollTop > 3);
|
|
@@ -11,12 +11,12 @@ export const useMedia = function (queries) {
|
|
|
11
11
|
} = useRuntimeTokens();
|
|
12
12
|
if (!isBrowser) return queries.map(() => fallbackCase);
|
|
13
13
|
const getQueries = useCallback(() => queries.map(media => `(min-width: ${breakpoints[media]})`), [breakpoints]);
|
|
14
|
-
const matchesInit = useMemo(() => getQueries().map(query =>
|
|
14
|
+
const matchesInit = useMemo(() => getQueries().map(query => window.matchMedia(query).matches), [getQueries]);
|
|
15
15
|
const [matches, setMatches] = useState(matchesInit);
|
|
16
16
|
if (isBrowser) {
|
|
17
17
|
useLayoutEffect(() => {
|
|
18
18
|
let isMounted = true;
|
|
19
|
-
const matchers = getQueries().map(query =>
|
|
19
|
+
const matchers = getQueries().map(query => window.matchMedia(query));
|
|
20
20
|
const removeHandlersFn = matchers.map((matcher, idx) => {
|
|
21
21
|
const handler = e => {
|
|
22
22
|
if (!isMounted) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAa,MAAM,OAAO,CAAC;AACzD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C"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
-
export const isBrowser = typeof
|
|
4
|
+
export const isBrowser = typeof window !== 'undefined';
|
|
5
5
|
export const isomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
|
|
6
6
|
export const useUncontrolledState = (value, onChange) => {
|
|
7
7
|
if (typeof onChange === 'function') {
|
|
@@ -62,8 +62,7 @@ export const hex2rgba = function (c) {
|
|
|
62
62
|
export const ownerDocument = node => (node === null || node === void 0 ? void 0 : node.ownerDocument) || document;
|
|
63
63
|
export const ownerWindow = node => {
|
|
64
64
|
var _ownerDocument;
|
|
65
|
-
return ((
|
|
66
|
-
);
|
|
65
|
+
return ((_ownerDocument = ownerDocument(node)) === null || _ownerDocument === void 0 ? void 0 : _ownerDocument.defaultView) || window;
|
|
67
66
|
};
|
|
68
67
|
export const useEventCallback = fn => {
|
|
69
68
|
const ref = useRef(fn);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autoguru/overdrive",
|
|
3
|
-
"version": "4.37.
|
|
3
|
+
"version": "4.37.1",
|
|
4
4
|
"description": "Overdrive is a product component library, and design system for AutoGuru.",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
"@joshwooding/vite-plugin-react-docgen-typescript": "0.5.0"
|
|
179
179
|
},
|
|
180
180
|
"volta": {
|
|
181
|
-
"node": "20.18.
|
|
181
|
+
"node": "20.18.2",
|
|
182
182
|
"yarn": "4.6.0"
|
|
183
183
|
},
|
|
184
184
|
"packageManager": "yarn@4.6.0"
|