react-functional-select
Advanced tools
Comparing version 3.3.5 to 4.0.0
import { type FunctionComponent } from 'react'; | ||
import type { FocusedOption, SelectedOption, AriaLiveAttribute } from '../../types'; | ||
export declare type AriaLiveRegionProps = Readonly<{ | ||
type AriaLiveRegionProps = Readonly<{ | ||
menuOpen: boolean; | ||
@@ -5,0 +5,0 @@ isFocused: boolean; |
import React, { type FormEventHandler, type FocusEventHandler } from 'react'; | ||
export declare type AutosizeInputProps = Readonly<{ | ||
id?: string; | ||
readOnly: boolean; | ||
ariaLabel?: string; | ||
inputValue: string; | ||
required?: boolean; | ||
ariaLabelledBy?: string; | ||
hasSelectedOptions: boolean; | ||
onBlur: FocusEventHandler<HTMLInputElement>; | ||
onFocus: FocusEventHandler<HTMLInputElement>; | ||
onChange: FormEventHandler<HTMLInputElement>; | ||
}>; | ||
declare const AutosizeInput: React.MemoExoticComponent<React.ForwardRefExoticComponent<Readonly<{ | ||
declare const AutosizeInput: React.ForwardRefExoticComponent<Readonly<{ | ||
id?: string | undefined; | ||
@@ -25,3 +13,3 @@ readOnly: boolean; | ||
onChange: FormEventHandler<HTMLInputElement>; | ||
}> & React.RefAttributes<HTMLInputElement>>>; | ||
}> & React.RefAttributes<HTMLInputElement>>; | ||
export default AutosizeInput; |
import React, { type ReactNode } from 'react'; | ||
import type { IconRenderer, MouseOrTouchEventHandler } from '../../types'; | ||
export declare type IndicatorIconsProps = Readonly<{ | ||
menuOpen: boolean; | ||
showClear: boolean; | ||
isLoading?: boolean; | ||
isInvalid?: boolean; | ||
isDisabled?: boolean; | ||
loadingNode?: ReactNode; | ||
clearIcon?: IconRenderer; | ||
caretIcon?: IconRenderer; | ||
onClearMouseDown: MouseOrTouchEventHandler; | ||
onCaretMouseDown?: MouseOrTouchEventHandler; | ||
}>; | ||
declare const IndicatorIcons: React.NamedExoticComponent<Readonly<{ | ||
@@ -25,4 +13,4 @@ menuOpen: boolean; | ||
onClearMouseDown: MouseOrTouchEventHandler; | ||
onCaretMouseDown?: MouseOrTouchEventHandler<Element> | undefined; | ||
onCaretMouseDown: MouseOrTouchEventHandler; | ||
}>>; | ||
export default IndicatorIcons; |
import { type MutableRefObject, type FunctionComponent } from 'react'; | ||
import type { MouseOrTouchEvent } from '../../types'; | ||
import { type MenuListProps } from './MenuList'; | ||
export interface MenuProps extends MenuListProps { | ||
interface MenuProps extends MenuListProps { | ||
menuTop?: string; | ||
menuOpen: boolean; | ||
lazyLoadMenu: boolean; | ||
menuPortalTarget?: Element; | ||
@@ -8,0 +9,0 @@ menuRef: MutableRefObject<HTMLDivElement | null>; |
import { type MutableRefObject, type FunctionComponent } from 'react'; | ||
import type { MenuOption } from '../../Select'; | ||
import { FixedSizeList } from 'react-window'; | ||
import type { RenderLabelCallback, SelectedOption } from '../../types'; | ||
export declare type MenuListProps = Readonly<{ | ||
import type { MenuOption, RenderLabelCallback } from '../../types'; | ||
export type MenuListProps = Readonly<{ | ||
height: number; | ||
@@ -10,5 +9,5 @@ itemSize: number; | ||
isLoading?: boolean; | ||
memoOptions: boolean; | ||
overscanCount?: number; | ||
width: string | number; | ||
memoOptions: boolean; | ||
direction?: 'ltr' | 'rtl'; | ||
@@ -20,6 +19,6 @@ menuOptions: MenuOption[]; | ||
renderOptionLabel: RenderLabelCallback; | ||
selectOption: (option: MenuOption) => void; | ||
fixedSizeListRef: MutableRefObject<FixedSizeList | null> | undefined; | ||
selectOption: (option: SelectedOption, isSelected?: boolean) => void; | ||
}>; | ||
declare const MenuList: FunctionComponent<MenuListProps>; | ||
export default MenuList; |
import React, { type CSSProperties } from 'react'; | ||
import type { ItemData } from '../../types'; | ||
export declare type OptionProps = Readonly<{ | ||
index: number; | ||
data: ItemData; | ||
style: CSSProperties; | ||
}>; | ||
declare const Option: React.NamedExoticComponent<Readonly<{ | ||
@@ -9,0 +4,0 @@ index: number; |
import { type ReactNode, type FunctionComponent } from 'react'; | ||
import type { MultiParams } from '../../Select'; | ||
import type { SelectedOption, RenderLabelCallback } from '../../types'; | ||
export declare type ValueProps = Readonly<{ | ||
import type { MultiParams, SelectedOption, RenderLabelCallback } from '../../types'; | ||
type ValueProps = Readonly<{ | ||
isMulti?: boolean; | ||
@@ -6,0 +5,0 @@ inputValue: string; |
import React from 'react'; | ||
import type { RenderLabelCallback, SelectedOption } from '../../types'; | ||
export declare type MultiValueProps = SelectedOption & Readonly<{ | ||
type MultiValueProps = SelectedOption & Readonly<{ | ||
isFocused: boolean; | ||
@@ -5,0 +5,0 @@ renderOptionLabel: RenderLabelCallback; |
import type { FocusedOption, OptionValueCallback, OptionFilterCallback, OptionDisabledCallback } from '../types'; | ||
export declare const PAGE_SIZE_DEFAULT = 5; | ||
export declare const MENU_ITEM_SIZE_DEFAULT = 35; | ||
@@ -7,9 +8,9 @@ export declare const MENU_MAX_HEIGHT_DEFAULT = 300; | ||
export declare const PLACEHOLDER_DEFAULT = "Select option.."; | ||
export declare const EMPTY_ARRAY: any[]; | ||
export declare const FOCUSED_OPTION_DEFAULT: FocusedOption; | ||
export declare const EMPTY_ARRAY: any[]; | ||
export declare const FunctionDefaults: { | ||
OPTION_LABEL: OptionValueCallback; | ||
OPTION_VALUE: OptionValueCallback; | ||
OPTION_IS_DISABLED: OptionDisabledCallback; | ||
OPTION_FILTER: OptionFilterCallback; | ||
export declare const FUNCTIONS: { | ||
optionLabel: OptionValueCallback; | ||
optionValue: OptionValueCallback; | ||
isOptionDisabled: OptionDisabledCallback; | ||
optionFilter: OptionFilterCallback; | ||
}; |
@@ -10,3 +10,3 @@ /** | ||
}; | ||
export declare type MenuPositionEnum = typeof MenuPositionEnum[keyof typeof MenuPositionEnum]; | ||
export type MenuPositionEnum = typeof MenuPositionEnum[keyof typeof MenuPositionEnum]; | ||
/** | ||
@@ -20,3 +20,3 @@ * Property filterMatchFrom values. Defaults to 'any'. | ||
}; | ||
export declare type FilterMatchEnum = typeof FilterMatchEnum[keyof typeof FilterMatchEnum]; | ||
export type FilterMatchEnum = typeof FilterMatchEnum[keyof typeof FilterMatchEnum]; | ||
/** | ||
@@ -30,3 +30,5 @@ * Arrow key direction OR position for cycling through menu options. | ||
readonly FIRST: 3; | ||
readonly PAGEUP: 4; | ||
readonly PAGEDOWN: 5; | ||
}; | ||
export declare type OptionIndexEnum = typeof OptionIndexEnum[keyof typeof OptionIndexEnum]; | ||
export type OptionIndexEnum = typeof OptionIndexEnum[keyof typeof OptionIndexEnum]; |
export * from './dom'; | ||
export * from './enums'; | ||
export * from './theme'; | ||
export * from './styled'; | ||
export * from './defaults'; |
export { default as useDebounce } from './useDebounce'; | ||
export { default as useLatestRef } from './useLatestRef'; | ||
export { default as useMountEffect } from './useMountEffect'; | ||
@@ -7,2 +8,1 @@ export { default as useMenuOptions } from './useMenuOptions'; | ||
export { default as useMenuPositioner } from './useMenuPositioner'; | ||
export { default as useFirstRenderState } from './useFirstRenderState'; |
import type { CallbackFn } from '../types'; | ||
/** | ||
* A custom hook that converts a callback to a ref to avoid triggering re-renders | ||
* ..when passed as a prop or avoid re-executing effects when passed as a dependency | ||
* Hook that converts a callback to a ref to avoid triggering re-renders when | ||
* passed as a prop or avoid re-executing effects when passed as a dependency | ||
* | ||
* @param callback The callback to write to a ref object | ||
* @param callback the callback to write to a ref object | ||
*/ | ||
declare const useCallbackRef: <T extends CallbackFn>(callback: T | undefined) => T; | ||
export default useCallbackRef; |
/** | ||
* Debouncer hook (hacky fix to prevent unecessary state mutations if no delay is passed). | ||
* If a number is passed for the delay parameter, use to debounce/set the value. | ||
* | ||
* @param value the value to debounce | ||
* @param delay the delay (ms) for the setTimeout | ||
*/ | ||
declare const useDebounce: <T>(value: T, delay?: number) => T; | ||
export default useDebounce; |
@@ -1,9 +0,7 @@ | ||
import type { MenuOption } from '../Select'; | ||
import { FilterMatchEnum } from '../constants'; | ||
import type { OptionData, SelectedOption, OptionValueCallback, OptionLabelCallback, OptionFilterCallback, OptionDisabledCallback } from '../types'; | ||
import type { MenuOption, OptionData, SelectedOption, OptionValueCallback, OptionLabelCallback, OptionFilterCallback, OptionDisabledCallback } from '../types'; | ||
/** | ||
* Parse options to array of MenuOptions and perform filtering (if applicable). | ||
* Set menuOptions state (ensure array returned). | ||
*/ | ||
declare const useMenuOptions: (options: OptionData[], debouncedInputValue: string, filterMatchFrom: FilterMatchEnum, selectedOption: SelectedOption[], getOptionValue: OptionValueCallback, getOptionLabel: OptionLabelCallback, getIsOptionDisabled?: OptionDisabledCallback, getFilterOptionString?: OptionFilterCallback, filterIgnoreCase?: boolean, filterIgnoreAccents?: boolean, isMulti?: boolean, async?: boolean, hideSelectedOptions?: boolean) => MenuOption[]; | ||
export default useMenuOptions; |
@@ -0,3 +1,3 @@ | ||
import type { CallbackFn } from '../types'; | ||
import { MenuPositionEnum } from '../constants'; | ||
import type { CallbackFn } from '../types'; | ||
import { type RefObject } from 'react'; | ||
@@ -4,0 +4,0 @@ /** |
import { type EffectCallback } from 'react'; | ||
/** | ||
* Run an effect only once (on initial mount). | ||
* Pass an empty array for the dependency list to ensure effect is only fired once. | ||
* | ||
* @param effect the effect to execute | ||
*/ | ||
declare const useMountEffect: (effect: EffectCallback) => void; | ||
export default useMountEffect; |
import { useEffect } from 'react'; | ||
/** | ||
* Run an effect only on updates. | ||
* Skip the first effect execution that occurrs after initial mount. | ||
* Skip the first effect execution that occurrs on initial mount. | ||
* | ||
* @param effect the effect to execute | ||
* @param deps the dependency list | ||
*/ | ||
declare const useUpdateEffect: typeof useEffect; | ||
export default useUpdateEffect; |
@@ -1,1 +0,1 @@ | ||
"use strict";var e=require("@babel/runtime/helpers/extends"),n=require("react"),t=require("styled-components"),o=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),i=require("react-window"),r=require("react-dom"),a={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container"},l={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input"},u="top",c="auto",s="bottom",d="any",f=0,p=1,m=2,h=3,g=t.keyframes(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),v=t.keyframes(["from{opacity:0;}to{opacity:1;}"]),b=t.css([""," 0.2s ease-in"],v),w={index:-1},O=[],y={OPTION_LABEL:function(e){return e.label},OPTION_VALUE:function(e){return e.value},OPTION_IS_DISABLED:function(e){return!!e.isDisabled},OPTION_FILTER:function(e){var n=e.label;return"string"==typeof n?n:""+n}},x=/(auto|scroll)/;function C(e){return I(e)?window.pageYOffset:e.scrollTop}function I(e){return e===document.body||e===document.documentElement||e===window}function S(e){var n=e.overflow,t=e.overflowX,o=e.overflowY;return x.test(""+n+t+o)}function E(e){var n=getComputedStyle(e),t=document.documentElement,o="absolute"===n.position;if("fixed"===n.position)return t;for(var i=e;i=null==i?void 0:i.parentElement;)if(n=getComputedStyle(i),(!o||"static"!==n.position)&&S(n))return i;return t}function k(e,n,t,o){void 0===t&&(t=300);var i=0,r=C(e),a=n-r;requestAnimationFrame((function n(){var l,u=a*((l=(l=i+=5)/t-1)*l*l+1)+r;!function(e,n){I(e)?window.scrollTo(0,n):e.scrollTop=n}(e,u),i<t?requestAnimationFrame(n):null==o||o()}))}var L=/[\u0300-\u036f]/g,M=function(e){return"boolean"==typeof e},N=function(e){return"function"==typeof e},z=function(e){return Array.isArray(e)&&!!e.length},D=function(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)},R=function(e){e.preventDefault(),e.stopPropagation()},T=function(e,n,t){var o=e.trim();return n&&(o=o.toLowerCase()),t?o.normalize("NFD").replace(L,""):o},A=function(e,n,t){var o=Array.isArray(e)?e:D(e)?[e]:O;return z(o)?o.map((function(e){return{data:e,value:n(e),label:t(e)}})):o},V=function n(t,o){var i=e({},t);return Object.keys(o).forEach((function(e){var r=o[e];i[e]="animation"!==e&&D(r)?t[e]?n(t[e],r):r:null!=r?r:""})),i},B={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"],g),color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 0.9375rem",clear:{width:"14px",height:"16px",animation:b,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.35rem 0",borderRadius:"3px",backgroundColor:"#fff",animation:b,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"},placeholder:{animation:b},multiValue:{margin:"1px 2px",borderRadius:"3px",backgroundColor:"#e7edf3",animation:b,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"}}},F=function(e){return D(e)?V(B,e):B},P=!!(null===window||void 0===window?void 0:window.ontouchstart)||!!(null===navigator||void 0===navigator?void 0:navigator.maxTouchPoints),q=function(e,n){return n.data.memoOptions&&i.areEqual(e,n)},W=n.memo((function(e){var t=e.index,o=e.style,i=e.data,r=i.menuOptions,a=i.selectOption,l=i.renderOptionLabel,u=i.focusedOptionIndex,c=r[t],s=c.data,d=c.value,f=c.label,p=c.isDisabled,m=c.isSelected,h=function(e,n,t){var o="rfs-option";return e&&(o+=" rfs-option-disabled"),n&&(o+=" rfs-option-selected"),t&&(o+=" rfs-option-focused"),o}(p,m,t===u),g=p?void 0:function(){return a({data:s,value:d,label:f},m)};return n.createElement("div",{style:o,onClick:g,className:h},l(s))}),q);W.displayName="Option";var _=t.div.withConfig({displayName:"NoOptionsMsg",componentId:"sc-1on2920-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(function(e){return e.theme.noOptions.color}),(function(e){return e.theme.noOptions.margin}),(function(e){return e.theme.noOptions.padding}),(function(e){return e.theme.noOptions.fontSize}),(function(e){return e.theme.noOptions.css})),j=function(e){var t=e.width,o=e.height,r=e.itemSize,a=e.direction,l=e.isLoading,u=e.loadingMsg,c=e.menuOptions,s=e.memoOptions,d=e.selectOption,f=e.noOptionsMsg,p=e.overscanCount,m=e.itemKeySelector,h=e.fixedSizeListRef,g=e.renderOptionLabel,v=e.focusedOptionIndex,b=n.useMemo((function(){return{menuOptions:c,memoOptions:s,selectOption:d,renderOptionLabel:g,focusedOptionIndex:v}}),[c,s,v,d,g]);if(l)return n.createElement(_,null,u);var w=m?function(e,n){return n.menuOptions[e][m]}:void 0;return n.createElement(n.Fragment,null,n.createElement(i.FixedSizeList,{width:t,height:o,itemKey:w,itemSize:r,itemData:b,direction:a,ref:h,overscanCount:p,itemCount:c.length},W),!z(c)&&f&&n.createElement(_,null,f))},K=["menuRef","menuTop","menuOpen","onMenuMouseDown","menuPortalTarget"],U=t.div.withConfig({displayName:"MenuWrapper",componentId:"sc-105ivps-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;will-change:top;padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}}"],(function(e){var n=e.menuTop,o=e.menuOpen,i=e.hideNoOptionsMsg,r=e.theme.menu;return t.css(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],r.width,r.margin,r.padding,r.animation,r.borderRadius,r.backgroundColor,i?"none":r.boxShadow,!o&&"display: none;",n&&"top: "+n+";")}),(function(e){return e.theme.menu.css}),"rfs-option",(function(e){return e.theme.menu.option.padding}),(function(e){return e.theme.menu.option.textAlign}),"rfs-option-focused","rfs-option-disabled","rfs-option-selected",(function(e){return e.theme.menu.option.focusedBgColor}),"rfs-option-selected",(function(e){return e.theme.menu.option.selectedColor}),(function(e){return e.theme.menu.option.selectedBgColor}),"rfs-option-disabled"),H=function(t){var i=t.menuRef,a=t.menuTop,l=t.menuOpen,u=t.onMenuMouseDown,c=t.menuPortalTarget,s=o(t,K),d=s.menuOptions,f=s.noOptionsMsg,p=l&&!f&&!z(d),m=n.createElement(U,{ref:i,menuTop:a,menuOpen:l,onMouseDown:u,className:"rfs-menu-container",hideNoOptionsMsg:p},n.createElement(j,e({},s)));return c?r.createPortal(m,c):m},Y=t.css(["color:",";"],(function(e){return e.theme.multiValue.clear.focusColor})),X=t.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-1vzivtq-0"})(["min-width:0;display:flex;"," ",""],(function(e){var n=e.theme.multiValue;return t.css(["margin:",";animation:",";border-radius:",";background-color:",";"],n.margin,n.animation,n.borderRadius,n.backgroundColor)}),(function(e){return e.theme.multiValue.css})),G=t.div.withConfig({displayName:"Label",componentId:"sc-1vzivtq-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(function(e){return e.theme.multiValue.label.padding}),(function(e){return e.theme.multiValue.label.fontSize}),(function(e){return e.theme.multiValue.label.borderRadius})),J=t.i.withConfig({displayName:"Clear",componentId:"sc-1vzivtq-2"})(["display:flex;font-style:inherit;"," ",""],(function(e){var n=e.theme.multiValue.clear;return t.css(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";&:hover{","}"],n.color,n.padding,n.fontSize,n.alignSelf,n.transition,n.fontWeight,Y)}),(function(e){return e.isFocused&&Y})),Q=n.memo((function(e){var t=e.data,o=e.value,i=e.isFocused,r=e.renderOptionLabel,a=e.removeSelectedOption,l=r(t),u=function(){return a(o)};return n.createElement(X,null,n.createElement(G,null,l),n.createElement(J,{isFocused:i,onClick:u,onTouchEnd:u,onMouseDown:R},"✖"))}));Q.displayName="MultiValue";var Z=function(){var e=n.useRef(!0);return e.current?(e.current=!1,!0):e.current},$=function(e,t){var o=Z();n.useEffect((function(){if(!o)return e()}),t)},ee=function(e){var t=n.useRef(e);return n.useEffect((function(){t.current=e})),n.useCallback((function(){for(var e,n,o=arguments.length,i=new Array(o),r=0;r<o;r++)i[r]=arguments[r];return null===(n=t.current)||void 0===n?void 0:(e=n).call.apply(e,[t].concat(i))}),[])},ne=function(e,t,o,i,r,a,l,u,c,s,f,p,m){void 0===c&&(c=!1),void 0===s&&(s=!1),void 0===f&&(f=!1),void 0===p&&(p=!1);var h=n.useState(O),g=h[0],v=h[1],b=ee(u||y.OPTION_FILTER),w=ee(l||y.OPTION_IS_DISABLED),x=p?"":t,C=o===d,I=M(m)?m:f;return n.useEffect((function(){var n=i.length?new Set(i.map((function(e){return e.value}))):null,t=T(x,c,s),o=function(e){var o,i=r(e),l=a(e),u=w(e),d=null!==(o=null==n?void 0:n.has(i))&&void 0!==o&&o,f={data:e,value:i,label:l,isDisabled:u,isSelected:d};if(!(!function(e){if(!t)return!0;var n=b(e),o=T(n,c,s);return C?o.includes(t):o.substr(0,t.length)===t}(f)||I&&d))return f},l=e.reduce((function(e,n){var t=o(n);return t&&e.push(t),e}),[]);v(l)}),[e,x,r,a,i,C,c,s,w,b,I]),g},te=function(e,t,o,i,r,a,l,s,d,f,p,m){var h=n.useRef(!1),g=n.useRef(!s),v=ee(d),b=ee(f),w=n.useState(a),O=w[0],y=w[1],x=n.useState(!1),I=x[0],S=x[1];n.useEffect((function(){g.current=!I&&!s})),n.useEffect((function(){var n=i===u||i===c&&!function(e){if(!e)return!0;var n=E(e),t=e.getBoundingClientRect(),o=t.top,i=t.height;return n.getBoundingClientRect().height-C(n)-o>=i}(e.current);S(n)}),[e,i]),$((function(){if(o){var n=function(e){v(),e&&(h.current=!0,y(e))};g.current?function(e,n,t,o){if(e){var i=e.getBoundingClientRect(),r=i.top,a=i.height,l=i.bottom,u=window.innerHeight;if(u-r>=a)o();else{var c=E(e),s=C(c),d=c.getBoundingClientRect().height-s-r,f=d<a;if(!f&&t){var p=getComputedStyle(e).marginBottom;k(c,l-u+s+parseInt(p,10),n,o)}else o(f?d:void 0)}}else o()}(e.current,p,m,n):n()}else b(),h.current&&(h.current=!1,y(a))}),[e,o,a,m,p,b,v]);var L=Math.min(O,l*r),M=I?function(e,n,t){var o,i,r=n&&getComputedStyle(n),a=r?parseInt(r.marginBottom,10):0,l=r?parseInt(r.marginTop,10):0,u=null!==(o=null==t?void 0:t.getBoundingClientRect().height)&&void 0!==o?o:0,c=e>0?e:null!==(i=null==n?void 0:n.getBoundingClientRect().height)&&void 0!==i?i:0;return"calc("+-Math.abs(c+u)+"px + "+(a+l)+"px)"}(L,e.current,t.current):void 0;return[M,L]},oe=t.css(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),ie=t.div.withConfig({displayName:"SingleValue",componentId:"sc-us7kwl-0"})([""," max-width:calc(100% - 0.5rem);"],oe),re=t.div.withConfig({displayName:"Placeholder",componentId:"sc-us7kwl-1"})([""," color:",";",""],oe,(function(e){return e.theme.color.placeholder}),(function(e){var n=e.theme;return!e.initRender&&t.css(["animation:",";"],n.placeholder.animation)})),ae=function(e){var t=e.isMulti,o=e.inputValue,i=e.placeholder,r=e.selectedOption,a=e.focusedMultiValue,l=e.renderOptionLabel,u=e.renderMultiOptions,c=e.removeSelectedOption,s=Z(),d=!z(r);return o&&(!t||t&&(d||u))?null:d?n.createElement(re,{initRender:s},i):t?n.createElement(n.Fragment,null,u?u({renderOptionLabel:l,selected:r}):r.map((function(e){var t=e.data,o=e.value;return n.createElement(Q,{key:o,data:t,value:o,renderOptionLabel:l,isFocused:o===a,removeSelectedOption:c})}))):n.createElement(ie,null,l(r[0].data))},le=t.css(["font-size:inherit;font-weight:inherit;font-family:inherit;"]),ue=t.div.withConfig({displayName:"SizerDiv",componentId:"sc-4er7q8-0"})(["top:0;left:0;height:0;overflow:scroll;white-space:pre;position:absolute;visibility:hidden;"," ",""],le,(function(e){return e.theme.input.css})),ce=t.input.attrs(l).withConfig({displayName:"Input",componentId:"sc-4er7q8-1"})(["border:0;outline:0;padding:0;cursor:text;background:0;color:inherit;box-sizing:content-box;"," :read-only{opacity:0;cursor:default;}:required{","}",""],le,(function(e){var n=e.theme;return e.isInvalid&&n.input.cssRequired}),(function(e){return e.theme.input.css})),se=n.memo(n.forwardRef((function(e,t){var o=e.id,i=e.onBlur,r=e.onFocus,a=e.readOnly,l=e.required,u=e.onChange,c=e.ariaLabel,s=e.inputValue,d=e.ariaLabelledBy,f=e.hasSelectedOptions,p=!!l&&!f,m=n.useRef(null),h=n.useState(15),g=h[0],v=h[1];return $((function(){var e=m.current;e&&v(e.scrollWidth+15)}),[s]),n.createElement(n.Fragment,null,n.createElement(ce,{id:o,ref:t,isInvalid:!0,onBlur:i,onFocus:r,value:s,readOnly:a,required:p,"aria-label":c,style:{width:g},"aria-labelledby":d,onChange:a?void 0:u}),n.createElement(ue,{ref:m},s))})));se.displayName="AutosizeInput";var de=t.span.withConfig({displayName:"A11yText",componentId:"sc-1yv4bud-0"})(["border:0;padding:0;width:1px;height:1px;margin:-1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(0,0,0,0);"]),fe=function(e){var t=e.menuOpen,o=e.isFocused,i=e.inputValue,r=e.optionCount,a=e.isSearchable,l=e.focusedOption,u=e.selectedOption,c=e.ariaLive,s=void 0===c?"polite":c,d=e.ariaLabel;if(!o)return null;var f=t?"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.":(void 0===d?"Select":d)+" is focused"+(a?", type to filter options":"")+", press Down arrow key to open the menu.",p=l.index,m=l.value,h=l.label,g=l.isDisabled,v=((m&&!g?"Option "+h+" is focused, "+(p+1)+" of "+r+".":"")+" "+(r+" option(s) available"+(i?" for search "+i:"")+".")+" "+f).trimStart(),b="Selected option: "+(u.length?u.map((function(e){return e.label})).join(" "):"N/A");return n.createElement(de,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},n.createElement("span",{id:"aria-selection"},b),n.createElement("span",{id:"aria-context"},v))},pe=t.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1tlaoz1-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;}}"],(function(e){return e.theme.loader.padding}),(function(e){var n=e.theme;return t.css(["width:",";height:",";animation:",";background-color:",";"],n.loader.size,n.loader.size,n.loader.animation,n.loader.color)})),me=function(){return n.createElement(pe,{"aria-hidden":!0,className:"rfs-loading-dots"},n.createElement("div",null),n.createElement("div",null),n.createElement("div",null))},he=t.svg.withConfig({displayName:"ClearSvg",componentId:"sc-kkzaaw-0"})(["fill:currentColor;",""],(function(e){var n=e.theme;return t.css(["width:",";height:",";animation:",";transition:",";"],n.icon.clear.width,n.icon.clear.height,n.icon.clear.animation,n.icon.clear.transition)})),ge=function(){return n.createElement(he,{"aria-hidden":!0,focusable:"false",viewBox:"0 0 14 16",className:"rfs-clear-icon"},n.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"}))},ve=t.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1jozl2i-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),be=t.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1jozl2i-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(function(e){return e.theme.icon.color}),(function(e){return e.theme.icon.padding}),(function(e){return e.theme.icon.hoverColor}),(function(e){return e.theme.icon.css})),we=t.div.withConfig({displayName:"Separator",componentId:"sc-1jozl2i-2"})(["width:1px;margin:0.5rem 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(function(e){var n=e.theme;return n.color.iconSeparator||n.color.border})),Oe=t.div.withConfig({displayName:"Caret",componentId:"sc-1jozl2i-3"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(function(e){return e.theme.icon.caret.transition}),(function(e){return e.theme.icon.caret.size}),(function(e){return e.theme.icon.caret.size}),(function(e){return e.theme.icon.caret.size}),(function(e){var n=e.theme,o=e.menuOpen,i=e.isInvalid;return o&&t.css(["transform:rotate(180deg);color:",";"],i?n.color.danger:n.color.caretActive||n.color.primary)})),ye=n.memo((function(e){var t=e.menuOpen,o=e.clearIcon,i=e.caretIcon,r=e.isInvalid,a=e.showClear,l=e.isLoading,u=e.isDisabled,c=e.loadingNode,s=e.onCaretMouseDown,d=e.onClearMouseDown,f=function(e){return N(e)?e({menuOpen:t,isLoading:l,isInvalid:r,isDisabled:u}):e};return n.createElement(ve,null,a&&!l&&n.createElement(be,{onTouchEnd:d,onMouseDown:d},f(o)||n.createElement(ge,null)),l&&(c||n.createElement(me,null)),n.createElement(we,{role:"none"}),n.createElement(be,{onTouchEnd:s,onMouseDown:s},f(i)||n.createElement(Oe,{"aria-hidden":!0,menuOpen:t,isInvalid:r,className:"rfs-caret-icon"})))}));ye.displayName="IndicatorIcons";var xe=t.div.attrs(a).withConfig({displayName:"SelectWrapper",componentId:"sc-kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(function(e){return e.theme.select.css})),Ce=t.div.withConfig({displayName:"ValueWrapper",componentId:"sc-kcrmu9-1"})(["flex:1 1 0%;display:flex;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;padding:",";"],(function(e){return e.theme.control.padding})),Ie=t.div.withConfig({displayName:"ControlWrapper",componentId:"sc-kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(function(e){var n=e.isDisabled,o=e.isFocused,i=e.isInvalid,r=e.theme,a=r.control,l=r.color;return t.css(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],a.transition,a.borderStyle,a.borderWidth,a.borderRadius,a.height||a.minHeight,i?l.danger:o?a.focusedBorderColor:l.border,a.height&&"height: "+a.height+";",n&&"pointer-events:none;user-select:none;",(a.backgroundColor||n)&&"background-color: "+(n?l.disabled:a.backgroundColor)+";",o&&"box-shadow: "+a.boxShadow+" "+(i?l.dangerLight:a.boxShadowColor)+";")}),(function(e){return e.theme.control.css}),(function(e){var n=e.isFocused,t=e.theme;return n&&t.control.focusedCss})),Se=n.forwardRef((function(o,i){var r,a=o.async,l=o.isMulti,u=o.inputId,c=o.selectId,g=o.required,v=o.ariaLive,b=o.autoFocus,x=o.isLoading,C=o.onKeyDown,I=o.clearIcon,S=o.caretIcon,E=o.isInvalid,k=o.ariaLabel,L=o.menuWidth,D=o.isDisabled,T=o.inputDelay,V=o.onMenuOpen,B=o.onMenuClose,q=o.onInputBlur,W=o.isClearable,_=o.themeConfig,j=o.loadingNode,K=o.initialValue,U=o.onInputFocus,Y=o.onInputChange,X=o.ariaLabelledBy,G=o.onOptionChange,J=o.onSearchChange,Q=o.getOptionLabel,Z=o.getOptionValue,oe=o.itemKeySelector,ie=o.openMenuOnFocus,re=o.menuPortalTarget,le=o.isAriaLiveEnabled,ue=o.menuOverscanCount,ce=o.blurInputOnSelect,de=o.menuItemDirection,pe=o.renderOptionLabel,me=o.renderMultiOptions,he=o.menuScrollDuration,ge=o.filterIgnoreAccents,ve=o.hideSelectedOptions,be=o.getIsOptionDisabled,we=o.getFilterOptionString,Oe=o.isSearchable,Se=void 0===Oe||Oe,Ee=o.memoOptions,ke=void 0!==Ee&&Ee,Le=o.lazyLoadMenu,Me=void 0!==Le&&Le,Ne=o.openMenuOnClick,ze=void 0===Ne||Ne,De=o.filterIgnoreCase,Re=void 0===De||De,Te=o.tabSelectsOption,Ae=void 0===Te||Te,Ve=o.closeMenuOnSelect,Be=void 0===Ve||Ve,Fe=o.scrollMenuIntoView,Pe=void 0===Fe||Fe,qe=o.backspaceClearsValue,We=void 0===qe||qe,_e=o.filterMatchFrom,je=void 0===_e?d:_e,Ke=o.menuPosition,Ue=void 0===Ke?s:Ke,He=o.options,Ye=void 0===He?O:He,Xe=o.loadingMsg,Ge=void 0===Xe?"Loading..":Xe,Je=o.placeholder,Qe=void 0===Je?"Select option..":Je,Ze=o.noOptionsMsg,$e=void 0===Ze?"No options":Ze,en=o.menuItemSize,nn=void 0===en?35:en,tn=o.menuMaxHeight,on=void 0===tn?300:tn,rn=n.useRef(!1),an=n.useRef(),ln=n.useRef(!1),un=n.useRef(N(J)),cn=n.useRef(N(G)),sn=n.useRef(null),dn=n.useRef(null),fn=n.useRef(null),pn=n.useRef(null),mn=n.useState(""),hn=mn[0],gn=mn[1],vn=n.useState(!1),bn=vn[0],wn=vn[1],On=n.useState(!1),yn=On[0],xn=On[1],Cn=n.useState(null),In=Cn[0],Sn=Cn[1],En=n.useState(w),kn=En[0],Ln=En[1],Mn=n.useMemo((function(){return F(_)}),[_]),Nn=n.useMemo((function(){return Q||y.OPTION_LABEL}),[Q]),zn=n.useMemo((function(){return Z||y.OPTION_VALUE}),[Z]),Dn=n.useMemo((function(){return pe||Nn}),[pe,Nn]),Rn=function(e,t){void 0===t&&(t=0);var o=n.useState(e),i=o[0],r=o[1];return $((function(){if(!(t<=0)){var n=setTimeout((function(){r(e)}),t);return function(){clearTimeout(n)}}}),[e,t]),t<=0?e:i}(hn,T),Tn=n.useState((function(){return A(K,zn,Nn)})),An=Tn[0],Vn=Tn[1],Bn=ne(Ye,Rn,je,An,zn,Nn,be,we,Re,ge,l,a,ve),Fn=te(dn,pn,bn,Ue,nn,on,Bn.length,!!re,V,B,he,Pe),Pn=Fn[0],qn=Fn[1],Wn=ee(J),_n=ee(G),jn=function(){var e;return null===(e=fn.current)||void 0===e?void 0:e.blur()},Kn=function(){var e;return null===(e=fn.current)||void 0===e?void 0:e.focus()},Un=function(e){var n;return null===(n=sn.current)||void 0===n?void 0:n.scrollToItem(e)},Hn=z(An),Yn=M(ce)?ce:P,Xn=n.useCallback((function(n){if(z(Bn)){var t=l?-1:Bn.findIndex((function(e){return e.isSelected})),o=t>-1?t:n===h?0:Bn.length-1;Un(o),wn(!0),Sn(null),Ln(e({index:o},Bn[o]))}else wn(!0)}),[l,Bn]),Gn=n.useCallback((function(e){Vn((function(n){return n.filter((function(n){return n.value!==e}))}))}),[]),Jn=n.useCallback((function(e,n){n?l&&Gn(e.value):Vn((function(n){return l?[].concat(n,[e]):[e]})),Yn?jn():Be&&(gn(""),wn(!1))}),[l,Be,Gn,Yn]);n.useImperativeHandle(i,(function(){return{empty:!Hn,menuOpen:rn.current,blur:jn,focus:Kn,clearValue:function(){Vn(O),Ln(w)},setValue:function(e){var n=A(e,zn,Nn);Vn(n)},toggleMenu:function(e){!0===e||void 0===e&&!rn.current?(Kn(),Xn(h)):jn()}}}),[Hn,zn,Nn,Xn]),r=function(){b&&Kn()},n.useEffect(r,[]),n.useEffect((function(){rn.current=bn}),[bn]),n.useEffect((function(){un.current=N(J),cn.current=N(G)})),n.useEffect((function(){yn&&ie&&Xn(h)}),[yn,ie,Xn]),n.useEffect((function(){un.current&&ln.current&&(ln.current=!1,Wn(Rn))}),[Wn,Rn]),$((function(){if(cn.current){var e=l?An.map((function(e){return e.data})):z(An)?An[0].data:null;_n(e)}}),[_n,l,An]),$((function(){var n=Bn.length,t=n>0&&(a||n!==Ye.length||0===an.current);0===n?Ln(w):(1===n||t)&&(Un(0),Ln(e({index:0},Bn[0]))),an.current=n}),[a,Ye,Bn]);var Qn=function(){var e=kn.data,n=kn.value,t=kn.label,o=kn.isSelected,i=kn.isDisabled;e&&!i&&Jn({data:e,value:n,label:t},o)},Zn=function(n){if(z(Bn)){var t=n===p?(kn.index+1)%Bn.length:kn.index>0?kn.index-1:Bn.length-1;Un(t),Sn(null),Ln(e({index:t},Bn[t]))}},$n=function(e){R(e),Kn()},et=function(e){if(!D){yn||Kn();var n="INPUT"!==e.target.nodeName;bn?n&&(wn(!1),gn("")):ze&&Xn(h),n&&e.preventDefault()}},nt=n.useCallback((function(e){null==q||q(e),xn(!1),wn(!1),gn("")}),[q]),tt=n.useCallback((function(e){null==U||U(e),xn(!0)}),[U]),ot=n.useCallback((function(e){ln.current=!0,null==Y||Y(e.currentTarget.value),gn(e.currentTarget.value),wn(!0)}),[Y]),it=n.useCallback((function(e){$n(e),rn.current?wn(!1):Xn(h)}),[Xn]),rt=n.useCallback((function(e){$n(e),Vn(O)}),[]),at=!Me||Me&&bn,lt=!(!W||D||!Hn),ut=D||!Se||!!In,ct=D||ze?void 0:it;return n.createElement(t.ThemeProvider,{theme:Mn},n.createElement(xe,{id:c,"aria-controls":u,"aria-expanded":bn,onKeyDown:function(e){if(!D){var n=e.key,t=e.shiftKey,o=e.defaultPrevented;if(!C||(C(e,hn,kn),!o)){switch(n){case"ArrowDown":bn?Zn(p):Xn(h);break;case"ArrowUp":bn?Zn(f):Xn(m);break;case"ArrowLeft":case"ArrowRight":if(!l||hn||me)return;!function(e){if(Hn){var n=-1,t=An.length-1,o=In?An.findIndex((function(e){return e.value===In})):-1,i=(n="ArrowRight"===e?o>-1&&o<t?o+1:-1:0!==o?-1===o?t:o-1:0)>=0?An[n].value:null;kn.data&&Ln(w),i!==In&&Sn(i)}}(n);break;case" ":if(hn)return;if(bn){if(!kn.data)return;Qn()}else Xn(h);break;case"Enter":bn&&Qn();break;case"Escape":bn&&(wn(!1),gn(""));break;case"Tab":if(!bn||!Ae||!kn.data||t)return;Qn();break;case"Delete":case"Backspace":if(hn)return;if(In){var i=An.findIndex((function(e){return e.value===In})),r=i>-1&&i<An.length-1?An[i+1].value:null;Gn(In),Sn(r)}else{if(!We)return;if(!Hn)break;if(l&&!me){var a=An[An.length-1].value;Gn(a)}else W&&Vn(O)}break;default:return}e.preventDefault()}}}},n.createElement(Ie,{ref:pn,isInvalid:E,isFocused:yn,isDisabled:D,className:"rfs-control-container",onTouchEnd:et,onMouseDown:et},n.createElement(Ce,null,n.createElement(ae,{isMulti:l,inputValue:hn,placeholder:Qe,selectedOption:An,focusedMultiValue:In,renderMultiOptions:me,renderOptionLabel:Dn,removeSelectedOption:Gn}),n.createElement(se,{id:u,ref:fn,required:g,ariaLabel:k,inputValue:hn,readOnly:ut,onBlur:nt,onFocus:tt,onChange:ot,ariaLabelledBy:X,hasSelectedOptions:Hn})),n.createElement(ye,{menuOpen:bn,clearIcon:I,caretIcon:S,isInvalid:E,isLoading:x,showClear:lt,isDisabled:D,loadingNode:j,onClearMouseDown:rt,onCaretMouseDown:ct})),at&&n.createElement(H,{menuRef:dn,menuOpen:bn,isLoading:x,menuTop:Pn,height:qn,itemSize:nn,loadingMsg:Ge,menuOptions:Bn,memoOptions:ke,fixedSizeListRef:sn,noOptionsMsg:$e,selectOption:Jn,direction:de,itemKeySelector:oe,overscanCount:ue,menuPortalTarget:re,width:L||Mn.menu.width,renderOptionLabel:Dn,focusedOptionIndex:kn.index,onMenuMouseDown:$n}),le&&n.createElement(fe,{ariaLive:v,menuOpen:bn,isFocused:yn,ariaLabel:k,inputValue:hn,isSearchable:Se,focusedOption:kn,selectedOption:An,optionCount:Bn.length})))}));Se.displayName="Select",exports.Select=Se; | ||
"use strict";var e,n=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),t=require("@babel/runtime/helpers/extends"),o=require("react"),i=require("styled-components"),r=require("react-dom"),a=require("react-window"),l={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container"},u={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input"},c="top",s="auto",d="bottom",f="any",p=0,m=1,g=2,h=3,v=4,b=5,w=i.keyframes(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),x=i.keyframes(["from{opacity:0;}to{opacity:1;}"]),y=i.css([""," 0.2s ease-in"],x),C={border:"#ced4da",danger:"#dc3545",primary:"#007bff",disabled:"#e9ecef",placeholder:"#6E7276",dangerLight:"rgba(220, 53, 69, 0.25)"},O={color:C,input:{},select:{},loader:{size:"0.625rem",padding:"0.375rem 0.75rem",animation:i.css([""," 1.19s ease-in-out infinite"],w),color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 14px",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",padding:"2px 8px",boxShadow:"0 0 0 0.2rem",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.35rem 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",padding:"0.375rem 0.75rem",selectedBgColor:C.primary,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:C.danger,transition:"color 0.2s ease-out"}}},S=[],I={index:-1},E={optionLabel:function(e){return e.label},optionValue:function(e){return e.value},isOptionDisabled:function(e){return!!e.isDisabled},optionFilter:function(e){return"string"==typeof e.label?e.label:""+e.label}},k=function(e){return M(e)?window.pageYOffset:e.scrollTop},M=function(e){return e===document.body||e===document.documentElement||e===window},z=function(e){var n=getComputedStyle(e);if("fixed"===n.position)return document.documentElement;for(var t=/(auto|scroll)/,o="absolute"===n.position,i=e;i=null==(r=i)?void 0:r.parentElement;){var r;if(n=getComputedStyle(i),(!o||"static"!==n.position)&&t.test(""+n.overflow+n.overflowX+n.overflowY))return i}return document.documentElement},L=function(e,n,t,o){void 0===t&&(t=300);var i=0,r=k(e),a=n-r;requestAnimationFrame((function n(){var l,u=a*((l=(l=i+=5)/t-1)*l*l+1)+r;!function(e,n){M(e)?window.scrollTo(0,n):e.scrollTop=n}(e,u),i<t?requestAnimationFrame(n):null==o||o()}))},D=/[\u0300-\u036f]/g,N=function(e){return"boolean"==typeof e},R=function(e){return"function"==typeof e},T=function(e){return Array.isArray(e)&&!!e.length},V=function(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)},A=function(e){e.preventDefault(),e.stopPropagation()},F=function(e,n,t){var o=e.trim();return n&&(o=o.toLowerCase()),t?o.normalize("NFD").replace(D,""):o},B=function(e,n,t){var o=Array.isArray(e)?e:V(e)?[e]:S;return T(o)?o.map((function(e){return{data:e,value:n(e),label:t(e)}})):o},q=function e(n,o){var i=t({},n);return Object.keys(o).forEach((function(t){var r=o[t];i[t]="animation"!==t&&V(r)?n[t]?e(n[t],r):r:null!=r?r:""})),i},P=function(e,n){return n.data.memoOptions&&a.areEqual(e,n)},W=o.memo((function(e){var n,t,i,r=e.index,a=e.style,l=e.data,u=l.menuOptions,c=l.selectOption,s=l.renderOptionLabel,d=l.focusedOptionIndex,f=u[r],p=(n=f.isDisabled,t=f.isSelected,i="rfs-option",n&&(i+=" rfs-option-disabled"),t&&(i+=" rfs-option-selected"),r===d&&(i+=" rfs-option-focused"),i);return o.createElement("div",{style:a,className:p,onClick:function(){return c(f)}},s(f.data))}),P);W.displayName="Option";var j=i.div.withConfig({displayName:"NoOptionsMsg",componentId:"sc-1on2920-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(function(e){return e.theme.noOptions.color}),(function(e){return e.theme.noOptions.margin}),(function(e){return e.theme.noOptions.padding}),(function(e){return e.theme.noOptions.fontSize}),(function(e){return e.theme.noOptions.css})),K=function(e){var n=e.width,t=e.height,i=e.itemSize,r=e.direction,l=e.isLoading,u=e.loadingMsg,c=e.menuOptions,s=e.memoOptions,d=e.selectOption,f=e.noOptionsMsg,p=e.overscanCount,m=e.itemKeySelector,g=e.fixedSizeListRef,h=e.renderOptionLabel,v=e.focusedOptionIndex,b=o.useMemo((function(){return{menuOptions:c,memoOptions:s,selectOption:d,renderOptionLabel:h,focusedOptionIndex:v}}),[c,s,v,d,h]);if(l)return o.createElement(j,null,u);var w=m?function(e,n){return n.menuOptions[e][m]}:void 0;return o.createElement(o.Fragment,null,o.createElement(a.FixedSizeList,{width:n,height:t,itemKey:w,itemSize:i,itemData:b,direction:r,ref:g,overscanCount:p,itemCount:c.length},W),!T(c)&&f&&o.createElement(j,null,f))},H=["menuRef","menuTop","menuOpen","lazyLoadMenu","onMenuMouseDown","menuPortalTarget"],U=i.div.withConfig({displayName:"MenuWrapper",componentId:"sc-105ivps-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;will-change:top;padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}}"],(function(e){var n=e.menuTop,t=e.menuOpen,o=e.hideNoOptionsMsg,r=e.theme.menu;return i.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;",n&&"top: "+n+";")}),(function(e){return e.theme.menu.css}),"rfs-option",(function(e){return e.theme.menu.option.padding}),(function(e){return e.theme.menu.option.textAlign}),"rfs-option-focused","rfs-option-disabled","rfs-option-selected",(function(e){return e.theme.menu.option.focusedBgColor}),"rfs-option-selected",(function(e){return e.theme.menu.option.selectedColor}),(function(e){return e.theme.menu.option.selectedBgColor}),"rfs-option-disabled"),Y=function(e){var i=e.menuRef,a=e.menuTop,l=e.menuOpen,u=e.lazyLoadMenu,c=e.onMenuMouseDown,s=e.menuPortalTarget,d=n(e,H);if(u&&!l)return null;var f=d.menuOptions,p=d.noOptionsMsg,m=l&&!p&&!T(f),g=o.createElement(U,{ref:i,menuTop:a,menuOpen:l,onMouseDown:c,className:"rfs-menu-container",hideNoOptionsMsg:m},o.createElement(K,t({},d)));return s?r.createPortal(g,s):g},X=i.css(["color:",";"],(function(e){return e.theme.multiValue.clear.focusColor})),G=i.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-1vzivtq-0"})(["min-width:0;display:flex;"," ",""],(function(e){var n=e.theme.multiValue;return i.css(["margin:",";animation:",";border-radius:",";background-color:",";"],n.margin,n.animation,n.borderRadius,n.backgroundColor)}),(function(e){return e.theme.multiValue.css})),J=i.div.withConfig({displayName:"Label",componentId:"sc-1vzivtq-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(function(e){return e.theme.multiValue.label.padding}),(function(e){return e.theme.multiValue.label.fontSize}),(function(e){return e.theme.multiValue.label.borderRadius})),Q=i.i.withConfig({displayName:"Clear",componentId:"sc-1vzivtq-2"})(["display:flex;font-style:inherit;"," ",""],(function(e){var n=e.theme.multiValue.clear;return i.css(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";&:hover{","}"],n.color,n.padding,n.fontSize,n.alignSelf,n.transition,n.fontWeight,X)}),(function(e){return e.isFocused&&X})),Z=o.memo((function(e){var n=e.data,t=e.value,i=e.isFocused,r=e.renderOptionLabel,a=e.removeSelectedOption,l=r(n),u=function(){return a(t)};return o.createElement(G,null,o.createElement(J,null,l),o.createElement(Q,{onClick:u,onTouchEnd:u,isFocused:i,onMouseDown:A},"✖"))}));Z.displayName="MultiValue";var $=i.div.withConfig({displayName:"SingleValue",componentId:"sc-us7kwl-0"})(["margin:0 2px;max-width:100%;overflow:hidden;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;grid-area:1 / 1 / 2 / 3;"]),_=i($).withConfig({displayName:"Placeholder",componentId:"sc-us7kwl-1"})(["color:",";"],(function(e){return e.theme.color.placeholder})),ee=function(e){var n=e.isMulti,t=e.inputValue,i=e.placeholder,r=e.selectedOption,a=e.focusedMultiValue,l=e.renderOptionLabel,u=e.renderMultiOptions,c=e.removeSelectedOption,s=!T(r);if(t&&(!n||n&&(s||u)))return null;if(s)return o.createElement(_,null,i);if(!n){var d=l(r[0].data);return o.createElement($,null,d)}return o.createElement(o.Fragment,null,u?u({renderOptionLabel:l,selected:r}):r.map((function(e){var n=e.data,t=e.value;return o.createElement(Z,{key:t,data:n,value:t,renderOptionLabel:l,isFocused:t===a,removeSelectedOption:c})})))},ne=i.css(["border:0;margin:0;outline:0;padding:0;font:inherit;min-width:2px;grid-area:1 / 2 / auto / auto;"]),te=i.div.withConfig({displayName:"InputWrapper",componentId:"sc-4er7q8-0"})(['margin:2px;flex:1 1 auto;display:inline-grid;box-sizing:border-box;grid-area:1 / 1 / 2 / 3;grid-template-columns:0px min-content;:after{white-space:pre;visibility:hidden;content:attr(data-value) " ";',"}"],ne),oe=i.input.attrs(u).withConfig({displayName:"Input",componentId:"sc-4er7q8-1"})(["width:100%;background:0;color:inherit;"," :read-only{opacity:0;cursor:default;}:required{","}",""],ne,(function(e){var n=e.theme;return e.isInvalid&&n.input.cssRequired}),(function(e){return e.theme.input.css})),ie=o.forwardRef((function(e,n){var t=e.id,i=e.onBlur,r=e.onFocus,a=e.readOnly,l=e.required,u=e.onChange,c=e.ariaLabel,s=e.inputValue,d=e.ariaLabelledBy,f=e.hasSelectedOptions,p=!!l&&!f;return o.createElement(te,{"data-value":s},o.createElement(oe,{id:t,ref:n,isInvalid:!0,onBlur:i,onFocus:r,value:s,readOnly:a,required:p,"aria-label":c,"aria-labelledby":d,onChange:a?void 0:u}))}));ie.displayName="AutosizeInput";var re=i.span.withConfig({displayName:"A11yText",componentId:"sc-1yv4bud-0"})(["border:0;padding:0;width:1px;height:1px;margin:-1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(0,0,0,0);"]),ae=function(e){var n=e.menuOpen,t=e.isFocused,i=e.inputValue,r=e.optionCount,a=e.isSearchable,l=e.focusedOption,u=e.selectedOption,c=e.ariaLive,s=void 0===c?"polite":c,d=e.ariaLabel;if(!t)return null;var f=n?"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.":(void 0===d?"Select":d)+" is focused"+(a?", type to filter options":"")+", press Down arrow key to open the menu.",p=l.index,m=l.value,g=l.label,h=l.isDisabled,v=((m&&!h?"Option "+g+" is focused, "+(p+1)+" of "+r+".":"")+" "+(r+" option(s) available"+(i?" for search "+i:"")+".")+" "+f).trimStart(),b="Selected option: "+(u.length?u.map((function(e){return e.label})).join(" "):"N/A");return o.createElement(re,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},o.createElement("span",{id:"aria-selection"},b),o.createElement("span",{id:"aria-context"},v))},le=i.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1tlaoz1-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;}}"],(function(e){return e.theme.loader.padding}),(function(e){var n=e.theme;return i.css(["width:",";height:",";animation:",";background-color:",";"],n.loader.size,n.loader.size,n.loader.animation,n.loader.color)})),ue=function(){return o.createElement(le,{"aria-hidden":!0,className:"rfs-loading-dots"},o.createElement("div",null),o.createElement("div",null),o.createElement("div",null))},ce=i.svg.withConfig({displayName:"ClearSvg",componentId:"sc-kkzaaw-0"})(["fill:currentColor;",""],(function(e){var n=e.theme;return i.css(["width:",";height:",";animation:",";transition:",";"],n.icon.clear.width,n.icon.clear.height,n.icon.clear.animation,n.icon.clear.transition)})),se=function(){return o.createElement(ce,{"aria-hidden":!0,focusable:"false",viewBox:"0 0 14 16",className:"rfs-clear-icon"},o.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=i.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1jozl2i-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),fe=i.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1jozl2i-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(function(e){return e.theme.icon.color}),(function(e){return e.theme.icon.padding}),(function(e){return e.theme.icon.hoverColor}),(function(e){return e.theme.icon.css})),pe=i.div.withConfig({displayName:"Separator",componentId:"sc-1jozl2i-2"})(["width:1px;margin:8px 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(function(e){var n=e.theme;return n.color.iconSeparator||n.color.border})),me=i.div.withConfig({displayName:"Caret",componentId:"sc-1jozl2i-3"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(function(e){return e.theme.icon.caret.transition}),(function(e){return e.theme.icon.caret.size}),(function(e){return e.theme.icon.caret.size}),(function(e){return e.theme.icon.caret.size}),(function(e){var n=e.theme,t=e.menuOpen,o=e.isInvalid;return t&&i.css(["transform:rotate(180deg);color:",";"],o?n.color.danger:n.color.caretActive||n.color.primary)})),ge=o.memo((function(e){var n=e.menuOpen,t=e.clearIcon,i=e.caretIcon,r=e.isInvalid,a=e.showClear,l=e.isLoading,u=e.isDisabled,c=e.loadingNode,s=e.onCaretMouseDown,d=e.onClearMouseDown,f=function(e){return R(e)?e({menuOpen:n,isLoading:l,isInvalid:r,isDisabled:u}):e};return o.createElement(de,null,a&&!l&&o.createElement(fe,{onTouchEnd:d,onMouseDown:d},f(t)||o.createElement(se,null)),l&&(c||o.createElement(ue,null)),o.createElement(pe,{role:"none"}),o.createElement(fe,{onTouchEnd:s,onMouseDown:s},f(i)||o.createElement(me,{"aria-hidden":!0,menuOpen:n,isInvalid:r,className:"rfs-caret-icon"})))}));ge.displayName="IndicatorIcons";var he=function(e,n){var t=o.useRef(!0);o.useEffect((function(){if(!t.current)return e();t.current=!1}),n)},ve=function(e){var n=o.useRef(e);return n.current=e,n},be=function(e){var n=o.useRef(e);return o.useEffect((function(){n.current=e}),[e]),o.useCallback((function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return null==n.current?void 0:n.current.apply(n,t)}),[])},we=function(e,n,t,i,r,a,l,u,c,s,d,p,m){void 0===c&&(c=!1),void 0===s&&(s=!1),void 0===d&&(d=!1),void 0===p&&(p=!1);var g=be(u||E.optionFilter),h=be(l||E.isOptionDisabled),v=N(m)?m:d,b=p?"":n;return o.useMemo((function(){var n=i.map((function(e){return e.value})),o=t===f,l=F(b,c,s),u=function(e){var t=r(e),i=a(e),u=h(e),d=n.includes(t),f={data:e,value:t,label:i,isDisabled:u,isSelected:d};return!function(e){if(!l)return!0;var n=g(e),t=F(n,c,s);return o?t.includes(l):t.startsWith(l)}(f)||v&&d?void 0:f};return e.reduce((function(e,n){var t=u(n);return t&&e.push(t),e}),[])}),[e,b,r,a,i,t,c,s,h,g,v])},xe=function(e,n,t,i,r,a,l,u,d,f,p,m){var g=o.useMemo((function(){return i===c||i===s&&!function(e){if(!e)return!0;var n=z(e),t=e.getBoundingClientRect(),o=t.top,i=t.height;return n.getBoundingClientRect().height-k(n)-o>=i}(e.current)}),[e,i]),h=be(d),v=be(f),b=o.useRef(!1),w=o.useState(a),x=w[0],y=w[1],C=ve(!g&&!u);he((function(){if(t){var n=function(e){h(),e&&(b.current=!0,y(e))};C.current?function(e,n,t,o){if(e){var i=e.getBoundingClientRect(),r=i.top,a=i.height,l=i.bottom,u=window.innerHeight;if(u-r>=a)o();else{var c=z(e),s=k(c),d=c.getBoundingClientRect().height-s-r,f=d<a;if(!f&&t){var p=parseInt(getComputedStyle(e).marginBottom,10);L(c,l-u+s+p,n,o)}else o(f?d:void 0)}}else o()}(e.current,p,m,n):n()}else v(),b.current&&(b.current=!1,y(a))}),[e,t,a,m,p,v,h]);var O=Math.min(x,l*r),S=g?function(e,n,t){var o,i,r=n&&getComputedStyle(n),a=r?parseInt(r.marginBottom,10):0,l=r?parseInt(r.marginTop,10):0,u=null!=(o=null==t?void 0:t.getBoundingClientRect().height)?o:0,c=e>0?e:null!=(i=null==n?void 0:n.getBoundingClientRect().height)?i:0;return"calc("+-Math.abs(c+u)+"px + "+(a+l)+"px)"}(O,e.current,n.current):void 0;return[S,O]},ye=["isSelected","isDisabled"],Ce=["index"],Oe=i.div.attrs(l).withConfig({displayName:"SelectWrapper",componentId:"sc-kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(function(e){return e.theme.select.css})),Se=i.div.withConfig({displayName:"ValueWrapper",componentId:"sc-kcrmu9-1"})(["flex:1 1 0%;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;display:",";padding:",";"],(function(e){return e.flex?"flex":"grid"}),(function(e){return e.theme.control.padding})),Ie=i.div.withConfig({displayName:"ControlWrapper",componentId:"sc-kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(function(e){var n=e.isDisabled,t=e.isFocused,o=e.isInvalid,r=e.theme,a=r.control,l=r.color;return i.css(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],a.transition,a.borderStyle,a.borderWidth,a.borderRadius,a.height||a.minHeight,o?l.danger:t?a.focusedBorderColor:l.border,a.height&&"height: "+a.height+";",n&&"pointer-events:none;user-select:none;",(a.backgroundColor||n)&&"background-color: "+(n?l.disabled:a.backgroundColor)+";",t&&"box-shadow: "+a.boxShadow+" "+(o?l.dangerLight:a.boxShadowColor)+";")}),(function(e){return e.theme.control.css}),(function(e){var n=e.isFocused,t=e.theme;return n&&t.control.focusedCss})),Ee=o.forwardRef((function(r,a){var l,u=r.async,c=r.isMulti,s=r.inputId,w=r.selectId,x=r.required,y=r.ariaLive,C=r.autoFocus,k=r.isLoading,M=r.onKeyDown,z=r.clearIcon,L=r.caretIcon,D=r.isInvalid,F=r.ariaLabel,P=r.menuWidth,W=r.isDisabled,j=r.inputDelay,K=r.onMenuOpen,H=r.onMenuClose,U=r.onInputBlur,X=r.isClearable,G=r.themeConfig,J=r.loadingNode,Q=r.initialValue,Z=r.onInputFocus,$=r.onInputChange,_=r.ariaLabelledBy,ne=r.onOptionChange,te=r.onSearchChange,oe=r.getOptionLabel,re=r.getOptionValue,le=r.itemKeySelector,ue=r.openMenuOnFocus,ce=r.menuPortalTarget,se=r.isAriaLiveEnabled,de=r.menuOverscanCount,fe=r.blurInputOnSelect,pe=r.menuItemDirection,me=r.renderOptionLabel,Ee=r.renderMultiOptions,ke=r.menuScrollDuration,Me=r.filterIgnoreAccents,ze=r.hideSelectedOptions,Le=r.getIsOptionDisabled,De=r.getFilterOptionString,Ne=r.isSearchable,Re=void 0===Ne||Ne,Te=r.memoOptions,Ve=void 0!==Te&&Te,Ae=r.lazyLoadMenu,Fe=void 0!==Ae&&Ae,Be=r.openMenuOnClick,qe=void 0===Be||Be,Pe=r.filterIgnoreCase,We=void 0===Pe||Pe,je=r.tabSelectsOption,Ke=void 0===je||je,He=r.closeMenuOnSelect,Ue=void 0===He||He,Ye=r.scrollMenuIntoView,Xe=void 0===Ye||Ye,Ge=r.backspaceClearsValue,Je=void 0===Ge||Ge,Qe=r.filterMatchFrom,Ze=void 0===Qe?f:Qe,$e=r.menuPosition,_e=void 0===$e?d:$e,en=r.options,nn=void 0===en?S:en,tn=r.pageSize,on=void 0===tn?5:tn,rn=r.loadingMsg,an=void 0===rn?"Loading..":rn,ln=r.placeholder,un=void 0===ln?"Select option..":ln,cn=r.noOptionsMsg,sn=void 0===cn?"No options":cn,dn=r.menuItemSize,fn=void 0===dn?35:dn,pn=r.menuMaxHeight,mn=void 0===pn?300:pn,gn=o.useRef(null),hn=o.useRef(null),vn=o.useRef(null),bn=o.useRef(null),wn=o.useState(""),xn=wn[0],yn=wn[1],Cn=o.useState(!1),On=Cn[0],Sn=Cn[1],In=o.useState(!1),En=In[0],kn=In[1],Mn=o.useState(null),zn=Mn[0],Ln=Mn[1],Dn=o.useState(I),Nn=Dn[0],Rn=Dn[1],Tn=o.useMemo((function(){return V(G)?q(O,G):O}),[G]),Vn=o.useMemo((function(){return oe||E.optionLabel}),[oe]),An=o.useMemo((function(){return re||E.optionValue}),[re]),Fn=o.useMemo((function(){return me||Vn}),[me,Vn]),Bn=function(e,n){void 0===n&&(n=0);var t=o.useState(e),i=t[0],r=t[1];return he((function(){if(!(n<=0)){var t=setTimeout((function(){r(e)}),n);return function(){clearTimeout(t)}}}),[e,n]),n<=0?e:i}(xn,j),qn=be(te),Pn=be(ne),Wn=ve(R(te)),jn=ve(R(ne)),Kn=ve(On),Hn=o.useRef(!1),Un=o.useRef(),Yn=o.useState((function(){return B(Q,An,Vn)})),Xn=Yn[0],Gn=Yn[1],Jn=we(nn,Bn,Ze,Xn,An,Vn,Le,De,We,Me,c,u,ze),Qn=xe(hn,bn,On,_e,fn,mn,Jn.length,!!ce,K,H,ke,Xe),Zn=Qn[0],$n=Qn[1],_n=function(){var e;return null==(e=vn.current)?void 0:e.blur()},et=function(){var e;return null==(e=vn.current)?void 0:e.focus()},nt=function(e){var n;return null==(n=gn.current)?void 0:n.scrollToItem(e)},tt=T(Xn),ot=o.useCallback((function(e){if(T(Jn)){var n=c?-1:Jn.findIndex((function(e){return e.isSelected})),o=n>-1?n:e===h?0:Jn.length-1;nt(o),Sn(!0),Ln(null),Rn(t({index:o},Jn[o]))}else Sn(!0)}),[c,Jn]),it=o.useCallback((function(e){Gn((function(n){return n.filter((function(n){return n.value!==e}))}))}),[]),rt=o.useCallback((function(t){if(!t.isDisabled){if(t.isSelected)c&&it(t.value);else{t.isSelected,t.isDisabled;var o=n(t,ye);Gn((function(e){return c?[].concat(e,[o]):[o]}))}(N(fe)?fe:N(e)?e:e=function(){try{return document.createEvent("TouchEvent"),!0}catch(e){return!1}}())?_n():Ue&&(yn(""),Sn(!1))}}),[c,Ue,fe,it]);o.useImperativeHandle(a,(function(){return{menuOpen:Kn.current,blur:_n,focus:et,clearValue:function(){Gn(S),Rn(I)},setValue:function(e){Gn(B(e,An,Vn))},toggleMenu:function(e){e||void 0===e&&!Kn.current?(et(),ot(h)):_n()}}}),[An,Vn,ot]),l=function(){C&&et()},o.useEffect(l,[]),o.useEffect((function(){Wn.current&&Hn.current&&(Hn.current=!1,qn(Bn))}),[qn,Bn]),he((function(){if(jn.current){var e=c?Xn.map((function(e){return e.data})):T(Xn)?Xn[0].data:null;Pn(e)}}),[Pn,c,Xn]),he((function(){var e=Jn.length,n=Un.current,o=e>0&&(u||e!==nn.length||0===n),i=Kn.current&&void 0!==n&&n<e;if(0===e)Rn(I);else if(1===e||o||i){var r=Math.max(0,Jn.findIndex((function(e){return e.isSelected})));nt(r),Rn(t({index:r},Jn[r]))}Un.current=e}),[u,nn,Jn]);var at=function(){Nn.index;var e=n(Nn,Ce);e.data&&rt(e)},lt=function(e){if(T(Jn)){var n=Nn.index;switch(e){case p:n=Nn.index>0?Nn.index-1:Jn.length-1;break;case m:n=(Nn.index+1)%Jn.length;break;case v:var o=Nn.index-on;n=o<0?0:o;break;case b:var i=Nn.index+on;n=i>Jn.length-1?Jn.length-1:i}nt(n),zn&&Ln(null),Rn(t({index:n},Jn[n]))}},ut=function(e){if(!W){En||et();var n="INPUT"!==e.target.nodeName;On?n&&(Sn(!1),yn("")):qe&&ot(h),n&&e.preventDefault()}},ct=function(e){A(e),et()},st=o.useCallback((function(e){ct(e),Gn(S)}),[]),dt=o.useCallback((function(e){W||qe||(ct(e),Kn.current?Sn(!1):ot(h))}),[W,qe,ot]),ft=!!c&&tt,pt=!!X&&!W&&tt,mt=W||!Re||!!zn;return o.createElement(i.ThemeProvider,{theme:Tn},o.createElement(Oe,{id:w,"aria-controls":s,"aria-expanded":On,onKeyDown:function(e){if(!(W||R(M)&&(M(e.key,xn,Nn),e.defaultPrevented))){switch(e.key){case"ArrowDown":On?lt(m):ot(h);break;case"ArrowUp":On?lt(p):ot(g);break;case"ArrowLeft":case"ArrowRight":if(!c||xn||Ee)return;!function(e){if(tt){var n=-1,t=Xn.length-1,o=zn?Xn.findIndex((function(e){return e.value===zn})):-1,i=(n="ArrowRight"===e?o>-1&&o<t?o+1:-1:0!==o?-1===o?t:o-1:0)>=0?Xn[n].value:null;Nn.data&&Rn(I),i!==zn&&Ln(i)}}(e.key);break;case"PageUp":if(!On)return;lt(v);break;case"PageDown":if(!On)return;lt(b);break;case" ":if(xn)return;if(On){if(!Nn.data)return;at()}else ot(h);break;case"Enter":if(!On)return;at();break;case"Escape":On&&(Sn(!1),yn(""));break;case"Tab":if(e.shiftKey||!On||!Ke||!Nn.data)return;at();break;case"Delete":case"Backspace":if(xn)return;if(zn){var n=Xn.findIndex((function(e){return e.value===zn})),t=n>-1&&n<Xn.length-1?Xn[n+1].value:null;it(zn),Ln(t)}else{if(!Je)return;if(!tt)break;if(c&&!Ee){var o=Xn[Xn.length-1].value;it(o)}else X&&Gn(S)}break;default:return}e.preventDefault()}}},o.createElement(Ie,{ref:bn,isInvalid:D,isFocused:En,isDisabled:W,className:"rfs-control-container",onTouchEnd:ut,onMouseDown:ut},o.createElement(Se,{flex:ft},o.createElement(ee,{isMulti:c,inputValue:xn,placeholder:un,selectedOption:Xn,focusedMultiValue:zn,renderMultiOptions:Ee,renderOptionLabel:Fn,removeSelectedOption:it}),o.createElement(ie,{id:s,ref:vn,required:x,ariaLabel:F,inputValue:xn,readOnly:mt,onBlur:function(e){null==U||U(e),kn(!1),Sn(!1),yn("")},onFocus:function(e){null==Z||Z(e),kn(!0),ue&&ot(h)},onChange:function(e){Hn.current=!0,null==$||$(e.currentTarget.value),yn(e.currentTarget.value),Sn(!0)},ariaLabelledBy:_,hasSelectedOptions:tt})),o.createElement(ge,{menuOpen:On,clearIcon:z,caretIcon:L,isInvalid:D,isLoading:k,showClear:pt,isDisabled:W,loadingNode:J,onClearMouseDown:st,onCaretMouseDown:dt})),o.createElement(Y,{menuRef:hn,menuOpen:On,isLoading:k,menuTop:Zn,height:$n,itemSize:fn,loadingMsg:an,menuOptions:Jn,memoOptions:Ve,fixedSizeListRef:gn,lazyLoadMenu:Fe,noOptionsMsg:sn,selectOption:rt,direction:pe,itemKeySelector:le,overscanCount:de,menuPortalTarget:ce,onMenuMouseDown:ct,width:P||Tn.menu.width,renderOptionLabel:Fn,focusedOptionIndex:Nn.index}),se&&o.createElement(ae,{ariaLive:y,menuOpen:On,isFocused:En,ariaLabel:F,inputValue:xn,isSearchable:Re,focusedOption:Nn,selectedOption:Xn,optionCount:Jn.length})))}));Ee.displayName="Select",exports.Select=Ee; |
@@ -1,1 +0,2 @@ | ||
export { type Theme, type SelectRef, type MenuOption, type MultiParams, type SelectProps, default as Select } from './Select'; | ||
export { default as Select } from './Select'; | ||
export type { Theme, SelectRef, MenuOption, MultiParams } from './types'; |
@@ -1,1 +0,1 @@ | ||
import e from"@babel/runtime/helpers/esm/extends";import n,{memo as r,useMemo as t,Fragment as o,useRef as i,useEffect as a,useState as l,useCallback as d,forwardRef as s,useImperativeHandle as u}from"react";import c,{css as p,keyframes as m,ThemeProvider as v}from"styled-components";import h from"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";import{areEqual as g,FixedSizeList as f}from"react-window";import{createPortal as b}from"react-dom";var w={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container"},O={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input"},x={TOP:"top",AUTO:"auto",BOTTOM:"bottom"},y={ANY:"any",START:"start"},C=0,I=1,S=2,E=3,N=m(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),L=p([""," 0.2s ease-in"],m(["from{opacity:0;}to{opacity:1;}"])),M=35,z=300,T="Loading..",k="No options",D="Select option..",A={index:-1},B=[],R={OPTION_LABEL:e=>{var{label:n}=e;return n},OPTION_VALUE:e=>{var{value:n}=e;return n},OPTION_IS_DISABLED:e=>{var{isDisabled:n}=e;return!!n},OPTION_FILTER:e=>{var{label:n}=e;return"string"==typeof n?n:""+n}},V=/(auto|scroll)/;function F(e){return P(e)?window.pageYOffset:e.scrollTop}function P(e){return e===document.body||e===document.documentElement||e===window}function q(e){var{overflow:n,overflowX:r,overflowY:t}=e;return V.test(""+n+r+t)}function W(e){var n=getComputedStyle(e),r=document.documentElement,t="absolute"===n.position;if("fixed"===n.position)return r;for(var o=e;o=null==o?void 0:o.parentElement;)if(n=getComputedStyle(o),(!t||"static"!==n.position)&&q(n))return o;return r}function _(e,n,r,t){void 0===r&&(r=300);var o=0,i=F(e),a=n-i;requestAnimationFrame((function n(){var l,d=a*((l=(l=o+=5)/r-1)*l*l+1)+i;!function(e,n){P(e)?window.scrollTo(0,n):e.scrollTop=n}(e,d),o<r?requestAnimationFrame(n):null==t||t()}))}var j=/[\u0300-\u036f]/g,U=e=>"boolean"==typeof e,K=e=>"function"==typeof e,Y=e=>Array.isArray(e)&&!!e.length,H=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),X=e=>{e.preventDefault(),e.stopPropagation()},G=(e,n,r)=>{var t=e.trim();return n&&(t=t.toLowerCase()),r?t.normalize("NFD").replace(j,""):t},J=(e,n,r)=>{var t=Array.isArray(e)?e:H(e)?[e]:B;return Y(t)?t.map((e=>({data:e,value:n(e),label:r(e)}))):t},Q=(n,r)=>{var t=e({},n);return Object.keys(r).forEach((e=>{var o=r[e];t[e]="animation"!==e&&H(o)?n[e]?Q(n[e],o):o:null!=o?o:""})),t},Z={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"],N),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.35rem 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"},placeholder:{animation:L},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"}}},$=!!(null===window||void 0===window?void 0:window.ontouchstart)||!!(null===navigator||void 0===navigator?void 0:navigator.maxTouchPoints),ee=r((e=>{var{index:r,style:t,data:{menuOptions:o,selectOption:i,renderOptionLabel:a,focusedOptionIndex:l}}=e,{data:d,value:s,label:u,isDisabled:c,isSelected:p}=o[r],m=((e,n,r)=>{var t="rfs-option";return e&&(t+=" rfs-option-disabled"),n&&(t+=" rfs-option-selected"),r&&(t+=" rfs-option-focused"),t})(c,p,r===l),v=c?void 0:()=>i({data:d,value:s,label:u},p);return n.createElement("div",{style:t,onClick:v,className:m},a(d))}),((e,n)=>{var{memoOptions:r}=n.data;return r&&g(e,n)}));ee.displayName="Option";var ne=c.div.withConfig({displayName:"NoOptionsMsg",componentId:"sc-1on2920-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(e=>{var{theme:n}=e;return n.noOptions.color}),(e=>{var{theme:n}=e;return n.noOptions.margin}),(e=>{var{theme:n}=e;return n.noOptions.padding}),(e=>{var{theme:n}=e;return n.noOptions.fontSize}),(e=>{var{theme:n}=e;return n.noOptions.css})),re=e=>{var{width:r,height:i,itemSize:a,direction:l,isLoading:d,loadingMsg:s,menuOptions:u,memoOptions:c,selectOption:p,noOptionsMsg:m,overscanCount:v,itemKeySelector:h,fixedSizeListRef:g,renderOptionLabel:b,focusedOptionIndex:w}=e,O=t((()=>({menuOptions:u,memoOptions:c,selectOption:p,renderOptionLabel:b,focusedOptionIndex:w})),[u,c,w,p,b]);if(d)return n.createElement(ne,null,s);var x=h?(e,n)=>n.menuOptions[e][h]:void 0;return n.createElement(o,null,n.createElement(f,{width:r,height:i,itemKey:x,itemSize:a,itemData:O,direction:l,ref:g,overscanCount:v,itemCount:u.length},ee),!Y(u)&&m&&n.createElement(ne,null,m))},te=["menuRef","menuTop","menuOpen","onMenuMouseDown","menuPortalTarget"],oe=c.div.withConfig({displayName:"MenuWrapper",componentId:"sc-105ivps-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;will-change:top;padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}}"],(e=>{var{menuTop:n,menuOpen:r,hideNoOptionsMsg:t,theme:{menu:o}}=e;return p(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],o.width,o.margin,o.padding,o.animation,o.borderRadius,o.backgroundColor,t?"none":o.boxShadow,!r&&"display: none;",n&&"top: "+n+";")}),(e=>{var{theme:n}=e;return n.menu.css}),"rfs-option",(e=>{var{theme:n}=e;return n.menu.option.padding}),(e=>{var{theme:n}=e;return n.menu.option.textAlign}),"rfs-option-focused","rfs-option-disabled","rfs-option-selected",(e=>{var{theme:n}=e;return n.menu.option.focusedBgColor}),"rfs-option-selected",(e=>{var{theme:n}=e;return n.menu.option.selectedColor}),(e=>{var{theme:n}=e;return n.menu.option.selectedBgColor}),"rfs-option-disabled"),ie=r=>{var{menuRef:t,menuTop:o,menuOpen:i,onMenuMouseDown:a,menuPortalTarget:l}=r,d=h(r,te),{menuOptions:s,noOptionsMsg:u}=d,c=i&&!u&&!Y(s),p=n.createElement(oe,{ref:t,menuTop:o,menuOpen:i,onMouseDown:a,className:"rfs-menu-container",hideNoOptionsMsg:c},n.createElement(re,e({},d)));return l?b(p,l):p},ae=p(["color:",";"],(e=>{var{theme:n}=e;return n.multiValue.clear.focusColor})),le=c.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-1vzivtq-0"})(["min-width:0;display:flex;"," ",""],(e=>{var{theme:{multiValue:n}}=e;return p(["margin:",";animation:",";border-radius:",";background-color:",";"],n.margin,n.animation,n.borderRadius,n.backgroundColor)}),(e=>{var{theme:n}=e;return n.multiValue.css})),de=c.div.withConfig({displayName:"Label",componentId:"sc-1vzivtq-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(e=>{var{theme:n}=e;return n.multiValue.label.padding}),(e=>{var{theme:n}=e;return n.multiValue.label.fontSize}),(e=>{var{theme:n}=e;return n.multiValue.label.borderRadius})),se=c.i.withConfig({displayName:"Clear",componentId:"sc-1vzivtq-2"})(["display:flex;font-style:inherit;"," ",""],(e=>{var{theme:{multiValue:{clear:n}}}=e;return p(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";&:hover{","}"],n.color,n.padding,n.fontSize,n.alignSelf,n.transition,n.fontWeight,ae)}),(e=>{var{isFocused:n}=e;return n&&ae})),ue=r((e=>{var{data:r,value:t,isFocused:o,renderOptionLabel:i,removeSelectedOption:a}=e,l=i(r),d=()=>a(t);return n.createElement(le,null,n.createElement(de,null,l),n.createElement(se,{isFocused:o,onClick:d,onTouchEnd:d,onMouseDown:X},"✖"))}));ue.displayName="MultiValue";var ce=()=>{var e=i(!0);return e.current?(e.current=!1,!0):e.current},pe=(e,n)=>{var r=ce();a((()=>{if(!r)return e()}),n)},me=e=>{var n=i(e);return a((()=>{n.current=e})),d((function(){for(var e,r=arguments.length,t=new Array(r),o=0;o<r;o++)t[o]=arguments[o];return null===(e=n.current)||void 0===e?void 0:e.call(n,...t)}),[])},ve=function(e,n,r,t,o,i,d,s,u,c,p,m,v){void 0===u&&(u=!1),void 0===c&&(c=!1),void 0===p&&(p=!1),void 0===m&&(m=!1);var[h,g]=l(B),f=me(s||R.OPTION_FILTER),b=me(d||R.OPTION_IS_DISABLED),w=m?"":n,O=r===y.ANY,x=U(v)?v:p;return a((()=>{var n=t.length?new Set(t.map((e=>e.value))):null,r=G(w,u,c),a=e=>{var t,a=o(e),l=i(e),d=b(e),s=null!==(t=null==n?void 0:n.has(a))&&void 0!==t&&t,p={data:e,value:a,label:l,isDisabled:d,isSelected:s};if(!(!(e=>{if(!r)return!0;var n=f(e),t=G(n,u,c);return O?t.includes(r):t.substr(0,r.length)===r})(p)||x&&s))return p},l=e.reduce(((e,n)=>{var r=a(n);return r&&e.push(r),e}),[]);g(l)}),[e,w,o,i,t,O,u,c,b,f,x]),h},he=(e,n,r,t,o,d,s,u,c,p,m,v)=>{var h=i(!1),g=i(!u),f=me(c),b=me(p),[w,O]=l(d),[y,C]=l(!1);a((()=>{g.current=!y&&!u})),a((()=>{var{TOP:n,AUTO:r}=x,o=t===n||t===r&&!(e=>{if(!e)return!0;var n=W(e),{top:r,height:t}=e.getBoundingClientRect(),{height:o}=n.getBoundingClientRect();return o-F(n)-r>=t})(e.current);C(o)}),[e,t]),pe((()=>{if(r){var n=e=>{f(),e&&(h.current=!0,O(e))};g.current?((e,n,r,t)=>{if(e){var{top:o,height:i,bottom:a}=e.getBoundingClientRect(),l=window.innerHeight;if(l-o>=i)t();else{var d=W(e),s=F(d),u=d.getBoundingClientRect().height-s-o,c=u<i;if(!c&&r){var p=getComputedStyle(e).marginBottom;_(d,a-l+s+parseInt(p,10),n,t)}else t(c?u:void 0)}}else t()})(e.current,m,v,n):n()}else b(),h.current&&(h.current=!1,O(d))}),[e,r,d,v,m,b,f]);var I=Math.min(w,s*o),S=y?((e,n,r)=>{var t,o,i=n&&getComputedStyle(n),a=i?parseInt(i.marginBottom,10):0,l=i?parseInt(i.marginTop,10):0,d=null!==(t=null==r?void 0:r.getBoundingClientRect().height)&&void 0!==t?t:0,s=e>0?e:null!==(o=null==n?void 0:n.getBoundingClientRect().height)&&void 0!==o?o:0;return"calc("+-Math.abs(s+d)+"px + "+(a+l)+"px)"})(I,e.current,n.current):void 0;return[S,I]},ge=p(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),fe=c.div.withConfig({displayName:"SingleValue",componentId:"sc-us7kwl-0"})([""," max-width:calc(100% - 0.5rem);"],ge),be=c.div.withConfig({displayName:"Placeholder",componentId:"sc-us7kwl-1"})([""," color:",";",""],ge,(e=>{var{theme:n}=e;return n.color.placeholder}),(e=>{var{theme:n,initRender:r}=e;return!r&&p(["animation:",";"],n.placeholder.animation)})),we=e=>{var{isMulti:r,inputValue:t,placeholder:i,selectedOption:a,focusedMultiValue:l,renderOptionLabel:d,renderMultiOptions:s,removeSelectedOption:u}=e,c=ce(),p=!Y(a);return t&&(!r||r&&(p||s))?null:p?n.createElement(be,{initRender:c},i):r?n.createElement(o,null,s?s({renderOptionLabel:d,selected:a}):a.map((e=>{var{data:r,value:t}=e;return n.createElement(ue,{key:t,data:r,value:t,renderOptionLabel:d,isFocused:t===l,removeSelectedOption:u})}))):n.createElement(fe,null,d(a[0].data))},Oe=p(["font-size:inherit;font-weight:inherit;font-family:inherit;"]),xe=c.div.withConfig({displayName:"SizerDiv",componentId:"sc-4er7q8-0"})(["top:0;left:0;height:0;overflow:scroll;white-space:pre;position:absolute;visibility:hidden;"," ",""],Oe,(e=>{var{theme:n}=e;return n.input.css})),ye=c.input.attrs(O).withConfig({displayName:"Input",componentId:"sc-4er7q8-1"})(["border:0;outline:0;padding:0;cursor:text;background:0;color:inherit;box-sizing:content-box;"," :read-only{opacity:0;cursor:default;}:required{","}",""],Oe,(e=>{var{theme:n,isInvalid:r}=e;return r&&n.input.cssRequired}),(e=>{var{theme:n}=e;return n.input.css})),Ce=r(s(((e,r)=>{var{id:t,onBlur:a,onFocus:d,readOnly:s,required:u,onChange:c,ariaLabel:p,inputValue:m,ariaLabelledBy:v,hasSelectedOptions:h}=e,g=!!u&&!h,f=i(null),[b,w]=l(15);return pe((()=>{var{current:e}=f;e&&w(e.scrollWidth+15)}),[m]),n.createElement(o,null,n.createElement(ye,{id:t,ref:r,isInvalid:!0,onBlur:a,onFocus:d,value:m,readOnly:s,required:g,"aria-label":p,style:{width:b},"aria-labelledby":v,onChange:s?void 0:c}),n.createElement(xe,{ref:f},m))})));Ce.displayName="AutosizeInput";var Ie=c.span.withConfig({displayName:"A11yText",componentId:"sc-1yv4bud-0"})(["border:0;padding:0;width:1px;height:1px;margin:-1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(0,0,0,0);"]),Se=e=>{var{menuOpen:r,isFocused:t,inputValue:o,optionCount:i,isSearchable:a,focusedOption:l,selectedOption:d,ariaLive:s="polite",ariaLabel:u="Select"}=e;if(!t)return null;var c=r?"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.":u+" is focused"+(a?", type to filter options":"")+", press Down arrow key to open the menu.",{index:p,value:m,label:v,isDisabled:h}=l,g=((m&&!h?"Option "+v+" is focused, "+(p+1)+" of "+i+".":"")+" "+(i+" option(s) available"+(o?" for search "+o:"")+".")+" "+c).trimStart(),f="Selected option: "+(d.length?d.map((e=>e.label)).join(" "):"N/A");return n.createElement(Ie,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},n.createElement("span",{id:"aria-selection"},f),n.createElement("span",{id:"aria-context"},g))},Ee=c.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1tlaoz1-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;}}"],(e=>{var{theme:n}=e;return n.loader.padding}),(e=>{var{theme:n}=e;return p(["width:",";height:",";animation:",";background-color:",";"],n.loader.size,n.loader.size,n.loader.animation,n.loader.color)})),Ne=()=>n.createElement(Ee,{"aria-hidden":!0,className:"rfs-loading-dots"},n.createElement("div",null),n.createElement("div",null),n.createElement("div",null)),Le=c.svg.withConfig({displayName:"ClearSvg",componentId:"sc-kkzaaw-0"})(["fill:currentColor;",""],(e=>{var{theme:n}=e;return p(["width:",";height:",";animation:",";transition:",";"],n.icon.clear.width,n.icon.clear.height,n.icon.clear.animation,n.icon.clear.transition)})),Me=()=>n.createElement(Le,{"aria-hidden":!0,focusable:"false",viewBox:"0 0 14 16",className:"rfs-clear-icon"},n.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"})),ze=c.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1jozl2i-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),Te=c.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1jozl2i-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(e=>{var{theme:n}=e;return n.icon.color}),(e=>{var{theme:n}=e;return n.icon.padding}),(e=>{var{theme:n}=e;return n.icon.hoverColor}),(e=>{var{theme:n}=e;return n.icon.css})),ke=c.div.withConfig({displayName:"Separator",componentId:"sc-1jozl2i-2"})(["width:1px;margin:0.5rem 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(e=>{var{theme:n}=e;return n.color.iconSeparator||n.color.border})),De=c.div.withConfig({displayName:"Caret",componentId:"sc-1jozl2i-3"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(e=>{var{theme:n}=e;return n.icon.caret.transition}),(e=>{var{theme:n}=e;return n.icon.caret.size}),(e=>{var{theme:n}=e;return n.icon.caret.size}),(e=>{var{theme:n}=e;return n.icon.caret.size}),(e=>{var{theme:n,menuOpen:r,isInvalid:t}=e;return r&&p(["transform:rotate(180deg);color:",";"],t?n.color.danger:n.color.caretActive||n.color.primary)})),Ae=r((e=>{var{menuOpen:r,clearIcon:t,caretIcon:o,isInvalid:i,showClear:a,isLoading:l,isDisabled:d,loadingNode:s,onCaretMouseDown:u,onClearMouseDown:c}=e,p=e=>K(e)?e({menuOpen:r,isLoading:l,isInvalid:i,isDisabled:d}):e;return n.createElement(ze,null,a&&!l&&n.createElement(Te,{onTouchEnd:c,onMouseDown:c},p(t)||n.createElement(Me,null)),l&&(s||n.createElement(Ne,null)),n.createElement(ke,{role:"none"}),n.createElement(Te,{onTouchEnd:u,onMouseDown:u},p(o)||n.createElement(De,{"aria-hidden":!0,menuOpen:r,isInvalid:i,className:"rfs-caret-icon"})))}));Ae.displayName="IndicatorIcons";var Be=c.div.attrs(w).withConfig({displayName:"SelectWrapper",componentId:"sc-kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(e=>{var{theme:n}=e;return n.select.css})),Re=c.div.withConfig({displayName:"ValueWrapper",componentId:"sc-kcrmu9-1"})(["flex:1 1 0%;display:flex;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;padding:",";"],(e=>{var{theme:n}=e;return n.control.padding})),Ve=c.div.withConfig({displayName:"ControlWrapper",componentId:"sc-kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(e=>{var{isDisabled:n,isFocused:r,isInvalid:t,theme:{control:o,color:i}}=e;return p(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],o.transition,o.borderStyle,o.borderWidth,o.borderRadius,o.height||o.minHeight,t?i.danger:r?o.focusedBorderColor:i.border,o.height&&"height: "+o.height+";",n&&"pointer-events:none;user-select:none;",(o.backgroundColor||n)&&"background-color: "+(n?i.disabled:o.backgroundColor)+";",r&&"box-shadow: "+o.boxShadow+" "+(t?i.dangerLight:o.boxShadowColor)+";")}),(e=>{var{theme:n}=e;return n.control.css}),(e=>{var{isFocused:n,theme:r}=e;return n&&r.control.focusedCss})),Fe=s(((r,o)=>{var{async:s,isMulti:c,inputId:p,selectId:m,required:h,ariaLive:g,autoFocus:f,isLoading:b,onKeyDown:w,clearIcon:O,caretIcon:N,isInvalid:L,ariaLabel:V,menuWidth:F,isDisabled:P,inputDelay:q,onMenuOpen:W,onMenuClose:_,onInputBlur:j,isClearable:G,themeConfig:ee,loadingNode:ne,initialValue:re,onInputFocus:te,onInputChange:oe,ariaLabelledBy:ae,onOptionChange:le,onSearchChange:de,getOptionLabel:se,getOptionValue:ue,itemKeySelector:ce,openMenuOnFocus:ge,menuPortalTarget:fe,isAriaLiveEnabled:be,menuOverscanCount:Oe,blurInputOnSelect:xe,menuItemDirection:ye,renderOptionLabel:Ie,renderMultiOptions:Ee,menuScrollDuration:Ne,filterIgnoreAccents:Le,hideSelectedOptions:Me,getIsOptionDisabled:ze,getFilterOptionString:Te,isSearchable:ke=!0,memoOptions:De=!1,lazyLoadMenu:Fe=!1,openMenuOnClick:Pe=!0,filterIgnoreCase:qe=!0,tabSelectsOption:We=!0,closeMenuOnSelect:_e=!0,scrollMenuIntoView:je=!0,backspaceClearsValue:Ue=!0,filterMatchFrom:Ke=y.ANY,menuPosition:Ye=x.BOTTOM,options:He=B,loadingMsg:Xe=T,placeholder:Ge=D,noOptionsMsg:Je=k,menuItemSize:Qe=M,menuMaxHeight:Ze=z}=r,$e=i(!1),en=i(),nn=i(!1),rn=i(K(de)),tn=i(K(le)),on=i(null),an=i(null),ln=i(null),dn=i(null),[sn,un]=l(""),[cn,pn]=l(!1),[mn,vn]=l(!1),[hn,gn]=l(null),[fn,bn]=l(A),wn=t((()=>(e=>H(e)?Q(Z,e):Z)(ee)),[ee]),On=t((()=>se||R.OPTION_LABEL),[se]),xn=t((()=>ue||R.OPTION_VALUE),[ue]),yn=t((()=>Ie||On),[Ie,On]),Cn=function(e,n){void 0===n&&(n=0);var[r,t]=l(e);return pe((()=>{if(!(n<=0)){var r=setTimeout((()=>{t(e)}),n);return()=>{clearTimeout(r)}}}),[e,n]),n<=0?e:r}(sn,q),[In,Sn]=l((()=>J(re,xn,On))),En=ve(He,Cn,Ke,In,xn,On,ze,Te,qe,Le,c,s,Me),[Nn,Ln]=he(an,dn,cn,Ye,Qe,Ze,En.length,!!fe,W,_,Ne,je),Mn=me(de),zn=me(le),Tn=()=>{var e;return null===(e=ln.current)||void 0===e?void 0:e.blur()},kn=()=>{var e;return null===(e=ln.current)||void 0===e?void 0:e.focus()},Dn=e=>{var n;return null===(n=on.current)||void 0===n?void 0:n.scrollToItem(e)},An=Y(In),Bn=U(xe)?xe:$,Rn=d((n=>{if(Y(En)){var r=c?-1:En.findIndex((e=>e.isSelected)),t=r>-1?r:n===E?0:En.length-1;Dn(t),pn(!0),gn(null),bn(e({index:t},En[t]))}else pn(!0)}),[c,En]),Vn=d((e=>{Sn((n=>n.filter((n=>n.value!==e))))}),[]),Fn=d(((e,n)=>{n?c&&Vn(e.value):Sn((n=>c?[...n,e]:[e])),Bn?Tn():_e&&(un(""),pn(!1))}),[c,_e,Vn,Bn]);u(o,(()=>({empty:!An,menuOpen:$e.current,blur:Tn,focus:kn,clearValue:()=>{Sn(B),bn(A)},setValue:e=>{var n=J(e,xn,On);Sn(n)},toggleMenu:e=>{!0===e||void 0===e&&!$e.current?(kn(),Rn(E)):Tn()}})),[An,xn,On,Rn]),a((()=>{f&&kn()}),[]),a((()=>{$e.current=cn}),[cn]),a((()=>{rn.current=K(de),tn.current=K(le)})),a((()=>{mn&&ge&&Rn(E)}),[mn,ge,Rn]),a((()=>{var{current:e}=rn;e&&nn.current&&(nn.current=!1,Mn(Cn))}),[Mn,Cn]),pe((()=>{var{current:e}=tn;if(e){var n=c?In.map((e=>e.data)):Y(In)?In[0].data:null;zn(n)}}),[zn,c,In]),pe((()=>{var{length:n}=En,r=n>0&&(s||n!==He.length||0===en.current);0===n?bn(A):(1===n||r)&&(Dn(0),bn(e({index:0},En[0]))),en.current=n}),[s,He,En]);var Pn=()=>{var{data:e,value:n,label:r,isSelected:t,isDisabled:o}=fn;e&&!o&&Fn({data:e,value:n,label:r},t)},qn=n=>{if(Y(En)){var r=n===I?(fn.index+1)%En.length:fn.index>0?fn.index-1:En.length-1;Dn(r),gn(null),bn(e({index:r},En[r]))}},Wn=e=>{X(e),kn()},_n=e=>{if(!P){mn||kn();var n="INPUT"!==e.target.nodeName;cn?n&&(pn(!1),un("")):Pe&&Rn(E),n&&e.preventDefault()}},jn=d((e=>{null==j||j(e),vn(!1),pn(!1),un("")}),[j]),Un=d((e=>{null==te||te(e),vn(!0)}),[te]),Kn=d((e=>{nn.current=!0,null==oe||oe(e.currentTarget.value),un(e.currentTarget.value),pn(!0)}),[oe]),Yn=d((e=>{Wn(e),$e.current?pn(!1):Rn(E)}),[Rn]),Hn=d((e=>{Wn(e),Sn(B)}),[]),Xn=!Fe||Fe&&cn,Gn=!(!G||P||!An),Jn=P||!ke||!!hn,Qn=P||Pe?void 0:Yn;return n.createElement(v,{theme:wn},n.createElement(Be,{id:m,"aria-controls":p,"aria-expanded":cn,onKeyDown:e=>{if(!P){var{key:n,shiftKey:r,defaultPrevented:t}=e;if(!w||(w(e,sn,fn),!t)){switch(n){case"ArrowDown":cn?qn(I):Rn(E);break;case"ArrowUp":cn?qn(C):Rn(S);break;case"ArrowLeft":case"ArrowRight":if(!c||sn||Ee)return;(e=>{if(An){var n=-1,r=In.length-1,t=hn?In.findIndex((e=>e.value===hn)):-1,o=(n="ArrowRight"===e?t>-1&&t<r?t+1:-1:0!==t?-1===t?r:t-1:0)>=0?In[n].value:null;fn.data&&bn(A),o!==hn&&gn(o)}})(n);break;case" ":if(sn)return;if(cn){if(!fn.data)return;Pn()}else Rn(E);break;case"Enter":cn&&Pn();break;case"Escape":cn&&(pn(!1),un(""));break;case"Tab":if(!cn||!We||!fn.data||r)return;Pn();break;case"Delete":case"Backspace":if(sn)return;if(hn){var o=In.findIndex((e=>e.value===hn)),i=o>-1&&o<In.length-1?In[o+1].value:null;Vn(hn),gn(i)}else{if(!Ue)return;if(!An)break;if(c&&!Ee){var{value:a}=In[In.length-1];Vn(a)}else G&&Sn(B)}break;default:return}e.preventDefault()}}}},n.createElement(Ve,{ref:dn,isInvalid:L,isFocused:mn,isDisabled:P,className:"rfs-control-container",onTouchEnd:_n,onMouseDown:_n},n.createElement(Re,null,n.createElement(we,{isMulti:c,inputValue:sn,placeholder:Ge,selectedOption:In,focusedMultiValue:hn,renderMultiOptions:Ee,renderOptionLabel:yn,removeSelectedOption:Vn}),n.createElement(Ce,{id:p,ref:ln,required:h,ariaLabel:V,inputValue:sn,readOnly:Jn,onBlur:jn,onFocus:Un,onChange:Kn,ariaLabelledBy:ae,hasSelectedOptions:An})),n.createElement(Ae,{menuOpen:cn,clearIcon:O,caretIcon:N,isInvalid:L,isLoading:b,showClear:Gn,isDisabled:P,loadingNode:ne,onClearMouseDown:Hn,onCaretMouseDown:Qn})),Xn&&n.createElement(ie,{menuRef:an,menuOpen:cn,isLoading:b,menuTop:Nn,height:Ln,itemSize:Qe,loadingMsg:Xe,menuOptions:En,memoOptions:De,fixedSizeListRef:on,noOptionsMsg:Je,selectOption:Fn,direction:ye,itemKeySelector:ce,overscanCount:Oe,menuPortalTarget:fe,width:F||wn.menu.width,renderOptionLabel:yn,focusedOptionIndex:fn.index,onMenuMouseDown:Wn}),be&&n.createElement(Se,{ariaLive:g,menuOpen:cn,isFocused:mn,ariaLabel:V,inputValue:sn,isSearchable:ke,focusedOption:fn,selectedOption:In,optionCount:En.length})))}));Fe.displayName="Select";export{Fe as Select}; | ||
import e from"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";import n from"@babel/runtime/helpers/esm/extends";import r,{memo as t,useMemo as o,Fragment as i,forwardRef as a,useRef as l,useEffect as d,useState as s,useCallback as u,useImperativeHandle as c}from"react";import p,{css as m,keyframes as g,ThemeProvider as h}from"styled-components";import{createPortal as f}from"react-dom";import{areEqual as v,FixedSizeList as b}from"react-window";var w,x={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container"},y={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input"},O={TOP:"top",AUTO:"auto",BOTTOM:"bottom"},C={ANY:"any",START:"start"},I=0,S=1,E=2,M=3,k=4,z=5,L=g(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),N=m([""," 0.2s ease-in"],g(["from{opacity:0;}to{opacity:1;}"])),D={border:"#ced4da",danger:"#dc3545",primary:"#007bff",disabled:"#e9ecef",placeholder:"#6E7276",dangerLight:"rgba(220, 53, 69, 0.25)"},T={color:D,input:{},select:{},loader:{size:"0.625rem",padding:"0.375rem 0.75rem",animation:m([""," 1.19s ease-in-out infinite"],L),color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 14px",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",padding:"2px 8px",boxShadow:"0 0 0 0.2rem",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.35rem 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",padding:"0.375rem 0.75rem",selectedBgColor:D.primary,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:D.danger,transition:"color 0.2s ease-out"}}},A=5,V=35,B=300,R="Loading..",F="No options",P="Select option..",W=[],q={index:-1},j={optionLabel:e=>e.label,optionValue:e=>e.value,isOptionDisabled:e=>!!e.isDisabled,optionFilter:e=>"string"==typeof e.label?e.label:""+e.label},K=e=>U(e)?window.pageYOffset:e.scrollTop,U=e=>e===document.body||e===document.documentElement||e===window,Y=e=>{var n=getComputedStyle(e);if("fixed"===n.position)return document.documentElement;for(var r=/(auto|scroll)/,t="absolute"===n.position,o=e;o=null==(i=o)?void 0:i.parentElement;){var i;if(n=getComputedStyle(o),(!t||"static"!==n.position)&&r.test(""+n.overflow+n.overflowX+n.overflowY))return o}return document.documentElement},H=function(e,n,r,t){void 0===r&&(r=300);var o=0,i=K(e),a=n-i,l=()=>{var n,d=a*((n=(n=o+=5)/r-1)*n*n+1)+i;((e,n)=>{U(e)?window.scrollTo(0,n):e.scrollTop=n})(e,d),o<r?requestAnimationFrame(l):null==t||t()};requestAnimationFrame(l)},X=/[\u0300-\u036f]/g,G=e=>"boolean"==typeof e,J=e=>"function"==typeof e,Q=e=>Array.isArray(e)&&!!e.length,Z=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),$=e=>{e.preventDefault(),e.stopPropagation()},_=(e,n,r)=>{var t=e.trim();return n&&(t=t.toLowerCase()),r?t.normalize("NFD").replace(X,""):t},ee=(e,n,r)=>{var t=Array.isArray(e)?e:Z(e)?[e]:W;return Q(t)?t.map((e=>({data:e,value:n(e),label:r(e)}))):t},ne=(e,r)=>{var t=n({},e);return Object.keys(r).forEach((n=>{var o=r[n];t[n]="animation"!==n&&Z(o)?e[n]?ne(e[n],o):o:null!=o?o:""})),t},re=t((e=>{var n,t,o,{index:i,style:a,data:{menuOptions:l,selectOption:d,renderOptionLabel:s,focusedOptionIndex:u}}=e,c=l[i],p=(n=c.isDisabled,t=c.isSelected,o="rfs-option",n&&(o+=" rfs-option-disabled"),t&&(o+=" rfs-option-selected"),i===u&&(o+=" rfs-option-focused"),o);return r.createElement("div",{style:a,className:p,onClick:()=>d(c)},s(c.data))}),((e,n)=>{var{memoOptions:r}=n.data;return r&&v(e,n)}));re.displayName="Option";var te=p.div.withConfig({displayName:"NoOptionsMsg",componentId:"sc-1on2920-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(e=>{var{theme:n}=e;return n.noOptions.color}),(e=>{var{theme:n}=e;return n.noOptions.margin}),(e=>{var{theme:n}=e;return n.noOptions.padding}),(e=>{var{theme:n}=e;return n.noOptions.fontSize}),(e=>{var{theme:n}=e;return n.noOptions.css})),oe=e=>{var{width:n,height:t,itemSize:a,direction:l,isLoading:d,loadingMsg:s,menuOptions:u,memoOptions:c,selectOption:p,noOptionsMsg:m,overscanCount:g,itemKeySelector:h,fixedSizeListRef:f,renderOptionLabel:v,focusedOptionIndex:w}=e,x=o((()=>({menuOptions:u,memoOptions:c,selectOption:p,renderOptionLabel:v,focusedOptionIndex:w})),[u,c,w,p,v]);if(d)return r.createElement(te,null,s);var y=h?(e,n)=>n.menuOptions[e][h]:void 0;return r.createElement(i,null,r.createElement(b,{width:n,height:t,itemKey:y,itemSize:a,itemData:x,direction:l,ref:f,overscanCount:g,itemCount:u.length},re),!Q(u)&&m&&r.createElement(te,null,m))},ie=["menuRef","menuTop","menuOpen","lazyLoadMenu","onMenuMouseDown","menuPortalTarget"],ae=p.div.withConfig({displayName:"MenuWrapper",componentId:"sc-105ivps-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;will-change:top;padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}}"],(e=>{var{menuTop:n,menuOpen:r,hideNoOptionsMsg:t,theme:{menu:o}}=e;return m(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],o.width,o.margin,o.padding,o.animation,o.borderRadius,o.backgroundColor,t?"none":o.boxShadow,!r&&"display: none;",n&&"top: "+n+";")}),(e=>{var{theme:n}=e;return n.menu.css}),"rfs-option",(e=>{var{theme:n}=e;return n.menu.option.padding}),(e=>{var{theme:n}=e;return n.menu.option.textAlign}),"rfs-option-focused","rfs-option-disabled","rfs-option-selected",(e=>{var{theme:n}=e;return n.menu.option.focusedBgColor}),"rfs-option-selected",(e=>{var{theme:n}=e;return n.menu.option.selectedColor}),(e=>{var{theme:n}=e;return n.menu.option.selectedBgColor}),"rfs-option-disabled"),le=t=>{var{menuRef:o,menuTop:i,menuOpen:a,lazyLoadMenu:l,onMenuMouseDown:d,menuPortalTarget:s}=t,u=e(t,ie);if(l&&!a)return null;var{menuOptions:c,noOptionsMsg:p}=u,m=a&&!p&&!Q(c),g=r.createElement(ae,{ref:o,menuTop:i,menuOpen:a,onMouseDown:d,className:"rfs-menu-container",hideNoOptionsMsg:m},r.createElement(oe,n({},u)));return s?f(g,s):g},de=m(["color:",";"],(e=>{var{theme:n}=e;return n.multiValue.clear.focusColor})),se=p.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-1vzivtq-0"})(["min-width:0;display:flex;"," ",""],(e=>{var{theme:{multiValue:n}}=e;return m(["margin:",";animation:",";border-radius:",";background-color:",";"],n.margin,n.animation,n.borderRadius,n.backgroundColor)}),(e=>{var{theme:n}=e;return n.multiValue.css})),ue=p.div.withConfig({displayName:"Label",componentId:"sc-1vzivtq-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(e=>{var{theme:n}=e;return n.multiValue.label.padding}),(e=>{var{theme:n}=e;return n.multiValue.label.fontSize}),(e=>{var{theme:n}=e;return n.multiValue.label.borderRadius})),ce=p.i.withConfig({displayName:"Clear",componentId:"sc-1vzivtq-2"})(["display:flex;font-style:inherit;"," ",""],(e=>{var{theme:{multiValue:{clear:n}}}=e;return m(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";&:hover{","}"],n.color,n.padding,n.fontSize,n.alignSelf,n.transition,n.fontWeight,de)}),(e=>{var{isFocused:n}=e;return n&&de})),pe=t((e=>{var{data:n,value:t,isFocused:o,renderOptionLabel:i,removeSelectedOption:a}=e,l=i(n),d=()=>a(t);return r.createElement(se,null,r.createElement(ue,null,l),r.createElement(ce,{onClick:d,onTouchEnd:d,isFocused:o,onMouseDown:$},"✖"))}));pe.displayName="MultiValue";var me=p.div.withConfig({displayName:"SingleValue",componentId:"sc-us7kwl-0"})(["margin:0 2px;max-width:100%;overflow:hidden;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;grid-area:1 / 1 / 2 / 3;"]),ge=p(me).withConfig({displayName:"Placeholder",componentId:"sc-us7kwl-1"})(["color:",";"],(e=>{var{theme:n}=e;return n.color.placeholder})),he=e=>{var{isMulti:n,inputValue:t,placeholder:o,selectedOption:a,focusedMultiValue:l,renderOptionLabel:d,renderMultiOptions:s,removeSelectedOption:u}=e,c=!Q(a);if(t&&(!n||n&&(c||s)))return null;if(c)return r.createElement(ge,null,o);if(!n){var p=d(a[0].data);return r.createElement(me,null,p)}return r.createElement(i,null,s?s({renderOptionLabel:d,selected:a}):a.map((e=>{var{data:n,value:t}=e;return r.createElement(pe,{key:t,data:n,value:t,renderOptionLabel:d,isFocused:t===l,removeSelectedOption:u})})))},fe=m(["border:0;margin:0;outline:0;padding:0;font:inherit;min-width:2px;grid-area:1 / 2 / auto / auto;"]),ve=p.div.withConfig({displayName:"InputWrapper",componentId:"sc-4er7q8-0"})(['margin:2px;flex:1 1 auto;display:inline-grid;box-sizing:border-box;grid-area:1 / 1 / 2 / 3;grid-template-columns:0px min-content;:after{white-space:pre;visibility:hidden;content:attr(data-value) " ";',"}"],fe),be=p.input.attrs(y).withConfig({displayName:"Input",componentId:"sc-4er7q8-1"})(["width:100%;background:0;color:inherit;"," :read-only{opacity:0;cursor:default;}:required{","}",""],fe,(e=>{var{theme:n,isInvalid:r}=e;return r&&n.input.cssRequired}),(e=>{var{theme:n}=e;return n.input.css})),we=a(((e,n)=>{var{id:t,onBlur:o,onFocus:i,readOnly:a,required:l,onChange:d,ariaLabel:s,inputValue:u,ariaLabelledBy:c,hasSelectedOptions:p}=e,m=!!l&&!p;return r.createElement(ve,{"data-value":u},r.createElement(be,{id:t,ref:n,isInvalid:!0,onBlur:o,onFocus:i,value:u,readOnly:a,required:m,"aria-label":s,"aria-labelledby":c,onChange:a?void 0:d}))}));we.displayName="AutosizeInput";var xe=p.span.withConfig({displayName:"A11yText",componentId:"sc-1yv4bud-0"})(["border:0;padding:0;width:1px;height:1px;margin:-1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(0,0,0,0);"]),ye=e=>{var{menuOpen:n,isFocused:t,inputValue:o,optionCount:i,isSearchable:a,focusedOption:l,selectedOption:d,ariaLive:s="polite",ariaLabel:u="Select"}=e;if(!t)return null;var c=n?"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.":u+" is focused"+(a?", type to filter options":"")+", press Down arrow key to open the menu.",{index:p,value:m,label:g,isDisabled:h}=l,f=((m&&!h?"Option "+g+" is focused, "+(p+1)+" of "+i+".":"")+" "+(i+" option(s) available"+(o?" for search "+o:"")+".")+" "+c).trimStart(),v="Selected option: "+(d.length?d.map((e=>e.label)).join(" "):"N/A");return r.createElement(xe,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},r.createElement("span",{id:"aria-selection"},v),r.createElement("span",{id:"aria-context"},f))},Oe=p.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1tlaoz1-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;}}"],(e=>{var{theme:n}=e;return n.loader.padding}),(e=>{var{theme:n}=e;return m(["width:",";height:",";animation:",";background-color:",";"],n.loader.size,n.loader.size,n.loader.animation,n.loader.color)})),Ce=()=>r.createElement(Oe,{"aria-hidden":!0,className:"rfs-loading-dots"},r.createElement("div",null),r.createElement("div",null),r.createElement("div",null)),Ie=p.svg.withConfig({displayName:"ClearSvg",componentId:"sc-kkzaaw-0"})(["fill:currentColor;",""],(e=>{var{theme:n}=e;return m(["width:",";height:",";animation:",";transition:",";"],n.icon.clear.width,n.icon.clear.height,n.icon.clear.animation,n.icon.clear.transition)})),Se=()=>r.createElement(Ie,{"aria-hidden":!0,focusable:"false",viewBox:"0 0 14 16",className:"rfs-clear-icon"},r.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"})),Ee=p.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1jozl2i-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),Me=p.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1jozl2i-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(e=>{var{theme:n}=e;return n.icon.color}),(e=>{var{theme:n}=e;return n.icon.padding}),(e=>{var{theme:n}=e;return n.icon.hoverColor}),(e=>{var{theme:n}=e;return n.icon.css})),ke=p.div.withConfig({displayName:"Separator",componentId:"sc-1jozl2i-2"})(["width:1px;margin:8px 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(e=>{var{theme:n}=e;return n.color.iconSeparator||n.color.border})),ze=p.div.withConfig({displayName:"Caret",componentId:"sc-1jozl2i-3"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(e=>{var{theme:n}=e;return n.icon.caret.transition}),(e=>{var{theme:n}=e;return n.icon.caret.size}),(e=>{var{theme:n}=e;return n.icon.caret.size}),(e=>{var{theme:n}=e;return n.icon.caret.size}),(e=>{var{theme:n,menuOpen:r,isInvalid:t}=e;return r&&m(["transform:rotate(180deg);color:",";"],t?n.color.danger:n.color.caretActive||n.color.primary)})),Le=t((e=>{var{menuOpen:n,clearIcon:t,caretIcon:o,isInvalid:i,showClear:a,isLoading:l,isDisabled:d,loadingNode:s,onCaretMouseDown:u,onClearMouseDown:c}=e,p=e=>J(e)?e({menuOpen:n,isLoading:l,isInvalid:i,isDisabled:d}):e;return r.createElement(Ee,null,a&&!l&&r.createElement(Me,{onTouchEnd:c,onMouseDown:c},p(t)||r.createElement(Se,null)),l&&(s||r.createElement(Ce,null)),r.createElement(ke,{role:"none"}),r.createElement(Me,{onTouchEnd:u,onMouseDown:u},p(o)||r.createElement(ze,{"aria-hidden":!0,menuOpen:n,isInvalid:i,className:"rfs-caret-icon"})))}));Le.displayName="IndicatorIcons";var Ne=(e,n)=>{var r=l(!0);d((()=>{if(!r.current)return e();r.current=!1}),n)},De=e=>{var n=l(e);return n.current=e,n},Te=e=>{var n=l(e);return d((()=>{n.current=e}),[e]),u((function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return null==n.current?void 0:n.current(...r)}),[])},Ae=function(e,n,r,t,i,a,l,d,s,u,c,p,m){void 0===s&&(s=!1),void 0===u&&(u=!1),void 0===c&&(c=!1),void 0===p&&(p=!1);var g=Te(d||j.optionFilter),h=Te(l||j.isOptionDisabled),f=G(m)?m:c,v=p?"":n;return o((()=>{var n=t.map((e=>e.value)),o=r===C.ANY,l=_(v,s,u),d=e=>{var r=i(e),t=a(e),d=h(e),c=n.includes(r),p={data:e,value:r,label:t,isDisabled:d,isSelected:c};return!(e=>{if(!l)return!0;var n=g(e),r=_(n,s,u);return o?r.includes(l):r.startsWith(l)})(p)||f&&c?void 0:p};return e.reduce(((e,n)=>{var r=d(n);return r&&e.push(r),e}),[])}),[e,v,i,a,t,r,s,u,h,g,f])},Ve=(e,n,r,t,i,a,d,u,c,p,m,g)=>{var h=o((()=>t===O.TOP||t===O.AUTO&&!(e=>{if(!e)return!0;var n=Y(e),{top:r,height:t}=e.getBoundingClientRect();return n.getBoundingClientRect().height-K(n)-r>=t})(e.current)),[e,t]),f=Te(c),v=Te(p),b=l(!1),[w,x]=s(a),y=De(!h&&!u);Ne((()=>{if(r){var n=e=>{f(),e&&(b.current=!0,x(e))};y.current?((e,n,r,t)=>{if(e){var{top:o,height:i,bottom:a}=e.getBoundingClientRect(),l=window.innerHeight;if(l-o>=i)t();else{var d=Y(e),s=K(d),u=d.getBoundingClientRect().height-s-o,c=u<i;if(!c&&r){var p=parseInt(getComputedStyle(e).marginBottom,10);H(d,a-l+s+p,n,t)}else t(c?u:void 0)}}else t()})(e.current,m,g,n):n()}else v(),b.current&&(b.current=!1,x(a))}),[e,r,a,g,m,v,f]);var C=Math.min(w,d*i),I=h?((e,n,r)=>{var t,o,i=n&&getComputedStyle(n),a=i?parseInt(i.marginBottom,10):0,l=i?parseInt(i.marginTop,10):0,d=null!=(t=null==r?void 0:r.getBoundingClientRect().height)?t:0,s=e>0?e:null!=(o=null==n?void 0:n.getBoundingClientRect().height)?o:0;return"calc("+-Math.abs(s+d)+"px + "+(a+l)+"px)"})(C,e.current,n.current):void 0;return[I,C]},Be=["isSelected","isDisabled"],Re=["index"],Fe=p.div.attrs(x).withConfig({displayName:"SelectWrapper",componentId:"sc-kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(e=>{var{theme:n}=e;return n.select.css})),Pe=p.div.withConfig({displayName:"ValueWrapper",componentId:"sc-kcrmu9-1"})(["flex:1 1 0%;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;display:",";padding:",";"],(e=>{var{flex:n}=e;return n?"flex":"grid"}),(e=>{var{theme:n}=e;return n.control.padding})),We=p.div.withConfig({displayName:"ControlWrapper",componentId:"sc-kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(e=>{var{isDisabled:n,isFocused:r,isInvalid:t,theme:{control:o,color:i}}=e;return m(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],o.transition,o.borderStyle,o.borderWidth,o.borderRadius,o.height||o.minHeight,t?i.danger:r?o.focusedBorderColor:i.border,o.height&&"height: "+o.height+";",n&&"pointer-events:none;user-select:none;",(o.backgroundColor||n)&&"background-color: "+(n?i.disabled:o.backgroundColor)+";",r&&"box-shadow: "+o.boxShadow+" "+(t?i.dangerLight:o.boxShadowColor)+";")}),(e=>{var{theme:n}=e;return n.control.css}),(e=>{var{isFocused:n,theme:r}=e;return n&&r.control.focusedCss})),qe=a(((t,i)=>{var{async:a,isMulti:p,inputId:m,selectId:g,required:f,ariaLive:v,autoFocus:b,isLoading:x,onKeyDown:y,clearIcon:L,caretIcon:N,isInvalid:D,ariaLabel:K,menuWidth:U,isDisabled:Y,inputDelay:H,onMenuOpen:X,onMenuClose:_,onInputBlur:re,isClearable:te,themeConfig:oe,loadingNode:ie,initialValue:ae,onInputFocus:de,onInputChange:se,ariaLabelledBy:ue,onOptionChange:ce,onSearchChange:pe,getOptionLabel:me,getOptionValue:ge,itemKeySelector:fe,openMenuOnFocus:ve,menuPortalTarget:be,isAriaLiveEnabled:xe,menuOverscanCount:Oe,blurInputOnSelect:Ce,menuItemDirection:Ie,renderOptionLabel:Se,renderMultiOptions:Ee,menuScrollDuration:Me,filterIgnoreAccents:ke,hideSelectedOptions:ze,getIsOptionDisabled:qe,getFilterOptionString:je,isSearchable:Ke=!0,memoOptions:Ue=!1,lazyLoadMenu:Ye=!1,openMenuOnClick:He=!0,filterIgnoreCase:Xe=!0,tabSelectsOption:Ge=!0,closeMenuOnSelect:Je=!0,scrollMenuIntoView:Qe=!0,backspaceClearsValue:Ze=!0,filterMatchFrom:$e=C.ANY,menuPosition:_e=O.BOTTOM,options:en=W,pageSize:nn=A,loadingMsg:rn=R,placeholder:tn=P,noOptionsMsg:on=F,menuItemSize:an=V,menuMaxHeight:ln=B}=t,dn=l(null),sn=l(null),un=l(null),cn=l(null),[pn,mn]=s(""),[gn,hn]=s(!1),[fn,vn]=s(!1),[bn,wn]=s(null),[xn,yn]=s(q),On=o((()=>Z(oe)?ne(T,oe):T),[oe]),Cn=o((()=>me||j.optionLabel),[me]),In=o((()=>ge||j.optionValue),[ge]),Sn=o((()=>Se||Cn),[Se,Cn]),En=function(e,n){void 0===n&&(n=0);var[r,t]=s(e);return Ne((()=>{if(!(n<=0)){var r=setTimeout((()=>{t(e)}),n);return()=>{clearTimeout(r)}}}),[e,n]),n<=0?e:r}(pn,H),Mn=Te(pe),kn=Te(ce),zn=De(J(pe)),Ln=De(J(ce)),Nn=De(gn),Dn=l(!1),Tn=l(),[An,Vn]=s((()=>ee(ae,In,Cn))),Bn=Ae(en,En,$e,An,In,Cn,qe,je,Xe,ke,p,a,ze),[Rn,Fn]=Ve(sn,cn,gn,_e,an,ln,Bn.length,!!be,X,_,Me,Qe),Pn=()=>{var e;return null==(e=un.current)?void 0:e.blur()},Wn=()=>{var e;return null==(e=un.current)?void 0:e.focus()},qn=e=>{var n;return null==(n=dn.current)?void 0:n.scrollToItem(e)},jn=Q(An),Kn=u((e=>{if(Q(Bn)){var r=p?-1:Bn.findIndex((e=>e.isSelected)),t=r>-1?r:e===M?0:Bn.length-1;qn(t),hn(!0),wn(null),yn(n({index:t},Bn[t]))}else hn(!0)}),[p,Bn]),Un=u((e=>{Vn((n=>n.filter((n=>n.value!==e))))}),[]),Yn=u((n=>{if(!n.isDisabled){if(n.isSelected)p&&Un(n.value);else{var r=e(n,Be);Vn((e=>p?[...e,r]:[r]))}(G(Ce)?Ce:G(w)?w:w=(()=>{try{return document.createEvent("TouchEvent"),!0}catch(e){return!1}})())?Pn():Je&&(mn(""),hn(!1))}}),[p,Je,Ce,Un]);c(i,(()=>({menuOpen:Nn.current,blur:Pn,focus:Wn,clearValue:()=>{Vn(W),yn(q)},setValue:e=>{Vn(ee(e,In,Cn))},toggleMenu:e=>{e||void 0===e&&!Nn.current?(Wn(),Kn(M)):Pn()}})),[In,Cn,Kn]),d((()=>{b&&Wn()}),[]),d((()=>{zn.current&&Dn.current&&(Dn.current=!1,Mn(En))}),[Mn,En]),Ne((()=>{if(Ln.current){var e=p?An.map((e=>e.data)):Q(An)?An[0].data:null;kn(e)}}),[kn,p,An]),Ne((()=>{var e=Bn.length,{current:r}=Tn,t=e>0&&(a||e!==en.length||0===r),o=Nn.current&&void 0!==r&&r<e;if(0===e)yn(q);else if(1===e||t||o){var i=Math.max(0,Bn.findIndex((e=>e.isSelected)));qn(i),yn(n({index:i},Bn[i]))}Tn.current=e}),[a,en,Bn]);var Hn=()=>{var n=e(xn,Re);n.data&&Yn(n)},Xn=e=>{if(Q(Bn)){var r=xn.index;switch(e){case I:r=xn.index>0?xn.index-1:Bn.length-1;break;case S:r=(xn.index+1)%Bn.length;break;case k:var t=xn.index-nn;r=t<0?0:t;break;case z:var o=xn.index+nn;r=o>Bn.length-1?Bn.length-1:o}qn(r),bn&&wn(null),yn(n({index:r},Bn[r]))}},Gn=e=>{if(!Y){fn||Wn();var n="INPUT"!==e.target.nodeName;gn?n&&(hn(!1),mn("")):He&&Kn(M),n&&e.preventDefault()}},Jn=e=>{$(e),Wn()},Qn=u((e=>{Jn(e),Vn(W)}),[]),Zn=u((e=>{Y||He||(Jn(e),Nn.current?hn(!1):Kn(M))}),[Y,He,Kn]),$n=!!p&&jn,_n=!!te&&!Y&&jn,er=Y||!Ke||!!bn;return r.createElement(h,{theme:On},r.createElement(Fe,{id:g,"aria-controls":m,"aria-expanded":gn,onKeyDown:e=>{if(!(Y||J(y)&&(y(e.key,pn,xn),e.defaultPrevented))){switch(e.key){case"ArrowDown":gn?Xn(S):Kn(M);break;case"ArrowUp":gn?Xn(I):Kn(E);break;case"ArrowLeft":case"ArrowRight":if(!p||pn||Ee)return;(e=>{if(jn){var n=-1,r=An.length-1,t=bn?An.findIndex((e=>e.value===bn)):-1,o=(n="ArrowRight"===e?t>-1&&t<r?t+1:-1:0!==t?-1===t?r:t-1:0)>=0?An[n].value:null;xn.data&&yn(q),o!==bn&&wn(o)}})(e.key);break;case"PageUp":if(!gn)return;Xn(k);break;case"PageDown":if(!gn)return;Xn(z);break;case" ":if(pn)return;if(gn){if(!xn.data)return;Hn()}else Kn(M);break;case"Enter":if(!gn)return;Hn();break;case"Escape":gn&&(hn(!1),mn(""));break;case"Tab":if(e.shiftKey||!gn||!Ge||!xn.data)return;Hn();break;case"Delete":case"Backspace":if(pn)return;if(bn){var n=An.findIndex((e=>e.value===bn)),r=n>-1&&n<An.length-1?An[n+1].value:null;Un(bn),wn(r)}else{if(!Ze)return;if(!jn)break;if(p&&!Ee){var{value:t}=An[An.length-1];Un(t)}else te&&Vn(W)}break;default:return}e.preventDefault()}}},r.createElement(We,{ref:cn,isInvalid:D,isFocused:fn,isDisabled:Y,className:"rfs-control-container",onTouchEnd:Gn,onMouseDown:Gn},r.createElement(Pe,{flex:$n},r.createElement(he,{isMulti:p,inputValue:pn,placeholder:tn,selectedOption:An,focusedMultiValue:bn,renderMultiOptions:Ee,renderOptionLabel:Sn,removeSelectedOption:Un}),r.createElement(we,{id:m,ref:un,required:f,ariaLabel:K,inputValue:pn,readOnly:er,onBlur:e=>{null==re||re(e),vn(!1),hn(!1),mn("")},onFocus:e=>{null==de||de(e),vn(!0),ve&&Kn(M)},onChange:e=>{Dn.current=!0,null==se||se(e.currentTarget.value),mn(e.currentTarget.value),hn(!0)},ariaLabelledBy:ue,hasSelectedOptions:jn})),r.createElement(Le,{menuOpen:gn,clearIcon:L,caretIcon:N,isInvalid:D,isLoading:x,showClear:_n,isDisabled:Y,loadingNode:ie,onClearMouseDown:Qn,onCaretMouseDown:Zn})),r.createElement(le,{menuRef:sn,menuOpen:gn,isLoading:x,menuTop:Rn,height:Fn,itemSize:an,loadingMsg:rn,menuOptions:Bn,memoOptions:Ue,fixedSizeListRef:dn,lazyLoadMenu:Ye,noOptionsMsg:on,selectOption:Yn,direction:Ie,itemKeySelector:fe,overscanCount:Oe,menuPortalTarget:be,onMenuMouseDown:Jn,width:U||On.menu.width,renderOptionLabel:Sn,focusedOptionIndex:xn.index}),xe&&r.createElement(ye,{ariaLive:v,menuOpen:gn,isFocused:fn,ariaLabel:K,inputValue:pn,isSearchable:Ke,focusedOption:xn,selectedOption:An,optionCount:Bn.length})))}));qe.displayName="Select";export{qe 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,r,o){"use strict";function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a.apply(this,arguments)}var i="rfs-option",l="rfs-option-focused",s="rfs-option-selected",d="rfs-option-disabled",u={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container"},c={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input"},p={TOP:"top",AUTO:"auto",BOTTOM:"bottom"},m={ANY:"any",START:"start"},f=0,v=1,h=2,g=3,b=n.keyframes(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),w=n.keyframes(["from{opacity:0;}to{opacity:1;}"]),O=n.css([""," 0.2s ease-in"],w),y=35,x=300,C="Loading..",I="No options",S="Select option..",E={index:-1},k=[],M={OPTION_LABEL:e=>{var{label:t}=e;return t},OPTION_VALUE:e=>{var{value:t}=e;return t},OPTION_IS_DISABLED:e=>{var{isDisabled:t}=e;return!!t},OPTION_FILTER:e=>{var{label:t}=e;return"string"==typeof t?t:""+t}};var N=/(auto|scroll)/;function L(e){return z(e)?window.pageYOffset:e.scrollTop}function z(e){return e===document.body||e===document.documentElement||e===window}function T(e){var{overflow:t,overflowX:n,overflowY:r}=e;return N.test(""+t+n+r)}function R(e){var t=getComputedStyle(e),n=document.documentElement,r="absolute"===t.position;if("fixed"===t.position)return n;for(var o=e;o=null==o?void 0:o.parentElement;)if(t=getComputedStyle(o),(!r||"static"!==t.position)&&T(t))return o;return n}function D(e,t,n,r){void 0===n&&(n=300);var o=0,a=L(e),i=t-a;requestAnimationFrame((function t(){var l,s=i*((l=(l=o+=5)/n-1)*l*l+1)+a;!function(e,t){z(e)?window.scrollTo(0,t):e.scrollTop=t}(e,s),o<n?requestAnimationFrame(t):null==r||r()}))}var A=/[\u0300-\u036f]/g,B=e=>"boolean"==typeof e,V=e=>"function"==typeof e,F=e=>Array.isArray(e)&&!!e.length,P=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),q=e=>{e.preventDefault(),e.stopPropagation()},j=(e,t,n)=>{var r=e.trim();return t&&(r=r.toLowerCase()),n?r.normalize("NFD").replace(A,""):r},W=(e,t,n)=>{var r=Array.isArray(e)?e:P(e)?[e]:k;return F(r)?r.map((e=>({data:e,value:t(e),label:n(e)}))):r},_=(e,t)=>{var n=a({},e);return Object.keys(t).forEach((r=>{var o=t[r];n[r]="animation"!==r&&P(o)?e[r]?_(e[r],o):o:null!=o?o:""})),n},U={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"],b),color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 0.9375rem",clear:{width:"14px",height:"16px",animation:O,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.35rem 0",borderRadius:"3px",backgroundColor:"#fff",animation:O,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"},placeholder:{animation:O},multiValue:{margin:"1px 2px",borderRadius:"3px",backgroundColor:"#e7edf3",animation:O,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"}}},K=!!(null===window||void 0===window?void 0:window.ontouchstart)||!!(null===navigator||void 0===navigator?void 0:navigator.maxTouchPoints),Y=(e,t)=>{var{memoOptions:n}=t.data;return n&&r.areEqual(e,t)},H=t.memo((e=>{var{index:n,style:r,data:{menuOptions:o,selectOption:a,renderOptionLabel:l,focusedOptionIndex:s}}=e,{data:d,value:u,label:c,isDisabled:p,isSelected:m}=o[n],f=((e,t,n)=>{var r=i;return e&&(r+=" rfs-option-disabled"),t&&(r+=" rfs-option-selected"),n&&(r+=" rfs-option-focused"),r})(p,m,n===s),v=p?void 0:()=>a({data:d,value:u,label:c},m);return t.createElement("div",{style:r,onClick:v,className:f},l(d))}),Y);H.displayName="Option";var X=n.div.withConfig({displayName:"NoOptionsMsg",componentId:"sc-1on2920-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(e=>{var{theme:t}=e;return t.noOptions.color}),(e=>{var{theme:t}=e;return t.noOptions.margin}),(e=>{var{theme:t}=e;return t.noOptions.padding}),(e=>{var{theme:t}=e;return t.noOptions.fontSize}),(e=>{var{theme:t}=e;return t.noOptions.css})),G=e=>{var{width:n,height:o,itemSize:a,direction:i,isLoading:l,loadingMsg:s,menuOptions:d,memoOptions:u,selectOption:c,noOptionsMsg:p,overscanCount:m,itemKeySelector:f,fixedSizeListRef:v,renderOptionLabel:h,focusedOptionIndex:g}=e,b=t.useMemo((()=>({menuOptions:d,memoOptions:u,selectOption:c,renderOptionLabel:h,focusedOptionIndex:g})),[d,u,g,c,h]);if(l)return t.createElement(X,null,s);var w=f?(e,t)=>t.menuOptions[e][f]:void 0;return t.createElement(t.Fragment,null,t.createElement(r.FixedSizeList,{width:n,height:o,itemKey:w,itemSize:a,itemData:b,direction:i,ref:v,overscanCount:m,itemCount:d.length},H),!F(d)&&p&&t.createElement(X,null,p))},J=["menuRef","menuTop","menuOpen","onMenuMouseDown","menuPortalTarget"],Q=n.div.withConfig({displayName:"MenuWrapper",componentId:"sc-105ivps-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;will-change:top;padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}}"],(e=>{var{menuTop:t,menuOpen:r,hideNoOptionsMsg:o,theme:{menu:a}}=e;return n.css(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],a.width,a.margin,a.padding,a.animation,a.borderRadius,a.backgroundColor,o?"none":a.boxShadow,!r&&"display: none;",t&&"top: "+t+";")}),(e=>{var{theme:t}=e;return t.menu.css}),i,(e=>{var{theme:t}=e;return t.menu.option.padding}),(e=>{var{theme:t}=e;return t.menu.option.textAlign}),l,d,s,(e=>{var{theme:t}=e;return t.menu.option.focusedBgColor}),s,(e=>{var{theme:t}=e;return t.menu.option.selectedColor}),(e=>{var{theme:t}=e;return t.menu.option.selectedBgColor}),d),Z=e=>{var{menuRef:n,menuTop:r,menuOpen:i,onMenuMouseDown:l,menuPortalTarget:s}=e,d=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,J),{menuOptions:u,noOptionsMsg:c}=d,p=i&&!c&&!F(u),m=t.createElement(Q,{ref:n,menuTop:r,menuOpen:i,onMouseDown:l,className:"rfs-menu-container",hideNoOptionsMsg:p},t.createElement(G,a({},d)));return s?o.createPortal(m,s):m},$=n.css(["color:",";"],(e=>{var{theme:t}=e;return t.multiValue.clear.focusColor})),ee=n.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-1vzivtq-0"})(["min-width:0;display:flex;"," ",""],(e=>{var{theme:{multiValue:t}}=e;return n.css(["margin:",";animation:",";border-radius:",";background-color:",";"],t.margin,t.animation,t.borderRadius,t.backgroundColor)}),(e=>{var{theme:t}=e;return t.multiValue.css})),te=n.div.withConfig({displayName:"Label",componentId:"sc-1vzivtq-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(e=>{var{theme:t}=e;return t.multiValue.label.padding}),(e=>{var{theme:t}=e;return t.multiValue.label.fontSize}),(e=>{var{theme:t}=e;return t.multiValue.label.borderRadius})),ne=n.i.withConfig({displayName:"Clear",componentId:"sc-1vzivtq-2"})(["display:flex;font-style:inherit;"," ",""],(e=>{var{theme:{multiValue:{clear:t}}}=e;return n.css(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";&:hover{","}"],t.color,t.padding,t.fontSize,t.alignSelf,t.transition,t.fontWeight,$)}),(e=>{var{isFocused:t}=e;return t&&$})),re=t.memo((e=>{var{data:n,value:r,isFocused:o,renderOptionLabel:a,removeSelectedOption:i}=e,l=a(n),s=()=>i(r);return t.createElement(ee,null,t.createElement(te,null,l),t.createElement(ne,{isFocused:o,onClick:s,onTouchEnd:s,onMouseDown:q},"✖"))}));re.displayName="MultiValue";var oe=()=>{var e=t.useRef(!0);return e.current?(e.current=!1,!0):e.current},ae=(e,n)=>{var r=oe();t.useEffect((()=>{if(!r)return e()}),n)},ie=e=>{var n=t.useRef(e);return t.useEffect((()=>{n.current=e})),t.useCallback((function(){for(var e,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return null===(e=n.current)||void 0===e?void 0:e.call(n,...r)}),[])},le=function(e,n,r,o,a,i,l,s,d,u,c,p,f){void 0===d&&(d=!1),void 0===u&&(u=!1),void 0===c&&(c=!1),void 0===p&&(p=!1);var[v,h]=t.useState(k),g=ie(s||M.OPTION_FILTER),b=ie(l||M.OPTION_IS_DISABLED),w=p?"":n,O=r===m.ANY,y=B(f)?f:c;return t.useEffect((()=>{var t=o.length?new Set(o.map((e=>e.value))):null,n=j(w,d,u),r=e=>{var r,o=a(e),l=i(e),s=b(e),c=null!==(r=null==t?void 0:t.has(o))&&void 0!==r&&r,p={data:e,value:o,label:l,isDisabled:s,isSelected:c};if(!(!(e=>{if(!n)return!0;var t=g(e),r=j(t,d,u);return O?r.includes(n):r.substr(0,n.length)===n})(p)||y&&c))return p},l=e.reduce(((e,t)=>{var n=r(t);return n&&e.push(n),e}),[]);h(l)}),[e,w,a,i,o,O,d,u,b,g,y]),v},se=(e,n,r,o,a,i,l,s,d,u,c,m)=>{var f=t.useRef(!1),v=t.useRef(!s),h=ie(d),g=ie(u),[b,w]=t.useState(i),[O,y]=t.useState(!1);t.useEffect((()=>{v.current=!O&&!s})),t.useEffect((()=>{var{TOP:t,AUTO:n}=p,r=o===t||o===n&&!(e=>{if(!e)return!0;var t=R(e),{top:n,height:r}=e.getBoundingClientRect(),{height:o}=t.getBoundingClientRect();return o-L(t)-n>=r})(e.current);y(r)}),[e,o]),ae((()=>{if(r){var t=e=>{h(),e&&(f.current=!0,w(e))};v.current?((e,t,n,r)=>{if(e){var{top:o,height:a,bottom:i}=e.getBoundingClientRect(),l=window.innerHeight;if(l-o>=a)r();else{var s=R(e),d=L(s),u=s.getBoundingClientRect().height-d-o,c=u<a;if(!c&&n){var p=getComputedStyle(e).marginBottom;D(s,i-l+d+parseInt(p,10),t,r)}else r(c?u:void 0)}}else r()})(e.current,c,m,t):t()}else g(),f.current&&(f.current=!1,w(i))}),[e,r,i,m,c,g,h]);var x=Math.min(b,l*a),C=O?((e,t,n)=>{var r,o,a=t&&getComputedStyle(t),i=a?parseInt(a.marginBottom,10):0,l=a?parseInt(a.marginTop,10):0,s=null!==(r=null==n?void 0:n.getBoundingClientRect().height)&&void 0!==r?r:0,d=e>0?e:null!==(o=null==t?void 0:t.getBoundingClientRect().height)&&void 0!==o?o:0;return"calc("+-Math.abs(d+s)+"px + "+(i+l)+"px)"})(x,e.current,n.current):void 0;return[C,x]},de=n.css(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),ue=n.div.withConfig({displayName:"SingleValue",componentId:"sc-us7kwl-0"})([""," max-width:calc(100% - 0.5rem);"],de),ce=n.div.withConfig({displayName:"Placeholder",componentId:"sc-us7kwl-1"})([""," color:",";",""],de,(e=>{var{theme:t}=e;return t.color.placeholder}),(e=>{var{theme:t,initRender:r}=e;return!r&&n.css(["animation:",";"],t.placeholder.animation)})),pe=e=>{var{isMulti:n,inputValue:r,placeholder:o,selectedOption:a,focusedMultiValue:i,renderOptionLabel:l,renderMultiOptions:s,removeSelectedOption:d}=e,u=oe(),c=!F(a);return r&&(!n||n&&(c||s))?null:c?t.createElement(ce,{initRender:u},o):n?t.createElement(t.Fragment,null,s?s({renderOptionLabel:l,selected:a}):a.map((e=>{var{data:n,value:r}=e;return t.createElement(re,{key:r,data:n,value:r,renderOptionLabel:l,isFocused:r===i,removeSelectedOption:d})}))):t.createElement(ue,null,l(a[0].data))},me=n.css(["font-size:inherit;font-weight:inherit;font-family:inherit;"]),fe=n.div.withConfig({displayName:"SizerDiv",componentId:"sc-4er7q8-0"})(["top:0;left:0;height:0;overflow:scroll;white-space:pre;position:absolute;visibility:hidden;"," ",""],me,(e=>{var{theme:t}=e;return t.input.css})),ve=n.input.attrs(c).withConfig({displayName:"Input",componentId:"sc-4er7q8-1"})(["border:0;outline:0;padding:0;cursor:text;background:0;color:inherit;box-sizing:content-box;"," :read-only{opacity:0;cursor:default;}:required{","}",""],me,(e=>{var{theme:t,isInvalid:n}=e;return n&&t.input.cssRequired}),(e=>{var{theme:t}=e;return t.input.css})),he=t.memo(t.forwardRef(((e,n)=>{var{id:r,onBlur:o,onFocus:a,readOnly:i,required:l,onChange:s,ariaLabel:d,inputValue:u,ariaLabelledBy:c,hasSelectedOptions:p}=e,m=!!l&&!p,f=t.useRef(null),[v,h]=t.useState(15);return ae((()=>{var{current:e}=f;e&&h(e.scrollWidth+15)}),[u]),t.createElement(t.Fragment,null,t.createElement(ve,{id:r,ref:n,isInvalid:!0,onBlur:o,onFocus:a,value:u,readOnly:i,required:m,"aria-label":d,style:{width:v},"aria-labelledby":c,onChange:i?void 0:s}),t.createElement(fe,{ref:f},u))})));he.displayName="AutosizeInput";var ge=n.span.withConfig({displayName:"A11yText",componentId:"sc-1yv4bud-0"})(["border:0;padding:0;width:1px;height:1px;margin:-1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(0,0,0,0);"]),be=e=>{var{menuOpen:n,isFocused:r,inputValue:o,optionCount:a,isSearchable:i,focusedOption:l,selectedOption:s,ariaLive:d="polite",ariaLabel:u="Select"}=e;if(!r)return null;var c=n?"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.":u+" is focused"+(i?", type to filter options":"")+", press Down arrow key to open the menu.",{index:p,value:m,label:f,isDisabled:v}=l,h=((m&&!v?"Option "+f+" is focused, "+(p+1)+" of "+a+".":"")+" "+(a+" option(s) available"+(o?" for search "+o:"")+".")+" "+c).trimStart(),g="Selected option: "+(s.length?s.map((e=>e.label)).join(" "):"N/A");return t.createElement(ge,{"aria-atomic":"false","aria-live":d,"aria-relevant":"additions text"},t.createElement("span",{id:"aria-selection"},g),t.createElement("span",{id:"aria-context"},h))},we=n.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1tlaoz1-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;}}"],(e=>{var{theme:t}=e;return t.loader.padding}),(e=>{var{theme:t}=e;return n.css(["width:",";height:",";animation:",";background-color:",";"],t.loader.size,t.loader.size,t.loader.animation,t.loader.color)})),Oe=()=>t.createElement(we,{"aria-hidden":!0,className:"rfs-loading-dots"},t.createElement("div",null),t.createElement("div",null),t.createElement("div",null)),ye=n.svg.withConfig({displayName:"ClearSvg",componentId:"sc-kkzaaw-0"})(["fill:currentColor;",""],(e=>{var{theme:t}=e;return n.css(["width:",";height:",";animation:",";transition:",";"],t.icon.clear.width,t.icon.clear.height,t.icon.clear.animation,t.icon.clear.transition)})),xe=()=>t.createElement(ye,{"aria-hidden":!0,focusable:"false",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"})),Ce=n.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1jozl2i-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),Ie=n.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1jozl2i-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(e=>{var{theme:t}=e;return t.icon.color}),(e=>{var{theme:t}=e;return t.icon.padding}),(e=>{var{theme:t}=e;return t.icon.hoverColor}),(e=>{var{theme:t}=e;return t.icon.css})),Se=n.div.withConfig({displayName:"Separator",componentId:"sc-1jozl2i-2"})(["width:1px;margin:0.5rem 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(e=>{var{theme:t}=e;return t.color.iconSeparator||t.color.border})),Ee=n.div.withConfig({displayName:"Caret",componentId:"sc-1jozl2i-3"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(e=>{var{theme:t}=e;return t.icon.caret.transition}),(e=>{var{theme:t}=e;return t.icon.caret.size}),(e=>{var{theme:t}=e;return t.icon.caret.size}),(e=>{var{theme:t}=e;return t.icon.caret.size}),(e=>{var{theme:t,menuOpen:r,isInvalid:o}=e;return r&&n.css(["transform:rotate(180deg);color:",";"],o?t.color.danger:t.color.caretActive||t.color.primary)})),ke=t.memo((e=>{var{menuOpen:n,clearIcon:r,caretIcon:o,isInvalid:a,showClear:i,isLoading:l,isDisabled:s,loadingNode:d,onCaretMouseDown:u,onClearMouseDown:c}=e,p=e=>V(e)?e({menuOpen:n,isLoading:l,isInvalid:a,isDisabled:s}):e;return t.createElement(Ce,null,i&&!l&&t.createElement(Ie,{onTouchEnd:c,onMouseDown:c},p(r)||t.createElement(xe,null)),l&&(d||t.createElement(Oe,null)),t.createElement(Se,{role:"none"}),t.createElement(Ie,{onTouchEnd:u,onMouseDown:u},p(o)||t.createElement(Ee,{"aria-hidden":!0,menuOpen:n,isInvalid:a,className:"rfs-caret-icon"})))}));ke.displayName="IndicatorIcons";var Me=n.div.attrs(u).withConfig({displayName:"SelectWrapper",componentId:"sc-kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(e=>{var{theme:t}=e;return t.select.css})),Ne=n.div.withConfig({displayName:"ValueWrapper",componentId:"sc-kcrmu9-1"})(["flex:1 1 0%;display:flex;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;padding:",";"],(e=>{var{theme:t}=e;return t.control.padding})),Le=n.div.withConfig({displayName:"ControlWrapper",componentId:"sc-kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(e=>{var{isDisabled:t,isFocused:r,isInvalid:o,theme:{control:a,color:i}}=e;return n.css(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],a.transition,a.borderStyle,a.borderWidth,a.borderRadius,a.height||a.minHeight,o?i.danger:r?a.focusedBorderColor:i.border,a.height&&"height: "+a.height+";",t&&"pointer-events:none;user-select:none;",(a.backgroundColor||t)&&"background-color: "+(t?i.disabled:a.backgroundColor)+";",r&&"box-shadow: "+a.boxShadow+" "+(o?i.dangerLight:a.boxShadowColor)+";")}),(e=>{var{theme:t}=e;return t.control.css}),(e=>{var{isFocused:t,theme:n}=e;return t&&n.control.focusedCss})),ze=t.forwardRef(((e,r)=>{var o,{async:i,isMulti:l,inputId:s,selectId:d,required:u,ariaLive:c,autoFocus:b,isLoading:w,onKeyDown:O,clearIcon:N,caretIcon:L,isInvalid:z,ariaLabel:T,menuWidth:R,isDisabled:D,inputDelay:A,onMenuOpen:j,onMenuClose:Y,onInputBlur:H,isClearable:X,themeConfig:G,loadingNode:J,initialValue:Q,onInputFocus:$,onInputChange:ee,ariaLabelledBy:te,onOptionChange:ne,onSearchChange:re,getOptionLabel:oe,getOptionValue:de,itemKeySelector:ue,openMenuOnFocus:ce,menuPortalTarget:me,isAriaLiveEnabled:fe,menuOverscanCount:ve,blurInputOnSelect:ge,menuItemDirection:we,renderOptionLabel:Oe,renderMultiOptions:ye,menuScrollDuration:xe,filterIgnoreAccents:Ce,hideSelectedOptions:Ie,getIsOptionDisabled:Se,getFilterOptionString:Ee,isSearchable:ze=!0,memoOptions:Te=!1,lazyLoadMenu:Re=!1,openMenuOnClick:De=!0,filterIgnoreCase:Ae=!0,tabSelectsOption:Be=!0,closeMenuOnSelect:Ve=!0,scrollMenuIntoView:Fe=!0,backspaceClearsValue:Pe=!0,filterMatchFrom:qe=m.ANY,menuPosition:je=p.BOTTOM,options:We=k,loadingMsg:_e=C,placeholder:Ue=S,noOptionsMsg:Ke=I,menuItemSize:Ye=y,menuMaxHeight:He=x}=e,Xe=t.useRef(!1),Ge=t.useRef(),Je=t.useRef(!1),Qe=t.useRef(V(re)),Ze=t.useRef(V(ne)),$e=t.useRef(null),et=t.useRef(null),tt=t.useRef(null),nt=t.useRef(null),[rt,ot]=t.useState(""),[at,it]=t.useState(!1),[lt,st]=t.useState(!1),[dt,ut]=t.useState(null),[ct,pt]=t.useState(E),mt=t.useMemo((()=>(e=>P(e)?_(U,e):U)(G)),[G]),ft=t.useMemo((()=>oe||M.OPTION_LABEL),[oe]),vt=t.useMemo((()=>de||M.OPTION_VALUE),[de]),ht=t.useMemo((()=>Oe||ft),[Oe,ft]),gt=function(e,n){void 0===n&&(n=0);var[r,o]=t.useState(e);return ae((()=>{if(!(n<=0)){var t=setTimeout((()=>{o(e)}),n);return()=>{clearTimeout(t)}}}),[e,n]),n<=0?e:r}(rt,A),[bt,wt]=t.useState((()=>W(Q,vt,ft))),Ot=le(We,gt,qe,bt,vt,ft,Se,Ee,Ae,Ce,l,i,Ie),[yt,xt]=se(et,nt,at,je,Ye,He,Ot.length,!!me,j,Y,xe,Fe),Ct=ie(re),It=ie(ne),St=()=>{var e;return null===(e=tt.current)||void 0===e?void 0:e.blur()},Et=()=>{var e;return null===(e=tt.current)||void 0===e?void 0:e.focus()},kt=e=>{var t;return null===(t=$e.current)||void 0===t?void 0:t.scrollToItem(e)},Mt=F(bt),Nt=B(ge)?ge:K,Lt=t.useCallback((e=>{if(F(Ot)){var t=l?-1:Ot.findIndex((e=>e.isSelected)),n=t>-1?t:e===g?0:Ot.length-1;kt(n),it(!0),ut(null),pt(a({index:n},Ot[n]))}else it(!0)}),[l,Ot]),zt=t.useCallback((e=>{wt((t=>t.filter((t=>t.value!==e))))}),[]),Tt=t.useCallback(((e,t)=>{t?l&&zt(e.value):wt((t=>l?[...t,e]:[e])),Nt?St():Ve&&(ot(""),it(!1))}),[l,Ve,zt,Nt]);t.useImperativeHandle(r,(()=>({empty:!Mt,menuOpen:Xe.current,blur:St,focus:Et,clearValue:()=>{wt(k),pt(E)},setValue:e=>{var t=W(e,vt,ft);wt(t)},toggleMenu:e=>{!0===e||void 0===e&&!Xe.current?(Et(),Lt(g)):St()}})),[Mt,vt,ft,Lt]),o=()=>{b&&Et()},t.useEffect(o,[]),t.useEffect((()=>{Xe.current=at}),[at]),t.useEffect((()=>{Qe.current=V(re),Ze.current=V(ne)})),t.useEffect((()=>{lt&&ce&&Lt(g)}),[lt,ce,Lt]),t.useEffect((()=>{var{current:e}=Qe;e&&Je.current&&(Je.current=!1,Ct(gt))}),[Ct,gt]),ae((()=>{var{current:e}=Ze;if(e){var t=l?bt.map((e=>e.data)):F(bt)?bt[0].data:null;It(t)}}),[It,l,bt]),ae((()=>{var{length:e}=Ot,t=e>0&&(i||e!==We.length||0===Ge.current);0===e?pt(E):(1===e||t)&&(kt(0),pt(a({index:0},Ot[0]))),Ge.current=e}),[i,We,Ot]);var Rt=()=>{var{data:e,value:t,label:n,isSelected:r,isDisabled:o}=ct;e&&!o&&Tt({data:e,value:t,label:n},r)},Dt=e=>{if(F(Ot)){var t=e===v?(ct.index+1)%Ot.length:ct.index>0?ct.index-1:Ot.length-1;kt(t),ut(null),pt(a({index:t},Ot[t]))}},At=e=>{q(e),Et()},Bt=e=>{if(!D){lt||Et();var t="INPUT"!==e.target.nodeName;at?t&&(it(!1),ot("")):De&&Lt(g),t&&e.preventDefault()}},Vt=t.useCallback((e=>{null==H||H(e),st(!1),it(!1),ot("")}),[H]),Ft=t.useCallback((e=>{null==$||$(e),st(!0)}),[$]),Pt=t.useCallback((e=>{Je.current=!0,null==ee||ee(e.currentTarget.value),ot(e.currentTarget.value),it(!0)}),[ee]),qt=t.useCallback((e=>{At(e),Xe.current?it(!1):Lt(g)}),[Lt]),jt=t.useCallback((e=>{At(e),wt(k)}),[]),Wt=!Re||Re&&at,_t=!(!X||D||!Mt),Ut=D||!ze||!!dt,Kt=D||De?void 0:qt;return t.createElement(n.ThemeProvider,{theme:mt},t.createElement(Me,{id:d,"aria-controls":s,"aria-expanded":at,onKeyDown:e=>{if(!D){var{key:t,shiftKey:n,defaultPrevented:r}=e;if(!O||(O(e,rt,ct),!r)){switch(t){case"ArrowDown":at?Dt(v):Lt(g);break;case"ArrowUp":at?Dt(f):Lt(h);break;case"ArrowLeft":case"ArrowRight":if(!l||rt||ye)return;(e=>{if(Mt){var t=-1,n=bt.length-1,r=dt?bt.findIndex((e=>e.value===dt)):-1,o=(t="ArrowRight"===e?r>-1&&r<n?r+1:-1:0!==r?-1===r?n:r-1:0)>=0?bt[t].value:null;ct.data&&pt(E),o!==dt&&ut(o)}})(t);break;case" ":if(rt)return;if(at){if(!ct.data)return;Rt()}else Lt(g);break;case"Enter":at&&Rt();break;case"Escape":at&&(it(!1),ot(""));break;case"Tab":if(!at||!Be||!ct.data||n)return;Rt();break;case"Delete":case"Backspace":if(rt)return;if(dt){var o=bt.findIndex((e=>e.value===dt)),a=o>-1&&o<bt.length-1?bt[o+1].value:null;zt(dt),ut(a)}else{if(!Pe)return;if(!Mt)break;if(l&&!ye){var{value:i}=bt[bt.length-1];zt(i)}else X&&wt(k)}break;default:return}e.preventDefault()}}}},t.createElement(Le,{ref:nt,isInvalid:z,isFocused:lt,isDisabled:D,className:"rfs-control-container",onTouchEnd:Bt,onMouseDown:Bt},t.createElement(Ne,null,t.createElement(pe,{isMulti:l,inputValue:rt,placeholder:Ue,selectedOption:bt,focusedMultiValue:dt,renderMultiOptions:ye,renderOptionLabel:ht,removeSelectedOption:zt}),t.createElement(he,{id:s,ref:tt,required:u,ariaLabel:T,inputValue:rt,readOnly:Ut,onBlur:Vt,onFocus:Ft,onChange:Pt,ariaLabelledBy:te,hasSelectedOptions:Mt})),t.createElement(ke,{menuOpen:at,clearIcon:N,caretIcon:L,isInvalid:z,isLoading:w,showClear:_t,isDisabled:D,loadingNode:J,onClearMouseDown:jt,onCaretMouseDown:Kt})),Wt&&t.createElement(Z,{menuRef:et,menuOpen:at,isLoading:w,menuTop:yt,height:xt,itemSize:Ye,loadingMsg:_e,menuOptions:Ot,memoOptions:Te,fixedSizeListRef:$e,noOptionsMsg:Ke,selectOption:Tt,direction:we,itemKeySelector:ue,overscanCount:ve,menuPortalTarget:me,width:R||mt.menu.width,renderOptionLabel:ht,focusedOptionIndex:ct.index,onMenuMouseDown:At}),fe&&t.createElement(be,{ariaLive:c,menuOpen:at,isFocused:lt,ariaLabel:T,inputValue:rt,isSearchable:ze,focusedOption:ct,selectedOption:bt,optionCount:Ot.length})))}));ze.displayName="Select",e.Select=ze})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("styled-components"),require("react-dom"),require("react-window")):"function"==typeof define&&define.amd?define(["exports","react","styled-components","react-dom","react-window"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactFunctionalSelect={},e.React,e.styled,e.ReactDOM,e.ReactWindow)}(this,(function(e,t,n,r,o){"use strict";function a(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}var l,s="rfs-option",d="rfs-option-focused",u="rfs-option-selected",c="rfs-option-disabled",p={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container"},m={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input"},f={TOP:"top",AUTO:"auto",BOTTOM:"bottom"},g={ANY:"any",START:"start"},h=0,v=1,b=2,w=3,x=4,y=5,O=n.keyframes(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),C=n.keyframes(["from{opacity:0;}to{opacity:1;}"]),S=n.css([""," 0.2s ease-in"],C),I={border:"#ced4da",danger:"#dc3545",primary:"#007bff",disabled:"#e9ecef",placeholder:"#6E7276",dangerLight:"rgba(220, 53, 69, 0.25)"},E={color:I,input:{},select:{},loader:{size:"0.625rem",padding:"0.375rem 0.75rem",animation:n.css([""," 1.19s ease-in-out infinite"],O),color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 14px",clear:{width:"14px",height:"16px",animation:S,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",padding:"2px 8px",boxShadow:"0 0 0 0.2rem",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.35rem 0",borderRadius:"3px",backgroundColor:"#fff",animation:S,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",padding:"0.375rem 0.75rem",selectedBgColor:I.primary,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:S,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:I.danger,transition:"color 0.2s ease-out"}}},M=5,k=35,z=300,L="Loading..",N="No options",D="Select option..",R=[],T={index:-1},A={optionLabel:e=>e.label,optionValue:e=>e.value,isOptionDisabled:e=>!!e.isDisabled,optionFilter:e=>"string"==typeof e.label?e.label:""+e.label},V=e=>F(e)?window.pageYOffset:e.scrollTop,F=e=>e===document.body||e===document.documentElement||e===window,B=e=>{var t=getComputedStyle(e);if("fixed"===t.position)return document.documentElement;for(var n=/(auto|scroll)/,r="absolute"===t.position,o=e;o=null==(a=o)?void 0:a.parentElement;){var a;if(t=getComputedStyle(o),(!r||"static"!==t.position)&&n.test(""+t.overflow+t.overflowX+t.overflowY))return o}return document.documentElement},q=function(e,t,n,r){void 0===n&&(n=300);var o=0,a=V(e),i=t-a,l=()=>{var t,s=i*((t=(t=o+=5)/n-1)*t*t+1)+a;((e,t)=>{F(e)?window.scrollTo(0,t):e.scrollTop=t})(e,s),o<n?requestAnimationFrame(l):null==r||r()};requestAnimationFrame(l)},P=/[\u0300-\u036f]/g,W=e=>"boolean"==typeof e,j=e=>"function"==typeof e,K=e=>Array.isArray(e)&&!!e.length,U=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),H=e=>{e.preventDefault(),e.stopPropagation()},Y=(e,t,n)=>{var r=e.trim();return t&&(r=r.toLowerCase()),n?r.normalize("NFD").replace(P,""):r},X=(e,t,n)=>{var r=Array.isArray(e)?e:U(e)?[e]:R;return K(r)?r.map((e=>({data:e,value:t(e),label:n(e)}))):r},G=(e,t)=>{var n=i({},e);return Object.keys(t).forEach((r=>{var o=t[r];n[r]="animation"!==r&&U(o)?e[r]?G(e[r],o):o:null!=o?o:""})),n},J=(e,t)=>{var{memoOptions:n}=t.data;return n&&o.areEqual(e,t)},Q=t.memo((e=>{var n,r,o,{index:a,style:i,data:{menuOptions:l,selectOption:d,renderOptionLabel:u,focusedOptionIndex:c}}=e,p=l[a],m=(n=p.isDisabled,r=p.isSelected,o=s,n&&(o+=" rfs-option-disabled"),r&&(o+=" rfs-option-selected"),a===c&&(o+=" rfs-option-focused"),o);return t.createElement("div",{style:i,className:m,onClick:()=>d(p)},u(p.data))}),J);Q.displayName="Option";var Z=n.div.withConfig({displayName:"NoOptionsMsg",componentId:"sc-1on2920-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(e=>{var{theme:t}=e;return t.noOptions.color}),(e=>{var{theme:t}=e;return t.noOptions.margin}),(e=>{var{theme:t}=e;return t.noOptions.padding}),(e=>{var{theme:t}=e;return t.noOptions.fontSize}),(e=>{var{theme:t}=e;return t.noOptions.css})),$=e=>{var{width:n,height:r,itemSize:a,direction:i,isLoading:l,loadingMsg:s,menuOptions:d,memoOptions:u,selectOption:c,noOptionsMsg:p,overscanCount:m,itemKeySelector:f,fixedSizeListRef:g,renderOptionLabel:h,focusedOptionIndex:v}=e,b=t.useMemo((()=>({menuOptions:d,memoOptions:u,selectOption:c,renderOptionLabel:h,focusedOptionIndex:v})),[d,u,v,c,h]);if(l)return t.createElement(Z,null,s);var w=f?(e,t)=>t.menuOptions[e][f]:void 0;return t.createElement(t.Fragment,null,t.createElement(o.FixedSizeList,{width:n,height:r,itemKey:w,itemSize:a,itemData:b,direction:i,ref:g,overscanCount:m,itemCount:d.length},Q),!K(d)&&p&&t.createElement(Z,null,p))},_=["menuRef","menuTop","menuOpen","lazyLoadMenu","onMenuMouseDown","menuPortalTarget"],ee=n.div.withConfig({displayName:"MenuWrapper",componentId:"sc-105ivps-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;will-change:top;padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}}"],(e=>{var{menuTop:t,menuOpen:r,hideNoOptionsMsg:o,theme:{menu:a}}=e;return n.css(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],a.width,a.margin,a.padding,a.animation,a.borderRadius,a.backgroundColor,o?"none":a.boxShadow,!r&&"display: none;",t&&"top: "+t+";")}),(e=>{var{theme:t}=e;return t.menu.css}),s,(e=>{var{theme:t}=e;return t.menu.option.padding}),(e=>{var{theme:t}=e;return t.menu.option.textAlign}),d,c,u,(e=>{var{theme:t}=e;return t.menu.option.focusedBgColor}),u,(e=>{var{theme:t}=e;return t.menu.option.selectedColor}),(e=>{var{theme:t}=e;return t.menu.option.selectedBgColor}),c),te=e=>{var{menuRef:n,menuTop:o,menuOpen:l,lazyLoadMenu:s,onMenuMouseDown:d,menuPortalTarget:u}=e,c=a(e,_);if(s&&!l)return null;var{menuOptions:p,noOptionsMsg:m}=c,f=l&&!m&&!K(p),g=t.createElement(ee,{ref:n,menuTop:o,menuOpen:l,onMouseDown:d,className:"rfs-menu-container",hideNoOptionsMsg:f},t.createElement($,i({},c)));return u?r.createPortal(g,u):g},ne=n.css(["color:",";"],(e=>{var{theme:t}=e;return t.multiValue.clear.focusColor})),re=n.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-1vzivtq-0"})(["min-width:0;display:flex;"," ",""],(e=>{var{theme:{multiValue:t}}=e;return n.css(["margin:",";animation:",";border-radius:",";background-color:",";"],t.margin,t.animation,t.borderRadius,t.backgroundColor)}),(e=>{var{theme:t}=e;return t.multiValue.css})),oe=n.div.withConfig({displayName:"Label",componentId:"sc-1vzivtq-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(e=>{var{theme:t}=e;return t.multiValue.label.padding}),(e=>{var{theme:t}=e;return t.multiValue.label.fontSize}),(e=>{var{theme:t}=e;return t.multiValue.label.borderRadius})),ae=n.i.withConfig({displayName:"Clear",componentId:"sc-1vzivtq-2"})(["display:flex;font-style:inherit;"," ",""],(e=>{var{theme:{multiValue:{clear:t}}}=e;return n.css(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";&:hover{","}"],t.color,t.padding,t.fontSize,t.alignSelf,t.transition,t.fontWeight,ne)}),(e=>{var{isFocused:t}=e;return t&&ne})),ie=t.memo((e=>{var{data:n,value:r,isFocused:o,renderOptionLabel:a,removeSelectedOption:i}=e,l=a(n),s=()=>i(r);return t.createElement(re,null,t.createElement(oe,null,l),t.createElement(ae,{onClick:s,onTouchEnd:s,isFocused:o,onMouseDown:H},"✖"))}));ie.displayName="MultiValue";var le=n.div.withConfig({displayName:"SingleValue",componentId:"sc-us7kwl-0"})(["margin:0 2px;max-width:100%;overflow:hidden;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;grid-area:1 / 1 / 2 / 3;"]),se=n(le).withConfig({displayName:"Placeholder",componentId:"sc-us7kwl-1"})(["color:",";"],(e=>{var{theme:t}=e;return t.color.placeholder})),de=e=>{var{isMulti:n,inputValue:r,placeholder:o,selectedOption:a,focusedMultiValue:i,renderOptionLabel:l,renderMultiOptions:s,removeSelectedOption:d}=e,u=!K(a);if(r&&(!n||n&&(u||s)))return null;if(u)return t.createElement(se,null,o);if(!n){var c=l(a[0].data);return t.createElement(le,null,c)}return t.createElement(t.Fragment,null,s?s({renderOptionLabel:l,selected:a}):a.map((e=>{var{data:n,value:r}=e;return t.createElement(ie,{key:r,data:n,value:r,renderOptionLabel:l,isFocused:r===i,removeSelectedOption:d})})))},ue=n.css(["border:0;margin:0;outline:0;padding:0;font:inherit;min-width:2px;grid-area:1 / 2 / auto / auto;"]),ce=n.div.withConfig({displayName:"InputWrapper",componentId:"sc-4er7q8-0"})(['margin:2px;flex:1 1 auto;display:inline-grid;box-sizing:border-box;grid-area:1 / 1 / 2 / 3;grid-template-columns:0px min-content;:after{white-space:pre;visibility:hidden;content:attr(data-value) " ";',"}"],ue),pe=n.input.attrs(m).withConfig({displayName:"Input",componentId:"sc-4er7q8-1"})(["width:100%;background:0;color:inherit;"," :read-only{opacity:0;cursor:default;}:required{","}",""],ue,(e=>{var{theme:t,isInvalid:n}=e;return n&&t.input.cssRequired}),(e=>{var{theme:t}=e;return t.input.css})),me=t.forwardRef(((e,n)=>{var{id:r,onBlur:o,onFocus:a,readOnly:i,required:l,onChange:s,ariaLabel:d,inputValue:u,ariaLabelledBy:c,hasSelectedOptions:p}=e,m=!!l&&!p;return t.createElement(ce,{"data-value":u},t.createElement(pe,{id:r,ref:n,isInvalid:!0,onBlur:o,onFocus:a,value:u,readOnly:i,required:m,"aria-label":d,"aria-labelledby":c,onChange:i?void 0:s}))}));me.displayName="AutosizeInput";var fe=n.span.withConfig({displayName:"A11yText",componentId:"sc-1yv4bud-0"})(["border:0;padding:0;width:1px;height:1px;margin:-1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(0,0,0,0);"]),ge=e=>{var{menuOpen:n,isFocused:r,inputValue:o,optionCount:a,isSearchable:i,focusedOption:l,selectedOption:s,ariaLive:d="polite",ariaLabel:u="Select"}=e;if(!r)return null;var c=n?"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.":u+" is focused"+(i?", type to filter options":"")+", press Down arrow key to open the menu.",{index:p,value:m,label:f,isDisabled:g}=l,h=((m&&!g?"Option "+f+" is focused, "+(p+1)+" of "+a+".":"")+" "+(a+" option(s) available"+(o?" for search "+o:"")+".")+" "+c).trimStart(),v="Selected option: "+(s.length?s.map((e=>e.label)).join(" "):"N/A");return t.createElement(fe,{"aria-atomic":"false","aria-live":d,"aria-relevant":"additions text"},t.createElement("span",{id:"aria-selection"},v),t.createElement("span",{id:"aria-context"},h))},he=n.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1tlaoz1-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;}}"],(e=>{var{theme:t}=e;return t.loader.padding}),(e=>{var{theme:t}=e;return n.css(["width:",";height:",";animation:",";background-color:",";"],t.loader.size,t.loader.size,t.loader.animation,t.loader.color)})),ve=()=>t.createElement(he,{"aria-hidden":!0,className:"rfs-loading-dots"},t.createElement("div",null),t.createElement("div",null),t.createElement("div",null)),be=n.svg.withConfig({displayName:"ClearSvg",componentId:"sc-kkzaaw-0"})(["fill:currentColor;",""],(e=>{var{theme:t}=e;return n.css(["width:",";height:",";animation:",";transition:",";"],t.icon.clear.width,t.icon.clear.height,t.icon.clear.animation,t.icon.clear.transition)})),we=()=>t.createElement(be,{"aria-hidden":!0,focusable:"false",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"})),xe=n.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1jozl2i-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),ye=n.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1jozl2i-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(e=>{var{theme:t}=e;return t.icon.color}),(e=>{var{theme:t}=e;return t.icon.padding}),(e=>{var{theme:t}=e;return t.icon.hoverColor}),(e=>{var{theme:t}=e;return t.icon.css})),Oe=n.div.withConfig({displayName:"Separator",componentId:"sc-1jozl2i-2"})(["width:1px;margin:8px 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(e=>{var{theme:t}=e;return t.color.iconSeparator||t.color.border})),Ce=n.div.withConfig({displayName:"Caret",componentId:"sc-1jozl2i-3"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(e=>{var{theme:t}=e;return t.icon.caret.transition}),(e=>{var{theme:t}=e;return t.icon.caret.size}),(e=>{var{theme:t}=e;return t.icon.caret.size}),(e=>{var{theme:t}=e;return t.icon.caret.size}),(e=>{var{theme:t,menuOpen:r,isInvalid:o}=e;return r&&n.css(["transform:rotate(180deg);color:",";"],o?t.color.danger:t.color.caretActive||t.color.primary)})),Se=t.memo((e=>{var{menuOpen:n,clearIcon:r,caretIcon:o,isInvalid:a,showClear:i,isLoading:l,isDisabled:s,loadingNode:d,onCaretMouseDown:u,onClearMouseDown:c}=e,p=e=>j(e)?e({menuOpen:n,isLoading:l,isInvalid:a,isDisabled:s}):e;return t.createElement(xe,null,i&&!l&&t.createElement(ye,{onTouchEnd:c,onMouseDown:c},p(r)||t.createElement(we,null)),l&&(d||t.createElement(ve,null)),t.createElement(Oe,{role:"none"}),t.createElement(ye,{onTouchEnd:u,onMouseDown:u},p(o)||t.createElement(Ce,{"aria-hidden":!0,menuOpen:n,isInvalid:a,className:"rfs-caret-icon"})))}));Se.displayName="IndicatorIcons";var Ie=(e,n)=>{var r=t.useRef(!0);t.useEffect((()=>{if(!r.current)return e();r.current=!1}),n)},Ee=e=>{var n=t.useRef(e);return n.current=e,n},Me=e=>{var n=t.useRef(e);return t.useEffect((()=>{n.current=e}),[e]),t.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)}),[])},ke=function(e,n,r,o,a,i,l,s,d,u,c,p,m){void 0===d&&(d=!1),void 0===u&&(u=!1),void 0===c&&(c=!1),void 0===p&&(p=!1);var f=Me(s||A.optionFilter),h=Me(l||A.isOptionDisabled),v=W(m)?m:c,b=p?"":n;return t.useMemo((()=>{var t=o.map((e=>e.value)),n=r===g.ANY,l=Y(b,d,u),s=e=>{var r=a(e),o=i(e),s=h(e),c=t.includes(r),p={data:e,value:r,label:o,isDisabled:s,isSelected:c};return!(e=>{if(!l)return!0;var t=f(e),r=Y(t,d,u);return n?r.includes(l):r.startsWith(l)})(p)||v&&c?void 0:p};return e.reduce(((e,t)=>{var n=s(t);return n&&e.push(n),e}),[])}),[e,b,a,i,o,r,d,u,h,f,v])},ze=(e,n,r,o,a,i,l,s,d,u,c,p)=>{var m=t.useMemo((()=>o===f.TOP||o===f.AUTO&&!(e=>{if(!e)return!0;var t=B(e),{top:n,height:r}=e.getBoundingClientRect();return t.getBoundingClientRect().height-V(t)-n>=r})(e.current)),[e,o]),g=Me(d),h=Me(u),v=t.useRef(!1),[b,w]=t.useState(i),x=Ee(!m&&!s);Ie((()=>{if(r){var t=e=>{g(),e&&(v.current=!0,w(e))};x.current?((e,t,n,r)=>{if(e){var{top:o,height:a,bottom:i}=e.getBoundingClientRect(),l=window.innerHeight;if(l-o>=a)r();else{var s=B(e),d=V(s),u=s.getBoundingClientRect().height-d-o,c=u<a;if(!c&&n){var p=parseInt(getComputedStyle(e).marginBottom,10);q(s,i-l+d+p,t,r)}else r(c?u:void 0)}}else r()})(e.current,c,p,t):t()}else h(),v.current&&(v.current=!1,w(i))}),[e,r,i,p,c,h,g]);var y=Math.min(b,l*a),O=m?((e,t,n)=>{var r,o,a=t&&getComputedStyle(t),i=a?parseInt(a.marginBottom,10):0,l=a?parseInt(a.marginTop,10):0,s=null!=(r=null==n?void 0:n.getBoundingClientRect().height)?r:0,d=e>0?e:null!=(o=null==t?void 0:t.getBoundingClientRect().height)?o:0;return"calc("+-Math.abs(d+s)+"px + "+(i+l)+"px)"})(y,e.current,n.current):void 0;return[O,y]},Le=["isSelected","isDisabled"],Ne=["index"],De=n.div.attrs(p).withConfig({displayName:"SelectWrapper",componentId:"sc-kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(e=>{var{theme:t}=e;return t.select.css})),Re=n.div.withConfig({displayName:"ValueWrapper",componentId:"sc-kcrmu9-1"})(["flex:1 1 0%;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;display:",";padding:",";"],(e=>{var{flex:t}=e;return t?"flex":"grid"}),(e=>{var{theme:t}=e;return t.control.padding})),Te=n.div.withConfig({displayName:"ControlWrapper",componentId:"sc-kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(e=>{var{isDisabled:t,isFocused:r,isInvalid:o,theme:{control:a,color:i}}=e;return n.css(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],a.transition,a.borderStyle,a.borderWidth,a.borderRadius,a.height||a.minHeight,o?i.danger:r?a.focusedBorderColor:i.border,a.height&&"height: "+a.height+";",t&&"pointer-events:none;user-select:none;",(a.backgroundColor||t)&&"background-color: "+(t?i.disabled:a.backgroundColor)+";",r&&"box-shadow: "+a.boxShadow+" "+(o?i.dangerLight:a.boxShadowColor)+";")}),(e=>{var{theme:t}=e;return t.control.css}),(e=>{var{isFocused:t,theme:n}=e;return t&&n.control.focusedCss})),Ae=t.forwardRef(((e,r)=>{var o,{async:s,isMulti:d,inputId:u,selectId:c,required:p,ariaLive:m,autoFocus:O,isLoading:C,onKeyDown:S,clearIcon:I,caretIcon:V,isInvalid:F,ariaLabel:B,menuWidth:q,isDisabled:P,inputDelay:Y,onMenuOpen:J,onMenuClose:Q,onInputBlur:Z,isClearable:$,themeConfig:_,loadingNode:ee,initialValue:ne,onInputFocus:re,onInputChange:oe,ariaLabelledBy:ae,onOptionChange:ie,onSearchChange:le,getOptionLabel:se,getOptionValue:ue,itemKeySelector:ce,openMenuOnFocus:pe,menuPortalTarget:fe,isAriaLiveEnabled:he,menuOverscanCount:ve,blurInputOnSelect:be,menuItemDirection:we,renderOptionLabel:xe,renderMultiOptions:ye,menuScrollDuration:Oe,filterIgnoreAccents:Ce,hideSelectedOptions:Ae,getIsOptionDisabled:Ve,getFilterOptionString:Fe,isSearchable:Be=!0,memoOptions:qe=!1,lazyLoadMenu:Pe=!1,openMenuOnClick:We=!0,filterIgnoreCase:je=!0,tabSelectsOption:Ke=!0,closeMenuOnSelect:Ue=!0,scrollMenuIntoView:He=!0,backspaceClearsValue:Ye=!0,filterMatchFrom:Xe=g.ANY,menuPosition:Ge=f.BOTTOM,options:Je=R,pageSize:Qe=M,loadingMsg:Ze=L,placeholder:$e=D,noOptionsMsg:_e=N,menuItemSize:et=k,menuMaxHeight:tt=z}=e,nt=t.useRef(null),rt=t.useRef(null),ot=t.useRef(null),at=t.useRef(null),[it,lt]=t.useState(""),[st,dt]=t.useState(!1),[ut,ct]=t.useState(!1),[pt,mt]=t.useState(null),[ft,gt]=t.useState(T),ht=t.useMemo((()=>U(_)?G(E,_):E),[_]),vt=t.useMemo((()=>se||A.optionLabel),[se]),bt=t.useMemo((()=>ue||A.optionValue),[ue]),wt=t.useMemo((()=>xe||vt),[xe,vt]),xt=function(e,n){void 0===n&&(n=0);var[r,o]=t.useState(e);return Ie((()=>{if(!(n<=0)){var t=setTimeout((()=>{o(e)}),n);return()=>{clearTimeout(t)}}}),[e,n]),n<=0?e:r}(it,Y),yt=Me(le),Ot=Me(ie),Ct=Ee(j(le)),St=Ee(j(ie)),It=Ee(st),Et=t.useRef(!1),Mt=t.useRef(),[kt,zt]=t.useState((()=>X(ne,bt,vt))),Lt=ke(Je,xt,Xe,kt,bt,vt,Ve,Fe,je,Ce,d,s,Ae),[Nt,Dt]=ze(rt,at,st,Ge,et,tt,Lt.length,!!fe,J,Q,Oe,He),Rt=()=>{var e;return null==(e=ot.current)?void 0:e.blur()},Tt=()=>{var e;return null==(e=ot.current)?void 0:e.focus()},At=e=>{var t;return null==(t=nt.current)?void 0:t.scrollToItem(e)},Vt=K(kt),Ft=t.useCallback((e=>{if(K(Lt)){var t=d?-1:Lt.findIndex((e=>e.isSelected)),n=t>-1?t:e===w?0:Lt.length-1;At(n),dt(!0),mt(null),gt(i({index:n},Lt[n]))}else dt(!0)}),[d,Lt]),Bt=t.useCallback((e=>{zt((t=>t.filter((t=>t.value!==e))))}),[]),qt=t.useCallback((e=>{if(!e.isDisabled){if(e.isSelected)d&&Bt(e.value);else{var t=a(e,Le);zt((e=>d?[...e,t]:[t]))}(W(be)?be:W(l)?l:l=(()=>{try{return document.createEvent("TouchEvent"),!0}catch(e){return!1}})())?Rt():Ue&&(lt(""),dt(!1))}}),[d,Ue,be,Bt]);t.useImperativeHandle(r,(()=>({menuOpen:It.current,blur:Rt,focus:Tt,clearValue:()=>{zt(R),gt(T)},setValue:e=>{zt(X(e,bt,vt))},toggleMenu:e=>{e||void 0===e&&!It.current?(Tt(),Ft(w)):Rt()}})),[bt,vt,Ft]),o=()=>{O&&Tt()},t.useEffect(o,[]),t.useEffect((()=>{Ct.current&&Et.current&&(Et.current=!1,yt(xt))}),[yt,xt]),Ie((()=>{if(St.current){var e=d?kt.map((e=>e.data)):K(kt)?kt[0].data:null;Ot(e)}}),[Ot,d,kt]),Ie((()=>{var e=Lt.length,{current:t}=Mt,n=e>0&&(s||e!==Je.length||0===t),r=It.current&&void 0!==t&&t<e;if(0===e)gt(T);else if(1===e||n||r){var o=Math.max(0,Lt.findIndex((e=>e.isSelected)));At(o),gt(i({index:o},Lt[o]))}Mt.current=e}),[s,Je,Lt]);var Pt=()=>{var e=a(ft,Ne);e.data&&qt(e)},Wt=e=>{if(K(Lt)){var t=ft.index;switch(e){case h:t=ft.index>0?ft.index-1:Lt.length-1;break;case v:t=(ft.index+1)%Lt.length;break;case x:var n=ft.index-Qe;t=n<0?0:n;break;case y:var r=ft.index+Qe;t=r>Lt.length-1?Lt.length-1:r}At(t),pt&&mt(null),gt(i({index:t},Lt[t]))}},jt=e=>{if(!P){ut||Tt();var t="INPUT"!==e.target.nodeName;st?t&&(dt(!1),lt("")):We&&Ft(w),t&&e.preventDefault()}},Kt=e=>{H(e),Tt()},Ut=t.useCallback((e=>{Kt(e),zt(R)}),[]),Ht=t.useCallback((e=>{P||We||(Kt(e),It.current?dt(!1):Ft(w))}),[P,We,Ft]),Yt=!!d&&Vt,Xt=!!$&&!P&&Vt,Gt=P||!Be||!!pt;return t.createElement(n.ThemeProvider,{theme:ht},t.createElement(De,{id:c,"aria-controls":u,"aria-expanded":st,onKeyDown:e=>{if(!(P||j(S)&&(S(e.key,it,ft),e.defaultPrevented))){switch(e.key){case"ArrowDown":st?Wt(v):Ft(w);break;case"ArrowUp":st?Wt(h):Ft(b);break;case"ArrowLeft":case"ArrowRight":if(!d||it||ye)return;(e=>{if(Vt){var t=-1,n=kt.length-1,r=pt?kt.findIndex((e=>e.value===pt)):-1,o=(t="ArrowRight"===e?r>-1&&r<n?r+1:-1:0!==r?-1===r?n:r-1:0)>=0?kt[t].value:null;ft.data&>(T),o!==pt&&mt(o)}})(e.key);break;case"PageUp":if(!st)return;Wt(x);break;case"PageDown":if(!st)return;Wt(y);break;case" ":if(it)return;if(st){if(!ft.data)return;Pt()}else Ft(w);break;case"Enter":if(!st)return;Pt();break;case"Escape":st&&(dt(!1),lt(""));break;case"Tab":if(e.shiftKey||!st||!Ke||!ft.data)return;Pt();break;case"Delete":case"Backspace":if(it)return;if(pt){var t=kt.findIndex((e=>e.value===pt)),n=t>-1&&t<kt.length-1?kt[t+1].value:null;Bt(pt),mt(n)}else{if(!Ye)return;if(!Vt)break;if(d&&!ye){var{value:r}=kt[kt.length-1];Bt(r)}else $&&zt(R)}break;default:return}e.preventDefault()}}},t.createElement(Te,{ref:at,isInvalid:F,isFocused:ut,isDisabled:P,className:"rfs-control-container",onTouchEnd:jt,onMouseDown:jt},t.createElement(Re,{flex:Yt},t.createElement(de,{isMulti:d,inputValue:it,placeholder:$e,selectedOption:kt,focusedMultiValue:pt,renderMultiOptions:ye,renderOptionLabel:wt,removeSelectedOption:Bt}),t.createElement(me,{id:u,ref:ot,required:p,ariaLabel:B,inputValue:it,readOnly:Gt,onBlur:e=>{null==Z||Z(e),ct(!1),dt(!1),lt("")},onFocus:e=>{null==re||re(e),ct(!0),pe&&Ft(w)},onChange:e=>{Et.current=!0,null==oe||oe(e.currentTarget.value),lt(e.currentTarget.value),dt(!0)},ariaLabelledBy:ae,hasSelectedOptions:Vt})),t.createElement(Se,{menuOpen:st,clearIcon:I,caretIcon:V,isInvalid:F,isLoading:C,showClear:Xt,isDisabled:P,loadingNode:ee,onClearMouseDown:Ut,onCaretMouseDown:Ht})),t.createElement(te,{menuRef:rt,menuOpen:st,isLoading:C,menuTop:Nt,height:Dt,itemSize:et,loadingMsg:Ze,menuOptions:Lt,memoOptions:qe,fixedSizeListRef:nt,lazyLoadMenu:Pe,noOptionsMsg:_e,selectOption:qt,direction:we,itemKeySelector:ce,overscanCount:ve,menuPortalTarget:fe,onMenuMouseDown:Kt,width:q||ht.menu.width,renderOptionLabel:wt,focusedOptionIndex:ft.index}),he&&t.createElement(ge,{ariaLive:m,menuOpen:st,isFocused:ut,ariaLabel:B,inputValue:it,isSearchable:Be,focusedOption:ft,selectedOption:kt,optionCount:Lt.length})))}));Ae.displayName="Select",e.Select=Ae})); |
@@ -1,92 +0,9 @@ | ||
import React, { type ReactNode, type KeyboardEvent, type FocusEventHandler } from 'react'; | ||
import React, { type ReactNode, type KeyboardEvent } from 'react'; | ||
import { FilterMatchEnum, MenuPositionEnum } from './constants'; | ||
import type { OptionData, MenuOption, MultiParams, IconRenderer, FocusedOption, CallbackFn, AriaLiveAttribute, OptionValueCallback } from './types'; | ||
import { type DefaultTheme } from 'styled-components'; | ||
import type { OptionData, PartialDeep, IconRenderer, FocusedOption, SelectedOption, CallbackFn, AriaLiveAttribute, OptionLabelCallback, OptionValueCallback } from './types'; | ||
export declare type Theme = PartialDeep<DefaultTheme>; | ||
export declare type MultiParams = Readonly<{ | ||
selected: SelectedOption[]; | ||
renderOptionLabel: (data: OptionData) => ReactNode; | ||
}>; | ||
export declare type MenuOption = Readonly<{ | ||
label: string | number; | ||
value: string | number; | ||
data: OptionData; | ||
isDisabled: boolean; | ||
isSelected: boolean; | ||
}>; | ||
export declare type SelectRef = Readonly<{ | ||
empty: boolean; | ||
menuOpen: boolean; | ||
blur: () => void; | ||
focus: () => void; | ||
clearValue: () => void; | ||
toggleMenu: (state?: boolean) => void; | ||
setValue: (option?: OptionData) => void; | ||
}>; | ||
export declare type SelectProps = Readonly<{ | ||
async?: boolean; | ||
inputId?: string; | ||
selectId?: string; | ||
isMulti?: boolean; | ||
ariaLabel?: string; | ||
required?: boolean; | ||
loadingMsg?: string; | ||
autoFocus?: boolean; | ||
isLoading?: boolean; | ||
isInvalid?: boolean; | ||
inputDelay?: number; | ||
themeConfig?: Theme; | ||
isDisabled?: boolean; | ||
placeholder?: string; | ||
menuItemSize?: number; | ||
isClearable?: boolean; | ||
memoOptions?: boolean; | ||
lazyLoadMenu?: boolean; | ||
options?: OptionData[]; | ||
isSearchable?: boolean; | ||
menuMaxHeight?: number; | ||
loadingNode?: ReactNode; | ||
ariaLabelledBy?: string; | ||
clearIcon?: IconRenderer; | ||
caretIcon?: IconRenderer; | ||
openMenuOnClick?: boolean; | ||
openMenuOnFocus?: boolean; | ||
menuPortalTarget?: Element; | ||
menuOverscanCount?: number; | ||
tabSelectsOption?: boolean; | ||
filterIgnoreCase?: boolean; | ||
menuScrollDuration?: number; | ||
blurInputOnSelect?: boolean; | ||
closeMenuOnSelect?: boolean; | ||
isAriaLiveEnabled?: boolean; | ||
menuWidth?: string | number; | ||
scrollMenuIntoView?: boolean; | ||
noOptionsMsg?: string | null; | ||
ariaLive?: AriaLiveAttribute; | ||
hideSelectedOptions?: boolean; | ||
filterIgnoreAccents?: boolean; | ||
onMenuOpen?: CallbackFn; | ||
onMenuClose?: CallbackFn; | ||
backspaceClearsValue?: boolean; | ||
menuPosition?: MenuPositionEnum; | ||
filterMatchFrom?: FilterMatchEnum; | ||
menuItemDirection?: 'ltr' | 'rtl'; | ||
itemKeySelector?: string | number; | ||
getOptionLabel?: OptionLabelCallback; | ||
getOptionValue?: OptionValueCallback; | ||
initialValue?: OptionData | OptionData[]; | ||
onInputChange?: (value?: string) => unknown; | ||
onSearchChange?: (value?: string) => unknown; | ||
onOptionChange?: (data: OptionData) => unknown; | ||
onInputBlur?: FocusEventHandler<HTMLInputElement>; | ||
onInputFocus?: FocusEventHandler<HTMLInputElement>; | ||
renderOptionLabel?: (data: OptionData) => ReactNode; | ||
getIsOptionDisabled?: (data: OptionData) => boolean; | ||
getFilterOptionString?: (option: MenuOption) => string; | ||
renderMultiOptions?: (params: MultiParams) => ReactNode; | ||
onKeyDown?: (e: KeyboardEvent<Element>, input?: string, focusedOption?: FocusedOption) => unknown; | ||
}>; | ||
declare const Select: React.ForwardRefExoticComponent<Readonly<{ | ||
async?: boolean | undefined; | ||
inputId?: string | undefined; | ||
pageSize?: number | undefined; | ||
selectId?: string | undefined; | ||
@@ -101,3 +18,3 @@ isMulti?: boolean | undefined; | ||
inputDelay?: number | undefined; | ||
themeConfig?: PartialDeep<DefaultTheme> | undefined; | ||
themeConfig?: import("./types").PartialDeep<DefaultTheme> | undefined; | ||
isDisabled?: boolean | undefined; | ||
@@ -153,3 +70,2 @@ placeholder?: string | undefined; | ||
}> & React.RefAttributes<Readonly<{ | ||
empty: boolean; | ||
menuOpen: boolean; | ||
@@ -159,5 +75,5 @@ blur: () => void; | ||
clearValue: () => void; | ||
toggleMenu: (state?: boolean) => void; | ||
setValue: (option?: OptionData) => void; | ||
toggleMenu: (state?: boolean | undefined) => void; | ||
setValue: (option?: any) => void; | ||
}>>>; | ||
export default Select; |
@@ -1,22 +0,22 @@ | ||
import type { MenuOption } from './Select'; | ||
import type { DefaultTheme } from 'styled-components'; | ||
import type { ReactNode, MouseEvent, TouchEvent, EventHandler } from 'react'; | ||
export declare type OptionData = any; | ||
export declare type CallbackFn = (...args: any[]) => any; | ||
export declare type AriaLiveAttribute = 'off' | 'polite' | 'assertive'; | ||
export declare type CustomRendererCallback = (...args: any[]) => ReactNode; | ||
export declare type IconRenderer = ReactNode | CustomRendererCallback; | ||
export declare type OptionValueCallback = (data: OptionData) => string | number; | ||
export declare type OptionLabelCallback = OptionValueCallback; | ||
export declare type RenderLabelCallback = (data: OptionData) => ReactNode; | ||
export declare type OptionFilterCallback = (option: MenuOption) => string; | ||
export declare type OptionDisabledCallback = (data: OptionData) => boolean; | ||
export declare type MouseOrTouchEvent<T = Element> = MouseEvent<T> | TouchEvent<T>; | ||
export declare type MouseOrTouchEventHandler<T = Element> = EventHandler<MouseOrTouchEvent<T>>; | ||
export declare type TestableElement = { | ||
export type OptionData = any; | ||
export type CallbackFn = (...args: any[]) => any; | ||
export type AriaLiveAttribute = 'off' | 'polite' | 'assertive'; | ||
export type CustomRendererCallback = (...args: any[]) => ReactNode; | ||
export type IconRenderer = ReactNode | CustomRendererCallback; | ||
export type OptionValueCallback = (data: OptionData) => string | number; | ||
export type OptionLabelCallback = OptionValueCallback; | ||
export type RenderLabelCallback = (data: OptionData) => ReactNode; | ||
export type OptionFilterCallback = (option: MenuOption) => string; | ||
export type OptionDisabledCallback = (data: OptionData) => boolean; | ||
export type MouseOrTouchEvent<T = Element> = MouseEvent<T> | TouchEvent<T>; | ||
export type MouseOrTouchEventHandler<T = Element> = EventHandler<MouseOrTouchEvent<T>>; | ||
export type TestableElement = { | ||
'data-testid'?: string; | ||
}; | ||
export declare type PartialDeep<T> = { | ||
export type PartialDeep<T> = { | ||
[P in keyof T]?: PartialDeep<T[P]>; | ||
}; | ||
export declare type SelectedOption = { | ||
export type SelectedOption = { | ||
data?: OptionData; | ||
@@ -31,8 +31,28 @@ value?: string | number; | ||
} | ||
export declare type ItemData = { | ||
export type ItemData = { | ||
memoOptions: boolean; | ||
menuOptions: MenuOption[]; | ||
focusedOptionIndex: number; | ||
selectOption: (option: MenuOption) => void; | ||
renderOptionLabel: (data: OptionData) => ReactNode; | ||
selectOption: (option: SelectedOption, isSelected?: boolean) => void; | ||
}; | ||
export type MultiParams = Readonly<{ | ||
selected: SelectedOption[]; | ||
renderOptionLabel: (data: OptionData) => ReactNode; | ||
}>; | ||
export type MenuOption = Readonly<{ | ||
label: string | number; | ||
value: string | number; | ||
data: OptionData; | ||
isDisabled: boolean; | ||
isSelected: boolean; | ||
}>; | ||
export type SelectRef = Readonly<{ | ||
menuOpen: boolean; | ||
blur: () => void; | ||
focus: () => void; | ||
clearValue: () => void; | ||
toggleMenu: (state?: boolean) => void; | ||
setValue: (option?: OptionData) => void; | ||
}>; | ||
export type Theme = PartialDeep<DefaultTheme>; |
@@ -8,3 +8,3 @@ import type { SyntheticEvent } from 'react'; | ||
/** | ||
* Call preventDefault() and stopPropagation() on event. | ||
* Prevent default behavior and propagation of an event | ||
*/ | ||
@@ -14,18 +14,18 @@ export declare const suppressEvent: (e: SyntheticEvent<Element>) => void; | ||
* Apply regex to string, and if the value is NOT case sensitive, | ||
* call .toLowerCase() and return result. | ||
* call .toLowerCase() and return result | ||
*/ | ||
export declare const trimAndFormatFilterStr: (value: string, filterIgnoreCase: boolean, filterIgnoreAccents: boolean) => string; | ||
/** | ||
* Builds the className property in Option.tsx component. | ||
* Builds the className property in Option.tsx component | ||
*/ | ||
export declare const buildOptionClsName: (isDisabled: boolean, isSelected: boolean, isFocused: boolean) => string; | ||
/** | ||
* Parses an object or an array of objects into output of SelectedOption[]. | ||
* Parses an object or an array of objects into output of SelectedOption[] | ||
*/ | ||
export declare const normalizeValue: (value: unknown, getOptionValue: OptionValueCallback, getOptionLabel: OptionLabelCallback) => SelectedOption[]; | ||
/** | ||
* Immutable implementation of mergeDeep for two objects. Will return the merged result. | ||
* Immutable implementation of mergeDeep for two objects. Will return the merged result | ||
* In first condition of if/else block - check that property is no 'animation', | ||
* since we never want to merge that complex styled-component object. | ||
* since we never want to merge that complex styled-component object | ||
*/ | ||
export declare const mergeDeep: <T>(target: any, source: any) => T; |
/** | ||
* Determines if the current device is touch-enabled. | ||
* Global, lazy evaluation. | ||
*/ | ||
export declare const IS_TOUCH_DEVICE: boolean; | ||
export declare const isTouchDevice: () => boolean; |
export * from './menu'; | ||
export * from './theme'; | ||
export * from './common'; | ||
export * from './device'; |
/** | ||
* Calculates the top property value for the MenuWrapper <div />. | ||
* This property is only generated when the position of the menu is above the control. | ||
* Calculates the top property value for the MenuWrapper element | ||
* This property is only generated when the position of the menu is above the control | ||
*/ | ||
export declare const calculateMenuTop: (menuHeight: number, menuEl: Element | null, controlEl: Element | null) => string; | ||
export declare const menuFitsBelowControl: (el: Element | null) => boolean; | ||
export declare const calculateMenuTop: (menuHeight: number, menuEl: HTMLElement | null, controlEl: HTMLElement | null) => string; | ||
export declare const menuFitsBelowControl: (el: HTMLElement | null) => boolean; | ||
/** | ||
* Calculate space around the control and menu to determine if an animated | ||
* scroll can performed to show the menu in full view. Also, execute a callback if defined. | ||
* scroll can performed to show the menu in full view. Also, execute a callback if defined | ||
*/ | ||
export declare const scrollMenuIntoViewOnOpen: (menuEl: Element | null, menuScrollDuration: number | undefined, scrollMenuIntoView: boolean | undefined, handleOnMenuOpen: (availableSpace?: number) => void) => void; | ||
export declare const scrollMenuIntoViewOnOpen: (menuEl: HTMLElement | null, menuScrollDuration: number | undefined, scrollMenuIntoView: boolean | undefined, handleOnMenuOpen: (availableSpace?: number) => void) => void; |
{ | ||
"name": "react-functional-select", | ||
"version": "3.3.5", | ||
"version": "4.0.0", | ||
"description": "Micro-sized and micro-optimized select component for React.js", | ||
@@ -27,3 +27,3 @@ "main": "dist/index.cjs.js", | ||
}, | ||
"homepage": "https://based-ghost.github.io/react-functional-select", | ||
"homepage": "https://master--625676b6922472003af898b4.chromatic.com", | ||
"keywords": [ | ||
@@ -52,56 +52,54 @@ "react", | ||
"@babel/cli": "^7.19.3", | ||
"@babel/core": "^7.19.3", | ||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", | ||
"@babel/plugin-proposal-optional-chaining": "^7.18.9", | ||
"@babel/plugin-transform-runtime": "^7.19.1", | ||
"@babel/preset-env": "^7.19.4", | ||
"@babel/core": "^7.20.2", | ||
"@babel/plugin-transform-runtime": "^7.19.6", | ||
"@babel/preset-env": "^7.20.2", | ||
"@babel/preset-react": "^7.18.6", | ||
"@babel/preset-typescript": "^7.18.6", | ||
"@rollup/plugin-babel": "^6.0.0", | ||
"@rollup/plugin-replace": "^5.0.0", | ||
"@rollup/plugin-typescript": "^9.0.1", | ||
"@storybook/addon-storysource": "^6.5.12", | ||
"@storybook/addons": "^6.5.12", | ||
"@storybook/builder-webpack5": "^6.5.12", | ||
"@storybook/manager-webpack5": "^6.5.12", | ||
"@storybook/react": "^6.5.12", | ||
"@storybook/theming": "^6.5.12", | ||
"@rollup/plugin-babel": "^6.0.2", | ||
"@rollup/plugin-replace": "^5.0.1", | ||
"@rollup/plugin-typescript": "^9.0.2", | ||
"@storybook/addon-storysource": "^6.5.13", | ||
"@storybook/addons": "^6.5.13", | ||
"@storybook/builder-webpack5": "^6.5.13", | ||
"@storybook/manager-webpack5": "^6.5.13", | ||
"@storybook/react": "^6.5.13", | ||
"@storybook/theming": "^6.5.13", | ||
"@testing-library/jest-dom": "^5.16.5", | ||
"@testing-library/react": "^13.4.0", | ||
"@testing-library/user-event": "^14.4.3", | ||
"@types/jest": "^29.1.2", | ||
"@types/node": "^18.8.5", | ||
"@types/react": "^18.0.21", | ||
"@types/react-dom": "^18.0.6", | ||
"@types/jest": "^29.2.3", | ||
"@types/node": "^18.11.9", | ||
"@types/react": "^18.0.25", | ||
"@types/react-dom": "^18.0.9", | ||
"@types/react-window": "^1.8.5", | ||
"@types/styled-components": "^5.1.26", | ||
"@typescript-eslint/eslint-plugin": "^5.40.0", | ||
"@typescript-eslint/parser": "^5.40.0", | ||
"babel-jest": "^29.1.2", | ||
"babel-loader": "^8.2.5", | ||
"@typescript-eslint/eslint-plugin": "^5.44.0", | ||
"@typescript-eslint/parser": "^5.44.0", | ||
"babel-jest": "^29.3.1", | ||
"babel-loader": "^9.1.0", | ||
"babel-plugin-styled-components": "^2.0.7", | ||
"chromatic": "^6.10.2", | ||
"chromatic": "^6.11.4", | ||
"cross-env": "^7.0.3", | ||
"enzyme": "^3.11.0", | ||
"eslint": "^8.25.0", | ||
"eslint": "^8.28.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-react": "^7.31.10", | ||
"eslint-plugin-react": "^7.31.11", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"jest": "^29.1.2", | ||
"jest-environment-jsdom": "^29.1.2", | ||
"jest": "^29.3.1", | ||
"jest-environment-jsdom": "^29.3.1", | ||
"jest-enzyme": "^7.1.2", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.7.1", | ||
"prettier": "^2.8.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-syntax-highlighter": "^15.5.0", | ||
"react-toastify": "^9.0.8", | ||
"react-window": "^1.8.7", | ||
"react-toastify": "^9.1.1", | ||
"react-window": "^1.8.8", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^3.1.0", | ||
"rollup": "^3.4.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"styled-components": "^5.3.6", | ||
"typescript": "^4.8.4", | ||
"webpack": "^5.74.0" | ||
"typescript": "^4.9.3", | ||
"webpack": "^5.75.0" | ||
}, | ||
@@ -130,4 +128,4 @@ "peerDependencies": { | ||
"dependencies": { | ||
"@babel/runtime": "^7.19.4" | ||
"@babel/runtime": "^7.20.1" | ||
} | ||
} |
@@ -49,6 +49,6 @@ [![NPM](https://img.shields.io/npm/v/react-functional-select.svg?style=flat-square)](https://www.npmjs.com/package/react-functional-select) | ||
import { Select } from 'react-functional-select'; | ||
import { useState, useEffect, useCallback } from 'react'; | ||
import React, { useState, useEffect, useCallback, type ComponentProps } from 'react'; | ||
import { Card, CardHeader, CardBody, Container, SelectContainer } from '../shared/components'; | ||
import type { FunctionComponent } from 'react'; | ||
type SelectProps = ComponentProps<typeof Select>; | ||
@@ -61,7 +61,3 @@ type Option = Readonly<{ | ||
type SingleSelectDemoProps = Readonly<{ | ||
isDisabled: boolean; | ||
}>; | ||
const _cityOptions: Option[] = [ | ||
const CITY_OPTIONS: Option[] = [ | ||
{ id: 1, city: 'Austin', state: 'TX' }, | ||
@@ -74,12 +70,14 @@ { id: 2, city: 'Denver', state: 'CO' }, | ||
const SingleSelectDemo: FunctionComponent<SingleSelectDemoProps> = ({ isDisabled }) => { | ||
const SingleSelect: React.FC<SelectProps> = ({ isDisabled }) => { | ||
const [isInvalid, setIsInvalid] = useState<boolean>(false); | ||
const [selectedOption, setSelectedOption] = useState<Option | null>(null); | ||
const getOptionValue = useCallback((option: Option): number => option.id, []); | ||
const onOptionChange = useCallback((option: Option | null): void => setSelectedOption(option), []); | ||
const getOptionLabel = useCallback((option: Option): string => `${option.city}, ${option.state}`, []); | ||
const getOptionValue = useCallback((opt: Option): number => opt.id, []); | ||
const onOptionChange = useCallback((opt: Option | null): void => setSelectedOption(opt), []); | ||
const getOptionLabel = useCallback((opt: Option): string => `${opt.city}, ${opt.state}`, []); | ||
useEffect(() => { | ||
isDisabled && setIsInvalid(false); | ||
if (isDisabled) { | ||
setIsInvalid(false); | ||
} | ||
}, [isDisabled]); | ||
@@ -98,3 +96,3 @@ | ||
isInvalid={isInvalid} | ||
options={_cityOptions} | ||
options={CITY_OPTIONS} | ||
isDisabled={isDisabled} | ||
@@ -112,3 +110,3 @@ onOptionChange={onOptionChange} | ||
export default SingleSelectDemo; | ||
export default SingleSelect; | ||
``` | ||
@@ -134,2 +132,3 @@ | ||
|`inputDelay`| number | `undefined` | The debounce delay in for the input search (milliseconds) | ||
|`pageSize`| number | `5` | Number of options to jump in menu when page{up|down} keys are used | ||
|`isDisabled`| bool | `false` | Is the select control disabled - recieves disabled styling | ||
@@ -136,0 +135,0 @@ |`required`| bool | `false` | Is the select control required - applied to the `input` element. When `true`, the optionally specified CSS from the `themeConfig.input.cssRequired` field will be applied to the `input` element. |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
53
115225
747
187
Updated@babel/runtime@^7.20.1