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

@rmwc/textfield

Package Overview
Dependencies
Maintainers
1
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rmwc/textfield - npm Package Compare versions

Comparing version 14.0.8 to 14.0.9

2

index.js

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

"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),s=require("@rmwc/base"),$=require("@rmwc/floating-label"),ee=require("@rmwc/icon"),te=require("@rmwc/line-ripple"),ne=require("@rmwc/notched-outline"),ie=require("@rmwc/ripple"),E=require("@material/textfield"),ae=i=>{const[n,o]=r.useState(),{foundation:a,...u}=s.useFoundation({props:i,api:({foundation:d})=>({getFoundation:()=>d}),elements:{},foundation:()=>new E.MDCTextFieldCharacterCounterFoundation({setContent:d=>{o(d)}})});return{content:n,...u}},le=i=>{const[n,o]=r.useState(!1),[a,u]=r.useState(0),[d,l]=r.useState(),[g,L]=r.useState(!1),[p,M]=r.useState(!1),f=r.useRef(),_=c=>{f.current=c},F=r.useRef(),I=c=>F.current=c,b=r.useRef(),v=c=>b.current=c,N=r.useRef(),B=c=>N.current=c,{content:G}=ae({apiRef:i.characterCount?_:void 0}),{foundation:h,...A}=s.useFoundation({props:i,elements:{rootEl:!0,inputEl:!0},foundation:({rootEl:c,inputEl:m,getProps:T})=>{const j=()=>({shakeLabel:e=>L(e),floatLabel:e=>{M(T().floatLabel??e)},hasLabel:()=>!!T().label,getLabelWidth:()=>{var e;return((e=N.current)==null?void 0:e.getWidth())||0}}),O=()=>({activateLineRipple:()=>{o(!0)},deactivateLineRipple:()=>{o(!1)},setLineRippleTransformOrigin:e=>{u(e)}}),q=()=>({notchOutline:e=>{l(e)},closeOutline:()=>{T().floatLabel??l(void 0)},hasOutline:()=>!!T().outlined}),y=()=>({registerInputInteractionHandler:(e,x)=>m.addEventListener(e,x),deregisterInputInteractionHandler:(e,x)=>m.removeEventListener(e,x),getNativeInput:()=>m.ref}),k=()=>({characterCounter:f.current?f.current.getFoundation():void 0,helperText:void 0,leadingIcon:F.current?F.current.getFoundation():void 0,trailingIcon:b.current?b.current.getFoundation():void 0});return new E.MDCTextFieldFoundation({addClass:e=>c.addClass(e),removeClass:e=>c.removeClass(e),hasClass:e=>c.hasClass(e),registerTextFieldInteractionHandler:(e,x)=>c.addEventListener(e,x),deregisterTextFieldInteractionHandler:(e,x)=>c.removeEventListener(e,x),registerValidationAttributeChangeHandler:e=>{const x=C=>C.map(R=>R.attributeName);if(m.ref){const C=new MutationObserver(J=>e(x(J))),R=m.ref,V={attributes:!0};return R&&C.observe(R,V),C}return{}},deregisterValidationAttributeChangeHandler:e=>{e&&e.disconnect()},isFocused:()=>document.activeElement===m.ref,...y(),...j(),...O(),...q()},k())}}),S=h.getValue();return r.useEffect(()=>{i.value!==void 0&&i.value!==S&&h.setValue(String(i.value))},[i.value,h,S]),r.useEffect(()=>{i.floatLabel!==void 0&&(h.notchOutline(i.floatLabel),h.adapter.floatLabel(i.floatLabel))},[h,i.floatLabel]),{shakeLabel:g,floatLabel:p,notchWidth:d,lineRippleActive:n,lineRippleCenter:a,setCharacterCounter:_,setLeadingIcon:I,setTrailingIcon:v,setFloatingLabel:B,characterCountContent:G,...A}},re=i=>{const{foundation:n,...o}=s.useFoundation({props:i,elements:{rootEl:!0},api:({foundation:a})=>({getFoundation:()=>a}),foundation:({rootEl:a,emit:u})=>new E.MDCTextFieldIconFoundation({getAttr:l=>a.getProp(l),setAttr:(l,g)=>a.setProp(l,g),removeAttr:l=>a.removeProp(l),setContent:l=>{a.setProp("icon",l)},registerInteractionHandler:(l,g)=>a.addEventListener(l,g),deregisterInteractionHandler:(l,g)=>a.removeEventListener(l,g),notifyIconAction:()=>u("onClick",{},!0)})});return{...o}},se=s.createComponent(function(n,o){const{label:a,style:u,outlined:d,align:l,invalid:g,disabled:L,helpText:p,children:M,textarea:f,fullwidth:_,inputRef:F,characterCount:I,icon:b,trailingIcon:v,rootProps:N={},foundationRef:B,ripple:G,prefix:h,suffix:A,resizeable:S,floatLabel:c,...m}=n,{rootEl:T,inputEl:j,shakeLabel:O,floatLabel:q,notchWidth:y,lineRippleActive:k,lineRippleCenter:e,setLeadingIcon:x,setTrailingIcon:C,setFloatingLabel:R,characterCountContent:V}=le(n),K=s.useId("textfield",n)+"-label",X=s.useClassNames(n,["mdc-text-field","mdc-text-field--upgraded",{"mdc-text-field--filled":!d,"mdc-text-field--textarea":f,"mdc-text-field--outlined":d,"mdc-text-field--invalid":g,"mdc-text-field--disabled":L,"mdc-text-field--with-leading-icon":!!b,"mdc-text-field--with-trailing-icon":!!v,"mdc-text-field--no-label":!a,"mdc-text-field--end-aligned":l==="end","mdc-text-field--with-internal-counter":f&&I,"rmwc-text-field--fullwidth":_}]),P=(D,w)=>t.jsx(U,{apiRef:H=>{w==="leading"?x(H):C(H)},position:w,tabIndex:w==="trailing"?0:void 0,icon:D}),Y=D=>{if(!(!!p||I&&!f))return null;const H=typeof p=="object"&&!r.isValidElement(p);return t.jsxs("div",{className:"mdc-text-field-helper-line",children:[p&&H?t.jsx(z,{...p}):t.jsx(z,{children:p}),!f&&D]})},Q=a?t.jsx($.FloatingLabel,{shake:O,float:q,apiRef:R,id:K,children:a}):null,W=I?t.jsx("div",{className:"mdc-text-field-character-counter",children:V}):null,Z=S?t.jsxs("span",{className:"mdc-text-field__resizer",children:[t.jsx(s.Tag,{element:j,className:"mdc-text-field__input",disabled:L,tag:"textarea",...m,ref:s.mergeRefs(o,F)}),W]}):t.jsxs(t.Fragment,{children:[t.jsx(s.Tag,{element:j,className:"mdc-text-field__input",disabled:L,tag:"textarea",...m,ref:s.mergeRefs(o,F)}),W]});return t.jsxs(t.Fragment,{children:[t.jsxs(de,{...N,element:T,style:u,className:X,ref:o,"aria-labelledby":K,children:[!!b&&P(b,"leading"),M,t.jsx(oe,{}),!!h&&!f&&t.jsx(ce,{prefix:h}),f?Z:t.jsx(s.Tag,{element:j,className:"mdc-text-field__input",disabled:L,tag:"input",...m,ref:s.mergeRefs(o,F)}),!!A&&!f&&t.jsx(ue,{suffix:A}),d?t.jsxs(t.Fragment,{children:[t.jsx(ne.NotchedOutline,{notch:y,children:Q}),!!v&&P(v,"trailing")]}):t.jsxs(t.Fragment,{children:[Q,!!v&&P(v,"trailing"),t.jsx(te.LineRipple,{active:k,center:e})]})]}),Y(W)]})}),oe=r.memo(function(){return t.jsx("span",{className:"mdc-text-field__ripple"})}),de=ie.withRipple({surface:!1})(r.forwardRef(function(n,o){return t.jsx(s.Tag,{...n,tag:"label",ref:o})})),ce=r.memo(function({prefix:n}){return t.jsx("span",{className:"mdc-text-field__affix mdc-text-field__affix--prefix",children:n})}),ue=r.memo(function({suffix:n}){return t.jsx("span",{className:"mdc-text-field__affix mdc-text-field__affix--suffix",children:n})}),z=s.createComponent(function(n,o){const{persistent:a,validationMsg:u,...d}=n,l=s.useClassNames(n,["mdc-text-field-helper-text",{"mdc-text-field-helper-text--persistent":a,"mdc-text-field-helper-text--validation-msg":u}]);return t.jsx(s.Tag,{tag:"div",className:l,...d,ref:o})}),U=function(n){const{apiRef:o,position:a,...u}=n,{rootEl:d}=re(n),l=s.useClassNames(n,["mdc-text-field__icon",{"mdc-text-field__icon--trailing":a==="trailing","mdc-text-field__icon--leading":a==="leading"}]);return t.jsx(ee.Icon,{...d.props({...u,className:l})})};U.displayName="TextFieldIcon";exports.TextField=se;exports.TextFieldHelperText=z;
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),s=require("@rmwc/base"),$=require("@rmwc/floating-label"),ee=require("@rmwc/icon"),te=require("@rmwc/line-ripple"),ne=require("@rmwc/notched-outline"),ie=require("@rmwc/ripple"),E=require("@material/textfield"),ae=i=>{const[n,o]=r.useState(),{foundation:a,...u}=s.useFoundation({props:i,api:({foundation:d})=>({getFoundation:()=>d}),elements:{},foundation:()=>new E.MDCTextFieldCharacterCounterFoundation({setContent:d=>{o(d)}})});return{content:n,...u}},le=i=>{const[n,o]=r.useState(!1),[a,u]=r.useState(0),[d,l]=r.useState(),[g,L]=r.useState(!1),[p,M]=r.useState(!1),f=r.useRef(),_=c=>{f.current=c},F=r.useRef(),I=c=>F.current=c,b=r.useRef(),v=c=>b.current=c,N=r.useRef(),B=c=>N.current=c,{content:G}=ae({apiRef:i.characterCount?_:void 0}),{foundation:h,...A}=s.useFoundation({props:i,elements:{rootEl:!0,inputEl:!0},foundation:({rootEl:c,inputEl:m,getProps:T})=>{const j=()=>({shakeLabel:e=>L(e),floatLabel:e=>{M(T().floatLabel??e)},hasLabel:()=>!!T().label,getLabelWidth:()=>{var e;return((e=N.current)==null?void 0:e.getWidth())||0}}),O=()=>({activateLineRipple:()=>{o(!0)},deactivateLineRipple:()=>{o(!1)},setLineRippleTransformOrigin:e=>{u(e)}}),q=()=>({notchOutline:e=>{l(e)},closeOutline:()=>{T().floatLabel??l(void 0)},hasOutline:()=>!!T().outlined}),y=()=>({registerInputInteractionHandler:(e,x)=>m.addEventListener(e,x),deregisterInputInteractionHandler:(e,x)=>m.removeEventListener(e,x),getNativeInput:()=>m.ref}),k=()=>({characterCounter:f.current?f.current.getFoundation():void 0,helperText:void 0,leadingIcon:F.current?F.current.getFoundation():void 0,trailingIcon:b.current?b.current.getFoundation():void 0});return new E.MDCTextFieldFoundation({addClass:e=>c.addClass(e),removeClass:e=>c.removeClass(e),hasClass:e=>c.hasClass(e),registerTextFieldInteractionHandler:(e,x)=>c.addEventListener(e,x),deregisterTextFieldInteractionHandler:(e,x)=>c.removeEventListener(e,x),registerValidationAttributeChangeHandler:e=>{const x=C=>C.map(R=>R.attributeName);if(m.ref){const C=new MutationObserver(J=>e(x(J))),R=m.ref,V={attributes:!0};return R&&C.observe(R,V),C}return{}},deregisterValidationAttributeChangeHandler:e=>{e&&e.disconnect()},isFocused:()=>document.activeElement===m.ref,...y(),...j(),...O(),...q()},k())}}),S=h.getValue();return r.useEffect(()=>{i.value!==void 0&&i.value!==S&&h.setValue(String(i.value))},[i.value,h,S]),r.useEffect(()=>{i.floatLabel!==void 0&&(h.notchOutline(i.floatLabel),h.adapter.floatLabel(i.floatLabel))},[h,i.floatLabel]),{shakeLabel:g,floatLabel:p,notchWidth:d,lineRippleActive:n,lineRippleCenter:a,setCharacterCounter:_,setLeadingIcon:I,setTrailingIcon:v,setFloatingLabel:B,characterCountContent:G,...A}},re=i=>{const{foundation:n,...o}=s.useFoundation({props:i,elements:{rootEl:!0},api:({foundation:a})=>({getFoundation:()=>a}),foundation:({rootEl:a,emit:u})=>new E.MDCTextFieldIconFoundation({getAttr:l=>a.getProp(l),setAttr:(l,g)=>a.setProp(l,g),removeAttr:l=>a.removeProp(l),setContent:l=>{a.setProp("icon",l)},registerInteractionHandler:(l,g)=>a.addEventListener(l,g),deregisterInteractionHandler:(l,g)=>a.removeEventListener(l,g),notifyIconAction:()=>u("onClick",{},!0)})});return{...o}},se=s.createComponent(function(n,o){const{label:a,style:u,outlined:d,align:l,invalid:g,disabled:L,helpText:p,children:M,textarea:f,fullwidth:_,inputRef:F,characterCount:I,icon:b,trailingIcon:v,rootProps:N={},foundationRef:B,ripple:G,prefix:h,suffix:A,resizeable:S,floatLabel:c,...m}=n,{rootEl:T,inputEl:j,shakeLabel:O,floatLabel:q,notchWidth:y,lineRippleActive:k,lineRippleCenter:e,setLeadingIcon:x,setTrailingIcon:C,setFloatingLabel:R,characterCountContent:V}=le(n),K=s.useId("textfield",n)+"-label",X=s.useClassNames(n,["mdc-text-field","mdc-text-field--upgraded",{"mdc-text-field--filled":!d,"mdc-text-field--textarea":f,"mdc-text-field--outlined":d,"mdc-text-field--invalid":g,"mdc-text-field--disabled":L,"mdc-text-field--with-leading-icon":!!b,"mdc-text-field--with-trailing-icon":!!v,"mdc-text-field--no-label":!a,"mdc-text-field--end-aligned":l==="end","mdc-text-field--with-internal-counter":f&&I,"rmwc-text-field--fullwidth":_}]),P=(D,w)=>t.jsx(U,{apiRef:H=>{w==="leading"?x(H):C(H)},position:w,tabIndex:w==="trailing"?0:void 0,icon:D}),Y=D=>{if(!(!!p||I&&!f))return null;const H=typeof p=="object"&&!r.isValidElement(p);return t.jsxs("div",{className:"mdc-text-field-helper-line",children:[p&&H?t.jsx(z,{...p}):t.jsx(z,{children:p}),!f&&D]})},Q=a?t.jsx($.FloatingLabel,{shake:O,float:q,apiRef:R,id:K,children:a}):null,W=I?t.jsx("div",{className:"mdc-text-field-character-counter",children:V}):null,Z=S?t.jsxs("span",{className:"mdc-text-field__resizer",children:[t.jsx(s.Tag,{...m,element:j,className:"mdc-text-field__input",disabled:L,tag:"textarea",ref:s.mergeRefs(o,F)}),W]}):t.jsxs(t.Fragment,{children:[t.jsx(s.Tag,{...m,element:j,className:"mdc-text-field__input",disabled:L,tag:"textarea",ref:s.mergeRefs(o,F)}),W]});return t.jsxs(t.Fragment,{children:[t.jsxs(de,{...N,element:T,style:u,className:X,ref:o,"aria-labelledby":K,children:[!!b&&P(b,"leading"),M,t.jsx(oe,{}),!!h&&!f&&t.jsx(ce,{prefix:h}),f?Z:t.jsx(s.Tag,{...m,element:j,className:"mdc-text-field__input",disabled:L,tag:"input",ref:s.mergeRefs(o,F)}),!!A&&!f&&t.jsx(ue,{suffix:A}),d?t.jsxs(t.Fragment,{children:[t.jsx(ne.NotchedOutline,{notch:y,children:Q}),!!v&&P(v,"trailing")]}):t.jsxs(t.Fragment,{children:[Q,!!v&&P(v,"trailing"),t.jsx(te.LineRipple,{active:k,center:e})]})]}),Y(W)]})}),oe=r.memo(function(){return t.jsx("span",{className:"mdc-text-field__ripple"})}),de=ie.withRipple({surface:!1})(r.forwardRef(function(n,o){return t.jsx(s.Tag,{...n,tag:"label",ref:o})})),ce=r.memo(function({prefix:n}){return t.jsx("span",{className:"mdc-text-field__affix mdc-text-field__affix--prefix",children:n})}),ue=r.memo(function({suffix:n}){return t.jsx("span",{className:"mdc-text-field__affix mdc-text-field__affix--suffix",children:n})}),z=s.createComponent(function(n,o){const{persistent:a,validationMsg:u,...d}=n,l=s.useClassNames(n,["mdc-text-field-helper-text",{"mdc-text-field-helper-text--persistent":a,"mdc-text-field-helper-text--validation-msg":u}]);return t.jsx(s.Tag,{tag:"div",...d,className:l,ref:o})}),U=function(n){const{apiRef:o,position:a,...u}=n,{rootEl:d}=re(n),l=s.useClassNames(n,["mdc-text-field__icon",{"mdc-text-field__icon--trailing":a==="trailing","mdc-text-field__icon--leading":a==="leading"}]);return t.jsx(ee.Icon,{...d.props({...u,className:l})})};U.displayName="TextFieldIcon";exports.TextField=se;exports.TextFieldHelperText=z;
{
"name": "@rmwc/textfield",
"version": "14.0.8",
"version": "14.0.9",
"description": "RMWC TextField component",

@@ -43,10 +43,10 @@ "main": "./index.js",

"@material/textfield": "^14.0.0",
"@rmwc/base": "14.0.8",
"@rmwc/floating-label": "14.0.8",
"@rmwc/icon": "14.0.8",
"@rmwc/line-ripple": "14.0.8",
"@rmwc/notched-outline": "14.0.8",
"@rmwc/ripple": "14.0.8",
"@rmwc/types": "14.0.8"
"@rmwc/base": "14.0.9",
"@rmwc/floating-label": "14.0.9",
"@rmwc/icon": "14.0.9",
"@rmwc/line-ripple": "14.0.9",
"@rmwc/notched-outline": "14.0.9",
"@rmwc/ripple": "14.0.9",
"@rmwc/types": "14.0.9"
}
}

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