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

reakit-utils

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reakit-utils - npm Package Compare versions

Comparing version 0.15.0 to 0.15.1

dom/package.json

13

CHANGELOG.md

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

## [0.15.1](https://github.com/reakit/reakit/tree/master/packages/reakit-utils/compare/reakit-utils@0.15.0...reakit-utils@0.15.1) (2020-12-11)
### Bug Fixes
* Accept other option props together with the `state` prop ([#799](https://github.com/reakit/reakit/tree/master/packages/reakit-utils/issues/799)) ([a21bb2b](https://github.com/reakit/reakit/tree/master/packages/reakit-utils/commit/a21bb2b22780121125bbf3dfc6160ac29e1a0741)), closes [#798](https://github.com/reakit/reakit/tree/master/packages/reakit-utils/issues/798)
* Add React 17 to peer dependencies ([#807](https://github.com/reakit/reakit/tree/master/packages/reakit-utils/issues/807)) ([411b5aa](https://github.com/reakit/reakit/tree/master/packages/reakit-utils/commit/411b5aa8adf63f3149b40db6a499e65b58929b29)), closes [#776](https://github.com/reakit/reakit/tree/master/packages/reakit-utils/issues/776)
* Fix `Menu` scroll jump ([#801](https://github.com/reakit/reakit/tree/master/packages/reakit-utils/issues/801)) ([96f5dd5](https://github.com/reakit/reakit/tree/master/packages/reakit-utils/commit/96f5dd52704444862d16167db3c82fb89838e3ae)), closes [#751](https://github.com/reakit/reakit/tree/master/packages/reakit-utils/issues/751)
# [0.15.0](https://github.com/reakit/reakit/tree/master/packages/reakit-utils/compare/reakit-utils@0.14.4...reakit-utils@0.15.0) (2020-11-12)

@@ -8,0 +21,0 @@

2

dist/reakit-utils.min.js

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReakitUtils={},e.React)}(this,(function(e,t){"use strict";function n(e){return e?e.ownerDocument||e:document}var r;try{r=window}catch(e){}function o(e){return e&&n(e).defaultView||r}var u=function(){var e=o();return Boolean(void 0!==e&&e.document&&e.document.createElement)}();function i(e,t){return"matches"in e?e.matches(t):"msMatchesSelector"in e?e.msMatchesSelector(t):e.webkitMatchesSelector(t)}function a(e,t){if("closest"in e)return e.closest(t);do{if(i(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}function c(e,t){return e===t||e.contains(t)}function f(e,t,r){if("function"==typeof Event)return new Event(t,r);var o=n(e).createEvent("Event");return o.initEvent(t,null==r?void 0:r.bubbles,null==r?void 0:r.cancelable),o}function l(e){var t=n(e).activeElement;return(null==t?void 0:t.nodeName)?t:null}function s(e){var t=l(e);if(!t)return!1;if(t===e)return!0;var n=t.getAttribute("aria-activedescendant");return!!n&&n===e.id}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach((function(t){v(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function g(e,t,n){return void 0===n&&(n={}),"function"==typeof FocusEvent?new FocusEvent(t,n):f(e,t,n)}var m=u&&"msCrypto"in window;var h=["button","color","file","image","reset","submit"];function O(e){return"object"==typeof e&&null!=e}function E(e){var t;if(!O(e))return!1;var n=Object.getPrototypeOf(e);return null==n||(null===(t=n.constructor)||void 0===t?void 0:t.toString())===Object.toString()}function j(e,t){return-1===t?e:[].concat(e.slice(0,t),e.slice(t+1))}var A="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function w(e){return i(e,A)&&function(e){var t=e;return t.offsetWidth>0||t.offsetHeight>0||e.getClientRects().length>0}(e)}function S(e){return w(e)&&!function(e){return parseInt(e.getAttribute("tabindex")||"0",10)<0}(e)}function T(e){var t=Array.from(e.querySelectorAll(A));return t.unshift(e),t.filter(w)}function P(e,t){var n=Array.from(e.querySelectorAll(A)),r=n.filter(S);return S(e)&&r.unshift(e),!r.length&&t?n:r}function x(e,t){void 0===t&&(t=null),e&&("function"==typeof e?e(t):e.current=t)}var I=u?t.useLayoutEffect:t.useEffect;e.applyState=function(e,t){return function(e){return"function"==typeof e}(e)?e(t):e},e.canUseDOM=u,e.closest=a,e.contains=c,e.createEvent=f,e.createOnKeyDown=function(e){var t=void 0===e?{}:e,n=t.keyMap,r=t.onKey,o=t.stopPropagation,u=t.onKeyDown,i=t.shouldKeyDown,a=void 0===i?function(){return!0}:i,c=t.preventDefault,f=void 0===c||c;return function(e){if(n){var t,i="function"==typeof n?n(e):n,c="function"==typeof f?f(e):f,l="function"==typeof o?o(e):o;if(e.key in i){var s=i[e.key];if("function"==typeof s&&a(e))return c&&e.preventDefault(),l&&e.stopPropagation(),r&&r(e),void s(e)}if(u&&"current"in u)null===(t=u.current)||void 0===t||t.call(u,e);else null==u||u(e)}}},e.ensureFocus=function(e,t){var n=void 0===t?{}:t,r=n.preventScroll,o=n.isActive,u=void 0===o?s:o;return u(e)?-1:(e.focus({preventScroll:r}),u(e)?-1:requestAnimationFrame((function(){e.focus({preventScroll:r})})))},e.fireBlurEvent=function(e,t){var n=g(e,"blur",t),r=e.dispatchEvent(n),o=d(d({},t),{},{bubbles:!0});return e.dispatchEvent(g(e,"focusout",o)),r},e.fireEvent=function(e,t,n){return e.dispatchEvent(f(e,t,n))},e.fireKeyboardEvent=function(e,t,r){return e.dispatchEvent(function(e,t,r){if(void 0===r&&(r={}),"function"==typeof KeyboardEvent)return new KeyboardEvent(t,r);var u=n(e).createEvent("KeyboardEvent");return u.initKeyboardEvent(t,r.bubbles,r.cancelable,o(e),r.key,r.location,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey),u}(e,t,r))},e.flatten=function e(t){for(var n,r=[],o=p(t);!(n=o()).done;){var u=n.value;Array.isArray(u)?r.push.apply(r,e(u)):r.push(u)}return r},e.getActiveElement=l,e.getAllFocusableIn=T,e.getAllTabbableIn=P,e.getClosestFocusable=function(e){for(;e&&!w(e);)e=a(e,A);return e},e.getDocument=n,e.getFirstFocusableIn=function(e){return T(e)[0]||null},e.getFirstTabbableIn=function(e,t){return P(e,t)[0]||null},e.getLastTabbableIn=function(e,t){var n=P(e,t);return n[n.length-1]||null},e.getNextActiveElementOnBlur=function(e){return m?l(e.currentTarget):e.relatedTarget},e.getNextTabbableIn=function(e,t){var n=l(e),r=T(e),o=r.indexOf(n),u=r.slice(o+1);return u.find(S)||r.find(S)||(t?u[0]:null)},e.getPreviousTabbableIn=function(e,t){var n=l(e),r=T(e).reverse(),o=r.indexOf(n),u=r.slice(o+1);return u.find(S)||r.find(S)||(t?u[0]:null)},e.getWindow=o,e.hasFocus=s,e.hasFocusWithin=function(e){var t=l(e);if(!t)return!1;if(c(e,t))return!0;var n=t.getAttribute("aria-activedescendant");return!!n&&(n===e.id||!!e.querySelector("#"+n))},e.isButton=function(e){if("BUTTON"===e.tagName)return!0;if("INPUT"===e.tagName){var t=e;return-1!==h.indexOf(t.type)}return!1},e.isEmpty=function(e){return Array.isArray(e)?!e.length:O(e)?!Object.keys(e).length:null==e||""===e},e.isFocusable=w,e.isInteger=function(e){return"number"==typeof e?Math.floor(e)===e:String(Math.floor(Number(e)))===e},e.isObject=O,e.isPlainObject=E,e.isPortalEvent=function(e){return!c(e.currentTarget,e.target)},e.isPromise=function(e){return Boolean(e&&"then"in e&&e.then)},e.isSelfTarget=function(e){return e.target===e.currentTarget},e.isTabbable=S,e.isTextField=function(e){try{var t=e instanceof HTMLInputElement&&null!==e.selectionStart,n="TEXTAREA"===e.tagName,r="true"===e.contentEditable;return t||n||r||!1}catch(e){return!1}},e.matches=i,e.normalizePropsAreEqual=function(e){return"normalizePropsAreEqualInner"===e.name?e:function(t,n){return E(t.state)&&E(n.state)?e(d(d({},t.state),t),d(d({},n.state),n)):e(t,n)}},e.omit=function(e,t){for(var n=Object.keys(e),r={},o=0;o<n.length;o+=1){var u=n[o];-1===t.indexOf(u)&&(r[u]=e[u])}return r},e.pick=function(e,t){for(var n=Object.keys(e),r={},o=0;o<n.length;o+=1){var u=n[o];t.indexOf(u)>=0&&(r[u]=e[u])}return r},e.removeIndexFromArray=j,e.removeItemFromArray=function(e,t){var n=e.indexOf(t);return j(e,n)},e.shallowEqual=function(e,t){if(e===t)return!0;if(!e)return!1;if(!t)return!1;if("object"!=typeof e)return!1;if("object"!=typeof t)return!1;var n=Object.keys(e),r=Object.keys(t),o=n.length;if(r.length!==o)return!1;for(var u=0,i=n;u<i.length;u++){var a=i[u];if(e[a]!==t[a])return!1}return!0},e.splitProps=function(e,t){if(!E(e.state)&&t)return function(e,t){for(var n={},r={},o=0,u=Object.keys(e);o<u.length;o++){var i=u[o];t.indexOf(i)>=0?n[i]=e[i]:r[i]=e[i]}return[n,r]}(e,t);e.state;var n=function(e,t){if(null==e)return{};var n,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n=u[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,["state"]);return[e.state,n]},e.toArray=function(e){return Array.isArray(e)?e:void 0!==e?[e]:[]},e.useForkRef=function(e,n){return t.useMemo((function(){return null==e&&null==n?null:function(t){x(e,t),x(n,t)}}),[e,n])},e.useLiveRef=function(e){var n=t.useRef(e);return I((function(){n.current=e})),n},e.useSealedState=function(e){return t.useState(e)[0]},e.useUpdateEffect=function(e,n){var r=t.useRef(!1);t.useEffect((function(){if(r.current)return e();r.current=!0}),n)},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReakitUtils={},e.React)}(this,(function(e,t){"use strict";function n(e){return e?e.ownerDocument||e:document}var r;try{r=window}catch(e){}function o(e){return e&&n(e).defaultView||r}var u=function(){var e=o();return Boolean(void 0!==e&&e.document&&e.document.createElement)}();function i(e,t){return"matches"in e?e.matches(t):"msMatchesSelector"in e?e.msMatchesSelector(t):e.webkitMatchesSelector(t)}function a(e,t){if("closest"in e)return e.closest(t);do{if(i(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}function c(e,t){return e===t||e.contains(t)}function f(e,t,r){if("function"==typeof Event)return new Event(t,r);var o=n(e).createEvent("Event");return o.initEvent(t,null==r?void 0:r.bubbles,null==r?void 0:r.cancelable),o}function l(e){var t=n(e).activeElement;return null!=t&&t.nodeName?t:null}function s(e){var t=l(e);if(!t)return!1;if(t===e)return!0;var n=t.getAttribute("aria-activedescendant");return!!n&&n===e.id}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach((function(t){v(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function g(e,t,n){return void 0===n&&(n={}),"function"==typeof FocusEvent?new FocusEvent(t,n):f(e,t,n)}var m=u&&"msCrypto"in window;var h=["button","color","file","image","reset","submit"];function O(e){return"object"==typeof e&&null!=e}function E(e){var t;if(!O(e))return!1;var n=Object.getPrototypeOf(e);return null==n||(null===(t=n.constructor)||void 0===t?void 0:t.toString())===Object.toString()}function A(e,t){return-1===t?e:[].concat(e.slice(0,t),e.slice(t+1))}function j(e,t){for(var n={},r={},o=0,u=Object.keys(e);o<u.length;o++){var i=u[o];t.indexOf(i)>=0?n[i]=e[i]:r[i]=e[i]}return[n,r]}var w="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function S(e){return i(e,w)&&function(e){var t=e;return t.offsetWidth>0||t.offsetHeight>0||e.getClientRects().length>0}(e)}function T(e){return S(e)&&!function(e){return parseInt(e.getAttribute("tabindex")||"0",10)<0}(e)}function P(e){var t=Array.from(e.querySelectorAll(w));return t.unshift(e),t.filter(S)}function x(e,t){var n=Array.from(e.querySelectorAll(w)),r=n.filter(T);return T(e)&&r.unshift(e),!r.length&&t?n:r}function I(e,t){void 0===t&&(t=null),e&&("function"==typeof e?e(t):e.current=t)}var k=u?t.useLayoutEffect:t.useEffect;e.applyState=function(e,t){return function(e){return"function"==typeof e}(e)?e(t):e},e.canUseDOM=u,e.closest=a,e.contains=c,e.createEvent=f,e.createOnKeyDown=function(e){var t=void 0===e?{}:e,n=t.keyMap,r=t.onKey,o=t.stopPropagation,u=t.onKeyDown,i=t.shouldKeyDown,a=void 0===i?function(){return!0}:i,c=t.preventDefault,f=void 0===c||c;return function(e){if(n){var t,i="function"==typeof n?n(e):n,c="function"==typeof f?f(e):f,l="function"==typeof o?o(e):o;if(e.key in i){var s=i[e.key];if("function"==typeof s&&a(e))return c&&e.preventDefault(),l&&e.stopPropagation(),r&&r(e),void s(e)}if(u&&"current"in u)null===(t=u.current)||void 0===t||t.call(u,e);else null==u||u(e)}}},e.ensureFocus=function(e,t){var n=void 0===t?{}:t,r=n.preventScroll,o=n.isActive,u=void 0===o?s:o;return u(e)?-1:(e.focus({preventScroll:r}),u(e)?-1:requestAnimationFrame((function(){e.focus({preventScroll:r})})))},e.fireBlurEvent=function(e,t){var n=g(e,"blur",t),r=e.dispatchEvent(n),o=d(d({},t),{},{bubbles:!0});return e.dispatchEvent(g(e,"focusout",o)),r},e.fireEvent=function(e,t,n){return e.dispatchEvent(f(e,t,n))},e.fireKeyboardEvent=function(e,t,r){return e.dispatchEvent(function(e,t,r){if(void 0===r&&(r={}),"function"==typeof KeyboardEvent)return new KeyboardEvent(t,r);var u=n(e).createEvent("KeyboardEvent");return u.initKeyboardEvent(t,r.bubbles,r.cancelable,o(e),r.key,r.location,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey),u}(e,t,r))},e.flatten=function e(t){for(var n,r=[],o=p(t);!(n=o()).done;){var u=n.value;Array.isArray(u)?r.push.apply(r,e(u)):r.push(u)}return r},e.getActiveElement=l,e.getAllFocusableIn=P,e.getAllTabbableIn=x,e.getClosestFocusable=function(e){for(;e&&!S(e);)e=a(e,w);return e},e.getDocument=n,e.getFirstFocusableIn=function(e){return P(e)[0]||null},e.getFirstTabbableIn=function(e,t){return x(e,t)[0]||null},e.getLastTabbableIn=function(e,t){var n=x(e,t);return n[n.length-1]||null},e.getNextActiveElementOnBlur=function(e){return m?l(e.currentTarget):e.relatedTarget},e.getNextTabbableIn=function(e,t){var n=l(e),r=P(e),o=r.indexOf(n),u=r.slice(o+1);return u.find(T)||r.find(T)||(t?u[0]:null)},e.getPreviousTabbableIn=function(e,t){var n=l(e),r=P(e).reverse(),o=r.indexOf(n),u=r.slice(o+1);return u.find(T)||r.find(T)||(t?u[0]:null)},e.getWindow=o,e.hasFocus=s,e.hasFocusWithin=function(e){var t=l(e);if(!t)return!1;if(c(e,t))return!0;var n=t.getAttribute("aria-activedescendant");return!!n&&(n===e.id||!!e.querySelector("#"+n))},e.isButton=function(e){if("BUTTON"===e.tagName)return!0;if("INPUT"===e.tagName){var t=e;return-1!==h.indexOf(t.type)}return!1},e.isEmpty=function(e){return Array.isArray(e)?!e.length:O(e)?!Object.keys(e).length:null==e||""===e},e.isFocusable=S,e.isInteger=function(e){return"number"==typeof e?Math.floor(e)===e:String(Math.floor(Number(e)))===e},e.isObject=O,e.isPlainObject=E,e.isPortalEvent=function(e){return!c(e.currentTarget,e.target)},e.isPromise=function(e){return Boolean(e&&"then"in e&&e.then)},e.isSelfTarget=function(e){return e.target===e.currentTarget},e.isTabbable=T,e.isTextField=function(e){try{var t=e instanceof HTMLInputElement&&null!==e.selectionStart,n="TEXTAREA"===e.tagName,r="true"===e.contentEditable;return t||n||r||!1}catch(e){return!1}},e.isUA=function(e){return!!u&&-1!==window.navigator.userAgent.indexOf(e)},e.matches=i,e.normalizePropsAreEqual=function(e){return"normalizePropsAreEqualInner"===e.name?e:function(t,n){return E(t.state)&&E(n.state)?e(d(d({},t.state),t),d(d({},n.state),n)):e(t,n)}},e.omit=function(e,t){for(var n=Object.keys(e),r={},o=0;o<n.length;o+=1){var u=n[o];-1===t.indexOf(u)&&(r[u]=e[u])}return r},e.pick=function(e,t){for(var n=Object.keys(e),r={},o=0;o<n.length;o+=1){var u=n[o];t.indexOf(u)>=0&&(r[u]=e[u])}return r},e.removeIndexFromArray=A,e.removeItemFromArray=function(e,t){var n=e.indexOf(t);return A(e,n)},e.shallowEqual=function(e,t){if(e===t)return!0;if(!e)return!1;if(!t)return!1;if("object"!=typeof e)return!1;if("object"!=typeof t)return!1;var n=Object.keys(e),r=Object.keys(t),o=n.length;if(r.length!==o)return!1;for(var u=0,i=n;u<i.length;u++){var a=i[u];if(e[a]!==t[a])return!1}return!0},e.splitProps=function(e,t){if(void 0===t&&(t=[]),!E(e.state))return j(e,t);var n=j(e,[].concat(t,["state"])),r=n[0],o=n[1],u=r.state,i=function(e,t){if(null==e)return{};var n,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n=u[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(r,["state"]);return[d(d({},u),i),o]},e.toArray=function(e){return Array.isArray(e)?e:void 0!==e?[e]:[]},e.useForkRef=function(e,n){return t.useMemo((function(){return null==e&&null==n?null:function(t){I(e,t),I(n,t)}}),[e,n])},e.useLiveRef=function(e){var n=t.useRef(e);return k((function(){n.current=e})),n},e.useSealedState=function(e){return t.useState(e)[0]},e.useUpdateEffect=function(e,n){var r=t.useRef(!1);t.useEffect((function(){if(r.current)return e();r.current=!0}),n)},Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -11,3 +11,3 @@ import { getDocument } from './getDocument.js';

if (!(activeElement === null || activeElement === void 0 ? void 0 : activeElement.nodeName)) {
if (!(activeElement !== null && activeElement !== void 0 && activeElement.nodeName)) {
// In IE11, activeElement might be an empty object if we're interacting

@@ -14,0 +14,0 @@ // with elements inside of an iframe.

@@ -36,2 +36,3 @@ import 'react';

export { createOnKeyDown } from './createOnKeyDown.js';
export { isUA } from './dom.js';
export { hasFocus } from './hasFocus.js';

@@ -38,0 +39,0 @@ export { ensureFocus } from './ensureFocus.js';

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

import { _ as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-1f0bf8c2.js';
import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from './_rollupPluginBabelHelpers-1f0bf8c2.js';
import './isObject.js';

@@ -57,12 +57,20 @@ import { isPlainObject } from './isPlainObject.js';

function splitProps(props, keys) {
if (!isPlainObject(props.state) && keys) {
if (keys === void 0) {
keys = [];
}
if (!isPlainObject(props.state)) {
return __deprecatedSplitProps(props, keys);
}
var state = props.state,
restProps = _objectWithoutPropertiesLoose(props, ["state"]);
var _deprecatedSplitProp = __deprecatedSplitProps(props, [].concat(keys, ["state"])),
picked = _deprecatedSplitProp[0],
omitted = _deprecatedSplitProp[1];
return [props.state, restProps];
var state = picked.state,
restPicked = _objectWithoutPropertiesLoose(picked, ["state"]);
return [_objectSpread2(_objectSpread2({}, state), restPicked), omitted];
}
export { splitProps };

@@ -15,3 +15,3 @@ 'use strict';

if (!(activeElement === null || activeElement === void 0 ? void 0 : activeElement.nodeName)) {
if (!(activeElement !== null && activeElement !== void 0 && activeElement.nodeName)) {
// In IE11, activeElement might be an empty object if we're interacting

@@ -18,0 +18,0 @@ // with elements inside of an iframe.

@@ -40,2 +40,3 @@ 'use strict';

var createOnKeyDown = require('./createOnKeyDown.js');
var dom = require('./dom.js');
var hasFocus = require('./hasFocus.js');

@@ -93,2 +94,3 @@ var ensureFocus = require('./ensureFocus.js');

exports.createOnKeyDown = createOnKeyDown.createOnKeyDown;
exports.isUA = dom.isUA;
exports.hasFocus = hasFocus.hasFocus;

@@ -95,0 +97,0 @@ exports.ensureFocus = ensureFocus.ensureFocus;

@@ -61,12 +61,20 @@ 'use strict';

function splitProps(props, keys) {
if (!isPlainObject.isPlainObject(props.state) && keys) {
if (keys === void 0) {
keys = [];
}
if (!isPlainObject.isPlainObject(props.state)) {
return __deprecatedSplitProps(props, keys);
}
var state = props.state,
restProps = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(props, ["state"]);
var _deprecatedSplitProp = __deprecatedSplitProps(props, [].concat(keys, ["state"])),
picked = _deprecatedSplitProp[0],
omitted = _deprecatedSplitProp[1];
return [props.state, restProps];
var state = picked.state,
restPicked = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(picked, ["state"]);
return [_rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, state), restPicked), omitted];
}
exports.splitProps = splitProps;
{
"name": "reakit-utils",
"version": "0.15.0",
"version": "0.15.1",
"description": "Reakit utils",

@@ -34,6 +34,6 @@ "sideEffects": false,

"peerDependencies": {
"react": "^16.8.0",
"react-dom": "^16.8.0"
"react": "^16.8.0 || ^17.0.0",
"react-dom": "^16.8.0 || ^17.0.0"
},
"gitHead": "57b1238e714bb4dda3984d62268313c180fcc6a8"
"gitHead": "398e4bad19fa405d93c48121516ab90b91c888a9"
}

@@ -33,2 +33,3 @@ # reakit-utils

- [createOnKeyDown](#createonkeydown)
- [isUA](#isua)
- [ensureFocus](#ensurefocus)

@@ -179,2 +180,10 @@ - [fireBlurEvent](#fireblurevent)

### isUA
Checks if a given string exists in the user agent string.
#### Parameters
- `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
### ensureFocus

@@ -690,3 +699,3 @@

- `props` **T**
- `keys` **(ReadonlyArray&lt;K> | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;K>)?**
- `keys` **(ReadonlyArray&lt;K> | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;K>)** (optional, default `[]`)

@@ -693,0 +702,0 @@ #### Examples

@@ -13,3 +13,6 @@ import { splitProps } from "../splitProps";

splitProps({ state: { a: "aa" }, a: "a", b: "b", c: "c" }, ["b"])
).toEqual([{ a: "aa" }, { a: "a", b: "b", c: "c" }]);
).toEqual([
{ a: "aa", b: "b" },
{ a: "a", c: "c" },
]);
});

@@ -16,0 +19,0 @@

@@ -7,2 +7,3 @@ export * from "./applyState";

export * from "./createOnKeyDown";
export * from "./dom";
export * from "./ensureFocus";

@@ -9,0 +10,0 @@ export * from "./fireEvent";

@@ -58,13 +58,11 @@ import { isPlainObject } from "./isPlainObject";

props: T,
keys?: ReadonlyArray<K> | Array<K>
keys: ReadonlyArray<K> | Array<K> = []
): [{ [P in K]: T["state"][P] }, Omit<T, K>] {
if (!isPlainObject(props.state) && keys) {
if (!isPlainObject(props.state)) {
return __deprecatedSplitProps(props, keys);
}
const [picked, omitted] = __deprecatedSplitProps(props, [...keys, "state"]);
const { state, ...restProps } = props;
return [
props.state as { [P in K]: T["state"][P] },
(restProps as unknown) as Omit<T, K>,
];
const { state, ...restPicked } = picked;
return [{ ...state, ...restPicked }, omitted as Omit<T, K>];
}

@@ -7,2 +7,3 @@ export * from "./applyState";

export * from "./createOnKeyDown";
export * from "./dom";
export * from "./ensureFocus";

@@ -9,0 +10,0 @@ export * from "./fireEvent";

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