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

polythene-core-textfield

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

polythene-core-textfield - npm Package Compare versions

Comparing version 1.7.1 to 1.7.2

2

dist/polythene-core-textfield.js

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("polythene-core")):"function"==typeof define&&define.amd?define(["exports","polythene-core"],t):t((e=e||self).polythene={},e["polythene-core"])}(this,function(e,t){"use strict";function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(n,!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t){if(null==e)return{};var r,n,l=function(e,t){if(null==e)return{};var r,n,l={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(l[r]=e[r]);return l}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r])}return l}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,l=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(n=(u=a.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(e){l=!0,i=e}finally{try{n||null==a.return||a.return()}finally{if(l)throw i}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var o={component:"pe-textfield",counter:"pe-textfield__counter",error:"pe-textfield__error",errorPlaceholder:"pe-textfield__error-placeholder",focusHelp:"pe-textfield__help-focus",help:"pe-textfield__help",input:"pe-textfield__input",inputArea:"pe-textfield__input-area",label:"pe-textfield__label",optionalIndicator:"pe-textfield__optional-indicator",requiredIndicator:"pe-textfield__required-indicator",hasCounter:"pe-textfield--counter",hasFloatingLabel:"pe-textfield--floating-label",hasFullWidth:"pe-textfield--full-width",hideClear:"pe-textfield--hide-clear",hideSpinner:"pe-textfield--hide-spinner",hideValidation:"pe-textfield--hide-validation",isDense:"pe-textfield--dense",isRequired:"pe-textfield--required",stateDirty:"pe-textfield--dirty",stateDisabled:"pe-textfield--disabled",stateFocused:"pe-textfield--focused",stateInvalid:"pe-textfield--invalid",stateReadonly:"pe-textfield--readonly"},c={invalid:!1,message:void 0},d=function(e,t){return e.ignoreEvents&&-1!==e.ignoreEvents.indexOf(t)};e._TextField=function(e){var l=e.h,s=e.a,f=e.useState,p=e.useEffect,v=e.useRef,h=e.getRef,y=u(e,["h","a","useState","useEffect","useRef","getRef"]),b=void 0!==y.defaultValue&&null!==y.defaultValue?y.defaultValue.toString():void 0!==y.value&&null!==y.value?y.value.toString():"",m=a(f(),2),g=m[0],x=m[1],O=a(f(!1),2),_=O[0],j=O[1],S=a(f(b),2),w=S[0],q=S[1],I=v(),P=v(),k=v(),N=v(),E=v(),D=v(),A=v(),C=y.multiLine?"textarea":"input",F=!!(void 0!==y.valid||y.validate||y.min||y.max||y[s.minlength]||y[s.maxlength]||y.required||y.pattern),R=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.type,r=e.focus,n=e.value;I.current&&(void 0!==n&&(I.current.value=n),void 0!==r&&(E.current=r,r?I.current.focus():I.current.blur()),"input"===t&&(y.validateOnInput||y.counter)&&(D.current=I.current.value!==b),"input"!==t&&(D.current=I.current.value!==b),"onblur"===t&&(D.current=!0),N.current=""!==I.current.value,L(),H(),P.current!==I.current.value&&q(I.current.value))},V=function(){var e=c;return D.current&&_&&0===I.current.value.length&&y.validateResetOnClear&&(D.current=!1,j(!1),A.current=void 0),y.counter&&(e={invalid:I.current.value.length>y.counter,message:y.error}),!e.invalid&&I.current.checkValidity&&(e={invalid:!I.current.checkValidity(),message:y.error}),!e.invalid&&y.validate&&(e=function(){if(!I.current)return c;var e=y.validate(I.current.value);return{invalid:e&&!e.valid,message:e&&e.error}}()),e},L=function(){var e=void 0!==y.valid?{invalid:!y.valid,message:y.error}:D.current||y.validateAtStart?V():c,t=_;A.current=e.message,e.invalid!==t&&j(e.invalid),e.invalid||(A.current=void 0)},H=function(){if(y.onChange){var e=V(),t={focus:E.current,dirty:N.current,invalid:e.invalid,error:e.error,value:I.current.value};JSON.stringify(t)!==JSON.stringify(k.current)&&(y.onChange(i({},t,{el:I.current,setInputState:function(e){var t=void 0!==e.value&&e.value!==I.current.value,r=void 0!==e.focus&&e.focus!==E.current;(t||r)&&R(e)}})),k.current=t)}};p(function(){N.current=""!==b,E.current=!1,D.current=!1,A.current=y.error},[]),p(function(){g&&(I.current=g.querySelector(C),I.current.value=b,R(),L(),H())},[g]),p(function(){if(I.current){var e=void 0!==y.value&&null!==y.value?y.value:I.current?I.current.value:P.current,t=null==e?"":e.toString();I.current&&P.current!==t&&(I.current.value=t,P.current=t,R({type:"input"}))}},[I.current,y.value]),p(function(){I.current&&(L(),H())},[y,I.current&&I.current.value]);var W=n({},t.filterSupportedAttributes(y),y.testId&&{"data-test-id":y.testId},h(function(e){return e&&!g&&(x(e),y.ref&&y.ref(e))}),{className:[o.component,_?o.stateInvalid:"",E.current?o.stateFocused:"",N.current?o.stateDirty:"",y.floatingLabel?o.hasFloatingLabel:"",y.disabled?o.stateDisabled:"",y.readonly?o.stateReadonly:"",y.dense?o.isDense:"",y.required?o.isRequired:"",y.fullWidth?o.hasFullWidth:"",y.counter?o.hasCounter:"",!1!==y.hideSpinner&&void 0!==y.hideSpinner?o.hideSpinner:"",!1!==y.hideClear&&void 0!==y.hideClear?o.hideClear:"",y.hideValidation?o.hideValidation:"","dark"===y.tone?"pe-dark-tone":null,"light"===y.tone?"pe-light-tone":null,y.className||y[s.class]].join(" ")}),J=i({},y,{},y.domAttributes),T=y.error||A.current,M=J.multiLine?null:J.type&&"submit"!==J.type&&"search"!==J.type?J.type:"text",z=_&&void 0!==T,B=J.disabled||J[s.readonly],G=J.required&&""!==J.requiredIndicator?l("span",{className:o.requiredIndicator},J.requiredIndicator||"*"):null,K=!J.required&&J.optionalIndicator?l("span",{className:o.optionalIndicator},J.optionalIndicator):null,Q=J.label?[J.label,G,K]:null,U=[l("div",{className:o.inputArea},[Q?l("label",{className:o.label},Q):null,l(C,n({},{className:o.input,disabled:J.disabled},M?{type:M}:null,J.name?{name:J.name}:null,d(J,s.onclick)?null:r({},s.onclick,function(){B||R({focus:!0})}),d(J,s.onfocus)?null:r({},s.onfocus,function(){B||(R({focus:!0}),g&&g.classList.add(o.stateFocused))}),d(J,s.onblur)?null:r({},s.onblur,function(){R({type:"onblur",focus:!1}),g.classList.remove(o.stateFocused)}),d(J,s.oninput)?null:r({},s.oninput,function(e){R({type:"input"})}),d(J,s.onkeydown)?null:r({},s.onkeydown,function(e){"Enter"===e.key?D.current=!0:"Escape"!==e.key&&"Esc"!==e.key||R({focus:!1})}),J.events?J.events:null,void 0!==J.required&&J.required?{required:!0}:null,void 0!==J[s.readonly]&&J[s.readonly]?r({},s.readonly,!0):null,void 0!==J.pattern?{pattern:J.pattern}:null,void 0!==J[s.maxlength]?r({},s.maxlength,J[s.maxlength]):null,void 0!==J[s.minlength]?r({},s.minlength,J[s.minlength]):null,void 0!==J.max?{max:J.max}:null,void 0!==J.min?{min:J.min}:null,void 0!==J[s.autofocus]?r({},s.autofocus,J[s.autofocus]):null,void 0!==J[s.tabindex]?r({},s.tabindex,J[s.tabindex]):null,void 0!==J.rows?{rows:J.rows}:null,void 0!==J.placeholder?{placeholder:J.placeholder}:null,void 0!==J.domAttributes?i({},J.domAttributes):null))]),J.counter?l("div",{className:o.counter},(w.length||0)+" / "+J.counter):null,J.help&&!z?l("div",{className:[o.help,J.focusHelp?o.focusHelp:null].join(" ")},J.help):null,z?l("div",{className:o.error},T):F&&!J.help?l("div",{className:o.errorPlaceholder}):null],X=[y.before].concat(U,[y.after]);return l(y.element||"div",W,X)},Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("polythene-core")):"function"==typeof define&&define.amd?define(["exports","polythene-core"],t):t((e=e||self).polythene={},e["polythene-core"])}(this,function(e,t){"use strict";function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(n,!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t){if(null==e)return{};var r,n,l=function(e,t){if(null==e)return{};var r,n,l={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(l[r]=e[r]);return l}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r])}return l}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,l=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(n=(u=a.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(e){l=!0,i=e}finally{try{n||null==a.return||a.return()}finally{if(l)throw i}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var o={component:"pe-textfield",counter:"pe-textfield__counter",error:"pe-textfield__error",errorPlaceholder:"pe-textfield__error-placeholder",focusHelp:"pe-textfield__help-focus",help:"pe-textfield__help",input:"pe-textfield__input",inputArea:"pe-textfield__input-area",label:"pe-textfield__label",optionalIndicator:"pe-textfield__optional-indicator",requiredIndicator:"pe-textfield__required-indicator",hasCounter:"pe-textfield--counter",hasFloatingLabel:"pe-textfield--floating-label",hasFullWidth:"pe-textfield--full-width",hideClear:"pe-textfield--hide-clear",hideSpinner:"pe-textfield--hide-spinner",hideValidation:"pe-textfield--hide-validation",isDense:"pe-textfield--dense",isRequired:"pe-textfield--required",stateDirty:"pe-textfield--dirty",stateDisabled:"pe-textfield--disabled",stateFocused:"pe-textfield--focused",stateInvalid:"pe-textfield--invalid",stateReadonly:"pe-textfield--readonly"},c={invalid:!1,message:void 0},d=function(e,t){return e.ignoreEvents&&-1!==e.ignoreEvents.indexOf(t)};e._TextField=function(e){var l=e.h,s=e.a,f=e.useState,p=e.useEffect,v=e.useRef,h=e.getRef,y=u(e,["h","a","useState","useEffect","useRef","getRef"]),b=void 0!==y.defaultValue&&null!==y.defaultValue?y.defaultValue.toString():void 0!==y.value&&null!==y.value?y.value.toString():"",m=a(f(),2),g=m[0],x=m[1],O=a(f(!1),2),_=O[0],w=O[1],j=a(f(b),2),S=j[0],k=j[1],q=v(),I=v(),P=v(),N=v(),E=v(),D=v(),A=v(),C=y.multiLine?"textarea":"input",F=!!(void 0!==y.valid||y.validate||y.min||y.max||y[s.minlength]||y[s.maxlength]||y.required||y.pattern),R=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.type,r=e.focus,n=e.value;q.current&&(void 0!==n&&(q.current.value=n),void 0!==r&&(E.current=r,r?q.current.focus():q.current.blur()),"input"===t&&(y.validateOnInput||y.counter)&&(D.current=q.current.value!==b),"input"!==t&&(D.current=q.current.value!==b),"onblur"===t&&(D.current=!0),N.current=""!==q.current.value,L(),H(),I.current!==q.current.value&&k(q.current.value))},V=function(){var e=c;return D.current&&_&&0===q.current.value.length&&y.validateResetOnClear&&(D.current=!1,w(!1),A.current=void 0),y.counter&&(e={invalid:q.current.value.length>y.counter,message:y.error}),!e.invalid&&q.current.checkValidity&&(e={invalid:!q.current.checkValidity(),message:y.error}),!e.invalid&&y.validate&&(e=function(){if(!q.current)return c;var e=y.validate(q.current.value);return{invalid:e&&!e.valid,message:e&&e.error}}()),e},L=function(){var e=void 0!==y.valid?{invalid:!y.valid,message:y.error}:D.current||y.validateAtStart?V():c,t=_;A.current=e.message,e.invalid!==t&&w(e.invalid),e.invalid||(A.current=void 0)},H=function(){if(y.onChange){var e=V(),t={focus:E.current,dirty:N.current,invalid:e.invalid,error:e.error,value:q.current.value};JSON.stringify(t)!==JSON.stringify(P.current)&&(y.onChange(i({},t,{el:q.current,setInputState:function(e){var t=void 0!==e.value&&e.value!==q.current.value,r=void 0!==e.focus&&e.focus!==E.current;(t||r)&&R(e)}})),P.current=t)}};p(function(){N.current=""!==b,E.current=!1,D.current=!1,A.current=y.error},[]),p(function(){g&&(q.current=g.querySelector(C),q.current.value=b,R(),L(),H())},[g]),p(function(){if(q.current){var e=void 0!==y.value&&null!==y.value?y.value:q.current?q.current.value:I.current,t=null==e?"":e.toString();q.current&&I.current!==t&&(q.current.value=t,I.current=t,R({type:"input"}))}},[q.current,y.value]),p(function(){q.current&&(L(),H())},[y,q.current&&q.current.value]);var W=n({},t.filterSupportedAttributes(y),y.testId&&{"data-test-id":y.testId},h(function(e){return e&&!g&&(x(e),y.ref&&y.ref(e))}),{className:[o.component,_?o.stateInvalid:"",E.current?o.stateFocused:"",N.current?o.stateDirty:"",y.floatingLabel?o.hasFloatingLabel:"",y.disabled?o.stateDisabled:"",y.readonly?o.stateReadonly:"",y.dense?o.isDense:"",y.required?o.isRequired:"",y.fullWidth?o.hasFullWidth:"",y.counter?o.hasCounter:"",!1!==y.hideSpinner&&void 0!==y.hideSpinner?o.hideSpinner:"",!1!==y.hideClear&&void 0!==y.hideClear?o.hideClear:"",y.hideValidation?o.hideValidation:"","dark"===y.tone?"pe-dark-tone":null,"light"===y.tone?"pe-light-tone":null,y.className||y[s.class]].join(" ")}),J=i({},y,{},y.domAttributes),T=y.error||A.current,M=J.multiLine?null:J.type&&"submit"!==J.type&&"search"!==J.type?J.type:"text",z=_&&void 0!==T,B=J.disabled||J[s.readonly],G=J.required&&""!==J.requiredIndicator?l("span",{className:o.requiredIndicator},J.requiredIndicator||"*"):null,K=!J.required&&J.optionalIndicator?l("span",{className:o.optionalIndicator},J.optionalIndicator):null,Q=J.label?[J.label,G,K]:null,U=J.events||{},X=[l("div",{className:o.inputArea},[Q?l("label",{className:o.label},Q):null,l(C,n({},{className:o.input,disabled:J.disabled},M?{type:M}:null,J.name?{name:J.name}:null,U,d(J,s.onclick)?null:r({},s.onclick,function(e){B||(R({focus:!0}),U[s.onclick]&&U[s.onclick](e))}),d(J,s.onfocus)?null:r({},s.onfocus,function(e){B||(R({focus:!0}),g&&g.classList.add(o.stateFocused),U[s.onfocus]&&U[s.onfocus](e))}),d(J,s.onblur)?null:r({},s.onblur,function(e){R({type:"onblur",focus:!1}),g.classList.remove(o.stateFocused),U[s.onblur]&&U[s.onblur](e)}),d(J,s.oninput)?null:r({},s.oninput,function(e){R({type:"input"}),U[s.oninput]&&U[s.oninput](e)}),d(J,s.onkeydown)?null:r({},s.onkeydown,function(e){"Enter"===e.key?D.current=!0:"Escape"!==e.key&&"Esc"!==e.key||R({focus:!1}),U[s.onkeydown]&&U[s.onkeydown](e)}),void 0!==J.required&&J.required?{required:!0}:null,void 0!==J[s.readonly]&&J[s.readonly]?r({},s.readonly,!0):null,void 0!==J.pattern?{pattern:J.pattern}:null,void 0!==J[s.maxlength]?r({},s.maxlength,J[s.maxlength]):null,void 0!==J[s.minlength]?r({},s.minlength,J[s.minlength]):null,void 0!==J.max?{max:J.max}:null,void 0!==J.min?{min:J.min}:null,void 0!==J[s.autofocus]?r({},s.autofocus,J[s.autofocus]):null,void 0!==J[s.tabindex]?r({},s.tabindex,J[s.tabindex]):null,void 0!==J.rows?{rows:J.rows}:null,void 0!==J.placeholder?{placeholder:J.placeholder}:null,void 0!==J.domAttributes?i({},J.domAttributes):null))]),J.counter?l("div",{className:o.counter},(S.length||0)+" / "+J.counter):null,J.help&&!z?l("div",{className:[o.help,J.focusHelp?o.focusHelp:null].join(" ")},J.help):null,z?l("div",{className:o.error},T):F&&!J.help?l("div",{className:o.errorPlaceholder}):null],Y=[y.before].concat(X,[y.after]);return l(y.element||"div",W,Y)},Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=polythene-core-textfield.js.map
{
"name": "polythene-core-textfield",
"version": "1.7.1",
"version": "1.7.2",
"description": "",

@@ -19,5 +19,5 @@ "main": "dist/polythene-core-textfield",

"dependencies": {
"polythene-core": "1.7.1",
"polythene-css-classes": "1.7.1",
"polythene-theme": "1.7.1"
"polythene-core": "1.7.2",
"polythene-css-classes": "1.7.2",
"polythene-theme": "1.7.2"
},

@@ -24,0 +24,0 @@ "author": "Arthur Clemens <arthurclemens@gmail.com> (http://arthurclemens.com)",

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