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

@rmwc/select

Package Overview
Dependencies
Maintainers
1
Versions
179
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rmwc/select - npm Package Compare versions

Comparing version 14.1.3 to 14.1.4

2

index.js

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

"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("react"),C=require("@rmwc/base"),Ce=require("@rmwc/floating-label"),be=require("@rmwc/line-ripple"),ve=require("@rmwc/notched-outline"),z=require("@rmwc/menu"),ie=require("@rmwc/list"),ne=require("@material/select"),he=require("@rmwc/icon"),Se=e=>{const[c,x]=a.useState(),[u,m]=a.useState(!1),[o,f]=a.useState(0),[b,O]=a.useState(!1),[v,h]=a.useState(!1),[g,p]=a.useState(""),i=a.useRef(-1),B=t=>{i.current=t},M=a.useRef(),w=t=>{M.current=t},S=a.useRef(),N=t=>{S.current=t},G=a.useRef(null),U=t=>{G.current=t},D=a.useRef(),ce=t=>{D.current=t},Q=a.useRef(),se=t=>{Q.current=t},q=a.useRef(!1),{foundation:l,...J}=C.useFoundation({props:e,elements:{rootEl:!0,anchorEl:!0},foundation:({rootEl:t,anchorEl:y,getProps:L,emit:k})=>{const _=()=>!L().enhanced,$=()=>{const r=()=>{var s,d;return(_()?Array.apply(null,(s=Q.current)==null?void 0:s.options):(d=S.current)==null?void 0:d.items())||[]},K=s=>s.getAttribute("data-value")||s.getAttribute("value")||"";return{setSelectedText:s=>p(s),openMenu:()=>{h(!0)},closeMenu:()=>{h(!1)},getAnchorElement:()=>G.current,setMenuAnchorElement:s=>U(s),setMenuAnchorCorner:s=>{var d;return(d=S.current)==null?void 0:d.setAnchorCorner(s)},setMenuWrapFocus:s=>{},focusMenuItemAtIndex:s=>{var d;return(d=S.current)==null?void 0:d.focusItemAtIndex(s)},getMenuItemCount:()=>r().length,getMenuItemValues:()=>r().map(K)||[],getMenuItemTextAtIndex:s=>r()[s].textContent,isSelectAnchorFocused:()=>!!(y.ref&&y.ref===document.activeElement),getSelectAnchorAttr:s=>y.getProp(s),setSelectAnchorAttr:(s,d)=>{if(s==="tabindex"){if(_())return;s="tabIndex"}return y.setProp(s,d)},removeSelectAnchorAttr:s=>{var d;(d=G.current)==null||d.removeAttribute(s)},addMenuClass:s=>{var d,F,E;return(E=(F=(d=S.current)==null?void 0:d.getSurfaceElement())==null?void 0:F.querySelector(".mdc-deprecated-list-item--activated"))==null?void 0:E.classList.add(s)},removeMenuClass:s=>{var d,F,E;return(E=(F=(d=S.current)==null?void 0:d.getSurfaceElement())==null?void 0:F.querySelector(".mdc-deprecated-list-item--activated"))==null?void 0:E.classList.remove(s)},getSelectedIndex:()=>i.current,setSelectedIndex:s=>B(s)}},I=()=>({addClass:r=>{t.addClass(r)},removeClass:r=>{t.removeClass(r)},hasClass:r=>t.hasClass(r),isRtl:()=>t.ref&&window.getComputedStyle(t.ref).getPropertyValue("direction")==="rtl",setRippleCenter:r=>{f(r)},activateBottomLine:()=>m(!0),deactivateBottomLine:()=>m(!1),notifyChange:r=>{q.current||k("onChange",{index:i.current,value:r},!0)}}),te=()=>({hasOutline:()=>!!L().outlined,notchOutline:r=>{x(r)},closeOutline:()=>{x(void 0)}}),xe=()=>({hasLabel:()=>!!L().label,floatLabel:r=>{O(r)},getLabelWidth:()=>{var r;return((r=M.current)==null?void 0:r.getWidth())||0},setLabelRequired:r=>{var K;return(K=M.current)==null?void 0:K.setRequired(r)}}),ge=()=>({leadingIcon:D.current&&D.current.getFoundation()||void 0}),A=new ne.MDCSelectFoundation({...$(),...I(),...te(),...xe()},ge()),T=A.adapter;A.layout=()=>{(()=>{const K=A.getValue();if(T.hasLabel()){const s=!!L().placeholder||K.length>0||i.current>-1,d=T.hasClass(ne.cssClasses.FOCUSED),F=s||d,E=T.hasClass(ne.cssClasses.REQUIRED);A.notchOutline(F),T.floatLabel(F),T.setLabelRequired(E)}})()},Object.defineProperty(A,"menuItemValues",{get:()=>T.getMenuItemValues()});const pe=A.init.bind(A);return A.init=()=>{q.current=!0,pe();const r=String(L().placeholder||"");!A.getValue()&&r&&T.setSelectedText(r),q.current=!1},A}}),{rootEl:j}=J,{onFocus:W}=e,le=a.useCallback(t=>{W==null||W(t),l.handleFocus()},[W,l]),{onBlur:H}=e,re=a.useCallback(t=>{H==null||H(t),l.handleBlur()},[H,l]),{onChange:P}=e,ae=a.useCallback(t=>{P==null||P(t),l.handleChange()},[P,l]),Y=a.useCallback(t=>{var k,_;if((k=j.ref)!=null&&k.querySelector(".mdc-select--disabled"))return;if((_=j.ref)!=null&&_.querySelector(".mdc-menu-surface--open")){l.handleMenuClosed();return}const L=($=>{const I=$.target.getBoundingClientRect();return $.clientX-I.left})(t);j.ref&&j.ref.focus(),l.handleClick(L)},[l,j.ref]),{onKeyDown:V}=e,oe=a.useCallback(t=>{V==null||V(t),l.handleKeydown(t)},[l,V]),ue=a.useCallback(t=>{i.current=t,l.handleMenuItemAction(t)},[l]),de=a.useCallback(()=>{l.handleMenuOpened()},[l]),Z=a.useCallback(()=>{h(!1),l.handleMenuClosed()},[l]),ee=l.getValue(),R=e.value??(i.current===-1?e.defaultValue:void 0),X=Array.isArray(e.options)?e.options.length:Object.values(e.options||{}).length;return a.useEffect(()=>{if(q.current=!0,R!==void 0&&R!==ee){const t=l.menuItemValues.indexOf(R);if(i.current=t,l.setValue(R||""),l.menuItemValues.includes(R)){const y=l.adapter.getMenuItemTextAtIndex(t);p(y)}}C.raf(()=>{q.current=!1})},[R,ee,X,l]),a.useEffect(()=>{l.setDisabled(!!e.disabled)},[l,e.disabled]),a.useEffect(()=>{var t;j.ref&&((t=S.current)==null||t.setAnchorElement(j.ref))},[j.ref]),{notchWidth:c,menuOpen:v,lineRippleActive:u,lineRippleCenter:o,floatLabel:b,selectedIndex:i.current,selectedTextContent:g,setFloatingLabel:w,setMenu:N,setLeadingIcon:ce,setNativeControl:se,handleFocus:le,handleBlur:re,handleClick:Y,handleChange:ae,handleKeydown:oe,handleMenuClosed:Z,handleMenuOpened:de,handleMenuSelected:ue,...J}},je=e=>{const{foundation:c,...x}=C.useFoundation({props:e,elements:{rootEl:!0},api:({foundation:u})=>({getFoundation:()=>u}),foundation:({rootEl:u,emit:m})=>new ne.MDCSelectIconFoundation({getAttr:o=>u.getProp(o),setAttr:(o,f)=>u.setProp(o,f),removeAttr:o=>u.removeProp(o),setContent:o=>{u.ref&&(u.ref.textContent=o)},registerInteractionHandler:(o,f)=>u.addEventListener(o,f),deregisterInteractionHandler:(o,f)=>u.removeEventListener(o,f),notifyIconAction:()=>m("onClick",{},!0)})});return{...x}},Ie=function(c){const{apiRef:x,...u}=c,{rootEl:m}=je(c),o=C.useClassNames(c,["mdc-select__icon"]);return n.jsx(he.Icon,{...m.props({...u,className:o})})},fe=e=>Array.isArray(e)&&e[0]&&typeof e[0]=="object"?e.map(c=>{if(typeof c!="object")throw new Error(`Encountered non object for Select ${c}`);return{...c,options:fe(c.options)}}):Array.isArray(e)?e.map(c=>({value:c,label:c})):typeof e=="object"?Object.keys(e).map(c=>({value:c,label:e[c]})):e,Ae=()=>n.jsxs("span",{className:"mdc-select__dropdown-icon",children:[n.jsx(he.Icon,{className:"mdc-select__dropdown-icon-inactive",icon:"arrow_drop_down"}),n.jsx(he.Icon,{className:"mdc-select__dropdown-icon-active",icon:"arrow_drop_up"})]});function Me(e){const{selectOptions:c,placeholder:x="",children:u,elementRef:m,open:o,label:f,...b}=e,O=({label:h,option:g,index:p})=>n.jsx("option",{...g,value:g.value,children:h},p),v=!e.value&&!e.defaultValue;return n.jsxs("select",{tabIndex:0,...b,ref:m,className:`rmwc-select__native-control${b.className?` ${b.className}`:""}`,children:[(e.placeholder!==void 0||v)&&n.jsx("option",{value:"",disabled:v,children:x}),!!c&&c.map(({label:h,options:g,...p},i)=>g?n.jsx("optgroup",{label:h,children:g.map(({label:B,...M},w)=>O({label:B,option:M,index:w}))},i):O({label:h,option:p,index:i})),u]})}const Re=function(e){return n.jsx(C.Tag,{...e})},ye=a.forwardRef((e,c)=>{const{selectOptions:x,menuApiRef:u,value:m,placeholder:o,children:f,selectedIndex:b,...O}=e;let v=0;const h=C.useClassNames(e,["mdc-select__menu"]),g=({label:p,option:i})=>(v+=1,n.jsx(z.MenuItem,{activated:m!==void 0?i.value===m:v-1===b,...i,"data-value":i.value,children:n.jsx("span",{className:"mdc-deprecated-list-item__text",children:p})},`${p}-${i.value}`));return n.jsxs(z.Menu,{...O,ref:c,apiRef:u,className:h,focusOnOpen:!0,children:[!!e.placeholder&&n.jsx(z.MenuItem,{selected:v-1===b,"data-value":"",theme:"textDisabledOnBackground",children:n.jsx("span",{className:"mdc-deprecated-list-item__text",children:o})}),x.map(({label:p,options:i,...B},M)=>i?n.jsxs(ie.ListGroup,{children:[p&&n.jsx(ie.ListGroupSubheader,{theme:"textDisabledOnBackground",children:p}),n.jsx(z.MenuItems,{children:i.map(({label:w,...S})=>g({label:w,option:S}))}),M<x.length-1&&n.jsx(ie.ListDivider,{})]},M):g({label:p,option:B})),f]})}),Le=({enhanced:e,children:c})=>e?n.jsx(z.MenuSurfaceAnchor,{children:c}):n.jsx(n.Fragment,{children:c}),Oe=C.createComponent(function(c,x){const{placeholder:u,children:m,value:o,outlined:f,label:b="",options:O=[],rootProps:v={},enhanced:h,icon:g,onChange:p,onFocus:i,onBlur:B,onKeyDown:M,invalid:w,inputRef:S,helpText:N,foundationRef:G,...U}=c,D=fe(O),{rootEl:ce,anchorEl:Q,notchWidth:se,menuOpen:q,selectedTextContent:l,lineRippleActive:J,lineRippleCenter:j,floatLabel:W,setFloatingLabel:le,setNativeControl:H,setLeadingIcon:re,selectedIndex:P,setMenu:ae,handleFocus:Y,handleBlur:V,handleClick:oe,handleChange:ue,handleKeydown:de,handleMenuClosed:Z,handleMenuOpened:ee,handleMenuSelected:R}=Se(c),X=C.useId("select",c),t=X+"-label",y=C.useClassNames(c,["mdc-select","rmwc-select__default-width",{"mdc-select--outlined":!!f,"mdc-select--filled":!f,"mdc-select--required":!!c.required,"mdc-select--invalid":!!w,"mdc-select--with-leading-icon":!!g,"mdc-select--no-label":!b}]),L=typeof h=="object"?h:{},k=o!==void 0?void 0:c.defaultValue||"",_=n.jsx(Ce.FloatingLabel,{float:W,apiRef:le,htmlFor:X,id:t,children:b}),$=()=>{if(!!!N)return null;const te=typeof N=="object"&&!a.isValidElement(N);return N&&te?n.jsx(me,{...N}):n.jsx(me,{children:N})};return n.jsxs(Le,{enhanced:h,children:[n.jsxs(C.Tag,{...v,element:ce,ref:x,className:y,children:[n.jsxs(Re,{className:"mdc-select__anchor",role:"button","aria-haspopup":"listbox","aria-labelledby":t,element:Q,onFocus:Y,onBlur:V,onClick:oe,onKeyDown:de,onChange:ue,tabIndex:h?void 0:-1,children:[!!g&&n.jsx(Ie,{apiRef:re,icon:g}),f?n.jsx(ve.NotchedOutline,{notch:se,children:_}):n.jsxs(n.Fragment,{children:[n.jsx(be.LineRipple,{active:J,center:j}),_]}),n.jsx("span",{className:"mdc-select__selected-text-container",children:n.jsx("span",{className:"mdc-select__selected-text",children:l})}),n.jsx(Ae,{}),!h&&n.jsx(Me,{...U,id:X,value:o,children:m,defaultValue:k,placeholder:u,selectOptions:D,elementRef:H,onFocus:Y,onBlur:I=>{V(I),Z()},onChange:I=>{R(I.currentTarget.selectedIndex)}})]}),h&&n.jsx(ye,{...U,...L,ref:x,anchorCorner:"bottomStart",defaultValue:k,placeholder:u,open:q,onClose:Z,onOpen:ee,onSelect:I=>{R(I.detail.index)},selectOptions:D,value:o,selectedIndex:P,menuApiRef:ae,children:m})]}),$()]})}),me=C.createComponent(function(c,x){const{persistent:u,validationMsg:m,...o}=c,f=C.useClassNames(c,["mdc-select-helper-text",{"mdc-select-helper-text--persistent":u,"mdc-select-helper-text--validation-msg":m}]);return n.jsx(C.Tag,{tag:"p",...o,className:f,ref:x})});exports.Select=Oe;exports.SelectHelperText=me;
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),a=require("react"),C=require("@rmwc/base"),Ce=require("@rmwc/floating-label"),be=require("@rmwc/line-ripple"),ve=require("@rmwc/notched-outline"),z=require("@rmwc/menu"),ie=require("@rmwc/list"),ne=require("@material/select"),he=require("@rmwc/icon"),Se=e=>{const[c,x]=a.useState(),[u,m]=a.useState(!1),[o,f]=a.useState(0),[b,O]=a.useState(!1),[v,h]=a.useState(!1),[g,p]=a.useState(""),i=a.useRef(-1),D=t=>{i.current=t},M=a.useRef(),q=t=>{M.current=t},S=a.useRef(),N=t=>{S.current=t},G=a.useRef(null),U=t=>{G.current=t},W=a.useRef(),ce=t=>{W.current=t},Q=a.useRef(),se=t=>{Q.current=t},V=a.useRef(!1),{foundation:l,...J}=C.useFoundation({props:e,elements:{rootEl:!0,anchorEl:!0},foundation:({rootEl:t,anchorEl:y,getProps:L,emit:T})=>{const _=()=>!L().enhanced,K=()=>{const r=()=>{var s,d;return(_()?Array.apply(null,(s=Q.current)==null?void 0:s.options):(d=S.current)==null?void 0:d.items())||[]},F=s=>s.getAttribute("data-value")||s.getAttribute("value")||"";return{setSelectedText:s=>p(s),openMenu:()=>{h(!0)},closeMenu:()=>{h(!1)},getAnchorElement:()=>G.current,setMenuAnchorElement:s=>U(s),setMenuAnchorCorner:s=>{var d;return(d=S.current)==null?void 0:d.setAnchorCorner(s)},setMenuWrapFocus:s=>{},focusMenuItemAtIndex:s=>{var d;return(d=S.current)==null?void 0:d.focusItemAtIndex(s)},getMenuItemCount:()=>r().length,getMenuItemValues:()=>r().map(F)||[],getMenuItemTextAtIndex:s=>r()[s].textContent,isSelectAnchorFocused:()=>!!(y.ref&&y.ref===document.activeElement),getSelectAnchorAttr:s=>y.getProp(s),setSelectAnchorAttr:(s,d)=>{if(s==="tabindex"){if(_())return;s="tabIndex"}return y.setProp(s,d)},removeSelectAnchorAttr:s=>{var d;(d=G.current)==null||d.removeAttribute(s)},addMenuClass:s=>{var d,w,B;return(B=(w=(d=S.current)==null?void 0:d.getSurfaceElement())==null?void 0:w.querySelector(".mdc-deprecated-list-item--activated"))==null?void 0:B.classList.add(s)},removeMenuClass:s=>{var d,w,B;return(B=(w=(d=S.current)==null?void 0:d.getSurfaceElement())==null?void 0:w.querySelector(".mdc-deprecated-list-item--activated"))==null?void 0:B.classList.remove(s)},getSelectedIndex:()=>i.current,setSelectedIndex:s=>D(s)}},I=()=>({addClass:r=>{t.addClass(r)},removeClass:r=>{t.removeClass(r)},hasClass:r=>t.hasClass(r),isRtl:()=>t.ref&&window.getComputedStyle(t.ref).getPropertyValue("direction")==="rtl",setRippleCenter:r=>{f(r)},activateBottomLine:()=>m(!0),deactivateBottomLine:()=>m(!1),notifyChange:r=>{V.current||T("onChange",{index:i.current,value:r},!0)}}),te=()=>({hasOutline:()=>!!L().outlined,notchOutline:r=>{x(r)},closeOutline:()=>{x(void 0)}}),xe=()=>({hasLabel:()=>!!L().label,floatLabel:r=>{O(r)},getLabelWidth:()=>{var r;return((r=M.current)==null?void 0:r.getWidth())||0},setLabelRequired:r=>{var F;return(F=M.current)==null?void 0:F.setRequired(r)}}),ge=()=>({leadingIcon:W.current&&W.current.getFoundation()||void 0}),A=new ne.MDCSelectFoundation({...K(),...I(),...te(),...xe()},ge()),E=A.adapter;A.layout=()=>{(()=>{const F=A.getValue();if(E.hasLabel()){const s=!!L().placeholder||(F==null?void 0:F.length)>0||i.current>-1,d=E.hasClass(ne.cssClasses.FOCUSED),w=s||d,B=E.hasClass(ne.cssClasses.REQUIRED);A.notchOutline(w),E.floatLabel(w),E.setLabelRequired(B)}})()},Object.defineProperty(A,"menuItemValues",{get:()=>E.getMenuItemValues()});const pe=A.init.bind(A);return A.init=()=>{V.current=!0,pe();const r=String(L().placeholder||"");!A.getValue()&&r&&E.setSelectedText(r),V.current=!1},A}}),{rootEl:j}=J,{onFocus:H}=e,le=a.useCallback(t=>{H==null||H(t),l.handleFocus()},[H,l]),{onBlur:P}=e,re=a.useCallback(t=>{P==null||P(t),l.handleBlur()},[P,l]),{onChange:$}=e,ae=a.useCallback(t=>{$==null||$(t),l.handleChange()},[$,l]),Y=a.useCallback(t=>{var T,_;if((T=j.ref)!=null&&T.querySelector(".mdc-select--disabled"))return;if((_=j.ref)!=null&&_.querySelector(".mdc-menu-surface--open")){l.handleMenuClosed();return}const L=(K=>{const I=K.target.getBoundingClientRect();return K.clientX-I.left})(t);j.ref&&j.ref.focus(),l.handleClick(L)},[l,j.ref]),{onKeyDown:k}=e,oe=a.useCallback(t=>{k==null||k(t),l.handleKeydown(t)},[l,k]),ue=a.useCallback(t=>{i.current=t,l.handleMenuItemAction(t)},[l]),de=a.useCallback(()=>{l.handleMenuOpened()},[l]),Z=a.useCallback(()=>{h(!1),l.handleMenuClosed()},[l]),ee=l.getValue(),R=e.value??(i.current===-1?e.defaultValue:void 0),X=Array.isArray(e.options)?e.options.length:Object.values(e.options||{}).length;return a.useEffect(()=>{if(V.current=!0,R!==void 0&&R!==ee){const t=l.menuItemValues.indexOf(R);if(i.current=t,l.setValue(R||""),l.menuItemValues.includes(R)){const y=l.adapter.getMenuItemTextAtIndex(t);p(y)}}C.raf(()=>{V.current=!1})},[R,ee,X,l]),a.useEffect(()=>{l.setDisabled(!!e.disabled)},[l,e.disabled]),a.useEffect(()=>{var t;j.ref&&((t=S.current)==null||t.setAnchorElement(j.ref))},[j.ref]),{notchWidth:c,menuOpen:v,lineRippleActive:u,lineRippleCenter:o,floatLabel:b,selectedIndex:i.current,selectedTextContent:g,setFloatingLabel:q,setMenu:N,setLeadingIcon:ce,setNativeControl:se,handleFocus:le,handleBlur:re,handleClick:Y,handleChange:ae,handleKeydown:oe,handleMenuClosed:Z,handleMenuOpened:de,handleMenuSelected:ue,...J}},je=e=>{const{foundation:c,...x}=C.useFoundation({props:e,elements:{rootEl:!0},api:({foundation:u})=>({getFoundation:()=>u}),foundation:({rootEl:u,emit:m})=>new ne.MDCSelectIconFoundation({getAttr:o=>u.getProp(o),setAttr:(o,f)=>u.setProp(o,f),removeAttr:o=>u.removeProp(o),setContent:o=>{u.ref&&(u.ref.textContent=o)},registerInteractionHandler:(o,f)=>u.addEventListener(o,f),deregisterInteractionHandler:(o,f)=>u.removeEventListener(o,f),notifyIconAction:()=>m("onClick",{},!0)})});return{...x}},Ie=function(c){const{apiRef:x,...u}=c,{rootEl:m}=je(c),o=C.useClassNames(c,["mdc-select__icon"]);return n.jsx(he.Icon,{...m.props({...u,className:o})})},fe=e=>Array.isArray(e)&&e[0]&&typeof e[0]=="object"?e.map(c=>{if(typeof c!="object")throw new Error(`Encountered non object for Select ${c}`);return{...c,options:fe(c.options)}}):Array.isArray(e)?e.map(c=>({value:c,label:c})):typeof e=="object"?Object.keys(e).map(c=>({value:c,label:e[c]})):e,Ae=()=>n.jsxs("span",{className:"mdc-select__dropdown-icon",children:[n.jsx(he.Icon,{className:"mdc-select__dropdown-icon-inactive",icon:"arrow_drop_down"}),n.jsx(he.Icon,{className:"mdc-select__dropdown-icon-active",icon:"arrow_drop_up"})]});function Me(e){const{selectOptions:c,placeholder:x="",children:u,elementRef:m,open:o,label:f,...b}=e,O=({label:h,option:g,index:p})=>n.jsx("option",{...g,value:g.value,children:h},p),v=!e.value&&!e.defaultValue;return n.jsxs("select",{tabIndex:0,...b,ref:m,className:`rmwc-select__native-control${b.className?` ${b.className}`:""}`,children:[(e.placeholder!==void 0||v)&&n.jsx("option",{value:"",disabled:v,children:x}),!!c&&c.map(({label:h,options:g,...p},i)=>g?n.jsx("optgroup",{label:h,children:g.map(({label:D,...M},q)=>O({label:D,option:M,index:q}))},i):O({label:h,option:p,index:i})),u]})}const Re=function(e){return n.jsx(C.Tag,{...e})},ye=a.forwardRef((e,c)=>{const{selectOptions:x,menuApiRef:u,value:m,placeholder:o,children:f,selectedIndex:b,...O}=e;let v=0;const h=C.useClassNames(e,["mdc-select__menu"]),g=({label:p,option:i})=>(v+=1,n.jsx(z.MenuItem,{activated:m!==void 0?i.value===m:v-1===b,...i,"data-value":i.value,children:n.jsx("span",{className:"mdc-deprecated-list-item__text",children:p})},`${p}-${i.value}`));return n.jsxs(z.Menu,{...O,ref:c,apiRef:u,className:h,focusOnOpen:!0,children:[!!e.placeholder&&n.jsx(z.MenuItem,{selected:v-1===b,"data-value":"",theme:"textDisabledOnBackground",children:n.jsx("span",{className:"mdc-deprecated-list-item__text",children:o})}),x.map(({label:p,options:i,...D},M)=>i?n.jsxs(ie.ListGroup,{children:[p&&n.jsx(ie.ListGroupSubheader,{theme:"textDisabledOnBackground",children:p}),n.jsx(z.MenuItems,{children:i.map(({label:q,...S})=>g({label:q,option:S}))}),M<x.length-1&&n.jsx(ie.ListDivider,{})]},M):g({label:p,option:D})),f]})}),Le=({enhanced:e,children:c})=>e?n.jsx(z.MenuSurfaceAnchor,{children:c}):n.jsx(n.Fragment,{children:c}),Oe=C.createComponent(function(c,x){const{placeholder:u,children:m,value:o,outlined:f,label:b="",options:O=[],rootProps:v={},enhanced:h,icon:g,onChange:p,onFocus:i,onBlur:D,onKeyDown:M,invalid:q,inputRef:S,helpText:N,foundationRef:G,...U}=c,W=fe(O),{rootEl:ce,anchorEl:Q,notchWidth:se,menuOpen:V,selectedTextContent:l,lineRippleActive:J,lineRippleCenter:j,floatLabel:H,setFloatingLabel:le,setNativeControl:P,setLeadingIcon:re,selectedIndex:$,setMenu:ae,handleFocus:Y,handleBlur:k,handleClick:oe,handleChange:ue,handleKeydown:de,handleMenuClosed:Z,handleMenuOpened:ee,handleMenuSelected:R}=Se(c),X=C.useId("select",c),t=X+"-label",y=C.useClassNames(c,["mdc-select","rmwc-select__default-width",{"mdc-select--outlined":!!f,"mdc-select--filled":!f,"mdc-select--required":!!c.required,"mdc-select--invalid":!!q,"mdc-select--with-leading-icon":!!g,"mdc-select--no-label":!b}]),L=typeof h=="object"?h:{},T=o!==void 0?void 0:c.defaultValue||"",_=n.jsx(Ce.FloatingLabel,{float:H,apiRef:le,htmlFor:X,id:t,children:b}),K=()=>{if(!!!N)return null;const te=typeof N=="object"&&!a.isValidElement(N);return N&&te?n.jsx(me,{...N}):n.jsx(me,{children:N})};return n.jsxs(Le,{enhanced:h,children:[n.jsxs(C.Tag,{...v,element:ce,ref:x,className:y,children:[n.jsxs(Re,{className:"mdc-select__anchor",role:"button","aria-haspopup":"listbox","aria-labelledby":t,element:Q,onFocus:Y,onBlur:k,onClick:oe,onKeyDown:de,onChange:ue,tabIndex:h?void 0:-1,children:[!!g&&n.jsx(Ie,{apiRef:re,icon:g}),f?n.jsx(ve.NotchedOutline,{notch:se,children:_}):n.jsxs(n.Fragment,{children:[n.jsx(be.LineRipple,{active:J,center:j}),_]}),n.jsx("span",{className:"mdc-select__selected-text-container",children:n.jsx("span",{className:"mdc-select__selected-text",children:l})}),n.jsx(Ae,{}),!h&&n.jsx(Me,{...U,id:X,value:o,children:m,defaultValue:T,placeholder:u,selectOptions:W,elementRef:P,onFocus:Y,onBlur:I=>{k(I),Z()},onChange:I=>{R(I.currentTarget.selectedIndex)}})]}),h&&n.jsx(ye,{...U,...L,ref:x,anchorCorner:"bottomStart",defaultValue:T,placeholder:u,open:V,onClose:Z,onOpen:ee,onSelect:I=>{R(I.detail.index)},selectOptions:W,value:o,selectedIndex:$,menuApiRef:ae,children:m})]}),K()]})}),me=C.createComponent(function(c,x){const{persistent:u,validationMsg:m,...o}=c,f=C.useClassNames(c,["mdc-select-helper-text",{"mdc-select-helper-text--persistent":u,"mdc-select-helper-text--validation-msg":m}]);return n.jsx(C.Tag,{tag:"p",...o,className:f,ref:x})});exports.Select=Oe;exports.SelectHelperText=me;
{
"name": "@rmwc/select",
"version": "14.1.3",
"version": "14.1.4",
"description": "RMWC Select component",

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

"@material/select": "^14.0.0",
"@rmwc/base": "14.1.3",
"@rmwc/floating-label": "14.1.3",
"@rmwc/icon": "14.1.3",
"@rmwc/line-ripple": "14.1.3",
"@rmwc/list": "14.1.3",
"@rmwc/menu": "14.1.3",
"@rmwc/notched-outline": "14.1.3",
"@rmwc/ripple": "14.1.3",
"@rmwc/types": "14.1.3"
"@rmwc/base": "14.1.4",
"@rmwc/floating-label": "14.1.4",
"@rmwc/icon": "14.1.4",
"@rmwc/line-ripple": "14.1.4",
"@rmwc/list": "14.1.4",
"@rmwc/menu": "14.1.4",
"@rmwc/notched-outline": "14.1.4",
"@rmwc/ripple": "14.1.4",
"@rmwc/types": "14.1.4"
}
}

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