@aristobyte-ui/utils 1.0.105 → 1.0.107
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.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +23 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
|
+
declare const useMediaQuery: (query: string) => boolean;
|
|
5
|
+
|
|
4
6
|
type RippleParamsRef = HTMLButtonElement | HTMLAnchorElement;
|
|
5
7
|
type RippleParams<HTMLElementType extends RippleParamsRef> = {
|
|
6
8
|
ref: React.RefObject<HTMLElementType | null>;
|
|
@@ -14,7 +16,7 @@ declare const Portal: React$1.FC<{
|
|
|
14
16
|
}>;
|
|
15
17
|
|
|
16
18
|
type IconPropsType = {
|
|
17
|
-
size?: number
|
|
19
|
+
size?: number | `${number}%`;
|
|
18
20
|
color?: string;
|
|
19
21
|
colors?: string[];
|
|
20
22
|
};
|
|
@@ -61,4 +63,4 @@ declare const Icons: {
|
|
|
61
63
|
Yarn: ({ size }: IconPropsType) => react_jsx_runtime.JSX.Element;
|
|
62
64
|
};
|
|
63
65
|
|
|
64
|
-
export { type IconPropsType, Icons, Portal, type RippleParams, renderRipple };
|
|
66
|
+
export { type IconPropsType, Icons, Portal, type RippleParams, renderRipple, useMediaQuery };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
|
+
declare const useMediaQuery: (query: string) => boolean;
|
|
5
|
+
|
|
4
6
|
type RippleParamsRef = HTMLButtonElement | HTMLAnchorElement;
|
|
5
7
|
type RippleParams<HTMLElementType extends RippleParamsRef> = {
|
|
6
8
|
ref: React.RefObject<HTMLElementType | null>;
|
|
@@ -14,7 +16,7 @@ declare const Portal: React$1.FC<{
|
|
|
14
16
|
}>;
|
|
15
17
|
|
|
16
18
|
type IconPropsType = {
|
|
17
|
-
size?: number
|
|
19
|
+
size?: number | `${number}%`;
|
|
18
20
|
color?: string;
|
|
19
21
|
colors?: string[];
|
|
20
22
|
};
|
|
@@ -61,4 +63,4 @@ declare const Icons: {
|
|
|
61
63
|
Yarn: ({ size }: IconPropsType) => react_jsx_runtime.JSX.Element;
|
|
62
64
|
};
|
|
63
65
|
|
|
64
|
-
export { type IconPropsType, Icons, Portal, type RippleParams, renderRipple };
|
|
66
|
+
export { type IconPropsType, Icons, Portal, type RippleParams, renderRipple, useMediaQuery };
|
package/dist/index.js
CHANGED
|
@@ -32,10 +32,27 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
Icons: () => Icons,
|
|
34
34
|
Portal: () => Portal,
|
|
35
|
-
renderRipple: () => renderRipple
|
|
35
|
+
renderRipple: () => renderRipple,
|
|
36
|
+
useMediaQuery: () => useMediaQuery
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(index_exports);
|
|
38
39
|
|
|
40
|
+
// hooks/useMediaQuery.ts
|
|
41
|
+
var React = __toESM(require("react"));
|
|
42
|
+
var useMediaQuery = (query) => {
|
|
43
|
+
const [matches, setMatches] = React.useState(false);
|
|
44
|
+
React.useEffect(() => {
|
|
45
|
+
const media = window.matchMedia(query);
|
|
46
|
+
if (media.matches !== matches) {
|
|
47
|
+
setMatches(media.matches);
|
|
48
|
+
}
|
|
49
|
+
const listener = () => setMatches(media.matches);
|
|
50
|
+
media.addEventListener("change", listener);
|
|
51
|
+
return () => media.removeEventListener("change", listener);
|
|
52
|
+
}, [matches, query]);
|
|
53
|
+
return matches;
|
|
54
|
+
};
|
|
55
|
+
|
|
39
56
|
// helpers/ripple.tsx
|
|
40
57
|
var renderRipple = ({
|
|
41
58
|
ref,
|
|
@@ -80,13 +97,13 @@ var renderRipple = ({
|
|
|
80
97
|
};
|
|
81
98
|
|
|
82
99
|
// helpers/Portal.tsx
|
|
83
|
-
var
|
|
100
|
+
var React2 = __toESM(require("react"));
|
|
84
101
|
var import_react_dom = require("react-dom");
|
|
85
102
|
var Portal = ({
|
|
86
103
|
children
|
|
87
104
|
}) => {
|
|
88
|
-
const [mounted, setMounted] =
|
|
89
|
-
|
|
105
|
+
const [mounted, setMounted] = React2.useState(false);
|
|
106
|
+
React2.useEffect(() => {
|
|
90
107
|
setMounted(true);
|
|
91
108
|
}, []);
|
|
92
109
|
if (!mounted || typeof window === "undefined") return null;
|
|
@@ -1917,6 +1934,7 @@ var Icons = {
|
|
|
1917
1934
|
0 && (module.exports = {
|
|
1918
1935
|
Icons,
|
|
1919
1936
|
Portal,
|
|
1920
|
-
renderRipple
|
|
1937
|
+
renderRipple,
|
|
1938
|
+
useMediaQuery
|
|
1921
1939
|
});
|
|
1922
1940
|
//# sourceMappingURL=index.js.map
|