react-dropdown-aria
Advanced tools
Comparing version 2.0.7 to 3.0.0-rc.1
# react-dropdown-aria | ||
## 2.0.7 | ||
- Make dropdown open by pressing space (Only when not searchable) [#45](https://github.com/jfangrad/react-dropdown-aria/pull/45) | ||
- Add button role to top level div to improve keyboard navigation [#45](https://github.com/jfangrad/react-dropdown-aria/pull/45) | ||
## 2.0.6 | ||
@@ -4,0 +8,0 @@ - Fix markup issues with ul but no li children (ul is now just a div) |
@@ -25,3 +25,3 @@ /// <reference types="react" /> | ||
selectedValueClassName: null; | ||
style: {}; | ||
theme: undefined; | ||
value: undefined; | ||
@@ -28,0 +28,0 @@ width: null; |
/// <reference types="react" /> | ||
import { DropdownOption, GetStyleFunction, OptionRendererFunction, OnOptionClicked } from '../utils/types'; | ||
import { DropdownOption, OptionRendererFunction, OnOptionClicked } from '../utils/types'; | ||
interface DropdownContentProps { | ||
@@ -8,7 +8,6 @@ selectedOption: string; | ||
onOptionClicked: OnOptionClicked; | ||
getStyle: GetStyleFunction; | ||
optionItemRenderer?: OptionRendererFunction; | ||
empty: boolean; | ||
} | ||
declare function DropdownContent({ selectedOption, options, focusedIndex, onOptionClicked, getStyle, optionItemRenderer, empty, }: DropdownContentProps): JSX.Element; | ||
declare function DropdownContent({ selectedOption, options, focusedIndex, onOptionClicked, optionItemRenderer, empty, }: DropdownContentProps): JSX.Element; | ||
export default DropdownContent; |
@@ -5,3 +5,3 @@ import React from 'react'; | ||
option: Option; | ||
optionClass: string; | ||
optionClass?: string; | ||
onOptionClicked: OnOptionClicked; | ||
@@ -11,4 +11,5 @@ itemRenderer?: ItemRenderer; | ||
selected: boolean; | ||
focused: boolean; | ||
} | ||
declare const _default: React.MemoExoticComponent<(props: OptionItemProps) => JSX.Element>; | ||
export default _default; |
import Dropdown from './components/Dropdown'; | ||
export default Dropdown; | ||
export { GetStyleFunction, OptionRendererFunction, ItemRenderer, DropdownStyle, Option, OptionGroup, DropdownOption, DropdownStyleDependantState, DropdownProps, } from './utils/types'; | ||
export { StyleKeys } from './utils/constants'; | ||
export { OptionRendererFunction, ItemRenderer, Option, OptionGroup, DropdownOption, DropdownStyleDependantState, DropdownProps, } from './utils/types'; | ||
export { OptionItemProps } from './components/OptionItem'; | ||
export { RdaTheme } from './styles'; |
@@ -1,2 +0,2 @@ | ||
import e,{useCallback as t,useState as r,useRef as n,useMemo as o,useEffect as a}from"react"; | ||
import e,{useCallback as t,useState as n,useRef as r,useMemo as o,useEffect as i}from"react";import a,{ThemeProvider as l}from"styled-components"; | ||
/*! ***************************************************************************** | ||
@@ -15,3 +15,3 @@ Copyright (c) Microsoft Corporation. | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var i=function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};var c={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function s(e){function t(e,t,n){var o=t.trim().split(h);t=o;var a=o.length,i=e.length;switch(i){case 0:case 1:var c=0;for(e=0===i?"":e[0]+" ";c<a;++c)t[c]=r(e,t[c],n).trim();break;default:var s=c=0;for(t=[];c<a;++c)for(var l=0;l<i;++l)t[s++]=r(e[l]+" ",o[c],n).trim()}return t}function r(e,t,r){var n=t.charCodeAt(0);switch(33>n&&(n=(t=t.trim()).charCodeAt(0)),n){case 38:return t.replace(b,"$1"+e.trim());case 58:return e.trim()+t.replace(b,"$1"+e.trim());default:if(0<1*r&&0<t.indexOf("\f"))return t.replace(b,(58===e.charCodeAt(0)?"":"$1")+e.trim())}return e+t}function n(e,t,r,a){var i=e+";",c=2*t+3*r+4*a;if(944===c){e=i.indexOf(":",9)+1;var s=i.substring(e,i.length-1).trim();return s=i.substring(0,e).trim()+s+";",1===_||2===_&&o(s,1)?"-webkit-"+s+s:s}if(0===_||2===_&&!o(i,1))return i;switch(c){case 1015:return 97===i.charCodeAt(10)?"-webkit-"+i+i:i;case 951:return 116===i.charCodeAt(3)?"-webkit-"+i+i:i;case 963:return 110===i.charCodeAt(5)?"-webkit-"+i+i:i;case 1009:if(100!==i.charCodeAt(4))break;case 969:case 942:return"-webkit-"+i+i;case 978:return"-webkit-"+i+"-moz-"+i+i;case 1019:case 983:return"-webkit-"+i+"-moz-"+i+"-ms-"+i+i;case 883:if(45===i.charCodeAt(8))return"-webkit-"+i+i;if(0<i.indexOf("image-set(",11))return i.replace(A,"$1-webkit-$2")+i;break;case 932:if(45===i.charCodeAt(4))switch(i.charCodeAt(5)){case 103:return"-webkit-box-"+i.replace("-grow","")+"-webkit-"+i+"-ms-"+i.replace("grow","positive")+i;case 115:return"-webkit-"+i+"-ms-"+i.replace("shrink","negative")+i;case 98:return"-webkit-"+i+"-ms-"+i.replace("basis","preferred-size")+i}return"-webkit-"+i+"-ms-"+i+i;case 964:return"-webkit-"+i+"-ms-flex-"+i+i;case 1023:if(99!==i.charCodeAt(8))break;return"-webkit-box-pack"+(s=i.substring(i.indexOf(":",15)).replace("flex-","").replace("space-between","justify"))+"-webkit-"+i+"-ms-flex-pack"+s+i;case 1005:return p.test(i)?i.replace(u,":-webkit-")+i.replace(u,":-moz-")+i:i;case 1e3:switch(t=(s=i.substring(13).trim()).indexOf("-")+1,s.charCodeAt(0)+s.charCodeAt(t)){case 226:s=i.replace(w,"tb");break;case 232:s=i.replace(w,"tb-rl");break;case 220:s=i.replace(w,"lr");break;default:return i}return"-webkit-"+i+"-ms-"+s+i;case 1017:if(-1===i.indexOf("sticky",9))break;case 975:switch(t=(i=e).length-10,c=(s=(33===i.charCodeAt(t)?i.substring(0,t):i).substring(e.indexOf(":",7)+1).trim()).charCodeAt(0)+(0|s.charCodeAt(7))){case 203:if(111>s.charCodeAt(8))break;case 115:i=i.replace(s,"-webkit-"+s)+";"+i;break;case 207:case 102:i=i.replace(s,"-webkit-"+(102<c?"inline-":"")+"box")+";"+i.replace(s,"-webkit-"+s)+";"+i.replace(s,"-ms-"+s+"box")+";"+i}return i+";";case 938:if(45===i.charCodeAt(5))switch(i.charCodeAt(6)){case 105:return s=i.replace("-items",""),"-webkit-"+i+"-webkit-box-"+s+"-ms-flex-"+s+i;case 115:return"-webkit-"+i+"-ms-flex-item-"+i.replace(x,"")+i;default:return"-webkit-"+i+"-ms-flex-line-pack"+i.replace("align-content","").replace(x,"")+i}break;case 973:case 989:if(45!==i.charCodeAt(3)||122===i.charCodeAt(4))break;case 931:case 953:if(!0===y.test(e))return 115===(s=e.substring(e.indexOf(":")+1)).charCodeAt(0)?n(e.replace("stretch","fill-available"),t,r,a).replace(":fill-available",":stretch"):i.replace(s,"-webkit-"+s)+i.replace(s,"-moz-"+s.replace("fill-",""))+i;break;case 962:if(i="-webkit-"+i+(102===i.charCodeAt(5)?"-ms-"+i:"")+i,211===r+a&&105===i.charCodeAt(13)&&0<i.indexOf("transform",10))return i.substring(0,i.indexOf(";",27)+1).replace(f,"$1-webkit-$2")+i}return i}function o(e,t){var r=e.indexOf(1===t?":":"{"),n=e.substring(0,3!==t?r:10);return r=e.substring(r+1,e.length-1),P(2!==t?n:n.replace(E,"$1"),r,t)}function a(e,t){var r=n(t,t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2));return r!==t+";"?r.replace(C," or ($1)").substring(4):"("+t+")"}function i(e,t,r,n,o,a,i,c,l,d){for(var u,p=0,f=t;p<T;++p)switch(u=D[p].call(s,e,f,r,n,o,a,i,c,l,d)){case void 0:case!1:case!0:case null:break;default:f=u}if(f!==t)return f}function c(e){return void 0!==(e=e.prefix)&&(P=null,e?"function"!=typeof e?_=1:(_=2,P=e):_=0),c}function s(e,r){var c=e;if(33>c.charCodeAt(0)&&(c=c.trim()),c=[c],0<T){var s=i(-1,r,c,c,N,O,0,0,0,0);void 0!==s&&"string"==typeof s&&(r=s)}var u=function e(r,c,s,u,p){for(var f,h,b,w,C,x=0,E=0,y=0,A=0,D=0,P=0,W=b=f=0,j=0,G=0,z=0,L=0,V=s.length,$=V-1,B="",F="",U="",H="";j<V;){if(h=s.charCodeAt(j),j===$&&0!==E+A+y+x&&(0!==E&&(h=47===E?10:47),A=y=x=0,V++,$++),0===E+A+y+x){if(j===$&&(0<G&&(B=B.replace(d,"")),0<B.trim().length)){switch(h){case 32:case 9:case 59:case 13:case 10:break;default:B+=s.charAt(j)}h=59}switch(h){case 123:for(f=(B=B.trim()).charCodeAt(0),b=1,L=++j;j<V;){switch(h=s.charCodeAt(j)){case 123:b++;break;case 125:b--;break;case 47:switch(h=s.charCodeAt(j+1)){case 42:case 47:e:{for(W=j+1;W<$;++W)switch(s.charCodeAt(W)){case 47:if(42===h&&42===s.charCodeAt(W-1)&&j+2!==W){j=W+1;break e}break;case 10:if(47===h){j=W+1;break e}}j=W}}break;case 91:h++;case 40:h++;case 34:case 39:for(;j++<$&&s.charCodeAt(j)!==h;);}if(0===b)break;j++}switch(b=s.substring(L,j),0===f&&(f=(B=B.replace(l,"").trim()).charCodeAt(0)),f){case 64:switch(0<G&&(B=B.replace(d,"")),h=B.charCodeAt(1)){case 100:case 109:case 115:case 45:G=c;break;default:G=R}if(L=(b=e(c,G,b,h,p+1)).length,0<T&&(C=i(3,b,G=t(R,B,z),c,N,O,L,h,p,u),B=G.join(""),void 0!==C&&0===(L=(b=C.trim()).length)&&(h=0,b="")),0<L)switch(h){case 115:B=B.replace(k,a);case 100:case 109:case 45:b=B+"{"+b+"}";break;case 107:b=(B=B.replace(m,"$1 $2"))+"{"+b+"}",b=1===_||2===_&&o("@"+b,3)?"@-webkit-"+b+"@"+b:"@"+b;break;default:b=B+b,112===u&&(F+=b,b="")}else b="";break;default:b=e(c,t(c,B,z),b,u,p+1)}U+=b,b=z=G=W=f=0,B="",h=s.charCodeAt(++j);break;case 125:case 59:if(1<(L=(B=(0<G?B.replace(d,""):B).trim()).length))switch(0===W&&(f=B.charCodeAt(0),45===f||96<f&&123>f)&&(L=(B=B.replace(" ",":")).length),0<T&&void 0!==(C=i(1,B,c,r,N,O,F.length,u,p,u))&&0===(L=(B=C.trim()).length)&&(B="\0\0"),f=B.charCodeAt(0),h=B.charCodeAt(1),f){case 0:break;case 64:if(105===h||99===h){H+=B+s.charAt(j);break}default:58!==B.charCodeAt(L-1)&&(F+=n(B,f,h,B.charCodeAt(2)))}z=G=W=f=0,B="",h=s.charCodeAt(++j)}}switch(h){case 13:case 10:47===E?E=0:0===1+f&&107!==u&&0<B.length&&(G=1,B+="\0"),0<T*I&&i(0,B,c,r,N,O,F.length,u,p,u),O=1,N++;break;case 59:case 125:if(0===E+A+y+x){O++;break}default:switch(O++,w=s.charAt(j),h){case 9:case 32:if(0===A+x+E)switch(D){case 44:case 58:case 9:case 32:w="";break;default:32!==h&&(w=" ")}break;case 0:w="\\0";break;case 12:w="\\f";break;case 11:w="\\v";break;case 38:0===A+E+x&&(G=z=1,w="\f"+w);break;case 108:if(0===A+E+x+S&&0<W)switch(j-W){case 2:112===D&&58===s.charCodeAt(j-3)&&(S=D);case 8:111===P&&(S=P)}break;case 58:0===A+E+x&&(W=j);break;case 44:0===E+y+A+x&&(G=1,w+="\r");break;case 34:case 39:0===E&&(A=A===h?0:0===A?h:A);break;case 91:0===A+E+y&&x++;break;case 93:0===A+E+y&&x--;break;case 41:0===A+E+x&&y--;break;case 40:if(0===A+E+x){if(0===f)switch(2*D+3*P){case 533:break;default:f=1}y++}break;case 64:0===E+y+A+x+W+b&&(b=1);break;case 42:case 47:if(!(0<A+x+y))switch(E){case 0:switch(2*h+3*s.charCodeAt(j+1)){case 235:E=47;break;case 220:L=j,E=42}break;case 42:47===h&&42===D&&L+2!==j&&(33===s.charCodeAt(L+2)&&(F+=s.substring(L,j+1)),w="",E=0)}}0===E&&(B+=w)}P=D,D=h,j++}if(0<(L=F.length)){if(G=c,0<T&&(void 0!==(C=i(2,F,G,r,N,O,L,u,p,u))&&0===(F=C).length))return H+F+U;if(F=G.join(",")+"{"+F+"}",0!=_*S){switch(2!==_||o(F,2)||(S=0),S){case 111:F=F.replace(v,":-moz-$1")+F;break;case 112:F=F.replace(g,"::-webkit-input-$1")+F.replace(g,"::-moz-$1")+F.replace(g,":-ms-input-$1")+F}S=0}}return H+F+U}(R,c,r,0,0);return 0<T&&(void 0!==(s=i(-2,u,c,c,N,O,u.length,0,0,0))&&(u=s)),"",S=0,O=N=1,u}var l=/^\0+/g,d=/[\0\r\f]/g,u=/: */g,p=/zoo|gra/,f=/([,: ])(transform)/g,h=/,\r+?/g,b=/([\t\r\n ])*\f?&/g,m=/@(k\w+)\s*(\S*)\s*/,g=/::(place)/g,v=/:(read-only)/g,w=/[svh]\w+-[tblr]{2}/,k=/\(\s*(.*)\s*\)/g,C=/([\s\S]*?);/g,x=/-self|flex-/g,E=/[^]*?(:[rp][el]a[\w-]+)[^]*/,y=/stretch|:\s*\w+\-(?:conte|avail)/,A=/([^-])(image-set\()/,O=1,N=1,S=0,_=1,R=[],D=[],T=0,P=null,I=0;return s.use=function e(t){switch(t){case void 0:case null:T=D.length=0;break;default:switch(t.constructor){case Array:for(var r=0,n=t.length;r<n;++r)e(t[r]);break;case Function:D[T++]=t;break;case Boolean:I=0|!!t}}return e},s.set=c,void 0!==e&&c(e),s}var l,d,u=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){e.exports=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(r,n,o,a,i,c,s,l,d,u){switch(r){case 1:if(0===d&&64===n.charCodeAt(0))return e(n+";"),"";break;case 2:if(0===l)return n+"/*|*/";break;case 3:switch(l){case 102:case 112:return e(o[0]+n),"";default:return n+(0===u?"/*|*/":"")}case-2:n.split("/*|*/}").forEach(t)}}}})),p=/[A-Z]|^ms/g,f=(l=function(e){return e.replace(p,"-$&").toLowerCase()},d={},function(e){return void 0===d[e]&&(d[e]=l(e)),d[e]}),h=function(e,t){return null==t||"boolean"==typeof t?"":1===c[e]||45===e.charCodeAt(1)||isNaN(t)||0===t?t:t+"px"};if("production"!==process.env.NODE_ENV){var b=/(attr|calc|counters?|url)\(/,m=["normal","none","counter","open-quote","close-quote","no-open-quote","no-close-quote","initial","inherit","unset"],g=h;h=function(e,t){return"content"===e&&("string"!=typeof t||-1===m.indexOf(t)&&!b.test(t)&&(t.charAt(0)!==t.charAt(t.length-1)||'"'!==t.charAt(0)&&"'"!==t.charAt(0)))&&console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\""+t+"\"'`"),g(e,t)}}var v=function e(t){for(var r=t.length,n=0,o="";n<r;n++){var a=t[n];if(null!=a){var i=void 0;switch(typeof a){case"boolean":break;case"function":"production"!==process.env.NODE_ENV&&console.error("Passing functions to cx is deprecated and will be removed in the next major version of Emotion.\nPlease call the function before passing it to cx."),i=e([a()]);break;case"object":if(Array.isArray(a))i=e(a);else for(var c in i="",a)a[c]&&c&&(i&&(i+=" "),i+=c);break;default:i=a}i&&(o&&(o+=" "),o+=i)}}return o},w="undefined"!=typeof document;function k(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key||""),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),(void 0!==e.container?e.container:document.head).appendChild(t),t}var C=function(){function e(e){this.isSpeedy="production"===process.env.NODE_ENV,this.tags=[],this.ctr=0,this.opts=e}var t=e.prototype;return t.inject=function(){if(this.injected)throw new Error("already injected!");this.tags[0]=k(this.opts),this.injected=!0},t.speedy=function(e){if(0!==this.ctr)throw new Error("cannot change speedy now");this.isSpeedy=!!e},t.insert=function(e,t){if(this.isSpeedy){var r=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(this.tags[this.tags.length-1]);try{r.insertRule(e,r.cssRules.length)}catch(t){"production"!==process.env.NODE_ENV&&console.warn("illegal rule",e)}}else{var n=k(this.opts);this.tags.push(n),n.appendChild(document.createTextNode(e+(t||"")))}this.ctr++,this.ctr%65e3==0&&this.tags.push(k(this.opts))},t.flush=function(){this.tags.forEach((function(e){return e.parentNode.removeChild(e)})),this.tags=[],this.ctr=0,this.injected=!1},e}();var x,E,y=function(e,t){if(void 0!==e.__SECRET_EMOTION__)return e.__SECRET_EMOTION__;void 0===t&&(t={});var r,n=t.key||"css";if("production"!==process.env.NODE_ENV&&/[^a-z-]/.test(n))throw new Error('Emotion key must only contain lower case alphabetical characters and - but "'+n+'" was passed');var o,a=u((function(e){r+=e,w&&c.insert(e,d)}));void 0!==t.prefix&&(o={prefix:t.prefix});var i={registered:{},inserted:{},nonce:t.nonce,key:n},c=new C(t);w&&c.inject();var l=new s(o);l.use(t.stylisPlugins)(a);var d="";function p(e,t){if(null==e)return"";switch(typeof e){case"boolean":return"";case"function":if(void 0!==e.__emotion_styles){var r=e.toString();if("NO_COMPONENT_SELECTOR"===r&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with babel-plugin-emotion.");return r}return void 0===this&&"production"!==process.env.NODE_ENV&&console.error("Interpolating functions in css calls is deprecated and will be removed in the next major version of Emotion.\nIf you want to have a css call based on props, create a function that returns a css call like this\nlet dynamicStyle = (props) => css`color: ${props.color}`\nIt can be called directly with props or interpolated in a styled call like this\nlet SomeComponent = styled('div')`${dynamicStyle}`"),p.call(this,void 0===this?e():e(this.mergedProps,this.context),t);case"object":return k.call(this,e);default:var n=i.registered[e];return!1===t&&void 0!==n?n:e}}var b,m,g=new WeakMap;function k(e){if(g.has(e))return g.get(e);var t="";return Array.isArray(e)?e.forEach((function(e){t+=p.call(this,e,!1)}),this):Object.keys(e).forEach((function(r){if("object"!=typeof e[r])void 0!==i.registered[e[r]]?t+=r+"{"+i.registered[e[r]]+"}":t+=f(r)+":"+h(r,e[r])+";";else{if("NO_COMPONENT_SELECTOR"===r&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with babel-plugin-emotion.");Array.isArray(e[r])&&"string"==typeof e[r][0]&&void 0===i.registered[e[r][0]]?e[r].forEach((function(e){t+=f(r)+":"+h(r,e)+";"})):t+=r+"{"+p.call(this,e[r],!1)+"}"}}),this),g.set(e,t),t}var x=/label:\s*([^\s;\n{]+)\s*;/g,E=function(e,t){return function(e){for(var t,r=e.length,n=r^r,o=0;r>=4;)t=1540483477*(65535&(t=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(t>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(t=1540483477*(65535&(t^=t>>>24))+((1540483477*(t>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),((n^=n>>>15)>>>0).toString(36)}(e+t)+t};if("production"!==process.env.NODE_ENV){var y=E,A=/\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;E=function(e,t){return y(e.replace(A,(function(e){return d=e,""})),t)}}var O=function(e){var t=!0,r="",n="";null==e||void 0===e.raw?(t=!1,r+=p.call(this,e,!1)):r+=e[0];for(var o=arguments.length,a=new Array(o>1?o-1:0),i=1;i<o;i++)a[i-1]=arguments[i];return a.forEach((function(n,o){r+=p.call(this,n,46===r.charCodeAt(r.length-1)),!0===t&&void 0!==e[o+1]&&(r+=e[o+1])}),this),m=r,r=r.replace(x,(function(e,t){return n+="-"+t,""})),b=E(r,n),r};if("production"!==process.env.NODE_ENV){var N=l;l=function(e,t){N(e,t),d=""}}function S(e,t){void 0===i.inserted[b]&&(r="",l(e,t),i.inserted[b]=r)}var _=function(){var e=O.apply(this,arguments),t=n+"-"+b;return void 0===i.registered[t]&&(i.registered[t]=m),S("."+t,e),t};function R(e,t){var r="";return t.split(" ").forEach((function(t){void 0!==i.registered[t]?e.push(t):r+=t+" "})),r}function D(e,t){var r=[],n=R(r,e);return r.length<2?e:n+_(r,t)}function T(e){i.inserted[e]=!0}if(w){var P=document.querySelectorAll("[data-emotion-"+n+"]");Array.prototype.forEach.call(P,(function(e){c.tags[0].parentNode.insertBefore(e,c.tags[0]),e.getAttribute("data-emotion-"+n).split(" ").forEach(T)}))}var I={flush:function(){w&&(c.flush(),c.inject()),i.inserted={},i.registered={}},hydrate:function(e){e.forEach(T)},cx:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return D(v(t))},merge:D,getRegisteredStyles:R,injectGlobal:function(){var e=O.apply(this,arguments);S("",e)},keyframes:function(){var e=O.apply(this,arguments),t="animation-"+b;return S("","@keyframes "+t+"{"+e+"}"),t},css:_,sheet:c,caches:i};return e.__SECRET_EMOTION__=I,I}("undefined"!=typeof global?global:{}),A=(y.flush,y.hydrate,y.cx),O=(y.merge,y.getRegisteredStyles,y.injectGlobal,y.keyframes,y.css);y.sheet,y.caches;!function(e){e.Arrow="Arrow",e.DropdownSelector="DropdownSelector",e.DropdownWrapper="DropdownWrapper",e.SelectorSearch="SelectorSearch",e.SelectedValue="SelectedValue",e.Placeholder="Placeholder",e.GroupContainer="GroupContainer",e.GroupDivider="GroupDivider",e.GroupHeading="GroupHeading",e.OptionContainer="OptionContainer",e.OptionItem="OptionItem"}(x||(x={})),function(e){e[e.DOWN_ARROW=40]="DOWN_ARROW",e[e.ENTER=13]="ENTER",e[e.ESCAPE=27]="ESCAPE",e[e.PAGE_DOWN=34]="PAGE_DOWN",e[e.PAGE_UP=33]="PAGE_UP",e[e.TAB=9]="TAB",e[e.UP_ARROW=38]="UP_ARROW",e[e.SPACE=32]="SPACE"}(E||(E={}));var N=[E.ESCAPE,E.UP_ARROW,E.DOWN_ARROW,E.PAGE_UP,E.PAGE_DOWN],S={base:"#808080",dark:"#7C7C7C",darker:"#6e6d6d",light:"#CECECE",lighter:"#e0e0e0",lightest:"#f5f5f5"},_={disabled:"#ededed",focused:"#0080bc"},R=e.memo((function(r){var n=r.onOptionClicked,o=r.option,a=r.optionClass,i=r.itemRenderer,c=r.index,s=r.selected,l=t((function(e){e.stopPropagation(),n(o,!0)}),[n,o]),d=e.createElement(e.Fragment,null,o.iconClass&&e.createElement("i",{className:o.iconClass+" dropdown-option-icon"}),o.value);return i&&(d=i(r,c)),e.createElement("div",{"aria-label":o.ariaLabel,"aria-selected":s,className:"dropdown-option "+a,onClick:l,title:o.title},d)}));function D(e){return void 0!==e.groupOptions}var T=function(e,t){return D(t)?e.concat(t.groupOptions):e.concat(t)},P=function(e,t){return i(i({},e),{groupOptions:e.groupOptions.filter((function(e){return e.value.toLowerCase().includes(t)}))})},I=function(t){var r=t.children,n=t.className,o=t.dim,a=void 0===o?24:o;return e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather "+n},r)},W=function(){return e.createElement(I,{className:"feather-inbox"},e.createElement("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),e.createElement("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}))},j=function(){return e.createElement(I,{className:"feather-chevron-down",dim:16},e.createElement("polyline",{points:"6 9 12 15 18 9"}))},G=function(){return e.createElement(I,{className:"feather-search",dim:16},e.createElement("circle",{cx:"11",cy:"11",r:"8"}),e.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}))};function z(t){var r=t.selectedOption,n=t.options,o=t.focusedIndex,a=t.onOptionClicked,i=t.getStyle,c=t.optionItemRenderer;if(t.empty)return e.createElement("div",{className:"dropdown-selector-content--empty"},e.createElement(W,null),"No data");var s=c?function(e,t){return c(e,i,t)}:void 0,l=0,d=n.map((function(t){if(D(t)){var n=t.groupOptions,c=t.label,d=n.map((function(t){var n=t.value===r,c=l===o,d=A(t.className,i(x.OptionItem,{selected:n,focused:c}));return l+=1,e.createElement(R,{key:t.value,optionClass:d,onOptionClicked:a,option:t,itemRenderer:s,index:l-1,selected:n})}));return d.length?e.createElement("div",{className:i(x.GroupContainer),key:t.label},e.createElement("div",{className:i(x.GroupHeading)},e.createElement("span",null,c.toUpperCase()," | "),e.createElement("span",null,n.length)),d,e.createElement("div",{className:i(x.GroupDivider)})):null}var u=t.value,p=t.className,f=l===o,h=u===r,b=A(p,i(x.OptionItem,{selected:h,focused:f}));return l+=1,e.createElement(R,{key:u,optionClass:b,onOptionClicked:a,option:t,itemRenderer:s,index:l-1,selected:h})}));return e.createElement(e.Fragment,null,d)}var L=function(e){return{bottom:0,left:"11px",lineHeight:"30px",overflow:"hidden",position:"absolute",right:"25px",textAlign:e.centerText?"center":"left",textOverflow:"ellipsis",top:0,whiteSpace:"nowrap"}},V={Arrow:function(){return{alignItems:"center",bottom:0,color:S.base,display:"flex",position:"absolute",right:"10px",top:0}},DropdownSelector:function(e,t){return{alignItems:"center",boxSizing:"border-box",cursor:t.open&&e.searchable?"text":"inherit",display:"flex",height:"32px",padding:"0 11px",position:"relative",width:"100%",input:{backgroundColor:"inherit",border:"none",fontSize:"inherit",height:"30px",outline:"none",width:"100%"}}},DropdownWrapper:function(e,t){var r=e.width,n=e.height,o=e.disabled,a=t.open,i=t.dropdownFocused;return{backgroundColor:o?S.light:S.lightest,border:"2px solid "+(a||i?_.focused:S.dark),borderRadius:"7",cursor:o?"not-allowed":"pointer",display:"flex",flexDirection:"column",fontSize:"1em",height:n,position:"relative",width:r,"&:hover":{border:"2px solid "+(a||i?_.focused:S.darker)},"&:disabled":{backgroundColor:_.disabled,cursor:"unset"}}},GroupContainer:function(){return{padding:"1em 0 0 0"}},GroupDivider:function(){return{borderBottom:"1px solid "+S.dark,margin:"auto",paddingTop:10,width:"85%"}},GroupHeading:function(){return{color:"grey",display:"flex",flexDirection:"row",fontSize:"0.9em",padding:"0 10px 3px 5px"}},OptionContainer:function(e,t){var r=e.openUp,n=e.maxContentHeight,o=t.open;return{backgroundColor:S.lightest,border:"2px solid "+S.darker,borderRadius:"4px",bottom:r?"105%":void 0,boxShadow:"0px "+(r?"-4px":"4px")+" 4px rgba(0, 0, 0, 0.25)",boxSizing:"border-box",color:"black",display:o?"block":"none",left:"0",listStyleType:"none",margin:"0",maxHeight:n||"175px",overflowX:"hidden",overflowY:"auto",padding:"2px 0",position:"absolute",top:r?void 0:"100%",width:"100%",zIndex:9999,".dropdown-selector-content--empty":{alignItems:"center",color:S.base,display:"flex",flexDirection:"column",justifyContent:"center",padding:"4px 0"},"&::-webkit-scrollbar":{width:"5px"},"&::-webkit-scrollbar-track":{background:"#ddd"},"&::-webkit-scrollbar-thumb":{background:"#666"}}},OptionItem:function(e,t,r){var n=r.selected,o=r.focused,a=S.lightest,i="inherit";return o&&n?(a=S.dark,i=S.lightest):o?a=S.lighter:n&&(a=S.light),{backgroundColor:a,border:"none",color:i,cursor:"pointer",fontSize:"0.95em",overflow:"hidden",padding:"5px 10px",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",display:"flex",alignItems:"center","&:hover":{backgroundColor:n?S.dark:S.light,color:n?S.lightest:void 0},".option-icon":{paddingRight:"5px"}}},Placeholder:function(e){return i({color:S.base},L(e))},SelectedValue:function(e,t){var r=t.open;return i({color:e.value&&!r?"black":S.base},L(e))},SelectorSearch:function(){return{bottom:0,left:"11px",position:"absolute",right:"25px",top:0}}},$={height:0,width:0,overflow:"hidden"},B=function(t,r,n){var o=t.map((function(t,o){return e.createElement("div",{role:"option",id:n+"_list_"+o,key:n+"_list_"+o,"aria-selected":o===r,"aria-label":t.value})}));return e.createElement("div",{role:"listbox",id:n+"_list",style:$},o)},F=function(e,n,a){var i=r(""),c=i[0],s=i[1],l=o((function(){return a&&c.trim()?function(e,t){for(var r=[],n=t.toLowerCase(),o=0,a=e;o<a.length;o++){var i=a[o];if(D(i)){var c=P(i,n);c.groupOptions.length>=0&&r.push(c)}else i.value.toLowerCase().includes(n)&&r.push(i)}return r}(n,c):n}),[n,c]),d=t((function(t,r){void 0===r&&(r=!0),s(t),r&&e(0)}),[e,s]);return{searchTerm:c,setSearchTerm:d,filteredOptions:l}},U=function(e,i){var c=e.style,s=e.options,l=e.searchable,d=e.onChange,u=e.disabled,p=e.ariaDescribedBy,f=e.ariaLabel,h=e.ariaLabelledBy,b=e.value,m=e.defaultOpen,g=r(0),v=g[0],w=g[1],k=r(m),C=k[0],x=k[1],E=n(null),y=n(null),A=n(null),N=r(!1),S=N[0],_=N[1],R=F(w,s,l),D=R.searchTerm,P=R.setSearchTerm,I=R.filteredOptions,W=o((function(){return I.reduce(T,[])}),[I]),j=o((function(){return W.map((function(e){return e.value})).indexOf(b)}),[W,b]),G=t((function(t,r){var n={focusedIndex:v,open:C,dropdownFocused:S},o=V[t](e,n,r||{}),a=c[t];return O(a?a(o,n,r):o)}),[c,v,C,e,S]),z=t((function(e){void 0===e&&(e=!1),P("",!1),x(!1),e&&y.current&&y.current.focus()}),[y.current,P,x]),L=t((function(){w(j>0?j:0),x(!0)}),[x,w,j]),$=t((function(e,t){void 0===t&&(t=!1),e&&(d(e),P("",!1)),t&&z(!0)}),[d,z,P]);!function(e,t){var r=function(r){t.current&&!t.current.contains(r.target)&&e()};a((function(){return document.addEventListener("mouseup",r,!1),document.addEventListener("touchend",r,!1),function(){document.removeEventListener("mouseup",r),document.removeEventListener("touchend",r)}}),[])}(z,E),function(e,t){a((function(){if(t.current&&e>=0){var r=t.current.getElementsByClassName("dropdown-option"),n=r&&r.length?r[e]:null;if(n&&n.getBoundingClientRect){var o=n.getBoundingClientRect().height,a=t.current.getBoundingClientRect().height,i=t.current.scrollTop,c=n.offsetTop<=i;n.offsetTop>=i&&n.offsetTop+o<=i+a||(c?t.current.scrollTo({top:n.offsetTop}):t.current.scrollTo({top:n.offsetTop-a+o+8}))}}}),[e])}(v,A);var U=o((function(){return{"aria-hidden":u,"aria-expanded":C,"aria-haspopup":"listbox","aria-activedescendant":i+"_list_"+v,"aria-controls":i+"_list","aria-label":f,"aria-labelledby":h,"aria-describedby":p}}),[u,C,i,v,f,h,p]);return{focusedIndex:v,setFocusedIndex:w,open:C,setOpen:x,searchTerm:D,setSearchTerm:P,dropdownFocused:S,setDropdownFocused:_,setValue:$,filteredOptions:I,getStyle:G,openDropdown:L,closeDropdown:z,flattenedOptions:W,container:E,inputRef:y,listWrapper:A,ariaProps:U,ariaList:B(W,j,i)}},H="undefined"!=typeof window&&window.document&&window.document.documentElement,M="test"!==process.env.NODE_ENV&&H,q=0,K=function(r){var n,a=r.arrowRenderer,c=r.contentClassName,s=r.className,l=r.disabled,d=r.hideArrow,u=r.id,p=r.optionItemRenderer,f=r.pageKeyTraverseSize,h=r.placeholder,b=r.searchable,m=r.value,g=r.selectedValueClassName,v=o((function(){return n||(M?(e=q,q+=1):e="test_or_ssr","react_dropdown_aria_"+e);var e}),[n=u]),w=U(r,v),k=w.getStyle,C=w.open,y=w.focusedIndex,O=w.setFocusedIndex,S=w.setDropdownFocused,_=w.setValue,R=w.openDropdown,D=w.closeDropdown,T=w.searchTerm,P=w.setSearchTerm,I=w.filteredOptions,W=w.flattenedOptions,L=w.container,V=w.inputRef,$=w.listWrapper,B=w.ariaProps,F=w.ariaList,H=t((function(){V.current&&V.current.focus()}),[V.current]),K=t((function(){H(),l||C&&b||(C?D(!0):R())}),[C,l,b,D,R]),Y=t((function(e){switch(e){case E.UP_ARROW:O((function(e){return 0===e?W.length-1:e-1}));break;case E.DOWN_ARROW:O((function(e){return(e+1)%W.length}));break;case E.PAGE_UP:O((function(e){return e-f<0&&0!==e?0:e-f<0?W.length-1:e-f}));break;case E.PAGE_DOWN:O((function(e){return e===W.length-1?0:e+f>W.length-1?W.length-1:(e+f)%W.length}));break;case E.ESCAPE:D(!0)}}),[O,W,f,D]),X=t((function(e){var t=e.keyCode;-1!==N.indexOf(t)?(e.preventDefault(),e.stopPropagation(),Y(t)):t!==E.ENTER&&(t!==E.SPACE||b)||C?t!==E.TAB||b?(t===E.TAB||t===E.ENTER)&&W.length>0&&y>=0&&C&&(e.stopPropagation(),e.preventDefault(),_(W[y],!0)):D():(e.preventDefault(),R())}),[W,_,y,C,Y,R,b,D]),Z=t((function(e){P(e.target.value)}),[P]),J=t((function(){return S(!0)}),[S]),Q=t((function(){return S(!1)}),[S]),ee=A("dropdown",s,k(x.DropdownWrapper)),te=A("dropdown-selector",k(x.DropdownSelector)),re=A("dropdown-selector-search",k(x.SelectorSearch)),ne=A("dropdown-selector-placeholder",k(x.Placeholder)),oe=A("dropdown-selector-value",g,k(x.SelectedValue)),ae=A("dropdown-selector-content",c,k(x.OptionContainer)),ie=A("dropdown-arrow",k(x.Arrow)),ce=o((function(){if(d)return null;if(a)return e.createElement("div",{className:ie},a(C));var t=C&&b;return e.createElement("div",{className:ie},t&&e.createElement(G,null),!t&&e.createElement(j,null))}),[C,a,ie,b,d]);return e.createElement("div",{ref:L,className:ee,onFocus:H,onClick:K,role:"button"},e.createElement("div",{className:te},e.createElement("span",{className:re},e.createElement("input",i({id:v,ref:V,value:T,onChange:Z,onKeyDown:X,onFocus:J,onBlur:Q,readOnly:!C||!b,disabled:l,autoComplete:"off",role:"combobox"},B))),!m&&!T&&e.createElement("span",{className:ne},h),m&&!T&&e.createElement("span",{className:oe},m),ce),F,e.createElement("div",{className:ae,ref:$},e.createElement(z,{selectedOption:m,options:I,focusedIndex:y,onOptionClicked:_,optionItemRenderer:p,getStyle:k,empty:0===W.length})))};K.defaultProps={ariaDescribedBy:null,ariaLabel:null,ariaLabelledBy:null,arrowRenderer:void 0,centerText:!1,className:void 0,contentClassName:null,defaultOpen:!1,disabled:!1,height:null,hideArrow:!1,id:null,maxContentHeight:150,openUp:!1,optionItemRenderer:void 0,pageKeyTraverseSize:10,placeholder:"Select ...",searchable:!1,selectedValueClassName:null,style:{},value:void 0,width:null};export default K;export{x as StyleKeys}; | ||
***************************************************************************** */var c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function u(e){return void 0!==e.groupOptions}var d,s=function(e,t){return u(t)?e.concat(t.groupOptions):e.concat(t)},p=function(e,t){return c(c({},e),{groupOptions:e.groupOptions.filter((function(e){return e.value.toLowerCase().includes(t)}))})};function f(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(Boolean).map((function(e){return"string"==typeof e?e:e?Object.keys(e).filter((function(t){return e[t]})).join(" "):""})).join(" ")}function m(e){return e&&"object"==typeof e&&!Array.isArray(e)}function h(e){return!!e&&"function"==typeof e}function g(e,t){if(!m(t))return t;var n=c({},e);for(var r in t){var o=t[r];m(o)&&r in n?n[r]=g(n[r],o):n[r]=o}return n}function v(e,t){var n={};if(h(e))n=v(e(t),t);else if(m(e))for(var r in e)if(Array.isArray(e[r])){var o=e[r],i=o[0],a=o[1];n[r]=v(g(a,i(t)),t)}else n[r]=v(e[r],t);else if(Array.isArray(e)){i=e[0];n=v(g(a=e[1],i(t)),t)}else n=e;return n}!function(e){e[e.DOWN_ARROW=40]="DOWN_ARROW",e[e.ENTER=13]="ENTER",e[e.ESCAPE=27]="ESCAPE",e[e.PAGE_DOWN=34]="PAGE_DOWN",e[e.PAGE_UP=33]="PAGE_UP",e[e.TAB=9]="TAB",e[e.UP_ARROW=38]="UP_ARROW",e[e.SPACE=32]="SPACE"}(d||(d={}));var b=[d.ESCAPE,d.UP_ARROW,d.DOWN_ARROW,d.PAGE_UP,d.PAGE_DOWN],w={base:"#808080",dark:"#7C7C7C",darker:"#6e6d6d",light:"#CECECE",lighter:"#e0e0e0",lightest:"#f5f5f5"},x={disabled:"#ededed",focused:"#0080bc"},E={wrapper:{backgroundColor:function(e){return e.disabled?w.light:w.lightest},border:function(e){var t=e.open,n=e.dropdownFocused;return"2px solid "+(t||n?x.focused:w.darker)},borderRadius:"7px",cursor:function(e){return e.disabled?"not-allowed":"pointer"},fontSize:"1em",display:"flex",flexDirection:"column",height:function(e){return e.height},position:"relative",width:function(e){return e.width},"&:hover":{border:function(e){return"2px solid "+(e.open||e.dropdownFocused?x.focused:w.darker)}},"&:disabled":{backgroundColor:x.disabled,cursor:"unset"}},selector:{alignItems:"center",boxSizing:"border-box",cursor:function(e){return e.open&&e.searchable?"text":"inherit"},display:"flex",height:"32px",padding:"0 11px",position:"relative",width:"100%",input:{backgroundColor:"inherit",border:"none",fontSize:"inherit",height:"30px",outline:"none",width:"100%"}},selectorSearch:{bottom:0,left:"11px",position:"absolute",right:"25px",top:0},selectedValue:{bottom:0,color:function(e){var t=e.value,n=e.open;return t&&!n?"black":w.base},left:"11px",lineHeight:"30px",overflow:"hidden",position:"absolute",right:"25px",textOverflow:"ellipsis",top:0,whiteSpace:"nowrap",marginLeft:"3px"},placeholder:{bottom:0,color:w.base,left:"11px",lineHeight:"30px",overflow:"hidden",position:"absolute",right:"25px",textAlign:function(e){return e.centerText?"center":"left"},textOverflow:"ellipsis",top:0,whiteSpace:"nowrap",marginLeft:"3px"},arrow:{alignItems:"center",bottom:0,color:w.base,display:"flex",position:"absolute",right:"10px",top:0},optionContainer:{backgroundColor:w.lightest,border:"2px solid "+w.darker,borderRadius:"4px",bottom:function(e){return e.openUp?"105%":void 0},boxShadow:function(e){return"0px "+(e.openUp?"-4px":"4px")+" 4px rgba(0, 0, 0, 0.25)"},boxSizing:"border-box",color:"black",display:function(e){return e.open?"block":"none"},left:"0",listStyleType:"none",margin:"0",maxHeight:function(e){return e.maxContentHeight||"175px"},overflowX:"hidden",overflowY:"auto",padding:"2px 0",position:"absolute",top:function(e){return e.openUp?void 0:"100%"},width:"100%",zIndex:9999,".dropdown-selector-content--empty":{alignItems:"center",color:w.base,display:"flex",flexDirection:"column",justifyContent:"center",padding:"4px 0"},"&::-webkit-scrollbar":{width:"5px"},"&::-webkit-scrollbar-track":{background:"#ddd"},"&::-webkit-scrollbar-thumb":{background:"#666"}},groupContainer:{padding:"1em 0 0 0"},groupHeading:{color:"grey",display:"flex",flexDirection:"row",fontSize:"0.9em",padding:"0 10px 3px 5px"},groupDivider:{borderBottom:"1px solid "+w.dark,margin:"auto",paddingTop:10,width:"85%"},optionItem:{backgroundColor:function(e){var t=e.focused,n=e.selected,r=w.lightest;return t&&n?r=w.dark:t?r=w.lighter:n&&(r=w.light),r},border:"none",color:function(e){return e.focused&&e.selected?w.lightest:"inherit"},cursor:"pointer",fontSize:"0.95em",overflow:"hidden",padding:"5px 10px",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",display:"flex",alignItems:"center","&:hover":function(e){var t=e.selected;return{backgroundColor:t?w.dark:w.light,color:t?w.lightest:void 0}},".dropdown-option-icon":{paddingRight:"5px"}}},C=a.div((function(e){return v(e.theme.wrapper,e)})),y=a.div((function(e){return v(e.theme.selector,e)})),O=a.span((function(e){return v(e.theme.selectorSearch,e)})),k=a.span((function(e){return v(e.theme.selectedValue,e)})),N=a.span((function(e){return v(e.theme.placeholder,e)})),A=a.div((function(e){return v(e.theme.arrow,e)})),R=a.span((function(e){return v(e.theme.optionContainer,e)})),T=a.div((function(e){return v(e.theme.groupContainer,e)})),P=a.div((function(e){return v(e.theme.groupHeading,e)})),_=a.div((function(e){return v(e.theme.groupDivider,e)})),S=a.div((function(e){return v(e.theme.optionItem,e)})),D=e.memo((function(n){var r=n.onOptionClicked,o=n.option,i=n.optionClass,a=n.itemRenderer,l=n.index,c=n.selected,u=n.focused,d=t((function(e){e.stopPropagation(),r(o,!0)}),[r,o]),s=e.createElement(e.Fragment,null,o.iconClass&&e.createElement("i",{className:o.iconClass+" dropdown-option-icon"}),o.value);return a&&(s=a(n,l)),e.createElement(S,{"aria-label":o.ariaLabel,"aria-selected":c,className:f("dropdown-option",i,{selected:c,focused:u}),onClick:d,title:o.title,selected:c,focused:u},s)})),L=function(t){var n=t.children,r=t.className,o=t.dim,i=void 0===o?24:o;return e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather "+r},n)},W=function(){return e.createElement(L,{className:"feather-inbox"},e.createElement("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),e.createElement("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}))},I=function(){return e.createElement(L,{className:"feather-chevron-down",dim:16},e.createElement("polyline",{points:"6 9 12 15 18 9"}))},B=function(){return e.createElement(L,{className:"feather-search",dim:16},e.createElement("circle",{cx:"11",cy:"11",r:"8"}),e.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}))};function U(t){var n=t.selectedOption,r=t.options,o=t.focusedIndex,i=t.onOptionClicked,a=t.optionItemRenderer;if(t.empty)return e.createElement("div",{className:"dropdown-selector-content--empty"},e.createElement(W,null),"No data");var l=a?function(e,t){return a(e,t)}:void 0,c=0,d=r.map((function(t){if(u(t)){var r=t.groupOptions,a=t.label,d=r.map((function(t){var r=t.value===n,a=c===o;return c+=1,e.createElement(D,{key:t.value,optionClass:t.className,onOptionClicked:i,option:t,itemRenderer:l,index:c-1,selected:r,focused:a})}));return d.length?e.createElement(T,{key:t.label},e.createElement(P,null,e.createElement("span",null,a.toUpperCase()," | "),e.createElement("span",null,r.length)),d,e.createElement(_,null)):null}var s=t.value,p=t.className,f=c===o,m=s===n;return c+=1,e.createElement(D,{key:s,optionClass:p,onOptionClicked:i,option:t,itemRenderer:l,index:c-1,selected:m,focused:f})}));return e.createElement(e.Fragment,null,d)}var F={height:0,width:0,overflow:"hidden"},z=function(t,n,r){var o=t.map((function(t,o){return e.createElement("div",{role:"option",id:r+"_list_"+o,key:r+"_list_"+o,"aria-selected":o===n,"aria-label":t.value})}));return e.createElement("div",{role:"listbox",id:r+"_list",style:F},o)},H=function(e,r,i){var a=n(""),l=a[0],c=a[1],d=o((function(){return i&&l.trim()?function(e,t){for(var n=[],r=t.toLowerCase(),o=0,i=e;o<i.length;o++){var a=i[o];if(u(a)){var l=p(a,r);l.groupOptions.length>=0&&n.push(l)}else a.value.toLowerCase().includes(r)&&n.push(a)}return n}(r,l):r}),[r,l]),s=t((function(t,n){void 0===n&&(n=!0),c(t),n&&e(0)}),[e,c]);return{searchTerm:l,setSearchTerm:s,filteredOptions:d}},j=function(e,a){var l=e.options,c=e.searchable,u=e.onChange,d=e.disabled,p=e.ariaDescribedBy,f=e.ariaLabel,m=e.ariaLabelledBy,h=e.value,g=e.defaultOpen,v=n(0),b=v[0],w=v[1],x=n(g),E=x[0],C=x[1],y=r(null),O=r(null),k=r(null),N=n(!1),A=N[0],R=N[1],T=H(w,l,c),P=T.searchTerm,_=T.setSearchTerm,S=T.filteredOptions,D=o((function(){return S.reduce(s,[])}),[S]),L=o((function(){return D.map((function(e){return e.value})).indexOf(h)}),[D,h]),W=t((function(e){void 0===e&&(e=!1),_("",!1),C(!1),e&&O.current&&O.current.focus()}),[O.current,_,C]),I=t((function(){w(L>0?L:0),C(!0)}),[C,w,L]),B=t((function(e,t){void 0===t&&(t=!1),e&&(u(e),_("",!1)),t&&W(!0)}),[u,W,_]);!function(e,t){var n=function(n){t.current&&!t.current.contains(n.target)&&e()};i((function(){return document.addEventListener("mouseup",n,!1),document.addEventListener("touchend",n,!1),function(){document.removeEventListener("mouseup",n),document.removeEventListener("touchend",n)}}),[])}(W,y),function(e,t){i((function(){if(t.current&&e>=0){var n=t.current.getElementsByClassName("dropdown-option"),r=n&&n.length?n[e]:null;if(r&&r.getBoundingClientRect){var o=r.getBoundingClientRect().height,i=t.current.getBoundingClientRect().height,a=t.current.scrollTop,l=r.offsetTop<=a;r.offsetTop>=a&&r.offsetTop+o<=a+i||(l?t.current.scrollTo({top:r.offsetTop}):t.current.scrollTo({top:r.offsetTop-i+o+8}))}}}),[e])}(b,k);var U=o((function(){return{"aria-hidden":d,"aria-expanded":E,"aria-haspopup":"listbox","aria-activedescendant":a+"_list_"+b,"aria-controls":a+"_list","aria-label":f,"aria-labelledby":m,"aria-describedby":p}}),[d,E,a,b,f,m,p]);return{focusedIndex:b,setFocusedIndex:w,open:E,setOpen:C,searchTerm:P,setSearchTerm:_,dropdownFocused:A,setDropdownFocused:R,setValue:B,filteredOptions:S,openDropdown:I,closeDropdown:W,flattenedOptions:D,container:y,inputRef:O,listWrapper:k,ariaProps:U,ariaList:z(D,L,a)}},G="undefined"!=typeof window&&window.document&&window.document.documentElement,V="test"!==process.env.NODE_ENV&&G,K=0,M=function(n){var r,i=n.arrowRenderer,a=n.centerText,u=n.contentClassName,s=n.className,p=n.disabled,g=n.height,v=n.hideArrow,w=n.id,x=n.maxContentHeight,T=n.openUp,P=n.optionItemRenderer,_=n.pageKeyTraverseSize,S=n.placeholder,D=n.searchable,L=n.selectedValueClassName,W=n.theme,F=n.value,z=n.width,H=o((function(){return r||(V?(e=K,K+=1):e="test_or_ssr","react_dropdown_aria_"+e);var e}),[r=w]),G=j(n,H),M=G.open,X=G.dropdownFocused,Y=G.focusedIndex,q=G.setFocusedIndex,J=G.setDropdownFocused,Q=G.setValue,Z=G.openDropdown,$=G.closeDropdown,ee=G.searchTerm,te=G.setSearchTerm,ne=G.filteredOptions,re=G.flattenedOptions,oe=G.container,ie=G.inputRef,ae=G.listWrapper,le=G.ariaProps,ce=G.ariaList,ue=o((function(){return m(W)?function e(t,n){var r=c({},n);for(var o in t){var i=t[o];m(i)&&o in n?r[o]=e(i,r[o]):h(i)&&o in n&&(m(r[o])||h(r[o]))?r[o]=[i,r[o]]:r[o]=i}return r}(W,E):E}),[W]),de=t((function(){ie.current&&ie.current.focus()}),[ie.current]),se=t((function(){de(),p||M&&D||(M?$(!0):Z())}),[M,p,D,$,Z]),pe=t((function(e){switch(e){case d.UP_ARROW:q((function(e){return 0===e?re.length-1:e-1}));break;case d.DOWN_ARROW:q((function(e){return(e+1)%re.length}));break;case d.PAGE_UP:q((function(e){return e-_<0&&0!==e?0:e-_<0?re.length-1:e-_}));break;case d.PAGE_DOWN:q((function(e){return e===re.length-1?0:e+_>re.length-1?re.length-1:(e+_)%re.length}));break;case d.ESCAPE:$(!0)}}),[q,re,_,$]),fe=t((function(e){var t=e.keyCode;-1!==b.indexOf(t)?(e.preventDefault(),e.stopPropagation(),pe(t)):t!==d.ENTER&&(t!==d.SPACE||D)||M?t!==d.TAB||D?(t===d.TAB||t===d.ENTER)&&re.length>0&&Y>=0&&M&&(e.stopPropagation(),e.preventDefault(),Q(re[Y],!0)):$():(e.preventDefault(),Z())}),[re,Q,Y,M,pe,Z,D,$]),me=t((function(e){te(e.target.value)}),[te]),he=t((function(){return J(!0)}),[J]),ge=t((function(){return J(!1)}),[J]),ve=o((function(){if(v)return null;if(i)return e.createElement(A,{className:"dropdown-arrow",open:M},i(M));var t=M&&D;return e.createElement(A,{className:"dropdown-arrow",open:M},t&&e.createElement(B,null),!t&&e.createElement(I,null))}),[M,i,D,v]);return e.createElement(l,{theme:ue},e.createElement(C,{ref:oe,onFocus:de,onClick:se,role:"button",width:z,height:g,disabled:p,open:M,dropdownFocused:X,className:f("dropdown",s)},e.createElement(y,{className:"dropdown-selector",open:M,searchable:D},e.createElement(O,{className:"dropdown-selector-search"},e.createElement("input",c({id:H,ref:ie,value:ee,onChange:me,onKeyDown:fe,onFocus:he,onBlur:ge,readOnly:!M||!D,disabled:p,autoComplete:"off",role:"combobox"},le))),!F&&!ee&&e.createElement(N,{className:"dropdown-selector-placeholder",centerText:a},S),F&&!ee&&e.createElement(k,{className:f("dropdown-selector-value",L),centerText:a,value:F,open:M},F),ve),ce,e.createElement(R,{maxContentHeight:x,openUp:T,open:M,className:f("dropdown-selector-content",u),ref:ae},e.createElement(U,{selectedOption:F,options:ne,focusedIndex:Y,onOptionClicked:Q,optionItemRenderer:P,empty:0===re.length}))))};M.defaultProps={ariaDescribedBy:null,ariaLabel:null,ariaLabelledBy:null,arrowRenderer:void 0,centerText:!1,className:void 0,contentClassName:null,defaultOpen:!1,disabled:!1,height:null,hideArrow:!1,id:null,maxContentHeight:150,openUp:!1,optionItemRenderer:void 0,pageKeyTraverseSize:10,placeholder:"Select ...",searchable:!1,selectedValueClassName:null,theme:void 0,value:void 0,width:null};export default M; | ||
//# sourceMappingURL=index.es.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};var o={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function a(e){function t(e,t,n){var o=t.trim().split(h);t=o;var a=o.length,i=e.length;switch(i){case 0:case 1:var c=0;for(e=0===i?"":e[0]+" ";c<a;++c)t[c]=r(e,t[c],n).trim();break;default:var s=c=0;for(t=[];c<a;++c)for(var l=0;l<i;++l)t[s++]=r(e[l]+" ",o[c],n).trim()}return t}function r(e,t,r){var n=t.charCodeAt(0);switch(33>n&&(n=(t=t.trim()).charCodeAt(0)),n){case 38:return t.replace(b,"$1"+e.trim());case 58:return e.trim()+t.replace(b,"$1"+e.trim());default:if(0<1*r&&0<t.indexOf("\f"))return t.replace(b,(58===e.charCodeAt(0)?"":"$1")+e.trim())}return e+t}function n(e,t,r,a){var i=e+";",c=2*t+3*r+4*a;if(944===c){e=i.indexOf(":",9)+1;var s=i.substring(e,i.length-1).trim();return s=i.substring(0,e).trim()+s+";",1===_||2===_&&o(s,1)?"-webkit-"+s+s:s}if(0===_||2===_&&!o(i,1))return i;switch(c){case 1015:return 97===i.charCodeAt(10)?"-webkit-"+i+i:i;case 951:return 116===i.charCodeAt(3)?"-webkit-"+i+i:i;case 963:return 110===i.charCodeAt(5)?"-webkit-"+i+i:i;case 1009:if(100!==i.charCodeAt(4))break;case 969:case 942:return"-webkit-"+i+i;case 978:return"-webkit-"+i+"-moz-"+i+i;case 1019:case 983:return"-webkit-"+i+"-moz-"+i+"-ms-"+i+i;case 883:if(45===i.charCodeAt(8))return"-webkit-"+i+i;if(0<i.indexOf("image-set(",11))return i.replace(A,"$1-webkit-$2")+i;break;case 932:if(45===i.charCodeAt(4))switch(i.charCodeAt(5)){case 103:return"-webkit-box-"+i.replace("-grow","")+"-webkit-"+i+"-ms-"+i.replace("grow","positive")+i;case 115:return"-webkit-"+i+"-ms-"+i.replace("shrink","negative")+i;case 98:return"-webkit-"+i+"-ms-"+i.replace("basis","preferred-size")+i}return"-webkit-"+i+"-ms-"+i+i;case 964:return"-webkit-"+i+"-ms-flex-"+i+i;case 1023:if(99!==i.charCodeAt(8))break;return"-webkit-box-pack"+(s=i.substring(i.indexOf(":",15)).replace("flex-","").replace("space-between","justify"))+"-webkit-"+i+"-ms-flex-pack"+s+i;case 1005:return p.test(i)?i.replace(d,":-webkit-")+i.replace(d,":-moz-")+i:i;case 1e3:switch(t=(s=i.substring(13).trim()).indexOf("-")+1,s.charCodeAt(0)+s.charCodeAt(t)){case 226:s=i.replace(w,"tb");break;case 232:s=i.replace(w,"tb-rl");break;case 220:s=i.replace(w,"lr");break;default:return i}return"-webkit-"+i+"-ms-"+s+i;case 1017:if(-1===i.indexOf("sticky",9))break;case 975:switch(t=(i=e).length-10,c=(s=(33===i.charCodeAt(t)?i.substring(0,t):i).substring(e.indexOf(":",7)+1).trim()).charCodeAt(0)+(0|s.charCodeAt(7))){case 203:if(111>s.charCodeAt(8))break;case 115:i=i.replace(s,"-webkit-"+s)+";"+i;break;case 207:case 102:i=i.replace(s,"-webkit-"+(102<c?"inline-":"")+"box")+";"+i.replace(s,"-webkit-"+s)+";"+i.replace(s,"-ms-"+s+"box")+";"+i}return i+";";case 938:if(45===i.charCodeAt(5))switch(i.charCodeAt(6)){case 105:return s=i.replace("-items",""),"-webkit-"+i+"-webkit-box-"+s+"-ms-flex-"+s+i;case 115:return"-webkit-"+i+"-ms-flex-item-"+i.replace(y,"")+i;default:return"-webkit-"+i+"-ms-flex-line-pack"+i.replace("align-content","").replace(y,"")+i}break;case 973:case 989:if(45!==i.charCodeAt(3)||122===i.charCodeAt(4))break;case 931:case 953:if(!0===E.test(e))return 115===(s=e.substring(e.indexOf(":")+1)).charCodeAt(0)?n(e.replace("stretch","fill-available"),t,r,a).replace(":fill-available",":stretch"):i.replace(s,"-webkit-"+s)+i.replace(s,"-moz-"+s.replace("fill-",""))+i;break;case 962:if(i="-webkit-"+i+(102===i.charCodeAt(5)?"-ms-"+i:"")+i,211===r+a&&105===i.charCodeAt(13)&&0<i.indexOf("transform",10))return i.substring(0,i.indexOf(";",27)+1).replace(f,"$1-webkit-$2")+i}return i}function o(e,t){var r=e.indexOf(1===t?":":"{"),n=e.substring(0,3!==t?r:10);return r=e.substring(r+1,e.length-1),T(2!==t?n:n.replace(x,"$1"),r,t)}function a(e,t){var r=n(t,t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2));return r!==t+";"?r.replace(C," or ($1)").substring(4):"("+t+")"}function i(e,t,r,n,o,a,i,c,l,u){for(var d,p=0,f=t;p<P;++p)switch(d=D[p].call(s,e,f,r,n,o,a,i,c,l,u)){case void 0:case!1:case!0:case null:break;default:f=d}if(f!==t)return f}function c(e){return void 0!==(e=e.prefix)&&(T=null,e?"function"!=typeof e?_=1:(_=2,T=e):_=0),c}function s(e,r){var c=e;if(33>c.charCodeAt(0)&&(c=c.trim()),c=[c],0<P){var s=i(-1,r,c,c,S,O,0,0,0,0);void 0!==s&&"string"==typeof s&&(r=s)}var d=function e(r,c,s,d,p){for(var f,h,b,w,C,y=0,x=0,E=0,A=0,D=0,T=0,W=b=f=0,j=0,G=0,z=0,L=0,V=s.length,$=V-1,B="",K="",M="",F="";j<V;){if(h=s.charCodeAt(j),j===$&&0!==x+A+E+y&&(0!==x&&(h=47===x?10:47),A=E=y=0,V++,$++),0===x+A+E+y){if(j===$&&(0<G&&(B=B.replace(u,"")),0<B.trim().length)){switch(h){case 32:case 9:case 59:case 13:case 10:break;default:B+=s.charAt(j)}h=59}switch(h){case 123:for(f=(B=B.trim()).charCodeAt(0),b=1,L=++j;j<V;){switch(h=s.charCodeAt(j)){case 123:b++;break;case 125:b--;break;case 47:switch(h=s.charCodeAt(j+1)){case 42:case 47:e:{for(W=j+1;W<$;++W)switch(s.charCodeAt(W)){case 47:if(42===h&&42===s.charCodeAt(W-1)&&j+2!==W){j=W+1;break e}break;case 10:if(47===h){j=W+1;break e}}j=W}}break;case 91:h++;case 40:h++;case 34:case 39:for(;j++<$&&s.charCodeAt(j)!==h;);}if(0===b)break;j++}switch(b=s.substring(L,j),0===f&&(f=(B=B.replace(l,"").trim()).charCodeAt(0)),f){case 64:switch(0<G&&(B=B.replace(u,"")),h=B.charCodeAt(1)){case 100:case 109:case 115:case 45:G=c;break;default:G=R}if(L=(b=e(c,G,b,h,p+1)).length,0<P&&(C=i(3,b,G=t(R,B,z),c,S,O,L,h,p,d),B=G.join(""),void 0!==C&&0===(L=(b=C.trim()).length)&&(h=0,b="")),0<L)switch(h){case 115:B=B.replace(k,a);case 100:case 109:case 45:b=B+"{"+b+"}";break;case 107:b=(B=B.replace(m,"$1 $2"))+"{"+b+"}",b=1===_||2===_&&o("@"+b,3)?"@-webkit-"+b+"@"+b:"@"+b;break;default:b=B+b,112===d&&(K+=b,b="")}else b="";break;default:b=e(c,t(c,B,z),b,d,p+1)}M+=b,b=z=G=W=f=0,B="",h=s.charCodeAt(++j);break;case 125:case 59:if(1<(L=(B=(0<G?B.replace(u,""):B).trim()).length))switch(0===W&&(f=B.charCodeAt(0),45===f||96<f&&123>f)&&(L=(B=B.replace(" ",":")).length),0<P&&void 0!==(C=i(1,B,c,r,S,O,K.length,d,p,d))&&0===(L=(B=C.trim()).length)&&(B="\0\0"),f=B.charCodeAt(0),h=B.charCodeAt(1),f){case 0:break;case 64:if(105===h||99===h){F+=B+s.charAt(j);break}default:58!==B.charCodeAt(L-1)&&(K+=n(B,f,h,B.charCodeAt(2)))}z=G=W=f=0,B="",h=s.charCodeAt(++j)}}switch(h){case 13:case 10:47===x?x=0:0===1+f&&107!==d&&0<B.length&&(G=1,B+="\0"),0<P*I&&i(0,B,c,r,S,O,K.length,d,p,d),O=1,S++;break;case 59:case 125:if(0===x+A+E+y){O++;break}default:switch(O++,w=s.charAt(j),h){case 9:case 32:if(0===A+y+x)switch(D){case 44:case 58:case 9:case 32:w="";break;default:32!==h&&(w=" ")}break;case 0:w="\\0";break;case 12:w="\\f";break;case 11:w="\\v";break;case 38:0===A+x+y&&(G=z=1,w="\f"+w);break;case 108:if(0===A+x+y+N&&0<W)switch(j-W){case 2:112===D&&58===s.charCodeAt(j-3)&&(N=D);case 8:111===T&&(N=T)}break;case 58:0===A+x+y&&(W=j);break;case 44:0===x+E+A+y&&(G=1,w+="\r");break;case 34:case 39:0===x&&(A=A===h?0:0===A?h:A);break;case 91:0===A+x+E&&y++;break;case 93:0===A+x+E&&y--;break;case 41:0===A+x+y&&E--;break;case 40:if(0===A+x+y){if(0===f)switch(2*D+3*T){case 533:break;default:f=1}E++}break;case 64:0===x+E+A+y+W+b&&(b=1);break;case 42:case 47:if(!(0<A+y+E))switch(x){case 0:switch(2*h+3*s.charCodeAt(j+1)){case 235:x=47;break;case 220:L=j,x=42}break;case 42:47===h&&42===D&&L+2!==j&&(33===s.charCodeAt(L+2)&&(K+=s.substring(L,j+1)),w="",x=0)}}0===x&&(B+=w)}T=D,D=h,j++}if(0<(L=K.length)){if(G=c,0<P&&(void 0!==(C=i(2,K,G,r,S,O,L,d,p,d))&&0===(K=C).length))return F+K+M;if(K=G.join(",")+"{"+K+"}",0!=_*N){switch(2!==_||o(K,2)||(N=0),N){case 111:K=K.replace(v,":-moz-$1")+K;break;case 112:K=K.replace(g,"::-webkit-input-$1")+K.replace(g,"::-moz-$1")+K.replace(g,":-ms-input-$1")+K}N=0}}return F+K+M}(R,c,r,0,0);return 0<P&&(void 0!==(s=i(-2,d,c,c,S,O,d.length,0,0,0))&&(d=s)),"",N=0,O=S=1,d}var l=/^\0+/g,u=/[\0\r\f]/g,d=/: */g,p=/zoo|gra/,f=/([,: ])(transform)/g,h=/,\r+?/g,b=/([\t\r\n ])*\f?&/g,m=/@(k\w+)\s*(\S*)\s*/,g=/::(place)/g,v=/:(read-only)/g,w=/[svh]\w+-[tblr]{2}/,k=/\(\s*(.*)\s*\)/g,C=/([\s\S]*?);/g,y=/-self|flex-/g,x=/[^]*?(:[rp][el]a[\w-]+)[^]*/,E=/stretch|:\s*\w+\-(?:conte|avail)/,A=/([^-])(image-set\()/,O=1,S=1,N=0,_=1,R=[],D=[],P=0,T=null,I=0;return s.use=function e(t){switch(t){case void 0:case null:P=D.length=0;break;default:switch(t.constructor){case Array:for(var r=0,n=t.length;r<n;++r)e(t[r]);break;case Function:D[P++]=t;break;case Boolean:I=0|!!t}}return e},s.set=c,void 0!==e&&c(e),s}var i,c,s=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){e.exports=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(r,n,o,a,i,c,s,l,u,d){switch(r){case 1:if(0===u&&64===n.charCodeAt(0))return e(n+";"),"";break;case 2:if(0===l)return n+"/*|*/";break;case 3:switch(l){case 102:case 112:return e(o[0]+n),"";default:return n+(0===d?"/*|*/":"")}case-2:n.split("/*|*/}").forEach(t)}}}})),l=/[A-Z]|^ms/g,u=(i=function(e){return e.replace(l,"-$&").toLowerCase()},c={},function(e){return void 0===c[e]&&(c[e]=i(e)),c[e]}),d=function(e,t){return null==t||"boolean"==typeof t?"":1===o[e]||45===e.charCodeAt(1)||isNaN(t)||0===t?t:t+"px"};if("production"!==process.env.NODE_ENV){var p=/(attr|calc|counters?|url)\(/,f=["normal","none","counter","open-quote","close-quote","no-open-quote","no-close-quote","initial","inherit","unset"],h=d;d=function(e,t){return"content"===e&&("string"!=typeof t||-1===f.indexOf(t)&&!p.test(t)&&(t.charAt(0)!==t.charAt(t.length-1)||'"'!==t.charAt(0)&&"'"!==t.charAt(0)))&&console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\""+t+"\"'`"),h(e,t)}}var b=function e(t){for(var r=t.length,n=0,o="";n<r;n++){var a=t[n];if(null!=a){var i=void 0;switch(typeof a){case"boolean":break;case"function":"production"!==process.env.NODE_ENV&&console.error("Passing functions to cx is deprecated and will be removed in the next major version of Emotion.\nPlease call the function before passing it to cx."),i=e([a()]);break;case"object":if(Array.isArray(a))i=e(a);else for(var c in i="",a)a[c]&&c&&(i&&(i+=" "),i+=c);break;default:i=a}i&&(o&&(o+=" "),o+=i)}}return o},m="undefined"!=typeof document;function g(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key||""),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),(void 0!==e.container?e.container:document.head).appendChild(t),t}var v=function(){function e(e){this.isSpeedy="production"===process.env.NODE_ENV,this.tags=[],this.ctr=0,this.opts=e}var t=e.prototype;return t.inject=function(){if(this.injected)throw new Error("already injected!");this.tags[0]=g(this.opts),this.injected=!0},t.speedy=function(e){if(0!==this.ctr)throw new Error("cannot change speedy now");this.isSpeedy=!!e},t.insert=function(e,t){if(this.isSpeedy){var r=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(this.tags[this.tags.length-1]);try{r.insertRule(e,r.cssRules.length)}catch(t){"production"!==process.env.NODE_ENV&&console.warn("illegal rule",e)}}else{var n=g(this.opts);this.tags.push(n),n.appendChild(document.createTextNode(e+(t||"")))}this.ctr++,this.ctr%65e3==0&&this.tags.push(g(this.opts))},t.flush=function(){this.tags.forEach((function(e){return e.parentNode.removeChild(e)})),this.tags=[],this.ctr=0,this.injected=!1},e}();var w,k,C=function(e,t){if(void 0!==e.__SECRET_EMOTION__)return e.__SECRET_EMOTION__;void 0===t&&(t={});var r,n=t.key||"css";if("production"!==process.env.NODE_ENV&&/[^a-z-]/.test(n))throw new Error('Emotion key must only contain lower case alphabetical characters and - but "'+n+'" was passed');var o,i=s((function(e){r+=e,m&&l.insert(e,f)}));void 0!==t.prefix&&(o={prefix:t.prefix});var c={registered:{},inserted:{},nonce:t.nonce,key:n},l=new v(t);m&&l.inject();var p=new a(o);p.use(t.stylisPlugins)(i);var f="";function h(e,t){if(null==e)return"";switch(typeof e){case"boolean":return"";case"function":if(void 0!==e.__emotion_styles){var r=e.toString();if("NO_COMPONENT_SELECTOR"===r&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with babel-plugin-emotion.");return r}return void 0===this&&"production"!==process.env.NODE_ENV&&console.error("Interpolating functions in css calls is deprecated and will be removed in the next major version of Emotion.\nIf you want to have a css call based on props, create a function that returns a css call like this\nlet dynamicStyle = (props) => css`color: ${props.color}`\nIt can be called directly with props or interpolated in a styled call like this\nlet SomeComponent = styled('div')`${dynamicStyle}`"),h.call(this,void 0===this?e():e(this.mergedProps,this.context),t);case"object":return C.call(this,e);default:var n=c.registered[e];return!1===t&&void 0!==n?n:e}}var g,w,k=new WeakMap;function C(e){if(k.has(e))return k.get(e);var t="";return Array.isArray(e)?e.forEach((function(e){t+=h.call(this,e,!1)}),this):Object.keys(e).forEach((function(r){if("object"!=typeof e[r])void 0!==c.registered[e[r]]?t+=r+"{"+c.registered[e[r]]+"}":t+=u(r)+":"+d(r,e[r])+";";else{if("NO_COMPONENT_SELECTOR"===r&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with babel-plugin-emotion.");Array.isArray(e[r])&&"string"==typeof e[r][0]&&void 0===c.registered[e[r][0]]?e[r].forEach((function(e){t+=u(r)+":"+d(r,e)+";"})):t+=r+"{"+h.call(this,e[r],!1)+"}"}}),this),k.set(e,t),t}var y=/label:\s*([^\s;\n{]+)\s*;/g,x=function(e,t){return function(e){for(var t,r=e.length,n=r^r,o=0;r>=4;)t=1540483477*(65535&(t=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(t>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(t=1540483477*(65535&(t^=t>>>24))+((1540483477*(t>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),((n^=n>>>15)>>>0).toString(36)}(e+t)+t};if("production"!==process.env.NODE_ENV){var E=x,A=/\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;x=function(e,t){return E(e.replace(A,(function(e){return f=e,""})),t)}}var O=function(e){var t=!0,r="",n="";null==e||void 0===e.raw?(t=!1,r+=h.call(this,e,!1)):r+=e[0];for(var o=arguments.length,a=new Array(o>1?o-1:0),i=1;i<o;i++)a[i-1]=arguments[i];return a.forEach((function(n,o){r+=h.call(this,n,46===r.charCodeAt(r.length-1)),!0===t&&void 0!==e[o+1]&&(r+=e[o+1])}),this),w=r,r=r.replace(y,(function(e,t){return n+="-"+t,""})),g=x(r,n),r};if("production"!==process.env.NODE_ENV){var S=p;p=function(e,t){S(e,t),f=""}}function N(e,t){void 0===c.inserted[g]&&(r="",p(e,t),c.inserted[g]=r)}var _=function(){var e=O.apply(this,arguments),t=n+"-"+g;return void 0===c.registered[t]&&(c.registered[t]=w),N("."+t,e),t};function R(e,t){var r="";return t.split(" ").forEach((function(t){void 0!==c.registered[t]?e.push(t):r+=t+" "})),r}function D(e,t){var r=[],n=R(r,e);return r.length<2?e:n+_(r,t)}function P(e){c.inserted[e]=!0}if(m){var T=document.querySelectorAll("[data-emotion-"+n+"]");Array.prototype.forEach.call(T,(function(e){l.tags[0].parentNode.insertBefore(e,l.tags[0]),e.getAttribute("data-emotion-"+n).split(" ").forEach(P)}))}var I={flush:function(){m&&(l.flush(),l.inject()),c.inserted={},c.registered={}},hydrate:function(e){e.forEach(P)},cx:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return D(b(t))},merge:D,getRegisteredStyles:R,injectGlobal:function(){var e=O.apply(this,arguments);N("",e)},keyframes:function(){var e=O.apply(this,arguments),t="animation-"+g;return N("","@keyframes "+t+"{"+e+"}"),t},css:_,sheet:l,caches:c};return e.__SECRET_EMOTION__=I,I}("undefined"!=typeof global?global:{}),y=(C.flush,C.hydrate,C.cx),x=(C.merge,C.getRegisteredStyles,C.injectGlobal,C.keyframes,C.css);C.sheet,C.caches;(w=exports.StyleKeys||(exports.StyleKeys={})).Arrow="Arrow",w.DropdownSelector="DropdownSelector",w.DropdownWrapper="DropdownWrapper",w.SelectorSearch="SelectorSearch",w.SelectedValue="SelectedValue",w.Placeholder="Placeholder",w.GroupContainer="GroupContainer",w.GroupDivider="GroupDivider",w.GroupHeading="GroupHeading",w.OptionContainer="OptionContainer",w.OptionItem="OptionItem",function(e){e[e.DOWN_ARROW=40]="DOWN_ARROW",e[e.ENTER=13]="ENTER",e[e.ESCAPE=27]="ESCAPE",e[e.PAGE_DOWN=34]="PAGE_DOWN",e[e.PAGE_UP=33]="PAGE_UP",e[e.TAB=9]="TAB",e[e.UP_ARROW=38]="UP_ARROW",e[e.SPACE=32]="SPACE"}(k||(k={}));var E=[k.ESCAPE,k.UP_ARROW,k.DOWN_ARROW,k.PAGE_UP,k.PAGE_DOWN],A={base:"#808080",dark:"#7C7C7C",darker:"#6e6d6d",light:"#CECECE",lighter:"#e0e0e0",lightest:"#f5f5f5"},O={disabled:"#ededed",focused:"#0080bc"},S=r.memo((function(e){var n=e.onOptionClicked,o=e.option,a=e.optionClass,i=e.itemRenderer,c=e.index,s=e.selected,l=t.useCallback((function(e){e.stopPropagation(),n(o,!0)}),[n,o]),u=r.createElement(r.Fragment,null,o.iconClass&&r.createElement("i",{className:o.iconClass+" dropdown-option-icon"}),o.value);return i&&(u=i(e,c)),r.createElement("div",{"aria-label":o.ariaLabel,"aria-selected":s,className:"dropdown-option "+a,onClick:l,title:o.title},u)}));function N(e){return void 0!==e.groupOptions}var _=function(e,t){return N(t)?e.concat(t.groupOptions):e.concat(t)},R=function(e,t){return n(n({},e),{groupOptions:e.groupOptions.filter((function(e){return e.value.toLowerCase().includes(t)}))})},D=function(e){var t=e.children,n=e.className,o=e.dim,a=void 0===o?24:o;return r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather "+n},t)},P=function(){return r.createElement(D,{className:"feather-inbox"},r.createElement("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),r.createElement("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}))},T=function(){return r.createElement(D,{className:"feather-chevron-down",dim:16},r.createElement("polyline",{points:"6 9 12 15 18 9"}))},I=function(){return r.createElement(D,{className:"feather-search",dim:16},r.createElement("circle",{cx:"11",cy:"11",r:"8"}),r.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}))};function W(e){var t=e.selectedOption,n=e.options,o=e.focusedIndex,a=e.onOptionClicked,i=e.getStyle,c=e.optionItemRenderer;if(e.empty)return r.createElement("div",{className:"dropdown-selector-content--empty"},r.createElement(P,null),"No data");var s=c?function(e,t){return c(e,i,t)}:void 0,l=0,u=n.map((function(e){if(N(e)){var n=e.groupOptions,c=e.label,u=n.map((function(e){var n=e.value===t,c=l===o,u=y(e.className,i(exports.StyleKeys.OptionItem,{selected:n,focused:c}));return l+=1,r.createElement(S,{key:e.value,optionClass:u,onOptionClicked:a,option:e,itemRenderer:s,index:l-1,selected:n})}));return u.length?r.createElement("div",{className:i(exports.StyleKeys.GroupContainer),key:e.label},r.createElement("div",{className:i(exports.StyleKeys.GroupHeading)},r.createElement("span",null,c.toUpperCase()," | "),r.createElement("span",null,n.length)),u,r.createElement("div",{className:i(exports.StyleKeys.GroupDivider)})):null}var d=e.value,p=e.className,f=l===o,h=d===t,b=y(p,i(exports.StyleKeys.OptionItem,{selected:h,focused:f}));return l+=1,r.createElement(S,{key:d,optionClass:b,onOptionClicked:a,option:e,itemRenderer:s,index:l-1,selected:h})}));return r.createElement(r.Fragment,null,u)}var j=function(e){return{bottom:0,left:"11px",lineHeight:"30px",overflow:"hidden",position:"absolute",right:"25px",textAlign:e.centerText?"center":"left",textOverflow:"ellipsis",top:0,whiteSpace:"nowrap"}},G={Arrow:function(){return{alignItems:"center",bottom:0,color:A.base,display:"flex",position:"absolute",right:"10px",top:0}},DropdownSelector:function(e,t){return{alignItems:"center",boxSizing:"border-box",cursor:t.open&&e.searchable?"text":"inherit",display:"flex",height:"32px",padding:"0 11px",position:"relative",width:"100%",input:{backgroundColor:"inherit",border:"none",fontSize:"inherit",height:"30px",outline:"none",width:"100%"}}},DropdownWrapper:function(e,t){var r=e.width,n=e.height,o=e.disabled,a=t.open,i=t.dropdownFocused;return{backgroundColor:o?A.light:A.lightest,border:"2px solid "+(a||i?O.focused:A.dark),borderRadius:"7",cursor:o?"not-allowed":"pointer",display:"flex",flexDirection:"column",fontSize:"1em",height:n,position:"relative",width:r,"&:hover":{border:"2px solid "+(a||i?O.focused:A.darker)},"&:disabled":{backgroundColor:O.disabled,cursor:"unset"}}},GroupContainer:function(){return{padding:"1em 0 0 0"}},GroupDivider:function(){return{borderBottom:"1px solid "+A.dark,margin:"auto",paddingTop:10,width:"85%"}},GroupHeading:function(){return{color:"grey",display:"flex",flexDirection:"row",fontSize:"0.9em",padding:"0 10px 3px 5px"}},OptionContainer:function(e,t){var r=e.openUp,n=e.maxContentHeight,o=t.open;return{backgroundColor:A.lightest,border:"2px solid "+A.darker,borderRadius:"4px",bottom:r?"105%":void 0,boxShadow:"0px "+(r?"-4px":"4px")+" 4px rgba(0, 0, 0, 0.25)",boxSizing:"border-box",color:"black",display:o?"block":"none",left:"0",listStyleType:"none",margin:"0",maxHeight:n||"175px",overflowX:"hidden",overflowY:"auto",padding:"2px 0",position:"absolute",top:r?void 0:"100%",width:"100%",zIndex:9999,".dropdown-selector-content--empty":{alignItems:"center",color:A.base,display:"flex",flexDirection:"column",justifyContent:"center",padding:"4px 0"},"&::-webkit-scrollbar":{width:"5px"},"&::-webkit-scrollbar-track":{background:"#ddd"},"&::-webkit-scrollbar-thumb":{background:"#666"}}},OptionItem:function(e,t,r){var n=r.selected,o=r.focused,a=A.lightest,i="inherit";return o&&n?(a=A.dark,i=A.lightest):o?a=A.lighter:n&&(a=A.light),{backgroundColor:a,border:"none",color:i,cursor:"pointer",fontSize:"0.95em",overflow:"hidden",padding:"5px 10px",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",display:"flex",alignItems:"center","&:hover":{backgroundColor:n?A.dark:A.light,color:n?A.lightest:void 0},".option-icon":{paddingRight:"5px"}}},Placeholder:function(e){return n({color:A.base},j(e))},SelectedValue:function(e,t){var r=t.open;return n({color:e.value&&!r?"black":A.base},j(e))},SelectorSearch:function(){return{bottom:0,left:"11px",position:"absolute",right:"25px",top:0}}},z={height:0,width:0,overflow:"hidden"},L=function(e,t,n){var o=e.map((function(e,o){return r.createElement("div",{role:"option",id:n+"_list_"+o,key:n+"_list_"+o,"aria-selected":o===t,"aria-label":e.value})}));return r.createElement("div",{role:"listbox",id:n+"_list",style:z},o)},V=function(e,r,n){var o=t.useState(""),a=o[0],i=o[1],c=t.useMemo((function(){return n&&a.trim()?function(e,t){for(var r=[],n=t.toLowerCase(),o=0,a=e;o<a.length;o++){var i=a[o];if(N(i)){var c=R(i,n);c.groupOptions.length>=0&&r.push(c)}else i.value.toLowerCase().includes(n)&&r.push(i)}return r}(r,a):r}),[r,a]),s=t.useCallback((function(t,r){void 0===r&&(r=!0),i(t),r&&e(0)}),[e,i]);return{searchTerm:a,setSearchTerm:s,filteredOptions:c}},$=function(e,r){var n=e.style,o=e.options,a=e.searchable,i=e.onChange,c=e.disabled,s=e.ariaDescribedBy,l=e.ariaLabel,u=e.ariaLabelledBy,d=e.value,p=e.defaultOpen,f=t.useState(0),h=f[0],b=f[1],m=t.useState(p),g=m[0],v=m[1],w=t.useRef(null),k=t.useRef(null),C=t.useRef(null),y=t.useState(!1),E=y[0],A=y[1],O=V(b,o,a),S=O.searchTerm,N=O.setSearchTerm,R=O.filteredOptions,D=t.useMemo((function(){return R.reduce(_,[])}),[R]),P=t.useMemo((function(){return D.map((function(e){return e.value})).indexOf(d)}),[D,d]),T=t.useCallback((function(t,r){var o={focusedIndex:h,open:g,dropdownFocused:E},a=G[t](e,o,r||{}),i=n[t];return x(i?i(a,o,r):a)}),[n,h,g,e,E]),I=t.useCallback((function(e){void 0===e&&(e=!1),N("",!1),v(!1),e&&k.current&&k.current.focus()}),[k.current,N,v]),W=t.useCallback((function(){b(P>0?P:0),v(!0)}),[v,b,P]),j=t.useCallback((function(e,t){void 0===t&&(t=!1),e&&(i(e),N("",!1)),t&&I(!0)}),[i,I,N]);!function(e,r){var n=function(t){r.current&&!r.current.contains(t.target)&&e()};t.useEffect((function(){return document.addEventListener("mouseup",n,!1),document.addEventListener("touchend",n,!1),function(){document.removeEventListener("mouseup",n),document.removeEventListener("touchend",n)}}),[])}(I,w),function(e,r){t.useEffect((function(){if(r.current&&e>=0){var t=r.current.getElementsByClassName("dropdown-option"),n=t&&t.length?t[e]:null;if(n&&n.getBoundingClientRect){var o=n.getBoundingClientRect().height,a=r.current.getBoundingClientRect().height,i=r.current.scrollTop,c=n.offsetTop<=i;n.offsetTop>=i&&n.offsetTop+o<=i+a||(c?r.current.scrollTo({top:n.offsetTop}):r.current.scrollTo({top:n.offsetTop-a+o+8}))}}}),[e])}(h,C);var z=t.useMemo((function(){return{"aria-hidden":c,"aria-expanded":g,"aria-haspopup":"listbox","aria-activedescendant":r+"_list_"+h,"aria-controls":r+"_list","aria-label":l,"aria-labelledby":u,"aria-describedby":s}}),[c,g,r,h,l,u,s]);return{focusedIndex:h,setFocusedIndex:b,open:g,setOpen:v,searchTerm:S,setSearchTerm:N,dropdownFocused:E,setDropdownFocused:A,setValue:j,filteredOptions:R,getStyle:T,openDropdown:W,closeDropdown:I,flattenedOptions:D,container:w,inputRef:k,listWrapper:C,ariaProps:z,ariaList:L(D,P,r)}},B="undefined"!=typeof window&&window.document&&window.document.documentElement,K="test"!==process.env.NODE_ENV&&B,M=0,F=function(e){var o,a=e.arrowRenderer,i=e.contentClassName,c=e.className,s=e.disabled,l=e.hideArrow,u=e.id,d=e.optionItemRenderer,p=e.pageKeyTraverseSize,f=e.placeholder,h=e.searchable,b=e.value,m=e.selectedValueClassName,g=(o=u,t.useMemo((function(){return o||(K?(e=M,M+=1):e="test_or_ssr","react_dropdown_aria_"+e);var e}),[o])),v=$(e,g),w=v.getStyle,C=v.open,x=v.focusedIndex,A=v.setFocusedIndex,O=v.setDropdownFocused,S=v.setValue,N=v.openDropdown,_=v.closeDropdown,R=v.searchTerm,D=v.setSearchTerm,P=v.filteredOptions,j=v.flattenedOptions,G=v.container,z=v.inputRef,L=v.listWrapper,V=v.ariaProps,B=v.ariaList,F=t.useCallback((function(){z.current&&z.current.focus()}),[z.current]),U=t.useCallback((function(){F(),s||C&&h||(C?_(!0):N())}),[C,s,h,_,N]),H=t.useCallback((function(e){switch(e){case k.UP_ARROW:A((function(e){return 0===e?j.length-1:e-1}));break;case k.DOWN_ARROW:A((function(e){return(e+1)%j.length}));break;case k.PAGE_UP:A((function(e){return e-p<0&&0!==e?0:e-p<0?j.length-1:e-p}));break;case k.PAGE_DOWN:A((function(e){return e===j.length-1?0:e+p>j.length-1?j.length-1:(e+p)%j.length}));break;case k.ESCAPE:_(!0)}}),[A,j,p,_]),q=t.useCallback((function(e){var t=e.keyCode;-1!==E.indexOf(t)?(e.preventDefault(),e.stopPropagation(),H(t)):t!==k.ENTER&&(t!==k.SPACE||h)||C?t!==k.TAB||h?(t===k.TAB||t===k.ENTER)&&j.length>0&&x>=0&&C&&(e.stopPropagation(),e.preventDefault(),S(j[x],!0)):_():(e.preventDefault(),N())}),[j,S,x,C,H,N,h,_]),Y=t.useCallback((function(e){D(e.target.value)}),[D]),X=t.useCallback((function(){return O(!0)}),[O]),Z=t.useCallback((function(){return O(!1)}),[O]),J=y("dropdown",c,w(exports.StyleKeys.DropdownWrapper)),Q=y("dropdown-selector",w(exports.StyleKeys.DropdownSelector)),ee=y("dropdown-selector-search",w(exports.StyleKeys.SelectorSearch)),te=y("dropdown-selector-placeholder",w(exports.StyleKeys.Placeholder)),re=y("dropdown-selector-value",m,w(exports.StyleKeys.SelectedValue)),ne=y("dropdown-selector-content",i,w(exports.StyleKeys.OptionContainer)),oe=y("dropdown-arrow",w(exports.StyleKeys.Arrow)),ae=t.useMemo((function(){if(l)return null;if(a)return r.createElement("div",{className:oe},a(C));var e=C&&h;return r.createElement("div",{className:oe},e&&r.createElement(I,null),!e&&r.createElement(T,null))}),[C,a,oe,h,l]);return r.createElement("div",{ref:G,className:J,onFocus:F,onClick:U,role:"button"},r.createElement("div",{className:Q},r.createElement("span",{className:ee},r.createElement("input",n({id:g,ref:z,value:R,onChange:Y,onKeyDown:q,onFocus:X,onBlur:Z,readOnly:!C||!h,disabled:s,autoComplete:"off",role:"combobox"},V))),!b&&!R&&r.createElement("span",{className:te},f),b&&!R&&r.createElement("span",{className:re},b),ae),B,r.createElement("div",{className:ne,ref:L},r.createElement(W,{selectedOption:b,options:P,focusedIndex:x,onOptionClicked:S,optionItemRenderer:d,getStyle:w,empty:0===j.length})))};F.defaultProps={ariaDescribedBy:null,ariaLabel:null,ariaLabelledBy:null,arrowRenderer:void 0,centerText:!1,className:void 0,contentClassName:null,defaultOpen:!1,disabled:!1,height:null,hideArrow:!1,id:null,maxContentHeight:150,openUp:!1,optionItemRenderer:void 0,pageKeyTraverseSize:10,placeholder:"Select ...",searchable:!1,selectedValueClassName:null,style:{},value:void 0,width:null},exports.default=F; | ||
"use strict";var e=require("react"),t=require("styled-components");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(e),o=n(t),a=function(){return(a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function l(e){return void 0!==e.groupOptions}var i,u=function(e,t){return l(t)?e.concat(t.groupOptions):e.concat(t)},c=function(e,t){return a(a({},e),{groupOptions:e.groupOptions.filter((function(e){return e.value.toLowerCase().includes(t)}))})};function d(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(Boolean).map((function(e){return"string"==typeof e?e:e?Object.keys(e).filter((function(t){return e[t]})).join(" "):""})).join(" ")}function s(e){return e&&"object"==typeof e&&!Array.isArray(e)}function p(e){return!!e&&"function"==typeof e}function f(e,t){if(!s(t))return t;var n=a({},e);for(var r in t){var o=t[r];s(o)&&r in n?n[r]=f(n[r],o):n[r]=o}return n}function m(e,t){var n={};if(p(e))n=m(e(t),t);else if(s(e))for(var r in e)if(Array.isArray(e[r])){var o=e[r],a=o[0],l=o[1];n[r]=m(f(l,a(t)),t)}else n[r]=m(e[r],t);else if(Array.isArray(e)){a=e[0];n=m(f(l=e[1],a(t)),t)}else n=e;return n}!function(e){e[e.DOWN_ARROW=40]="DOWN_ARROW",e[e.ENTER=13]="ENTER",e[e.ESCAPE=27]="ESCAPE",e[e.PAGE_DOWN=34]="PAGE_DOWN",e[e.PAGE_UP=33]="PAGE_UP",e[e.TAB=9]="TAB",e[e.UP_ARROW=38]="UP_ARROW",e[e.SPACE=32]="SPACE"}(i||(i={}));var h=[i.ESCAPE,i.UP_ARROW,i.DOWN_ARROW,i.PAGE_UP,i.PAGE_DOWN],g={base:"#808080",dark:"#7C7C7C",darker:"#6e6d6d",light:"#CECECE",lighter:"#e0e0e0",lightest:"#f5f5f5"},v={disabled:"#ededed",focused:"#0080bc"},b={wrapper:{backgroundColor:function(e){return e.disabled?g.light:g.lightest},border:function(e){var t=e.open,n=e.dropdownFocused;return"2px solid "+(t||n?v.focused:g.darker)},borderRadius:"7px",cursor:function(e){return e.disabled?"not-allowed":"pointer"},fontSize:"1em",display:"flex",flexDirection:"column",height:function(e){return e.height},position:"relative",width:function(e){return e.width},"&:hover":{border:function(e){return"2px solid "+(e.open||e.dropdownFocused?v.focused:g.darker)}},"&:disabled":{backgroundColor:v.disabled,cursor:"unset"}},selector:{alignItems:"center",boxSizing:"border-box",cursor:function(e){return e.open&&e.searchable?"text":"inherit"},display:"flex",height:"32px",padding:"0 11px",position:"relative",width:"100%",input:{backgroundColor:"inherit",border:"none",fontSize:"inherit",height:"30px",outline:"none",width:"100%"}},selectorSearch:{bottom:0,left:"11px",position:"absolute",right:"25px",top:0},selectedValue:{bottom:0,color:function(e){var t=e.value,n=e.open;return t&&!n?"black":g.base},left:"11px",lineHeight:"30px",overflow:"hidden",position:"absolute",right:"25px",textOverflow:"ellipsis",top:0,whiteSpace:"nowrap",marginLeft:"3px"},placeholder:{bottom:0,color:g.base,left:"11px",lineHeight:"30px",overflow:"hidden",position:"absolute",right:"25px",textAlign:function(e){return e.centerText?"center":"left"},textOverflow:"ellipsis",top:0,whiteSpace:"nowrap",marginLeft:"3px"},arrow:{alignItems:"center",bottom:0,color:g.base,display:"flex",position:"absolute",right:"10px",top:0},optionContainer:{backgroundColor:g.lightest,border:"2px solid "+g.darker,borderRadius:"4px",bottom:function(e){return e.openUp?"105%":void 0},boxShadow:function(e){return"0px "+(e.openUp?"-4px":"4px")+" 4px rgba(0, 0, 0, 0.25)"},boxSizing:"border-box",color:"black",display:function(e){return e.open?"block":"none"},left:"0",listStyleType:"none",margin:"0",maxHeight:function(e){return e.maxContentHeight||"175px"},overflowX:"hidden",overflowY:"auto",padding:"2px 0",position:"absolute",top:function(e){return e.openUp?void 0:"100%"},width:"100%",zIndex:9999,".dropdown-selector-content--empty":{alignItems:"center",color:g.base,display:"flex",flexDirection:"column",justifyContent:"center",padding:"4px 0"},"&::-webkit-scrollbar":{width:"5px"},"&::-webkit-scrollbar-track":{background:"#ddd"},"&::-webkit-scrollbar-thumb":{background:"#666"}},groupContainer:{padding:"1em 0 0 0"},groupHeading:{color:"grey",display:"flex",flexDirection:"row",fontSize:"0.9em",padding:"0 10px 3px 5px"},groupDivider:{borderBottom:"1px solid "+g.dark,margin:"auto",paddingTop:10,width:"85%"},optionItem:{backgroundColor:function(e){var t=e.focused,n=e.selected,r=g.lightest;return t&&n?r=g.dark:t?r=g.lighter:n&&(r=g.light),r},border:"none",color:function(e){return e.focused&&e.selected?g.lightest:"inherit"},cursor:"pointer",fontSize:"0.95em",overflow:"hidden",padding:"5px 10px",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",display:"flex",alignItems:"center","&:hover":function(e){var t=e.selected;return{backgroundColor:t?g.dark:g.light,color:t?g.lightest:void 0}},".dropdown-option-icon":{paddingRight:"5px"}}},w=o.default.div((function(e){return m(e.theme.wrapper,e)})),x=o.default.div((function(e){return m(e.theme.selector,e)})),E=o.default.span((function(e){return m(e.theme.selectorSearch,e)})),C=o.default.span((function(e){return m(e.theme.selectedValue,e)})),k=o.default.span((function(e){return m(e.theme.placeholder,e)})),y=o.default.div((function(e){return m(e.theme.arrow,e)})),O=o.default.span((function(e){return m(e.theme.optionContainer,e)})),N=o.default.div((function(e){return m(e.theme.groupContainer,e)})),R=o.default.div((function(e){return m(e.theme.groupHeading,e)})),A=o.default.div((function(e){return m(e.theme.groupDivider,e)})),T=o.default.div((function(e){return m(e.theme.optionItem,e)})),P=r.default.memo((function(t){var n=t.onOptionClicked,o=t.option,a=t.optionClass,l=t.itemRenderer,i=t.index,u=t.selected,c=t.focused,s=e.useCallback((function(e){e.stopPropagation(),n(o,!0)}),[n,o]),p=r.default.createElement(r.default.Fragment,null,o.iconClass&&r.default.createElement("i",{className:o.iconClass+" dropdown-option-icon"}),o.value);return l&&(p=l(t,i)),r.default.createElement(T,{"aria-label":o.ariaLabel,"aria-selected":u,className:d("dropdown-option",a,{selected:u,focused:c}),onClick:s,title:o.title,selected:u,focused:c},p)})),S=function(e){var t=e.children,n=e.className,o=e.dim,a=void 0===o?24:o;return r.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather "+n},t)},_=function(){return r.default.createElement(S,{className:"feather-inbox"},r.default.createElement("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),r.default.createElement("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}))},D=function(){return r.default.createElement(S,{className:"feather-chevron-down",dim:16},r.default.createElement("polyline",{points:"6 9 12 15 18 9"}))},L=function(){return r.default.createElement(S,{className:"feather-search",dim:16},r.default.createElement("circle",{cx:"11",cy:"11",r:"8"}),r.default.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}))};function W(e){var t=e.selectedOption,n=e.options,o=e.focusedIndex,a=e.onOptionClicked,i=e.optionItemRenderer;if(e.empty)return r.default.createElement("div",{className:"dropdown-selector-content--empty"},r.default.createElement(_,null),"No data");var u=i?function(e,t){return i(e,t)}:void 0,c=0,d=n.map((function(e){if(l(e)){var n=e.groupOptions,i=e.label,d=n.map((function(e){var n=e.value===t,l=c===o;return c+=1,r.default.createElement(P,{key:e.value,optionClass:e.className,onOptionClicked:a,option:e,itemRenderer:u,index:c-1,selected:n,focused:l})}));return d.length?r.default.createElement(N,{key:e.label},r.default.createElement(R,null,r.default.createElement("span",null,i.toUpperCase()," | "),r.default.createElement("span",null,n.length)),d,r.default.createElement(A,null)):null}var s=e.value,p=e.className,f=c===o,m=s===t;return c+=1,r.default.createElement(P,{key:s,optionClass:p,onOptionClicked:a,option:e,itemRenderer:u,index:c-1,selected:m,focused:f})}));return r.default.createElement(r.default.Fragment,null,d)}var I={height:0,width:0,overflow:"hidden"},B=function(e,t,n){var o=e.map((function(e,o){return r.default.createElement("div",{role:"option",id:n+"_list_"+o,key:n+"_list_"+o,"aria-selected":o===t,"aria-label":e.value})}));return r.default.createElement("div",{role:"listbox",id:n+"_list",style:I},o)},U=function(t,n,r){var o=e.useState(""),a=o[0],i=o[1],u=e.useMemo((function(){return r&&a.trim()?function(e,t){for(var n=[],r=t.toLowerCase(),o=0,a=e;o<a.length;o++){var i=a[o];if(l(i)){var u=c(i,r);u.groupOptions.length>=0&&n.push(u)}else i.value.toLowerCase().includes(r)&&n.push(i)}return n}(n,a):n}),[n,a]),d=e.useCallback((function(e,n){void 0===n&&(n=!0),i(e),n&&t(0)}),[t,i]);return{searchTerm:a,setSearchTerm:d,filteredOptions:u}},F=function(t,n){var r=t.options,o=t.searchable,a=t.onChange,l=t.disabled,i=t.ariaDescribedBy,c=t.ariaLabel,d=t.ariaLabelledBy,s=t.value,p=t.defaultOpen,f=e.useState(0),m=f[0],h=f[1],g=e.useState(p),v=g[0],b=g[1],w=e.useRef(null),x=e.useRef(null),E=e.useRef(null),C=e.useState(!1),k=C[0],y=C[1],O=U(h,r,o),N=O.searchTerm,R=O.setSearchTerm,A=O.filteredOptions,T=e.useMemo((function(){return A.reduce(u,[])}),[A]),P=e.useMemo((function(){return T.map((function(e){return e.value})).indexOf(s)}),[T,s]),S=e.useCallback((function(e){void 0===e&&(e=!1),R("",!1),b(!1),e&&x.current&&x.current.focus()}),[x.current,R,b]),_=e.useCallback((function(){h(P>0?P:0),b(!0)}),[b,h,P]),D=e.useCallback((function(e,t){void 0===t&&(t=!1),e&&(a(e),R("",!1)),t&&S(!0)}),[a,S,R]);!function(t,n){var r=function(e){n.current&&!n.current.contains(e.target)&&t()};e.useEffect((function(){return document.addEventListener("mouseup",r,!1),document.addEventListener("touchend",r,!1),function(){document.removeEventListener("mouseup",r),document.removeEventListener("touchend",r)}}),[])}(S,w),function(t,n){e.useEffect((function(){if(n.current&&t>=0){var e=n.current.getElementsByClassName("dropdown-option"),r=e&&e.length?e[t]:null;if(r&&r.getBoundingClientRect){var o=r.getBoundingClientRect().height,a=n.current.getBoundingClientRect().height,l=n.current.scrollTop,i=r.offsetTop<=l;r.offsetTop>=l&&r.offsetTop+o<=l+a||(i?n.current.scrollTo({top:r.offsetTop}):n.current.scrollTo({top:r.offsetTop-a+o+8}))}}}),[t])}(m,E);var L=e.useMemo((function(){return{"aria-hidden":l,"aria-expanded":v,"aria-haspopup":"listbox","aria-activedescendant":n+"_list_"+m,"aria-controls":n+"_list","aria-label":c,"aria-labelledby":d,"aria-describedby":i}}),[l,v,n,m,c,d,i]);return{focusedIndex:m,setFocusedIndex:h,open:v,setOpen:b,searchTerm:N,setSearchTerm:R,dropdownFocused:k,setDropdownFocused:y,setValue:D,filteredOptions:A,openDropdown:_,closeDropdown:S,flattenedOptions:T,container:w,inputRef:x,listWrapper:E,ariaProps:L,ariaList:B(T,P,n)}},z="undefined"!=typeof window&&window.document&&window.document.documentElement,H="test"!==process.env.NODE_ENV&&z,j=0,G=function(n){var o,l=n.arrowRenderer,u=n.centerText,c=n.contentClassName,f=n.className,m=n.disabled,g=n.height,v=n.hideArrow,N=n.id,R=n.maxContentHeight,A=n.openUp,T=n.optionItemRenderer,P=n.pageKeyTraverseSize,S=n.placeholder,_=n.searchable,I=n.selectedValueClassName,B=n.theme,U=n.value,z=n.width,G=(o=N,e.useMemo((function(){return o||(H?(e=j,j+=1):e="test_or_ssr","react_dropdown_aria_"+e);var e}),[o])),M=F(n,G),V=M.open,K=M.dropdownFocused,q=M.focusedIndex,X=M.setFocusedIndex,Y=M.setDropdownFocused,J=M.setValue,Q=M.openDropdown,Z=M.closeDropdown,$=M.searchTerm,ee=M.setSearchTerm,te=M.filteredOptions,ne=M.flattenedOptions,re=M.container,oe=M.inputRef,ae=M.listWrapper,le=M.ariaProps,ie=M.ariaList,ue=e.useMemo((function(){return s(B)?function e(t,n){var r=a({},n);for(var o in t){var l=t[o];s(l)&&o in n?r[o]=e(l,r[o]):p(l)&&o in n&&(s(r[o])||p(r[o]))?r[o]=[l,r[o]]:r[o]=l}return r}(B,b):b}),[B]),ce=e.useCallback((function(){oe.current&&oe.current.focus()}),[oe.current]),de=e.useCallback((function(){ce(),m||V&&_||(V?Z(!0):Q())}),[V,m,_,Z,Q]),se=e.useCallback((function(e){switch(e){case i.UP_ARROW:X((function(e){return 0===e?ne.length-1:e-1}));break;case i.DOWN_ARROW:X((function(e){return(e+1)%ne.length}));break;case i.PAGE_UP:X((function(e){return e-P<0&&0!==e?0:e-P<0?ne.length-1:e-P}));break;case i.PAGE_DOWN:X((function(e){return e===ne.length-1?0:e+P>ne.length-1?ne.length-1:(e+P)%ne.length}));break;case i.ESCAPE:Z(!0)}}),[X,ne,P,Z]),pe=e.useCallback((function(e){var t=e.keyCode;-1!==h.indexOf(t)?(e.preventDefault(),e.stopPropagation(),se(t)):t!==i.ENTER&&(t!==i.SPACE||_)||V?t!==i.TAB||_?(t===i.TAB||t===i.ENTER)&&ne.length>0&&q>=0&&V&&(e.stopPropagation(),e.preventDefault(),J(ne[q],!0)):Z():(e.preventDefault(),Q())}),[ne,J,q,V,se,Q,_,Z]),fe=e.useCallback((function(e){ee(e.target.value)}),[ee]),me=e.useCallback((function(){return Y(!0)}),[Y]),he=e.useCallback((function(){return Y(!1)}),[Y]),ge=e.useMemo((function(){if(v)return null;if(l)return r.default.createElement(y,{className:"dropdown-arrow",open:V},l(V));var e=V&&_;return r.default.createElement(y,{className:"dropdown-arrow",open:V},e&&r.default.createElement(L,null),!e&&r.default.createElement(D,null))}),[V,l,_,v]);return r.default.createElement(t.ThemeProvider,{theme:ue},r.default.createElement(w,{ref:re,onFocus:ce,onClick:de,role:"button",width:z,height:g,disabled:m,open:V,dropdownFocused:K,className:d("dropdown",f)},r.default.createElement(x,{className:"dropdown-selector",open:V,searchable:_},r.default.createElement(E,{className:"dropdown-selector-search"},r.default.createElement("input",a({id:G,ref:oe,value:$,onChange:fe,onKeyDown:pe,onFocus:me,onBlur:he,readOnly:!V||!_,disabled:m,autoComplete:"off",role:"combobox"},le))),!U&&!$&&r.default.createElement(k,{className:"dropdown-selector-placeholder",centerText:u},S),U&&!$&&r.default.createElement(C,{className:d("dropdown-selector-value",I),centerText:u,value:U,open:V},U),ge),ie,r.default.createElement(O,{maxContentHeight:R,openUp:A,open:V,className:d("dropdown-selector-content",c),ref:ae},r.default.createElement(W,{selectedOption:U,options:te,focusedIndex:q,onOptionClicked:J,optionItemRenderer:T,empty:0===ne.length}))))};G.defaultProps={ariaDescribedBy:null,ariaLabel:null,ariaLabelledBy:null,arrowRenderer:void 0,centerText:!1,className:void 0,contentClassName:null,defaultOpen:!1,disabled:!1,height:null,hideArrow:!1,id:null,maxContentHeight:150,openUp:!1,optionItemRenderer:void 0,pageKeyTraverseSize:10,placeholder:"Select ...",searchable:!1,selectedValueClassName:null,theme:void 0,value:void 0,width:null},module.exports=G; | ||
//# sourceMappingURL=index.js.map |
@@ -1,16 +0,42 @@ | ||
import { CSSObject } from 'create-emotion'; | ||
import { DefaultTheme } from 'styled-components'; | ||
import { DropdownProps, DropdownStyleDependantState, ExtraState } from '../utils/types'; | ||
declare const _default: { | ||
Arrow: () => CSSObject; | ||
DropdownSelector: (props: DropdownProps, { open }: DropdownStyleDependantState) => CSSObject; | ||
DropdownWrapper: ({ width, height, disabled }: DropdownProps, { open, dropdownFocused }: DropdownStyleDependantState) => CSSObject; | ||
GroupContainer: () => CSSObject; | ||
GroupDivider: () => CSSObject; | ||
GroupHeading: () => CSSObject; | ||
OptionContainer: ({ openUp, maxContentHeight }: DropdownProps, { open }: DropdownStyleDependantState) => CSSObject; | ||
OptionItem: (props: DropdownProps, state: DropdownStyleDependantState, { selected, focused }: ExtraState) => CSSObject; | ||
Placeholder: (props: DropdownProps) => CSSObject; | ||
SelectedValue: (props: DropdownProps, { open }: DropdownStyleDependantState) => CSSObject; | ||
SelectorSearch: () => CSSObject; | ||
export declare type StyleValue<T> = string | number | undefined | { | ||
[key: string]: StyleValue<T> | ThemeObject<T> | ThemeFunction<T>; | ||
}; | ||
export default _default; | ||
export declare type ThemeFunction<T> = (props: T) => ThemeObject<T> | StyleValue<T>; | ||
export declare type ThemeObject<T> = { | ||
[key: string]: ThemeFunction<T> | StyleValue<T>; | ||
}; | ||
export declare type ThemeObjectOrFunction<T = undefined> = ThemeObject<T> | ThemeFunction<T> | [ThemeFunction<T>, DefaultTheme]; | ||
export declare type RdaTheme = { | ||
wrapper?: ThemeObjectOrFunction<DropdownWrapperProps>; | ||
selector?: ThemeObjectOrFunction<DropdownSelectorProps>; | ||
selectorSearch?: ThemeObjectOrFunction; | ||
selectedValue?: ThemeObjectOrFunction<SelectedValueProps>; | ||
placeholder?: ThemeObjectOrFunction<PlaceholderProps>; | ||
arrow?: ThemeObjectOrFunction<ArrowProps>; | ||
optionContainer?: ThemeObjectOrFunction<OptionContainerProps>; | ||
groupContainer?: ThemeObjectOrFunction; | ||
groupHeading?: ThemeObjectOrFunction; | ||
groupDivider?: ThemeObjectOrFunction; | ||
optionItem?: ThemeObjectOrFunction<OptionItemWrapProps>; | ||
}; | ||
export declare const DropdownTheme: RdaTheme; | ||
export declare type DropdownWrapperProps = Pick<DropdownProps, 'width' | 'height' | 'disabled'> & Pick<DropdownStyleDependantState, 'open' | 'dropdownFocused'>; | ||
export declare const DropdownWrapper: import("styled-components").StyledComponent<"div", any, DropdownWrapperProps, never>; | ||
export declare type DropdownSelectorProps = Pick<DropdownProps, 'searchable'> & Pick<DropdownStyleDependantState, 'open'>; | ||
export declare const DropdownSelector: import("styled-components").StyledComponent<"div", any, DropdownSelectorProps, never>; | ||
export declare const SelectorSearch: import("styled-components").StyledComponent<"span", any, {}, never>; | ||
export declare type SelectedValueProps = Pick<DropdownProps, 'centerText' | 'value'> & Pick<DropdownStyleDependantState, 'open'>; | ||
export declare const SelectedValue: import("styled-components").StyledComponent<"span", any, SelectedValueProps, never>; | ||
export declare type PlaceholderProps = Pick<DropdownProps, 'centerText'>; | ||
export declare const Placeholder: import("styled-components").StyledComponent<"span", any, Pick<DropdownProps, "centerText">, never>; | ||
export declare type ArrowProps = Pick<DropdownStyleDependantState, 'open'>; | ||
export declare const Arrow: import("styled-components").StyledComponent<"div", any, Pick<DropdownStyleDependantState, "open">, never>; | ||
export declare type OptionContainerProps = Pick<DropdownProps, 'openUp' | 'maxContentHeight'> & Pick<DropdownStyleDependantState, 'open'>; | ||
export declare const OptionContainer: import("styled-components").StyledComponent<"span", any, OptionContainerProps, never>; | ||
export declare const GroupContainer: import("styled-components").StyledComponent<"div", any, {}, never>; | ||
export declare const GroupHeading: import("styled-components").StyledComponent<"div", any, {}, never>; | ||
export declare const GroupDivider: import("styled-components").StyledComponent<"div", any, {}, never>; | ||
export declare type OptionItemWrapProps = Pick<ExtraState, 'selected' | 'focused'>; | ||
export declare const OptionItemWrap: import("styled-components").StyledComponent<"div", any, Pick<ExtraState, "selected" | "focused">, never>; |
@@ -1,14 +0,1 @@ | ||
export declare enum StyleKeys { | ||
Arrow = "Arrow", | ||
DropdownSelector = "DropdownSelector", | ||
DropdownWrapper = "DropdownWrapper", | ||
SelectorSearch = "SelectorSearch", | ||
SelectedValue = "SelectedValue", | ||
Placeholder = "Placeholder", | ||
GroupContainer = "GroupContainer", | ||
GroupDivider = "GroupDivider", | ||
GroupHeading = "GroupHeading", | ||
OptionContainer = "OptionContainer", | ||
OptionItem = "OptionItem" | ||
} | ||
export declare enum KEY_CODES { | ||
@@ -15,0 +2,0 @@ DOWN_ARROW = 40, |
@@ -1,3 +0,3 @@ | ||
import React from "react"; | ||
import { DropdownProps, ExtraState, Option, DropdownOption } from './types'; | ||
import React from 'react'; | ||
import { DropdownProps, Option, DropdownOption } from './types'; | ||
export declare const useDropdownHooks: (props: DropdownProps, mergedId: string) => { | ||
@@ -14,3 +14,2 @@ focusedIndex: number; | ||
filteredOptions: DropdownOption[]; | ||
getStyle: (key: "Arrow" | "DropdownSelector" | "DropdownWrapper" | "SelectorSearch" | "SelectedValue" | "Placeholder" | "GroupContainer" | "GroupDivider" | "GroupHeading" | "OptionContainer" | "OptionItem", extraState?: ExtraState | undefined) => string; | ||
openDropdown: () => void; | ||
@@ -17,0 +16,0 @@ closeDropdown: (focus?: any) => void; |
@@ -1,4 +0,10 @@ | ||
import { Option, OptionGroup } from './types'; | ||
import { RdaTheme, ThemeFunction, ThemeObjectOrFunction, StyleValue } from '../styles'; | ||
import { Option, OptionGroup, DropdownOption } from './types'; | ||
export declare function isOptionGroup(option: Option | OptionGroup): option is OptionGroup; | ||
export declare const arrayReducer: (acc: Option[], val: Option | OptionGroup) => Option[]; | ||
export declare const filterDropdownOptions: (options: (Option | OptionGroup)[], searchTerm: string) => (Option | OptionGroup)[]; | ||
export declare const arrayReducer: (acc: Option[], val: DropdownOption) => Option[]; | ||
export declare const filterDropdownOptions: (options: DropdownOption[], searchTerm: string) => DropdownOption[]; | ||
export declare function cx(...args: (string | object | undefined)[]): string; | ||
export declare function isObject(obj: any): obj is object; | ||
export declare function isFunction<T>(obj: any): obj is ThemeFunction<T>; | ||
export declare function mergeThemes(provided: RdaTheme, defaultTheme: RdaTheme): RdaTheme; | ||
export declare function unpackTheme<T>(theme: ThemeObjectOrFunction<T> | StyleValue<T>, props: T): any; |
import { ReactNode } from 'react'; | ||
import { StyleKeys } from './constants'; | ||
import { OptionItemProps } from '../components/OptionItem'; | ||
import { RdaTheme } from '../styles'; | ||
export interface ExtraState { | ||
[key: string]: any; | ||
} | ||
export declare type StyleKey = keyof typeof StyleKeys; | ||
declare type StyleFunction = (base: {}, state: DropdownStyleDependantState, extraState?: {}) => {}; | ||
export declare type GetStyleFunction = (key: StyleKey, extraState?: ExtraState) => string; | ||
export declare type OptionRendererFunction = (props: OptionItemProps, getStyle: GetStyleFunction, index: number) => JSX.Element; | ||
export declare type OptionRendererFunction = (props: OptionItemProps, index: number) => JSX.Element; | ||
export declare type OnOptionClicked = (option: Option, shouldClose?: boolean) => void; | ||
export declare type ItemRenderer = (props: OptionItemProps, index: number) => JSX.Element; | ||
export interface DropdownStyle { | ||
Arrow?: StyleFunction; | ||
DropdownButton?: StyleFunction; | ||
DisplayedValue?: StyleFunction; | ||
DropdownWrapper?: StyleFunction; | ||
GroupContainer?: StyleFunction; | ||
GroupHeading?: StyleFunction; | ||
GroupDivider?: StyleFunction; | ||
OptionContainer?: StyleFunction; | ||
OptionItem?: StyleFunction; | ||
} | ||
export interface Option { | ||
value: string; | ||
ariaLabel?: string; | ||
className?: string; | ||
title?: string; | ||
value: string; | ||
iconClass?: string; | ||
@@ -66,6 +52,5 @@ } | ||
selectedValueClassName: string; | ||
theme: RdaTheme; | ||
onChange: (option: Option) => void; | ||
style: DropdownStyle; | ||
width: number; | ||
} | ||
export {}; |
{ | ||
"name": "react-dropdown-aria", | ||
"version": "2.0.7", | ||
"version": "3.0.0-rc.1", | ||
"description": "Simple and accessible React dropdown component", | ||
@@ -48,2 +48,3 @@ "main": "dist/index.js", | ||
"@types/sinon": "^7.0.13", | ||
"@types/styled-components": "^5.1.2", | ||
"@typescript-eslint/eslint-plugin": "^2.27.0", | ||
@@ -53,3 +54,2 @@ "@typescript-eslint/parser": "^2.27.0", | ||
"babel-loader": "^8.0.6", | ||
"babel-plugin-emotion": "^10.0.14", | ||
"enzyme": "^3.6.0", | ||
@@ -63,3 +63,3 @@ "enzyme-adapter-react-16": "^1.5.0", | ||
"jest": "^26.0.1", | ||
"jest-emotion": "^10.0.11", | ||
"jest-styled-components": "^7.0.3", | ||
"jsx-loader": "^0.13.2", | ||
@@ -74,11 +74,11 @@ "prettier": "^1.18.2", | ||
"sinon": "^6.1.5", | ||
"styled-components": "^5.2.1", | ||
"ts-jest": "^25.5.0", | ||
"typescript": "^3.8.3" | ||
}, | ||
"dependencies": { | ||
"emotion": "^9.2.6" | ||
}, | ||
"dependencies": {}, | ||
"peerDependencies": { | ||
"react": "^16.8.0", | ||
"react-dom": "^16.8.0" | ||
"react-dom": "^16.8.0", | ||
"styled-components": "^5.1.1" | ||
}, | ||
@@ -96,4 +96,4 @@ "jest": { | ||
], | ||
"snapshotSerializers": [ | ||
"jest-emotion" | ||
"setupFilesAfterEnv": [ | ||
"./styled.setup.ts" | ||
] | ||
@@ -100,0 +100,0 @@ }, |
@@ -14,3 +14,3 @@ [![CircleCI](https://circleci.com/gh/jfangrad/react-dropdown-aria.svg?style=svg&circle-token=c8db79d70dddf853273a5964b860ec0bf53f5163)](https://circleci.com/gh/jfangrad/react-dropdown-aria/tree/master) [![npm](https://img.shields.io/npm/v/react-dropdown-aria.svg)](https://www.npmjs.com/package/react-dropdown-aria) | ||
## Features | ||
1. Fully customizable styling | ||
1. Fully customizable styling (powered by styled-components) | ||
2. Grouped options | ||
@@ -80,32 +80,26 @@ 3. Accessible | ||
1. CSS className props (As seen in props table below) | ||
2. Emotion JavaScript Objects passed to `style` prop | ||
2. JavaScript Objects passed to the `theme` prop | ||
The suggested method is by using the style prop as shown in the [Custom Styling Example](https://github.com/jfangrad/react-aria-dropdown/blob/master/demo/src/Components/CustomStyles.jsx). | ||
The following object keys are supported to apply style to the corresponding part of the dropdown: | ||
The suggested method is by using the theme prop as shown in the [Custom Styling Example](https://github.com/jfangrad/react-aria-dropdown/blob/master/demo/src/Components/CustomStyles.jsx). | ||
The theme prop can have keys of the following form: | ||
```typescript | ||
type RdaTheme = { | ||
wrapper?: ThemeObjectOrFunction<DropdownWrapperProps>; | ||
selector?: ThemeObjectOrFunction<DropdownSelectorProps>; | ||
selectorSearch?: ThemeObjectOrFunction; | ||
selectedValue?: ThemeObjectOrFunction<SelectedValueProps>; | ||
placeholder?: ThemeObjectOrFunction<PlaceholderProps>; | ||
arrow?: ThemeObjectOrFunction<ArrowProps>; | ||
optionContainer?: ThemeObjectOrFunction<OptionContainerProps>; | ||
groupContainer?: ThemeObjectOrFunction; | ||
groupHeading?: ThemeObjectOrFunction; | ||
groupDivider?: ThemeObjectOrFunction; | ||
optionItem?: ThemeObjectOrFunction<OptionItemWrapProps>; | ||
}; | ||
``` | ||
Arrow, DropdownButton, DisplayedValue, DropdownWrapper, GroupContainer, GroupDivider, GroupHeading, OptionContainer, OptionItem | ||
``` | ||
The style prop should be passed an object containing one or more of the above properties. Each of those properties should be a function that returns an object. An example is shown below: | ||
```js | ||
const style = { | ||
OptionItem: (base, state, { selected }) => ({ | ||
...base, | ||
fontSize: '0.95em', | ||
color: selected ? 'white' : 'black', | ||
backgroundColor: selected ? '#00A3EF' : 'white', | ||
'&:hover': { | ||
backgroundColor: selected ? '#0092d6' : '#e0f5ff', | ||
}, | ||
'&:focus': { | ||
backgroundColor: selected ? '#0092d6' : '#e0f5ff', | ||
}, | ||
}), | ||
... | ||
} | ||
``` | ||
As shown above, each function will be called with `base` and `state` at minimum and some will be provided a third `extraState` parameter which should be an object, as shown with `optionStyle` where the extraState contains whether an option is currently selected or not. | ||
As is shown above, each key in the `theme` object can be either a plain object or function. If you need access to the current state of the dropdown then you should pass a function which will be called with the appropiate state. | ||
`base` - is the default styles object. It can either be spread out to extend the default styles (as shown above) or ommitted to ignore all default styles | ||
The theme object you provide will be merged with the default theme. | ||
`state` - is the internal state of the dropdown | ||
Examples of both methods are shown in the [Custom Styling Example](https://github.com/jfangrad/react-aria-dropdown/blob/master/demo/src/Components/CustomStyles.jsx). | ||
@@ -138,3 +132,3 @@ ## Dropdown Props | ||
| `onChange` | function | undefined | Function called when the selected value changes | | ||
| `style` | object | {} | Use to change the style of the dropdown through js instead of css (see styling section) | | ||
| `theme` | [RdaTheme](https://github.com/jfangrad/react-dropdown-aria/blob/master/packages/react-dropdown-aria/styles/index.ts#L12) | undefined | Use to change the style of the dropdown through js instead of css (see styling section) | | ||
| `width` | number | null | Use to set the dropdown width manually | | ||
@@ -156,3 +150,3 @@ | ||
yarn lib:dev | ||
yarn demo:dev | ||
yarn demo:start | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
18
3
173909
40
353
2
149
+ Added@ampproject/remapping@2.3.0(transitive)
+ Added@babel/compat-data@7.26.5(transitive)
+ Added@babel/core@7.26.7(transitive)
+ Added@babel/helper-annotate-as-pure@7.25.9(transitive)
+ Added@babel/helper-compilation-targets@7.26.5(transitive)
+ Added@babel/helper-module-transforms@7.26.0(transitive)
+ Added@babel/helper-plugin-utils@7.26.5(transitive)
+ Added@babel/helper-validator-option@7.25.9(transitive)
+ Added@babel/helpers@7.26.7(transitive)
+ Added@babel/plugin-syntax-jsx@7.25.9(transitive)
+ Added@emotion/is-prop-valid@1.3.1(transitive)
+ Added@emotion/memoize@0.9.0(transitive)
+ Added@emotion/stylis@0.8.5(transitive)
+ Added@emotion/unitless@0.7.5(transitive)
+ Addedbabel-plugin-styled-components@2.1.4(transitive)
+ Addedbrowserslist@4.24.4(transitive)
+ Addedcamelize@1.0.1(transitive)
+ Addedcaniuse-lite@1.0.30001698(transitive)
+ Addedconvert-source-map@2.0.0(transitive)
+ Addedcss-color-keywords@1.0.0(transitive)
+ Addedcss-to-react-native@3.2.0(transitive)
+ Addedelectron-to-chromium@1.5.95(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedgensync@1.0.0-beta.2(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedhoist-non-react-statics@3.3.2(transitive)
+ Addedjson5@2.2.3(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedlru-cache@5.1.1(transitive)
+ Addednode-releases@2.0.19(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedpostcss-value-parser@4.2.0(transitive)
+ Addedsemver@6.3.1(transitive)
+ Addedshallowequal@1.1.0(transitive)
+ Addedstyled-components@5.3.11(transitive)
+ Addedsupports-color@5.5.0(transitive)
+ Addedupdate-browserslist-db@1.1.2(transitive)
+ Addedyallist@3.1.1(transitive)
- Removedemotion@^9.2.6
- Removed@babel/runtime@7.26.7(transitive)
- Removed@emotion/babel-utils@0.6.10(transitive)
- Removed@emotion/hash@0.6.6(transitive)
- Removed@emotion/memoize@0.6.6(transitive)
- Removed@emotion/serialize@0.9.1(transitive)
- Removed@emotion/stylis@0.7.1(transitive)
- Removed@emotion/unitless@0.6.7(transitive)
- Removed@emotion/utils@0.8.2(transitive)
- Removed@types/parse-json@4.0.2(transitive)
- Removedabbrev@1.1.1(transitive)
- Removedbabel-plugin-emotion@9.2.11(transitive)
- Removedbabel-plugin-macros@2.8.0(transitive)
- Removedbabel-plugin-syntax-jsx@6.18.0(transitive)
- Removedcallsites@3.1.0(transitive)
- Removedconvert-source-map@1.9.0(transitive)
- Removedcosmiconfig@6.0.0(transitive)
- Removedcreate-emotion@9.2.12(transitive)
- Removedcsstype@2.6.21(transitive)
- Removedemotion@9.2.12(transitive)
- Removederror-ex@1.3.2(transitive)
- Removedfind-root@1.1.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedimport-fresh@3.3.1(transitive)
- Removedis-arrayish@0.2.1(transitive)
- Removedis-core-module@2.16.1(transitive)
- Removedjson-parse-even-better-errors@2.3.1(transitive)
- Removedlines-and-columns@1.2.4(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removednopt@1.0.10(transitive)
- Removedparent-module@1.0.1(transitive)
- Removedparse-json@5.2.0(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedpath-type@4.0.0(transitive)
- Removedregenerator-runtime@0.14.1(transitive)
- Removedresolve@1.22.10(transitive)
- Removedresolve-from@4.0.0(transitive)
- Removedsource-map@0.5.70.7.4(transitive)
- Removedstylis@3.5.4(transitive)
- Removedstylis-rule-sheet@0.0.10(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedtouch@2.0.2(transitive)
- Removedyaml@1.10.2(transitive)