Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-md/utils

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-md/utils - npm Package Compare versions

Comparing version 2.7.0 to 2.7.1

es/useOnUnmount.js

18

CHANGELOG.md

@@ -6,2 +6,20 @@ # Change Log

## [2.7.1](https://github.com/mlaursen/react-md/compare/v2.7.0...v2.7.1) (2021-03-23)
### Bug Fixes
* **@react-md/utils:** useTabFocusWrap when only one element ([25178d7](https://github.com/mlaursen/react-md/commit/25178d7c691e3e6fbb2ccaf93cf3c96a0e7c5380))
### Other Internal Changes
* **@react-md/utils:** Added a simple `useOnUnmount` hook ([96f3cc0](https://github.com/mlaursen/react-md/commit/96f3cc04beacacd3a5ffb64ce50c42646f7e9e7d))
* **ts:** stopped using FC type ([c5daa47](https://github.com/mlaursen/react-md/commit/c5daa47d73516e075c036fd745e7228d7f155a62))
# [2.7.0](https://github.com/mlaursen/react-md/compare/v2.6.0...v2.7.0) (2021-02-28)

@@ -8,0 +26,0 @@

41

es/index.js

@@ -0,31 +1,32 @@

export * from "./applyRef";
export * from "./bem";
export * from "./colors";
export * from "./containsElement";
export * from "./defaults";
export * from "./Dir";
export * from "./events";
export * from "./getPercentage";
export * from "./layout";
export * from "./loop";
export * from "./mode";
export * from "./nearest";
export * from "./omit";
export * from "./positioning";
export * from "./scrollIntoView";
export * from "./search";
export * from "./sizing";
export * from "./positioning";
export * from "./wia-aria";
export * from "./Dir";
export * from "./bem";
export * from "./omit";
export * from "./defaults";
export * from "./scrollIntoView";
export * from "./containsElement";
export * from "./throttle";
export * from "./types";
export * from "./unitToNumber";
export * from "./applyRef";
export * from "./throttle";
export * from "./loop";
export * from "./getPercentage";
export * from "./nearest";
export * from "./withinRange";
export * from "./useCloseOnOutsideClick";
export * from "./useEnsuredRef";
export * from "./useInterval";
export * from "./useIsomorphicLayoutEffect";
export * from "./useOnUnmount";
export * from "./useRefCache";
export * from "./useTempValue";
export * from "./useTimeout";
export * from "./useToggle";
export * from "./useInterval";
export * from "./useTimeout";
export * from "./useTempValue";
export * from "./useRefCache";
export * from "./useCloseOnOutsideClick";
export * from "./types";
export * from "./wia-aria";
export * from "./withinRange";
//# sourceMappingURL=index.js.map

@@ -7,5 +7,5 @@ import { useAppSize } from "./useAppSize";

*/
export var MobileOnly = function (props) {
var _a = props, children = _a.children, fallback = _a.fallback;
var _b = useAppSize(), isPhone = _b.isPhone, isTablet = _b.isTablet;
export function MobileOnly(_a) {
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? null : _b;
var _c = useAppSize(), isPhone = _c.isPhone, isTablet = _c.isTablet;
if (isPhone || isTablet) {

@@ -15,3 +15,3 @@ return children;

return fallback;
};
}
/**

@@ -21,4 +21,4 @@ * A simple component that will render the children only when the app is

*/
export var PhoneOnly = function (props) {
var _a = props, children = _a.children, fallback = _a.fallback;
export function PhoneOnly(_a) {
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? null : _b;
var isPhone = useAppSize().isPhone;

@@ -29,3 +29,3 @@ if (isPhone) {

return fallback;
};
}
/**

@@ -35,4 +35,4 @@ * A simple component that will render the children only when the app is

*/
export var TabletOnly = function (props) {
var _a = props, children = _a.children, fallback = _a.fallback;
export function TabletOnly(_a) {
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? null : _b;
var isTablet = useAppSize().isTablet;

@@ -43,3 +43,3 @@ if (isTablet) {

return fallback;
};
}
/**

@@ -49,4 +49,4 @@ * A simple component that will render the children only when the app is

*/
export var DesktopOnly = function (props) {
var _a = props, children = _a.children, fallback = _a.fallback;
export function DesktopOnly(_a) {
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? null : _b;
var isDesktop = useAppSize().isDesktop;

@@ -57,10 +57,3 @@ if (isDesktop) {

return fallback;
};
var defaultProps = {
fallback: null,
};
MobileOnly.defaultProps = defaultProps;
PhoneOnly.defaultProps = defaultProps;
TabletOnly.defaultProps = defaultProps;
DesktopOnly.defaultProps = defaultProps;
}
//# sourceMappingURL=MediaOnly.js.map

@@ -33,2 +33,3 @@ import { useCallback, useRef } from "react";

event.preventDefault();
elements[0].focus();
}

@@ -35,0 +36,0 @@ else if (elements[0] === event.target && event.shiftKey) {

@@ -0,30 +1,31 @@

export * from "./applyRef";
export * from "./bem";
export * from "./colors";
export * from "./containsElement";
export * from "./defaults";
export * from "./Dir";
export * from "./events";
export * from "./getPercentage";
export * from "./layout";
export * from "./loop";
export * from "./mode";
export * from "./nearest";
export * from "./omit";
export * from "./positioning";
export * from "./scrollIntoView";
export * from "./search";
export * from "./sizing";
export * from "./positioning";
export * from "./wia-aria";
export * from "./Dir";
export * from "./bem";
export * from "./omit";
export * from "./defaults";
export * from "./scrollIntoView";
export * from "./containsElement";
export * from "./throttle";
export * from "./types";
export * from "./unitToNumber";
export * from "./applyRef";
export * from "./throttle";
export * from "./loop";
export * from "./getPercentage";
export * from "./nearest";
export * from "./withinRange";
export * from "./useCloseOnOutsideClick";
export * from "./useEnsuredRef";
export * from "./useInterval";
export * from "./useIsomorphicLayoutEffect";
export * from "./useOnUnmount";
export * from "./useRefCache";
export * from "./useTempValue";
export * from "./useTimeout";
export * from "./useToggle";
export * from "./useInterval";
export * from "./useTimeout";
export * from "./useTempValue";
export * from "./useRefCache";
export * from "./useCloseOnOutsideClick";
export * from "./types";
export * from "./wia-aria";
export * from "./withinRange";

@@ -13,32 +13,33 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./applyRef"), exports);
__exportStar(require("./bem"), exports);
__exportStar(require("./colors"), exports);
__exportStar(require("./containsElement"), exports);
__exportStar(require("./defaults"), exports);
__exportStar(require("./Dir"), exports);
__exportStar(require("./events"), exports);
__exportStar(require("./getPercentage"), exports);
__exportStar(require("./layout"), exports);
__exportStar(require("./loop"), exports);
__exportStar(require("./mode"), exports);
__exportStar(require("./nearest"), exports);
__exportStar(require("./omit"), exports);
__exportStar(require("./positioning"), exports);
__exportStar(require("./scrollIntoView"), exports);
__exportStar(require("./search"), exports);
__exportStar(require("./sizing"), exports);
__exportStar(require("./positioning"), exports);
__exportStar(require("./wia-aria"), exports);
__exportStar(require("./Dir"), exports);
__exportStar(require("./bem"), exports);
__exportStar(require("./omit"), exports);
__exportStar(require("./defaults"), exports);
__exportStar(require("./scrollIntoView"), exports);
__exportStar(require("./containsElement"), exports);
__exportStar(require("./throttle"), exports);
__exportStar(require("./types"), exports);
__exportStar(require("./unitToNumber"), exports);
__exportStar(require("./applyRef"), exports);
__exportStar(require("./throttle"), exports);
__exportStar(require("./loop"), exports);
__exportStar(require("./getPercentage"), exports);
__exportStar(require("./nearest"), exports);
__exportStar(require("./withinRange"), exports);
__exportStar(require("./useCloseOnOutsideClick"), exports);
__exportStar(require("./useEnsuredRef"), exports);
__exportStar(require("./useInterval"), exports);
__exportStar(require("./useIsomorphicLayoutEffect"), exports);
__exportStar(require("./useOnUnmount"), exports);
__exportStar(require("./useRefCache"), exports);
__exportStar(require("./useTempValue"), exports);
__exportStar(require("./useTimeout"), exports);
__exportStar(require("./useToggle"), exports);
__exportStar(require("./useInterval"), exports);
__exportStar(require("./useTimeout"), exports);
__exportStar(require("./useTempValue"), exports);
__exportStar(require("./useRefCache"), exports);
__exportStar(require("./useCloseOnOutsideClick"), exports);
__exportStar(require("./types"), exports);
__exportStar(require("./wia-aria"), exports);
__exportStar(require("./withinRange"), exports);
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import { FC, ReactElement } from "react";
import { ReactElement } from "react";
export interface MediaOnlyProps {

@@ -17,3 +17,3 @@ /**

*/
export declare const MobileOnly: FC<MediaOnlyProps>;
export declare function MobileOnly({ children, fallback, }: MediaOnlyProps): ReactElement | null;
/**

@@ -23,3 +23,3 @@ * A simple component that will render the children only when the app is

*/
export declare const PhoneOnly: FC<MediaOnlyProps>;
export declare function PhoneOnly({ children, fallback, }: MediaOnlyProps): ReactElement | null;
/**

@@ -29,3 +29,3 @@ * A simple component that will render the children only when the app is

*/
export declare const TabletOnly: FC<MediaOnlyProps>;
export declare function TabletOnly({ children, fallback, }: MediaOnlyProps): ReactElement | null;
/**

@@ -35,2 +35,2 @@ * A simple component that will render the children only when the app is

*/
export declare const DesktopOnly: FC<MediaOnlyProps>;
export declare function DesktopOnly({ children, fallback, }: MediaOnlyProps): ReactElement | null;

@@ -10,5 +10,5 @@ "use strict";

*/
var MobileOnly = function (props) {
var _a = props, children = _a.children, fallback = _a.fallback;
var _b = useAppSize_1.useAppSize(), isPhone = _b.isPhone, isTablet = _b.isTablet;
function MobileOnly(_a) {
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? null : _b;
var _c = useAppSize_1.useAppSize(), isPhone = _c.isPhone, isTablet = _c.isTablet;
if (isPhone || isTablet) {

@@ -18,3 +18,3 @@ return children;

return fallback;
};
}
exports.MobileOnly = MobileOnly;

@@ -25,4 +25,4 @@ /**

*/
var PhoneOnly = function (props) {
var _a = props, children = _a.children, fallback = _a.fallback;
function PhoneOnly(_a) {
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? null : _b;
var isPhone = useAppSize_1.useAppSize().isPhone;

@@ -33,3 +33,3 @@ if (isPhone) {

return fallback;
};
}
exports.PhoneOnly = PhoneOnly;

@@ -40,4 +40,4 @@ /**

*/
var TabletOnly = function (props) {
var _a = props, children = _a.children, fallback = _a.fallback;
function TabletOnly(_a) {
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? null : _b;
var isTablet = useAppSize_1.useAppSize().isTablet;

@@ -48,3 +48,3 @@ if (isTablet) {

return fallback;
};
}
exports.TabletOnly = TabletOnly;

@@ -55,4 +55,4 @@ /**

*/
var DesktopOnly = function (props) {
var _a = props, children = _a.children, fallback = _a.fallback;
function DesktopOnly(_a) {
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? null : _b;
var isDesktop = useAppSize_1.useAppSize().isDesktop;

@@ -63,11 +63,4 @@ if (isDesktop) {

return fallback;
};
}
exports.DesktopOnly = DesktopOnly;
var defaultProps = {
fallback: null,
};
exports.MobileOnly.defaultProps = defaultProps;
exports.PhoneOnly.defaultProps = defaultProps;
exports.TabletOnly.defaultProps = defaultProps;
exports.DesktopOnly.defaultProps = defaultProps;
//# sourceMappingURL=MediaOnly.js.map

@@ -36,2 +36,3 @@ "use strict";

event.preventDefault();
elements[0].focus();
}

@@ -38,0 +39,0 @@ else if (elements[0] === event.target && event.shiftKey) {

{
"name": "@react-md/utils",
"version": "2.7.0",
"version": "2.7.1",
"description": "General utils for react-md.",

@@ -50,3 +50,3 @@ "main": "./lib/index.js",

},
"gitHead": "931e81f628b580837df3a97267a42c9880b13815"
"gitHead": "4fb8828b048fd2472096d5f55033cc4a7ba24e1a"
}

@@ -0,35 +1,31 @@

export * from "./applyRef";
export * from "./bem";
export * from "./colors";
export * from "./containsElement";
export * from "./defaults";
export * from "./Dir";
export * from "./events";
export * from "./getPercentage";
export * from "./layout";
export * from "./loop";
export * from "./mode";
export * from "./nearest";
export * from "./omit";
export * from "./positioning";
export * from "./scrollIntoView";
export * from "./search";
export * from "./sizing";
export * from "./positioning";
export * from "./wia-aria";
export * from "./Dir";
export * from "./bem";
export * from "./omit";
export * from "./defaults";
export * from "./scrollIntoView";
export * from "./containsElement";
export * from "./throttle";
export * from "./types";
export * from "./unitToNumber";
export * from "./applyRef";
export * from "./throttle";
export * from "./loop";
export * from "./getPercentage";
export * from "./nearest";
export * from "./withinRange";
export * from "./useCloseOnOutsideClick";
export * from "./useEnsuredRef";
export * from "./useInterval";
export * from "./useIsomorphicLayoutEffect";
export * from "./useOnUnmount";
export * from "./useRefCache";
export * from "./useTempValue";
export * from "./useTimeout";
export * from "./useToggle";
export * from "./useInterval";
export * from "./useTimeout";
export * from "./useTempValue";
export * from "./useRefCache";
export * from "./useCloseOnOutsideClick";
export * from "./types";
export * from "./wia-aria";
export * from "./withinRange";

@@ -63,2 +63,3 @@ import { useCallback, useRef } from "react";

event.preventDefault();
elements[0].focus();
} else if (elements[0] === event.target && event.shiftKey) {

@@ -65,0 +66,0 @@ event.preventDefault();

@@ -0,30 +1,31 @@

export * from "./applyRef";
export * from "./bem";
export * from "./colors";
export * from "./containsElement";
export * from "./defaults";
export * from "./Dir";
export * from "./events";
export * from "./getPercentage";
export * from "./layout";
export * from "./loop";
export * from "./mode";
export * from "./nearest";
export * from "./omit";
export * from "./positioning";
export * from "./scrollIntoView";
export * from "./search";
export * from "./sizing";
export * from "./positioning";
export * from "./wia-aria";
export * from "./Dir";
export * from "./bem";
export * from "./omit";
export * from "./defaults";
export * from "./scrollIntoView";
export * from "./containsElement";
export * from "./throttle";
export * from "./types";
export * from "./unitToNumber";
export * from "./applyRef";
export * from "./throttle";
export * from "./loop";
export * from "./getPercentage";
export * from "./nearest";
export * from "./withinRange";
export * from "./useCloseOnOutsideClick";
export * from "./useEnsuredRef";
export * from "./useInterval";
export * from "./useIsomorphicLayoutEffect";
export * from "./useOnUnmount";
export * from "./useRefCache";
export * from "./useTempValue";
export * from "./useTimeout";
export * from "./useToggle";
export * from "./useInterval";
export * from "./useTimeout";
export * from "./useTempValue";
export * from "./useRefCache";
export * from "./useCloseOnOutsideClick";
export * from "./types";
export * from "./wia-aria";
export * from "./withinRange";

@@ -1,2 +0,2 @@

import { FC, ReactElement } from "react";
import { ReactElement } from "react";
export interface MediaOnlyProps {

@@ -17,3 +17,3 @@ /**

*/
export declare const MobileOnly: FC<MediaOnlyProps>;
export declare function MobileOnly({ children, fallback, }: MediaOnlyProps): ReactElement | null;
/**

@@ -23,3 +23,3 @@ * A simple component that will render the children only when the app is

*/
export declare const PhoneOnly: FC<MediaOnlyProps>;
export declare function PhoneOnly({ children, fallback, }: MediaOnlyProps): ReactElement | null;
/**

@@ -29,3 +29,3 @@ * A simple component that will render the children only when the app is

*/
export declare const TabletOnly: FC<MediaOnlyProps>;
export declare function TabletOnly({ children, fallback, }: MediaOnlyProps): ReactElement | null;
/**

@@ -35,2 +35,2 @@ * A simple component that will render the children only when the app is

*/
export declare const DesktopOnly: FC<MediaOnlyProps>;
export declare function DesktopOnly({ children, fallback, }: MediaOnlyProps): ReactElement | null;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc