react-functional-select
Advanced tools
Comparing version 3.1.2 to 3.2.0
import React from 'react'; | ||
import type { EventHandler, ReactNode } from 'react'; | ||
import type { IconRenderer, MouseOrTouchEvent } from '../../types'; | ||
import type { ReactNode } from 'react'; | ||
import type { IconRenderer, MouseOrTouchEventHandler } from '../../types'; | ||
export declare type IndicatorIconsProps = Readonly<{ | ||
@@ -13,4 +13,4 @@ menuOpen: boolean; | ||
caretIcon?: IconRenderer; | ||
onClearMouseDown: EventHandler<MouseOrTouchEvent<HTMLElement>>; | ||
onCaretMouseDown?: EventHandler<MouseOrTouchEvent<HTMLElement>>; | ||
onClearMouseDown: MouseOrTouchEventHandler; | ||
onCaretMouseDown?: MouseOrTouchEventHandler; | ||
}>; | ||
@@ -26,5 +26,5 @@ declare const IndicatorIcons: React.NamedExoticComponent<Readonly<{ | ||
caretIcon?: IconRenderer; | ||
onClearMouseDown: EventHandler<MouseOrTouchEvent<HTMLElement>>; | ||
onCaretMouseDown?: ((event: MouseOrTouchEvent<HTMLElement>) => void) | undefined; | ||
onClearMouseDown: MouseOrTouchEventHandler; | ||
onCaretMouseDown?: MouseOrTouchEventHandler | undefined; | ||
}>>; | ||
export default IndicatorIcons; |
import React, { memo } from 'react'; | ||
import LoadingDots from './LoadingDots'; | ||
import { isFunction } from '../../utils'; | ||
import ClearSvgIcon from './ClearSvgIcon'; | ||
@@ -47,7 +48,7 @@ import styled, { css } from 'styled-components'; | ||
const IndicatorIcons = memo(({ menuOpen, clearIcon, caretIcon, isInvalid, showClear, isLoading, isDisabled, loadingNode, onCaretMouseDown, onClearMouseDown }) => { | ||
const customIconContext = (typeof caretIcon === 'function' || typeof clearIcon === 'function') | ||
const customIconContext = isFunction(caretIcon) || isFunction(clearIcon) | ||
? { menuOpen, isLoading: !!isLoading, isInvalid: !!isInvalid, isDisabled: !!isDisabled } | ||
: undefined; | ||
const renderIconFn = (renderer) => { | ||
return typeof renderer === 'function' | ||
return isFunction(renderer) | ||
? renderer(customIconContext) | ||
@@ -54,0 +55,0 @@ : renderer; |
@@ -55,5 +55,4 @@ import React from 'react'; | ||
const Menu = ({ menuRef, menuTop, menuOpen, onMenuMouseDown, menuPortalTarget, ...menuListProps }) => { | ||
const hideNoOptionsMsg = menuOpen && | ||
!Boolean(menuListProps.noOptionsMsg) && | ||
!isArrayWithLength(menuListProps.menuOptions); | ||
const { menuOptions, noOptionsMsg } = menuListProps; | ||
const hideNoOptionsMsg = menuOpen && !Boolean(noOptionsMsg) && !isArrayWithLength(menuOptions); | ||
const menuNode = (React.createElement(MenuWrapper, { ref: menuRef, menuTop: menuTop, menuOpen: menuOpen, onMouseDown: onMenuMouseDown, className: MENU_CONTAINER_CLS, "data-testid": MENU_CONTAINER_TESTID, hideNoOptionsMsg: hideNoOptionsMsg }, | ||
@@ -60,0 +59,0 @@ React.createElement(MenuList, Object.assign({}, menuListProps)))); |
@@ -12,2 +12,3 @@ import { FixedSizeList } from 'react-window'; | ||
width: string | number; | ||
direction?: 'ltr' | 'rtl'; | ||
menuOptions: MenuOption[]; | ||
@@ -14,0 +15,0 @@ focusedOptionIndex: number; |
@@ -14,3 +14,3 @@ import React, { useMemo, Fragment } from 'react'; | ||
`; | ||
const MenuList = ({ width, height, itemSize, isLoading, loadingMsg, menuOptions, selectOption, noOptionsMsg, overscanCount, itemKeySelector, fixedSizeListRef, renderOptionLabel, focusedOptionIndex }) => { | ||
const MenuList = ({ width, height, itemSize, direction, isLoading, loadingMsg, menuOptions, selectOption, noOptionsMsg, overscanCount, itemKeySelector, fixedSizeListRef, renderOptionLabel, focusedOptionIndex }) => { | ||
const itemData = useMemo(() => ({ | ||
@@ -29,5 +29,5 @@ menuOptions, | ||
return (React.createElement(Fragment, null, | ||
React.createElement(FixedSizeList, { width: width, height: height, itemKey: itemKey, itemSize: itemSize, itemData: itemData, ref: fixedSizeListRef, overscanCount: overscanCount, itemCount: menuOptions.length }, Option), | ||
React.createElement(FixedSizeList, { width: width, height: height, itemKey: itemKey, itemSize: itemSize, itemData: itemData, direction: direction, ref: fixedSizeListRef, overscanCount: overscanCount, itemCount: menuOptions.length }, Option), | ||
!isArrayWithLength(menuOptions) && noOptionsMsg && (React.createElement(NoOptionsMsg, null, noOptionsMsg)))); | ||
}; | ||
export default MenuList; |
import React from 'react'; | ||
import type { ReactNode, ReactText } from 'react'; | ||
import type { OptionData, MouseOrTouchEvent, SelectedOption } from '../../types'; | ||
import type { OptionData, SelectedOption } from '../../types'; | ||
export declare type MultiValueProps = SelectedOption & Readonly<{ | ||
isFocused: boolean; | ||
removeSelectedOption: (value?: ReactText) => void; | ||
renderOptionLabel: (data: OptionData) => ReactNode; | ||
removeSelectedOption: (value?: ReactText, e?: MouseOrTouchEvent<HTMLElement>) => void; | ||
}>; | ||
declare const MultiValue: React.NamedExoticComponent<MultiValueProps>; | ||
export default MultiValue; |
import React, { memo } from 'react'; | ||
import styled, { css } from 'styled-components'; | ||
import { CLEAR_ICON_MV_TESTID } from '../../constants'; | ||
import { suppressMouseOrTouchEvent } from '../../utils'; | ||
const _clearIconFocusStyle = css ` | ||
@@ -51,4 +52,4 @@ z-index: 5000; | ||
React.createElement(Label, null, renderOptionLabel(data)), | ||
React.createElement(Clear, { isFocused: isFocused, "data-testid": CLEAR_ICON_MV_TESTID, onTouchEnd: (e) => removeSelectedOption(value, e), onMouseDown: (e) => removeSelectedOption(value, e) }, "\u2716")))); | ||
React.createElement(Clear, { isFocused: isFocused, "data-testid": CLEAR_ICON_MV_TESTID, onMouseDown: suppressMouseOrTouchEvent, onClick: () => removeSelectedOption(value), onTouchEnd: () => removeSelectedOption(value) }, "\u2716")))); | ||
MultiValue.displayName = 'MultiValue'; | ||
export default MultiValue; |
import type { MultiParams } from '../../Select'; | ||
import type { OptionData, SelectedOption } from '../../types'; | ||
import type { ReactNode, ReactText, FunctionComponent } from 'react'; | ||
import type { OptionData, MouseOrTouchEvent, SelectedOption } from '../../types'; | ||
export declare type ValueProps = Readonly<{ | ||
@@ -10,7 +10,7 @@ isMulti?: boolean; | ||
focusedMultiValue: ReactText | null; | ||
removeSelectedOption: (value?: ReactText) => void; | ||
renderOptionLabel: (data: OptionData) => ReactNode; | ||
renderMultiOptions?: (params: MultiParams) => ReactNode; | ||
removeSelectedOption: (value?: ReactText, e?: MouseOrTouchEvent<HTMLElement>) => void; | ||
}>; | ||
declare const Value: FunctionComponent<ValueProps>; | ||
export default Value; |
@@ -5,2 +5,2 @@ /** | ||
*/ | ||
export declare const useDebounce: <T>(value: T, delay?: number | undefined) => T; | ||
export declare const useDebounce: <T>(value: T, delay?: number) => T; |
@@ -6,6 +6,6 @@ import { useEffect, useState } from 'react'; | ||
*/ | ||
export const useDebounce = (value, delay) => { | ||
export const useDebounce = (value, delay = 0) => { | ||
const [debouncedValue, setDebouncedValue] = useState(value); | ||
useEffect(() => { | ||
if (delay === undefined) | ||
if (delay <= 0) | ||
return; | ||
@@ -19,5 +19,3 @@ const handler = setTimeout(() => { | ||
}, [value, delay]); | ||
return (delay === undefined) | ||
? value | ||
: debouncedValue; | ||
return delay <= 0 ? value : debouncedValue; | ||
}; |
import { useEffect, useState } from 'react'; | ||
import { trimAndFormatFilterStr } from '../utils'; | ||
import { EMPTY_ARRAY, FilterMatchEnum } from '../constants'; | ||
import { isBoolean, trimAndFormatFilterStr } from '../utils'; | ||
/** | ||
@@ -12,3 +12,3 @@ * Parse options to array of MenuOptions and perform filtering (if applicable). | ||
const searchValue = !async ? debouncedInputValue : ''; | ||
const hideSelectedOptionsOrDefault = (typeof hideSelectedOptions !== 'boolean') ? !!isMulti : hideSelectedOptions; | ||
const hideSelectedOptionsOrDefault = !isBoolean(hideSelectedOptions) ? !!isMulti : hideSelectedOptions; | ||
useEffect(() => { | ||
@@ -42,4 +42,5 @@ const normalizedInput = trimAndFormatFilterStr(searchValue, filterIgnoreCase, filterIgnoreAccents); | ||
}; | ||
const { length } = options; | ||
const nextMenuOptions = []; | ||
for (let i = 0; i < options.length; i++) { | ||
for (let i = 0; i < length; i++) { | ||
const option = parseMenuOption(options[i]); | ||
@@ -46,0 +47,0 @@ option && nextMenuOptions.push(option); |
@@ -10,2 +10,2 @@ import { MenuPositionEnum } from '../constants'; | ||
*/ | ||
export declare const useMenuPositioner: (menuRef: MutableRefObject<HTMLElement | null>, controlRef: MutableRefObject<HTMLElement | null>, menuOpen: boolean, menuPosition: MenuPositionEnum, menuItemSize: number, menuHeightDefault: number, menuOptionsLength: number, menuScrollDuration?: number | undefined, scrollMenuIntoView?: boolean | undefined, onMenuOpen?: ((...args: any[]) => any) | undefined, onMenuClose?: ((...args: any[]) => any) | undefined) => [string | undefined, number]; | ||
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]; |
@@ -12,12 +12,14 @@ import { useEffect, useState, useRef } from 'react'; | ||
*/ | ||
export const useMenuPositioner = (menuRef, controlRef, menuOpen, menuPosition, menuItemSize, menuHeightDefault, menuOptionsLength, menuScrollDuration, scrollMenuIntoView, onMenuOpen, onMenuClose) => { | ||
export const useMenuPositioner = (menuRef, controlRef, menuOpen, menuPosition, menuItemSize, menuHeightDefault, menuOptionsLength, isMenuPortaled, menuScrollDuration, scrollMenuIntoView, onMenuOpen, onMenuClose) => { | ||
const resetMenuHeightRef = useRef(false); | ||
const isMenuTopPositionRef = useRef(false); | ||
const shouldScrollRef = useRef(!isMenuPortaled); | ||
const [menuHeight, setMenuHeight] = useState(menuHeightDefault); | ||
const [isMenuTopPosition, setIsMenuTopPosition] = useState(menuPosition === MenuPositionEnum.TOP); | ||
const [isMenuTopPosition, setIsMenuTopPosition] = useState(false); | ||
useEffect(() => { | ||
const isTopPosition = menuPosition === MenuPositionEnum.TOP || | ||
shouldScrollRef.current = !isMenuTopPosition && !isMenuPortaled; | ||
}, [isMenuTopPosition, isMenuPortaled]); | ||
useEffect(() => { | ||
const isTopPos = menuPosition === MenuPositionEnum.TOP || | ||
(menuPosition === MenuPositionEnum.AUTO && !menuFitsBelowControl(menuRef.current)); | ||
setIsMenuTopPosition(isTopPosition); | ||
isMenuTopPositionRef.current = isMenuTopPosition; | ||
setIsMenuTopPosition(isTopPos); | ||
}, [menuRef, menuPosition]); | ||
@@ -33,3 +35,3 @@ useUpdateEffect(() => { | ||
}; | ||
!isMenuTopPositionRef.current | ||
shouldScrollRef.current | ||
? scrollMenuIntoViewOnOpen(menuRef.current, menuScrollDuration, scrollMenuIntoView, handleOnMenuOpen) | ||
@@ -36,0 +38,0 @@ : handleOnMenuOpen(); |
@@ -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 Array.isArray(e)&&!!e.length}function E(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function M(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(S,"")}(o):o}const k=(e,t,n)=>{const o=Array.isArray(e)?e:E(e)?[e]:C;return I(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},z=(e,t)=>{const n={...e};return Object.keys(t).forEach((o=>{const i=t[o];n[o]=E(i)&&"animation"!==o?o in e?z(e[o],i):i:i||""})),n};function N(e){return L(e)?window.pageYOffset:e.scrollTop}function L(e){return e===document.documentElement||e===document.body||e===window}function D({overflow:e,overflowX:t,overflowY:n}){const o=e=>"auto"===e||"scroll"===e;return o(e)||o(t)||o(n)}function R(e){let t=getComputedStyle(e);const n="absolute"===t.position;if("fixed"===t.position)return document.documentElement;for(let i=e;i=null===(o=i)||void 0===o?void 0:o.parentElement;){var o;if(t=getComputedStyle(i),(!n||"static"!==t.position)&&D(t))return i}return document.documentElement}function T(e,t,n=300,o){let i=0;const a=N(e),r=t-a;window.requestAnimationFrame((function t(){var l;i+=5,function(e,t){L(e)?window.scrollTo(0,t):e.scrollTop=t}(e,r*((l=(l=i)/n-1)*l*l+1)+a),i<n?window.requestAnimationFrame(t):null==o||o()}))}const V="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,A="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent),F=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);F.displayName="Option";const B=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)),$=({width:t,height:o,itemSize:i,isLoading:r,loadingMsg:l,menuOptions:s,selectOption:d,noOptionsMsg:u,overscanCount:c,itemKeySelector:p,fixedSizeListRef:f,renderOptionLabel:m,focusedOptionIndex:g})=>{const h=e.useMemo((()=>({menuOptions:s,selectOption:d,renderOptionLabel:m,focusedOptionIndex:g})),[s,g,d,m]);if(r)return a.default.createElement(B,null,l);return a.default.createElement(e.Fragment,null,a.default.createElement(n.FixedSizeList,{width:t,height:o,itemKey:p?(e,t)=>t.menuOptions[e][p]:void 0,itemSize:i,itemData:h,ref:f,overscanCount:c,itemCount:s.length},F),!I(s)&&u&&a.default.createElement(B,null,u))},q=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"))),P=({menuRef:e,menuTop:t,menuOpen:n,onMenuMouseDown:i,menuPortalTarget:r,...l})=>{const s=n&&!Boolean(l.noOptionsMsg)&&!I(l.menuOptions),d=a.default.createElement(q,{ref:e,menuTop:t,menuOpen:n,onMouseDown:i,className:"rfs-menu-container",hideNoOptionsMsg:s},a.default.createElement($,Object.assign({},l)));return r?o.createPortal(d,r):d},W=t.css(["z-index:5000;transform:scale(1.26);color:",";"],(({theme:e})=>e.multiValue.clear.focusColor)),j=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)),K=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)),H=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,W)),(({isFocused:e})=>e&&W)),U=e.memo((({data:e,value:t,isFocused:n,renderOptionLabel:o,removeSelectedOption:i})=>a.default.createElement(j,null,a.default.createElement(K,null,o(e)),a.default.createElement(H,{isFocused:n,onTouchEnd:e=>i(t,e),onMouseDown:e=>i(t,e)},"✖"))));U.displayName="MultiValue";const Y=t.css(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),_=r.default.div.withConfig({displayName:"SingleValue",componentId:"sc-153h0ct-0"})([""," max-width:calc(100% - 0.5rem);"],Y),X=r.default.div.withConfig({displayName:"Placeholder",componentId:"sc-153h0ct-1"})([""," color:",";",""],Y,(({theme:e})=>e.color.placeholder),(({theme:e,isMulti:n})=>n&&t.css(["animation:",";"],e.multiValue.animation))),G=({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(U,{key:t,data:e,value:t,renderOptionLabel:l,isFocused:t===r,removeSelectedOption:d})))):a.default.createElement(_,null,l(i[0].data)):a.default.createElement(X,{isMulti:t},o):null,J=(t,n,o,i,a,r,l,s,d,u,c,f,m)=>{const[g,h]=e.useState(C),b=m?"":n,v="boolean"!=typeof f?!!c:f;return e.useEffect((()=>{const e=M(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=M(f(t),d,u);return o===p?n.indexOf(e)>-1:n.substr(0,e.length)===e})(l)||v&&l.isSelected))return l},g=[];for(let e=0;e<t.length;e++){const n=m(t[e]);n&&g.push(n)}h(g)}),[t,i,b,v,o,d,u,s,l,a,r]),g},Q=(t,n)=>{const o=e.useRef(!0);e.useEffect((()=>{if(!o.current)return t();o.current=!1}),n)},Z=(t,n,o,i,a,r,l,s,c,p,f)=>{const m=e.useRef(!1),g=e.useRef(!1),[h,b]=e.useState(r),[v,w]=e.useState(i===d);e.useEffect((()=>{const e=i===d||i===u&&!(e=>{if(!e)return!0;const t=R(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-N(t)-n>=o})(t.current);w(e),g.current=v}),[t,i]),Q((()=>{if(o){const e=e=>{null==p||p(),e&&(m.current=!0,b(e))};g.current?e():((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=R(e),d=N(s),u=s.getBoundingClientRect().height-d-i,c=u<a;if(c||!n)return void o(c?u:void 0);T(s,r-l+d+parseInt(getComputedStyle(e).marginBottom,10),t,o)})(t.current,s,c,e)}else null==f||f(),m.current&&(m.current=!1,b(r))}),[t,o,f,p,r,c,s]);const y=Math.min(h,l*a);return[v?((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)"})(y,t.current,n.current):void 0,y]},ee=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)),te=r.default.input.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),A&&"::-ms-clear{display:none;}"),ne=e.memo(e.forwardRef((({id:t,onBlur:n,onFocus:o,readOnly:i,required:r,onChange:l,ariaLabel:d,inputValue:u,ariaLabelledBy:c,selectedOption:p},f)=>{const m=e.useRef(null),[g,h]=e.useState(2),b=r&&!I(p);return Q((()=>{m.current&&h(m.current.scrollWidth+2)}),[u]),a.default.createElement(e.Fragment,null,a.default.createElement(te,Object.assign({id:t,ref:f,isInvalid:!0,onBlur:n,onFocus:o,value:u,readOnly:i,required:b,"aria-label":d,style:{width:g}},s,{"aria-labelledby":c,onChange:i?void 0:l})),a.default.createElement(ee,{ref:m},u))})));ne.displayName="AutosizeInput";const oe=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);"]),ie=({menuOpen:e,isFocused:t,ariaLabel:n,inputValue:o,optionCount:i,isSearchable:r,focusedOption:l,selectedOption:s,ariaLive:d="polite"})=>{if(!t)return null;const u=`${i} result(s) available${o?" for search input "+o:""}.`,c=l.value?`Focused option: ${l.label}${l.isDisabled?" - disabled":""}, ${l.index+1} of ${i}.`:"",p=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.":`${n||"Select"} is focused${r?", type to filter options":""}, press Down arrow key to open the menu.`,f=I(s)?s.map((({label:e})=>e)).join(" "):"N/A",m=c+u+p;return a.default.createElement(oe,{"aria-atomic":"false","aria-live":d,"aria-relevant":"additions text"},a.default.createElement("span",{id:"aria-context"},"Selected option: "+f),a.default.createElement("span",{id:"aria-selection"},m))},ae=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))),re=()=>a.default.createElement(ae,{"aria-hidden":!0,className:"rfs-loading-dots"},a.default.createElement("div",null),a.default.createElement("div",null),a.default.createElement("div",null)),le=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))),se=()=>a.default.createElement(le,{"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"})),de=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;"]),ue=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)),ce=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))),pe=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)),fe=e.memo((({menuOpen:e,clearIcon:t,caretIcon:n,isInvalid:o,showClear:i,isLoading:r,isDisabled:l,loadingNode:s,onCaretMouseDown:d,onClearMouseDown:u})=>{const c="function"==typeof n||"function"==typeof t?{menuOpen:e,isLoading:!!r,isInvalid:!!o,isDisabled:!!l}:void 0,p=e=>"function"==typeof e?e(c):e;return a.default.createElement(de,null,i&&!r&&a.default.createElement(ue,{onTouchEnd:u,onMouseDown:u},p(t)||a.default.createElement(se,null)),r&&(s||a.default.createElement(re,null)),a.default.createElement(pe,null),a.default.createElement(ue,{onTouchEnd:d,onMouseDown:d},p(n)||a.default.createElement(ce,{"aria-hidden":!0,menuOpen:e,isInvalid:o,className:"rfs-caret-icon"})))}));fe.displayName="IndicatorIcons";const me=r.default.div.withConfig({displayName:"SelectWrapper",componentId:"kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(({theme:e})=>e.select.css)),ge=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)),he=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)),be=e.forwardRef((({async:n,isMulti:o,inputId:i,selectId:r,required:s,ariaLive:d,autoFocus:u,isLoading:w,onKeyDown:y,clearIcon:S,caretIcon:M,isInvalid:N,ariaLabel:L,menuWidth:D,isDisabled:R,inputDelay:T,onMenuOpen:A,onMenuClose:F,onInputBlur:B,isClearable:$,themeConfig:q,loadingNode:W,initialValue:j,onInputFocus:K,onInputChange:H,ariaLabelledBy:U,onOptionChange:Y,onSearchChange:_,getOptionLabel:X,getOptionValue:ee,itemKeySelector:te,openMenuOnFocus:oe,menuPortalTarget:ae,isAriaLiveEnabled:re,menuOverscanCount:le,blurInputOnSelect:se,renderOptionLabel:de,renderMultiOptions:ue,menuScrollDuration:ce,filterIgnoreAccents:pe,hideSelectedOptions:be,getIsOptionDisabled:ve,getFilterOptionString:we,isSearchable:ye=!0,lazyLoadMenu:xe=!1,openMenuOnClick:Ce=!0,filterIgnoreCase:Oe=!0,tabSelectsOption:Se=!0,closeMenuOnSelect:Ie=!0,scrollMenuIntoView:Ee=!0,backspaceClearsValue:Me=!0,filterMatchFrom:ke=p,menuPosition:ze=c,options:Ne=C,loadingMsg:Le="Loading..",placeholder:De="Select option..",noOptionsMsg:Re="No options",menuItemSize:Te=35,menuMaxHeight:Ve=300},Ae)=>{const Fe=e.useRef(!1),Be=e.useRef(),$e=e.useRef(!1),qe=e.useRef(null),Pe=e.useRef(null),We=e.useRef(null),je=e.useRef(null),[Ke,He]=e.useState(""),[Ue,Ye]=e.useState(!1),[_e,Xe]=e.useState(!1),[Ge,Je]=e.useState(null),[Qe,Ze]=e.useState(x),et=e.useMemo((()=>E(q)?z(O,q):O),[q]),tt=e.useMemo((()=>X||(e=>e.label)),[X]),nt=e.useMemo((()=>ee||(e=>e.value)),[ee]),ot=e.useMemo((()=>de||tt),[de,tt]),it=((t,n)=>{const[o,i]=e.useState(t);return e.useEffect((()=>{if(void 0===n)return;const e=setTimeout((()=>{i(t)}),n);return()=>{clearTimeout(e)}}),[t,n]),void 0===n?t:o})(Ke,T),[at,rt]=e.useState((()=>k(j,nt,tt))),lt=J(Ne,it,ke,at,nt,tt,ve,we,Oe,pe,o,be,n),[st,dt]=Z(Pe,je,Ue,ze,Te,Ve,lt.length,ce,Ee,A,F),ut=()=>{var e;return null===(e=We.current)||void 0===e?void 0:e.blur()},ct=()=>{var e;return null===(e=We.current)||void 0===e?void 0:e.focus()},pt=e=>{var t;return null===(t=qe.current)||void 0===t?void 0:t.scrollToItem(e)},ft=(e,t=!0)=>{e.stopPropagation(),t&&e.preventDefault()},mt=e.useCallback(((e,t)=>{t&&ft(t,"mousedown"===t.type),rt((t=>t.filter((t=>t.value!==e))))}),[]),gt=e.useCallback((e=>{if(!I(lt))return void(!Fe.current&&Ye(!0));const t=o?-1:lt.findIndex((({isSelected:e})=>e)),n=t>-1?t:e===v?0:lt.length-1;!Fe.current&&Ye(!0),Ze({index:n,...lt[n]}),pt(n)}),[o,lt]),ht=e.useCallback(((e,t)=>{t?o&&mt(e.value):rt((t=>o?[...t,e]:[e]));("boolean"==typeof se?se:V)?ut():Ie&&(Ye(!1),He(""))}),[o,Ie,mt,se]);e.useImperativeHandle(Ae,(()=>({menuOpen:Ue,empty:!I(at),blur:ut,focus:ct,clearValue:()=>{rt(C),Ze(x)},setValue:e=>{const t=k(e,nt,tt);rt(t)},toggleMenu:e=>{!0===e||void 0===e&&!Ue?(!_e&&ct(),gt(v)):ut()}}))),e.useEffect((()=>{u&&ct()}),[]),e.useEffect((()=>{Fe.current=Ue}),[Ue]),e.useEffect((()=>{_e&&oe&>(v)}),[_e,oe,gt]),e.useEffect((()=>{_&&$e.current&&($e.current=!1,_(it))}),[_,it]),Q((()=>{if(!Y)return;const e=o?at.map((e=>e.data)):I(at)?at[0].data:null;Y(e)}),[o,at,Y]),Q((()=>{const e=lt.length>0&&(n||lt.length!==Ne.length||0===Be.current);0===lt.length?Ze(x):(1===lt.length||e)&&(Ze({index:0,...lt[0]}),pt(0)),Be.current=lt.length}),[n,Ne,lt]);const bt=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:i}=Qe;e&&!i&&ht({data:e,value:t,label:n},o)},vt=e=>{R||(_e||ct(),Ue?"INPUT"!==e.currentTarget.tagName&&(Ue&&Ye(!1),Ke&&He("")):Ce&>(v),"INPUT"!==e.currentTarget.tagName&&e.preventDefault())},wt=e.useCallback((e=>{null==B||B(e),Xe(!1),Ye(!1),He("")}),[B]),yt=e.useCallback((e=>{null==K||K(e),Xe(!0)}),[K]),xt=e.useCallback((e=>{$e.current=!0,null==H||H(e.currentTarget.value||""),!Fe.current&&Ye(!0),He(e.currentTarget.value||"")}),[H]),Ct=e.useCallback((e=>{ft(e,"mousedown"===e.type),rt(C),ct()}),[]),Ot=e.useCallback((e=>{ft(e,"mousedown"===e.type),ct(),Fe.current?Ye(!1):gt(v)}),[gt]),St=!xe||xe&&Ue,It=R||!ye||!!Ge,Et=!(!$||R||!I(at)),Mt=R||Ce?void 0:Ot;return a.default.createElement(t.ThemeProvider,{theme:et},a.default.createElement(me,Object.assign({id:r,"aria-controls":i,"aria-expanded":Ue,onKeyDown:e=>{if(!(R||y&&(y(e,Ke,Qe),e.defaultPrevented))){switch(e.key){case"ArrowDown":case"ArrowUp":{const t="ArrowDown"===e.key;Ue?(e=>{if(!I(lt))return;const t=e===h?(Qe.index+1)%lt.length:Qe.index>0?Qe.index-1:lt.length-1;Ge&&Je(null),Ze({index:t,...lt[t]}),pt(t)})(t?h:g):gt(t?v:b);break}case"ArrowLeft":case"ArrowRight":if(!o||Ke||ue)return;(e=>{if(!I(at))return;let t=-1;const n=at.length-1,o=Ge?at.findIndex((e=>e.value===Ge)):-1;t=e===f?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const i=t>=0?at[t].value:null;Qe.data&&Ze(x),i!==Ge&&Je(i)})("ArrowLeft"===e.key?m:f);break;case" ":if(Ke)return;if(Ue){if(!Qe.data)return;bt()}else gt(v);break;case"Enter":Ue&&229!==e.keyCode&&bt();break;case"Escape":Ue&&(Ye(!1),He(""));break;case"Tab":if(!Ue||!Se||!Qe.data||e.shiftKey)return;bt();break;case"Delete":case"Backspace":if(Ke)return;if(Ge){const e=at.findIndex((e=>e.value===Ge)),t=e>-1&&e<at.length-1?at[e+1].value:null;mt(Ge),Je(t)}else{if(!Me)return;if(I(at))if(o&&!ue){const{value:e}=at[at.length-1];mt(e)}else $&&rt(C)}break;default:return}e.preventDefault()}}},l),a.default.createElement(he,{ref:je,isInvalid:N,isFocused:_e,isDisabled:R,className:"rfs-control-container",onTouchEnd:vt,onMouseDown:vt},a.default.createElement(ge,null,a.default.createElement(G,{isMulti:o,inputValue:Ke,placeholder:De,selectedOption:at,focusedMultiValue:Ge,renderOptionLabel:ot,renderMultiOptions:ue,removeSelectedOption:mt}),a.default.createElement(ne,{id:i,ref:We,required:s,ariaLabel:L,inputValue:Ke,readOnly:It,onBlur:wt,onFocus:yt,onChange:xt,ariaLabelledBy:U,selectedOption:at})),a.default.createElement(fe,{menuOpen:Ue,clearIcon:S,caretIcon:M,isInvalid:N,isLoading:w,showClear:Et,isDisabled:R,loadingNode:W,onClearMouseDown:Ct,onCaretMouseDown:Mt})),St&&a.default.createElement(P,{menuRef:Pe,menuOpen:Ue,isLoading:w,menuTop:st,height:dt,itemSize:Te,loadingMsg:Le,menuOptions:lt,fixedSizeListRef:qe,noOptionsMsg:Re,selectOption:ht,itemKeySelector:te,overscanCount:le,menuPortalTarget:ae,width:D||et.menu.width,onMenuMouseDown:e=>{ft(e),ct()},renderOptionLabel:ot,focusedOptionIndex:Qe.index}),re&&a.default.createElement(ie,{ariaLive:d,menuOpen:Ue,isFocused:_e,ariaLabel:L,inputValue:Ke,isSearchable:ye,focusedOption:Qe,selectedOption:at,optionCount:lt.length})))}));be.displayName="Select",exports.Select=be; | ||
"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"function"==typeof e}function M(e){return Array.isArray(e)&&!!e.length}function k(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}const z=(e,t=!0)=>{t&&e.preventDefault(),e.stopPropagation()};function L(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(S,"")}(o):o}const N=(e,t,n)=>{const o=Array.isArray(e)?e:k(e)?[e]:C;return M(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},D=(e,t)=>{const n={...e};return Object.keys(t).forEach((o=>{const i=t[o];n[o]="animation"!==o&&k(i)?e[o]?D(e[o],i):i:i||""})),n};function R(e){return T(e)?window.pageYOffset:e.scrollTop}function T(e){return e===document.documentElement||e===document.body||e===window}const V=/(auto|scroll)/;function A({overflow:e,overflowX:t,overflowY:n}){return V.test(`${e}${t}${n}`)}function F(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)&&A(t))return n}return n}function B(e,t,n=300,o){let i=0;const a=R(e),r=t-a;requestAnimationFrame((function t(){var l;i+=5,function(e,t){T(e)?window.scrollTo(0,t):e.scrollTop=t}(e,r*((l=(l=i)/n-1)*l*l+1)+a),i<n?requestAnimationFrame(t):null==o||o()}))}const $="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,q="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent),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),!M(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)&&!M(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:z,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||M(i)&&!s)?M(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(C),b=m?"":n,v=I(f)?f:!!c;return e.useEffect((()=>{const e=L(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=L(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(!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=F(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-R(t)-n>=o})(t.current);y(e)}),[t,i]),ne((()=>{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=F(e),d=R(s),u=s.getBoundingClientRect().height-d-i,c=u<a;if(c||!n)return void o(c?u:void 0);B(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]},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.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),q&&"::-ms-clear{display:none;}"),re=e.memo(e.forwardRef((({id:t,onBlur:n,onFocus:o,readOnly:i,required:r,onChange:l,ariaLabel:d,inputValue:u,ariaLabelledBy:c,selectedOption:p},f)=>{const m=e.useRef(null),[g,h]=e.useState(2),b=r&&!M(p);return ne((()=>{m.current&&h(m.current.scrollWidth+2)}),[u]),a.default.createElement(e.Fragment,null,a.default.createElement(ae,Object.assign({id:t,ref:f,isInvalid:!0,onBlur:n,onFocus:o,value:u,readOnly:i,required:b,"aria-label":d,style:{width:g}},s,{"aria-labelledby":c,onChange:i?void 0:l})),a.default.createElement(ie,{ref:m},u))})));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,ariaLabel:n,inputValue:o,optionCount:i,isSearchable:r,focusedOption:l,selectedOption:s,ariaLive:d="polite"})=>{if(!t)return null;const u=`${i} result(s) available${o?" for search input "+o:""}.`,c=l.value?`Focused option: ${l.label}${l.isDisabled?" - disabled":""}, ${l.index+1} of ${i}.`:"",p=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.":`${n||"Select"} is focused${r?", type to filter options":""}, press Down arrow key to open the menu.`,f=M(s)?s.map((({label:e})=>e)).join(" "):"N/A",m=c+u+p;return a.default.createElement(le,{"aria-atomic":"false","aria-live":d,"aria-relevant":"additions text"},a.default.createElement("span",{id:"aria-context"},"Selected option: "+f),a.default.createElement("span",{id:"aria-selection"},m))},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=E(n)||E(t)?{menuOpen:e,isLoading:!!r,isInvalid:!!o,isDisabled:!!l}:void 0,p=e=>E(e)?e(c):e;return a.default.createElement(fe,null,i&&!r&&a.default.createElement(me,{onTouchEnd:u,onMouseDown:u},p(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},p(n)||a.default.createElement(ge,{"aria-hidden":!0,menuOpen:e,isInvalid:o,className:"rfs-caret-icon"})))}));be.displayName="IndicatorIcons";const ve=r.default.div.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:s,ariaLive:d,autoFocus:u,isLoading:w,onKeyDown:y,clearIcon:S,caretIcon:E,isInvalid:L,ariaLabel:R,menuWidth:T,isDisabled:V,inputDelay:A,onMenuOpen:F,onMenuClose:B,onInputBlur:q,isClearable:P,themeConfig:W,loadingNode:j,initialValue:K,onInputFocus:U,onInputChange:Y,ariaLabelledBy:_,onOptionChange:X,onSearchChange:G,getOptionLabel:J,getOptionValue:Q,itemKeySelector:Z,openMenuOnFocus:ie,menuPortalTarget:ae,isAriaLiveEnabled:le,menuOverscanCount:de,blurInputOnSelect:ue,menuItemDirection:ce,renderOptionLabel:pe,renderMultiOptions:fe,menuScrollDuration:me,filterIgnoreAccents:ge,hideSelectedOptions:he,getIsOptionDisabled:xe,getFilterOptionString:Ce,isSearchable:Oe=!0,lazyLoadMenu:Se=!1,openMenuOnClick:Ie=!0,filterIgnoreCase:Ee=!0,tabSelectsOption:Me=!0,closeMenuOnSelect:ke=!0,scrollMenuIntoView:ze=!0,backspaceClearsValue:Le=!0,filterMatchFrom:Ne=p,menuPosition:De=c,options:Re=C,loadingMsg:Te="Loading..",placeholder:Ve="Select option..",noOptionsMsg:Ae="No options",menuItemSize:Fe=35,menuMaxHeight:Be=300},$e)=>{const qe=e.useRef(!1),Pe=e.useRef(),We=e.useRef(!1),je=e.useRef(null),Ke=e.useRef(null),He=e.useRef(null),Ue=e.useRef(null),[Ye,_e]=e.useState(""),[Xe,Ge]=e.useState(!1),[Je,Qe]=e.useState(!1),[Ze,et]=e.useState(null),[tt,nt]=e.useState(x),ot=e.useMemo((()=>k(W)?D(O,W):O),[W]),it=e.useMemo((()=>J||(e=>e.label)),[J]),at=e.useMemo((()=>Q||(e=>e.value)),[Q]),rt=e.useMemo((()=>pe||it),[pe,it]),lt=((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})(Ye,A),[st,dt]=e.useState((()=>N(K,at,it))),ut=te(Re,lt,Ne,st,at,it,xe,Ce,Ee,ge,o,he,n),[ct,pt]=oe(Ke,Ue,Xe,De,Fe,Be,ut.length,!!ae,me,ze,F,B),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=je.current)||void 0===t?void 0:t.scrollToItem(e)},ht=e.useCallback((e=>{if(!M(ut))return void(!qe.current&&Ge(!0));const t=o?-1:ut.findIndex((e=>e.isSelected)),n=t>-1?t:e===v?0:ut.length-1;!qe.current&&Ge(!0),nt({index:n,...ut[n]}),gt(n)}),[o,ut]),bt=e.useCallback((e=>{dt((t=>t.filter((({value:t})=>t!==e))))}),[]),vt=e.useCallback(((e,t)=>{t?o&&bt(e.value):dt((t=>o?[...t,e]:[e]));(I(ue)?ue:$)?ft():ke&&(Ge(!1),_e(""))}),[o,ke,bt,ue]);e.useImperativeHandle($e,(()=>({empty:!M(st),menuOpen:Xe,blur:ft,focus:mt,clearValue:()=>{vt.length&&dt(C),tt.data&&nt(x)},setValue:e=>{const t=N(e,at,it);dt(t)},toggleMenu:e=>{!0===e||void 0===e&&!Xe?(!Je&&mt(),ht(v)):ft()}}))),e.useEffect((()=>{u&&mt()}),[]),e.useEffect((()=>{qe.current=Xe}),[Xe]),e.useEffect((()=>{Je&&ie&&ht(v)}),[Je,ie,ht]),e.useEffect((()=>{G&&We.current&&(We.current=!1,G(lt))}),[G,lt]),ne((()=>{if(!X)return;const e=o?st.map((e=>e.data)):M(st)?st[0].data:null;X(e)}),[o,st,X]),ne((()=>{const e=ut.length>0&&(n||ut.length!==Re.length||0===Pe.current);0===ut.length?nt(x):(1===ut.length||e)&&(nt({index:0,...ut[0]}),gt(0)),Pe.current=ut.length}),[n,Re,ut]);const wt=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:i}=tt;e&&!i&&vt({data:e,value:t,label:n},o)},yt=e=>{const t="ArrowDown"===e,n=t?v:b;Xe?(e=>{if(!M(ut))return;const t=e===h?(tt.index+1)%ut.length:tt.index>0?tt.index-1:ut.length-1;Ze&&et(null),nt({index:t,...ut[t]}),gt(t)})(t?h:g):ht(n)},xt=e=>{if(V)return;Je||mt();const t="INPUT"!==e.currentTarget.tagName;Xe?t&&(Xe&&Ge(!1),Ye&&_e("")):Ie&&ht(v),t&&e.preventDefault()},Ct=e.useCallback((e=>{null==q||q(e),Qe(!1),Ge(!1),_e("")}),[q]),Ot=e.useCallback((e=>{null==U||U(e),Qe(!0)}),[U]),St=e.useCallback((e=>{const t=e.currentTarget.value||"";We.current=!0,null==Y||Y(t),!qe.current&&Ge(!0),_e(t)}),[Y]),It=e.useCallback((e=>{z(e),dt(C),mt()}),[]),Et=e.useCallback((e=>{z(e,"mousedown"===e.type),mt(),qe.current?Ge(!1):ht(v)}),[ht]),Mt=!Se||Se&&Xe,kt=V||!Oe||!!Ze,zt=!(!P||V||!M(st)),Lt=V||Ie?void 0:Et;return a.default.createElement(t.ThemeProvider,{theme:ot},a.default.createElement(ve,Object.assign({id:r,"aria-controls":i,"aria-expanded":Xe,onKeyDown:e=>{if(!(V||y&&(y(e,Ye,tt),e.defaultPrevented))){switch(e.key){case"ArrowDown":case"ArrowUp":yt(e.key);break;case"ArrowLeft":case"ArrowRight":if(!o||Ye||fe)return;(e=>{if(!M(st))return;let t=-1;const n=st.length-1,o=Ze?st.findIndex((e=>e.value===Ze)):-1;t=e===f?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const i=t>=0?st[t].value:null;tt.data&&nt(x),i!==Ze&&et(i)})("ArrowLeft"===e.key?m:f);break;case" ":if(Ye)return;if(Xe){if(!tt.data)return;wt()}else ht(v);break;case"Enter":Xe&&229!==e.keyCode&&wt();break;case"Escape":Xe&&(Ge(!1),_e(""));break;case"Tab":if(!Xe||!Me||!tt.data||e.shiftKey)return;wt();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(!Le)return;if(!M(st))break;if(o&&!fe){const{value:e}=st[st.length-1];bt(e)}else P&&dt(C)}break;default:return}e.preventDefault()}}},l),a.default.createElement(ye,{ref:Ue,isInvalid:L,isFocused:Je,isDisabled:V,className:"rfs-control-container",onTouchEnd:xt,onMouseDown:xt},a.default.createElement(we,null,a.default.createElement(ee,{isMulti:o,inputValue:Ye,placeholder:Ve,selectedOption:st,focusedMultiValue:Ze,renderOptionLabel:rt,renderMultiOptions:fe,removeSelectedOption:bt}),a.default.createElement(re,{id:i,ref:He,required:s,ariaLabel:R,inputValue:Ye,readOnly:kt,onBlur:Ct,onFocus:Ot,onChange:St,ariaLabelledBy:_,selectedOption:st})),a.default.createElement(be,{menuOpen:Xe,clearIcon:S,caretIcon:E,isInvalid:L,isLoading:w,showClear:zt,isDisabled:V,loadingNode:j,onClearMouseDown:It,onCaretMouseDown:Lt})),Mt&&a.default.createElement(H,{menuRef:Ke,menuOpen:Xe,isLoading:w,menuTop:ct,height:pt,itemSize:Fe,loadingMsg:Te,menuOptions:ut,fixedSizeListRef:je,noOptionsMsg:Ae,selectOption:vt,direction:ce,itemKeySelector:Z,overscanCount:de,menuPortalTarget:ae,width:T||ot.menu.width,onMenuMouseDown:e=>{z(e),mt()},renderOptionLabel:rt,focusedOptionIndex:tt.index}),le&&a.default.createElement(se,{ariaLive:d,menuOpen:Xe,isFocused:Je,ariaLabel:R,inputValue:Ye,isSearchable:Oe,focusedOption:tt,selectedOption:st,optionCount:ut.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 i,useState as r,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 w={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container"},v={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,N=3,z=m(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),L=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"],z),color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 0.9375rem",clear:{width:"14px",height:"16px",animation:L,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:L,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:L,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 Array.isArray(e)&&!!e.length}function R(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function F(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(A,"")}(o):o}const $=(e,t,n)=>{const o=Array.isArray(e)?e:R(e)?[e]:P;return B(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},W=(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 i=n[e];o[e]=R(i)&&"animation"!==e?e in t?W(t[e],i):i:i||""})),o};function q(e){return K(e)?window.pageYOffset:e.scrollTop}function K(e){return e===document.documentElement||e===document.body||e===window}function U({overflow:e,overflowX:t,overflowY:n}){const o=e=>"auto"===e||"scroll"===e;return o(e)||o(t)||o(n)}function H(e){let t=getComputedStyle(e);const n="absolute"===t.position;if("fixed"===t.position)return document.documentElement;for(let i=e;i=null===(o=i)||void 0===o?void 0:o.parentElement;){var o;if(t=getComputedStyle(i),(!n||"static"!==t.position)&&U(t))return i}return document.documentElement}function Y(e,t,n=300,o){let i=0;const r=q(e),a=t-r;window.requestAnimationFrame((function t(){var l;i+=5,function(e,t){K(e)?window.scrollTo(0,t):e.scrollTop=t}(e,a*((l=(l=i)/n-1)*l*l+1)+r),i<n?window.requestAnimationFrame(t):null==o||o()}))}const X="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,G="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent),J=n((({index:e,style:n,data:{menuOptions:o,selectOption:i,renderOptionLabel:r,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:()=>i({data:l,value:s,label:c},u),className:p},r(l))}),h);J.displayName="Option";const Q=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)),Z=({width:e,height:n,itemSize:r,isLoading:a,loadingMsg:l,menuOptions:s,selectOption:c,noOptionsMsg:d,overscanCount:u,itemKeySelector:p,fixedSizeListRef:m,renderOptionLabel:f,focusedOptionIndex:g})=>{const h=o((()=>({menuOptions:s,selectOption:c,renderOptionLabel:f,focusedOptionIndex:g})),[s,g,c,f]);if(a)return t.createElement(Q,null,l);return t.createElement(i,null,t.createElement(b,{width:e,height:n,itemKey:p?(e,t)=>t.menuOptions[e][p]:void 0,itemSize:r,itemData:h,ref:m,overscanCount:u,itemCount:s.length},J),!B(s)&&d&&t.createElement(Q,null,d))},_=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"))),ee=e=>{let{menuRef:n,menuTop:o,menuOpen:i,onMenuMouseDown:r,menuPortalTarget:a}=e,l=g(e,["menuRef","menuTop","menuOpen","onMenuMouseDown","menuPortalTarget"]);const s=i&&!Boolean(l.noOptionsMsg)&&!B(l.menuOptions),c=t.createElement(_,{ref:n,menuTop:o,menuOpen:i,onMouseDown:r,className:"rfs-menu-container",hideNoOptionsMsg:s},t.createElement(Z,Object.assign({},l)));return a?y(c,a):c},te=p(["z-index:5000;transform:scale(1.26);color:",";"],(({theme:e})=>e.multiValue.clear.focusColor)),ne=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)),oe=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)),ie=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,te)),(({isFocused:e})=>e&&te)),re=n((({data:e,value:n,isFocused:o,renderOptionLabel:i,removeSelectedOption:r})=>t.createElement(ne,null,t.createElement(oe,null,i(e)),t.createElement(ie,{isFocused:o,onTouchEnd:e=>r(n,e),onMouseDown:e=>r(n,e)},"✖"))));re.displayName="MultiValue";const ae=p(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),le=u.div.withConfig({displayName:"SingleValue",componentId:"sc-153h0ct-0"})([""," max-width:calc(100% - 0.5rem);"],ae),se=u.div.withConfig({displayName:"Placeholder",componentId:"sc-153h0ct-1"})([""," color:",";",""],ae,(({theme:e})=>e.color.placeholder),(({theme:e,isMulti:t})=>t&&p(["animation:",";"],e.multiValue.animation))),ce=({isMulti:e,inputValue:n,placeholder:o,selectedOption:r,focusedMultiValue:a,renderOptionLabel:l,renderMultiOptions:s,removeSelectedOption:c})=>!n||e&&(!e||B(r)&&!s)?B(r)?e?t.createElement(i,null,s?s({renderOptionLabel:l,selected:r}):r.map((({data:e,value:n})=>t.createElement(re,{key:n,data:e,value:n,renderOptionLabel:l,isFocused:n===a,removeSelectedOption:c})))):t.createElement(le,null,l(r[0].data)):t.createElement(se,{isMulti:e},o):null;function de(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 ue(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?de(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):de(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}const pe=(e,t,n,o,i,l,s,c,d,u,p,m,f)=>{const[g,h]=r(P),b=f?"":t,y="boolean"!=typeof m?!!p:m;return a((()=>{const t=F(b,d,u),r=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=i(e),s=ue(ue({data:e,value:o,label:l(e)},a(e)&&{isDisabled:!0}),(null==r?void 0:r.has(o))&&{isSelected:!0});if(!(t&&!(e=>{const o=F(p(e),d,u);return n===I?o.indexOf(t)>-1:o.substr(0,t.length)===t})(s)||y&&s.isSelected))return s},f=[];for(let t=0;t<e.length;t++){const n=m(e[t]);n&&f.push(n)}h(f)}),[e,o,b,y,n,d,u,c,s,i,l]),g},me=(e,t)=>{const n=l(!0);a((()=>{if(!n.current)return e();n.current=!1}),t)},fe=(e,t,n,o,i,s,c,d,u,p,m)=>{const f=l(!1),g=l(!1),[h,b]=r(s),[y,w]=r(o===O);a((()=>{const t=o===O||o===x&&!(e=>{if(!e)return!0;const t=H(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-q(t)-n>=o})(e.current);w(t),g.current=y}),[e,o]),me((()=>{if(n){const t=e=>{null==p||p(),e&&(f.current=!0,b(e))};g.current?t():((e,t,n,o)=>{if(!e)return void o();const{top:i,height:r,bottom:a}=e.getBoundingClientRect(),l=window.innerHeight;if(l-i>=r)return void o();const s=H(e),c=q(s),d=s.getBoundingClientRect().height-c-i,u=d<r;if(u||!n)return void o(u?d:void 0);Y(s,a-l+c+parseInt(getComputedStyle(e).marginBottom,10),t,o)})(e.current,d,u,t)}else null==m||m(),f.current&&(f.current=!1,b(s))}),[e,n,m,p,s,u,d]);const v=Math.min(h,c*i);return[y?((e,t,n)=>{const o=e>0||!t?e:t.getBoundingClientRect().height,i=n?n.getBoundingClientRect().height:0,r=t&&getComputedStyle(t),a=r?parseInt(r.marginBottom,10):0,l=r?parseInt(r.marginTop,10):0;return"calc("+-Math.abs(o+i)+"px + "+(a+l)+"px)"})(v,e.current,t.current):void 0,v]},ge=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)),he=u.input.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),G&&"::-ms-clear{display:none;}"),be=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]=r(2),y=s&&!B(m);return me((()=>{g.current&&b(g.current.scrollWidth+2)}),[u]),t.createElement(i,null,t.createElement(he,Object.assign({id:e,ref:f,isInvalid:!0,onBlur:n,onFocus:o,value:u,readOnly:a,required:y,"aria-label":d,style:{width:h}},v,{"aria-labelledby":p,onChange:a?void 0:c})),t.createElement(ge,{ref:g},u))})));be.displayName="AutosizeInput";const ye=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);"]),we=({menuOpen:e,isFocused:n,ariaLabel:o,inputValue:i,optionCount:r,isSearchable:a,focusedOption:l,selectedOption:s,ariaLive:c="polite"})=>{if(!n)return null;const d=`${r} result(s) available${i?" for search input "+i:""}.`,u=l.value?`Focused option: ${l.label}${l.isDisabled?" - disabled":""}, ${l.index+1} of ${r}.`:"",p=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.":`${o||"Select"} is focused${a?", type to filter options":""}, press Down arrow key to open the menu.`,m=B(s)?s.map((({label:e})=>e)).join(" "):"N/A",f=u+d+p;return t.createElement(ye,{"aria-atomic":"false","aria-live":c,"aria-relevant":"additions text"},t.createElement("span",{id:"aria-context"},"Selected option: "+m),t.createElement("span",{id:"aria-selection"},f))},ve=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))),Oe=()=>t.createElement(ve,{"aria-hidden":!0,className:"rfs-loading-dots"},t.createElement("div",null),t.createElement("div",null),t.createElement("div",null)),xe=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))),Ce=()=>t.createElement(xe,{"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"})),Ie=u.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1561oeb-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),Se=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)),Ee=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))),De=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)),Me=n((({menuOpen:e,clearIcon:n,caretIcon:o,isInvalid:i,showClear:r,isLoading:a,isDisabled:l,loadingNode:s,onCaretMouseDown:c,onClearMouseDown:d})=>{const u="function"==typeof o||"function"==typeof n?{menuOpen:e,isLoading:!!a,isInvalid:!!i,isDisabled:!!l}:void 0,p=e=>"function"==typeof e?e(u):e;return t.createElement(Ie,null,r&&!a&&t.createElement(Se,{onTouchEnd:d,onMouseDown:d},p(n)||t.createElement(Ce,null)),a&&(s||t.createElement(Oe,null)),t.createElement(De,null),t.createElement(Se,{onTouchEnd:c,onMouseDown:c},p(o)||t.createElement(Ee,{"aria-hidden":!0,menuOpen:e,isInvalid:i,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 Ne(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?ke(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):ke(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}Me.displayName="IndicatorIcons";const ze=u.div.withConfig({displayName:"SelectWrapper",componentId:"kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(({theme:e})=>e.select.css)),Le=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)),je=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:i}})=>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?i.danger:t?o.focusedBorderColor:i.border,o.height?`height: ${o.height};`:"",e?"pointer-events:none;user-select:none;":"",o.backgroundColor||e?`background-color: ${e?i.disabled:o.backgroundColor};`:"",t?`box-shadow: ${o.boxShadow} ${n?i.dangerLight:o.boxShadowColor};`:"")),(({theme:e})=>e.control.css),(({isFocused:e,theme:t})=>e&&t.control.focusedCss)),Pe=s((({async:e,isMulti:n,inputId:i,selectId:s,required:u,ariaLive:p,autoFocus:m,isLoading:g,onKeyDown:h,clearIcon:b,caretIcon:y,isInvalid:v,ariaLabel:O,menuWidth:x,isDisabled:z,inputDelay:L,onMenuOpen:V,onMenuClose:A,onInputBlur:F,isClearable:q,themeConfig:K,loadingNode:U,initialValue:H,onInputFocus:Y,onInputChange:G,ariaLabelledBy:J,onOptionChange:Q,onSearchChange:Z,getOptionLabel:_,getOptionValue:te,itemKeySelector:ne,openMenuOnFocus:oe,menuPortalTarget:ie,isAriaLiveEnabled:re,menuOverscanCount:ae,blurInputOnSelect:le,renderOptionLabel:se,renderMultiOptions:de,menuScrollDuration:ue,filterIgnoreAccents:ge,hideSelectedOptions:he,getIsOptionDisabled:ye,getFilterOptionString:ve,isSearchable:Oe=!0,lazyLoadMenu:xe=!1,openMenuOnClick:Ce=!0,filterIgnoreCase:Ie=!0,tabSelectsOption:Se=!0,closeMenuOnSelect:Ee=!0,scrollMenuIntoView:De=!0,backspaceClearsValue:ke=!0,filterMatchFrom:Pe=I,menuPosition:Te=C,options:Ve=P,loadingMsg:Ae="Loading..",placeholder:Be="Select option..",noOptionsMsg:Re="No options",menuItemSize:Fe=35,menuMaxHeight:$e=300},We)=>{const qe=l(!1),Ke=l(),Ue=l(!1),He=l(null),Ye=l(null),Xe=l(null),Ge=l(null),[Je,Qe]=r(""),[Ze,_e]=r(!1),[et,tt]=r(!1),[nt,ot]=r(null),[it,rt]=r(j),at=o((()=>R(K)?W(T,K):T),[K]),lt=o((()=>_||(e=>e.label)),[_]),st=o((()=>te||(e=>e.value)),[te]),ct=o((()=>se||lt),[se,lt]),dt=((e,t)=>{const[n,o]=r(e);return a((()=>{if(void 0===t)return;const n=setTimeout((()=>{o(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),void 0===t?e:n})(Je,L),[ut,pt]=r((()=>$(H,st,lt))),mt=pe(Ve,dt,Pe,ut,st,lt,ye,ve,Ie,ge,n,he,e),[ft,gt]=fe(Ye,Ge,Ze,Te,Fe,$e,mt.length,ue,De,V,A),ht=()=>{var e;return null===(e=Xe.current)||void 0===e?void 0:e.blur()},bt=()=>{var e;return null===(e=Xe.current)||void 0===e?void 0:e.focus()},yt=e=>{var t;return null===(t=He.current)||void 0===t?void 0:t.scrollToItem(e)},wt=(e,t=!0)=>{e.stopPropagation(),t&&e.preventDefault()},vt=c(((e,t)=>{t&&wt(t,"mousedown"===t.type),pt((t=>t.filter((t=>t.value!==e))))}),[]),Ot=c((e=>{if(!B(mt))return void(!qe.current&&_e(!0));const t=n?-1:mt.findIndex((({isSelected:e})=>e)),o=t>-1?t:e===N?0:mt.length-1;!qe.current&&_e(!0),rt(Ne({index:o},mt[o])),yt(o)}),[n,mt]),xt=c(((e,t)=>{t?n&&vt(e.value):pt((t=>n?[...t,e]:[e]));("boolean"==typeof le?le:X)?ht():Ee&&(_e(!1),Qe(""))}),[n,Ee,vt,le]);d(We,(()=>({menuOpen:Ze,empty:!B(ut),blur:ht,focus:bt,clearValue:()=>{pt(P),rt(j)},setValue:e=>{const t=$(e,st,lt);pt(t)},toggleMenu:e=>{!0===e||void 0===e&&!Ze?(!et&&bt(),Ot(N)):ht()}}))),a((()=>{m&&bt()}),[]),a((()=>{qe.current=Ze}),[Ze]),a((()=>{et&&oe&&Ot(N)}),[et,oe,Ot]),a((()=>{Z&&Ue.current&&(Ue.current=!1,Z(dt))}),[Z,dt]),me((()=>{if(!Q)return;const e=n?ut.map((e=>e.data)):B(ut)?ut[0].data:null;Q(e)}),[n,ut,Q]),me((()=>{const t=mt.length>0&&(e||mt.length!==Ve.length||0===Ke.current);0===mt.length?rt(j):(1===mt.length||t)&&(rt(Ne({index:0},mt[0])),yt(0)),Ke.current=mt.length}),[e,Ve,mt]);const Ct=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:i}=it;e&&!i&&xt({data:e,value:t,label:n},o)},It=e=>{z||(et||bt(),Ze?"INPUT"!==e.currentTarget.tagName&&(Ze&&_e(!1),Je&&Qe("")):Ce&&Ot(N),"INPUT"!==e.currentTarget.tagName&&e.preventDefault())},St=c((e=>{null==F||F(e),tt(!1),_e(!1),Qe("")}),[F]),Et=c((e=>{null==Y||Y(e),tt(!0)}),[Y]),Dt=c((e=>{Ue.current=!0,null==G||G(e.currentTarget.value||""),!qe.current&&_e(!0),Qe(e.currentTarget.value||"")}),[G]),Mt=c((e=>{wt(e,"mousedown"===e.type),pt(P),bt()}),[]),kt=c((e=>{wt(e,"mousedown"===e.type),bt(),qe.current?_e(!1):Ot(N)}),[Ot]),Nt=!xe||xe&&Ze,zt=z||!Oe||!!nt,Lt=!(!q||z||!B(ut)),jt=z||Ce?void 0:kt;return t.createElement(f,{theme:at},t.createElement(ze,Object.assign({id:s,"aria-controls":i,"aria-expanded":Ze,onKeyDown:e=>{if(!(z||h&&(h(e,Je,it),e.defaultPrevented))){switch(e.key){case"ArrowDown":case"ArrowUp":{const t="ArrowDown"===e.key;Ze?(e=>{if(!B(mt))return;const t=e===M?(it.index+1)%mt.length:it.index>0?it.index-1:mt.length-1;nt&&ot(null),rt(Ne({index:t},mt[t])),yt(t)})(t?M:D):Ot(t?N:k);break}case"ArrowLeft":case"ArrowRight":if(!n||Je||de)return;(e=>{if(!B(ut))return;let t=-1;const n=ut.length-1,o=nt?ut.findIndex((e=>e.value===nt)):-1;t=e===S?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const i=t>=0?ut[t].value:null;it.data&&rt(j),i!==nt&&ot(i)})("ArrowLeft"===e.key?E:S);break;case" ":if(Je)return;if(Ze){if(!it.data)return;Ct()}else Ot(N);break;case"Enter":Ze&&229!==e.keyCode&&Ct();break;case"Escape":Ze&&(_e(!1),Qe(""));break;case"Tab":if(!Ze||!Se||!it.data||e.shiftKey)return;Ct();break;case"Delete":case"Backspace":if(Je)return;if(nt){const e=ut.findIndex((e=>e.value===nt)),t=e>-1&&e<ut.length-1?ut[e+1].value:null;vt(nt),ot(t)}else{if(!ke)return;if(B(ut))if(n&&!de){const{value:e}=ut[ut.length-1];vt(e)}else q&&pt(P)}break;default:return}e.preventDefault()}}},w),t.createElement(je,{ref:Ge,isInvalid:v,isFocused:et,isDisabled:z,className:"rfs-control-container",onTouchEnd:It,onMouseDown:It},t.createElement(Le,null,t.createElement(ce,{isMulti:n,inputValue:Je,placeholder:Be,selectedOption:ut,focusedMultiValue:nt,renderOptionLabel:ct,renderMultiOptions:de,removeSelectedOption:vt}),t.createElement(be,{id:i,ref:Xe,required:u,ariaLabel:O,inputValue:Je,readOnly:zt,onBlur:St,onFocus:Et,onChange:Dt,ariaLabelledBy:J,selectedOption:ut})),t.createElement(Me,{menuOpen:Ze,clearIcon:b,caretIcon:y,isInvalid:v,isLoading:g,showClear:Lt,isDisabled:z,loadingNode:U,onClearMouseDown:Mt,onCaretMouseDown:jt})),Nt&&t.createElement(ee,{menuRef:Ye,menuOpen:Ze,isLoading:g,menuTop:ft,height:gt,itemSize:Fe,loadingMsg:Ae,menuOptions:mt,fixedSizeListRef:He,noOptionsMsg:Re,selectOption:xt,itemKeySelector:ne,overscanCount:ae,menuPortalTarget:ie,width:x||at.menu.width,onMenuMouseDown:e=>{wt(e),bt()},renderOptionLabel:ct,focusedOptionIndex:it.index}),re&&t.createElement(we,{ariaLive:p,menuOpen:Ze,isFocused:et,ariaLabel:O,inputValue:Je,isSearchable:Oe,focusedOption:it,selectedOption:ut,optionCount:mt.length})))}));Pe.displayName="Select";export{Pe as Select}; | ||
import e from"@babel/runtime/helpers/esm/defineProperty";import t,{memo as n,useMemo as o,Fragment as i,useState as r,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"function"==typeof e}function F(e){return Array.isArray(e)&&!!e.length}function $(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}const W=(e,t=!0)=>{t&&e.preventDefault(),e.stopPropagation()};function q(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(A,"")}(o):o}const K=(e,t,n)=>{const o=Array.isArray(e)?e:$(e)?[e]:P;return F(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},H=(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 i=n[e];o[e]="animation"!==e&&$(i)?t[e]?H(t[e],i):i:i||""})),o};function U(e){return Y(e)?window.pageYOffset:e.scrollTop}function Y(e){return e===document.documentElement||e===document.body||e===window}const X=/(auto|scroll)/;function G({overflow:e,overflowX:t,overflowY:n}){return X.test(`${e}${t}${n}`)}function J(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)&&G(t))return n}return n}function Q(e,t,n=300,o){let i=0;const r=U(e),a=t-r;requestAnimationFrame((function t(){var l;i+=5,function(e,t){Y(e)?window.scrollTo(0,t):e.scrollTop=t}(e,a*((l=(l=i)/n-1)*l*l+1)+r),i<n?requestAnimationFrame(t):null==o||o()}))}const Z="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,_="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent),ee=n((({index:e,style:n,data:{menuOptions:o,selectOption:i,renderOptionLabel:r,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:()=>i({data:l,value:s,label:c},u),className:p},r(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:r,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(te,null,s);return t.createElement(i,null,t.createElement(b,{width:e,height:n,itemKey:m?(e,t)=>t.menuOptions[e][m]:void 0,itemSize:r,itemData:y,direction:a,ref:f,overscanCount:p,itemCount:c.length},ee),!F(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"))),ie=e=>{let{menuRef:n,menuTop:o,menuOpen:i,onMenuMouseDown:r,menuPortalTarget:a}=e,l=g(e,["menuRef","menuTop","menuOpen","onMenuMouseDown","menuPortalTarget"]);const{menuOptions:s,noOptionsMsg:c}=l,d=i&&!Boolean(c)&&!F(s),u=t.createElement(oe,{ref:n,menuTop:o,menuOpen:i,onMouseDown:r,className:"rfs-menu-container",hideNoOptionsMsg:d},t.createElement(ne,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)),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,re)),(({isFocused:e})=>e&&re)),ce=n((({data:e,value:n,isFocused:o,renderOptionLabel:i,removeSelectedOption:r})=>t.createElement(ae,null,t.createElement(le,null,i(e)),t.createElement(se,{isFocused:o,onMouseDown:W,onClick:()=>r(n),onTouchEnd:()=>r(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:r,focusedMultiValue:a,renderOptionLabel:l,renderMultiOptions:s,removeSelectedOption:c})=>!n||e&&(!e||F(r)&&!s)?F(r)?e?t.createElement(i,null,s?s({renderOptionLabel:l,selected:r}):r.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(r[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,i,l,s,c,d,u,p,m,f)=>{const[g,h]=r(P),b=f?"":t,y=B(m)?m:!!p;return a((()=>{const t=q(b,d,u),r=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=i(e),s=ge(ge({data:e,value:o,label:l(e)},a(e)&&{isDisabled:!0}),(null==r?void 0:r.has(o))&&{isSelected:!0});if(!(t&&!(e=>{const o=q(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,i,l]),g},be=(e,t)=>{const n=l(!0);a((()=>{if(!n.current)return e();n.current=!1}),t)},ye=(e,t,n,o,i,s,c,d,u,p,m,f)=>{const g=l(!1),h=l(!d),[b,y]=r(s),[v,w]=r(!1);a((()=>{h.current=!v&&!d}),[v,d]),a((()=>{const t=o===O||o===x&&!(e=>{if(!e)return!0;const t=J(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-U(t)-n>=o})(e.current);w(t)}),[e,o]),be((()=>{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:i,height:r,bottom:a}=e.getBoundingClientRect(),l=window.innerHeight;if(l-i>=r)return void o();const s=J(e),c=U(s),d=s.getBoundingClientRect().height-c-i,u=d<r;if(u||!n)return void o(u?d:void 0);Q(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*i);return[v?((e,t,n)=>{const o=e>0||!t?e:t.getBoundingClientRect().height,i=n?n.getBoundingClientRect().height:0,r=t&&getComputedStyle(t),a=r?parseInt(r.marginBottom,10):0,l=r?parseInt(r.marginTop,10):0;return"calc("+-Math.abs(o+i)+"px + "+(a+l)+"px)"})(C,e.current,t.current):void 0,C]},ve=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.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;}"),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]=r(2),y=s&&!F(m);return be((()=>{g.current&&b(g.current.scrollWidth+2)}),[u]),t.createElement(i,null,t.createElement(we,Object.assign({id:e,ref:f,isInvalid:!0,onBlur:n,onFocus:o,value:u,readOnly:a,required:y,"aria-label":d,style:{width:h}},w,{"aria-labelledby":p,onChange:a?void 0:c})),t.createElement(ve,{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,ariaLabel:o,inputValue:i,optionCount:r,isSearchable:a,focusedOption:l,selectedOption:s,ariaLive:c="polite"})=>{if(!n)return null;const d=`${r} result(s) available${i?" for search input "+i:""}.`,u=l.value?`Focused option: ${l.label}${l.isDisabled?" - disabled":""}, ${l.index+1} of ${r}.`:"",p=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.":`${o||"Select"} is focused${a?", type to filter options":""}, press Down arrow key to open the menu.`,m=F(s)?s.map((({label:e})=>e)).join(" "):"N/A",f=u+d+p;return t.createElement(xe,{"aria-atomic":"false","aria-live":c,"aria-relevant":"additions text"},t.createElement("span",{id:"aria-context"},"Selected option: "+m),t.createElement("span",{id:"aria-selection"},f))},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:i,showClear:r,isLoading:a,isDisabled:l,loadingNode:s,onCaretMouseDown:c,onClearMouseDown:d})=>{const u=R(o)||R(n)?{menuOpen:e,isLoading:!!a,isInvalid:!!i,isDisabled:!!l}:void 0,p=e=>R(e)?e(u):e;return t.createElement(Me,null,r&&!a&&t.createElement(ke,{onTouchEnd:d,onMouseDown:d},p(n)||t.createElement(De,null)),a&&(s||t.createElement(Se,null)),t.createElement(Le,null),t.createElement(ke,{onTouchEnd:c,onMouseDown:c},p(o)||t.createElement(ze,{"aria-hidden":!0,menuOpen:e,isInvalid:i,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.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:i}})=>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?i.danger:t?o.focusedBorderColor:i.border,o.height?`height: ${o.height};`:"",e?"pointer-events:none;user-select:none;":"",o.backgroundColor||e?`background-color: ${e?i.disabled:o.backgroundColor};`:"",t?`box-shadow: ${o.boxShadow} ${n?i.dangerLight:o.boxShadowColor};`:"")),(({theme:e})=>e.control.css),(({isFocused:e,theme:t})=>e&&t.control.focusedCss)),Be=s((({async:e,isMulti:n,inputId:i,selectId:s,required:u,ariaLive:p,autoFocus:m,isLoading:g,onKeyDown:h,clearIcon:b,caretIcon:y,isInvalid:w,ariaLabel:O,menuWidth:x,isDisabled:L,inputDelay:N,onMenuOpen:V,onMenuClose:A,onInputBlur:R,isClearable:q,themeConfig:U,loadingNode:Y,initialValue:X,onInputFocus:G,onInputChange:J,ariaLabelledBy:Q,onOptionChange:_,onSearchChange:ee,getOptionLabel:te,getOptionValue:ne,itemKeySelector:oe,openMenuOnFocus:re,menuPortalTarget:ae,isAriaLiveEnabled:le,menuOverscanCount:se,blurInputOnSelect:ce,menuItemDirection:de,renderOptionLabel:ue,renderMultiOptions:pe,menuScrollDuration:fe,filterIgnoreAccents:ge,hideSelectedOptions:ve,getIsOptionDisabled:we,getFilterOptionString:xe,isSearchable:Ie=!0,lazyLoadMenu:Se=!1,openMenuOnClick:Ee=!0,filterIgnoreCase:De=!0,tabSelectsOption:Me=!0,closeMenuOnSelect:ke=!0,scrollMenuIntoView:ze=!0,backspaceClearsValue:Le=!0,filterMatchFrom:je=I,menuPosition:Be=C,options:Re=P,loadingMsg:Fe="Loading..",placeholder:$e="Select option..",noOptionsMsg:We="No options",menuItemSize:qe=35,menuMaxHeight:Ke=300},He)=>{const Ue=l(!1),Ye=l(),Xe=l(!1),Ge=l(null),Je=l(null),Qe=l(null),Ze=l(null),[_e,et]=r(""),[tt,nt]=r(!1),[ot,it]=r(!1),[rt,at]=r(null),[lt,st]=r(j),ct=o((()=>$(U)?H(T,U):T),[U]),dt=o((()=>te||(e=>e.label)),[te]),ut=o((()=>ne||(e=>e.value)),[ne]),pt=o((()=>ue||dt),[ue,dt]),mt=((e,t=0)=>{const[n,o]=r(e);return a((()=>{if(t<=0)return;const n=setTimeout((()=>{o(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),t<=0?e:n})(_e,N),[ft,gt]=r((()=>K(X,ut,dt))),ht=he(Re,mt,je,ft,ut,dt,we,xe,De,ge,n,ve,e),[bt,yt]=ye(Je,Ze,tt,Be,qe,Ke,ht.length,!!ae,fe,ze,V,A),vt=()=>{var e;return null===(e=Qe.current)||void 0===e?void 0:e.blur()},wt=()=>{var e;return null===(e=Qe.current)||void 0===e?void 0:e.focus()},Ot=e=>{var t;return null===(t=Ge.current)||void 0===t?void 0:t.scrollToItem(e)},xt=c((e=>{if(!F(ht))return void(!Ue.current&&nt(!0));const t=n?-1:ht.findIndex((e=>e.isSelected)),o=t>-1?t:e===z?0:ht.length-1;!Ue.current&&nt(!0),st(Pe({index:o},ht[o])),Ot(o)}),[n,ht]),Ct=c((e=>{gt((t=>t.filter((({value:t})=>t!==e))))}),[]),It=c(((e,t)=>{t?n&&Ct(e.value):gt((t=>n?[...t,e]:[e]));(B(ce)?ce:Z)?vt():ke&&(nt(!1),et(""))}),[n,ke,Ct,ce]);d(He,(()=>({empty:!F(ft),menuOpen:tt,blur:vt,focus:wt,clearValue:()=>{It.length&>(P),lt.data&&st(j)},setValue:e=>{const t=K(e,ut,dt);gt(t)},toggleMenu:e=>{!0===e||void 0===e&&!tt?(!ot&&wt(),xt(z)):vt()}}))),a((()=>{m&&wt()}),[]),a((()=>{Ue.current=tt}),[tt]),a((()=>{ot&&re&&xt(z)}),[ot,re,xt]),a((()=>{ee&&Xe.current&&(Xe.current=!1,ee(mt))}),[ee,mt]),be((()=>{if(!_)return;const e=n?ft.map((e=>e.data)):F(ft)?ft[0].data:null;_(e)}),[n,ft,_]),be((()=>{const t=ht.length>0&&(e||ht.length!==Re.length||0===Ye.current);0===ht.length?st(j):(1===ht.length||t)&&(st(Pe({index:0},ht[0])),Ot(0)),Ye.current=ht.length}),[e,Re,ht]);const St=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:i}=lt;e&&!i&&It({data:e,value:t,label:n},o)},Et=e=>{const t="ArrowDown"===e,n=t?z:k;tt?(e=>{if(!F(ht))return;const t=e===M?(lt.index+1)%ht.length:lt.index>0?lt.index-1:ht.length-1;rt&&at(null),st(Pe({index:t},ht[t])),Ot(t)})(t?M:D):xt(n)},Dt=e=>{if(L)return;ot||wt();const t="INPUT"!==e.currentTarget.tagName;tt?t&&(tt&&nt(!1),_e&&et("")):Ee&&xt(z),t&&e.preventDefault()},Mt=c((e=>{null==R||R(e),it(!1),nt(!1),et("")}),[R]),kt=c((e=>{null==G||G(e),it(!0)}),[G]),zt=c((e=>{const t=e.currentTarget.value||"";Xe.current=!0,null==J||J(t),!Ue.current&&nt(!0),et(t)}),[J]),Lt=c((e=>{W(e),gt(P),wt()}),[]),Nt=c((e=>{W(e,"mousedown"===e.type),wt(),Ue.current?nt(!1):xt(z)}),[xt]),jt=!Se||Se&&tt,Pt=L||!Ie||!!rt,Tt=!(!q||L||!F(ft)),Vt=L||Ee?void 0:Nt;return t.createElement(f,{theme:ct},t.createElement(Te,Object.assign({id:s,"aria-controls":i,"aria-expanded":tt,onKeyDown:e=>{if(!(L||h&&(h(e,_e,lt),e.defaultPrevented))){switch(e.key){case"ArrowDown":case"ArrowUp":Et(e.key);break;case"ArrowLeft":case"ArrowRight":if(!n||_e||pe)return;(e=>{if(!F(ft))return;let t=-1;const n=ft.length-1,o=rt?ft.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 i=t>=0?ft[t].value:null;lt.data&&st(j),i!==rt&&at(i)})("ArrowLeft"===e.key?E:S);break;case" ":if(_e)return;if(tt){if(!lt.data)return;St()}else xt(z);break;case"Enter":tt&&229!==e.keyCode&&St();break;case"Escape":tt&&(nt(!1),et(""));break;case"Tab":if(!tt||!Me||!lt.data||e.shiftKey)return;St();break;case"Delete":case"Backspace":if(_e)return;if(rt){const e=ft.findIndex((e=>e.value===rt)),t=e>-1&&e<ft.length-1?ft[e+1].value:null;Ct(rt),at(t)}else{if(!Le)return;if(!F(ft))break;if(n&&!pe){const{value:e}=ft[ft.length-1];Ct(e)}else q&>(P)}break;default:return}e.preventDefault()}}},v),t.createElement(Ae,{ref:Ze,isInvalid:w,isFocused:ot,isDisabled:L,className:"rfs-control-container",onTouchEnd:Dt,onMouseDown:Dt},t.createElement(Ve,null,t.createElement(me,{isMulti:n,inputValue:_e,placeholder:$e,selectedOption:ft,focusedMultiValue:rt,renderOptionLabel:pt,renderMultiOptions:pe,removeSelectedOption:Ct}),t.createElement(Oe,{id:i,ref:Qe,required:u,ariaLabel:O,inputValue:_e,readOnly:Pt,onBlur:Mt,onFocus:kt,onChange:zt,ariaLabelledBy:Q,selectedOption:ft})),t.createElement(Ne,{menuOpen:tt,clearIcon:b,caretIcon:y,isInvalid:w,isLoading:g,showClear:Tt,isDisabled:L,loadingNode:Y,onClearMouseDown:Lt,onCaretMouseDown:Vt})),jt&&t.createElement(ie,{menuRef:Je,menuOpen:tt,isLoading:g,menuTop:bt,height:yt,itemSize:qe,loadingMsg:Fe,menuOptions:ht,fixedSizeListRef:Ge,noOptionsMsg:We,selectOption:It,direction:de,itemKeySelector:oe,overscanCount:se,menuPortalTarget:ae,width:x||ct.menu.width,onMenuMouseDown:e=>{W(e),wt()},renderOptionLabel:pt,focusedOptionIndex:lt.index}),le&&t.createElement(Ce,{ariaLive:p,menuOpen:tt,isFocused:ot,ariaLabel:O,inputValue:_e,isSearchable:Ie,focusedOption:lt,selectedOption:ft,optionCount:ht.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",w=0,v=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 N=/[\u0300-\u036f]/g;function L(e){return Array.isArray(e)&&!!e.length}function P(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function R(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(N,"")}(o):o}const T=(e,t,n)=>{const o=Array.isArray(e)?e:P(e)?[e]:k;return L(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},V=(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]=P(r)&&"animation"!==o?o in e?V(e[o],r):r:r||""})),n};function A(e){return F(e)?window.pageYOffset:e.scrollTop}function F(e){return e===document.documentElement||e===document.body||e===window}function B({overflow:e,overflowX:t,overflowY:n}){const o=e=>"auto"===e||"scroll"===e;return o(e)||o(t)||o(n)}function $(e){let t=getComputedStyle(e);const n="absolute"===t.position;if("fixed"===t.position)return document.documentElement;for(let r=e;r=null===(o=r)||void 0===o?void 0:o.parentElement;){var o;if(t=getComputedStyle(r),(!n||"static"!==t.position)&&B(t))return r}return document.documentElement}function q(e,t,n=300,o){let r=0;const i=A(e),a=t-i;window.requestAnimationFrame((function t(){var l;r+=5,function(e,t){F(e)?window.scrollTo(0,t):e.scrollTop=t}(e,a*((l=(l=r)/n-1)*l*l+1)+i),r<n?window.requestAnimationFrame(t):null==o||o()}))}const W="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,K="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent),H=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);H.displayName="Option";const U=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)),Y=({width:e,height:n,itemSize:r,isLoading:i,loadingMsg:l,menuOptions:s,selectOption:d,noOptionsMsg:c,overscanCount:u,itemKeySelector:p,fixedSizeListRef:f,renderOptionLabel:m,focusedOptionIndex:g})=>{const h=t.useMemo((()=>({menuOptions:s,selectOption:d,renderOptionLabel:m,focusedOptionIndex:g})),[s,g,d,m]);if(i)return a.default.createElement(U,null,l);return a.default.createElement(t.Fragment,null,a.default.createElement(o.FixedSizeList,{width:e,height:n,itemKey:p?(e,t)=>t.menuOptions[e][p]:void 0,itemSize:r,itemData:h,ref:f,overscanCount:u,itemCount:s.length},H),!L(s)&&c&&a.default.createElement(U,null,c))},_=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))),X=e=>{let{menuRef:t,menuTop:n,menuOpen:o,onMenuMouseDown:i,menuPortalTarget:l}=e,s=j(e,["menuRef","menuTop","menuOpen","onMenuMouseDown","menuPortalTarget"]);const d=o&&!Boolean(s.noOptionsMsg)&&!L(s.menuOptions),c=a.default.createElement(_,{ref:t,menuTop:n,menuOpen:o,onMouseDown:i,className:"rfs-menu-container","data-testid":undefined,hideNoOptionsMsg:d},a.default.createElement(Y,Object.assign({},s)));return l?r.createPortal(c,l):c},G=n.css(["z-index:5000;transform:scale(1.26);color:",";"],(({theme:e})=>e.multiValue.clear.focusColor)),J=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)),Q=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)),Z=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,G)),(({isFocused:e})=>e&&G)),ee=t.memo((({data:e,value:t,isFocused:n,renderOptionLabel:o,removeSelectedOption:r})=>a.default.createElement(J,null,a.default.createElement(Q,null,o(e)),a.default.createElement(Z,{isFocused:n,"data-testid":undefined,onTouchEnd:e=>r(t,e),onMouseDown:e=>r(t,e)},"✖"))));ee.displayName="MultiValue";const te=n.css(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),ne=l.default.div.withConfig({displayName:"SingleValue",componentId:"sc-153h0ct-0"})([""," max-width:calc(100% - 0.5rem);"],te),oe=l.default.div.withConfig({displayName:"Placeholder",componentId:"sc-153h0ct-1"})([""," color:",";",""],te,(({theme:e})=>e.color.placeholder),(({theme:e,isMulti:t})=>t&&n.css(["animation:",";"],e.multiValue.animation))),re=({isMulti:e,inputValue:n,placeholder:o,selectedOption:r,focusedMultiValue:i,renderOptionLabel:l,renderMultiOptions:s,removeSelectedOption:d})=>!n||e&&(!e||L(r)&&!s)?L(r)?e?a.default.createElement(t.Fragment,null,s?s({renderOptionLabel:l,selected:r}):r.map((({data:e,value:t})=>a.default.createElement(ee,{key:t,data:e,value:t,renderOptionLabel:l,isFocused:t===i,removeSelectedOption:d})))):a.default.createElement(ne,null,l(r[0].data)):a.default.createElement(oe,{isMulti:e},o):null;function ie(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 ae(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ie(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ie(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const le=(e,n,o,r,i,a,l,s,d,c,u,p,f)=>{const[m,g]=t.useState(k),h=f?"":n,b="boolean"!=typeof p?!!u:p;return t.useEffect((()=>{const t=R(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=ae(ae({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=R(p(e),d,c);return o===y?n.indexOf(t)>-1:n.substr(0,t.length)===t})(l)||b&&l.isSelected))return l},m=[];for(let t=0;t<e.length;t++){const n=f(e[t]);n&&m.push(n)}g(m)}),[e,r,h,b,o,d,c,s,l,i,a]),m},se=(e,n)=>{const o=t.useRef(!0);t.useEffect((()=>{if(!o.current)return e();o.current=!1}),n)},de=(e,n,o,r,i,a,l,s,d,c,u)=>{const p=t.useRef(!1),f=t.useRef(!1),[m,b]=t.useState(a),[y,w]=t.useState(r===g);t.useEffect((()=>{const t=r===g||r===h&&!(e=>{if(!e)return!0;const t=$(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-A(t)-n>=o})(e.current);w(t),f.current=y}),[e,r]),se((()=>{if(o){const t=e=>{null==c||c(),e&&(p.current=!0,b(e))};f.current?t():((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=$(e),d=A(s),c=s.getBoundingClientRect().height-d-r,u=c<i;if(u||!n)return void o(u?c:void 0);q(s,a-l+d+parseInt(getComputedStyle(e).marginBottom,10),t,o)})(e.current,s,d,t)}else null==u||u(),p.current&&(p.current=!1,b(a))}),[e,o,u,c,a,d,s]);const v=Math.min(m,l*i);return[y?((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)"})(v,e.current,n.current):void 0,v]},ce=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)),ue=l.default.input.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),K&&"::-ms-clear{display:none;}"),pe=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),[g,h]=t.useState(2),b=i&&!L(u);return se((()=>{f.current&&h(f.current.scrollWidth+2)}),[d]),a.default.createElement(t.Fragment,null,a.default.createElement(ue,Object.assign({id:e,ref:p,isInvalid:!0,onBlur:n,onFocus:o,value:d,readOnly:r,required:b,"aria-label":s,style:{width:g}},m,{"aria-labelledby":c,onChange:r?void 0:l})),a.default.createElement(ce,{ref:f},d))})));pe.displayName="AutosizeInput";const fe=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);"]),me=({menuOpen:e,isFocused:t,ariaLabel:n,inputValue:o,optionCount:r,isSearchable:i,focusedOption:l,selectedOption:s,ariaLive:d="polite"})=>{if(!t)return null;const c=`${r} result(s) available${o?" for search input "+o:""}.`,u=l.value?`Focused option: ${l.label}${l.isDisabled?" - disabled":""}, ${l.index+1} of ${r}.`:"",p=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.":`${n||"Select"} is focused${i?", type to filter options":""}, press Down arrow key to open the menu.`,f=L(s)?s.map((({label:e})=>e)).join(" "):"N/A",m=u+c+p;return a.default.createElement(fe,{"aria-atomic":"false","aria-live":d,"aria-relevant":"additions text"},a.default.createElement("span",{id:"aria-context"},"Selected option: "+f),a.default.createElement("span",{id:"aria-selection"},m))},ge=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))),he=()=>a.default.createElement(ge,{"aria-hidden":!0,className:"rfs-loading-dots"},a.default.createElement("div",null),a.default.createElement("div",null),a.default.createElement("div",null)),be=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))),ye=()=>a.default.createElement(be,{"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"})),we=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;"]),ve=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)),Oe=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))),xe=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)),Ce=t.memo((({menuOpen:e,clearIcon:t,caretIcon:n,isInvalid:o,showClear:r,isLoading:i,isDisabled:l,loadingNode:s,onCaretMouseDown:d,onClearMouseDown:c})=>{const u="function"==typeof n||"function"==typeof t?{menuOpen:e,isLoading:!!i,isInvalid:!!o,isDisabled:!!l}:void 0,p=e=>"function"==typeof e?e(u):e;return a.default.createElement(we,null,r&&!i&&a.default.createElement(ve,{onTouchEnd:c,onMouseDown:c,"data-testid":undefined},p(t)||a.default.createElement(ye,null)),i&&(s||a.default.createElement(he,null)),a.default.createElement(xe,null),a.default.createElement(ve,{onTouchEnd:d,onMouseDown:d,"data-testid":undefined},p(n)||a.default.createElement(Oe,{"aria-hidden":!0,menuOpen:e,isInvalid:o,className:"rfs-caret-icon"})))}));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 Ee(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}Ce.displayName="IndicatorIcons";const Ie=l.default.div.withConfig({displayName:"SelectWrapper",componentId:"kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(({theme:e})=>e.select.css)),Me=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)),ke=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)),De=t.forwardRef((({async:e,isMulti:o,inputId:r,selectId:i,required:l,ariaLive:s,autoFocus:d,isLoading:c,onKeyDown:u,clearIcon:p,caretIcon:m,isInvalid:g,ariaLabel:h,menuWidth:E,isDisabled:I,inputDelay:j,onMenuOpen:z,onMenuClose:N,onInputBlur:R,isClearable:A,themeConfig:F,loadingNode:B,initialValue:$,onInputFocus:q,onInputChange:K,ariaLabelledBy:H,onOptionChange:U,onSearchChange:Y,getOptionLabel:_,getOptionValue:G,itemKeySelector:J,openMenuOnFocus:Q,menuPortalTarget:Z,isAriaLiveEnabled:ee,menuOverscanCount:te,blurInputOnSelect:ne,renderOptionLabel:oe,renderMultiOptions:ie,menuScrollDuration:ae,filterIgnoreAccents:ce,hideSelectedOptions:ue,getIsOptionDisabled:fe,getFilterOptionString:ge,isSearchable:he=!0,lazyLoadMenu:be=!1,openMenuOnClick:ye=!0,filterIgnoreCase:we=!0,tabSelectsOption:ve=!0,closeMenuOnSelect:Oe=!0,scrollMenuIntoView:xe=!0,backspaceClearsValue:Se=!0,filterMatchFrom:De=y,menuPosition:je=b,options:ze=k,loadingMsg:Ne="Loading..",placeholder:Le="Select option..",noOptionsMsg:Pe="No options",menuItemSize:Re=35,menuMaxHeight:Te=300},Ve)=>{const Ae=t.useRef(!1),Fe=t.useRef(),Be=t.useRef(!1),$e=t.useRef(null),qe=t.useRef(null),We=t.useRef(null),Ke=t.useRef(null),[He,Ue]=t.useState(""),[Ye,_e]=t.useState(!1),[Xe,Ge]=t.useState(!1),[Je,Qe]=t.useState(null),[Ze,et]=t.useState(M),tt=t.useMemo((()=>P(F)?V(D,F):D),[F]),nt=t.useMemo((()=>_||(e=>e.label)),[_]),ot=t.useMemo((()=>G||(e=>e.value)),[G]),rt=t.useMemo((()=>oe||nt),[oe,nt]),it=((e,n)=>{const[o,r]=t.useState(e);return t.useEffect((()=>{if(void 0===n)return;const t=setTimeout((()=>{r(e)}),n);return()=>{clearTimeout(t)}}),[e,n]),void 0===n?e:o})(He,j),[at,lt]=t.useState((()=>T($,ot,nt))),st=le(ze,it,De,at,ot,nt,fe,ge,we,ce,o,ue,e),[dt,ct]=de(qe,Ke,Ye,je,Re,Te,st.length,ae,xe,z,N),ut=()=>{var e;return null===(e=We.current)||void 0===e?void 0:e.blur()},pt=()=>{var e;return null===(e=We.current)||void 0===e?void 0:e.focus()},ft=e=>{var t;return null===(t=$e.current)||void 0===t?void 0:t.scrollToItem(e)},mt=(e,t=!0)=>{e.stopPropagation(),t&&e.preventDefault()},gt=t.useCallback(((e,t)=>{t&&mt(t,"mousedown"===t.type),lt((t=>t.filter((t=>t.value!==e))))}),[]),ht=t.useCallback((e=>{if(!L(st))return void(!Ae.current&&_e(!0));const t=o?-1:st.findIndex((({isSelected:e})=>e)),n=t>-1?t:e===S?0:st.length-1;!Ae.current&&_e(!0),et(Ee({index:n},st[n])),ft(n)}),[o,st]),bt=t.useCallback(((e,t)=>{t?o&>(e.value):lt((t=>o?[...t,e]:[e]));("boolean"==typeof ne?ne:W)?ut():Oe&&(_e(!1),Ue(""))}),[o,Oe,gt,ne]);t.useImperativeHandle(Ve,(()=>({menuOpen:Ye,empty:!L(at),blur:ut,focus:pt,clearValue:()=>{lt(k),et(M)},setValue:e=>{const t=T(e,ot,nt);lt(t)},toggleMenu:e=>{!0===e||void 0===e&&!Ye?(!Xe&&pt(),ht(S)):ut()}}))),t.useEffect((()=>{d&&pt()}),[]),t.useEffect((()=>{Ae.current=Ye}),[Ye]),t.useEffect((()=>{Xe&&Q&&ht(S)}),[Xe,Q,ht]),t.useEffect((()=>{Y&&Be.current&&(Be.current=!1,Y(it))}),[Y,it]),se((()=>{if(!U)return;const e=o?at.map((e=>e.data)):L(at)?at[0].data:null;U(e)}),[o,at,U]),se((()=>{const t=st.length>0&&(e||st.length!==ze.length||0===Fe.current);0===st.length?et(M):(1===st.length||t)&&(et(Ee({index:0},st[0])),ft(0)),Fe.current=st.length}),[e,ze,st]);const yt=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:r}=Ze;e&&!r&&bt({data:e,value:t,label:n},o)},wt=e=>{I||(Xe||pt(),Ye?"INPUT"!==e.currentTarget.tagName&&(Ye&&_e(!1),He&&Ue("")):ye&&ht(S),"INPUT"!==e.currentTarget.tagName&&e.preventDefault())},vt=t.useCallback((e=>{null==R||R(e),Ge(!1),_e(!1),Ue("")}),[R]),Ot=t.useCallback((e=>{null==q||q(e),Ge(!0)}),[q]),xt=t.useCallback((e=>{Be.current=!0,null==K||K(e.currentTarget.value||""),!Ae.current&&_e(!0),Ue(e.currentTarget.value||"")}),[K]),Ct=t.useCallback((e=>{mt(e,"mousedown"===e.type),lt(k),pt()}),[]),St=t.useCallback((e=>{mt(e,"mousedown"===e.type),pt(),Ae.current?_e(!1):ht(S)}),[ht]),Et=!be||be&&Ye,It=I||!he||!!Je,Mt=!(!A||I||!L(at)),kt=I||ye?void 0:St;return a.default.createElement(n.ThemeProvider,{theme:tt},a.default.createElement(Ie,Object.assign({id:i,"aria-controls":r,"aria-expanded":Ye,onKeyDown:e=>{if(!(I||u&&(u(e,He,Ze),e.defaultPrevented))){switch(e.key){case"ArrowDown":case"ArrowUp":{const t="ArrowDown"===e.key;Ye?(e=>{if(!L(st))return;const t=e===x?(Ze.index+1)%st.length:Ze.index>0?Ze.index-1:st.length-1;Je&&Qe(null),et(Ee({index:t},st[t])),ft(t)})(t?x:O):ht(t?S:C);break}case"ArrowLeft":case"ArrowRight":if(!o||He||ie)return;(e=>{if(!L(at))return;let t=-1;const n=at.length-1,o=Je?at.findIndex((e=>e.value===Je)):-1;t=e===w?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const r=t>=0?at[t].value:null;Ze.data&&et(M),r!==Je&&Qe(r)})("ArrowLeft"===e.key?v:w);break;case" ":if(He)return;if(Ye){if(!Ze.data)return;yt()}else ht(S);break;case"Enter":Ye&&229!==e.keyCode&&yt();break;case"Escape":Ye&&(_e(!1),Ue(""));break;case"Tab":if(!Ye||!ve||!Ze.data||e.shiftKey)return;yt();break;case"Delete":case"Backspace":if(He)return;if(Je){const e=at.findIndex((e=>e.value===Je)),t=e>-1&&e<at.length-1?at[e+1].value:null;gt(Je),Qe(t)}else{if(!Se)return;if(L(at))if(o&&!ie){const{value:e}=at[at.length-1];gt(e)}else A&<(k)}break;default:return}e.preventDefault()}}},f),a.default.createElement(ke,{ref:Ke,isInvalid:g,isFocused:Xe,isDisabled:I,className:"rfs-control-container",onTouchEnd:wt,onMouseDown:wt,"data-testid":undefined},a.default.createElement(Me,null,a.default.createElement(re,{isMulti:o,inputValue:He,placeholder:Le,selectedOption:at,focusedMultiValue:Je,renderOptionLabel:rt,renderMultiOptions:ie,removeSelectedOption:gt}),a.default.createElement(pe,{id:r,ref:We,required:l,ariaLabel:h,inputValue:He,readOnly:It,onBlur:vt,onFocus:Ot,onChange:xt,ariaLabelledBy:H,selectedOption:at})),a.default.createElement(Ce,{menuOpen:Ye,clearIcon:p,caretIcon:m,isInvalid:g,isLoading:c,showClear:Mt,isDisabled:I,loadingNode:B,onClearMouseDown:Ct,onCaretMouseDown:kt})),Et&&a.default.createElement(X,{menuRef:qe,menuOpen:Ye,isLoading:c,menuTop:dt,height:ct,itemSize:Re,loadingMsg:Ne,menuOptions:st,fixedSizeListRef:$e,noOptionsMsg:Pe,selectOption:bt,itemKeySelector:J,overscanCount:te,menuPortalTarget:Z,width:E||tt.menu.width,onMenuMouseDown:e=>{mt(e),pt()},renderOptionLabel:rt,focusedOptionIndex:Ze.index}),ee&&a.default.createElement(me,{ariaLive:s,menuOpen:Ye,isFocused:Xe,ariaLabel:h,inputValue:He,isSearchable:he,focusedOption:Ze,selectedOption:at,optionCount:st.length})))}));De.displayName="Select",e.Select=De,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 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,O=1,w=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"function"==typeof e}function R(e){return Array.isArray(e)&&!!e.length}function T(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}const V=(e,t=!0)=>{t&&e.preventDefault(),e.stopPropagation()};function A(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(L,"")}(o):o}const F=(e,t,n)=>{const o=Array.isArray(e)?e:T(e)?[e]:k;return R(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},B=(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&&T(r)?e[o]?B(e[o],r):r:r||""})),n};function $(e){return q(e)?window.pageYOffset:e.scrollTop}function q(e){return e===document.documentElement||e===document.body||e===window}const W=/(auto|scroll)/;function K({overflow:e,overflowX:t,overflowY:n}){return W.test(`${e}${t}${n}`)}function H(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)&&K(t))return n}return n}function U(e,t,n=300,o){let r=0;const i=$(e),a=t-i;requestAnimationFrame((function t(){var l;r+=5,function(e,t){q(e)?window.scrollTo(0,t):e.scrollTop=t}(e,a*((l=(l=r)/n-1)*l*l+1)+i),r<n?requestAnimationFrame(t):null==o||o()}))}const Y="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,_="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent),X=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);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: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(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:d.length},X),!R(d)&&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),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))),Z=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)&&!R(d),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:V,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:d})=>!n||e&&(!e||R(r)&&!s)?R(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:d})))):a.default.createElement(ae,null,l(r[0].data)):a.default.createElement(le,{isMulti:e},o):null;function de(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 ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?de(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):de(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,d,c,u,p,f)=>{const[m,g]=t.useState(k),h=f?"":n,b=N(p)?p:!!u;return t.useEffect((()=>{const t=A(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=ce(ce({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=A(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},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,d,c,u,p)=>{const f=t.useRef(!1),m=t.useRef(!s),[b,y]=t.useState(a),[v,O]=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=H(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-$(t)-n>=o})(e.current);O(t)}),[e,r]),pe((()=>{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=H(e),d=$(s),c=s.getBoundingClientRect().height-d-r,u=c<i;if(u||!n)return void o(u?c:void 0);U(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 w=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)"})(w,e.current,n.current):void 0,w]},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.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;}"),he=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),[g,h]=t.useState(2),b=i&&!R(u);return pe((()=>{f.current&&h(f.current.scrollWidth+2)}),[d]),a.default.createElement(t.Fragment,null,a.default.createElement(ge,Object.assign({id:e,ref:p,isInvalid:!0,onBlur:n,onFocus:o,value:d,readOnly:r,required:b,"aria-label":s,style:{width:g}},m,{"aria-labelledby":c,onChange:r?void 0:l})),a.default.createElement(me,{ref:f},d))})));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,ariaLabel:n,inputValue:o,optionCount:r,isSearchable:i,focusedOption:l,selectedOption:s,ariaLive:d="polite"})=>{if(!t)return null;const c=`${r} result(s) available${o?" for search input "+o:""}.`,u=l.value?`Focused option: ${l.label}${l.isDisabled?" - disabled":""}, ${l.index+1} of ${r}.`:"",p=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.":`${n||"Select"} is focused${i?", type to filter options":""}, press Down arrow key to open the menu.`,f=R(s)?s.map((({label:e})=>e)).join(" "):"N/A",m=u+c+p;return a.default.createElement(be,{"aria-atomic":"false","aria-live":d,"aria-relevant":"additions text"},a.default.createElement("span",{id:"aria-context"},"Selected option: "+f),a.default.createElement("span",{id:"aria-selection"},m))},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))),Oe=()=>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)),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))),xe=()=>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"})),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:d,onClearMouseDown:c})=>{const u=P(n)||P(t)?{menuOpen:e,isLoading:!!i,isInvalid:!!o,isDisabled:!!l}:void 0,p=e=>P(e)?e(u):e;return a.default.createElement(Ce,null,r&&!i&&a.default.createElement(Se,{onTouchEnd:c,onMouseDown:c,"data-testid":undefined},p(t)||a.default.createElement(xe,null)),i&&(s||a.default.createElement(Oe,null)),a.default.createElement(Ie,null),a.default.createElement(Se,{onTouchEnd:d,onMouseDown:d,"data-testid":undefined},p(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.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:d,isLoading:c,onKeyDown:u,clearIcon:p,caretIcon:m,isInvalid:g,ariaLabel:h,menuWidth:E,isDisabled:I,inputDelay:j,onMenuOpen:z,onMenuClose:L,onInputBlur:P,isClearable:A,themeConfig:$,loadingNode:q,initialValue:W,onInputFocus:K,onInputChange:H,ariaLabelledBy:U,onOptionChange:_,onSearchChange:X,getOptionLabel:G,getOptionValue:J,itemKeySelector:Q,openMenuOnFocus:ee,menuPortalTarget:te,isAriaLiveEnabled:ne,menuOverscanCount:oe,blurInputOnSelect:re,menuItemDirection:ie,renderOptionLabel:ae,renderMultiOptions:le,menuScrollDuration:de,filterIgnoreAccents:ce,hideSelectedOptions:me,getIsOptionDisabled:ge,getFilterOptionString:be,isSearchable:ve=!0,lazyLoadMenu:Oe=!1,openMenuOnClick:we=!0,filterIgnoreCase:xe=!0,tabSelectsOption:Ce=!0,closeMenuOnSelect:Se=!0,scrollMenuIntoView:Ee=!0,backspaceClearsValue:Ie=!0,filterMatchFrom:ke=y,menuPosition:Ne=b,options:Pe=k,loadingMsg:Re="Loading..",placeholder:Te="Select option..",noOptionsMsg:Ve="No options",menuItemSize:Ae=35,menuMaxHeight:Fe=300},Be)=>{const $e=t.useRef(!1),qe=t.useRef(),We=t.useRef(!1),Ke=t.useRef(null),He=t.useRef(null),Ue=t.useRef(null),Ye=t.useRef(null),[_e,Xe]=t.useState(""),[Ge,Je]=t.useState(!1),[Qe,Ze]=t.useState(!1),[et,tt]=t.useState(null),[nt,ot]=t.useState(M),rt=t.useMemo((()=>T($)?B(D,$):D),[$]),it=t.useMemo((()=>G||(e=>e.label)),[G]),at=t.useMemo((()=>J||(e=>e.value)),[J]),lt=t.useMemo((()=>ae||it),[ae,it]),st=((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})(_e,j),[dt,ct]=t.useState((()=>F(W,at,it))),ut=ue(Pe,st,ke,dt,at,it,ge,be,xe,ce,o,me,e),[pt,ft]=fe(He,Ye,Ge,Ne,Ae,Fe,ut.length,!!te,de,Ee,z,L),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=t.useCallback((e=>{if(!R(ut))return void(!$e.current&&Je(!0));const t=o?-1:ut.findIndex((e=>e.isSelected)),n=t>-1?t:e===S?0:ut.length-1;!$e.current&&Je(!0),ot(De({index:n},ut[n])),ht(n)}),[o,ut]),yt=t.useCallback((e=>{ct((t=>t.filter((({value:t})=>t!==e))))}),[]),vt=t.useCallback(((e,t)=>{t?o&&yt(e.value):ct((t=>o?[...t,e]:[e]));(N(re)?re:Y)?mt():Se&&(Je(!1),Xe(""))}),[o,Se,yt,re]);t.useImperativeHandle(Be,(()=>({empty:!R(dt),menuOpen:Ge,blur:mt,focus:gt,clearValue:()=>{vt.length&&ct(k),nt.data&&ot(M)},setValue:e=>{const t=F(e,at,it);ct(t)},toggleMenu:e=>{!0===e||void 0===e&&!Ge?(!Qe&>(),bt(S)):mt()}}))),t.useEffect((()=>{d&>()}),[]),t.useEffect((()=>{$e.current=Ge}),[Ge]),t.useEffect((()=>{Qe&&ee&&bt(S)}),[Qe,ee,bt]),t.useEffect((()=>{X&&We.current&&(We.current=!1,X(st))}),[X,st]),pe((()=>{if(!_)return;const e=o?dt.map((e=>e.data)):R(dt)?dt[0].data:null;_(e)}),[o,dt,_]),pe((()=>{const t=ut.length>0&&(e||ut.length!==Pe.length||0===qe.current);0===ut.length?ot(M):(1===ut.length||t)&&(ot(De({index:0},ut[0])),ht(0)),qe.current=ut.length}),[e,Pe,ut]);const Ot=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:r}=nt;e&&!r&&vt({data:e,value:t,label:n},o)},wt=e=>{const t="ArrowDown"===e,n=t?S:C;Ge?(e=>{if(!R(ut))return;const t=e===x?(nt.index+1)%ut.length:nt.index>0?nt.index-1:ut.length-1;et&&tt(null),ot(De({index:t},ut[t])),ht(t)})(t?x:w):bt(n)},xt=e=>{if(I)return;Qe||gt();const t="INPUT"!==e.currentTarget.tagName;Ge?t&&(Ge&&Je(!1),_e&&Xe("")):we&&bt(S),t&&e.preventDefault()},Ct=t.useCallback((e=>{null==P||P(e),Ze(!1),Je(!1),Xe("")}),[P]),St=t.useCallback((e=>{null==K||K(e),Ze(!0)}),[K]),Et=t.useCallback((e=>{const t=e.currentTarget.value||"";We.current=!0,null==H||H(t),!$e.current&&Je(!0),Xe(t)}),[H]),It=t.useCallback((e=>{V(e),ct(k),gt()}),[]),Mt=t.useCallback((e=>{V(e,"mousedown"===e.type),gt(),$e.current?Je(!1):bt(S)}),[bt]),kt=!Oe||Oe&&Ge,Dt=I||!ve||!!et,jt=!(!A||I||!R(dt)),zt=I||we?void 0:Mt;return a.default.createElement(n.ThemeProvider,{theme:rt},a.default.createElement(je,Object.assign({id:i,"aria-controls":r,"aria-expanded":Ge,onKeyDown:e=>{if(!(I||u&&(u(e,_e,nt),e.defaultPrevented))){switch(e.key){case"ArrowDown":case"ArrowUp":wt(e.key);break;case"ArrowLeft":case"ArrowRight":if(!o||_e||le)return;(e=>{if(!R(dt))return;let t=-1;const n=dt.length-1,o=et?dt.findIndex((e=>e.value===et)):-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;nt.data&&ot(M),r!==et&&tt(r)})("ArrowLeft"===e.key?O:v);break;case" ":if(_e)return;if(Ge){if(!nt.data)return;Ot()}else bt(S);break;case"Enter":Ge&&229!==e.keyCode&&Ot();break;case"Escape":Ge&&(Je(!1),Xe(""));break;case"Tab":if(!Ge||!Ce||!nt.data||e.shiftKey)return;Ot();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;yt(et),tt(t)}else{if(!Ie)return;if(!R(dt))break;if(o&&!le){const{value:e}=dt[dt.length-1];yt(e)}else A&&ct(k)}break;default:return}e.preventDefault()}}},f),a.default.createElement(Le,{ref:Ye,isInvalid:g,isFocused:Qe,isDisabled:I,className:"rfs-control-container",onTouchEnd:xt,onMouseDown:xt,"data-testid":undefined},a.default.createElement(ze,null,a.default.createElement(se,{isMulti:o,inputValue:_e,placeholder:Te,selectedOption:dt,focusedMultiValue:et,renderOptionLabel:lt,renderMultiOptions:le,removeSelectedOption:yt}),a.default.createElement(he,{id:r,ref:Ue,required:l,ariaLabel:h,inputValue:_e,readOnly:Dt,onBlur:Ct,onFocus:St,onChange:Et,ariaLabelledBy:U,selectedOption:dt})),a.default.createElement(Me,{menuOpen:Ge,clearIcon:p,caretIcon:m,isInvalid:g,isLoading:c,showClear:jt,isDisabled:I,loadingNode:q,onClearMouseDown:It,onCaretMouseDown:zt})),kt&&a.default.createElement(Z,{menuRef:He,menuOpen:Ge,isLoading:c,menuTop:pt,height:ft,itemSize:Ae,loadingMsg:Re,menuOptions:ut,fixedSizeListRef:Ke,noOptionsMsg:Ve,selectOption:vt,direction:ie,itemKeySelector:Q,overscanCount:oe,menuPortalTarget:te,width:E||rt.menu.width,onMenuMouseDown:e=>{V(e),gt()},renderOptionLabel:lt,focusedOptionIndex:nt.index}),ne&&a.default.createElement(ye,{ariaLive:s,menuOpen:Ge,isFocused:Qe,ariaLabel:h,inputValue:_e,isSearchable:ve,focusedOption:nt,selectedOption:dt,optionCount:ut.length})))}));Ne.displayName="Select",e.Select=Ne,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -72,2 +72,3 @@ import React from 'react'; | ||
filterMatchFrom?: FilterMatchEnum; | ||
menuItemDirection?: 'ltr' | 'rtl'; | ||
onMenuOpen?: (...args: any[]) => any; | ||
@@ -134,2 +135,3 @@ onMenuClose?: (...args: any[]) => any; | ||
filterMatchFrom?: FilterMatchEnum | undefined; | ||
menuItemDirection?: "ltr" | "rtl" | undefined; | ||
onMenuOpen?: ((...args: any[]) => any) | undefined; | ||
@@ -136,0 +138,0 @@ onMenuClose?: ((...args: any[]) => any) | undefined; |
@@ -6,4 +6,4 @@ import React, { useRef, useMemo, useState, useEffect, forwardRef, useCallback, useImperativeHandle } from 'react'; | ||
import { Menu, Value, AriaLiveRegion, AutosizeInput, IndicatorIcons } from './components'; | ||
import { mergeDeep, IS_TOUCH_DEVICE, isPlainObject, normalizeValue, isArrayWithLength } from './utils'; | ||
import { useDebounce, useMenuPositioner, useMenuOptions, useMountEffect, useUpdateEffect } from './hooks'; | ||
import { mergeDeep, IS_TOUCH_DEVICE, suppressMouseOrTouchEvent, normalizeValue, isPlainObject, isBoolean, isArrayWithLength } from './utils'; | ||
const SelectWrapper = styled.div ` | ||
@@ -62,3 +62,3 @@ position: relative; | ||
`; | ||
const Select = forwardRef(({ async, isMulti, inputId, selectId, required, ariaLive, autoFocus, isLoading, onKeyDown, clearIcon, caretIcon, isInvalid, ariaLabel, menuWidth, isDisabled, inputDelay, onMenuOpen, onMenuClose, onInputBlur, isClearable, themeConfig, loadingNode, initialValue, onInputFocus, onInputChange, ariaLabelledBy, onOptionChange, onSearchChange, getOptionLabel, getOptionValue, itemKeySelector, openMenuOnFocus, menuPortalTarget, isAriaLiveEnabled, menuOverscanCount, blurInputOnSelect, renderOptionLabel, renderMultiOptions, menuScrollDuration, filterIgnoreAccents, hideSelectedOptions, getIsOptionDisabled, getFilterOptionString, isSearchable = true, lazyLoadMenu = false, openMenuOnClick = true, filterIgnoreCase = true, tabSelectsOption = true, closeMenuOnSelect = true, scrollMenuIntoView = true, backspaceClearsValue = true, filterMatchFrom = FilterMatchEnum.ANY, menuPosition = MenuPositionEnum.BOTTOM, options = EMPTY_ARRAY, loadingMsg = LOADING_MSG_DEFAULT, placeholder = PLACEHOLDER_DEFAULT, noOptionsMsg = NO_OPTIONS_MSG_DEFAULT, menuItemSize = MENU_ITEM_SIZE_DEFAULT, menuMaxHeight = MENU_MAX_HEIGHT_DEFAULT }, ref) => { | ||
const Select = forwardRef(({ async, isMulti, inputId, selectId, required, ariaLive, autoFocus, isLoading, onKeyDown, clearIcon, caretIcon, isInvalid, ariaLabel, menuWidth, isDisabled, inputDelay, onMenuOpen, onMenuClose, onInputBlur, isClearable, themeConfig, loadingNode, initialValue, onInputFocus, onInputChange, ariaLabelledBy, onOptionChange, onSearchChange, getOptionLabel, getOptionValue, itemKeySelector, openMenuOnFocus, menuPortalTarget, isAriaLiveEnabled, menuOverscanCount, blurInputOnSelect, menuItemDirection, renderOptionLabel, renderMultiOptions, menuScrollDuration, filterIgnoreAccents, hideSelectedOptions, getIsOptionDisabled, getFilterOptionString, isSearchable = true, lazyLoadMenu = false, openMenuOnClick = true, filterIgnoreCase = true, tabSelectsOption = true, closeMenuOnSelect = true, scrollMenuIntoView = true, backspaceClearsValue = true, filterMatchFrom = FilterMatchEnum.ANY, menuPosition = MenuPositionEnum.BOTTOM, options = EMPTY_ARRAY, loadingMsg = LOADING_MSG_DEFAULT, placeholder = PLACEHOLDER_DEFAULT, noOptionsMsg = NO_OPTIONS_MSG_DEFAULT, menuItemSize = MENU_ITEM_SIZE_DEFAULT, menuMaxHeight = MENU_MAX_HEIGHT_DEFAULT }, ref) => { | ||
// Instance prop & DOM node refs | ||
@@ -95,15 +95,6 @@ const menuOpenRef = useRef(false); | ||
// Custom hook abstraction that handles calculating menuHeightCalc (defaults to menuMaxHeight) / handles executing callbacks/logic on menuOpen state change. | ||
const [menuStyleTop, menuHeightCalc] = useMenuPositioner(menuRef, controlRef, menuOpen, menuPosition, menuItemSize, menuMaxHeight, menuOptions.length, menuScrollDuration, scrollMenuIntoView, onMenuOpen, onMenuClose); | ||
const [menuStyleTop, menuHeightCalc] = useMenuPositioner(menuRef, controlRef, menuOpen, menuPosition, menuItemSize, menuMaxHeight, menuOptions.length, !!menuPortalTarget, menuScrollDuration, scrollMenuIntoView, onMenuOpen, onMenuClose); | ||
const blurInput = () => inputRef.current?.blur(); | ||
const focusInput = () => inputRef.current?.focus(); | ||
const scrollToItemIndex = (index) => listRef.current?.scrollToItem(index); | ||
const handleMouseOrTouchEvent = (e, preventDefault = true) => { | ||
e.stopPropagation(); | ||
preventDefault && e.preventDefault(); | ||
}; | ||
const removeSelectedOption = useCallback((removeValue, e) => { | ||
if (e) | ||
handleMouseOrTouchEvent(e, e.type === 'mousedown'); | ||
setSelectedOption((prevSelected) => prevSelected.filter((x) => x.value !== removeValue)); | ||
}, []); | ||
const openMenuAndFocusOption = useCallback((position) => { | ||
@@ -115,9 +106,9 @@ if (!isArrayWithLength(menuOptions)) { | ||
const selectedIndex = !isMulti | ||
? menuOptions.findIndex(({ isSelected }) => isSelected) | ||
? menuOptions.findIndex((x) => x.isSelected) | ||
: -1; | ||
const index = (selectedIndex > -1) | ||
const index = selectedIndex > -1 | ||
? selectedIndex | ||
: (position === OptionIndexEnum.FIRST) | ||
: position === OptionIndexEnum.FIRST | ||
? 0 | ||
: (menuOptions.length - 1); | ||
: menuOptions.length - 1; | ||
!menuOpenRef.current && setMenuOpen(true); | ||
@@ -127,13 +118,15 @@ setFocusedOption({ index, ...menuOptions[index] }); | ||
}, [isMulti, menuOptions]); | ||
const removeSelectedOption = useCallback((removeValue) => { | ||
setSelectedOption((prev) => prev.filter(({ value }) => value !== removeValue)); | ||
}, []); | ||
const selectOption = useCallback((option, isSelected) => { | ||
if (isSelected) { | ||
if (isMulti) { | ||
if (isMulti) | ||
removeSelectedOption(option.value); | ||
} | ||
} | ||
else { | ||
setSelectedOption((prevSelected) => !isMulti ? [option] : [...prevSelected, option]); | ||
setSelectedOption((prev) => !isMulti ? [option] : [...prev, option]); | ||
} | ||
// Use 'blurInputOnSelect' if defined, otherwise evaluate to true if current device is touch-device | ||
const blurControl = (typeof blurInputOnSelect === 'boolean') | ||
const blurControl = isBoolean(blurInputOnSelect) | ||
? blurInputOnSelect | ||
@@ -154,9 +147,11 @@ : IS_TOUCH_DEVICE; | ||
useImperativeHandle(ref, () => ({ | ||
empty: !isArrayWithLength(selectedOption), | ||
menuOpen, | ||
empty: !isArrayWithLength(selectedOption), | ||
blur: blurInput, | ||
focus: focusInput, | ||
clearValue: () => { | ||
setSelectedOption(EMPTY_ARRAY); | ||
setFocusedOption(FOCUSED_OPTION_DEFAULT); | ||
if (selectOption.length) | ||
setSelectedOption(EMPTY_ARRAY); | ||
if (focusedOption.data) | ||
setFocusedOption(FOCUSED_OPTION_DEFAULT); | ||
}, | ||
@@ -276,3 +271,3 @@ setValue: (option) => { | ||
const index = direction === OptionIndexEnum.DOWN | ||
? ((focusedOption.index + 1) % menuOptions.length) | ||
? (focusedOption.index + 1) % menuOptions.length | ||
: focusedOption.index > 0 | ||
@@ -285,2 +280,8 @@ ? focusedOption.index - 1 | ||
}; | ||
const handleVerticalKeySubRoutine = (key) => { | ||
const downKey = key === 'ArrowDown'; | ||
const downUpIndex = downKey ? OptionIndexEnum.DOWN : OptionIndexEnum.UP; | ||
const posIndex = downKey ? OptionIndexEnum.FIRST : OptionIndexEnum.LAST; | ||
menuOpen ? focusOptionOnArrowKey(downUpIndex) : openMenuAndFocusOption(posIndex); | ||
}; | ||
const handleOnKeyDown = (e) => { | ||
@@ -297,6 +298,3 @@ if (isDisabled) | ||
case 'ArrowUp': { | ||
const downKey = e.key === 'ArrowDown'; | ||
menuOpen | ||
? focusOptionOnArrowKey(downKey ? OptionIndexEnum.DOWN : OptionIndexEnum.UP) | ||
: openMenuAndFocusOption(downKey ? OptionIndexEnum.FIRST : OptionIndexEnum.LAST); | ||
handleVerticalKeySubRoutine(e.key); | ||
break; | ||
@@ -308,3 +306,4 @@ } | ||
return; | ||
focusValueOnArrowKey(e.key === 'ArrowLeft' ? ValueIndexEnum.PREVIOUS : ValueIndexEnum.NEXT); | ||
const leftRightIndex = e.key === 'ArrowLeft' ? ValueIndexEnum.PREVIOUS : ValueIndexEnum.NEXT; | ||
focusValueOnArrowKey(leftRightIndex); | ||
break; | ||
@@ -314,6 +313,5 @@ } | ||
case ' ': { | ||
if (inputValue) { | ||
if (inputValue) | ||
return; | ||
} | ||
else if (!menuOpen) { | ||
if (!menuOpen) { | ||
openMenuAndFocusOption(OptionIndexEnum.FIRST); | ||
@@ -343,5 +341,4 @@ } | ||
case 'Tab': { | ||
if (!menuOpen || !tabSelectsOption || !focusedOption.data || e.shiftKey) { | ||
if (!menuOpen || !tabSelectsOption || !focusedOption.data || e.shiftKey) | ||
return; | ||
} | ||
selectOptionFromFocused(); | ||
@@ -365,11 +362,11 @@ break; | ||
return; | ||
if (isArrayWithLength(selectedOption)) { | ||
if (isMulti && !renderMultiOptions) { | ||
const { value } = selectedOption[selectedOption.length - 1]; | ||
removeSelectedOption(value); | ||
} | ||
else if (isClearable) { | ||
setSelectedOption(EMPTY_ARRAY); | ||
} | ||
if (!isArrayWithLength(selectedOption)) | ||
break; | ||
if (isMulti && !renderMultiOptions) { | ||
const { value } = selectedOption[selectedOption.length - 1]; | ||
removeSelectedOption(value); | ||
} | ||
else if (isClearable) { | ||
setSelectedOption(EMPTY_ARRAY); | ||
} | ||
} | ||
@@ -388,10 +385,11 @@ break; | ||
focusInput(); | ||
const targetIsNotInput = e.currentTarget.tagName !== 'INPUT'; | ||
if (!menuOpen) { | ||
openMenuOnClick && openMenuAndFocusOption(OptionIndexEnum.FIRST); | ||
} | ||
else if (e.currentTarget.tagName !== 'INPUT') { | ||
else if (targetIsNotInput) { | ||
menuOpen && setMenuOpen(false); | ||
inputValue && setInputValue(''); | ||
} | ||
if (e.currentTarget.tagName !== 'INPUT') { | ||
if (targetIsNotInput) { | ||
e.preventDefault(); | ||
@@ -401,3 +399,3 @@ } | ||
const handleOnMenuMouseDown = (e) => { | ||
handleMouseOrTouchEvent(e); | ||
suppressMouseOrTouchEvent(e); | ||
focusInput(); | ||
@@ -416,9 +414,10 @@ }; | ||
const handleOnInputChange = useCallback((e) => { | ||
const newInputVal = e.currentTarget.value || ''; | ||
onChangeEventValue.current = true; | ||
onInputChange?.(e.currentTarget.value || ''); | ||
onInputChange?.(newInputVal); | ||
!menuOpenRef.current && setMenuOpen(true); | ||
setInputValue(e.currentTarget.value || ''); | ||
setInputValue(newInputVal); | ||
}, [onInputChange]); | ||
const handleOnClearMouseDown = useCallback((e) => { | ||
handleMouseOrTouchEvent(e, e.type === 'mousedown'); | ||
suppressMouseOrTouchEvent(e); | ||
setSelectedOption(EMPTY_ARRAY); | ||
@@ -428,3 +427,3 @@ focusInput(); | ||
const handleOnCaretMouseDown = useCallback((e) => { | ||
handleMouseOrTouchEvent(e, e.type === 'mousedown'); | ||
suppressMouseOrTouchEvent(e, e.type === 'mousedown'); | ||
focusInput(); | ||
@@ -444,3 +443,3 @@ menuOpenRef.current ? setMenuOpen(false) : openMenuAndFocusOption(OptionIndexEnum.FIRST); | ||
React.createElement(IndicatorIcons, { menuOpen: menuOpen, clearIcon: clearIcon, caretIcon: caretIcon, isInvalid: isInvalid, isLoading: isLoading, showClear: showClear, isDisabled: isDisabled, loadingNode: loadingNode, onClearMouseDown: handleOnClearMouseDown, onCaretMouseDown: handleOnCaretMouseDownOrNoop })), | ||
renderMenu && (React.createElement(Menu, { menuRef: menuRef, menuOpen: menuOpen, isLoading: isLoading, menuTop: menuStyleTop, height: menuHeightCalc, itemSize: menuItemSize, loadingMsg: loadingMsg, menuOptions: menuOptions, fixedSizeListRef: listRef, noOptionsMsg: noOptionsMsg, selectOption: selectOption, itemKeySelector: itemKeySelector, overscanCount: menuOverscanCount, menuPortalTarget: menuPortalTarget, width: menuWidth || theme.menu.width, onMenuMouseDown: handleOnMenuMouseDown, renderOptionLabel: renderOptionLabelFn, focusedOptionIndex: focusedOption.index })), | ||
renderMenu && (React.createElement(Menu, { menuRef: menuRef, menuOpen: menuOpen, isLoading: isLoading, menuTop: menuStyleTop, height: menuHeightCalc, itemSize: menuItemSize, loadingMsg: loadingMsg, menuOptions: menuOptions, fixedSizeListRef: listRef, noOptionsMsg: noOptionsMsg, selectOption: selectOption, direction: menuItemDirection, itemKeySelector: itemKeySelector, overscanCount: menuOverscanCount, menuPortalTarget: menuPortalTarget, width: menuWidth || theme.menu.width, onMenuMouseDown: handleOnMenuMouseDown, renderOptionLabel: renderOptionLabelFn, focusedOptionIndex: focusedOption.index })), | ||
isAriaLiveEnabled && (React.createElement(AriaLiveRegion, { ariaLive: ariaLive, menuOpen: menuOpen, isFocused: isFocused, ariaLabel: ariaLabel, inputValue: inputValue, isSearchable: isSearchable, focusedOption: focusedOption, selectedOption: selectedOption, optionCount: menuOptions.length }))))); | ||
@@ -447,0 +446,0 @@ }); |
/** | ||
* @private | ||
* @param c: amount of change | ||
* @param d: duration | ||
* @param s: initial value (start) | ||
* @param t: time (elapsed) | ||
*/ | ||
function easeOutCubic(c, d, s, t) { | ||
return c * ((t = t / d - 1) * t * t + 1) + s; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
function getScrollTop(el) { | ||
@@ -19,8 +29,10 @@ return isDocumentElement(el) ? window.pageYOffset : el.scrollTop; | ||
} | ||
// Test CSSStyleDeclaration props for auto/scroll values - determines scroll eligibility. | ||
const _overflowRegExp = /(auto|scroll)/; | ||
/** | ||
* @private | ||
*/ | ||
function styleHasOverlfow({ overflow, overflowX, overflowY }) { | ||
const isOverflow = (x) => x === 'auto' || x === 'scroll'; | ||
return isOverflow(overflow) || isOverflow(overflowX) || isOverflow(overflowY); | ||
function isScrollableStyle({ overflow, overflowX, overflowY }) { | ||
const overflowTestStr = `${overflow}${overflowX}${overflowY}`; | ||
return _overflowRegExp.test(overflowTestStr); | ||
} | ||
@@ -32,13 +44,14 @@ /** | ||
let style = getComputedStyle(el); | ||
const docEl = document.documentElement; | ||
const isParentAbs = style.position === 'absolute'; | ||
if (style.position === 'fixed') { | ||
return document.documentElement; | ||
return docEl; | ||
} | ||
for (let parent = el; (parent = parent?.parentElement);) { | ||
style = getComputedStyle(parent); | ||
if (!(isParentAbs && style.position === 'static') && styleHasOverlfow(style)) { | ||
if (!(isParentAbs && style.position === 'static') && isScrollableStyle(style)) { | ||
return parent; | ||
} | ||
} | ||
return document.documentElement; | ||
return docEl; | ||
} | ||
@@ -49,16 +62,13 @@ /** | ||
function smoothScrollTo(el, to, duration = 300, callback) { | ||
let currentTime = 0; | ||
let time = 0; | ||
const start = getScrollTop(el); | ||
const change = to - start; | ||
function easeOutCubic(t) { | ||
return change * ((t = t / duration - 1) * t * t + 1) + start; | ||
} | ||
function scrollFn() { | ||
currentTime += 5; | ||
scrollTo(el, easeOutCubic(currentTime)); | ||
(currentTime < duration) | ||
? window.requestAnimationFrame(scrollFn) | ||
time += 5; | ||
scrollTo(el, easeOutCubic(change, duration, start, time)); | ||
(time < duration) | ||
? requestAnimationFrame(scrollFn) | ||
: callback?.(); | ||
} | ||
window.requestAnimationFrame(scrollFn); | ||
requestAnimationFrame(scrollFn); | ||
} | ||
@@ -65,0 +75,0 @@ /** |
import type { ReactText } from 'react'; | ||
import type { OptionData, SelectedOption } from '../types'; | ||
import type { MouseOrTouchEvent, OptionData, SelectedOption } from '../types'; | ||
/** | ||
* Tests if object is an array with at least 1 item. | ||
* Test if typeof parameter is boolean. | ||
*/ | ||
export declare function isBoolean(test: any): boolean; | ||
/** | ||
* Test if typeof parameter is function. | ||
*/ | ||
export declare function isFunction(test: any): boolean; | ||
/** | ||
* Test if parameter is an array with at least 1 item. | ||
*/ | ||
export declare function isArrayWithLength(test: any): boolean; | ||
@@ -12,2 +20,7 @@ /** | ||
/** | ||
* Handle mouse/touch events by suppressing event propagation, | ||
* and in some cases, preventing the default behavior. | ||
*/ | ||
export declare const suppressMouseOrTouchEvent: (e: MouseOrTouchEvent<HTMLElement>, preventDefault?: boolean) => void; | ||
/** | ||
* Apply regex to string, and if the value is NOT case sensitive, | ||
@@ -14,0 +27,0 @@ * call .toLowerCase() and return result. |
@@ -12,4 +12,16 @@ import { OPTION_CLS, EMPTY_ARRAY, OPTION_FOCUSED_CLS, OPTION_SELECTED_CLS, OPTION_DISABLED_CLS, } from '../constants'; | ||
/** | ||
* Tests if object is an array with at least 1 item. | ||
* Test if typeof parameter is boolean. | ||
*/ | ||
export function isBoolean(test) { | ||
return typeof test === 'boolean'; | ||
} | ||
/** | ||
* Test if typeof parameter is function. | ||
*/ | ||
export function isFunction(test) { | ||
return typeof test === 'function'; | ||
} | ||
/** | ||
* Test if parameter is an array with at least 1 item. | ||
*/ | ||
export function isArrayWithLength(test) { | ||
@@ -25,2 +37,10 @@ return Array.isArray(test) && !!test.length; | ||
/** | ||
* Handle mouse/touch events by suppressing event propagation, | ||
* and in some cases, preventing the default behavior. | ||
*/ | ||
export const suppressMouseOrTouchEvent = (e, preventDefault = true) => { | ||
preventDefault && e.preventDefault(); | ||
e.stopPropagation(); | ||
}; | ||
/** | ||
* Apply regex to string, and if the value is NOT case sensitive, | ||
@@ -53,3 +73,7 @@ * call .toLowerCase() and return result. | ||
export const normalizeValue = (value, getOptionValue, getOptionLabel) => { | ||
const initialValues = Array.isArray(value) ? value : isPlainObject(value) ? [value] : EMPTY_ARRAY; | ||
const initialValues = Array.isArray(value) | ||
? value | ||
: isPlainObject(value) | ||
? [value] | ||
: EMPTY_ARRAY; | ||
if (!isArrayWithLength(initialValues)) { | ||
@@ -74,4 +98,4 @@ return initialValues; | ||
output[key] = | ||
(isPlainObject(sourceProp) && key !== 'animation') | ||
? (key in target) | ||
(key !== 'animation' && isPlainObject(sourceProp)) | ||
? !!target[key] | ||
? mergeDeep(target[key], sourceProp) | ||
@@ -78,0 +102,0 @@ : sourceProp |
{ | ||
"name": "react-functional-select", | ||
"version": "3.1.2", | ||
"version": "3.2.0", | ||
"description": "Micro-sized and micro-optimized select component for React.js", | ||
@@ -40,4 +40,4 @@ "main": "./dist/index.cjs.js", | ||
"devDependencies": { | ||
"@babel/cli": "^7.13.10", | ||
"@babel/core": "^7.13.10", | ||
"@babel/cli": "^7.13.14", | ||
"@babel/core": "^7.13.14", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.13.8", | ||
@@ -47,23 +47,23 @@ "@babel/plugin-proposal-optional-chaining": "^7.13.12", | ||
"@babel/preset-env": "^7.13.12", | ||
"@babel/preset-react": "^7.12.13", | ||
"@babel/preset-react": "^7.13.13", | ||
"@babel/preset-typescript": "^7.13.0", | ||
"@babel/runtime": "^7.13.10", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"@rollup/plugin-replace": "^2.4.1", | ||
"@rollup/plugin-typescript": "^8.2.0", | ||
"@storybook/addon-storysource": "^6.1.21", | ||
"@storybook/addons": "^6.1.21", | ||
"@rollup/plugin-replace": "^2.4.2", | ||
"@rollup/plugin-typescript": "^8.2.1", | ||
"@storybook/addon-storysource": "^6.2.0", | ||
"@storybook/addons": "^6.2.0", | ||
"@storybook/preset-create-react-app": "^3.1.7", | ||
"@storybook/react": "^6.1.21", | ||
"@testing-library/jest-dom": "^5.11.9", | ||
"@testing-library/react": "^11.2.5", | ||
"@testing-library/user-event": "^13.0.7", | ||
"@types/jest": "^26.0.21", | ||
"@types/node": "^14.14.35", | ||
"@storybook/react": "^6.2.0", | ||
"@testing-library/jest-dom": "^5.11.10", | ||
"@testing-library/react": "^11.2.6", | ||
"@testing-library/user-event": "^13.1.1", | ||
"@types/jest": "^26.0.22", | ||
"@types/node": "^14.14.37", | ||
"@types/react": "^17.0.3", | ||
"@types/react-dom": "^17.0.2", | ||
"@types/react-dom": "^17.0.3", | ||
"@types/react-window": "^1.8.2", | ||
"@types/styled-components": "^5.1.9", | ||
"@typescript-eslint/eslint-plugin": "^4.19.0", | ||
"@typescript-eslint/parser": "^4.19.0", | ||
"@typescript-eslint/eslint-plugin": "^4.20.0", | ||
"@typescript-eslint/parser": "^4.20.0", | ||
"babel-jest": "^26.6.3", | ||
@@ -75,3 +75,3 @@ "babel-loader": "^8.2.2", | ||
"enzyme": "^3.11.0", | ||
"eslint": "^7.22.0", | ||
"eslint": "^7.23.0", | ||
"eslint-config-poetez": "^1.0.0", | ||
@@ -85,4 +85,4 @@ "eslint-config-prettier": "^8.1.0", | ||
"prettier": "^2.2.1", | ||
"react": "^17.0.1", | ||
"react-dom": "^17.0.1", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"react-scripts": "^4.0.3", | ||
@@ -93,5 +93,5 @@ "react-syntax-highlighter": "^15.4.3", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.42.3", | ||
"rollup": "^2.44.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"styled-components": "^5.2.1", | ||
"styled-components": "^5.2.2", | ||
"typescript": "^4.2.3" | ||
@@ -98,0 +98,0 @@ }, |
@@ -12,3 +12,3 @@ # react-functional-select | ||
- Fully-featured package that is truly lightweight: <8 KB (gzipped)! | ||
- Fully-featured <strong><em>AND</em></strong> lightweight: ~7 kB (gzipped)! | ||
- Offers nearly all customization features found in [`react-select`](https://github.com/JedWatson/react-select), in a modern, functional design (inspired by react-select, you will find much of the API similar) | ||
@@ -140,2 +140,3 @@ - Extensible styling API with [`styled-components`](https://github.com/styled-components/styled-components) | ||
|`menuScrollDuration`| number | `300` | Duration of scroll menu into view animation | ||
|`menuItemDirection`| 'ltr' OR 'rtl' | `'ltr'` | The direction of text for each menu option and position of the menu's scroll bar (`react-window`'s `direction` prop) | ||
|`ariaLabelledBy`| string | `undefined` | HTML ID of an element that should be used as the label (for assistive tech) | ||
@@ -142,0 +143,0 @@ |`ariaLive`| 'off' OR 'polite' OR 'assertive' | `'polite'` | Used to set the priority with which screen reader should treat updates to live regions (translates to `aria-live` attribute) |
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
180508
2246
178