reakit-system
Advanced tools
Comparing version 0.12.0 to 0.12.1
@@ -6,2 +6,13 @@ # Change Log | ||
## [0.12.1](https://github.com/reakit/reakit/tree/master/packages/reakit-system/compare/reakit-system@0.12.0...reakit-system@0.12.1) (2020-05-12) | ||
### Features | ||
* Remove `undefined` props from props hooks and render props ([d95c9e5](https://github.com/reakit/reakit/tree/master/packages/reakit-system/commit/d95c9e5311debc59c3e5d137936cc78e95fb8215)) | ||
# [0.12.0](https://github.com/reakit/reakit/tree/master/packages/reakit-system/compare/reakit-system@0.11.0...reakit-system@0.12.0) (2020-04-29) | ||
@@ -8,0 +19,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],r):r((e=e||self).ReakitSystem={},e.React)}(this,(function(e,r){"use strict";function t(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?n(Object(o),!0).forEach((function(r){t(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function u(e,r){if(null==e)return{};var t,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)t=u[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}function i(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function a(e){var r=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,r){if(e){if("string"==typeof e)return i(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?i(e,r):void 0}}(e)))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(r=e[Symbol.iterator]()).next.bind(r)}function c(e,r){for(var t={},n={},o=0,u=Object.keys(e);o<u.length;o++){var i=u[o];r.indexOf(i)>=0?t[i]=e[i]:n[i]=e[i]}return[t,n]}function s(e){return r.forwardRef(e)}var f=r.createContext({}),l=function(e,t,n){void 0===n&&(n=t.children);var o=r.useContext(f);if(o.useCreateElement)return o.useCreateElement(e,t,n);if(function(e){return"function"==typeof e}(n)){t.children;return n(u(t,["children"]))}return r.createElement(e,t,n)};function p(e,t){r.useDebugValue(e);var n=r.useContext(f);return null!=n[e]?n[e]:t}function v(e,t,n){void 0===t&&(t={}),void 0===n&&(n={});var u="use"+e+"Options";r.useDebugValue(u);var i=p(u);return i?o({},t,{},i(t,n)):t}function y(e,t,n){void 0===t&&(t={}),void 0===n&&(n={});var o="use"+e+"Props";r.useDebugValue(o);var u=p(o);return u?u(t,n):n}function d(e){return"object"==typeof e&&null!=e}function m(e,r){for(var t,n={},o=a(e);!(t=o()).done;)for(var u=t.value,i=0,c=Object.keys(u);i<c.length;i++){var s=c[i];if(!r||r(u[s],s)){var f=n[s]||[];n[s]=[].concat(f,[u[s]])}}return n}function b(e){for(var r=m(e,(function(e){return"function"==typeof e})),t={},n=0,o=Object.keys(r);n<o.length;n++){var u=o[n],i=r[u];t[u]=1===i.length?i[0]:i.reduce((function(e,r){return function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return r.apply(void 0,n.slice(0,-1).concat([e.apply(void 0,n)]))}}))}return t}function O(e){for(var r=m(e,d),t={},n=0,o=Object.keys(r);n<o.length;n++){var u=o[n],i=r[u];t[u]=Object.assign.apply(Object,[{}].concat(i))}return t}e.SystemContext=f,e.SystemProvider=function(e){var t=e.children,n=e.unstable_system;return r.createElement(f.Provider,{value:n},t)},e.createComponent=function(e){var t,n,i=e.as,a=e.useHook,f=e.keys,p=void 0===f?(null==a?void 0:a.__keys)||[]:f,v=e.useCreateElement,y=void 0===v?l:v,d=e.memo,m=function(e,r){var t=e.as,n=void 0===t?i:t,s=u(e,["as"]);if(a){var f,l=c(s,p),v=l[0],d=l[1],m=a(v,o({ref:r},d)),b=m.wrapElement,O=u(m,["wrapElement"]),g=(null===(f=n.render)||void 0===f?void 0:f.__keys)||n.__keys,j=g&&c(s,g)[0],h=j?o({},O,{},j):O,_=y(n,h);return b?b(_):_}return y(n,s)};return m.__keys=p,d?(t=s(m),r.memo(t,n)):s(m)},e.createHook=function(e){var r,t,n=(t=e.compose,Array.isArray(t)?t:void 0!==t?[t]:[]),o=function(r,t){if(e.useOptions&&(r=e.useOptions(r,t)),e.name&&(r=v(e.name,r,t)),e.compose)for(var o,u=a(n);!(o=u()).done;){r=o.value.__useOptions(r,t)}return r},u=function(r,t,u){if(void 0===r&&(r={}),void 0===t&&(t={}),void 0===u&&(u=!1),u||(r=o(r,t)),e.useProps&&(t=e.useProps(r,t)),e.name&&(t=y(e.name,r,t)),e.compose)if(e.useComposeOptions&&(r=e.useComposeOptions(r,t)),e.useComposeProps)t=e.useComposeProps(r,t);else for(var i,c=a(n);!(i=c()).done;){t=(0,i.value)(r,t,!0)}return t||{}};u.__useOptions=o;var i=n.reduce((function(e,r){return e.push.apply(e,r.__keys||[]),e}),[]);return u.__keys=[].concat(i,(null===(r=e.useState)||void 0===r?void 0:r.__keys)||[],e.keys||[]),u},e.mergeSystem=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return Object.assign.apply(Object,[{}].concat(r,[O(r),b(r)]))},e.useCreateElement=l,e.useOptions=v,e.useProps=y,e.useToken=p,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],r):r((e=e||self).ReakitSystem={},e.React)}(this,(function(e,r){"use strict";function t(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?n(Object(o),!0).forEach((function(r){t(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function u(e,r){if(null==e)return{};var t,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)t=u[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}function i(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function a(e){var r=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,r){if(e){if("string"==typeof e)return i(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?i(e,r):void 0}}(e)))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(r=e[Symbol.iterator]()).next.bind(r)}function c(e,r){for(var t={},n={},o=0,u=Object.keys(e);o<u.length;o++){var i=u[o];r.indexOf(i)>=0?t[i]=e[i]:n[i]=e[i]}return[t,n]}function s(e){return r.forwardRef(e)}var f=r.createContext({}),l=function(e,t,n){void 0===n&&(n=t.children);var o=r.useContext(f);if(o.useCreateElement)return o.useCreateElement(e,t,n);if(function(e){return"function"==typeof e}(n)){t.children;return n(u(t,["children"]))}return r.createElement(e,t,n)};function p(e,t){r.useDebugValue(e);var n=r.useContext(f);return null!=n[e]?n[e]:t}function v(e,t,n){void 0===t&&(t={}),void 0===n&&(n={});var u="use"+e+"Options";r.useDebugValue(u);var i=p(u);return i?o(o({},t),i(t,n)):t}function y(e,t,n){void 0===t&&(t={}),void 0===n&&(n={});var o="use"+e+"Props";r.useDebugValue(o);var u=p(o);return u?u(t,n):n}function d(e){return"object"==typeof e&&null!=e}function m(e,r){for(var t,n={},o=a(e);!(t=o()).done;)for(var u=t.value,i=0,c=Object.keys(u);i<c.length;i++){var s=c[i];if(!r||r(u[s],s)){var f=n[s]||[];n[s]=[].concat(f,[u[s]])}}return n}function b(e){for(var r=m(e,(function(e){return"function"==typeof e})),t={},n=0,o=Object.keys(r);n<o.length;n++){var u=o[n],i=r[u];t[u]=1===i.length?i[0]:i.reduce((function(e,r){return function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return r.apply(void 0,n.slice(0,-1).concat([e.apply(void 0,n)]))}}))}return t}function O(e){for(var r=m(e,d),t={},n=0,o=Object.keys(r);n<o.length;n++){var u=o[n],i=r[u];t[u]=Object.assign.apply(Object,[{}].concat(i))}return t}e.SystemContext=f,e.SystemProvider=function(e){var t=e.children,n=e.unstable_system;return r.createElement(f.Provider,{value:n},t)},e.createComponent=function(e){var t,n,i=e.as,a=e.useHook,f=e.keys,p=void 0===f?(null==a?void 0:a.__keys)||[]:f,v=e.useCreateElement,y=void 0===v?l:v,d=e.memo,m=function(e,r){var t=e.as,n=void 0===t?i:t,s=u(e,["as"]);if(a){var f,l=c(s,p),v=l[0],d=l[1],m=a(v,o({ref:r},d)),b=m.wrapElement,O=u(m,["wrapElement"]),g=(null===(f=n.render)||void 0===f?void 0:f.__keys)||n.__keys,j=g&&c(s,g)[0],h=j?o(o({},O),j):O,_=y(n,h);return b?b(_):_}return y(n,s)};return m.__keys=p,d?(t=s(m),r.memo(t,n)):s(m)},e.createHook=function(e){var r,t,n=(t=e.compose,Array.isArray(t)?t:void 0!==t?[t]:[]),o=function(r,t){if(e.useOptions&&(r=e.useOptions(r,t)),e.name&&(r=v(e.name,r,t)),e.compose)for(var o,u=a(n);!(o=u()).done;){r=o.value.__useOptions(r,t)}return r},u=function(r,t,u){if(void 0===r&&(r={}),void 0===t&&(t={}),void 0===u&&(u=!1),u||(r=o(r,t)),e.useProps&&(t=e.useProps(r,t)),e.name&&(t=y(e.name,r,t)),e.compose)if(e.useComposeOptions&&(r=e.useComposeOptions(r,t)),e.useComposeProps)t=e.useComposeProps(r,t);else for(var i,c=a(n);!(i=c()).done;){t=(0,i.value)(r,t,!0)}var s={},f=t||{};for(var l in f)void 0!==f[l]&&(s[l]=f[l]);return s};u.__useOptions=o;var i=n.reduce((function(e,r){return e.push.apply(e,r.__keys||[]),e}),[]);return u.__keys=[].concat(i,(null===(r=e.useState)||void 0===r?void 0:r.__keys)||[],e.keys||[]),u},e.mergeSystem=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return Object.assign.apply(Object,[{}].concat(r,[O(r),b(r)]))},e.useCreateElement=l,e.useOptions=v,e.useProps=y,e.useToken=p,Object.defineProperty(e,"__esModule",{value:!0})})); |
import { forwardRef as forwardRef$1, memo as memo$1 } from 'react'; | ||
import './SystemContext.js'; | ||
import { a as _objectWithoutPropertiesLoose, _ as _objectSpread2 } from './_rollupPluginBabelHelpers-5ba0a876.js'; | ||
import { a as _objectWithoutPropertiesLoose, _ as _objectSpread2 } from './_rollupPluginBabelHelpers-5637b43c.js'; | ||
import { useCreateElement } from './useCreateElement.js'; | ||
@@ -55,3 +55,3 @@ import { splitProps } from 'reakit-utils/splitProps'; | ||
var asOptions = asKeys && splitProps(props, asKeys)[0]; | ||
var allProps = asOptions ? _objectSpread2({}, elementProps, {}, asOptions) : elementProps; | ||
var allProps = asOptions ? _objectSpread2(_objectSpread2({}, elementProps), asOptions) : elementProps; | ||
@@ -58,0 +58,0 @@ var _element = useCreateElement$1(as, allProps); |
@@ -5,3 +5,3 @@ import 'react'; | ||
import { useProps } from './useProps.js'; | ||
import { b as _createForOfIteratorHelperLoose } from './_rollupPluginBabelHelpers-5ba0a876.js'; | ||
import { b as _createForOfIteratorHelperLoose } from './_rollupPluginBabelHelpers-5637b43c.js'; | ||
import { useOptions } from './useOptions.js'; | ||
@@ -102,5 +102,15 @@ import { toArray } from 'reakit-utils/toArray'; | ||
} | ||
} // Remove undefined values from htmlProps | ||
var finalHTMLProps = {}; | ||
var definedHTMLProps = htmlProps || {}; | ||
for (var prop in definedHTMLProps) { | ||
if (definedHTMLProps[prop] !== undefined) { | ||
finalHTMLProps[prop] = definedHTMLProps[prop]; | ||
} | ||
} | ||
return htmlProps || {}; | ||
return finalHTMLProps; | ||
}; | ||
@@ -107,0 +117,0 @@ |
@@ -5,3 +5,3 @@ import 'react'; | ||
export { useProps } from './useProps.js'; | ||
import './_rollupPluginBabelHelpers-5ba0a876.js'; | ||
import './_rollupPluginBabelHelpers-5637b43c.js'; | ||
export { useOptions } from './useOptions.js'; | ||
@@ -8,0 +8,0 @@ export { useCreateElement } from './useCreateElement.js'; |
@@ -1,2 +0,2 @@ | ||
import { b as _createForOfIteratorHelperLoose } from './_rollupPluginBabelHelpers-5ba0a876.js'; | ||
import { b as _createForOfIteratorHelperLoose } from './_rollupPluginBabelHelpers-5637b43c.js'; | ||
import { isObject } from 'reakit-utils/isObject'; | ||
@@ -3,0 +3,0 @@ |
import { useContext, createElement } from 'react'; | ||
import { SystemContext } from './SystemContext.js'; | ||
import { a as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-5ba0a876.js'; | ||
import { a as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-5637b43c.js'; | ||
@@ -5,0 +5,0 @@ function isRenderProp(children) { |
import { useDebugValue } from 'react'; | ||
import './SystemContext.js'; | ||
import { useToken } from './useToken.js'; | ||
import { _ as _objectSpread2 } from './_rollupPluginBabelHelpers-5ba0a876.js'; | ||
import { _ as _objectSpread2 } from './_rollupPluginBabelHelpers-5637b43c.js'; | ||
@@ -53,3 +53,3 @@ /** | ||
if (useHook) { | ||
return _objectSpread2({}, options, {}, useHook(options, htmlProps)); | ||
return _objectSpread2(_objectSpread2({}, options), useHook(options, htmlProps)); | ||
} | ||
@@ -56,0 +56,0 @@ |
@@ -7,3 +7,3 @@ 'use strict'; | ||
require('./SystemContext.js'); | ||
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-770e06b1.js'); | ||
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-b18c4e5e.js'); | ||
var useCreateElement = require('./useCreateElement.js'); | ||
@@ -60,3 +60,3 @@ var splitProps = require('reakit-utils/splitProps'); | ||
var asOptions = asKeys && splitProps.splitProps(props, asKeys)[0]; | ||
var allProps = asOptions ? _rollupPluginBabelHelpers._objectSpread2({}, elementProps, {}, asOptions) : elementProps; | ||
var allProps = asOptions ? _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, elementProps), asOptions) : elementProps; | ||
@@ -63,0 +63,0 @@ var _element = useCreateElement$1(as, allProps); |
@@ -9,3 +9,3 @@ 'use strict'; | ||
var useProps = require('./useProps.js'); | ||
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-770e06b1.js'); | ||
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-b18c4e5e.js'); | ||
var useOptions = require('./useOptions.js'); | ||
@@ -106,5 +106,15 @@ var toArray = require('reakit-utils/toArray'); | ||
} | ||
} // Remove undefined values from htmlProps | ||
var finalHTMLProps = {}; | ||
var definedHTMLProps = htmlProps || {}; | ||
for (var prop in definedHTMLProps) { | ||
if (definedHTMLProps[prop] !== undefined) { | ||
finalHTMLProps[prop] = definedHTMLProps[prop]; | ||
} | ||
} | ||
return htmlProps || {}; | ||
return finalHTMLProps; | ||
}; | ||
@@ -111,0 +121,0 @@ |
@@ -9,3 +9,3 @@ 'use strict'; | ||
var useProps = require('./useProps.js'); | ||
require('./_rollupPluginBabelHelpers-770e06b1.js'); | ||
require('./_rollupPluginBabelHelpers-b18c4e5e.js'); | ||
var useOptions = require('./useOptions.js'); | ||
@@ -12,0 +12,0 @@ var useCreateElement = require('./useCreateElement.js'); |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-770e06b1.js'); | ||
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-b18c4e5e.js'); | ||
var isObject = require('reakit-utils/isObject'); | ||
@@ -8,0 +8,0 @@ |
@@ -7,3 +7,3 @@ 'use strict'; | ||
var SystemContext = require('./SystemContext.js'); | ||
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-770e06b1.js'); | ||
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-b18c4e5e.js'); | ||
@@ -10,0 +10,0 @@ function isRenderProp(children) { |
@@ -8,3 +8,3 @@ 'use strict'; | ||
var useToken = require('./useToken.js'); | ||
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-770e06b1.js'); | ||
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-b18c4e5e.js'); | ||
@@ -58,3 +58,3 @@ /** | ||
if (useHook) { | ||
return _rollupPluginBabelHelpers._objectSpread2({}, options, {}, useHook(options, htmlProps)); | ||
return _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, options), useHook(options, htmlProps)); | ||
} | ||
@@ -61,0 +61,0 @@ |
{ | ||
"name": "reakit-system", | ||
"version": "0.12.0", | ||
"version": "0.12.1", | ||
"description": "Reakit System utils", | ||
@@ -40,3 +40,3 @@ "sideEffects": false, | ||
}, | ||
"gitHead": "0c51c4f3dc1ec9a83b9d915039ad8167f4e4217b" | ||
"gitHead": "60c04a70e5c774fa749f6e291f3f0bbfde8bfc7c" | ||
} |
@@ -96,3 +96,11 @@ import { toArray } from "reakit-utils/toArray"; | ||
} | ||
return htmlProps || ({} as P); | ||
// Remove undefined values from htmlProps | ||
const finalHTMLProps = {} as P; | ||
const definedHTMLProps = htmlProps || ({} as P); | ||
for (const prop in definedHTMLProps) { | ||
if (definedHTMLProps[prop] !== undefined) { | ||
finalHTMLProps[prop] = definedHTMLProps[prop]; | ||
} | ||
} | ||
return finalHTMLProps; | ||
}; | ||
@@ -99,0 +107,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100767
2524