react-functional-select
Advanced tools
Comparing version 3.2.1 to 3.2.2
import { MenuPositionEnum } from '../constants'; | ||
import type { MutableRefObject } from 'react'; | ||
import type { RefObject } from 'react'; | ||
import type { CallbackFunction } from '../types'; | ||
/** | ||
@@ -10,2 +11,2 @@ * Handle calculating and maintaining the menuHeight used by react-window. | ||
*/ | ||
export declare const useMenuPositioner: (menuRef: MutableRefObject<HTMLElement | null>, controlRef: MutableRefObject<HTMLElement | null>, menuOpen: boolean, menuPosition: MenuPositionEnum, menuItemSize: number, menuHeightDefault: number, menuOptionsLength: number, isMenuPortaled: boolean, menuScrollDuration?: number | undefined, scrollMenuIntoView?: boolean | undefined, onMenuOpen?: ((...args: any[]) => any) | undefined, onMenuClose?: ((...args: any[]) => any) | undefined) => [string | undefined, number]; | ||
export declare const useMenuPositioner: (menuRef: RefObject<HTMLElement | null>, controlRef: RefObject<HTMLElement | null>, menuOpen: boolean, menuPosition: MenuPositionEnum, menuItemSize: number, menuHeightDefault: number, menuOptionsLength: number, isMenuPortaled: boolean, menuScrollDuration?: number | undefined, scrollMenuIntoView?: boolean | undefined, onMenuOpen?: CallbackFunction | undefined, onMenuClose?: CallbackFunction | undefined) => [string | undefined, number]; |
@@ -13,2 +13,4 @@ import { useEffect, useState, useRef } from 'react'; | ||
export const useMenuPositioner = (menuRef, controlRef, menuOpen, menuPosition, menuItemSize, menuHeightDefault, menuOptionsLength, isMenuPortaled, menuScrollDuration, scrollMenuIntoView, onMenuOpen, onMenuClose) => { | ||
const onMenuOpenRef = useRef(); | ||
const onMenuCloseRef = useRef(); | ||
const resetMenuHeightRef = useRef(false); | ||
@@ -19,2 +21,6 @@ const shouldScrollRef = useRef(!isMenuPortaled); | ||
useEffect(() => { | ||
onMenuOpenRef.current = onMenuOpen; | ||
onMenuCloseRef.current = onMenuClose; | ||
}, [onMenuOpen, onMenuClose]); | ||
useEffect(() => { | ||
shouldScrollRef.current = !isMenuTopPosition && !isMenuPortaled; | ||
@@ -30,3 +36,3 @@ }, [isMenuTopPosition, isMenuPortaled]); | ||
const handleOnMenuOpen = (availableSpace) => { | ||
onMenuOpen?.(); | ||
onMenuOpenRef.current?.(); | ||
if (availableSpace) { | ||
@@ -42,3 +48,3 @@ resetMenuHeightRef.current = true; | ||
else { | ||
onMenuClose?.(); | ||
onMenuCloseRef.current?.(); | ||
if (resetMenuHeightRef.current) { | ||
@@ -49,3 +55,3 @@ resetMenuHeightRef.current = false; | ||
} | ||
}, [menuRef, menuOpen, onMenuClose, onMenuOpen, menuHeightDefault, scrollMenuIntoView, menuScrollDuration]); | ||
}, [menuRef, menuOpen, menuHeightDefault, scrollMenuIntoView, menuScrollDuration]); | ||
// Calculated menu height passed react-window; calculate MenuWrapper <div /> 'top' style prop if menu is positioned above control | ||
@@ -52,0 +58,0 @@ const menuHeightCalc = Math.min(menuHeight, menuOptionsLength * menuItemSize); |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components"),n=require("react-window"),o=require("react-dom");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=i(e),r=i(t);const l={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container"},s={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input"},d="top",u="auto",c="bottom",p="any",f=0,m=1,g=0,h=1,b=2,v=3,w=t.keyframes(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),y=t.css([""," 0.2s ease-out both"],t.keyframes(["from{opacity:0;}to{opacity:1;}"])),x={index:-1},C=[],O={color:{border:"#ced4da",danger:"#dc3545",primary:"#007bff",disabled:"#e9ecef",placeholder:"#6E7276",dangerLight:"rgba(220, 53, 69, 0.25)"},input:{},select:{},loader:{size:"0.625rem",padding:"0.375rem 0.75rem",animation:t.css([""," 1.19s ease-in-out infinite"],w),color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 0.9375rem",clear:{width:"14px",height:"16px",animation:y,transition:"color 0.2s ease-out"},caret:{size:"7px",transition:"transform 0.3s ease-in-out, color 0.2s ease-out"}},control:{minHeight:"38px",borderWidth:"1px",borderStyle:"solid",borderRadius:"3px",boxShadow:"0 0 0 0.2rem",padding:"0.375rem 0.75rem",boxShadowColor:"rgba(0, 123, 255, 0.25)",focusedBorderColor:"rgba(0, 123, 255, 0.75)",transition:"box-shadow 0.2s ease-out, border-color 0.2s ease-out"},menu:{padding:"0",width:"100%",margin:"0.5rem 0",borderRadius:"3px",backgroundColor:"#fff",animation:y,boxShadow:"0 0.5em 1em -0.125em rgb(10 10 10 / 12%), 0 0 0 1px rgb(10 10 10 / 4%)",option:{textAlign:"left",selectedColor:"#fff",selectedBgColor:"#007bff",padding:"0.375rem 0.75rem",focusedBgColor:"rgba(0, 123, 255, 0.15)"}},noOptions:{fontSize:"1.25rem",margin:"0.25rem 0",color:"hsl(0, 0%, 60%)",padding:"0.375rem 0.75rem"},multiValue:{margin:"1px 2px",borderRadius:"3px",backgroundColor:"#e7edf3",animation:y,label:{borderRadius:"3px",fontSize:"0.825em",padding:"1px 0 1px 6px"},clear:{fontWeight:600,padding:"0 6px",color:"#a6a6a6",fontSize:"0.65em",alignSelf:"center",focusColor:"#808080",transition:"color 0.2s ease-out, transform 0.2s ease-out, z-index 0.2s ease-out"}}},S=/[\u0300-\u036f]/g;function I(e){return"boolean"==typeof e}function E(e){return Array.isArray(e)&&!!e.length}function M(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}const k=(e,t=!0)=>{t&&e.preventDefault(),e.stopPropagation()};function z(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(S,"")}(o):o}const L=(e,t,n)=>{const o=Array.isArray(e)?e:M(e)?[e]:C;return E(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},N=(e,t)=>{const n={...e};return Object.keys(t).forEach((o=>{const i=t[o];n[o]="animation"!==o&&M(i)?e[o]?N(e[o],i):i:i||""})),n};function D(e){return R(e)?window.pageYOffset:e.scrollTop}function R(e){return e===document.documentElement||e===document.body||e===window}const T=/(auto|scroll)/;function V({overflow:e,overflowX:t,overflowY:n}){return T.test(`${e}${t}${n}`)}function A(e){let t=getComputedStyle(e);const n=document.documentElement,o="absolute"===t.position;if("fixed"===t.position)return n;for(let n=e;n=null===(i=n)||void 0===i?void 0:i.parentElement;){var i;if(t=getComputedStyle(n),(!o||"static"!==t.position)&&V(t))return n}return n}function F(e,t,n=300,o){let i=0;const a=D(e),r=t-a;requestAnimationFrame((function t(){i+=5;const l=r*((s=(s=i)/n-1)*s*s+1)+a;var s;!function(e,t){R(e)?window.scrollTo(0,t):e.scrollTop=t}(e,l),i<n?requestAnimationFrame(t):null==o||o()}))}const B="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,$="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent),q=e.memo((({index:e,style:t,data:{menuOptions:n,selectOption:o,renderOptionLabel:i,focusedOptionIndex:r}})=>{const{data:l,value:s,label:d,isDisabled:u,isSelected:c}=n[e],p=function(e,t,n){let o="rfs-option";return e&&(o+=" rfs-option-disabled"),t&&(o+=" rfs-option-selected"),n&&(o+=" rfs-option-focused"),o}(u,c,e===r);return a.default.createElement("div",{style:t,onClick:u?void 0:()=>o({data:l,value:s,label:d},c),className:p},i(l))}),n.areEqual);q.displayName="Option";const P=r.default.div.withConfig({displayName:"NoOptionsMsg",componentId:"v1y124-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(({theme:e})=>e.noOptions.color),(({theme:e})=>e.noOptions.margin),(({theme:e})=>e.noOptions.padding),(({theme:e})=>e.noOptions.fontSize),(({theme:e})=>e.noOptions.css)),W=({width:t,height:o,itemSize:i,direction:r,isLoading:l,loadingMsg:s,menuOptions:d,selectOption:u,noOptionsMsg:c,overscanCount:p,itemKeySelector:f,fixedSizeListRef:m,renderOptionLabel:g,focusedOptionIndex:h})=>{const b=e.useMemo((()=>({menuOptions:d,selectOption:u,renderOptionLabel:g,focusedOptionIndex:h})),[d,h,u,g]);if(l)return a.default.createElement(P,null,s);return a.default.createElement(e.Fragment,null,a.default.createElement(n.FixedSizeList,{width:t,height:o,itemKey:f?(e,t)=>t.menuOptions[e][f]:void 0,itemSize:i,itemData:b,direction:r,ref:m,overscanCount:p,itemCount:d.length},q),!E(d)&&c&&a.default.createElement(P,null,c))},j=r.default.div.withConfig({displayName:"MenuWrapper",componentId:"yf5myu-0"})(["z-index:999;cursor:default;position:absolute;"," "," .","{display:block;overflow:hidden;user-select:none;white-space:nowrap;text-overflow:ellipsis;-webkit-tap-highlight-color:transparent;","}"],(({menuTop:e,menuOpen:n,hideNoOptionsMsg:o,theme:{menu:i}})=>t.css(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],i.width,i.margin,i.padding,i.animation,i.borderRadius,i.backgroundColor,o?"none":i.boxShadow,n?"":"display: none;",e?`top: ${e};`:"")),(({theme:e})=>e.menu.css),"rfs-option",(({theme:{menu:{option:e}}})=>t.css(["padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}"],e.padding,e.textAlign,"rfs-option-focused","rfs-option-disabled","rfs-option-selected",e.focusedBgColor,"rfs-option-selected",e.selectedColor,e.selectedBgColor,"rfs-option-disabled"))),K=({menuRef:e,menuTop:t,menuOpen:n,onMenuMouseDown:i,menuPortalTarget:r,...l})=>{const{menuOptions:s,noOptionsMsg:d}=l,u=n&&!Boolean(d)&&!E(s),c=a.default.createElement(j,{ref:e,menuTop:t,menuOpen:n,onMouseDown:i,className:"rfs-menu-container",hideNoOptionsMsg:u},a.default.createElement(W,Object.assign({},l)));return r?o.createPortal(c,r):c},H=t.css(["z-index:5000;transform:scale(1.26);color:",";"],(({theme:e})=>e.multiValue.clear.focusColor)),U=r.default.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-211cx7-0"})(["min-width:0;display:flex;"," ",""],(({theme:{multiValue:e}})=>t.css(["margin:",";animation:",";border-radius:",";background-color:",";"],e.margin,e.animation,e.borderRadius,e.backgroundColor)),(({theme:e})=>e.multiValue.css)),Y=r.default.div.withConfig({displayName:"Label",componentId:"sc-211cx7-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(({theme:e})=>e.multiValue.label.padding),(({theme:e})=>e.multiValue.label.fontSize),(({theme:e})=>e.multiValue.label.borderRadius)),_=r.default.i.withConfig({displayName:"Clear",componentId:"sc-211cx7-2"})(["display:flex;font-style:inherit;"," ",""],(({theme:{multiValue:{clear:e}}})=>t.css(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";:hover{","}"],e.color,e.padding,e.fontSize,e.alignSelf,e.transition,e.fontWeight,H)),(({isFocused:e})=>e&&H)),X=e.memo((({data:e,value:t,isFocused:n,renderOptionLabel:o,removeSelectedOption:i})=>a.default.createElement(U,null,a.default.createElement(Y,null,o(e)),a.default.createElement(_,{isFocused:n,onMouseDown:k,onClick:()=>i(t),onTouchEnd:()=>i(t)},"✖"))));X.displayName="MultiValue";const G=t.css(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),J=r.default.div.withConfig({displayName:"SingleValue",componentId:"sc-153h0ct-0"})([""," max-width:calc(100% - 0.5rem);"],G),Q=r.default.div.withConfig({displayName:"Placeholder",componentId:"sc-153h0ct-1"})([""," color:",";",""],G,(({theme:e})=>e.color.placeholder),(({theme:e,isMulti:n})=>n&&t.css(["animation:",";"],e.multiValue.animation))),Z=({isMulti:t,inputValue:n,placeholder:o,selectedOption:i,focusedMultiValue:r,renderOptionLabel:l,renderMultiOptions:s,removeSelectedOption:d})=>!n||t&&(!t||E(i)&&!s)?E(i)?t?a.default.createElement(e.Fragment,null,s?s({renderOptionLabel:l,selected:i}):i.map((({data:e,value:t})=>a.default.createElement(X,{key:t,data:e,value:t,renderOptionLabel:l,isFocused:t===r,removeSelectedOption:d})))):a.default.createElement(J,null,l(i[0].data)):a.default.createElement(Q,{isMulti:t},o):null,ee=(t,n,o,i,a,r,l,s,d,u,c,f,m)=>{const[g,h]=e.useState(C),b=m?"":n,v=I(f)?f:!!c;return e.useEffect((()=>{const e=z(b,d,u),n=i.length?new Set(i.map((e=>e.value))):void 0,c=l||(e=>!!e.isDisabled),f=s||(e=>"string"==typeof e.label?e.label:`${e.label}`),m=t=>{const i=a(t),l={data:t,value:i,label:r(t),...c(t)&&{isDisabled:!0},...(null==n?void 0:n.has(i))&&{isSelected:!0}};if(!(e&&!(t=>{const n=z(f(t),d,u);return o===p?n.indexOf(e)>-1:n.substr(0,e.length)===e})(l)||v&&l.isSelected))return l},{length:g}=t,w=[];for(let e=0;e<g;e++){const n=m(t[e]);n&&w.push(n)}h(w)}),[t,i,b,v,o,d,u,s,l,a,r]),g},te=(t,n)=>{const o=e.useRef(!0);e.useEffect((()=>{if(!o.current)return t();o.current=!1}),n)},ne=(t,n,o,i,a,r,l,s,c,p,f,m)=>{const g=e.useRef(!1),h=e.useRef(!s),[b,v]=e.useState(r),[w,y]=e.useState(!1);e.useEffect((()=>{h.current=!w&&!s}),[w,s]),e.useEffect((()=>{const e=i===d||i===u&&!(e=>{if(!e)return!0;const t=A(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-D(t)-n>=o})(t.current);y(e)}),[t,i]),te((()=>{if(o){const e=e=>{null==f||f(),e&&(g.current=!0,v(e))};h.current?((e,t,n,o)=>{if(!e)return void o();const{top:i,height:a,bottom:r}=e.getBoundingClientRect(),l=window.innerHeight;if(l-i>=a)return void o();const s=A(e),d=D(s),u=s.getBoundingClientRect().height-d-i,c=u<a;if(c||!n)return void o(c?u:void 0);F(s,r-l+d+parseInt(getComputedStyle(e).marginBottom,10),t,o)})(t.current,c,p,e):e()}else null==m||m(),g.current&&(g.current=!1,v(r))}),[t,o,m,f,r,p,c]);const x=Math.min(b,l*a);return[w?((e,t,n)=>{const o=e>0||!t?e:t.getBoundingClientRect().height,i=n?n.getBoundingClientRect().height:0,a=t&&getComputedStyle(t),r=a?parseInt(a.marginBottom,10):0,l=a?parseInt(a.marginTop,10):0;return"calc("+-Math.abs(o+i)+"px + "+(r+l)+"px)"})(x,t.current,n.current):void 0,x]},oe=r.default.div.withConfig({displayName:"SizerDiv",componentId:"o2ype2-0"})(["top:0;left:0;height:0;overflow:scroll;white-space:pre;position:absolute;visibility:hidden;font-size:inherit;font-weight:inherit;font-family:inherit;",""],(({theme:e})=>e.input.css)),ie=r.default.input.attrs(s).withConfig({displayName:"Input",componentId:"o2ype2-1"})(["border:0;outline:0;padding:0;cursor:text;background:0;color:inherit;font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:content-box;:read-only{opacity:0;cursor:default;}:required{","}"," ",""],(({theme:e,isInvalid:t})=>t&&e.input.cssRequired),(({theme:e})=>e.input.css),$&&"::-ms-clear{display:none;}"),ae=e.memo(e.forwardRef((({id:t,onBlur:n,onFocus:o,readOnly:i,required:r,onChange:l,ariaLabel:s,inputValue:d,ariaLabelledBy:u,selectedOption:c},p)=>{const f=e.useRef(null),[m,g]=e.useState(2),h=!!r&&!E(c);return te((()=>{f.current&&g(f.current.scrollWidth+2)}),[d]),a.default.createElement(e.Fragment,null,a.default.createElement(ie,{id:t,ref:p,isInvalid:!0,onBlur:n,onFocus:o,value:d,readOnly:i,required:h,"aria-label":s,style:{width:m},"aria-labelledby":u,onChange:i?void 0:l}),a.default.createElement(oe,{ref:f},d))})));ae.displayName="AutosizeInput";const re=r.default.span.withConfig({displayName:"A11yText",componentId:"zxgkbx-0"})(["border:0;padding:0;width:1px;height:1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(1px,1px,1px,1px);"]),le=({menuOpen:e,isFocused:t,inputValue:n,optionCount:o,isSearchable:i,focusedOption:r,selectedOption:l,ariaLive:s="polite",ariaLabel:d="Select"})=>{if(!t)return null;const u=` ${o} result(s) available${n?" for search input "+n:""}.`,c=e?"Use Up and Down arrow keys to choose options, press Enter or Tab to select the currently focused option, press Escape to close the menu.":`${d} is focused${i?", type to filter options":""}, press Down arrow key to open the menu.`,{index:p,value:f,label:m,isDisabled:g}=r,h=f?`Focused option: ${m}${g?" - disabled":""}, ${p+1} of ${o}.`:"",b=l.length?l.map((e=>e.label)).join(" "):"N/A";return a.default.createElement(re,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},a.default.createElement("span",{id:"aria-selection"},"Selected option: "+b),a.default.createElement("span",{id:"aria-context"},h+u+c))},se=r.default.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1j9e0pa-0"})(["display:flex;align-self:center;text-align:center;margin-right:0.25rem;padding:",";> div{border-radius:100%;display:inline-block;",":nth-of-type(1){animation-delay:-0.272s;}:nth-of-type(2){animation-delay:-0.136s;}}"],(({theme:e})=>e.loader.padding),(({theme:{loader:e}})=>t.css(["width:",";height:",";animation:",";background-color:",";"],e.size,e.size,e.animation,e.color))),de=()=>a.default.createElement(se,{"aria-hidden":!0,className:"rfs-loading-dots"},a.default.createElement("div",null),a.default.createElement("div",null),a.default.createElement("div",null)),ue=r.default.svg.withConfig({displayName:"ClearSvg",componentId:"sc-1v5ipi2-0"})(["fill:currentColor;",""],(({theme:e})=>t.css(["width:",";height:",";animation:",";transition:",";"],e.icon.clear.width,e.icon.clear.height,e.icon.clear.animation,e.icon.clear.transition))),ce=()=>a.default.createElement(ue,{"aria-hidden":!0,viewBox:"0 0 14 16",className:"rfs-clear-icon"},a.default.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})),pe=r.default.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1561oeb-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),fe=r.default.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1561oeb-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(({theme:e})=>e.icon.color),(({theme:e})=>e.icon.padding),(({theme:e})=>e.icon.hoverColor),(({theme:e})=>e.icon.css)),me=r.default.div.withConfig({displayName:"Caret",componentId:"sc-1561oeb-2"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(({theme:e})=>e.icon.caret.transition),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e,menuOpen:n,isInvalid:o})=>n&&t.css(["transform:rotate(180deg);color:",";"],o?e.color.danger:e.color.caretActive||e.color.primary))),ge=r.default.div.withConfig({displayName:"Separator",componentId:"sc-1561oeb-3"})(["width:1px;margin:0.5rem 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(({theme:e})=>e.color.iconSeparator||e.color.border)),he=e.memo((({menuOpen:e,clearIcon:t,caretIcon:n,isInvalid:o,showClear:i,isLoading:r,isDisabled:l,loadingNode:s,onCaretMouseDown:d,onClearMouseDown:u})=>{const c=t=>"function"==typeof t?t({menuOpen:e,isLoading:r,isInvalid:o,isDisabled:l}):t;return a.default.createElement(pe,null,i&&!r&&a.default.createElement(fe,{onTouchEnd:u,onMouseDown:u},c(t)||a.default.createElement(ce,null)),r&&(s||a.default.createElement(de,null)),a.default.createElement(ge,null),a.default.createElement(fe,{onTouchEnd:d,onMouseDown:d},c(n)||a.default.createElement(me,{"aria-hidden":!0,menuOpen:e,isInvalid:o,className:"rfs-caret-icon"})))}));he.displayName="IndicatorIcons";const be=r.default.div.attrs(l).withConfig({displayName:"SelectWrapper",componentId:"kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(({theme:e})=>e.select.css)),ve=r.default.div.withConfig({displayName:"ValueWrapper",componentId:"kcrmu9-1"})(["flex:1 1 0%;display:flex;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;padding:",";"],(({theme:e})=>e.control.padding)),we=r.default.div.withConfig({displayName:"ControlWrapper",componentId:"kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(({isDisabled:e,isFocused:n,isInvalid:o,theme:{control:i,color:a}})=>t.css(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],i.transition,i.borderStyle,i.borderWidth,i.borderRadius,i.height||i.minHeight,o?a.danger:n?i.focusedBorderColor:a.border,i.height?`height: ${i.height};`:"",e?"pointer-events:none;user-select:none;":"",i.backgroundColor||e?`background-color: ${e?a.disabled:i.backgroundColor};`:"",n?`box-shadow: ${i.boxShadow} ${o?a.dangerLight:i.boxShadowColor};`:"")),(({theme:e})=>e.control.css),(({isFocused:e,theme:t})=>e&&t.control.focusedCss)),ye=e.forwardRef((({async:n,isMulti:o,inputId:i,selectId:r,required:l,ariaLive:s,autoFocus:d,isLoading:u,onKeyDown:w,clearIcon:y,caretIcon:S,isInvalid:z,ariaLabel:D,menuWidth:R,isDisabled:T,inputDelay:V,onMenuOpen:A,onMenuClose:F,onInputBlur:$,isClearable:q,themeConfig:P,loadingNode:W,initialValue:j,onInputFocus:H,onInputChange:U,ariaLabelledBy:Y,onOptionChange:_,onSearchChange:X,getOptionLabel:G,getOptionValue:J,itemKeySelector:Q,openMenuOnFocus:oe,menuPortalTarget:ie,isAriaLiveEnabled:re,menuOverscanCount:se,blurInputOnSelect:de,menuItemDirection:ue,renderOptionLabel:ce,renderMultiOptions:pe,menuScrollDuration:fe,filterIgnoreAccents:me,hideSelectedOptions:ge,getIsOptionDisabled:ye,getFilterOptionString:xe,isSearchable:Ce=!0,lazyLoadMenu:Oe=!1,openMenuOnClick:Se=!0,filterIgnoreCase:Ie=!0,tabSelectsOption:Ee=!0,closeMenuOnSelect:Me=!0,scrollMenuIntoView:ke=!0,backspaceClearsValue:ze=!0,filterMatchFrom:Le=p,menuPosition:Ne=c,options:De=C,loadingMsg:Re="Loading..",placeholder:Te="Select option..",noOptionsMsg:Ve="No options",menuItemSize:Ae=35,menuMaxHeight:Fe=300},Be)=>{const $e=e.useRef(!1),qe=e.useRef(),Pe=e.useRef(!1),We=e.useRef(null),je=e.useRef(null),Ke=e.useRef(null),He=e.useRef(null),[Ue,Ye]=e.useState(""),[_e,Xe]=e.useState(!1),[Ge,Je]=e.useState(!1),[Qe,Ze]=e.useState(null),[et,tt]=e.useState(x),nt=e.useMemo((()=>M(P)?N(O,P):O),[P]),ot=e.useMemo((()=>G||(e=>e.label)),[G]),it=e.useMemo((()=>J||(e=>e.value)),[J]),at=e.useMemo((()=>ce||ot),[ce,ot]),rt=((t,n=0)=>{const[o,i]=e.useState(t);return e.useEffect((()=>{if(n<=0)return;const e=setTimeout((()=>{i(t)}),n);return()=>{clearTimeout(e)}}),[t,n]),n<=0?t:o})(Ue,V),[lt,st]=e.useState((()=>L(j,it,ot))),dt=ee(De,rt,Le,lt,it,ot,ye,xe,Ie,me,o,ge,n),[ut,ct]=ne(je,He,_e,Ne,Ae,Fe,dt.length,!!ie,fe,ke,A,F),pt=()=>{var e;return null===(e=Ke.current)||void 0===e?void 0:e.blur()},ft=()=>{var e;return null===(e=Ke.current)||void 0===e?void 0:e.focus()},mt=e=>{var t;return null===(t=We.current)||void 0===t?void 0:t.scrollToItem(e)},gt=e.useCallback((e=>{if(!E(dt))return void(!$e.current&&Xe(!0));const t=o?-1:dt.findIndex((e=>e.isSelected)),n=t>-1?t:e===v?0:dt.length-1;!$e.current&&Xe(!0),tt({index:n,...dt[n]}),mt(n)}),[o,dt]),ht=e.useCallback((e=>{st((t=>t.filter((({value:t})=>t!==e))))}),[]),bt=e.useCallback(((e,t)=>{t?o&&ht(e.value):st((t=>o?[...t,e]:[e]));(I(de)?de:B)?pt():Me&&(Xe(!1),Ye(""))}),[o,Me,ht,de]);e.useImperativeHandle(Be,(()=>({empty:!E(lt),menuOpen:_e,blur:pt,focus:ft,clearValue:()=>{bt.length&&st(C),et.data&&tt(x)},setValue:e=>{const t=L(e,it,ot);st(t)},toggleMenu:e=>{!0===e||void 0===e&&!_e?(!Ge&&ft(),gt(v)):pt()}}))),e.useEffect((()=>{d&&ft()}),[]),e.useEffect((()=>{$e.current=_e}),[_e]),e.useEffect((()=>{Ge&&oe&>(v)}),[Ge,oe,gt]),e.useEffect((()=>{X&&Pe.current&&(Pe.current=!1,X(rt))}),[X,rt]),te((()=>{if(!_)return;const e=o?lt.map((e=>e.data)):E(lt)?lt[0].data:null;_(e)}),[o,lt,_]),te((()=>{const e=dt.length>0&&(n||dt.length!==De.length||0===qe.current);0===dt.length?tt(x):(1===dt.length||e)&&(tt({index:0,...dt[0]}),mt(0)),qe.current=dt.length}),[n,De,dt]);const vt=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:i}=et;e&&!i&&bt({data:e,value:t,label:n},o)},wt=e=>{const t="ArrowDown"===e,n=t?v:b;_e?(e=>{if(!E(dt))return;const t=e===h?(et.index+1)%dt.length:et.index>0?et.index-1:dt.length-1;Qe&&Ze(null),tt({index:t,...dt[t]}),mt(t)})(t?h:g):gt(n)},yt=e=>{if(T)return;Ge||ft();const t="INPUT"!==e.currentTarget.tagName;_e?t&&(_e&&Xe(!1),Ue&&Ye("")):Se&>(v),t&&e.preventDefault()},xt=e.useCallback((e=>{null==$||$(e),Je(!1),Xe(!1),Ye("")}),[$]),Ct=e.useCallback((e=>{null==H||H(e),Je(!0)}),[H]),Ot=e.useCallback((e=>{const t=e.currentTarget.value||"";Pe.current=!0,null==U||U(t),!$e.current&&Xe(!0),Ye(t)}),[U]),St=e.useCallback((e=>{k(e),st(C),ft()}),[]),It=e.useCallback((e=>{k(e,"mousedown"===e.type),ft(),$e.current?Xe(!1):gt(v)}),[gt]),Et=!Oe||Oe&&_e,Mt=T||!Ce||!!Qe,kt=!(!q||T||!E(lt)),zt=T||Se?void 0:It;return a.default.createElement(t.ThemeProvider,{theme:nt},a.default.createElement(be,{id:r,"aria-controls":i,"aria-expanded":_e,onKeyDown:e=>{if(T)return;if(w&&(w(e,Ue,et),e.defaultPrevented))return;const{key:t}=e;switch(t){case"ArrowDown":case"ArrowUp":wt(t);break;case"ArrowLeft":case"ArrowRight":if(!o||Ue||pe)return;(e=>{if(!E(lt))return;let t=-1;const n=lt.length-1,o=Qe?lt.findIndex((e=>e.value===Qe)):-1;t=e===f?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const i=t>=0?lt[t].value:null;et.data&&tt(x),i!==Qe&&Ze(i)})("ArrowLeft"===t?m:f);break;case" ":if(Ue)return;if(_e){if(!et.data)return;vt()}else gt(v);break;case"Enter":_e&&229!==e.keyCode&&vt();break;case"Escape":_e&&(Xe(!1),Ye(""));break;case"Tab":if(!_e||!Ee||!et.data||e.shiftKey)return;vt();break;case"Delete":case"Backspace":if(Ue)return;if(Qe){const e=lt.findIndex((e=>e.value===Qe)),t=e>-1&&e<lt.length-1?lt[e+1].value:null;ht(Qe),Ze(t)}else{if(!ze)return;if(!E(lt))break;if(o&&!pe){const{value:e}=lt[lt.length-1];ht(e)}else q&&st(C)}break;default:return}e.preventDefault()}},a.default.createElement(we,{ref:He,isInvalid:z,isFocused:Ge,isDisabled:T,className:"rfs-control-container",onTouchEnd:yt,onMouseDown:yt},a.default.createElement(ve,null,a.default.createElement(Z,{isMulti:o,inputValue:Ue,placeholder:Te,selectedOption:lt,focusedMultiValue:Qe,renderOptionLabel:at,renderMultiOptions:pe,removeSelectedOption:ht}),a.default.createElement(ae,{id:i,ref:Ke,required:l,ariaLabel:D,inputValue:Ue,readOnly:Mt,onBlur:xt,onFocus:Ct,onChange:Ot,ariaLabelledBy:Y,selectedOption:lt})),a.default.createElement(he,{menuOpen:_e,clearIcon:y,caretIcon:S,isInvalid:z,isLoading:u,showClear:kt,isDisabled:T,loadingNode:W,onClearMouseDown:St,onCaretMouseDown:zt})),Et&&a.default.createElement(K,{menuRef:je,menuOpen:_e,isLoading:u,menuTop:ut,height:ct,itemSize:Ae,loadingMsg:Re,menuOptions:dt,fixedSizeListRef:We,noOptionsMsg:Ve,selectOption:bt,direction:ue,itemKeySelector:Q,overscanCount:se,menuPortalTarget:ie,width:R||nt.menu.width,onMenuMouseDown:e=>{k(e),ft()},renderOptionLabel:at,focusedOptionIndex:et.index}),re&&a.default.createElement(le,{ariaLive:s,menuOpen:_e,isFocused:Ge,ariaLabel:D,inputValue:Ue,isSearchable:Ce,focusedOption:et,selectedOption:lt,optionCount:dt.length})))}));ye.displayName="Select",exports.Select=ye; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components"),n=require("react-window"),o=require("react-dom");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=i(e),r=i(t);const l={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container"},s={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input"},d="top",u="auto",c="bottom",p="any",f=0,m=1,g=0,h=1,b=2,v=3,w=t.keyframes(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),y=t.css([""," 0.2s ease-out both"],t.keyframes(["from{opacity:0;}to{opacity:1;}"])),x=t.css([""," 1.19s ease-in-out infinite"],w),C={index:-1},O=[],S=/[\u0300-\u036f]/g;function E(e){return"boolean"==typeof e}function I(e){return Array.isArray(e)&&!!e.length}function M(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}const k=(e,t=!0)=>{t&&e.preventDefault(),e.stopPropagation()};function z(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(S,"")}(o):o}const L=(e,t,n)=>{const o=Array.isArray(e)?e:M(e)?[e]:O;return I(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},N=(e,t)=>{const n={...e};return Object.keys(t).forEach((o=>{const i=t[o];n[o]="animation"!==o&&M(i)?e[o]?N(e[o],i):i:i||""})),n};function D(e){return R(e)?window.pageYOffset:e.scrollTop}function R(e){return e===document.documentElement||e===document.body||e===window}const T=/(auto|scroll)/;function V({overflow:e,overflowX:t,overflowY:n}){return T.test(`${e}${t}${n}`)}function A(e){let t=getComputedStyle(e);const n=document.documentElement,o="absolute"===t.position;if("fixed"===t.position)return n;for(let n=e;n=null===(i=n)||void 0===i?void 0:i.parentElement;){var i;if(t=getComputedStyle(n),(!o||"static"!==t.position)&&V(t))return n}return n}function F(e,t,n=300,o){let i=0;const a=D(e),r=t-a;requestAnimationFrame((function t(){i+=5;const l=r*((s=(s=i)/n-1)*s*s+1)+a;var s;!function(e,t){R(e)?window.scrollTo(0,t):e.scrollTop=t}(e,l),i<n?requestAnimationFrame(t):null==o||o()}))}const B="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,$="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent),q={color:{border:"#ced4da",danger:"#dc3545",primary:"#007bff",disabled:"#e9ecef",placeholder:"#6E7276",dangerLight:"rgba(220, 53, 69, 0.25)"},input:{},select:{},loader:{size:"0.625rem",padding:"0.375rem 0.75rem",animation:x,color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 0.9375rem",clear:{width:"14px",height:"16px",animation:y,transition:"color 0.2s ease-out"},caret:{size:"7px",transition:"transform 0.3s ease-in-out, color 0.2s ease-out"}},control:{minHeight:"38px",borderWidth:"1px",borderStyle:"solid",borderRadius:"3px",boxShadow:"0 0 0 0.2rem",padding:"0.375rem 0.75rem",boxShadowColor:"rgba(0, 123, 255, 0.25)",focusedBorderColor:"rgba(0, 123, 255, 0.75)",transition:"box-shadow 0.2s ease-out, border-color 0.2s ease-out"},menu:{padding:"0",width:"100%",margin:"0.5rem 0",borderRadius:"3px",backgroundColor:"#fff",animation:y,boxShadow:"0 0.5em 1em -0.125em rgb(10 10 10 / 12%), 0 0 0 1px rgb(10 10 10 / 4%)",option:{textAlign:"left",selectedColor:"#fff",selectedBgColor:"#007bff",padding:"0.375rem 0.75rem",focusedBgColor:"rgba(0, 123, 255, 0.15)"}},noOptions:{fontSize:"1.25rem",margin:"0.25rem 0",color:"hsl(0, 0%, 60%)",padding:"0.375rem 0.75rem"},multiValue:{margin:"1px 2px",borderRadius:"3px",backgroundColor:"#e7edf3",animation:y,label:{borderRadius:"3px",fontSize:"0.825em",padding:"1px 0 1px 6px"},clear:{fontWeight:600,padding:"0 6px",color:"#a6a6a6",fontSize:"0.65em",alignSelf:"center",focusColor:"#808080",transition:"color 0.2s ease-out, transform 0.2s ease-out, z-index 0.2s ease-out"}}},P=e.memo((({index:e,style:t,data:{menuOptions:n,selectOption:o,renderOptionLabel:i,focusedOptionIndex:r}})=>{const{data:l,value:s,label:d,isDisabled:u,isSelected:c}=n[e],p=function(e,t,n){let o="rfs-option";return e&&(o+=" rfs-option-disabled"),t&&(o+=" rfs-option-selected"),n&&(o+=" rfs-option-focused"),o}(u,c,e===r);return a.default.createElement("div",{style:t,onClick:u?void 0:()=>o({data:l,value:s,label:d},c),className:p},i(l))}),n.areEqual);P.displayName="Option";const W=r.default.div.withConfig({displayName:"NoOptionsMsg",componentId:"v1y124-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(({theme:e})=>e.noOptions.color),(({theme:e})=>e.noOptions.margin),(({theme:e})=>e.noOptions.padding),(({theme:e})=>e.noOptions.fontSize),(({theme:e})=>e.noOptions.css)),j=({width:t,height:o,itemSize:i,direction:r,isLoading:l,loadingMsg:s,menuOptions:d,selectOption:u,noOptionsMsg:c,overscanCount:p,itemKeySelector:f,fixedSizeListRef:m,renderOptionLabel:g,focusedOptionIndex:h})=>{const b=e.useMemo((()=>({menuOptions:d,selectOption:u,renderOptionLabel:g,focusedOptionIndex:h})),[d,h,u,g]);if(l)return a.default.createElement(W,null,s);return a.default.createElement(e.Fragment,null,a.default.createElement(n.FixedSizeList,{width:t,height:o,itemKey:f?(e,t)=>t.menuOptions[e][f]:void 0,itemSize:i,itemData:b,direction:r,ref:m,overscanCount:p,itemCount:d.length},P),!I(d)&&c&&a.default.createElement(W,null,c))},K=r.default.div.withConfig({displayName:"MenuWrapper",componentId:"yf5myu-0"})(["z-index:999;cursor:default;position:absolute;"," "," .","{display:block;overflow:hidden;user-select:none;white-space:nowrap;text-overflow:ellipsis;-webkit-tap-highlight-color:transparent;","}"],(({menuTop:e,menuOpen:n,hideNoOptionsMsg:o,theme:{menu:i}})=>t.css(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],i.width,i.margin,i.padding,i.animation,i.borderRadius,i.backgroundColor,o?"none":i.boxShadow,n?"":"display: none;",e?`top: ${e};`:"")),(({theme:e})=>e.menu.css),"rfs-option",(({theme:{menu:{option:e}}})=>t.css(["padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}"],e.padding,e.textAlign,"rfs-option-focused","rfs-option-disabled","rfs-option-selected",e.focusedBgColor,"rfs-option-selected",e.selectedColor,e.selectedBgColor,"rfs-option-disabled"))),H=({menuRef:e,menuTop:t,menuOpen:n,onMenuMouseDown:i,menuPortalTarget:r,...l})=>{const{menuOptions:s,noOptionsMsg:d}=l,u=n&&!Boolean(d)&&!I(s),c=a.default.createElement(K,{ref:e,menuTop:t,menuOpen:n,onMouseDown:i,className:"rfs-menu-container",hideNoOptionsMsg:u},a.default.createElement(j,Object.assign({},l)));return r?o.createPortal(c,r):c},U=t.css(["z-index:5000;transform:scale(1.26);color:",";"],(({theme:e})=>e.multiValue.clear.focusColor)),Y=r.default.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-211cx7-0"})(["min-width:0;display:flex;"," ",""],(({theme:{multiValue:e}})=>t.css(["margin:",";animation:",";border-radius:",";background-color:",";"],e.margin,e.animation,e.borderRadius,e.backgroundColor)),(({theme:e})=>e.multiValue.css)),_=r.default.div.withConfig({displayName:"Label",componentId:"sc-211cx7-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(({theme:e})=>e.multiValue.label.padding),(({theme:e})=>e.multiValue.label.fontSize),(({theme:e})=>e.multiValue.label.borderRadius)),X=r.default.i.withConfig({displayName:"Clear",componentId:"sc-211cx7-2"})(["display:flex;font-style:inherit;"," ",""],(({theme:{multiValue:{clear:e}}})=>t.css(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";:hover{","}"],e.color,e.padding,e.fontSize,e.alignSelf,e.transition,e.fontWeight,U)),(({isFocused:e})=>e&&U)),G=e.memo((({data:e,value:t,isFocused:n,renderOptionLabel:o,removeSelectedOption:i})=>a.default.createElement(Y,null,a.default.createElement(_,null,o(e)),a.default.createElement(X,{isFocused:n,onMouseDown:k,onClick:()=>i(t),onTouchEnd:()=>i(t)},"✖"))));G.displayName="MultiValue";const J=t.css(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),Q=r.default.div.withConfig({displayName:"SingleValue",componentId:"sc-153h0ct-0"})([""," max-width:calc(100% - 0.5rem);"],J),Z=r.default.div.withConfig({displayName:"Placeholder",componentId:"sc-153h0ct-1"})([""," color:",";",""],J,(({theme:e})=>e.color.placeholder),(({theme:e,isMulti:n})=>n&&t.css(["animation:",";"],e.multiValue.animation))),ee=({isMulti:t,inputValue:n,placeholder:o,selectedOption:i,focusedMultiValue:r,renderOptionLabel:l,renderMultiOptions:s,removeSelectedOption:d})=>!n||t&&(!t||I(i)&&!s)?I(i)?t?a.default.createElement(e.Fragment,null,s?s({renderOptionLabel:l,selected:i}):i.map((({data:e,value:t})=>a.default.createElement(G,{key:t,data:e,value:t,renderOptionLabel:l,isFocused:t===r,removeSelectedOption:d})))):a.default.createElement(Q,null,l(i[0].data)):a.default.createElement(Z,{isMulti:t},o):null,te=(t,n,o,i,a,r,l,s,d,u,c,f,m)=>{const[g,h]=e.useState(O),b=m?"":n,v=E(f)?f:!!c;return e.useEffect((()=>{const e=z(b,d,u),n=i.length?new Set(i.map((e=>e.value))):void 0,c=l||(e=>!!e.isDisabled),f=s||(e=>"string"==typeof e.label?e.label:`${e.label}`),m=t=>{const i=a(t),l={data:t,value:i,label:r(t),...c(t)&&{isDisabled:!0},...(null==n?void 0:n.has(i))&&{isSelected:!0}};if(!(e&&!(t=>{const n=z(f(t),d,u);return o===p?n.indexOf(e)>-1:n.substr(0,e.length)===e})(l)||v&&l.isSelected))return l},{length:g}=t,w=[];for(let e=0;e<g;e++){const n=m(t[e]);n&&w.push(n)}h(w)}),[t,i,b,v,o,d,u,s,l,a,r]),g},ne=(t,n)=>{const o=e.useRef(!0);e.useEffect((()=>{if(!o.current)return t();o.current=!1}),n)},oe=(t,n,o,i,a,r,l,s,c,p,f,m)=>{const g=e.useRef(),h=e.useRef(),b=e.useRef(!1),v=e.useRef(!s),[w,y]=e.useState(r),[x,C]=e.useState(!1);e.useEffect((()=>{g.current=f,h.current=m}),[f,m]),e.useEffect((()=>{v.current=!x&&!s}),[x,s]),e.useEffect((()=>{const e=i===d||i===u&&!(e=>{if(!e)return!0;const t=A(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-D(t)-n>=o})(t.current);C(e)}),[t,i]),ne((()=>{if(o){const e=e=>{var t;null===(t=g.current)||void 0===t||t.call(g),e&&(b.current=!0,y(e))};v.current?((e,t,n,o)=>{if(!e)return void o();const{top:i,height:a,bottom:r}=e.getBoundingClientRect(),l=window.innerHeight;if(l-i>=a)return void o();const s=A(e),d=D(s),u=s.getBoundingClientRect().height-d-i,c=u<a;if(c||!n)return void o(c?u:void 0);F(s,r-l+d+parseInt(getComputedStyle(e).marginBottom,10),t,o)})(t.current,c,p,e):e()}else{var e;null===(e=h.current)||void 0===e||e.call(h),b.current&&(b.current=!1,y(r))}}),[t,o,r,p,c]);const O=Math.min(w,l*a);return[x?((e,t,n)=>{const o=e>0||!t?e:t.getBoundingClientRect().height,i=n?n.getBoundingClientRect().height:0,a=t&&getComputedStyle(t),r=a?parseInt(a.marginBottom,10):0,l=a?parseInt(a.marginTop,10):0;return"calc("+-Math.abs(o+i)+"px + "+(r+l)+"px)"})(O,t.current,n.current):void 0,O]},ie=r.default.div.withConfig({displayName:"SizerDiv",componentId:"o2ype2-0"})(["top:0;left:0;height:0;overflow:scroll;white-space:pre;position:absolute;visibility:hidden;font-size:inherit;font-weight:inherit;font-family:inherit;",""],(({theme:e})=>e.input.css)),ae=r.default.input.attrs(s).withConfig({displayName:"Input",componentId:"o2ype2-1"})(["border:0;outline:0;padding:0;cursor:text;background:0;color:inherit;font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:content-box;:read-only{opacity:0;cursor:default;}:required{","}"," ",""],(({theme:e,isInvalid:t})=>t&&e.input.cssRequired),(({theme:e})=>e.input.css),$&&"::-ms-clear{display:none;}"),re=e.memo(e.forwardRef((({id:t,onBlur:n,onFocus:o,readOnly:i,required:r,onChange:l,ariaLabel:s,inputValue:d,ariaLabelledBy:u,selectedOption:c},p)=>{const f=e.useRef(null),[m,g]=e.useState(2),h=!!r&&!I(c);return ne((()=>{f.current&&g(f.current.scrollWidth+2)}),[d]),a.default.createElement(e.Fragment,null,a.default.createElement(ae,{id:t,ref:p,isInvalid:!0,onBlur:n,onFocus:o,value:d,readOnly:i,required:h,"aria-label":s,style:{width:m},"aria-labelledby":u,onChange:i?void 0:l}),a.default.createElement(ie,{ref:f},d))})));re.displayName="AutosizeInput";const le=r.default.span.withConfig({displayName:"A11yText",componentId:"zxgkbx-0"})(["border:0;padding:0;width:1px;height:1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(1px,1px,1px,1px);"]),se=({menuOpen:e,isFocused:t,inputValue:n,optionCount:o,isSearchable:i,focusedOption:r,selectedOption:l,ariaLive:s="polite",ariaLabel:d="Select"})=>{if(!t)return null;const u=` ${o} result(s) available${n?" for search input "+n:""}.`,c=e?"Use Up and Down arrow keys to choose options, press Enter or Tab to select the currently focused option, press Escape to close the menu.":`${d} is focused${i?", type to filter options":""}, press Down arrow key to open the menu.`,{index:p,value:f,label:m,isDisabled:g}=r,h=f?`Focused option: ${m}${g?" - disabled":""}, ${p+1} of ${o}.`:"",b=l.length?l.map((e=>e.label)).join(" "):"N/A";return a.default.createElement(le,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},a.default.createElement("span",{id:"aria-selection"},"Selected option: "+b),a.default.createElement("span",{id:"aria-context"},h+u+c))},de=r.default.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1j9e0pa-0"})(["display:flex;align-self:center;text-align:center;margin-right:0.25rem;padding:",";> div{border-radius:100%;display:inline-block;",":nth-of-type(1){animation-delay:-0.272s;}:nth-of-type(2){animation-delay:-0.136s;}}"],(({theme:e})=>e.loader.padding),(({theme:{loader:e}})=>t.css(["width:",";height:",";animation:",";background-color:",";"],e.size,e.size,e.animation,e.color))),ue=()=>a.default.createElement(de,{"aria-hidden":!0,className:"rfs-loading-dots"},a.default.createElement("div",null),a.default.createElement("div",null),a.default.createElement("div",null)),ce=r.default.svg.withConfig({displayName:"ClearSvg",componentId:"sc-1v5ipi2-0"})(["fill:currentColor;",""],(({theme:e})=>t.css(["width:",";height:",";animation:",";transition:",";"],e.icon.clear.width,e.icon.clear.height,e.icon.clear.animation,e.icon.clear.transition))),pe=()=>a.default.createElement(ce,{"aria-hidden":!0,viewBox:"0 0 14 16",className:"rfs-clear-icon"},a.default.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})),fe=r.default.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1561oeb-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),me=r.default.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1561oeb-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(({theme:e})=>e.icon.color),(({theme:e})=>e.icon.padding),(({theme:e})=>e.icon.hoverColor),(({theme:e})=>e.icon.css)),ge=r.default.div.withConfig({displayName:"Caret",componentId:"sc-1561oeb-2"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(({theme:e})=>e.icon.caret.transition),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e,menuOpen:n,isInvalid:o})=>n&&t.css(["transform:rotate(180deg);color:",";"],o?e.color.danger:e.color.caretActive||e.color.primary))),he=r.default.div.withConfig({displayName:"Separator",componentId:"sc-1561oeb-3"})(["width:1px;margin:0.5rem 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(({theme:e})=>e.color.iconSeparator||e.color.border)),be=e.memo((({menuOpen:e,clearIcon:t,caretIcon:n,isInvalid:o,showClear:i,isLoading:r,isDisabled:l,loadingNode:s,onCaretMouseDown:d,onClearMouseDown:u})=>{const c=t=>"function"==typeof t?t({menuOpen:e,isLoading:r,isInvalid:o,isDisabled:l}):t;return a.default.createElement(fe,null,i&&!r&&a.default.createElement(me,{onTouchEnd:u,onMouseDown:u},c(t)||a.default.createElement(pe,null)),r&&(s||a.default.createElement(ue,null)),a.default.createElement(he,null),a.default.createElement(me,{onTouchEnd:d,onMouseDown:d},c(n)||a.default.createElement(ge,{"aria-hidden":!0,menuOpen:e,isInvalid:o,className:"rfs-caret-icon"})))}));be.displayName="IndicatorIcons";const ve=r.default.div.attrs(l).withConfig({displayName:"SelectWrapper",componentId:"kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(({theme:e})=>e.select.css)),we=r.default.div.withConfig({displayName:"ValueWrapper",componentId:"kcrmu9-1"})(["flex:1 1 0%;display:flex;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;padding:",";"],(({theme:e})=>e.control.padding)),ye=r.default.div.withConfig({displayName:"ControlWrapper",componentId:"kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(({isDisabled:e,isFocused:n,isInvalid:o,theme:{control:i,color:a}})=>t.css(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],i.transition,i.borderStyle,i.borderWidth,i.borderRadius,i.height||i.minHeight,o?a.danger:n?i.focusedBorderColor:a.border,i.height?`height: ${i.height};`:"",e?"pointer-events:none;user-select:none;":"",i.backgroundColor||e?`background-color: ${e?a.disabled:i.backgroundColor};`:"",n?`box-shadow: ${i.boxShadow} ${o?a.dangerLight:i.boxShadowColor};`:"")),(({theme:e})=>e.control.css),(({isFocused:e,theme:t})=>e&&t.control.focusedCss)),xe=e.forwardRef((({async:n,isMulti:o,inputId:i,selectId:r,required:l,ariaLive:s,autoFocus:d,isLoading:u,onKeyDown:w,clearIcon:y,caretIcon:x,isInvalid:S,ariaLabel:z,menuWidth:D,isDisabled:R,inputDelay:T,onMenuOpen:V,onMenuClose:A,onInputBlur:F,isClearable:$,themeConfig:P,loadingNode:W,initialValue:j,onInputFocus:K,onInputChange:U,ariaLabelledBy:Y,onOptionChange:_,onSearchChange:X,getOptionLabel:G,getOptionValue:J,itemKeySelector:Q,openMenuOnFocus:Z,menuPortalTarget:ie,isAriaLiveEnabled:ae,menuOverscanCount:le,blurInputOnSelect:de,menuItemDirection:ue,renderOptionLabel:ce,renderMultiOptions:pe,menuScrollDuration:fe,filterIgnoreAccents:me,hideSelectedOptions:ge,getIsOptionDisabled:he,getFilterOptionString:xe,isSearchable:Ce=!0,lazyLoadMenu:Oe=!1,openMenuOnClick:Se=!0,filterIgnoreCase:Ee=!0,tabSelectsOption:Ie=!0,closeMenuOnSelect:Me=!0,scrollMenuIntoView:ke=!0,backspaceClearsValue:ze=!0,filterMatchFrom:Le=p,menuPosition:Ne=c,options:De=O,loadingMsg:Re="Loading..",placeholder:Te="Select option..",noOptionsMsg:Ve="No options",menuItemSize:Ae=35,menuMaxHeight:Fe=300},Be)=>{const $e=e.useRef(!1),qe=e.useRef(),Pe=e.useRef(!1),We=e.useRef(),je=e.useRef(),Ke=e.useRef(null),He=e.useRef(null),Ue=e.useRef(null),Ye=e.useRef(null),[_e,Xe]=e.useState(""),[Ge,Je]=e.useState(!1),[Qe,Ze]=e.useState(!1),[et,tt]=e.useState(null),[nt,ot]=e.useState(C),it=e.useMemo((()=>M(P)?N(q,P):q),[P]),at=e.useMemo((()=>G||(e=>e.label)),[G]),rt=e.useMemo((()=>J||(e=>e.value)),[J]),lt=e.useMemo((()=>ce||at),[ce,at]),st=((t,n=0)=>{const[o,i]=e.useState(t);return e.useEffect((()=>{if(n<=0)return;const e=setTimeout((()=>{i(t)}),n);return()=>{clearTimeout(e)}}),[t,n]),n<=0?t:o})(_e,T),[dt,ut]=e.useState((()=>L(j,rt,at))),ct=te(De,st,Le,dt,rt,at,he,xe,Ee,me,o,ge,n),[pt,ft]=oe(He,Ye,Ge,Ne,Ae,Fe,ct.length,!!ie,fe,ke,V,A),mt=()=>{var e;return null===(e=Ue.current)||void 0===e?void 0:e.blur()},gt=()=>{var e;return null===(e=Ue.current)||void 0===e?void 0:e.focus()},ht=e=>{var t;return null===(t=Ke.current)||void 0===t?void 0:t.scrollToItem(e)},bt=e.useCallback((e=>{if(!I(ct))return void(!$e.current&&Je(!0));const t=o?-1:ct.findIndex((e=>e.isSelected)),n=t>-1?t:e===v?0:ct.length-1;!$e.current&&Je(!0),ot({index:n,...ct[n]}),ht(n)}),[o,ct]),vt=e.useCallback((e=>{ut((t=>t.filter((t=>t.value!==e))))}),[]),wt=e.useCallback(((e,t)=>{t?o&&vt(e.value):ut((t=>o?[...t,e]:[e]));(E(de)?de:B)?mt():Me&&(Je(!1),Xe(""))}),[o,Me,vt,de]);e.useImperativeHandle(Be,(()=>({empty:!I(dt),menuOpen:Ge,blur:mt,focus:gt,clearValue:()=>{wt.length&&ut(O),nt.data&&ot(C)},setValue:e=>{const t=L(e,rt,at);ut(t)},toggleMenu:e=>{!0===e||void 0===e&&!Ge?(!Qe&>(),bt(v)):mt()}}))),e.useEffect((()=>{d&>()}),[]),e.useEffect((()=>{$e.current=Ge}),[Ge]),e.useEffect((()=>{je.current=_,We.current=X}),[_,X]),e.useEffect((()=>{Qe&&Z&&bt(v)}),[Qe,Z,bt]),e.useEffect((()=>{const{current:e}=We;e&&Pe.current&&(Pe.current=!1,e(st))}),[st]),ne((()=>{const{current:e}=je;if(!e)return;e(o?dt.map((e=>e.data)):I(dt)?dt[0].data:null)}),[o,dt]),ne((()=>{const{length:e}=ct,t=e>0&&(n||e!==De.length||0===qe.current);0===e?ot(C):(1===e||t)&&(ot({index:0,...ct[0]}),ht(0)),qe.current=e}),[n,De,ct]);const yt=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:i}=nt;e&&!i&&wt({data:e,value:t,label:n},o)},xt=e=>{const t="ArrowDown"===e,n=t?v:b;Ge?(e=>{if(!I(ct))return;const t=e===h?(nt.index+1)%ct.length:nt.index>0?nt.index-1:ct.length-1;et&&tt(null),ot({index:t,...ct[t]}),ht(t)})(t?h:g):bt(n)},Ct=e=>{if(R)return;Qe||gt();const t="INPUT"!==e.currentTarget.tagName;Ge?t&&(Ge&&Je(!1),_e&&Xe("")):Se&&bt(v),t&&e.preventDefault()},Ot=e.useCallback((e=>{null==F||F(e),Ze(!1),Je(!1),Xe("")}),[F]),St=e.useCallback((e=>{null==K||K(e),Ze(!0)}),[K]),Et=e.useCallback((e=>{const t=e.currentTarget.value||"";Pe.current=!0,null==U||U(t),!$e.current&&Je(!0),Xe(t)}),[U]),It=e.useCallback((e=>{k(e),ut(O),gt()}),[]),Mt=e.useCallback((e=>{k(e,"mousedown"===e.type),gt(),$e.current?Je(!1):bt(v)}),[bt]),kt=!Oe||Oe&&Ge,zt=R||!Ce||!!et,Lt=!(!$||R||!I(dt)),Nt=R||Se?void 0:Mt;return a.default.createElement(t.ThemeProvider,{theme:it},a.default.createElement(ve,{id:r,"aria-controls":i,"aria-expanded":Ge,onKeyDown:e=>{if(R)return;if(w&&(w(e,_e,nt),e.defaultPrevented))return;const{key:t}=e;switch(t){case"ArrowDown":case"ArrowUp":xt(t);break;case"ArrowLeft":case"ArrowRight":if(!o||_e||pe)return;(e=>{if(!I(dt))return;let t=-1;const n=dt.length-1,o=et?dt.findIndex((e=>e.value===et)):-1;t=e===f?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const i=t>=0?dt[t].value:null;nt.data&&ot(C),i!==et&&tt(i)})("ArrowLeft"===t?m:f);break;case" ":if(_e)return;if(Ge){if(!nt.data)return;yt()}else bt(v);break;case"Enter":Ge&&229!==e.keyCode&&yt();break;case"Escape":Ge&&(Je(!1),Xe(""));break;case"Tab":if(!Ge||!Ie||!nt.data||e.shiftKey)return;yt();break;case"Delete":case"Backspace":if(_e)return;if(et){const e=dt.findIndex((e=>e.value===et)),t=e>-1&&e<dt.length-1?dt[e+1].value:null;vt(et),tt(t)}else{if(!ze)return;if(!I(dt))break;if(o&&!pe){const{value:e}=dt[dt.length-1];vt(e)}else $&&ut(O)}break;default:return}e.preventDefault()}},a.default.createElement(ye,{ref:Ye,isInvalid:S,isFocused:Qe,isDisabled:R,className:"rfs-control-container",onTouchEnd:Ct,onMouseDown:Ct},a.default.createElement(we,null,a.default.createElement(ee,{isMulti:o,inputValue:_e,placeholder:Te,selectedOption:dt,focusedMultiValue:et,renderOptionLabel:lt,renderMultiOptions:pe,removeSelectedOption:vt}),a.default.createElement(re,{id:i,ref:Ue,required:l,ariaLabel:z,inputValue:_e,readOnly:zt,onBlur:Ot,onFocus:St,onChange:Et,ariaLabelledBy:Y,selectedOption:dt})),a.default.createElement(be,{menuOpen:Ge,clearIcon:y,caretIcon:x,isInvalid:S,isLoading:u,showClear:Lt,isDisabled:R,loadingNode:W,onClearMouseDown:It,onCaretMouseDown:Nt})),kt&&a.default.createElement(H,{menuRef:He,menuOpen:Ge,isLoading:u,menuTop:pt,height:ft,itemSize:Ae,loadingMsg:Re,menuOptions:ct,fixedSizeListRef:Ke,noOptionsMsg:Ve,selectOption:wt,direction:ue,itemKeySelector:Q,overscanCount:le,menuPortalTarget:ie,width:D||it.menu.width,onMenuMouseDown:e=>{k(e),gt()},renderOptionLabel:lt,focusedOptionIndex:nt.index}),ae&&a.default.createElement(se,{ariaLive:s,menuOpen:Ge,isFocused:Qe,ariaLabel:z,inputValue:_e,isSearchable:Ce,focusedOption:nt,selectedOption:dt,optionCount:ct.length})))}));xe.displayName="Select",exports.Select=xe; |
@@ -1,1 +0,1 @@ | ||
import e from"@babel/runtime/helpers/esm/defineProperty";import t,{memo as n,useMemo as o,Fragment as r,useState as i,useEffect as a,useRef as l,forwardRef as s,useCallback as c,useImperativeHandle as d}from"react";import u,{css as p,keyframes as m,ThemeProvider as f}from"styled-components";import g from"@babel/runtime/helpers/esm/objectWithoutProperties";import{areEqual as h,FixedSizeList as b}from"react-window";import{createPortal as y}from"react-dom";const v={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container"},w={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input"},O="top",x="auto",C="bottom",I="any",S=0,E=1,D=0,M=1,k=2,z=3,L=m(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),N=p([""," 0.2s ease-out both"],m(["from{opacity:0;}to{opacity:1;}"])),j={index:-1},P=[],T={color:{border:"#ced4da",danger:"#dc3545",primary:"#007bff",disabled:"#e9ecef",placeholder:"#6E7276",dangerLight:"rgba(220, 53, 69, 0.25)"},input:{},select:{},loader:{size:"0.625rem",padding:"0.375rem 0.75rem",animation:p([""," 1.19s ease-in-out infinite"],L),color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 0.9375rem",clear:{width:"14px",height:"16px",animation:N,transition:"color 0.2s ease-out"},caret:{size:"7px",transition:"transform 0.3s ease-in-out, color 0.2s ease-out"}},control:{minHeight:"38px",borderWidth:"1px",borderStyle:"solid",borderRadius:"3px",boxShadow:"0 0 0 0.2rem",padding:"0.375rem 0.75rem",boxShadowColor:"rgba(0, 123, 255, 0.25)",focusedBorderColor:"rgba(0, 123, 255, 0.75)",transition:"box-shadow 0.2s ease-out, border-color 0.2s ease-out"},menu:{padding:"0",width:"100%",margin:"0.5rem 0",borderRadius:"3px",backgroundColor:"#fff",animation:N,boxShadow:"0 0.5em 1em -0.125em rgb(10 10 10 / 12%), 0 0 0 1px rgb(10 10 10 / 4%)",option:{textAlign:"left",selectedColor:"#fff",selectedBgColor:"#007bff",padding:"0.375rem 0.75rem",focusedBgColor:"rgba(0, 123, 255, 0.15)"}},noOptions:{fontSize:"1.25rem",margin:"0.25rem 0",color:"hsl(0, 0%, 60%)",padding:"0.375rem 0.75rem"},multiValue:{margin:"1px 2px",borderRadius:"3px",backgroundColor:"#e7edf3",animation:N,label:{borderRadius:"3px",fontSize:"0.825em",padding:"1px 0 1px 6px"},clear:{fontWeight:600,padding:"0 6px",color:"#a6a6a6",fontSize:"0.65em",alignSelf:"center",focusColor:"#808080",transition:"color 0.2s ease-out, transform 0.2s ease-out, z-index 0.2s ease-out"}}};function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}const A=/[\u0300-\u036f]/g;function B(e){return"boolean"==typeof e}function R(e){return Array.isArray(e)&&!!e.length}function F(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}const $=(e,t=!0)=>{t&&e.preventDefault(),e.stopPropagation()};function W(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(A,"")}(o):o}const q=(e,t,n)=>{const o=Array.isArray(e)?e:F(e)?[e]:P;return R(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},K=(t,n)=>{const o=function(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?V(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):V(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}({},t);return Object.keys(n).forEach((e=>{const r=n[e];o[e]="animation"!==e&&F(r)?t[e]?K(t[e],r):r:r||""})),o};function H(e){return U(e)?window.pageYOffset:e.scrollTop}function U(e){return e===document.documentElement||e===document.body||e===window}const Y=/(auto|scroll)/;function X({overflow:e,overflowX:t,overflowY:n}){return Y.test(`${e}${t}${n}`)}function G(e){let t=getComputedStyle(e);const n=document.documentElement,o="absolute"===t.position;if("fixed"===t.position)return n;for(let n=e;n=null===(r=n)||void 0===r?void 0:r.parentElement;){var r;if(t=getComputedStyle(n),(!o||"static"!==t.position)&&X(t))return n}return n}function J(e,t,n=300,o){let r=0;const i=H(e),a=t-i;requestAnimationFrame((function t(){r+=5;const l=a*((s=(s=r)/n-1)*s*s+1)+i;var s;!function(e,t){U(e)?window.scrollTo(0,t):e.scrollTop=t}(e,l),r<n?requestAnimationFrame(t):null==o||o()}))}const Q="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,Z="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent),_=n((({index:e,style:n,data:{menuOptions:o,selectOption:r,renderOptionLabel:i,focusedOptionIndex:a}})=>{const{data:l,value:s,label:c,isDisabled:d,isSelected:u}=o[e],p=function(e,t,n){let o="rfs-option";return e&&(o+=" rfs-option-disabled"),t&&(o+=" rfs-option-selected"),n&&(o+=" rfs-option-focused"),o}(d,u,e===a);return t.createElement("div",{style:n,onClick:d?void 0:()=>r({data:l,value:s,label:c},u),className:p},i(l))}),h);_.displayName="Option";const ee=u.div.withConfig({displayName:"NoOptionsMsg",componentId:"v1y124-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(({theme:e})=>e.noOptions.color),(({theme:e})=>e.noOptions.margin),(({theme:e})=>e.noOptions.padding),(({theme:e})=>e.noOptions.fontSize),(({theme:e})=>e.noOptions.css)),te=({width:e,height:n,itemSize:i,direction:a,isLoading:l,loadingMsg:s,menuOptions:c,selectOption:d,noOptionsMsg:u,overscanCount:p,itemKeySelector:m,fixedSizeListRef:f,renderOptionLabel:g,focusedOptionIndex:h})=>{const y=o((()=>({menuOptions:c,selectOption:d,renderOptionLabel:g,focusedOptionIndex:h})),[c,h,d,g]);if(l)return t.createElement(ee,null,s);return t.createElement(r,null,t.createElement(b,{width:e,height:n,itemKey:m?(e,t)=>t.menuOptions[e][m]:void 0,itemSize:i,itemData:y,direction:a,ref:f,overscanCount:p,itemCount:c.length},_),!R(c)&&u&&t.createElement(ee,null,u))},ne=u.div.withConfig({displayName:"MenuWrapper",componentId:"yf5myu-0"})(["z-index:999;cursor:default;position:absolute;"," "," .","{display:block;overflow:hidden;user-select:none;white-space:nowrap;text-overflow:ellipsis;-webkit-tap-highlight-color:transparent;","}"],(({menuTop:e,menuOpen:t,hideNoOptionsMsg:n,theme:{menu:o}})=>p(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],o.width,o.margin,o.padding,o.animation,o.borderRadius,o.backgroundColor,n?"none":o.boxShadow,t?"":"display: none;",e?`top: ${e};`:"")),(({theme:e})=>e.menu.css),"rfs-option",(({theme:{menu:{option:e}}})=>p(["padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}"],e.padding,e.textAlign,"rfs-option-focused","rfs-option-disabled","rfs-option-selected",e.focusedBgColor,"rfs-option-selected",e.selectedColor,e.selectedBgColor,"rfs-option-disabled"))),oe=e=>{let{menuRef:n,menuTop:o,menuOpen:r,onMenuMouseDown:i,menuPortalTarget:a}=e,l=g(e,["menuRef","menuTop","menuOpen","onMenuMouseDown","menuPortalTarget"]);const{menuOptions:s,noOptionsMsg:c}=l,d=r&&!Boolean(c)&&!R(s),u=t.createElement(ne,{ref:n,menuTop:o,menuOpen:r,onMouseDown:i,className:"rfs-menu-container",hideNoOptionsMsg:d},t.createElement(te,Object.assign({},l)));return a?y(u,a):u},re=p(["z-index:5000;transform:scale(1.26);color:",";"],(({theme:e})=>e.multiValue.clear.focusColor)),ie=u.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-211cx7-0"})(["min-width:0;display:flex;"," ",""],(({theme:{multiValue:e}})=>p(["margin:",";animation:",";border-radius:",";background-color:",";"],e.margin,e.animation,e.borderRadius,e.backgroundColor)),(({theme:e})=>e.multiValue.css)),ae=u.div.withConfig({displayName:"Label",componentId:"sc-211cx7-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(({theme:e})=>e.multiValue.label.padding),(({theme:e})=>e.multiValue.label.fontSize),(({theme:e})=>e.multiValue.label.borderRadius)),le=u.i.withConfig({displayName:"Clear",componentId:"sc-211cx7-2"})(["display:flex;font-style:inherit;"," ",""],(({theme:{multiValue:{clear:e}}})=>p(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";:hover{","}"],e.color,e.padding,e.fontSize,e.alignSelf,e.transition,e.fontWeight,re)),(({isFocused:e})=>e&&re)),se=n((({data:e,value:n,isFocused:o,renderOptionLabel:r,removeSelectedOption:i})=>t.createElement(ie,null,t.createElement(ae,null,r(e)),t.createElement(le,{isFocused:o,onMouseDown:$,onClick:()=>i(n),onTouchEnd:()=>i(n)},"✖"))));se.displayName="MultiValue";const ce=p(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),de=u.div.withConfig({displayName:"SingleValue",componentId:"sc-153h0ct-0"})([""," max-width:calc(100% - 0.5rem);"],ce),ue=u.div.withConfig({displayName:"Placeholder",componentId:"sc-153h0ct-1"})([""," color:",";",""],ce,(({theme:e})=>e.color.placeholder),(({theme:e,isMulti:t})=>t&&p(["animation:",";"],e.multiValue.animation))),pe=({isMulti:e,inputValue:n,placeholder:o,selectedOption:i,focusedMultiValue:a,renderOptionLabel:l,renderMultiOptions:s,removeSelectedOption:c})=>!n||e&&(!e||R(i)&&!s)?R(i)?e?t.createElement(r,null,s?s({renderOptionLabel:l,selected:i}):i.map((({data:e,value:n})=>t.createElement(se,{key:n,data:e,value:n,renderOptionLabel:l,isFocused:n===a,removeSelectedOption:c})))):t.createElement(de,null,l(i[0].data)):t.createElement(ue,{isMulti:e},o):null;function me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function fe(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?me(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):me(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}const ge=(e,t,n,o,r,l,s,c,d,u,p,m,f)=>{const[g,h]=i(P),b=f?"":t,y=B(m)?m:!!p;return a((()=>{const t=W(b,d,u),i=o.length?new Set(o.map((e=>e.value))):void 0,a=s||(e=>!!e.isDisabled),p=c||(e=>"string"==typeof e.label?e.label:`${e.label}`),m=e=>{const o=r(e),s=fe(fe({data:e,value:o,label:l(e)},a(e)&&{isDisabled:!0}),(null==i?void 0:i.has(o))&&{isSelected:!0});if(!(t&&!(e=>{const o=W(p(e),d,u);return n===I?o.indexOf(t)>-1:o.substr(0,t.length)===t})(s)||y&&s.isSelected))return s},{length:f}=e,g=[];for(let t=0;t<f;t++){const n=m(e[t]);n&&g.push(n)}h(g)}),[e,o,b,y,n,d,u,c,s,r,l]),g},he=(e,t)=>{const n=l(!0);a((()=>{if(!n.current)return e();n.current=!1}),t)},be=(e,t,n,o,r,s,c,d,u,p,m,f)=>{const g=l(!1),h=l(!d),[b,y]=i(s),[v,w]=i(!1);a((()=>{h.current=!v&&!d}),[v,d]),a((()=>{const t=o===O||o===x&&!(e=>{if(!e)return!0;const t=G(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-H(t)-n>=o})(e.current);w(t)}),[e,o]),he((()=>{if(n){const t=e=>{null==m||m(),e&&(g.current=!0,y(e))};h.current?((e,t,n,o)=>{if(!e)return void o();const{top:r,height:i,bottom:a}=e.getBoundingClientRect(),l=window.innerHeight;if(l-r>=i)return void o();const s=G(e),c=H(s),d=s.getBoundingClientRect().height-c-r,u=d<i;if(u||!n)return void o(u?d:void 0);J(s,a-l+c+parseInt(getComputedStyle(e).marginBottom,10),t,o)})(e.current,u,p,t):t()}else null==f||f(),g.current&&(g.current=!1,y(s))}),[e,n,f,m,s,p,u]);const C=Math.min(b,c*r);return[v?((e,t,n)=>{const o=e>0||!t?e:t.getBoundingClientRect().height,r=n?n.getBoundingClientRect().height:0,i=t&&getComputedStyle(t),a=i?parseInt(i.marginBottom,10):0,l=i?parseInt(i.marginTop,10):0;return"calc("+-Math.abs(o+r)+"px + "+(a+l)+"px)"})(C,e.current,t.current):void 0,C]},ye=u.div.withConfig({displayName:"SizerDiv",componentId:"o2ype2-0"})(["top:0;left:0;height:0;overflow:scroll;white-space:pre;position:absolute;visibility:hidden;font-size:inherit;font-weight:inherit;font-family:inherit;",""],(({theme:e})=>e.input.css)),ve=u.input.attrs(w).withConfig({displayName:"Input",componentId:"o2ype2-1"})(["border:0;outline:0;padding:0;cursor:text;background:0;color:inherit;font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:content-box;:read-only{opacity:0;cursor:default;}:required{","}"," ",""],(({theme:e,isInvalid:t})=>t&&e.input.cssRequired),(({theme:e})=>e.input.css),Z&&"::-ms-clear{display:none;}"),we=n(s((({id:e,onBlur:n,onFocus:o,readOnly:a,required:s,onChange:c,ariaLabel:d,inputValue:u,ariaLabelledBy:p,selectedOption:m},f)=>{const g=l(null),[h,b]=i(2),y=!!s&&!R(m);return he((()=>{g.current&&b(g.current.scrollWidth+2)}),[u]),t.createElement(r,null,t.createElement(ve,{id:e,ref:f,isInvalid:!0,onBlur:n,onFocus:o,value:u,readOnly:a,required:y,"aria-label":d,style:{width:h},"aria-labelledby":p,onChange:a?void 0:c}),t.createElement(ye,{ref:g},u))})));we.displayName="AutosizeInput";const Oe=u.span.withConfig({displayName:"A11yText",componentId:"zxgkbx-0"})(["border:0;padding:0;width:1px;height:1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(1px,1px,1px,1px);"]),xe=({menuOpen:e,isFocused:n,inputValue:o,optionCount:r,isSearchable:i,focusedOption:a,selectedOption:l,ariaLive:s="polite",ariaLabel:c="Select"})=>{if(!n)return null;const d=` ${r} result(s) available${o?" for search input "+o:""}.`,u=e?"Use Up and Down arrow keys to choose options, press Enter or Tab to select the currently focused option, press Escape to close the menu.":`${c} is focused${i?", type to filter options":""}, press Down arrow key to open the menu.`,{index:p,value:m,label:f,isDisabled:g}=a,h=m?`Focused option: ${f}${g?" - disabled":""}, ${p+1} of ${r}.`:"",b=l.length?l.map((e=>e.label)).join(" "):"N/A";return t.createElement(Oe,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},t.createElement("span",{id:"aria-selection"},"Selected option: "+b),t.createElement("span",{id:"aria-context"},h+d+u))},Ce=u.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1j9e0pa-0"})(["display:flex;align-self:center;text-align:center;margin-right:0.25rem;padding:",";> div{border-radius:100%;display:inline-block;",":nth-of-type(1){animation-delay:-0.272s;}:nth-of-type(2){animation-delay:-0.136s;}}"],(({theme:e})=>e.loader.padding),(({theme:{loader:e}})=>p(["width:",";height:",";animation:",";background-color:",";"],e.size,e.size,e.animation,e.color))),Ie=()=>t.createElement(Ce,{"aria-hidden":!0,className:"rfs-loading-dots"},t.createElement("div",null),t.createElement("div",null),t.createElement("div",null)),Se=u.svg.withConfig({displayName:"ClearSvg",componentId:"sc-1v5ipi2-0"})(["fill:currentColor;",""],(({theme:e})=>p(["width:",";height:",";animation:",";transition:",";"],e.icon.clear.width,e.icon.clear.height,e.icon.clear.animation,e.icon.clear.transition))),Ee=()=>t.createElement(Se,{"aria-hidden":!0,viewBox:"0 0 14 16",className:"rfs-clear-icon"},t.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})),De=u.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1561oeb-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),Me=u.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1561oeb-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(({theme:e})=>e.icon.color),(({theme:e})=>e.icon.padding),(({theme:e})=>e.icon.hoverColor),(({theme:e})=>e.icon.css)),ke=u.div.withConfig({displayName:"Caret",componentId:"sc-1561oeb-2"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(({theme:e})=>e.icon.caret.transition),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e,menuOpen:t,isInvalid:n})=>t&&p(["transform:rotate(180deg);color:",";"],n?e.color.danger:e.color.caretActive||e.color.primary))),ze=u.div.withConfig({displayName:"Separator",componentId:"sc-1561oeb-3"})(["width:1px;margin:0.5rem 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(({theme:e})=>e.color.iconSeparator||e.color.border)),Le=n((({menuOpen:e,clearIcon:n,caretIcon:o,isInvalid:r,showClear:i,isLoading:a,isDisabled:l,loadingNode:s,onCaretMouseDown:c,onClearMouseDown:d})=>{const u=t=>"function"==typeof t?t({menuOpen:e,isLoading:a,isInvalid:r,isDisabled:l}):t;return t.createElement(De,null,i&&!a&&t.createElement(Me,{onTouchEnd:d,onMouseDown:d},u(n)||t.createElement(Ee,null)),a&&(s||t.createElement(Ie,null)),t.createElement(ze,null),t.createElement(Me,{onTouchEnd:c,onMouseDown:c},u(o)||t.createElement(ke,{"aria-hidden":!0,menuOpen:e,isInvalid:r,className:"rfs-caret-icon"})))}));function Ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function je(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?Ne(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):Ne(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}Le.displayName="IndicatorIcons";const Pe=u.div.attrs(v).withConfig({displayName:"SelectWrapper",componentId:"kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(({theme:e})=>e.select.css)),Te=u.div.withConfig({displayName:"ValueWrapper",componentId:"kcrmu9-1"})(["flex:1 1 0%;display:flex;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;padding:",";"],(({theme:e})=>e.control.padding)),Ve=u.div.withConfig({displayName:"ControlWrapper",componentId:"kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(({isDisabled:e,isFocused:t,isInvalid:n,theme:{control:o,color:r}})=>p(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],o.transition,o.borderStyle,o.borderWidth,o.borderRadius,o.height||o.minHeight,n?r.danger:t?o.focusedBorderColor:r.border,o.height?`height: ${o.height};`:"",e?"pointer-events:none;user-select:none;":"",o.backgroundColor||e?`background-color: ${e?r.disabled:o.backgroundColor};`:"",t?`box-shadow: ${o.boxShadow} ${n?r.dangerLight:o.boxShadowColor};`:"")),(({theme:e})=>e.control.css),(({isFocused:e,theme:t})=>e&&t.control.focusedCss)),Ae=s((({async:e,isMulti:n,inputId:r,selectId:s,required:u,ariaLive:p,autoFocus:m,isLoading:g,onKeyDown:h,clearIcon:b,caretIcon:y,isInvalid:v,ariaLabel:w,menuWidth:O,isDisabled:x,inputDelay:L,onMenuOpen:N,onMenuClose:V,onInputBlur:A,isClearable:W,themeConfig:H,loadingNode:U,initialValue:Y,onInputFocus:X,onInputChange:G,ariaLabelledBy:J,onOptionChange:Z,onSearchChange:_,getOptionLabel:ee,getOptionValue:te,itemKeySelector:ne,openMenuOnFocus:re,menuPortalTarget:ie,isAriaLiveEnabled:ae,menuOverscanCount:le,blurInputOnSelect:se,menuItemDirection:ce,renderOptionLabel:de,renderMultiOptions:ue,menuScrollDuration:me,filterIgnoreAccents:fe,hideSelectedOptions:ye,getIsOptionDisabled:ve,getFilterOptionString:Oe,isSearchable:Ce=!0,lazyLoadMenu:Ie=!1,openMenuOnClick:Se=!0,filterIgnoreCase:Ee=!0,tabSelectsOption:De=!0,closeMenuOnSelect:Me=!0,scrollMenuIntoView:ke=!0,backspaceClearsValue:ze=!0,filterMatchFrom:Ne=I,menuPosition:Ae=C,options:Be=P,loadingMsg:Re="Loading..",placeholder:Fe="Select option..",noOptionsMsg:$e="No options",menuItemSize:We=35,menuMaxHeight:qe=300},Ke)=>{const He=l(!1),Ue=l(),Ye=l(!1),Xe=l(null),Ge=l(null),Je=l(null),Qe=l(null),[Ze,_e]=i(""),[et,tt]=i(!1),[nt,ot]=i(!1),[rt,it]=i(null),[at,lt]=i(j),st=o((()=>F(H)?K(T,H):T),[H]),ct=o((()=>ee||(e=>e.label)),[ee]),dt=o((()=>te||(e=>e.value)),[te]),ut=o((()=>de||ct),[de,ct]),pt=((e,t=0)=>{const[n,o]=i(e);return a((()=>{if(t<=0)return;const n=setTimeout((()=>{o(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),t<=0?e:n})(Ze,L),[mt,ft]=i((()=>q(Y,dt,ct))),gt=ge(Be,pt,Ne,mt,dt,ct,ve,Oe,Ee,fe,n,ye,e),[ht,bt]=be(Ge,Qe,et,Ae,We,qe,gt.length,!!ie,me,ke,N,V),yt=()=>{var e;return null===(e=Je.current)||void 0===e?void 0:e.blur()},vt=()=>{var e;return null===(e=Je.current)||void 0===e?void 0:e.focus()},wt=e=>{var t;return null===(t=Xe.current)||void 0===t?void 0:t.scrollToItem(e)},Ot=c((e=>{if(!R(gt))return void(!He.current&&tt(!0));const t=n?-1:gt.findIndex((e=>e.isSelected)),o=t>-1?t:e===z?0:gt.length-1;!He.current&&tt(!0),lt(je({index:o},gt[o])),wt(o)}),[n,gt]),xt=c((e=>{ft((t=>t.filter((({value:t})=>t!==e))))}),[]),Ct=c(((e,t)=>{t?n&&xt(e.value):ft((t=>n?[...t,e]:[e]));(B(se)?se:Q)?yt():Me&&(tt(!1),_e(""))}),[n,Me,xt,se]);d(Ke,(()=>({empty:!R(mt),menuOpen:et,blur:yt,focus:vt,clearValue:()=>{Ct.length&&ft(P),at.data&<(j)},setValue:e=>{const t=q(e,dt,ct);ft(t)},toggleMenu:e=>{!0===e||void 0===e&&!et?(!nt&&vt(),Ot(z)):yt()}}))),a((()=>{m&&vt()}),[]),a((()=>{He.current=et}),[et]),a((()=>{nt&&re&&Ot(z)}),[nt,re,Ot]),a((()=>{_&&Ye.current&&(Ye.current=!1,_(pt))}),[_,pt]),he((()=>{if(!Z)return;const e=n?mt.map((e=>e.data)):R(mt)?mt[0].data:null;Z(e)}),[n,mt,Z]),he((()=>{const t=gt.length>0&&(e||gt.length!==Be.length||0===Ue.current);0===gt.length?lt(j):(1===gt.length||t)&&(lt(je({index:0},gt[0])),wt(0)),Ue.current=gt.length}),[e,Be,gt]);const It=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:r}=at;e&&!r&&Ct({data:e,value:t,label:n},o)},St=e=>{const t="ArrowDown"===e,n=t?z:k;et?(e=>{if(!R(gt))return;const t=e===M?(at.index+1)%gt.length:at.index>0?at.index-1:gt.length-1;rt&&it(null),lt(je({index:t},gt[t])),wt(t)})(t?M:D):Ot(n)},Et=e=>{if(x)return;nt||vt();const t="INPUT"!==e.currentTarget.tagName;et?t&&(et&&tt(!1),Ze&&_e("")):Se&&Ot(z),t&&e.preventDefault()},Dt=c((e=>{null==A||A(e),ot(!1),tt(!1),_e("")}),[A]),Mt=c((e=>{null==X||X(e),ot(!0)}),[X]),kt=c((e=>{const t=e.currentTarget.value||"";Ye.current=!0,null==G||G(t),!He.current&&tt(!0),_e(t)}),[G]),zt=c((e=>{$(e),ft(P),vt()}),[]),Lt=c((e=>{$(e,"mousedown"===e.type),vt(),He.current?tt(!1):Ot(z)}),[Ot]),Nt=!Ie||Ie&&et,jt=x||!Ce||!!rt,Pt=!(!W||x||!R(mt)),Tt=x||Se?void 0:Lt;return t.createElement(f,{theme:st},t.createElement(Pe,{id:s,"aria-controls":r,"aria-expanded":et,onKeyDown:e=>{if(x)return;if(h&&(h(e,Ze,at),e.defaultPrevented))return;const{key:t}=e;switch(t){case"ArrowDown":case"ArrowUp":St(t);break;case"ArrowLeft":case"ArrowRight":if(!n||Ze||ue)return;(e=>{if(!R(mt))return;let t=-1;const n=mt.length-1,o=rt?mt.findIndex((e=>e.value===rt)):-1;t=e===S?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const r=t>=0?mt[t].value:null;at.data&<(j),r!==rt&&it(r)})("ArrowLeft"===t?E:S);break;case" ":if(Ze)return;if(et){if(!at.data)return;It()}else Ot(z);break;case"Enter":et&&229!==e.keyCode&&It();break;case"Escape":et&&(tt(!1),_e(""));break;case"Tab":if(!et||!De||!at.data||e.shiftKey)return;It();break;case"Delete":case"Backspace":if(Ze)return;if(rt){const e=mt.findIndex((e=>e.value===rt)),t=e>-1&&e<mt.length-1?mt[e+1].value:null;xt(rt),it(t)}else{if(!ze)return;if(!R(mt))break;if(n&&!ue){const{value:e}=mt[mt.length-1];xt(e)}else W&&ft(P)}break;default:return}e.preventDefault()}},t.createElement(Ve,{ref:Qe,isInvalid:v,isFocused:nt,isDisabled:x,className:"rfs-control-container",onTouchEnd:Et,onMouseDown:Et},t.createElement(Te,null,t.createElement(pe,{isMulti:n,inputValue:Ze,placeholder:Fe,selectedOption:mt,focusedMultiValue:rt,renderOptionLabel:ut,renderMultiOptions:ue,removeSelectedOption:xt}),t.createElement(we,{id:r,ref:Je,required:u,ariaLabel:w,inputValue:Ze,readOnly:jt,onBlur:Dt,onFocus:Mt,onChange:kt,ariaLabelledBy:J,selectedOption:mt})),t.createElement(Le,{menuOpen:et,clearIcon:b,caretIcon:y,isInvalid:v,isLoading:g,showClear:Pt,isDisabled:x,loadingNode:U,onClearMouseDown:zt,onCaretMouseDown:Tt})),Nt&&t.createElement(oe,{menuRef:Ge,menuOpen:et,isLoading:g,menuTop:ht,height:bt,itemSize:We,loadingMsg:Re,menuOptions:gt,fixedSizeListRef:Xe,noOptionsMsg:$e,selectOption:Ct,direction:ce,itemKeySelector:ne,overscanCount:le,menuPortalTarget:ie,width:O||st.menu.width,onMenuMouseDown:e=>{$(e),vt()},renderOptionLabel:ut,focusedOptionIndex:at.index}),ae&&t.createElement(xe,{ariaLive:p,menuOpen:et,isFocused:nt,ariaLabel:w,inputValue:Ze,isSearchable:Ce,focusedOption:at,selectedOption:mt,optionCount:gt.length})))}));Ae.displayName="Select";export{Ae as Select}; | ||
import e from"@babel/runtime/helpers/esm/defineProperty";import t,{memo as n,useMemo as o,Fragment as r,useState as i,useEffect as a,useRef as l,forwardRef as s,useCallback as c,useImperativeHandle as d}from"react";import u,{css as p,keyframes as m,ThemeProvider as f}from"styled-components";import g from"@babel/runtime/helpers/esm/objectWithoutProperties";import{areEqual as h,FixedSizeList as b}from"react-window";import{createPortal as v}from"react-dom";const y={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container"},w={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input"},O="top",x="auto",C="bottom",I="any",S=0,E=1,D=0,M=1,k=2,z=3,L=m(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),N=p([""," 0.2s ease-out both"],m(["from{opacity:0;}to{opacity:1;}"])),j=p([""," 1.19s ease-in-out infinite"],L),P={index:-1},T=[];function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}const A=/[\u0300-\u036f]/g;function B(e){return"boolean"==typeof e}function R(e){return Array.isArray(e)&&!!e.length}function F(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}const $=(e,t=!0)=>{t&&e.preventDefault(),e.stopPropagation()};function W(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(A,"")}(o):o}const q=(e,t,n)=>{const o=Array.isArray(e)?e:F(e)?[e]:T;return R(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},K=(t,n)=>{const o=function(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?V(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):V(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}({},t);return Object.keys(n).forEach((e=>{const r=n[e];o[e]="animation"!==e&&F(r)?t[e]?K(t[e],r):r:r||""})),o};function H(e){return U(e)?window.pageYOffset:e.scrollTop}function U(e){return e===document.documentElement||e===document.body||e===window}const Y=/(auto|scroll)/;function X({overflow:e,overflowX:t,overflowY:n}){return Y.test(`${e}${t}${n}`)}function G(e){let t=getComputedStyle(e);const n=document.documentElement,o="absolute"===t.position;if("fixed"===t.position)return n;for(let n=e;n=null===(r=n)||void 0===r?void 0:r.parentElement;){var r;if(t=getComputedStyle(n),(!o||"static"!==t.position)&&X(t))return n}return n}function J(e,t,n=300,o){let r=0;const i=H(e),a=t-i;requestAnimationFrame((function t(){r+=5;const l=a*((s=(s=r)/n-1)*s*s+1)+i;var s;!function(e,t){U(e)?window.scrollTo(0,t):e.scrollTop=t}(e,l),r<n?requestAnimationFrame(t):null==o||o()}))}const Q="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,Z="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent),_={color:{border:"#ced4da",danger:"#dc3545",primary:"#007bff",disabled:"#e9ecef",placeholder:"#6E7276",dangerLight:"rgba(220, 53, 69, 0.25)"},input:{},select:{},loader:{size:"0.625rem",padding:"0.375rem 0.75rem",animation:j,color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 0.9375rem",clear:{width:"14px",height:"16px",animation:N,transition:"color 0.2s ease-out"},caret:{size:"7px",transition:"transform 0.3s ease-in-out, color 0.2s ease-out"}},control:{minHeight:"38px",borderWidth:"1px",borderStyle:"solid",borderRadius:"3px",boxShadow:"0 0 0 0.2rem",padding:"0.375rem 0.75rem",boxShadowColor:"rgba(0, 123, 255, 0.25)",focusedBorderColor:"rgba(0, 123, 255, 0.75)",transition:"box-shadow 0.2s ease-out, border-color 0.2s ease-out"},menu:{padding:"0",width:"100%",margin:"0.5rem 0",borderRadius:"3px",backgroundColor:"#fff",animation:N,boxShadow:"0 0.5em 1em -0.125em rgb(10 10 10 / 12%), 0 0 0 1px rgb(10 10 10 / 4%)",option:{textAlign:"left",selectedColor:"#fff",selectedBgColor:"#007bff",padding:"0.375rem 0.75rem",focusedBgColor:"rgba(0, 123, 255, 0.15)"}},noOptions:{fontSize:"1.25rem",margin:"0.25rem 0",color:"hsl(0, 0%, 60%)",padding:"0.375rem 0.75rem"},multiValue:{margin:"1px 2px",borderRadius:"3px",backgroundColor:"#e7edf3",animation:N,label:{borderRadius:"3px",fontSize:"0.825em",padding:"1px 0 1px 6px"},clear:{fontWeight:600,padding:"0 6px",color:"#a6a6a6",fontSize:"0.65em",alignSelf:"center",focusColor:"#808080",transition:"color 0.2s ease-out, transform 0.2s ease-out, z-index 0.2s ease-out"}}},ee=n((({index:e,style:n,data:{menuOptions:o,selectOption:r,renderOptionLabel:i,focusedOptionIndex:a}})=>{const{data:l,value:s,label:c,isDisabled:d,isSelected:u}=o[e],p=function(e,t,n){let o="rfs-option";return e&&(o+=" rfs-option-disabled"),t&&(o+=" rfs-option-selected"),n&&(o+=" rfs-option-focused"),o}(d,u,e===a);return t.createElement("div",{style:n,onClick:d?void 0:()=>r({data:l,value:s,label:c},u),className:p},i(l))}),h);ee.displayName="Option";const te=u.div.withConfig({displayName:"NoOptionsMsg",componentId:"v1y124-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(({theme:e})=>e.noOptions.color),(({theme:e})=>e.noOptions.margin),(({theme:e})=>e.noOptions.padding),(({theme:e})=>e.noOptions.fontSize),(({theme:e})=>e.noOptions.css)),ne=({width:e,height:n,itemSize:i,direction:a,isLoading:l,loadingMsg:s,menuOptions:c,selectOption:d,noOptionsMsg:u,overscanCount:p,itemKeySelector:m,fixedSizeListRef:f,renderOptionLabel:g,focusedOptionIndex:h})=>{const v=o((()=>({menuOptions:c,selectOption:d,renderOptionLabel:g,focusedOptionIndex:h})),[c,h,d,g]);if(l)return t.createElement(te,null,s);return t.createElement(r,null,t.createElement(b,{width:e,height:n,itemKey:m?(e,t)=>t.menuOptions[e][m]:void 0,itemSize:i,itemData:v,direction:a,ref:f,overscanCount:p,itemCount:c.length},ee),!R(c)&&u&&t.createElement(te,null,u))},oe=u.div.withConfig({displayName:"MenuWrapper",componentId:"yf5myu-0"})(["z-index:999;cursor:default;position:absolute;"," "," .","{display:block;overflow:hidden;user-select:none;white-space:nowrap;text-overflow:ellipsis;-webkit-tap-highlight-color:transparent;","}"],(({menuTop:e,menuOpen:t,hideNoOptionsMsg:n,theme:{menu:o}})=>p(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],o.width,o.margin,o.padding,o.animation,o.borderRadius,o.backgroundColor,n?"none":o.boxShadow,t?"":"display: none;",e?`top: ${e};`:"")),(({theme:e})=>e.menu.css),"rfs-option",(({theme:{menu:{option:e}}})=>p(["padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}"],e.padding,e.textAlign,"rfs-option-focused","rfs-option-disabled","rfs-option-selected",e.focusedBgColor,"rfs-option-selected",e.selectedColor,e.selectedBgColor,"rfs-option-disabled"))),re=e=>{let{menuRef:n,menuTop:o,menuOpen:r,onMenuMouseDown:i,menuPortalTarget:a}=e,l=g(e,["menuRef","menuTop","menuOpen","onMenuMouseDown","menuPortalTarget"]);const{menuOptions:s,noOptionsMsg:c}=l,d=r&&!Boolean(c)&&!R(s),u=t.createElement(oe,{ref:n,menuTop:o,menuOpen:r,onMouseDown:i,className:"rfs-menu-container",hideNoOptionsMsg:d},t.createElement(ne,Object.assign({},l)));return a?v(u,a):u},ie=p(["z-index:5000;transform:scale(1.26);color:",";"],(({theme:e})=>e.multiValue.clear.focusColor)),ae=u.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-211cx7-0"})(["min-width:0;display:flex;"," ",""],(({theme:{multiValue:e}})=>p(["margin:",";animation:",";border-radius:",";background-color:",";"],e.margin,e.animation,e.borderRadius,e.backgroundColor)),(({theme:e})=>e.multiValue.css)),le=u.div.withConfig({displayName:"Label",componentId:"sc-211cx7-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(({theme:e})=>e.multiValue.label.padding),(({theme:e})=>e.multiValue.label.fontSize),(({theme:e})=>e.multiValue.label.borderRadius)),se=u.i.withConfig({displayName:"Clear",componentId:"sc-211cx7-2"})(["display:flex;font-style:inherit;"," ",""],(({theme:{multiValue:{clear:e}}})=>p(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";:hover{","}"],e.color,e.padding,e.fontSize,e.alignSelf,e.transition,e.fontWeight,ie)),(({isFocused:e})=>e&&ie)),ce=n((({data:e,value:n,isFocused:o,renderOptionLabel:r,removeSelectedOption:i})=>t.createElement(ae,null,t.createElement(le,null,r(e)),t.createElement(se,{isFocused:o,onMouseDown:$,onClick:()=>i(n),onTouchEnd:()=>i(n)},"✖"))));ce.displayName="MultiValue";const de=p(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),ue=u.div.withConfig({displayName:"SingleValue",componentId:"sc-153h0ct-0"})([""," max-width:calc(100% - 0.5rem);"],de),pe=u.div.withConfig({displayName:"Placeholder",componentId:"sc-153h0ct-1"})([""," color:",";",""],de,(({theme:e})=>e.color.placeholder),(({theme:e,isMulti:t})=>t&&p(["animation:",";"],e.multiValue.animation))),me=({isMulti:e,inputValue:n,placeholder:o,selectedOption:i,focusedMultiValue:a,renderOptionLabel:l,renderMultiOptions:s,removeSelectedOption:c})=>!n||e&&(!e||R(i)&&!s)?R(i)?e?t.createElement(r,null,s?s({renderOptionLabel:l,selected:i}):i.map((({data:e,value:n})=>t.createElement(ce,{key:n,data:e,value:n,renderOptionLabel:l,isFocused:n===a,removeSelectedOption:c})))):t.createElement(ue,null,l(i[0].data)):t.createElement(pe,{isMulti:e},o):null;function fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ge(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?fe(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):fe(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}const he=(e,t,n,o,r,l,s,c,d,u,p,m,f)=>{const[g,h]=i(T),b=f?"":t,v=B(m)?m:!!p;return a((()=>{const t=W(b,d,u),i=o.length?new Set(o.map((e=>e.value))):void 0,a=s||(e=>!!e.isDisabled),p=c||(e=>"string"==typeof e.label?e.label:`${e.label}`),m=e=>{const o=r(e),s=ge(ge({data:e,value:o,label:l(e)},a(e)&&{isDisabled:!0}),(null==i?void 0:i.has(o))&&{isSelected:!0});if(!(t&&!(e=>{const o=W(p(e),d,u);return n===I?o.indexOf(t)>-1:o.substr(0,t.length)===t})(s)||v&&s.isSelected))return s},{length:f}=e,g=[];for(let t=0;t<f;t++){const n=m(e[t]);n&&g.push(n)}h(g)}),[e,o,b,v,n,d,u,c,s,r,l]),g},be=(e,t)=>{const n=l(!0);a((()=>{if(!n.current)return e();n.current=!1}),t)},ve=(e,t,n,o,r,s,c,d,u,p,m,f)=>{const g=l(),h=l(),b=l(!1),v=l(!d),[y,w]=i(s),[C,I]=i(!1);a((()=>{g.current=m,h.current=f}),[m,f]),a((()=>{v.current=!C&&!d}),[C,d]),a((()=>{const t=o===O||o===x&&!(e=>{if(!e)return!0;const t=G(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-H(t)-n>=o})(e.current);I(t)}),[e,o]),be((()=>{if(n){const t=e=>{var t;null===(t=g.current)||void 0===t||t.call(g),e&&(b.current=!0,w(e))};v.current?((e,t,n,o)=>{if(!e)return void o();const{top:r,height:i,bottom:a}=e.getBoundingClientRect(),l=window.innerHeight;if(l-r>=i)return void o();const s=G(e),c=H(s),d=s.getBoundingClientRect().height-c-r,u=d<i;if(u||!n)return void o(u?d:void 0);J(s,a-l+c+parseInt(getComputedStyle(e).marginBottom,10),t,o)})(e.current,u,p,t):t()}else{var t;null===(t=h.current)||void 0===t||t.call(h),b.current&&(b.current=!1,w(s))}}),[e,n,s,p,u]);const S=Math.min(y,c*r);return[C?((e,t,n)=>{const o=e>0||!t?e:t.getBoundingClientRect().height,r=n?n.getBoundingClientRect().height:0,i=t&&getComputedStyle(t),a=i?parseInt(i.marginBottom,10):0,l=i?parseInt(i.marginTop,10):0;return"calc("+-Math.abs(o+r)+"px + "+(a+l)+"px)"})(S,e.current,t.current):void 0,S]},ye=u.div.withConfig({displayName:"SizerDiv",componentId:"o2ype2-0"})(["top:0;left:0;height:0;overflow:scroll;white-space:pre;position:absolute;visibility:hidden;font-size:inherit;font-weight:inherit;font-family:inherit;",""],(({theme:e})=>e.input.css)),we=u.input.attrs(w).withConfig({displayName:"Input",componentId:"o2ype2-1"})(["border:0;outline:0;padding:0;cursor:text;background:0;color:inherit;font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:content-box;:read-only{opacity:0;cursor:default;}:required{","}"," ",""],(({theme:e,isInvalid:t})=>t&&e.input.cssRequired),(({theme:e})=>e.input.css),Z&&"::-ms-clear{display:none;}"),Oe=n(s((({id:e,onBlur:n,onFocus:o,readOnly:a,required:s,onChange:c,ariaLabel:d,inputValue:u,ariaLabelledBy:p,selectedOption:m},f)=>{const g=l(null),[h,b]=i(2),v=!!s&&!R(m);return be((()=>{g.current&&b(g.current.scrollWidth+2)}),[u]),t.createElement(r,null,t.createElement(we,{id:e,ref:f,isInvalid:!0,onBlur:n,onFocus:o,value:u,readOnly:a,required:v,"aria-label":d,style:{width:h},"aria-labelledby":p,onChange:a?void 0:c}),t.createElement(ye,{ref:g},u))})));Oe.displayName="AutosizeInput";const xe=u.span.withConfig({displayName:"A11yText",componentId:"zxgkbx-0"})(["border:0;padding:0;width:1px;height:1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(1px,1px,1px,1px);"]),Ce=({menuOpen:e,isFocused:n,inputValue:o,optionCount:r,isSearchable:i,focusedOption:a,selectedOption:l,ariaLive:s="polite",ariaLabel:c="Select"})=>{if(!n)return null;const d=` ${r} result(s) available${o?" for search input "+o:""}.`,u=e?"Use Up and Down arrow keys to choose options, press Enter or Tab to select the currently focused option, press Escape to close the menu.":`${c} is focused${i?", type to filter options":""}, press Down arrow key to open the menu.`,{index:p,value:m,label:f,isDisabled:g}=a,h=m?`Focused option: ${f}${g?" - disabled":""}, ${p+1} of ${r}.`:"",b=l.length?l.map((e=>e.label)).join(" "):"N/A";return t.createElement(xe,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},t.createElement("span",{id:"aria-selection"},"Selected option: "+b),t.createElement("span",{id:"aria-context"},h+d+u))},Ie=u.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1j9e0pa-0"})(["display:flex;align-self:center;text-align:center;margin-right:0.25rem;padding:",";> div{border-radius:100%;display:inline-block;",":nth-of-type(1){animation-delay:-0.272s;}:nth-of-type(2){animation-delay:-0.136s;}}"],(({theme:e})=>e.loader.padding),(({theme:{loader:e}})=>p(["width:",";height:",";animation:",";background-color:",";"],e.size,e.size,e.animation,e.color))),Se=()=>t.createElement(Ie,{"aria-hidden":!0,className:"rfs-loading-dots"},t.createElement("div",null),t.createElement("div",null),t.createElement("div",null)),Ee=u.svg.withConfig({displayName:"ClearSvg",componentId:"sc-1v5ipi2-0"})(["fill:currentColor;",""],(({theme:e})=>p(["width:",";height:",";animation:",";transition:",";"],e.icon.clear.width,e.icon.clear.height,e.icon.clear.animation,e.icon.clear.transition))),De=()=>t.createElement(Ee,{"aria-hidden":!0,viewBox:"0 0 14 16",className:"rfs-clear-icon"},t.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})),Me=u.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1561oeb-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),ke=u.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1561oeb-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(({theme:e})=>e.icon.color),(({theme:e})=>e.icon.padding),(({theme:e})=>e.icon.hoverColor),(({theme:e})=>e.icon.css)),ze=u.div.withConfig({displayName:"Caret",componentId:"sc-1561oeb-2"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(({theme:e})=>e.icon.caret.transition),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e,menuOpen:t,isInvalid:n})=>t&&p(["transform:rotate(180deg);color:",";"],n?e.color.danger:e.color.caretActive||e.color.primary))),Le=u.div.withConfig({displayName:"Separator",componentId:"sc-1561oeb-3"})(["width:1px;margin:0.5rem 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(({theme:e})=>e.color.iconSeparator||e.color.border)),Ne=n((({menuOpen:e,clearIcon:n,caretIcon:o,isInvalid:r,showClear:i,isLoading:a,isDisabled:l,loadingNode:s,onCaretMouseDown:c,onClearMouseDown:d})=>{const u=t=>"function"==typeof t?t({menuOpen:e,isLoading:a,isInvalid:r,isDisabled:l}):t;return t.createElement(Me,null,i&&!a&&t.createElement(ke,{onTouchEnd:d,onMouseDown:d},u(n)||t.createElement(De,null)),a&&(s||t.createElement(Se,null)),t.createElement(Le,null),t.createElement(ke,{onTouchEnd:c,onMouseDown:c},u(o)||t.createElement(ze,{"aria-hidden":!0,menuOpen:e,isInvalid:r,className:"rfs-caret-icon"})))}));function je(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Pe(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?je(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):je(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}Ne.displayName="IndicatorIcons";const Te=u.div.attrs(y).withConfig({displayName:"SelectWrapper",componentId:"kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(({theme:e})=>e.select.css)),Ve=u.div.withConfig({displayName:"ValueWrapper",componentId:"kcrmu9-1"})(["flex:1 1 0%;display:flex;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;padding:",";"],(({theme:e})=>e.control.padding)),Ae=u.div.withConfig({displayName:"ControlWrapper",componentId:"kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(({isDisabled:e,isFocused:t,isInvalid:n,theme:{control:o,color:r}})=>p(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],o.transition,o.borderStyle,o.borderWidth,o.borderRadius,o.height||o.minHeight,n?r.danger:t?o.focusedBorderColor:r.border,o.height?`height: ${o.height};`:"",e?"pointer-events:none;user-select:none;":"",o.backgroundColor||e?`background-color: ${e?r.disabled:o.backgroundColor};`:"",t?`box-shadow: ${o.boxShadow} ${n?r.dangerLight:o.boxShadowColor};`:"")),(({theme:e})=>e.control.css),(({isFocused:e,theme:t})=>e&&t.control.focusedCss)),Be=s((({async:e,isMulti:n,inputId:r,selectId:s,required:u,ariaLive:p,autoFocus:m,isLoading:g,onKeyDown:h,clearIcon:b,caretIcon:v,isInvalid:y,ariaLabel:w,menuWidth:O,isDisabled:x,inputDelay:L,onMenuOpen:N,onMenuClose:j,onInputBlur:V,isClearable:A,themeConfig:W,loadingNode:H,initialValue:U,onInputFocus:Y,onInputChange:X,ariaLabelledBy:G,onOptionChange:J,onSearchChange:Z,getOptionLabel:ee,getOptionValue:te,itemKeySelector:ne,openMenuOnFocus:oe,menuPortalTarget:ie,isAriaLiveEnabled:ae,menuOverscanCount:le,blurInputOnSelect:se,menuItemDirection:ce,renderOptionLabel:de,renderMultiOptions:ue,menuScrollDuration:pe,filterIgnoreAccents:fe,hideSelectedOptions:ge,getIsOptionDisabled:ye,getFilterOptionString:we,isSearchable:xe=!0,lazyLoadMenu:Ie=!1,openMenuOnClick:Se=!0,filterIgnoreCase:Ee=!0,tabSelectsOption:De=!0,closeMenuOnSelect:Me=!0,scrollMenuIntoView:ke=!0,backspaceClearsValue:ze=!0,filterMatchFrom:Le=I,menuPosition:je=C,options:Be=T,loadingMsg:Re="Loading..",placeholder:Fe="Select option..",noOptionsMsg:$e="No options",menuItemSize:We=35,menuMaxHeight:qe=300},Ke)=>{const He=l(!1),Ue=l(),Ye=l(!1),Xe=l(),Ge=l(),Je=l(null),Qe=l(null),Ze=l(null),_e=l(null),[et,tt]=i(""),[nt,ot]=i(!1),[rt,it]=i(!1),[at,lt]=i(null),[st,ct]=i(P),dt=o((()=>F(W)?K(_,W):_),[W]),ut=o((()=>ee||(e=>e.label)),[ee]),pt=o((()=>te||(e=>e.value)),[te]),mt=o((()=>de||ut),[de,ut]),ft=((e,t=0)=>{const[n,o]=i(e);return a((()=>{if(t<=0)return;const n=setTimeout((()=>{o(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),t<=0?e:n})(et,L),[gt,ht]=i((()=>q(U,pt,ut))),bt=he(Be,ft,Le,gt,pt,ut,ye,we,Ee,fe,n,ge,e),[vt,yt]=ve(Qe,_e,nt,je,We,qe,bt.length,!!ie,pe,ke,N,j),wt=()=>{var e;return null===(e=Ze.current)||void 0===e?void 0:e.blur()},Ot=()=>{var e;return null===(e=Ze.current)||void 0===e?void 0:e.focus()},xt=e=>{var t;return null===(t=Je.current)||void 0===t?void 0:t.scrollToItem(e)},Ct=c((e=>{if(!R(bt))return void(!He.current&&ot(!0));const t=n?-1:bt.findIndex((e=>e.isSelected)),o=t>-1?t:e===z?0:bt.length-1;!He.current&&ot(!0),ct(Pe({index:o},bt[o])),xt(o)}),[n,bt]),It=c((e=>{ht((t=>t.filter((t=>t.value!==e))))}),[]),St=c(((e,t)=>{t?n&&It(e.value):ht((t=>n?[...t,e]:[e]));(B(se)?se:Q)?wt():Me&&(ot(!1),tt(""))}),[n,Me,It,se]);d(Ke,(()=>({empty:!R(gt),menuOpen:nt,blur:wt,focus:Ot,clearValue:()=>{St.length&&ht(T),st.data&&ct(P)},setValue:e=>{const t=q(e,pt,ut);ht(t)},toggleMenu:e=>{!0===e||void 0===e&&!nt?(!rt&&Ot(),Ct(z)):wt()}}))),a((()=>{m&&Ot()}),[]),a((()=>{He.current=nt}),[nt]),a((()=>{Ge.current=J,Xe.current=Z}),[J,Z]),a((()=>{rt&&oe&&Ct(z)}),[rt,oe,Ct]),a((()=>{const{current:e}=Xe;e&&Ye.current&&(Ye.current=!1,e(ft))}),[ft]),be((()=>{const{current:e}=Ge;if(!e)return;e(n?gt.map((e=>e.data)):R(gt)?gt[0].data:null)}),[n,gt]),be((()=>{const{length:t}=bt,n=t>0&&(e||t!==Be.length||0===Ue.current);0===t?ct(P):(1===t||n)&&(ct(Pe({index:0},bt[0])),xt(0)),Ue.current=t}),[e,Be,bt]);const Et=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:r}=st;e&&!r&&St({data:e,value:t,label:n},o)},Dt=e=>{const t="ArrowDown"===e,n=t?z:k;nt?(e=>{if(!R(bt))return;const t=e===M?(st.index+1)%bt.length:st.index>0?st.index-1:bt.length-1;at&<(null),ct(Pe({index:t},bt[t])),xt(t)})(t?M:D):Ct(n)},Mt=e=>{if(x)return;rt||Ot();const t="INPUT"!==e.currentTarget.tagName;nt?t&&(nt&&ot(!1),et&&tt("")):Se&&Ct(z),t&&e.preventDefault()},kt=c((e=>{null==V||V(e),it(!1),ot(!1),tt("")}),[V]),zt=c((e=>{null==Y||Y(e),it(!0)}),[Y]),Lt=c((e=>{const t=e.currentTarget.value||"";Ye.current=!0,null==X||X(t),!He.current&&ot(!0),tt(t)}),[X]),Nt=c((e=>{$(e),ht(T),Ot()}),[]),jt=c((e=>{$(e,"mousedown"===e.type),Ot(),He.current?ot(!1):Ct(z)}),[Ct]),Pt=!Ie||Ie&&nt,Tt=x||!xe||!!at,Vt=!(!A||x||!R(gt)),At=x||Se?void 0:jt;return t.createElement(f,{theme:dt},t.createElement(Te,{id:s,"aria-controls":r,"aria-expanded":nt,onKeyDown:e=>{if(x)return;if(h&&(h(e,et,st),e.defaultPrevented))return;const{key:t}=e;switch(t){case"ArrowDown":case"ArrowUp":Dt(t);break;case"ArrowLeft":case"ArrowRight":if(!n||et||ue)return;(e=>{if(!R(gt))return;let t=-1;const n=gt.length-1,o=at?gt.findIndex((e=>e.value===at)):-1;t=e===S?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const r=t>=0?gt[t].value:null;st.data&&ct(P),r!==at&<(r)})("ArrowLeft"===t?E:S);break;case" ":if(et)return;if(nt){if(!st.data)return;Et()}else Ct(z);break;case"Enter":nt&&229!==e.keyCode&&Et();break;case"Escape":nt&&(ot(!1),tt(""));break;case"Tab":if(!nt||!De||!st.data||e.shiftKey)return;Et();break;case"Delete":case"Backspace":if(et)return;if(at){const e=gt.findIndex((e=>e.value===at)),t=e>-1&&e<gt.length-1?gt[e+1].value:null;It(at),lt(t)}else{if(!ze)return;if(!R(gt))break;if(n&&!ue){const{value:e}=gt[gt.length-1];It(e)}else A&&ht(T)}break;default:return}e.preventDefault()}},t.createElement(Ae,{ref:_e,isInvalid:y,isFocused:rt,isDisabled:x,className:"rfs-control-container",onTouchEnd:Mt,onMouseDown:Mt},t.createElement(Ve,null,t.createElement(me,{isMulti:n,inputValue:et,placeholder:Fe,selectedOption:gt,focusedMultiValue:at,renderOptionLabel:mt,renderMultiOptions:ue,removeSelectedOption:It}),t.createElement(Oe,{id:r,ref:Ze,required:u,ariaLabel:w,inputValue:et,readOnly:Tt,onBlur:kt,onFocus:zt,onChange:Lt,ariaLabelledBy:G,selectedOption:gt})),t.createElement(Ne,{menuOpen:nt,clearIcon:b,caretIcon:v,isInvalid:y,isLoading:g,showClear:Vt,isDisabled:x,loadingNode:H,onClearMouseDown:Nt,onCaretMouseDown:At})),Pt&&t.createElement(re,{menuRef:Qe,menuOpen:nt,isLoading:g,menuTop:vt,height:yt,itemSize:We,loadingMsg:Re,menuOptions:bt,fixedSizeListRef:Je,noOptionsMsg:$e,selectOption:St,direction:ce,itemKeySelector:ne,overscanCount:le,menuPortalTarget:ie,width:O||dt.menu.width,onMenuMouseDown:e=>{$(e),Ot()},renderOptionLabel:mt,focusedOptionIndex:st.index}),ae&&t.createElement(Ce,{ariaLive:p,menuOpen:nt,isFocused:rt,ariaLabel:w,inputValue:et,isSearchable:xe,focusedOption:st,selectedOption:gt,optionCount:bt.length})))}));Be.displayName="Select";export{Be as Select}; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("styled-components"),require("react-window"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","styled-components","react-window","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactFunctionalSelect={},e.React,e.styled,e.ReactWindow,e.ReactDOM)}(this,(function(e,t,n,o,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=i(t),l=i(n);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const d="rfs-option",c="rfs-option-focused",u="rfs-option-selected",p="rfs-option-disabled",f={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container","data-testid":undefined},m={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input","data-testid":undefined},g="top",h="auto",b="bottom",y="any",v=0,w=1,O=0,x=1,C=2,S=3,E=n.keyframes(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),I=n.css([""," 0.2s ease-out both"],n.keyframes(["from{opacity:0;}to{opacity:1;}"])),M={index:-1},k=[],D={color:{border:"#ced4da",danger:"#dc3545",primary:"#007bff",disabled:"#e9ecef",placeholder:"#6E7276",dangerLight:"rgba(220, 53, 69, 0.25)"},input:{},select:{},loader:{size:"0.625rem",padding:"0.375rem 0.75rem",animation:n.css([""," 1.19s ease-in-out infinite"],E),color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 0.9375rem",clear:{width:"14px",height:"16px",animation:I,transition:"color 0.2s ease-out"},caret:{size:"7px",transition:"transform 0.3s ease-in-out, color 0.2s ease-out"}},control:{minHeight:"38px",borderWidth:"1px",borderStyle:"solid",borderRadius:"3px",boxShadow:"0 0 0 0.2rem",padding:"0.375rem 0.75rem",boxShadowColor:"rgba(0, 123, 255, 0.25)",focusedBorderColor:"rgba(0, 123, 255, 0.75)",transition:"box-shadow 0.2s ease-out, border-color 0.2s ease-out"},menu:{padding:"0",width:"100%",margin:"0.5rem 0",borderRadius:"3px",backgroundColor:"#fff",animation:I,boxShadow:"0 0.5em 1em -0.125em rgb(10 10 10 / 12%), 0 0 0 1px rgb(10 10 10 / 4%)",option:{textAlign:"left",selectedColor:"#fff",selectedBgColor:"#007bff",padding:"0.375rem 0.75rem",focusedBgColor:"rgba(0, 123, 255, 0.15)"}},noOptions:{fontSize:"1.25rem",margin:"0.25rem 0",color:"hsl(0, 0%, 60%)",padding:"0.375rem 0.75rem"},multiValue:{margin:"1px 2px",borderRadius:"3px",backgroundColor:"#e7edf3",animation:I,label:{borderRadius:"3px",fontSize:"0.825em",padding:"1px 0 1px 6px"},clear:{fontWeight:600,padding:"0 6px",color:"#a6a6a6",fontSize:"0.65em",alignSelf:"center",focusColor:"#808080",transition:"color 0.2s ease-out, transform 0.2s ease-out, z-index 0.2s ease-out"}}};function j(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}const L=/[\u0300-\u036f]/g;function N(e){return"boolean"==typeof e}function P(e){return Array.isArray(e)&&!!e.length}function R(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}const T=(e,t=!0)=>{t&&e.preventDefault(),e.stopPropagation()};function V(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(L,"")}(o):o}const A=(e,t,n)=>{const o=Array.isArray(e)?e:R(e)?[e]:k;return P(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},F=(e,t)=>{const n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e);return Object.keys(t).forEach((o=>{const r=t[o];n[o]="animation"!==o&&R(r)?e[o]?F(e[o],r):r:r||""})),n};function B(e){return $(e)?window.pageYOffset:e.scrollTop}function $(e){return e===document.documentElement||e===document.body||e===window}const q=/(auto|scroll)/;function W({overflow:e,overflowX:t,overflowY:n}){return q.test(`${e}${t}${n}`)}function K(e){let t=getComputedStyle(e);const n=document.documentElement,o="absolute"===t.position;if("fixed"===t.position)return n;for(let n=e;n=null===(r=n)||void 0===r?void 0:r.parentElement;){var r;if(t=getComputedStyle(n),(!o||"static"!==t.position)&&W(t))return n}return n}function H(e,t,n=300,o){let r=0;const i=B(e),a=t-i;requestAnimationFrame((function t(){r+=5;const l=a*((s=(s=r)/n-1)*s*s+1)+i;var s;!function(e,t){$(e)?window.scrollTo(0,t):e.scrollTop=t}(e,l),r<n?requestAnimationFrame(t):null==o||o()}))}const U="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,Y="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent),_=t.memo((({index:e,style:t,data:{menuOptions:n,selectOption:o,renderOptionLabel:r,focusedOptionIndex:i}})=>{const{data:l,value:s,label:c,isDisabled:u,isSelected:p}=n[e],f=function(e,t,n){let o=d;return e&&(o+=" rfs-option-disabled"),t&&(o+=" rfs-option-selected"),n&&(o+=" rfs-option-focused"),o}(u,p,e===i);return a.default.createElement("div",{style:t,onClick:u?void 0:()=>o({data:l,value:s,label:c},p),className:f},r(l))}),o.areEqual);_.displayName="Option";const X=l.default.div.withConfig({displayName:"NoOptionsMsg",componentId:"v1y124-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(({theme:e})=>e.noOptions.color),(({theme:e})=>e.noOptions.margin),(({theme:e})=>e.noOptions.padding),(({theme:e})=>e.noOptions.fontSize),(({theme:e})=>e.noOptions.css)),G=({width:e,height:n,itemSize:r,direction:i,isLoading:l,loadingMsg:s,menuOptions:d,selectOption:c,noOptionsMsg:u,overscanCount:p,itemKeySelector:f,fixedSizeListRef:m,renderOptionLabel:g,focusedOptionIndex:h})=>{const b=t.useMemo((()=>({menuOptions:d,selectOption:c,renderOptionLabel:g,focusedOptionIndex:h})),[d,h,c,g]);if(l)return a.default.createElement(X,null,s);return a.default.createElement(t.Fragment,null,a.default.createElement(o.FixedSizeList,{width:e,height:n,itemKey:f?(e,t)=>t.menuOptions[e][f]:void 0,itemSize:r,itemData:b,direction:i,ref:m,overscanCount:p,itemCount:d.length},_),!P(d)&&u&&a.default.createElement(X,null,u))},J=l.default.div.withConfig({displayName:"MenuWrapper",componentId:"yf5myu-0"})(["z-index:999;cursor:default;position:absolute;"," "," .","{display:block;overflow:hidden;user-select:none;white-space:nowrap;text-overflow:ellipsis;-webkit-tap-highlight-color:transparent;","}"],(({menuTop:e,menuOpen:t,hideNoOptionsMsg:o,theme:{menu:r}})=>n.css(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],r.width,r.margin,r.padding,r.animation,r.borderRadius,r.backgroundColor,o?"none":r.boxShadow,t?"":"display: none;",e?`top: ${e};`:"")),(({theme:e})=>e.menu.css),d,(({theme:{menu:{option:e}}})=>n.css(["padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}"],e.padding,e.textAlign,c,p,u,e.focusedBgColor,u,e.selectedColor,e.selectedBgColor,p))),Q=e=>{let{menuRef:t,menuTop:n,menuOpen:o,onMenuMouseDown:i,menuPortalTarget:l}=e,s=j(e,["menuRef","menuTop","menuOpen","onMenuMouseDown","menuPortalTarget"]);const{menuOptions:d,noOptionsMsg:c}=s,u=o&&!Boolean(c)&&!P(d),p=a.default.createElement(J,{ref:t,menuTop:n,menuOpen:o,onMouseDown:i,className:"rfs-menu-container","data-testid":undefined,hideNoOptionsMsg:u},a.default.createElement(G,Object.assign({},s)));return l?r.createPortal(p,l):p},Z=n.css(["z-index:5000;transform:scale(1.26);color:",";"],(({theme:e})=>e.multiValue.clear.focusColor)),ee=l.default.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-211cx7-0"})(["min-width:0;display:flex;"," ",""],(({theme:{multiValue:e}})=>n.css(["margin:",";animation:",";border-radius:",";background-color:",";"],e.margin,e.animation,e.borderRadius,e.backgroundColor)),(({theme:e})=>e.multiValue.css)),te=l.default.div.withConfig({displayName:"Label",componentId:"sc-211cx7-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(({theme:e})=>e.multiValue.label.padding),(({theme:e})=>e.multiValue.label.fontSize),(({theme:e})=>e.multiValue.label.borderRadius)),ne=l.default.i.withConfig({displayName:"Clear",componentId:"sc-211cx7-2"})(["display:flex;font-style:inherit;"," ",""],(({theme:{multiValue:{clear:e}}})=>n.css(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";:hover{","}"],e.color,e.padding,e.fontSize,e.alignSelf,e.transition,e.fontWeight,Z)),(({isFocused:e})=>e&&Z)),oe=t.memo((({data:e,value:t,isFocused:n,renderOptionLabel:o,removeSelectedOption:r})=>a.default.createElement(ee,null,a.default.createElement(te,null,o(e)),a.default.createElement(ne,{isFocused:n,"data-testid":undefined,onMouseDown:T,onClick:()=>r(t),onTouchEnd:()=>r(t)},"✖"))));oe.displayName="MultiValue";const re=n.css(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),ie=l.default.div.withConfig({displayName:"SingleValue",componentId:"sc-153h0ct-0"})([""," max-width:calc(100% - 0.5rem);"],re),ae=l.default.div.withConfig({displayName:"Placeholder",componentId:"sc-153h0ct-1"})([""," color:",";",""],re,(({theme:e})=>e.color.placeholder),(({theme:e,isMulti:t})=>t&&n.css(["animation:",";"],e.multiValue.animation))),le=({isMulti:e,inputValue:n,placeholder:o,selectedOption:r,focusedMultiValue:i,renderOptionLabel:l,renderMultiOptions:s,removeSelectedOption:d})=>!n||e&&(!e||P(r)&&!s)?P(r)?e?a.default.createElement(t.Fragment,null,s?s({renderOptionLabel:l,selected:r}):r.map((({data:e,value:t})=>a.default.createElement(oe,{key:t,data:e,value:t,renderOptionLabel:l,isFocused:t===i,removeSelectedOption:d})))):a.default.createElement(ie,null,l(r[0].data)):a.default.createElement(ae,{isMulti:e},o):null;function se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function de(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?se(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):se(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const ce=(e,n,o,r,i,a,l,s,d,c,u,p,f)=>{const[m,g]=t.useState(k),h=f?"":n,b=N(p)?p:!!u;return t.useEffect((()=>{const t=V(h,d,c),n=r.length?new Set(r.map((e=>e.value))):void 0,u=l||(e=>!!e.isDisabled),p=s||(e=>"string"==typeof e.label?e.label:`${e.label}`),f=e=>{const r=i(e),l=de(de({data:e,value:r,label:a(e)},u(e)&&{isDisabled:!0}),(null==n?void 0:n.has(r))&&{isSelected:!0});if(!(t&&!(e=>{const n=V(p(e),d,c);return o===y?n.indexOf(t)>-1:n.substr(0,t.length)===t})(l)||b&&l.isSelected))return l},{length:m}=e,v=[];for(let t=0;t<m;t++){const n=f(e[t]);n&&v.push(n)}g(v)}),[e,r,h,b,o,d,c,s,l,i,a]),m},ue=(e,n)=>{const o=t.useRef(!0);t.useEffect((()=>{if(!o.current)return e();o.current=!1}),n)},pe=(e,n,o,r,i,a,l,s,d,c,u,p)=>{const f=t.useRef(!1),m=t.useRef(!s),[b,y]=t.useState(a),[v,w]=t.useState(!1);t.useEffect((()=>{m.current=!v&&!s}),[v,s]),t.useEffect((()=>{const t=r===g||r===h&&!(e=>{if(!e)return!0;const t=K(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-B(t)-n>=o})(e.current);w(t)}),[e,r]),ue((()=>{if(o){const t=e=>{null==u||u(),e&&(f.current=!0,y(e))};m.current?((e,t,n,o)=>{if(!e)return void o();const{top:r,height:i,bottom:a}=e.getBoundingClientRect(),l=window.innerHeight;if(l-r>=i)return void o();const s=K(e),d=B(s),c=s.getBoundingClientRect().height-d-r,u=c<i;if(u||!n)return void o(u?c:void 0);H(s,a-l+d+parseInt(getComputedStyle(e).marginBottom,10),t,o)})(e.current,d,c,t):t()}else null==p||p(),f.current&&(f.current=!1,y(a))}),[e,o,p,u,a,c,d]);const O=Math.min(b,l*i);return[v?((e,t,n)=>{const o=e>0||!t?e:t.getBoundingClientRect().height,r=n?n.getBoundingClientRect().height:0,i=t&&getComputedStyle(t),a=i?parseInt(i.marginBottom,10):0,l=i?parseInt(i.marginTop,10):0;return"calc("+-Math.abs(o+r)+"px + "+(a+l)+"px)"})(O,e.current,n.current):void 0,O]},fe=l.default.div.withConfig({displayName:"SizerDiv",componentId:"o2ype2-0"})(["top:0;left:0;height:0;overflow:scroll;white-space:pre;position:absolute;visibility:hidden;font-size:inherit;font-weight:inherit;font-family:inherit;",""],(({theme:e})=>e.input.css)),me=l.default.input.attrs(m).withConfig({displayName:"Input",componentId:"o2ype2-1"})(["border:0;outline:0;padding:0;cursor:text;background:0;color:inherit;font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:content-box;:read-only{opacity:0;cursor:default;}:required{","}"," ",""],(({theme:e,isInvalid:t})=>t&&e.input.cssRequired),(({theme:e})=>e.input.css),Y&&"::-ms-clear{display:none;}"),ge=t.memo(t.forwardRef((({id:e,onBlur:n,onFocus:o,readOnly:r,required:i,onChange:l,ariaLabel:s,inputValue:d,ariaLabelledBy:c,selectedOption:u},p)=>{const f=t.useRef(null),[m,g]=t.useState(2),h=!!i&&!P(u);return ue((()=>{f.current&&g(f.current.scrollWidth+2)}),[d]),a.default.createElement(t.Fragment,null,a.default.createElement(me,{id:e,ref:p,isInvalid:!0,onBlur:n,onFocus:o,value:d,readOnly:r,required:h,"aria-label":s,style:{width:m},"aria-labelledby":c,onChange:r?void 0:l}),a.default.createElement(fe,{ref:f},d))})));ge.displayName="AutosizeInput";const he=l.default.span.withConfig({displayName:"A11yText",componentId:"zxgkbx-0"})(["border:0;padding:0;width:1px;height:1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(1px,1px,1px,1px);"]),be=({menuOpen:e,isFocused:t,inputValue:n,optionCount:o,isSearchable:r,focusedOption:i,selectedOption:l,ariaLive:s="polite",ariaLabel:d="Select"})=>{if(!t)return null;const c=` ${o} result(s) available${n?" for search input "+n:""}.`,u=e?"Use Up and Down arrow keys to choose options, press Enter or Tab to select the currently focused option, press Escape to close the menu.":`${d} is focused${r?", type to filter options":""}, press Down arrow key to open the menu.`,{index:p,value:f,label:m,isDisabled:g}=i,h=f?`Focused option: ${m}${g?" - disabled":""}, ${p+1} of ${o}.`:"",b=l.length?l.map((e=>e.label)).join(" "):"N/A";return a.default.createElement(he,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},a.default.createElement("span",{id:"aria-selection"},"Selected option: "+b),a.default.createElement("span",{id:"aria-context"},h+c+u))},ye=l.default.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1j9e0pa-0"})(["display:flex;align-self:center;text-align:center;margin-right:0.25rem;padding:",";> div{border-radius:100%;display:inline-block;",":nth-of-type(1){animation-delay:-0.272s;}:nth-of-type(2){animation-delay:-0.136s;}}"],(({theme:e})=>e.loader.padding),(({theme:{loader:e}})=>n.css(["width:",";height:",";animation:",";background-color:",";"],e.size,e.size,e.animation,e.color))),ve=()=>a.default.createElement(ye,{"aria-hidden":!0,className:"rfs-loading-dots"},a.default.createElement("div",null),a.default.createElement("div",null),a.default.createElement("div",null)),we=l.default.svg.withConfig({displayName:"ClearSvg",componentId:"sc-1v5ipi2-0"})(["fill:currentColor;",""],(({theme:e})=>n.css(["width:",";height:",";animation:",";transition:",";"],e.icon.clear.width,e.icon.clear.height,e.icon.clear.animation,e.icon.clear.transition))),Oe=()=>a.default.createElement(we,{"aria-hidden":!0,viewBox:"0 0 14 16",className:"rfs-clear-icon"},a.default.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})),xe=l.default.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1561oeb-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),Ce=l.default.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1561oeb-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(({theme:e})=>e.icon.color),(({theme:e})=>e.icon.padding),(({theme:e})=>e.icon.hoverColor),(({theme:e})=>e.icon.css)),Se=l.default.div.withConfig({displayName:"Caret",componentId:"sc-1561oeb-2"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(({theme:e})=>e.icon.caret.transition),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e,menuOpen:t,isInvalid:o})=>t&&n.css(["transform:rotate(180deg);color:",";"],o?e.color.danger:e.color.caretActive||e.color.primary))),Ee=l.default.div.withConfig({displayName:"Separator",componentId:"sc-1561oeb-3"})(["width:1px;margin:0.5rem 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(({theme:e})=>e.color.iconSeparator||e.color.border)),Ie=t.memo((({menuOpen:e,clearIcon:t,caretIcon:n,isInvalid:o,showClear:r,isLoading:i,isDisabled:l,loadingNode:s,onCaretMouseDown:d,onClearMouseDown:c})=>{const u=t=>"function"==typeof t?t({menuOpen:e,isLoading:i,isInvalid:o,isDisabled:l}):t;return a.default.createElement(xe,null,r&&!i&&a.default.createElement(Ce,{onTouchEnd:c,onMouseDown:c,"data-testid":undefined},u(t)||a.default.createElement(Oe,null)),i&&(s||a.default.createElement(ve,null)),a.default.createElement(Ee,null),a.default.createElement(Ce,{onTouchEnd:d,onMouseDown:d,"data-testid":undefined},u(n)||a.default.createElement(Se,{"aria-hidden":!0,menuOpen:e,isInvalid:o,className:"rfs-caret-icon"})))}));function Me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ke(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}Ie.displayName="IndicatorIcons";const De=l.default.div.attrs(f).withConfig({displayName:"SelectWrapper",componentId:"kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(({theme:e})=>e.select.css)),je=l.default.div.withConfig({displayName:"ValueWrapper",componentId:"kcrmu9-1"})(["flex:1 1 0%;display:flex;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;padding:",";"],(({theme:e})=>e.control.padding)),ze=l.default.div.withConfig({displayName:"ControlWrapper",componentId:"kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(({isDisabled:e,isFocused:t,isInvalid:o,theme:{control:r,color:i}})=>n.css(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],r.transition,r.borderStyle,r.borderWidth,r.borderRadius,r.height||r.minHeight,o?i.danger:t?r.focusedBorderColor:i.border,r.height?`height: ${r.height};`:"",e?"pointer-events:none;user-select:none;":"",r.backgroundColor||e?`background-color: ${e?i.disabled:r.backgroundColor};`:"",t?`box-shadow: ${r.boxShadow} ${o?i.dangerLight:r.boxShadowColor};`:"")),(({theme:e})=>e.control.css),(({isFocused:e,theme:t})=>e&&t.control.focusedCss)),Le=t.forwardRef((({async:e,isMulti:o,inputId:r,selectId:i,required:l,ariaLive:s,autoFocus:d,isLoading:c,onKeyDown:u,clearIcon:p,caretIcon:f,isInvalid:m,ariaLabel:g,menuWidth:h,isDisabled:E,inputDelay:I,onMenuOpen:j,onMenuClose:z,onInputBlur:L,isClearable:V,themeConfig:B,loadingNode:$,initialValue:q,onInputFocus:W,onInputChange:K,ariaLabelledBy:H,onOptionChange:Y,onSearchChange:_,getOptionLabel:X,getOptionValue:G,itemKeySelector:J,openMenuOnFocus:Z,menuPortalTarget:ee,isAriaLiveEnabled:te,menuOverscanCount:ne,blurInputOnSelect:oe,menuItemDirection:re,renderOptionLabel:ie,renderMultiOptions:ae,menuScrollDuration:se,filterIgnoreAccents:de,hideSelectedOptions:fe,getIsOptionDisabled:me,getFilterOptionString:he,isSearchable:ye=!0,lazyLoadMenu:ve=!1,openMenuOnClick:we=!0,filterIgnoreCase:Oe=!0,tabSelectsOption:xe=!0,closeMenuOnSelect:Ce=!0,scrollMenuIntoView:Se=!0,backspaceClearsValue:Ee=!0,filterMatchFrom:Me=y,menuPosition:Le=b,options:Ne=k,loadingMsg:Pe="Loading..",placeholder:Re="Select option..",noOptionsMsg:Te="No options",menuItemSize:Ve=35,menuMaxHeight:Ae=300},Fe)=>{const Be=t.useRef(!1),$e=t.useRef(),qe=t.useRef(!1),We=t.useRef(null),Ke=t.useRef(null),He=t.useRef(null),Ue=t.useRef(null),[Ye,_e]=t.useState(""),[Xe,Ge]=t.useState(!1),[Je,Qe]=t.useState(!1),[Ze,et]=t.useState(null),[tt,nt]=t.useState(M),ot=t.useMemo((()=>R(B)?F(D,B):D),[B]),rt=t.useMemo((()=>X||(e=>e.label)),[X]),it=t.useMemo((()=>G||(e=>e.value)),[G]),at=t.useMemo((()=>ie||rt),[ie,rt]),lt=((e,n=0)=>{const[o,r]=t.useState(e);return t.useEffect((()=>{if(n<=0)return;const t=setTimeout((()=>{r(e)}),n);return()=>{clearTimeout(t)}}),[e,n]),n<=0?e:o})(Ye,I),[st,dt]=t.useState((()=>A(q,it,rt))),ct=ce(Ne,lt,Me,st,it,rt,me,he,Oe,de,o,fe,e),[ut,pt]=pe(Ke,Ue,Xe,Le,Ve,Ae,ct.length,!!ee,se,Se,j,z),ft=()=>{var e;return null===(e=He.current)||void 0===e?void 0:e.blur()},mt=()=>{var e;return null===(e=He.current)||void 0===e?void 0:e.focus()},gt=e=>{var t;return null===(t=We.current)||void 0===t?void 0:t.scrollToItem(e)},ht=t.useCallback((e=>{if(!P(ct))return void(!Be.current&&Ge(!0));const t=o?-1:ct.findIndex((e=>e.isSelected)),n=t>-1?t:e===S?0:ct.length-1;!Be.current&&Ge(!0),nt(ke({index:n},ct[n])),gt(n)}),[o,ct]),bt=t.useCallback((e=>{dt((t=>t.filter((({value:t})=>t!==e))))}),[]),yt=t.useCallback(((e,t)=>{t?o&&bt(e.value):dt((t=>o?[...t,e]:[e]));(N(oe)?oe:U)?ft():Ce&&(Ge(!1),_e(""))}),[o,Ce,bt,oe]);t.useImperativeHandle(Fe,(()=>({empty:!P(st),menuOpen:Xe,blur:ft,focus:mt,clearValue:()=>{yt.length&&dt(k),tt.data&&nt(M)},setValue:e=>{const t=A(e,it,rt);dt(t)},toggleMenu:e=>{!0===e||void 0===e&&!Xe?(!Je&&mt(),ht(S)):ft()}}))),t.useEffect((()=>{d&&mt()}),[]),t.useEffect((()=>{Be.current=Xe}),[Xe]),t.useEffect((()=>{Je&&Z&&ht(S)}),[Je,Z,ht]),t.useEffect((()=>{_&&qe.current&&(qe.current=!1,_(lt))}),[_,lt]),ue((()=>{if(!Y)return;const e=o?st.map((e=>e.data)):P(st)?st[0].data:null;Y(e)}),[o,st,Y]),ue((()=>{const t=ct.length>0&&(e||ct.length!==Ne.length||0===$e.current);0===ct.length?nt(M):(1===ct.length||t)&&(nt(ke({index:0},ct[0])),gt(0)),$e.current=ct.length}),[e,Ne,ct]);const vt=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:r}=tt;e&&!r&&yt({data:e,value:t,label:n},o)},wt=e=>{const t="ArrowDown"===e,n=t?S:C;Xe?(e=>{if(!P(ct))return;const t=e===x?(tt.index+1)%ct.length:tt.index>0?tt.index-1:ct.length-1;Ze&&et(null),nt(ke({index:t},ct[t])),gt(t)})(t?x:O):ht(n)},Ot=e=>{if(E)return;Je||mt();const t="INPUT"!==e.currentTarget.tagName;Xe?t&&(Xe&&Ge(!1),Ye&&_e("")):we&&ht(S),t&&e.preventDefault()},xt=t.useCallback((e=>{null==L||L(e),Qe(!1),Ge(!1),_e("")}),[L]),Ct=t.useCallback((e=>{null==W||W(e),Qe(!0)}),[W]),St=t.useCallback((e=>{const t=e.currentTarget.value||"";qe.current=!0,null==K||K(t),!Be.current&&Ge(!0),_e(t)}),[K]),Et=t.useCallback((e=>{T(e),dt(k),mt()}),[]),It=t.useCallback((e=>{T(e,"mousedown"===e.type),mt(),Be.current?Ge(!1):ht(S)}),[ht]),Mt=!ve||ve&&Xe,kt=E||!ye||!!Ze,Dt=!(!V||E||!P(st)),jt=E||we?void 0:It;return a.default.createElement(n.ThemeProvider,{theme:ot},a.default.createElement(De,{id:i,"aria-controls":r,"aria-expanded":Xe,onKeyDown:e=>{if(E)return;if(u&&(u(e,Ye,tt),e.defaultPrevented))return;const{key:t}=e;switch(t){case"ArrowDown":case"ArrowUp":wt(t);break;case"ArrowLeft":case"ArrowRight":if(!o||Ye||ae)return;(e=>{if(!P(st))return;let t=-1;const n=st.length-1,o=Ze?st.findIndex((e=>e.value===Ze)):-1;t=e===v?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const r=t>=0?st[t].value:null;tt.data&&nt(M),r!==Ze&&et(r)})("ArrowLeft"===t?w:v);break;case" ":if(Ye)return;if(Xe){if(!tt.data)return;vt()}else ht(S);break;case"Enter":Xe&&229!==e.keyCode&&vt();break;case"Escape":Xe&&(Ge(!1),_e(""));break;case"Tab":if(!Xe||!xe||!tt.data||e.shiftKey)return;vt();break;case"Delete":case"Backspace":if(Ye)return;if(Ze){const e=st.findIndex((e=>e.value===Ze)),t=e>-1&&e<st.length-1?st[e+1].value:null;bt(Ze),et(t)}else{if(!Ee)return;if(!P(st))break;if(o&&!ae){const{value:e}=st[st.length-1];bt(e)}else V&&dt(k)}break;default:return}e.preventDefault()}},a.default.createElement(ze,{ref:Ue,isInvalid:m,isFocused:Je,isDisabled:E,className:"rfs-control-container",onTouchEnd:Ot,onMouseDown:Ot,"data-testid":undefined},a.default.createElement(je,null,a.default.createElement(le,{isMulti:o,inputValue:Ye,placeholder:Re,selectedOption:st,focusedMultiValue:Ze,renderOptionLabel:at,renderMultiOptions:ae,removeSelectedOption:bt}),a.default.createElement(ge,{id:r,ref:He,required:l,ariaLabel:g,inputValue:Ye,readOnly:kt,onBlur:xt,onFocus:Ct,onChange:St,ariaLabelledBy:H,selectedOption:st})),a.default.createElement(Ie,{menuOpen:Xe,clearIcon:p,caretIcon:f,isInvalid:m,isLoading:c,showClear:Dt,isDisabled:E,loadingNode:$,onClearMouseDown:Et,onCaretMouseDown:jt})),Mt&&a.default.createElement(Q,{menuRef:Ke,menuOpen:Xe,isLoading:c,menuTop:ut,height:pt,itemSize:Ve,loadingMsg:Pe,menuOptions:ct,fixedSizeListRef:We,noOptionsMsg:Te,selectOption:yt,direction:re,itemKeySelector:J,overscanCount:ne,menuPortalTarget:ee,width:h||ot.menu.width,onMenuMouseDown:e=>{T(e),mt()},renderOptionLabel:at,focusedOptionIndex:tt.index}),te&&a.default.createElement(be,{ariaLive:s,menuOpen:Xe,isFocused:Je,ariaLabel:g,inputValue:Ye,isSearchable:ye,focusedOption:tt,selectedOption:st,optionCount:ct.length})))}));Le.displayName="Select",e.Select=Le,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("styled-components"),require("react-window"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","styled-components","react-window","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactFunctionalSelect={},e.React,e.styled,e.ReactWindow,e.ReactDOM)}(this,(function(e,t,n,o,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=i(t),l=i(n);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const c="rfs-option",d="rfs-option-focused",u="rfs-option-selected",p="rfs-option-disabled",f={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container","data-testid":undefined},m={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input","data-testid":undefined},g="top",h="auto",b="bottom",y="any",v=0,w=1,O=0,x=1,C=2,S=3,E=n.keyframes(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),I=n.css([""," 0.2s ease-out both"],n.keyframes(["from{opacity:0;}to{opacity:1;}"])),M=n.css([""," 1.19s ease-in-out infinite"],E),k={index:-1},D=[];function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}const z=/[\u0300-\u036f]/g;function L(e){return"boolean"==typeof e}function N(e){return Array.isArray(e)&&!!e.length}function R(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}const P=(e,t=!0)=>{t&&e.preventDefault(),e.stopPropagation()};function T(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(z,"")}(o):o}const V=(e,t,n)=>{const o=Array.isArray(e)?e:R(e)?[e]:D;return N(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},A=(e,t)=>{const n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e);return Object.keys(t).forEach((o=>{const r=t[o];n[o]="animation"!==o&&R(r)?e[o]?A(e[o],r):r:r||""})),n};function F(e){return B(e)?window.pageYOffset:e.scrollTop}function B(e){return e===document.documentElement||e===document.body||e===window}const $=/(auto|scroll)/;function q({overflow:e,overflowX:t,overflowY:n}){return $.test(`${e}${t}${n}`)}function W(e){let t=getComputedStyle(e);const n=document.documentElement,o="absolute"===t.position;if("fixed"===t.position)return n;for(let n=e;n=null===(r=n)||void 0===r?void 0:r.parentElement;){var r;if(t=getComputedStyle(n),(!o||"static"!==t.position)&&q(t))return n}return n}function K(e,t,n=300,o){let r=0;const i=F(e),a=t-i;requestAnimationFrame((function t(){r+=5;const l=a*((s=(s=r)/n-1)*s*s+1)+i;var s;!function(e,t){B(e)?window.scrollTo(0,t):e.scrollTop=t}(e,l),r<n?requestAnimationFrame(t):null==o||o()}))}const H="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,U="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent),Y={color:{border:"#ced4da",danger:"#dc3545",primary:"#007bff",disabled:"#e9ecef",placeholder:"#6E7276",dangerLight:"rgba(220, 53, 69, 0.25)"},input:{},select:{},loader:{size:"0.625rem",padding:"0.375rem 0.75rem",animation:M,color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 0.9375rem",clear:{width:"14px",height:"16px",animation:I,transition:"color 0.2s ease-out"},caret:{size:"7px",transition:"transform 0.3s ease-in-out, color 0.2s ease-out"}},control:{minHeight:"38px",borderWidth:"1px",borderStyle:"solid",borderRadius:"3px",boxShadow:"0 0 0 0.2rem",padding:"0.375rem 0.75rem",boxShadowColor:"rgba(0, 123, 255, 0.25)",focusedBorderColor:"rgba(0, 123, 255, 0.75)",transition:"box-shadow 0.2s ease-out, border-color 0.2s ease-out"},menu:{padding:"0",width:"100%",margin:"0.5rem 0",borderRadius:"3px",backgroundColor:"#fff",animation:I,boxShadow:"0 0.5em 1em -0.125em rgb(10 10 10 / 12%), 0 0 0 1px rgb(10 10 10 / 4%)",option:{textAlign:"left",selectedColor:"#fff",selectedBgColor:"#007bff",padding:"0.375rem 0.75rem",focusedBgColor:"rgba(0, 123, 255, 0.15)"}},noOptions:{fontSize:"1.25rem",margin:"0.25rem 0",color:"hsl(0, 0%, 60%)",padding:"0.375rem 0.75rem"},multiValue:{margin:"1px 2px",borderRadius:"3px",backgroundColor:"#e7edf3",animation:I,label:{borderRadius:"3px",fontSize:"0.825em",padding:"1px 0 1px 6px"},clear:{fontWeight:600,padding:"0 6px",color:"#a6a6a6",fontSize:"0.65em",alignSelf:"center",focusColor:"#808080",transition:"color 0.2s ease-out, transform 0.2s ease-out, z-index 0.2s ease-out"}}};function _(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}const X=t.memo((({index:e,style:t,data:{menuOptions:n,selectOption:o,renderOptionLabel:r,focusedOptionIndex:i}})=>{const{data:l,value:s,label:d,isDisabled:u,isSelected:p}=n[e],f=function(e,t,n){let o=c;return e&&(o+=" rfs-option-disabled"),t&&(o+=" rfs-option-selected"),n&&(o+=" rfs-option-focused"),o}(u,p,e===i);return a.default.createElement("div",{style:t,onClick:u?void 0:()=>o({data:l,value:s,label:d},p),className:f},r(l))}),o.areEqual);X.displayName="Option";const G=l.default.div.withConfig({displayName:"NoOptionsMsg",componentId:"v1y124-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(({theme:e})=>e.noOptions.color),(({theme:e})=>e.noOptions.margin),(({theme:e})=>e.noOptions.padding),(({theme:e})=>e.noOptions.fontSize),(({theme:e})=>e.noOptions.css)),J=({width:e,height:n,itemSize:r,direction:i,isLoading:l,loadingMsg:s,menuOptions:c,selectOption:d,noOptionsMsg:u,overscanCount:p,itemKeySelector:f,fixedSizeListRef:m,renderOptionLabel:g,focusedOptionIndex:h})=>{const b=t.useMemo((()=>({menuOptions:c,selectOption:d,renderOptionLabel:g,focusedOptionIndex:h})),[c,h,d,g]);if(l)return a.default.createElement(G,null,s);return a.default.createElement(t.Fragment,null,a.default.createElement(o.FixedSizeList,{width:e,height:n,itemKey:f?(e,t)=>t.menuOptions[e][f]:void 0,itemSize:r,itemData:b,direction:i,ref:m,overscanCount:p,itemCount:c.length},X),!N(c)&&u&&a.default.createElement(G,null,u))},Q=l.default.div.withConfig({displayName:"MenuWrapper",componentId:"yf5myu-0"})(["z-index:999;cursor:default;position:absolute;"," "," .","{display:block;overflow:hidden;user-select:none;white-space:nowrap;text-overflow:ellipsis;-webkit-tap-highlight-color:transparent;","}"],(({menuTop:e,menuOpen:t,hideNoOptionsMsg:o,theme:{menu:r}})=>n.css(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],r.width,r.margin,r.padding,r.animation,r.borderRadius,r.backgroundColor,o?"none":r.boxShadow,t?"":"display: none;",e?`top: ${e};`:"")),(({theme:e})=>e.menu.css),c,(({theme:{menu:{option:e}}})=>n.css(["padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}"],e.padding,e.textAlign,d,p,u,e.focusedBgColor,u,e.selectedColor,e.selectedBgColor,p))),Z=e=>{let{menuRef:t,menuTop:n,menuOpen:o,onMenuMouseDown:i,menuPortalTarget:l}=e,s=_(e,["menuRef","menuTop","menuOpen","onMenuMouseDown","menuPortalTarget"]);const{menuOptions:c,noOptionsMsg:d}=s,u=o&&!Boolean(d)&&!N(c),p=a.default.createElement(Q,{ref:t,menuTop:n,menuOpen:o,onMouseDown:i,className:"rfs-menu-container","data-testid":undefined,hideNoOptionsMsg:u},a.default.createElement(J,Object.assign({},s)));return l?r.createPortal(p,l):p},ee=n.css(["z-index:5000;transform:scale(1.26);color:",";"],(({theme:e})=>e.multiValue.clear.focusColor)),te=l.default.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-211cx7-0"})(["min-width:0;display:flex;"," ",""],(({theme:{multiValue:e}})=>n.css(["margin:",";animation:",";border-radius:",";background-color:",";"],e.margin,e.animation,e.borderRadius,e.backgroundColor)),(({theme:e})=>e.multiValue.css)),ne=l.default.div.withConfig({displayName:"Label",componentId:"sc-211cx7-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(({theme:e})=>e.multiValue.label.padding),(({theme:e})=>e.multiValue.label.fontSize),(({theme:e})=>e.multiValue.label.borderRadius)),oe=l.default.i.withConfig({displayName:"Clear",componentId:"sc-211cx7-2"})(["display:flex;font-style:inherit;"," ",""],(({theme:{multiValue:{clear:e}}})=>n.css(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";:hover{","}"],e.color,e.padding,e.fontSize,e.alignSelf,e.transition,e.fontWeight,ee)),(({isFocused:e})=>e&&ee)),re=t.memo((({data:e,value:t,isFocused:n,renderOptionLabel:o,removeSelectedOption:r})=>a.default.createElement(te,null,a.default.createElement(ne,null,o(e)),a.default.createElement(oe,{isFocused:n,"data-testid":undefined,onMouseDown:P,onClick:()=>r(t),onTouchEnd:()=>r(t)},"✖"))));re.displayName="MultiValue";const ie=n.css(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),ae=l.default.div.withConfig({displayName:"SingleValue",componentId:"sc-153h0ct-0"})([""," max-width:calc(100% - 0.5rem);"],ie),le=l.default.div.withConfig({displayName:"Placeholder",componentId:"sc-153h0ct-1"})([""," color:",";",""],ie,(({theme:e})=>e.color.placeholder),(({theme:e,isMulti:t})=>t&&n.css(["animation:",";"],e.multiValue.animation))),se=({isMulti:e,inputValue:n,placeholder:o,selectedOption:r,focusedMultiValue:i,renderOptionLabel:l,renderMultiOptions:s,removeSelectedOption:c})=>!n||e&&(!e||N(r)&&!s)?N(r)?e?a.default.createElement(t.Fragment,null,s?s({renderOptionLabel:l,selected:r}):r.map((({data:e,value:t})=>a.default.createElement(re,{key:t,data:e,value:t,renderOptionLabel:l,isFocused:t===i,removeSelectedOption:c})))):a.default.createElement(ae,null,l(r[0].data)):a.default.createElement(le,{isMulti:e},o):null;function ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function de(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ce(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ce(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const ue=(e,n,o,r,i,a,l,s,c,d,u,p,f)=>{const[m,g]=t.useState(D),h=f?"":n,b=L(p)?p:!!u;return t.useEffect((()=>{const t=T(h,c,d),n=r.length?new Set(r.map((e=>e.value))):void 0,u=l||(e=>!!e.isDisabled),p=s||(e=>"string"==typeof e.label?e.label:`${e.label}`),f=e=>{const r=i(e),l=de(de({data:e,value:r,label:a(e)},u(e)&&{isDisabled:!0}),(null==n?void 0:n.has(r))&&{isSelected:!0});if(!(t&&!(e=>{const n=T(p(e),c,d);return o===y?n.indexOf(t)>-1:n.substr(0,t.length)===t})(l)||b&&l.isSelected))return l},{length:m}=e,v=[];for(let t=0;t<m;t++){const n=f(e[t]);n&&v.push(n)}g(v)}),[e,r,h,b,o,c,d,s,l,i,a]),m},pe=(e,n)=>{const o=t.useRef(!0);t.useEffect((()=>{if(!o.current)return e();o.current=!1}),n)},fe=(e,n,o,r,i,a,l,s,c,d,u,p)=>{const f=t.useRef(),m=t.useRef(),b=t.useRef(!1),y=t.useRef(!s),[v,w]=t.useState(a),[O,x]=t.useState(!1);t.useEffect((()=>{f.current=u,m.current=p}),[u,p]),t.useEffect((()=>{y.current=!O&&!s}),[O,s]),t.useEffect((()=>{const t=r===g||r===h&&!(e=>{if(!e)return!0;const t=W(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-F(t)-n>=o})(e.current);x(t)}),[e,r]),pe((()=>{if(o){const t=e=>{var t;null===(t=f.current)||void 0===t||t.call(f),e&&(b.current=!0,w(e))};y.current?((e,t,n,o)=>{if(!e)return void o();const{top:r,height:i,bottom:a}=e.getBoundingClientRect(),l=window.innerHeight;if(l-r>=i)return void o();const s=W(e),c=F(s),d=s.getBoundingClientRect().height-c-r,u=d<i;if(u||!n)return void o(u?d:void 0);K(s,a-l+c+parseInt(getComputedStyle(e).marginBottom,10),t,o)})(e.current,c,d,t):t()}else{var t;null===(t=m.current)||void 0===t||t.call(m),b.current&&(b.current=!1,w(a))}}),[e,o,a,d,c]);const C=Math.min(v,l*i);return[O?((e,t,n)=>{const o=e>0||!t?e:t.getBoundingClientRect().height,r=n?n.getBoundingClientRect().height:0,i=t&&getComputedStyle(t),a=i?parseInt(i.marginBottom,10):0,l=i?parseInt(i.marginTop,10):0;return"calc("+-Math.abs(o+r)+"px + "+(a+l)+"px)"})(C,e.current,n.current):void 0,C]},me=l.default.div.withConfig({displayName:"SizerDiv",componentId:"o2ype2-0"})(["top:0;left:0;height:0;overflow:scroll;white-space:pre;position:absolute;visibility:hidden;font-size:inherit;font-weight:inherit;font-family:inherit;",""],(({theme:e})=>e.input.css)),ge=l.default.input.attrs(m).withConfig({displayName:"Input",componentId:"o2ype2-1"})(["border:0;outline:0;padding:0;cursor:text;background:0;color:inherit;font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:content-box;:read-only{opacity:0;cursor:default;}:required{","}"," ",""],(({theme:e,isInvalid:t})=>t&&e.input.cssRequired),(({theme:e})=>e.input.css),U&&"::-ms-clear{display:none;}"),he=t.memo(t.forwardRef((({id:e,onBlur:n,onFocus:o,readOnly:r,required:i,onChange:l,ariaLabel:s,inputValue:c,ariaLabelledBy:d,selectedOption:u},p)=>{const f=t.useRef(null),[m,g]=t.useState(2),h=!!i&&!N(u);return pe((()=>{f.current&&g(f.current.scrollWidth+2)}),[c]),a.default.createElement(t.Fragment,null,a.default.createElement(ge,{id:e,ref:p,isInvalid:!0,onBlur:n,onFocus:o,value:c,readOnly:r,required:h,"aria-label":s,style:{width:m},"aria-labelledby":d,onChange:r?void 0:l}),a.default.createElement(me,{ref:f},c))})));he.displayName="AutosizeInput";const be=l.default.span.withConfig({displayName:"A11yText",componentId:"zxgkbx-0"})(["border:0;padding:0;width:1px;height:1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(1px,1px,1px,1px);"]),ye=({menuOpen:e,isFocused:t,inputValue:n,optionCount:o,isSearchable:r,focusedOption:i,selectedOption:l,ariaLive:s="polite",ariaLabel:c="Select"})=>{if(!t)return null;const d=` ${o} result(s) available${n?" for search input "+n:""}.`,u=e?"Use Up and Down arrow keys to choose options, press Enter or Tab to select the currently focused option, press Escape to close the menu.":`${c} is focused${r?", type to filter options":""}, press Down arrow key to open the menu.`,{index:p,value:f,label:m,isDisabled:g}=i,h=f?`Focused option: ${m}${g?" - disabled":""}, ${p+1} of ${o}.`:"",b=l.length?l.map((e=>e.label)).join(" "):"N/A";return a.default.createElement(be,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},a.default.createElement("span",{id:"aria-selection"},"Selected option: "+b),a.default.createElement("span",{id:"aria-context"},h+d+u))},ve=l.default.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1j9e0pa-0"})(["display:flex;align-self:center;text-align:center;margin-right:0.25rem;padding:",";> div{border-radius:100%;display:inline-block;",":nth-of-type(1){animation-delay:-0.272s;}:nth-of-type(2){animation-delay:-0.136s;}}"],(({theme:e})=>e.loader.padding),(({theme:{loader:e}})=>n.css(["width:",";height:",";animation:",";background-color:",";"],e.size,e.size,e.animation,e.color))),we=()=>a.default.createElement(ve,{"aria-hidden":!0,className:"rfs-loading-dots"},a.default.createElement("div",null),a.default.createElement("div",null),a.default.createElement("div",null)),Oe=l.default.svg.withConfig({displayName:"ClearSvg",componentId:"sc-1v5ipi2-0"})(["fill:currentColor;",""],(({theme:e})=>n.css(["width:",";height:",";animation:",";transition:",";"],e.icon.clear.width,e.icon.clear.height,e.icon.clear.animation,e.icon.clear.transition))),xe=()=>a.default.createElement(Oe,{"aria-hidden":!0,viewBox:"0 0 14 16",className:"rfs-clear-icon"},a.default.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})),Ce=l.default.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1561oeb-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),Se=l.default.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1561oeb-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(({theme:e})=>e.icon.color),(({theme:e})=>e.icon.padding),(({theme:e})=>e.icon.hoverColor),(({theme:e})=>e.icon.css)),Ee=l.default.div.withConfig({displayName:"Caret",componentId:"sc-1561oeb-2"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(({theme:e})=>e.icon.caret.transition),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e,menuOpen:t,isInvalid:o})=>t&&n.css(["transform:rotate(180deg);color:",";"],o?e.color.danger:e.color.caretActive||e.color.primary))),Ie=l.default.div.withConfig({displayName:"Separator",componentId:"sc-1561oeb-3"})(["width:1px;margin:0.5rem 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(({theme:e})=>e.color.iconSeparator||e.color.border)),Me=t.memo((({menuOpen:e,clearIcon:t,caretIcon:n,isInvalid:o,showClear:r,isLoading:i,isDisabled:l,loadingNode:s,onCaretMouseDown:c,onClearMouseDown:d})=>{const u=t=>"function"==typeof t?t({menuOpen:e,isLoading:i,isInvalid:o,isDisabled:l}):t;return a.default.createElement(Ce,null,r&&!i&&a.default.createElement(Se,{onTouchEnd:d,onMouseDown:d,"data-testid":undefined},u(t)||a.default.createElement(xe,null)),i&&(s||a.default.createElement(we,null)),a.default.createElement(Ie,null),a.default.createElement(Se,{onTouchEnd:c,onMouseDown:c,"data-testid":undefined},u(n)||a.default.createElement(Ee,{"aria-hidden":!0,menuOpen:e,isInvalid:o,className:"rfs-caret-icon"})))}));function ke(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function De(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ke(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ke(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}Me.displayName="IndicatorIcons";const je=l.default.div.attrs(f).withConfig({displayName:"SelectWrapper",componentId:"kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(({theme:e})=>e.select.css)),ze=l.default.div.withConfig({displayName:"ValueWrapper",componentId:"kcrmu9-1"})(["flex:1 1 0%;display:flex;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;padding:",";"],(({theme:e})=>e.control.padding)),Le=l.default.div.withConfig({displayName:"ControlWrapper",componentId:"kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(({isDisabled:e,isFocused:t,isInvalid:o,theme:{control:r,color:i}})=>n.css(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],r.transition,r.borderStyle,r.borderWidth,r.borderRadius,r.height||r.minHeight,o?i.danger:t?r.focusedBorderColor:i.border,r.height?`height: ${r.height};`:"",e?"pointer-events:none;user-select:none;":"",r.backgroundColor||e?`background-color: ${e?i.disabled:r.backgroundColor};`:"",t?`box-shadow: ${r.boxShadow} ${o?i.dangerLight:r.boxShadowColor};`:"")),(({theme:e})=>e.control.css),(({isFocused:e,theme:t})=>e&&t.control.focusedCss)),Ne=t.forwardRef((({async:e,isMulti:o,inputId:r,selectId:i,required:l,ariaLive:s,autoFocus:c,isLoading:d,onKeyDown:u,clearIcon:p,caretIcon:f,isInvalid:m,ariaLabel:g,menuWidth:h,isDisabled:E,inputDelay:I,onMenuOpen:M,onMenuClose:j,onInputBlur:z,isClearable:T,themeConfig:F,loadingNode:B,initialValue:$,onInputFocus:q,onInputChange:W,ariaLabelledBy:K,onOptionChange:U,onSearchChange:_,getOptionLabel:X,getOptionValue:G,itemKeySelector:J,openMenuOnFocus:Q,menuPortalTarget:ee,isAriaLiveEnabled:te,menuOverscanCount:ne,blurInputOnSelect:oe,menuItemDirection:re,renderOptionLabel:ie,renderMultiOptions:ae,menuScrollDuration:le,filterIgnoreAccents:ce,hideSelectedOptions:de,getIsOptionDisabled:me,getFilterOptionString:ge,isSearchable:be=!0,lazyLoadMenu:ve=!1,openMenuOnClick:we=!0,filterIgnoreCase:Oe=!0,tabSelectsOption:xe=!0,closeMenuOnSelect:Ce=!0,scrollMenuIntoView:Se=!0,backspaceClearsValue:Ee=!0,filterMatchFrom:Ie=y,menuPosition:ke=b,options:Ne=D,loadingMsg:Re="Loading..",placeholder:Pe="Select option..",noOptionsMsg:Te="No options",menuItemSize:Ve=35,menuMaxHeight:Ae=300},Fe)=>{const Be=t.useRef(!1),$e=t.useRef(),qe=t.useRef(!1),We=t.useRef(),Ke=t.useRef(),He=t.useRef(null),Ue=t.useRef(null),Ye=t.useRef(null),_e=t.useRef(null),[Xe,Ge]=t.useState(""),[Je,Qe]=t.useState(!1),[Ze,et]=t.useState(!1),[tt,nt]=t.useState(null),[ot,rt]=t.useState(k),it=t.useMemo((()=>R(F)?A(Y,F):Y),[F]),at=t.useMemo((()=>X||(e=>e.label)),[X]),lt=t.useMemo((()=>G||(e=>e.value)),[G]),st=t.useMemo((()=>ie||at),[ie,at]),ct=((e,n=0)=>{const[o,r]=t.useState(e);return t.useEffect((()=>{if(n<=0)return;const t=setTimeout((()=>{r(e)}),n);return()=>{clearTimeout(t)}}),[e,n]),n<=0?e:o})(Xe,I),[dt,ut]=t.useState((()=>V($,lt,at))),pt=ue(Ne,ct,Ie,dt,lt,at,me,ge,Oe,ce,o,de,e),[ft,mt]=fe(Ue,_e,Je,ke,Ve,Ae,pt.length,!!ee,le,Se,M,j),gt=()=>{var e;return null===(e=Ye.current)||void 0===e?void 0:e.blur()},ht=()=>{var e;return null===(e=Ye.current)||void 0===e?void 0:e.focus()},bt=e=>{var t;return null===(t=He.current)||void 0===t?void 0:t.scrollToItem(e)},yt=t.useCallback((e=>{if(!N(pt))return void(!Be.current&&Qe(!0));const t=o?-1:pt.findIndex((e=>e.isSelected)),n=t>-1?t:e===S?0:pt.length-1;!Be.current&&Qe(!0),rt(De({index:n},pt[n])),bt(n)}),[o,pt]),vt=t.useCallback((e=>{ut((t=>t.filter((t=>t.value!==e))))}),[]),wt=t.useCallback(((e,t)=>{t?o&&vt(e.value):ut((t=>o?[...t,e]:[e]));(L(oe)?oe:H)?gt():Ce&&(Qe(!1),Ge(""))}),[o,Ce,vt,oe]);t.useImperativeHandle(Fe,(()=>({empty:!N(dt),menuOpen:Je,blur:gt,focus:ht,clearValue:()=>{wt.length&&ut(D),ot.data&&rt(k)},setValue:e=>{const t=V(e,lt,at);ut(t)},toggleMenu:e=>{!0===e||void 0===e&&!Je?(!Ze&&ht(),yt(S)):gt()}}))),t.useEffect((()=>{c&&ht()}),[]),t.useEffect((()=>{Be.current=Je}),[Je]),t.useEffect((()=>{Ke.current=U,We.current=_}),[U,_]),t.useEffect((()=>{Ze&&Q&&yt(S)}),[Ze,Q,yt]),t.useEffect((()=>{const{current:e}=We;e&&qe.current&&(qe.current=!1,e(ct))}),[ct]),pe((()=>{const{current:e}=Ke;if(!e)return;e(o?dt.map((e=>e.data)):N(dt)?dt[0].data:null)}),[o,dt]),pe((()=>{const{length:t}=pt,n=t>0&&(e||t!==Ne.length||0===$e.current);0===t?rt(k):(1===t||n)&&(rt(De({index:0},pt[0])),bt(0)),$e.current=t}),[e,Ne,pt]);const Ot=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:r}=ot;e&&!r&&wt({data:e,value:t,label:n},o)},xt=e=>{const t="ArrowDown"===e,n=t?S:C;Je?(e=>{if(!N(pt))return;const t=e===x?(ot.index+1)%pt.length:ot.index>0?ot.index-1:pt.length-1;tt&&nt(null),rt(De({index:t},pt[t])),bt(t)})(t?x:O):yt(n)},Ct=e=>{if(E)return;Ze||ht();const t="INPUT"!==e.currentTarget.tagName;Je?t&&(Je&&Qe(!1),Xe&&Ge("")):we&&yt(S),t&&e.preventDefault()},St=t.useCallback((e=>{null==z||z(e),et(!1),Qe(!1),Ge("")}),[z]),Et=t.useCallback((e=>{null==q||q(e),et(!0)}),[q]),It=t.useCallback((e=>{const t=e.currentTarget.value||"";qe.current=!0,null==W||W(t),!Be.current&&Qe(!0),Ge(t)}),[W]),Mt=t.useCallback((e=>{P(e),ut(D),ht()}),[]),kt=t.useCallback((e=>{P(e,"mousedown"===e.type),ht(),Be.current?Qe(!1):yt(S)}),[yt]),Dt=!ve||ve&&Je,jt=E||!be||!!tt,zt=!(!T||E||!N(dt)),Lt=E||we?void 0:kt;return a.default.createElement(n.ThemeProvider,{theme:it},a.default.createElement(je,{id:i,"aria-controls":r,"aria-expanded":Je,onKeyDown:e=>{if(E)return;if(u&&(u(e,Xe,ot),e.defaultPrevented))return;const{key:t}=e;switch(t){case"ArrowDown":case"ArrowUp":xt(t);break;case"ArrowLeft":case"ArrowRight":if(!o||Xe||ae)return;(e=>{if(!N(dt))return;let t=-1;const n=dt.length-1,o=tt?dt.findIndex((e=>e.value===tt)):-1;t=e===v?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const r=t>=0?dt[t].value:null;ot.data&&rt(k),r!==tt&&nt(r)})("ArrowLeft"===t?w:v);break;case" ":if(Xe)return;if(Je){if(!ot.data)return;Ot()}else yt(S);break;case"Enter":Je&&229!==e.keyCode&&Ot();break;case"Escape":Je&&(Qe(!1),Ge(""));break;case"Tab":if(!Je||!xe||!ot.data||e.shiftKey)return;Ot();break;case"Delete":case"Backspace":if(Xe)return;if(tt){const e=dt.findIndex((e=>e.value===tt)),t=e>-1&&e<dt.length-1?dt[e+1].value:null;vt(tt),nt(t)}else{if(!Ee)return;if(!N(dt))break;if(o&&!ae){const{value:e}=dt[dt.length-1];vt(e)}else T&&ut(D)}break;default:return}e.preventDefault()}},a.default.createElement(Le,{ref:_e,isInvalid:m,isFocused:Ze,isDisabled:E,className:"rfs-control-container",onTouchEnd:Ct,onMouseDown:Ct,"data-testid":undefined},a.default.createElement(ze,null,a.default.createElement(se,{isMulti:o,inputValue:Xe,placeholder:Pe,selectedOption:dt,focusedMultiValue:tt,renderOptionLabel:st,renderMultiOptions:ae,removeSelectedOption:vt}),a.default.createElement(he,{id:r,ref:Ye,required:l,ariaLabel:g,inputValue:Xe,readOnly:jt,onBlur:St,onFocus:Et,onChange:It,ariaLabelledBy:K,selectedOption:dt})),a.default.createElement(Me,{menuOpen:Je,clearIcon:p,caretIcon:f,isInvalid:m,isLoading:d,showClear:zt,isDisabled:E,loadingNode:B,onClearMouseDown:Mt,onCaretMouseDown:Lt})),Dt&&a.default.createElement(Z,{menuRef:Ue,menuOpen:Je,isLoading:d,menuTop:ft,height:mt,itemSize:Ve,loadingMsg:Re,menuOptions:pt,fixedSizeListRef:He,noOptionsMsg:Te,selectOption:wt,direction:re,itemKeySelector:J,overscanCount:ne,menuPortalTarget:ee,width:h||it.menu.width,onMenuMouseDown:e=>{P(e),ht()},renderOptionLabel:st,focusedOptionIndex:ot.index}),te&&a.default.createElement(ye,{ariaLive:s,menuOpen:Je,isFocused:Ze,ariaLabel:g,inputValue:Xe,isSearchable:be,focusedOption:ot,selectedOption:dt,optionCount:pt.length})))}));Ne.displayName="Select",e.Select=Ne,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -5,3 +5,3 @@ import React from 'react'; | ||
import type { ReactNode, ReactText, KeyboardEvent, FocusEventHandler } from 'react'; | ||
import type { OptionData, PartialDeep, IconRenderer, FocusedOption, SelectedOption, AriaLiveAttribute } from './types'; | ||
import type { OptionData, PartialDeep, IconRenderer, FocusedOption, SelectedOption, CallbackFunction, AriaLiveAttribute } from './types'; | ||
export declare type Theme = PartialDeep<DefaultTheme>; | ||
@@ -70,2 +70,4 @@ export declare type MultiParams = Readonly<{ | ||
filterIgnoreAccents?: boolean; | ||
onMenuOpen?: CallbackFunction; | ||
onMenuClose?: CallbackFunction; | ||
backspaceClearsValue?: boolean; | ||
@@ -75,4 +77,2 @@ menuPosition?: MenuPositionEnum; | ||
menuItemDirection?: 'ltr' | 'rtl'; | ||
onMenuOpen?: (...args: any[]) => any; | ||
onMenuClose?: (...args: any[]) => any; | ||
onInputChange?: (value?: string) => any; | ||
@@ -134,2 +134,4 @@ initialValue?: OptionData | OptionData[]; | ||
filterIgnoreAccents?: boolean | undefined; | ||
onMenuOpen?: CallbackFunction | undefined; | ||
onMenuClose?: CallbackFunction | undefined; | ||
backspaceClearsValue?: boolean | undefined; | ||
@@ -139,4 +141,2 @@ menuPosition?: MenuPositionEnum | undefined; | ||
menuItemDirection?: "ltr" | "rtl" | undefined; | ||
onMenuOpen?: ((...args: any[]) => any) | undefined; | ||
onMenuClose?: ((...args: any[]) => any) | undefined; | ||
onInputChange?: ((value?: string | undefined) => any) | undefined; | ||
@@ -143,0 +143,0 @@ initialValue?: OptionData | OptionData[]; |
import React, { useRef, useMemo, useState, useEffect, forwardRef, useCallback, useImperativeHandle } from 'react'; | ||
import { mergeDeep, isBoolean, isPlainObject, normalizeValue, IS_TOUCH_DEVICE, isArrayWithLength, suppressMouseOrTouchEvent } from './utils'; | ||
import { ValueIndexEnum, FilterMatchEnum, OptionIndexEnum, MenuPositionEnum, EMPTY_ARRAY, SELECT_WRAPPER_ATTRS, PLACEHOLDER_DEFAULT, LOADING_MSG_DEFAULT, CONTROL_CONTAINER_CLS, FOCUSED_OPTION_DEFAULT, NO_OPTIONS_MSG_DEFAULT, MENU_ITEM_SIZE_DEFAULT, MENU_MAX_HEIGHT_DEFAULT, CONTROL_CONTAINER_TESTID } from './constants'; | ||
@@ -7,3 +8,2 @@ import { DEFAULT_THEME } from './theme'; | ||
import { useDebounce, useMenuPositioner, useMenuOptions, useMountEffect, useUpdateEffect } from './hooks'; | ||
import { mergeDeep, IS_TOUCH_DEVICE, suppressMouseOrTouchEvent, normalizeValue, isPlainObject, isBoolean, isArrayWithLength } from './utils'; | ||
const SelectWrapper = styled.div.attrs(SELECT_WRAPPER_ATTRS) ` | ||
@@ -67,2 +67,4 @@ position: relative; | ||
const onChangeEventValue = useRef(false); | ||
const onSearchChangeRef = useRef(); | ||
const onOptionChangeRef = useRef(); | ||
const listRef = useRef(null); | ||
@@ -116,9 +118,8 @@ const menuRef = useRef(null); | ||
}, [isMulti, menuOptions]); | ||
const removeSelectedOption = useCallback((removeValue) => { | ||
setSelectedOption((prev) => prev.filter(({ value }) => value !== removeValue)); | ||
const removeSelectedOption = useCallback((value) => { | ||
setSelectedOption((prev) => prev.filter((x) => x.value !== value)); | ||
}, []); | ||
const selectOption = useCallback((option, isSelected) => { | ||
if (isSelected) { | ||
if (isMulti) | ||
removeSelectedOption(option.value); | ||
isMulti && removeSelectedOption(option.value); | ||
} | ||
@@ -170,11 +171,11 @@ else { | ||
/** | ||
* (useMountEffect) If autoFocus = true, focus the control following initial mount. | ||
* useMountEffect: | ||
* If autoFocus = true, focus the control following initial mount. | ||
*/ | ||
useMountEffect(() => { | ||
if (autoFocus) { | ||
focusInput(); | ||
} | ||
autoFocus && focusInput(); | ||
}); | ||
/** | ||
* Write current value of 'menuOpen' to ref object (use to prevent extraneous state update calls) | ||
* Write value of 'menuOpen' to ref object. | ||
* Prevent extraneous state update calls/rerenders. | ||
*/ | ||
@@ -185,2 +186,10 @@ useEffect(() => { | ||
/** | ||
* Write value of 'onOptionChange' & 'onSearchChange' props to ref object. | ||
* Prevent effects using these props from excessive executions if they are not memoized or change frequently. | ||
*/ | ||
useEffect(() => { | ||
onOptionChangeRef.current = onOptionChange; | ||
onSearchChangeRef.current = onSearchChange; | ||
}, [onOptionChange, onSearchChange]); | ||
/** | ||
* If control recieves focus & openMenuOnFocus = true, open menu | ||
@@ -198,12 +207,15 @@ */ | ||
useEffect(() => { | ||
if (onSearchChange && onChangeEventValue.current) { | ||
const { current: onSearchFn } = onSearchChangeRef; | ||
if (onSearchFn && onChangeEventValue.current) { | ||
onChangeEventValue.current = false; | ||
onSearchChange(debouncedInputValue); | ||
onSearchFn(debouncedInputValue); | ||
} | ||
}, [onSearchChange, debouncedInputValue]); | ||
}, [debouncedInputValue]); | ||
/** | ||
* (useUpdateEffect) Handle passing 'selectedOption' value(s) to onOptionChange callback function prop (if defined) | ||
* useUpdateEffect: | ||
* Handle passing 'selectedOption' value(s) to onOptionChange callback function prop (if defined) | ||
*/ | ||
useUpdateEffect(() => { | ||
if (!onOptionChange) | ||
const { current: onChangeFn } = onOptionChangeRef; | ||
if (!onChangeFn) | ||
return; | ||
@@ -215,6 +227,7 @@ const normalizedOptionValue = isMulti | ||
: null; | ||
onOptionChange(normalizedOptionValue); | ||
}, [isMulti, selectedOption, onOptionChange]); | ||
onChangeFn(normalizedOptionValue); | ||
}, [isMulti, selectedOption]); | ||
/** | ||
* (useUpdateEffect) Handle clearing focused option if menuOptions array has 0 length; | ||
* useUpdateEffect: | ||
* Handle clearing focused option if menuOptions array has 0 length; | ||
* Handle menuOptions changes - conditionally focus first option and do scroll to first option; | ||
@@ -224,12 +237,12 @@ * Handle reseting scroll pos to first item after the previous search returned zero results (use prevMenuOptionsLen) | ||
useUpdateEffect(() => { | ||
const inputChanged = menuOptions.length > 0 && | ||
(async || menuOptions.length !== options.length || prevMenuOptionsLength.current === 0); | ||
if (menuOptions.length === 0) { | ||
const { length: menuLen } = menuOptions; | ||
const inputChanged = menuLen > 0 && (async || menuLen !== options.length || prevMenuOptionsLength.current === 0); | ||
if (menuLen === 0) { | ||
setFocusedOption(FOCUSED_OPTION_DEFAULT); | ||
} | ||
else if (menuOptions.length === 1 || inputChanged) { | ||
else if (menuLen === 1 || inputChanged) { | ||
setFocusedOption({ index: 0, ...menuOptions[0] }); | ||
scrollToItemIndex(0); | ||
} | ||
prevMenuOptionsLength.current = menuOptions.length; | ||
prevMenuOptionsLength.current = menuLen; | ||
}, [async, options, menuOptions]); | ||
@@ -261,3 +274,3 @@ const selectOptionFromFocused = () => { | ||
} | ||
const nextFocusedVal = (nextFocusedIdx >= 0) | ||
const nextFocusedVal = nextFocusedIdx >= 0 | ||
? selectedOption[nextFocusedIdx].value | ||
@@ -264,0 +277,0 @@ : null; |
@@ -60,10 +60,10 @@ /** | ||
function smoothScrollTo(el, to, duration = 300, callback) { | ||
let curTime = 0; | ||
let currentTime = 0; | ||
const start = getScrollTop(el); | ||
const change = to - start; | ||
function scrollFn() { | ||
curTime += 5; | ||
const calcScrollTop = easeOutCubic(change, duration, start, curTime); | ||
currentTime += 5; | ||
const calcScrollTop = easeOutCubic(change, duration, start, currentTime); | ||
scrollTo(el, calcScrollTop); | ||
(curTime < duration) | ||
(currentTime < duration) | ||
? requestAnimationFrame(scrollFn) | ||
@@ -70,0 +70,0 @@ : callback?.(); |
{ | ||
"name": "react-functional-select", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"description": "Micro-sized and micro-optimized select component for React.js", | ||
@@ -52,6 +52,6 @@ "main": "./dist/index.cjs.js", | ||
"@rollup/plugin-typescript": "^8.2.1", | ||
"@storybook/addon-storysource": "^6.2.1", | ||
"@storybook/addons": "^6.2.1", | ||
"@storybook/addon-storysource": "^6.2.3", | ||
"@storybook/addons": "^6.2.3", | ||
"@storybook/preset-create-react-app": "^3.1.7", | ||
"@storybook/react": "^6.2.1", | ||
"@storybook/react": "^6.2.3", | ||
"@testing-library/jest-dom": "^5.11.10", | ||
@@ -66,8 +66,8 @@ "@testing-library/react": "^11.2.6", | ||
"@types/styled-components": "^5.1.9", | ||
"@typescript-eslint/eslint-plugin": "^4.20.0", | ||
"@typescript-eslint/parser": "^4.20.0", | ||
"@typescript-eslint/eslint-plugin": "^4.21.0", | ||
"@typescript-eslint/parser": "^4.21.0", | ||
"babel-jest": "^26.6.3", | ||
"babel-loader": "^8.2.2", | ||
"babel-plugin-styled-components": "^1.12.0", | ||
"concurrently": "^6.0.0", | ||
"concurrently": "^6.0.1", | ||
"cross-env": "^7.0.3", | ||
@@ -74,0 +74,0 @@ "enzyme": "^3.11.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
181515
2265