Socket
Socket
Sign inDemoInstall

@chakra-ui/utils

Package Overview
Dependencies
5
Maintainers
4
Versions
257
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.2.0

dist/cjs/focus.js

26

CHANGELOG.md
# Change Log
## 1.2.0
### Minor Changes
- [`61962345c`](https://github.com/chakra-ui/chakra-ui/commit/61962345c5b1c862445c16c586e304b28c376c9a)
[#3291](https://github.com/chakra-ui/chakra-ui/pull/3291) Thanks
[@dominictwlee](https://github.com/dominictwlee)! - Support negative scale
values for css variables.
### Patch Changes
- [`ff4a36bca`](https://github.com/chakra-ui/chakra-ui/commit/ff4a36bca11cc177830f6f1da13700acd1e3a087)
[#3245](https://github.com/chakra-ui/chakra-ui/pull/3245) Thanks
[@segunadebayo](https://github.com/segunadebayo)! - Removed `objectAssign`
function in favor of using native `Object.assign` method. It is
[now supported in most browsers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#browser_compatibility)
This function is only used once in the `system` package as well. This PR
simply removes it to cut bundle size of utils. Less is more 😃.
* [`483687237`](https://github.com/chakra-ui/chakra-ui/commit/483687237f2c4fed05dc6a79693f307c601c1285)
[#3283](https://github.com/chakra-ui/chakra-ui/pull/3283) Thanks
[@segunadebayo](https://github.com/segunadebayo)! - Update focus util to
handle unsupported browsers (Safari), and ability to opt out of
`requestAnimationFrame`
## 1.1.0

@@ -4,0 +30,0 @@

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

exports.isString = isString;
exports.isCssVar = isCssVar;
exports.isInputEvent = isInputEvent;

@@ -85,2 +86,6 @@ exports.__DEV__ = exports.isEmpty = exports.isNull = exports.isEmptyObject = exports.isObject = exports.isUndefined = exports.isDefined = exports.isEmptyArray = exports.isNotNumber = void 0;

return Object.prototype.toString.call(value) === "[object String]";
}
function isCssVar(value) {
return /^var\(--.+\)$/.test(value);
} // Event assertions

@@ -87,0 +92,0 @@

@@ -100,2 +100,10 @@ "use strict";

});
var _focus = require("./focus");
Object.keys(_focus).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _focus[key]) return;
exports[key] = _focus[key];
});
//# sourceMappingURL=index.js.map

6

dist/cjs/object.js

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

exports.objectFilter = objectFilter;
exports.fromEntries = exports.objectKeys = exports.filterUndefined = exports.memoizedGet = exports.memoize = exports.objectAssign = exports.mergeWith = void 0;
exports.fromEntries = exports.objectKeys = exports.filterUndefined = exports.memoizedGet = exports.memoize = exports.mergeWith = void 0;

@@ -17,6 +17,2 @@ var _lodash = _interopRequireDefault(require("lodash.mergewith"));

var _objectAssign = _interopRequireDefault(require("object-assign"));
exports.objectAssign = _objectAssign["default"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -23,0 +19,0 @@

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

exports.isTabbable = isTabbable;
exports.focus = focus;
exports.hasNegativeTabIndex = exports.hasTabIndex = exports.hasDisplayNone = void 0;

@@ -90,31 +89,2 @@

}
var isActiveElement = function isActiveElement(element) {
return document.activeElement === element;
};
function isInputElement(element) {
return isHTMLElement(element) && element.tagName.toLowerCase() === "input" && "select" in element;
}
function focus(element, options) {
if (options === void 0) {
options = {};
}
var _options = options,
_options$isActive = _options.isActive,
isActive = _options$isActive === void 0 ? isActiveElement : _options$isActive,
preventScroll = _options.preventScroll;
if (isActive(element)) return -1;
return requestAnimationFrame(function () {
element.focus({
preventScroll: preventScroll
});
if (isInputElement(element)) {
element.select();
}
});
}
//# sourceMappingURL=tabbable.js.map

@@ -34,2 +34,5 @@ // Number assertions

return Object.prototype.toString.call(value) === "[object String]";
}
export function isCssVar(value) {
return /^var\(--.+\)$/.test(value);
} // Event assertions

@@ -36,0 +39,0 @@

@@ -13,2 +13,3 @@ export * from "./function";

export * from "./responsive";
export * from "./focus";
//# sourceMappingURL=index.js.map
export { default as mergeWith } from "lodash.mergewith";
export { default as objectAssign } from "object-assign";
export function omit(object, keys) {

@@ -4,0 +3,0 @@ var result = {};

@@ -51,29 +51,2 @@ // Really great work done by Diego Haz on this one

}
var isActiveElement = element => document.activeElement === element;
function isInputElement(element) {
return isHTMLElement(element) && element.tagName.toLowerCase() === "input" && "select" in element;
}
export function focus(element, options) {
if (options === void 0) {
options = {};
}
var {
isActive = isActiveElement,
preventScroll
} = options;
if (isActive(element)) return -1;
return requestAnimationFrame(() => {
element.focus({
preventScroll
});
if (isInputElement(element)) {
element.select();
}
});
}
//# sourceMappingURL=tabbable.js.map

@@ -15,4 +15,5 @@ import { ChangeEvent } from "react";

export declare function isString(value: any): value is string;
export declare function isCssVar(value: string): boolean;
export declare function isInputEvent(value: any): value is ChangeEvent;
export declare const isEmpty: (value: any) => boolean;
export declare const __DEV__: boolean;

@@ -13,1 +13,2 @@ export * from "./function";

export * from "./responsive";
export * from "./focus";
import type { Dict } from "./types";
export { default as mergeWith } from "lodash.mergewith";
export { default as objectAssign } from "object-assign";
export declare function omit<T extends Dict, K extends keyof T>(object: T, keys: K[]): Pick<T, Exclude<keyof T, K>>;

@@ -5,0 +4,0 @@ export declare function pick<T extends Dict, K extends keyof T>(object: T, keys: K[]): { [P in K]: T[P]; };

@@ -11,10 +11,1 @@ export declare const hasDisplayNone: (element: HTMLElement) => boolean;

export declare function isTabbable(element?: HTMLElement | null): boolean;
declare const isActiveElement: (element: FocusableElement) => boolean;
export interface FocusableElement {
focus(options?: FocusOptions): void;
}
interface FocusProps extends FocusOptions {
isActive?: typeof isActiveElement;
}
export declare function focus(element: FocusableElement, options?: FocusProps): number;
export {};
{
"name": "@chakra-ui/utils",
"version": "1.1.0",
"version": "1.2.0",
"description": "Common utilties and types for Chakra UI",

@@ -49,4 +49,3 @@ "author": "Segun Adebayo <sage@adebayosegun.com>",

"css-box-model": "1.2.1",
"lodash.mergewith": "4.6.2",
"object-assign": "4.1.1"
"lodash.mergewith": "4.6.2"
},

@@ -53,0 +52,0 @@ "peerDependencies": {

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc