@elliemae/ds-hooks-is-mobile 3.32.0-rc.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.
- package/dist/cjs/DSHookIsMobile.js +66 -0
- package/dist/cjs/DSHookIsMobile.js.map +7 -0
- package/dist/cjs/index.js +37 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +7 -0
- package/dist/esm/DSHookIsMobile.js +36 -0
- package/dist/esm/DSHookIsMobile.js.map +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/package.json +7 -0
- package/dist/types/DSHookIsMobile.d.ts +6 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var DSHookIsMobile_exports = {};
|
|
30
|
+
__export(DSHookIsMobile_exports, {
|
|
31
|
+
UseIsMobileWithSchema: () => UseIsMobileWithSchema,
|
|
32
|
+
useIsMobile: () => useIsMobile
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(DSHookIsMobile_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_pui_theme = require("@elliemae/pui-theme");
|
|
38
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
39
|
+
const theme = (0, import_pui_theme.getDefaultTheme)();
|
|
40
|
+
const isMobile = () => {
|
|
41
|
+
if (!window)
|
|
42
|
+
return false;
|
|
43
|
+
return Number(theme.breakpoints.medium.split("px")[0]) - window.innerWidth >= 0;
|
|
44
|
+
};
|
|
45
|
+
const useIsMobile = () => {
|
|
46
|
+
const [mobile, setMobile] = (0, import_react.useState)(isMobile());
|
|
47
|
+
(0, import_react.useEffect)(() => {
|
|
48
|
+
function handleResize() {
|
|
49
|
+
setMobile(isMobile());
|
|
50
|
+
}
|
|
51
|
+
window?.addEventListener("resize", handleResize);
|
|
52
|
+
return () => {
|
|
53
|
+
window?.removeEventListener("resize", handleResize);
|
|
54
|
+
};
|
|
55
|
+
}, []);
|
|
56
|
+
if (!window)
|
|
57
|
+
return false;
|
|
58
|
+
return mobile;
|
|
59
|
+
};
|
|
60
|
+
const returnType = {
|
|
61
|
+
isMobile: import_ds_props_helpers.PropTypes.bool.description("Whether the current view is Mobile or Desktop.")
|
|
62
|
+
};
|
|
63
|
+
useIsMobile.displayName = "useIsMobile";
|
|
64
|
+
const UseIsMobileWithSchema = (0, import_ds_props_helpers.describe)(useIsMobile);
|
|
65
|
+
UseIsMobileWithSchema.returnType = returnType;
|
|
66
|
+
//# sourceMappingURL=DSHookIsMobile.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSHookIsMobile.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useState, useEffect } from 'react';\nimport { getDefaultTheme } from '@elliemae/pui-theme';\nimport type { Theme } from '@elliemae/pui-theme';\nimport { PropTypes, describe } from '@elliemae/ds-props-helpers';\n\nconst theme = getDefaultTheme() as Theme;\n\nconst isMobile = (): boolean => {\n if (!window) return false;\n return Number(theme.breakpoints.medium.split('px')[0]) - window.innerWidth >= 0;\n};\n\nconst useIsMobile = (): boolean => {\n const [mobile, setMobile] = useState<boolean>(isMobile());\n\n useEffect(() => {\n function handleResize() {\n setMobile(isMobile());\n }\n window?.addEventListener('resize', handleResize);\n return () => {\n window?.removeEventListener('resize', handleResize);\n };\n }, []);\n\n if (!window) return false;\n return mobile;\n};\n\nconst returnType = {\n isMobile: PropTypes.bool.description('Whether the current view is Mobile or Desktop.'),\n};\n\nuseIsMobile.displayName = 'useIsMobile';\nconst UseIsMobileWithSchema = describe(useIsMobile);\n\nUseIsMobileWithSchema.returnType = returnType;\n\nexport { useIsMobile, UseIsMobileWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAoC;AACpC,uBAAgC;AAEhC,8BAAoC;AAEpC,MAAM,YAAQ,kCAAgB;AAE9B,MAAM,WAAW,MAAe;AAC9B,MAAI,CAAC;AAAQ,WAAO;AACpB,SAAO,OAAO,MAAM,YAAY,OAAO,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,OAAO,cAAc;AAChF;AAEA,MAAM,cAAc,MAAe;AACjC,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAkB,SAAS,CAAC;AAExD,8BAAU,MAAM;AACd,aAAS,eAAe;AACtB,gBAAU,SAAS,CAAC;AAAA,IACtB;AACA,YAAQ,iBAAiB,UAAU,YAAY;AAC/C,WAAO,MAAM;AACX,cAAQ,oBAAoB,UAAU,YAAY;AAAA,IACpD;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,MAAI,CAAC;AAAQ,WAAO;AACpB,SAAO;AACT;AAEA,MAAM,aAAa;AAAA,EACjB,UAAU,kCAAU,KAAK,YAAY,gDAAgD;AACvF;AAEA,YAAY,cAAc;AAC1B,MAAM,4BAAwB,kCAAS,WAAW;AAElD,sBAAsB,aAAa;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
UseIsMobileWithSchema: () => import_DSHookIsMobile.UseIsMobileWithSchema,
|
|
32
|
+
useIsMobile: () => import_DSHookIsMobile.useIsMobile
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(src_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_DSHookIsMobile = require("./DSHookIsMobile.js");
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export { useIsMobile, UseIsMobileWithSchema } from './DSHookIsMobile.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,4BAAmD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { getDefaultTheme } from "@elliemae/pui-theme";
|
|
4
|
+
import { PropTypes, describe } from "@elliemae/ds-props-helpers";
|
|
5
|
+
const theme = getDefaultTheme();
|
|
6
|
+
const isMobile = () => {
|
|
7
|
+
if (!window)
|
|
8
|
+
return false;
|
|
9
|
+
return Number(theme.breakpoints.medium.split("px")[0]) - window.innerWidth >= 0;
|
|
10
|
+
};
|
|
11
|
+
const useIsMobile = () => {
|
|
12
|
+
const [mobile, setMobile] = useState(isMobile());
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
function handleResize() {
|
|
15
|
+
setMobile(isMobile());
|
|
16
|
+
}
|
|
17
|
+
window?.addEventListener("resize", handleResize);
|
|
18
|
+
return () => {
|
|
19
|
+
window?.removeEventListener("resize", handleResize);
|
|
20
|
+
};
|
|
21
|
+
}, []);
|
|
22
|
+
if (!window)
|
|
23
|
+
return false;
|
|
24
|
+
return mobile;
|
|
25
|
+
};
|
|
26
|
+
const returnType = {
|
|
27
|
+
isMobile: PropTypes.bool.description("Whether the current view is Mobile or Desktop.")
|
|
28
|
+
};
|
|
29
|
+
useIsMobile.displayName = "useIsMobile";
|
|
30
|
+
const UseIsMobileWithSchema = describe(useIsMobile);
|
|
31
|
+
UseIsMobileWithSchema.returnType = returnType;
|
|
32
|
+
export {
|
|
33
|
+
UseIsMobileWithSchema,
|
|
34
|
+
useIsMobile
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=DSHookIsMobile.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSHookIsMobile.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useState, useEffect } from 'react';\nimport { getDefaultTheme } from '@elliemae/pui-theme';\nimport type { Theme } from '@elliemae/pui-theme';\nimport { PropTypes, describe } from '@elliemae/ds-props-helpers';\n\nconst theme = getDefaultTheme() as Theme;\n\nconst isMobile = (): boolean => {\n if (!window) return false;\n return Number(theme.breakpoints.medium.split('px')[0]) - window.innerWidth >= 0;\n};\n\nconst useIsMobile = (): boolean => {\n const [mobile, setMobile] = useState<boolean>(isMobile());\n\n useEffect(() => {\n function handleResize() {\n setMobile(isMobile());\n }\n window?.addEventListener('resize', handleResize);\n return () => {\n window?.removeEventListener('resize', handleResize);\n };\n }, []);\n\n if (!window) return false;\n return mobile;\n};\n\nconst returnType = {\n isMobile: PropTypes.bool.description('Whether the current view is Mobile or Desktop.'),\n};\n\nuseIsMobile.displayName = 'useIsMobile';\nconst UseIsMobileWithSchema = describe(useIsMobile);\n\nUseIsMobileWithSchema.returnType = returnType;\n\nexport { useIsMobile, UseIsMobileWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,UAAU,iBAAiB;AACpC,SAAS,uBAAuB;AAEhC,SAAS,WAAW,gBAAgB;AAEpC,MAAM,QAAQ,gBAAgB;AAE9B,MAAM,WAAW,MAAe;AAC9B,MAAI,CAAC;AAAQ,WAAO;AACpB,SAAO,OAAO,MAAM,YAAY,OAAO,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,OAAO,cAAc;AAChF;AAEA,MAAM,cAAc,MAAe;AACjC,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAkB,SAAS,CAAC;AAExD,YAAU,MAAM;AACd,aAAS,eAAe;AACtB,gBAAU,SAAS,CAAC;AAAA,IACtB;AACA,YAAQ,iBAAiB,UAAU,YAAY;AAC/C,WAAO,MAAM;AACX,cAAQ,oBAAoB,UAAU,YAAY;AAAA,IACpD;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,MAAI,CAAC;AAAQ,WAAO;AACpB,SAAO;AACT;AAEA,MAAM,aAAa;AAAA,EACjB,UAAU,UAAU,KAAK,YAAY,gDAAgD;AACvF;AAEA,YAAY,cAAc;AAC1B,MAAM,wBAAwB,SAAS,WAAW;AAElD,sBAAsB,aAAa;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { useIsMobile, UseIsMobileWithSchema } from './DSHookIsMobile.js';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,aAAa,6BAA6B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useIsMobile, UseIsMobileWithSchema } from './DSHookIsMobile.js';
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elliemae/ds-hooks-is-mobile",
|
|
3
|
+
"version": "3.32.0-rc.5",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "ICE MT - Dimsum - Hooks Is Mobile",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"module": "./dist/esm/index.js",
|
|
10
|
+
"main": "./dist/cjs/index.js",
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/esm/index.js",
|
|
15
|
+
"require": "./dist/cjs/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"*.css",
|
|
20
|
+
"*.scss"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"pnpm": ">=6",
|
|
28
|
+
"node": ">=16"
|
|
29
|
+
},
|
|
30
|
+
"author": "ICE MT",
|
|
31
|
+
"jestSonar": {
|
|
32
|
+
"sonar56x": true,
|
|
33
|
+
"reportPath": "reports",
|
|
34
|
+
"reportFile": "tests.xml",
|
|
35
|
+
"indent": 4
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@elliemae/ds-props-helpers": "3.32.0-rc.5"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@elliemae/pui-cli": "~9.0.0-next.31",
|
|
42
|
+
"@elliemae/ds-monorepo-devops": "3.32.0-rc.5"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"lodash": "^4.17.21",
|
|
46
|
+
"react": "~17.0.2",
|
|
47
|
+
"react-dom": "^17.0.2",
|
|
48
|
+
"styled-components": "~5.3.9",
|
|
49
|
+
"styled-system": "^5.1.5"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public",
|
|
53
|
+
"typeSafety": true
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
|
|
57
|
+
"test": "pui-cli test --passWithNoTests",
|
|
58
|
+
"lint": "node ../../../scripts/lint.mjs --fix",
|
|
59
|
+
"eslint:fix": "eslint --ext='.js,.jsx,.test.js,.ts,.tsx' --fix --config='../../../.eslintrc.js' src/",
|
|
60
|
+
"dts": "node ../../../scripts/dts.mjs",
|
|
61
|
+
"dts:withdeps": "pnpm --filter {.}... dts",
|
|
62
|
+
"build": "cross-env NODE_ENV=production node ../../../scripts/build/build.mjs",
|
|
63
|
+
"dev:build": "pnpm --filter {.}... build",
|
|
64
|
+
"dev:install": "pnpm --filter {.}... i --no-lockfile && pnpm run dev:build",
|
|
65
|
+
"checkDeps": "npm exec ../../util/ds-codemods -- check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
|
|
66
|
+
}
|
|
67
|
+
}
|