@sohanemon/utils 4.0.13 → 4.0.15
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.
|
@@ -3,8 +3,6 @@ type BreakPoints = "sm" | "md" | "lg" | "xl" | "2xl" | "max-sm" | "max-md" | "ma
|
|
|
3
3
|
type MediaWrapperProps = React.ComponentProps<"div"> & {
|
|
4
4
|
breakpoint: BreakPoints;
|
|
5
5
|
as?: React.ElementType;
|
|
6
|
-
fallback?: React.ElementType;
|
|
7
|
-
classNameFallback?: string;
|
|
8
6
|
};
|
|
9
|
-
export declare function MediaWrapper({ breakpoint, as,
|
|
7
|
+
export declare function MediaWrapper({ breakpoint, as, ...props }: MediaWrapperProps): any;
|
|
10
8
|
export {};
|
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { useMediaQuery } from "../hooks";
|
|
5
|
-
export function MediaWrapper({ breakpoint, as = "div",
|
|
5
|
+
export function MediaWrapper({ breakpoint, as = "div", ...props }) {
|
|
6
6
|
const overMedia = useMediaQuery(breakpoint.split("-").pop());
|
|
7
7
|
const isMax = breakpoint.startsWith("max");
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
// and what className should be passed to it.
|
|
11
|
-
const Wrapper = useFallback ? fallback || React.Fragment : as;
|
|
12
|
-
const className = useFallback ? classNameFallback : classNameOriginal;
|
|
13
|
-
return _jsx(Wrapper, { className: className, ...props });
|
|
8
|
+
const Wrapper = overMedia === isMax ? React.Fragment : as;
|
|
9
|
+
return _jsx(Wrapper, { ...props });
|
|
14
10
|
}
|
|
@@ -38,9 +38,9 @@ export const ResponsiveIndicator = () => {
|
|
|
38
38
|
}
|
|
39
39
|
// Define positions
|
|
40
40
|
const positions = [
|
|
41
|
-
{ bottom: "2rem", left: "2rem" },
|
|
42
|
-
{ bottom: "2rem", right: "2rem" },
|
|
43
|
-
{ top: "2rem", right: "2rem" },
|
|
41
|
+
{ bottom: "2rem", left: "2rem" }, // Bottom left
|
|
42
|
+
{ bottom: "2rem", right: "2rem" }, // Bottom right
|
|
43
|
+
{ top: "2rem", right: "2rem" }, // Top right
|
|
44
44
|
{ top: "2rem", left: "2rem" }, // Top left
|
|
45
45
|
];
|
|
46
46
|
const buttonStyle = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sohanemon/utils",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.15",
|
|
4
4
|
"description": "",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"source": "./src/index.ts",
|
|
6
7
|
"main": "./dist/index.js",
|
|
7
8
|
"types": "./dist/index.d.ts",
|
|
@@ -25,11 +26,10 @@
|
|
|
25
26
|
"dist",
|
|
26
27
|
"README.md"
|
|
27
28
|
],
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
"keywords": [],
|
|
29
|
+
"keywords": [
|
|
30
|
+
"utils",
|
|
31
|
+
"cn"
|
|
32
|
+
],
|
|
33
33
|
"author": "sohanemon",
|
|
34
34
|
"license": "ISC",
|
|
35
35
|
"devDependencies": {
|
|
@@ -40,5 +40,10 @@
|
|
|
40
40
|
"clsx": "^2.0.0",
|
|
41
41
|
"react": "^18.2.0",
|
|
42
42
|
"tailwind-merge": "^1.14.0"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsc",
|
|
46
|
+
"build:watch": "tsc --watch",
|
|
47
|
+
"export": "tsc && npm publish"
|
|
43
48
|
}
|
|
44
|
-
}
|
|
49
|
+
}
|