react-functional-select
Advanced tools
Comparing version 3.3.0 to 3.3.1
@@ -19,3 +19,3 @@ import React from 'react'; | ||
} | ||
// Message text for "aria-selection" SPAN | ||
// Message contents for "aria-context" <span> | ||
const optionsMsg = ` ${optionCount} result(s) available${inputValue ? (' for search input ' + inputValue) : ''}.`; | ||
@@ -29,9 +29,11 @@ const menuMsg = menuOpen | ||
: ''; | ||
// Message text for "aria-context" SPAN | ||
// Message contents for "aria-selection" <span> | ||
const labels = selectedOption.length ? selectedOption.map((x) => x.label).join(' ') : 'N/A'; | ||
const selectedOptionMsg = 'Selected option: ' + labels; | ||
return (React.createElement(A11yText, { "aria-atomic": 'false', "aria-live": ariaLive, "aria-relevant": 'additions text' }, | ||
React.createElement("span", { id: ARIA_LIVE_SELECTION_ID }, selectedOptionMsg), | ||
React.createElement("span", { id: ARIA_LIVE_CONTEXT_ID }, focusedMsg + optionsMsg + menuMsg))); | ||
// Formatted messages for both <span>'s | ||
const selectionMsg = 'Selected option: ' + labels; | ||
const ariaContextMsg = `${focusedMsg} ${optionsMsg} ${menuMsg}`.trimStart(); | ||
return (React.createElement(A11yText, { "aria-atomic": "false", "aria-live": ariaLive, "aria-relevant": "additions text" }, | ||
React.createElement("span", { id: ARIA_LIVE_SELECTION_ID }, selectionMsg), | ||
React.createElement("span", { id: ARIA_LIVE_CONTEXT_ID }, ariaContextMsg))); | ||
}; | ||
export default AriaLiveRegion; |
@@ -13,4 +13,4 @@ import React from 'react'; | ||
`; | ||
const ClearSvgIcon = () => (React.createElement(ClearSvg, { "aria-hidden": true, viewBox: '0 0 14 16', className: CLEAR_ICON_CLS }, | ||
React.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' }))); | ||
const ClearSvgIcon = () => (React.createElement(ClearSvg, { "aria-hidden": true, viewBox: "0 0 14 16", className: CLEAR_ICON_CLS }, | ||
React.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" }))); | ||
export default ClearSvgIcon; |
@@ -48,3 +48,3 @@ import React, { memo } from 'react'; | ||
const IndicatorIcons = memo(({ menuOpen, clearIcon, caretIcon, isInvalid, showClear, isLoading, isDisabled, loadingNode, onCaretMouseDown, onClearMouseDown }) => { | ||
const renderIconFn = (renderer) => { | ||
const renderIconCallback = (renderer) => { | ||
return isFunction(renderer) | ||
@@ -55,8 +55,8 @@ ? renderer({ menuOpen, isLoading, isInvalid, isDisabled }) | ||
return (React.createElement(IndicatorIconsWrapper, null, | ||
showClear && !isLoading && (React.createElement(IndicatorIcon, { onTouchEnd: onClearMouseDown, onMouseDown: onClearMouseDown, "data-testid": CLEAR_ICON_TESTID }, renderIconFn(clearIcon) || React.createElement(ClearSvgIcon, null))), | ||
showClear && !isLoading && (React.createElement(IndicatorIcon, { onTouchEnd: onClearMouseDown, onMouseDown: onClearMouseDown, "data-testid": CLEAR_ICON_TESTID }, renderIconCallback(clearIcon) || React.createElement(ClearSvgIcon, null))), | ||
isLoading && (loadingNode || React.createElement(LoadingDots, null)), | ||
React.createElement(Separator, null), | ||
React.createElement(IndicatorIcon, { onTouchEnd: onCaretMouseDown, onMouseDown: onCaretMouseDown, "data-testid": CARET_ICON_TESTID }, renderIconFn(caretIcon) || (React.createElement(Caret, { "aria-hidden": true, menuOpen: menuOpen, isInvalid: isInvalid, className: CARET_ICON_CLS }))))); | ||
React.createElement(IndicatorIcon, { onTouchEnd: onCaretMouseDown, onMouseDown: onCaretMouseDown, "data-testid": CARET_ICON_TESTID }, renderIconCallback(caretIcon) || (React.createElement(Caret, { "aria-hidden": true, menuOpen: menuOpen, isInvalid: isInvalid, className: CARET_ICON_CLS }))))); | ||
}); | ||
IndicatorIcons.displayName = 'IndicatorIcons'; | ||
export default IndicatorIcons; |
import React from 'react'; | ||
import type { SelectedOption } from '../../types'; | ||
import type { FormEventHandler, FocusEventHandler } from 'react'; | ||
@@ -11,3 +10,3 @@ export declare type AutosizeInputProps = Readonly<{ | ||
ariaLabelledBy?: string; | ||
selectedOption: SelectedOption[]; | ||
hasSelectedOptions: boolean; | ||
onBlur: FocusEventHandler<HTMLInputElement>; | ||
@@ -24,3 +23,3 @@ onFocus: FocusEventHandler<HTMLInputElement>; | ||
ariaLabelledBy?: string | undefined; | ||
selectedOption: SelectedOption[]; | ||
hasSelectedOptions: boolean; | ||
onBlur: FocusEventHandler<HTMLInputElement>; | ||
@@ -27,0 +26,0 @@ onFocus: FocusEventHandler<HTMLInputElement>; |
import React, { memo, useRef, useState, Fragment, forwardRef } from 'react'; | ||
import styled from 'styled-components'; | ||
import { useUpdateEffect } from '../../hooks'; | ||
import { IS_MICROSOFT_BROWSER } from '../../utils'; | ||
import { AUTOSIZE_INPUT_ATTRS } from '../../constants'; | ||
import { isArrayWithLength, IS_MICROSOFT_BROWSER } from '../../utils'; | ||
const _inputMinWidthPx = 2; | ||
const INPUT_MIN_WIDTH_PX = 2; | ||
const SizerDiv = styled.div ` | ||
@@ -44,9 +44,9 @@ top: 0; | ||
`; | ||
const AutosizeInput = memo(forwardRef(({ id, onBlur, onFocus, readOnly, required, onChange, ariaLabel, inputValue, ariaLabelledBy, selectedOption }, ref) => { | ||
const AutosizeInput = memo(forwardRef(({ id, onBlur, onFocus, readOnly, required, onChange, ariaLabel, inputValue, ariaLabelledBy, hasSelectedOptions }, ref) => { | ||
const sizerRef = useRef(null); | ||
const [inputWidth, setInputWidth] = useState(_inputMinWidthPx); | ||
const isInvalid = !!required && !isArrayWithLength(selectedOption); | ||
const [inputWidth, setInputWidth] = useState(INPUT_MIN_WIDTH_PX); | ||
const isInvalid = !!required && !hasSelectedOptions; | ||
useUpdateEffect(() => { | ||
if (sizerRef.current) { | ||
setInputWidth(sizerRef.current.scrollWidth + _inputMinWidthPx); | ||
setInputWidth(sizerRef.current.scrollWidth + INPUT_MIN_WIDTH_PX); | ||
} | ||
@@ -53,0 +53,0 @@ }, [inputValue]); |
@@ -33,21 +33,18 @@ import React from 'react'; | ||
-webkit-tap-highlight-color: transparent; | ||
padding: ${({ theme }) => theme.menu.option.padding}; | ||
text-align: ${({ theme }) => theme.menu.option.textAlign}; | ||
${({ theme: { menu: { option } } }) => css ` | ||
padding: ${option.padding}; | ||
text-align: ${option.textAlign}; | ||
&.${OPTION_FOCUSED_CLS}, | ||
&:hover:not(.${OPTION_DISABLED_CLS}):not(.${OPTION_SELECTED_CLS}) { | ||
background-color: ${({ theme }) => theme.menu.option.focusedBgColor}; | ||
} | ||
&.${OPTION_FOCUSED_CLS}, | ||
&:hover:not(.${OPTION_DISABLED_CLS}):not(.${OPTION_SELECTED_CLS}) { | ||
background-color: ${option.focusedBgColor}; | ||
} | ||
&.${OPTION_SELECTED_CLS} { | ||
color: ${({ theme }) => theme.menu.option.selectedColor}; | ||
background-color: ${({ theme }) => theme.menu.option.selectedBgColor}; | ||
} | ||
&.${OPTION_SELECTED_CLS} { | ||
color: ${option.selectedColor}; | ||
background-color: ${option.selectedBgColor}; | ||
} | ||
&.${OPTION_DISABLED_CLS} { | ||
opacity: 0.35; | ||
} | ||
`} | ||
&.${OPTION_DISABLED_CLS} { | ||
opacity: 0.35; | ||
} | ||
} | ||
@@ -54,0 +51,0 @@ `; |
import { FixedSizeList } from 'react-window'; | ||
import type { MenuOption } from '../../Select'; | ||
import type { OptionData, SelectedOption } from '../../types'; | ||
import type { ReactNode, ReactText, MutableRefObject, FunctionComponent } from 'react'; | ||
import type { ReactText, MutableRefObject, FunctionComponent } from 'react'; | ||
import type { RenderLabelCallback, SelectedOption } from '../../types'; | ||
export declare type MenuListProps = Readonly<{ | ||
@@ -17,3 +17,3 @@ height: number; | ||
itemKeySelector?: ReactText; | ||
renderOptionLabel: (data: OptionData) => ReactNode; | ||
renderOptionLabel: RenderLabelCallback; | ||
fixedSizeListRef: MutableRefObject<FixedSizeList | null>; | ||
@@ -20,0 +20,0 @@ selectOption: (option: SelectedOption, isSelected?: boolean) => void; |
import React from 'react'; | ||
import type { ReactNode, ReactText } from 'react'; | ||
import type { OptionData, SelectedOption } from '../../types'; | ||
import type { ReactText } from 'react'; | ||
import type { RenderLabelCallback, SelectedOption } from '../../types'; | ||
export declare type MultiValueProps = SelectedOption & Readonly<{ | ||
isFocused: boolean; | ||
renderOptionLabel: RenderLabelCallback; | ||
removeSelectedOption: (value?: ReactText) => void; | ||
renderOptionLabel: (data: OptionData) => ReactNode; | ||
}>; | ||
declare const MultiValue: React.NamedExoticComponent<MultiValueProps>; | ||
export default MultiValue; |
import React, { memo } from 'react'; | ||
import { suppressEvent } from '../../utils'; | ||
import styled, { css } from 'styled-components'; | ||
import { CLEAR_ICON_MV_TESTID } from '../../constants'; | ||
import { suppressMouseOrTouchEvent } from '../../utils'; | ||
const _clearIconFocusStyle = css ` | ||
@@ -50,6 +50,9 @@ z-index: 5000; | ||
`; | ||
const MultiValue = memo(({ data, value, isFocused, renderOptionLabel, removeSelectedOption }) => (React.createElement(MultiValueWrapper, null, | ||
React.createElement(Label, null, renderOptionLabel(data)), | ||
React.createElement(Clear, { isFocused: isFocused, "data-testid": CLEAR_ICON_MV_TESTID, onMouseDown: suppressMouseOrTouchEvent, onClick: () => removeSelectedOption(value), onTouchEnd: () => removeSelectedOption(value) }, "\u2716")))); | ||
const MultiValue = memo(({ data, value, isFocused, renderOptionLabel, removeSelectedOption }) => { | ||
const onClearEvent = () => removeSelectedOption(value); | ||
return (React.createElement(MultiValueWrapper, null, | ||
React.createElement(Label, null, renderOptionLabel(data)), | ||
React.createElement(Clear, { isFocused: isFocused, onClick: onClearEvent, onTouchEnd: onClearEvent, onMouseDown: suppressEvent, "data-testid": CLEAR_ICON_MV_TESTID }, "\u2716"))); | ||
}); | ||
MultiValue.displayName = 'MultiValue'; | ||
export default MultiValue; |
import React from 'react'; | ||
import type { MultiParams } from '../../Select'; | ||
import type { ReactNode, ReactText } from 'react'; | ||
import type { OptionData, SelectedOption } from '../../types'; | ||
import type { SelectedOption, RenderLabelCallback } from '../../types'; | ||
export declare type ValueProps = Readonly<{ | ||
@@ -11,4 +11,4 @@ isMulti?: boolean; | ||
focusedMultiValue: ReactText | null; | ||
renderOptionLabel: RenderLabelCallback; | ||
removeSelectedOption: (value?: ReactText) => void; | ||
renderOptionLabel: (data: OptionData) => ReactNode; | ||
renderMultiOptions?: (params: MultiParams) => ReactNode; | ||
@@ -22,6 +22,6 @@ }>; | ||
focusedMultiValue: ReactText | null; | ||
renderOptionLabel: RenderLabelCallback; | ||
removeSelectedOption: (value?: React.ReactText | undefined) => void; | ||
renderOptionLabel: (data: OptionData) => ReactNode; | ||
renderMultiOptions?: ((params: MultiParams) => ReactNode) | undefined; | ||
}>>; | ||
export default Value; |
@@ -6,3 +6,3 @@ import React, { memo, Fragment } from 'react'; | ||
import { useFirstRenderState } from '../../hooks'; | ||
const _singleValueBaseStyle = css ` | ||
const SINGLE_VALUE_BASE_STYLE = css ` | ||
top: 50%; | ||
@@ -17,7 +17,7 @@ overflow: hidden; | ||
const SingleValue = styled.div ` | ||
${_singleValueBaseStyle} | ||
${SINGLE_VALUE_BASE_STYLE} | ||
max-width: calc(100% - 0.5rem); | ||
`; | ||
const Placeholder = styled.div ` | ||
${_singleValueBaseStyle} | ||
${SINGLE_VALUE_BASE_STYLE} | ||
color: ${({ theme }) => theme.color.placeholder}; | ||
@@ -24,0 +24,0 @@ ${({ theme, isFirstRender }) => !isFirstRender && css `animation: ${theme.placeholder.animation};`} |
@@ -1,2 +0,2 @@ | ||
import type { FocusedOption } from '../types'; | ||
import type { FocusedOption, OptionValueCallback, OptionLabelCallback, OptionFilterCallback, OptionDisabledCallback } from '../types'; | ||
export declare const MENU_ITEM_SIZE_DEFAULT = 35; | ||
@@ -8,2 +8,6 @@ export declare const MENU_MAX_HEIGHT_DEFAULT = 300; | ||
export declare const FOCUSED_OPTION_DEFAULT: FocusedOption; | ||
export declare const GET_OPTION_LABEL_DEFAULT: OptionLabelCallback; | ||
export declare const GET_OPTION_VALUE_DEFAULT: OptionValueCallback; | ||
export declare const GET_OPTION_DISABLED_DEFAULT: OptionDisabledCallback; | ||
export declare const GET_OPTION_FILTER_DEFAULT: OptionFilterCallback; | ||
export declare const EMPTY_ARRAY: any[]; |
@@ -7,3 +7,7 @@ export const MENU_ITEM_SIZE_DEFAULT = 35; | ||
export const FOCUSED_OPTION_DEFAULT = { index: -1 }; | ||
export const GET_OPTION_LABEL_DEFAULT = (data) => data.label; | ||
export const GET_OPTION_VALUE_DEFAULT = (data) => data.value; | ||
export const GET_OPTION_DISABLED_DEFAULT = (data) => !!data.isDisabled; | ||
export const GET_OPTION_FILTER_DEFAULT = ({ label }) => (typeof label === 'string') ? label : `${label}`; | ||
// Default for options and selectedOption props | ||
export const EMPTY_ARRAY = []; |
@@ -0,1 +1,2 @@ | ||
import type { TestableElement } from '../types'; | ||
import type { HTMLAttributes, InputHTMLAttributes } from 'react'; | ||
@@ -25,10 +26,6 @@ export declare const ARIA_LIVE_CONTEXT_ID = "aria-context"; | ||
*/ | ||
export declare const SELECT_WRAPPER_ATTRS: HTMLAttributes<HTMLDivElement> & { | ||
'data-testid'?: string; | ||
}; | ||
export declare const SELECT_WRAPPER_ATTRS: HTMLAttributes<HTMLDivElement> & TestableElement; | ||
/** | ||
* Static attributes for 'AutosizeInput' input element. | ||
*/ | ||
export declare const AUTOSIZE_INPUT_ATTRS: InputHTMLAttributes<HTMLInputElement> & { | ||
'data-testid'?: string; | ||
}; | ||
export declare const AUTOSIZE_INPUT_ATTRS: InputHTMLAttributes<HTMLInputElement> & TestableElement; |
@@ -16,3 +16,3 @@ import { css, keyframes } from 'styled-components'; | ||
`; | ||
export const FADE_IN_ANIMATION_CSS = css `${_fadeInKeyframes} 0.25s ease-in-out both`; | ||
export const FADE_IN_ANIMATION_CSS = css `${_fadeInKeyframes} 0.25s ease-in-out`; | ||
export const BOUNCE_ANIMATION_CSS = css `${_bounceKeyframes} 1.19s ease-in-out infinite`; |
export { default as useDebounce } from './useDebounce'; | ||
export { default as useMountEffect } from './useMountEffect'; | ||
export { default as useMenuOptions } from './useMenuOptions'; | ||
export { default as useCallbackRef } from './useCallbackRef'; | ||
export { default as useUpdateEffect } from './useUpdateEffect'; | ||
export { default as useMenuPositioner } from './useMenuPositioner'; | ||
export { default as useFirstRenderState } from './useFirstRenderState'; |
export { default as useDebounce } from './useDebounce'; | ||
export { default as useMountEffect } from './useMountEffect'; | ||
export { default as useMenuOptions } from './useMenuOptions'; | ||
export { default as useCallbackRef } from './useCallbackRef'; | ||
export { default as useUpdateEffect } from './useUpdateEffect'; | ||
export { default as useMenuPositioner } from './useMenuPositioner'; | ||
export { default as useFirstRenderState } from './useFirstRenderState'; |
/** | ||
* useDebounce hook | ||
* | ||
* Debouncer hook (hacky fix to prevent unecessary state mutations if no delay is passed). | ||
@@ -3,0 +5,0 @@ * If a number is passed for the delay parameter, use to debounce/set the value. |
import { useEffect, useState } from 'react'; | ||
/** | ||
* useDebounce hook | ||
* | ||
* Debouncer hook (hacky fix to prevent unecessary state mutations if no delay is passed). | ||
@@ -4,0 +6,0 @@ * If a number is passed for the delay parameter, use to debounce/set the value. |
/** | ||
* useFirstRenderState hook | ||
* | ||
* Returns "true" if component is just mounted (first render), else "false". | ||
@@ -3,0 +5,0 @@ */ |
import { useRef } from 'react'; | ||
/** | ||
* useFirstRenderState hook | ||
* | ||
* Returns "true" if component is just mounted (first render), else "false". | ||
@@ -4,0 +6,0 @@ */ |
import { FilterMatchEnum } from '../constants'; | ||
import type { ReactText } from 'react'; | ||
import type { MenuOption } from '../Select'; | ||
import type { OptionData, SelectedOption } from '../types'; | ||
import type { MutableRefObject } from 'react'; | ||
import type { OptionData, SelectedOption, OptionValueCallback, OptionLabelCallback, OptionFilterCallback, OptionDisabledCallback } from '../types'; | ||
/** | ||
* useMenuOptions hook | ||
* | ||
* 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: (data: OptionData) => ReactText, getOptionLabel: (data: OptionData) => ReactText, getIsOptionDisabled?: ((data: OptionData) => boolean) | undefined, getFilterOptionString?: ((option: MenuOption) => string) | undefined, filterIgnoreCase?: boolean | undefined, filterIgnoreAccents?: boolean | undefined, isMulti?: boolean | undefined, hideSelectedOptions?: boolean | undefined, async?: boolean | undefined) => MenuOption[]; | ||
declare const useMenuOptions: (options: OptionData[], debouncedInputValue: string, filterMatchFrom: FilterMatchEnum, selectedOption: SelectedOption[], getOptionValue: OptionValueCallback, getOptionLabel: OptionLabelCallback, getIsOptionDisabledRef: MutableRefObject<OptionDisabledCallback>, getFilterOptionStringRef: MutableRefObject<OptionFilterCallback>, filterIgnoreCase?: boolean, filterIgnoreAccents?: boolean, isMulti?: boolean, async?: boolean, hideSelectedOptions?: boolean | undefined) => MenuOption[]; | ||
export default useMenuOptions; |
@@ -1,27 +0,24 @@ | ||
import { useEffect, useRef, useState } from 'react'; | ||
import { useEffect, useState } from 'react'; | ||
import { EMPTY_ARRAY, FilterMatchEnum } from '../constants'; | ||
import { isBoolean, trimAndFormatFilterStr } from '../utils'; | ||
/** | ||
* useMenuOptions hook | ||
* | ||
* Parse options to array of MenuOptions and perform filtering (if applicable). | ||
* Set menuOptions state (ensure array returned). | ||
*/ | ||
const useMenuOptions = (options, debouncedInputValue, filterMatchFrom, selectedOption, getOptionValue, getOptionLabel, getIsOptionDisabled, getFilterOptionString, filterIgnoreCase, filterIgnoreAccents, isMulti, hideSelectedOptions, async) => { | ||
const getIsOptionDisabledRef = useRef(); | ||
const getFilterOptionStringRef = useRef(); | ||
const useMenuOptions = (options, debouncedInputValue, filterMatchFrom, selectedOption, getOptionValue, getOptionLabel, getIsOptionDisabledRef, getFilterOptionStringRef, filterIgnoreCase = false, filterIgnoreAccents = false, isMulti = false, async = false, hideSelectedOptions) => { | ||
const [menuOptions, setMenuOptions] = useState(EMPTY_ARRAY); | ||
// Prevent effect from executing on search input mutations in 'async' mode (also prevents filtering from executing) | ||
const searchValue = !async ? debouncedInputValue : ''; | ||
const hideSelectedOptionsOrDefault = isBoolean(hideSelectedOptions) ? hideSelectedOptions : !!isMulti; | ||
const hideSelectedOptionsOrDefault = isBoolean(hideSelectedOptions) ? hideSelectedOptions : isMulti; | ||
useEffect(() => { | ||
getIsOptionDisabledRef.current = getIsOptionDisabled || ((data) => !!data.isDisabled); | ||
getFilterOptionStringRef.current = getFilterOptionString || (({ label }) => (typeof label === 'string') ? label : `${label}`); | ||
}, [getIsOptionDisabled, getFilterOptionString]); | ||
useEffect(() => { | ||
const isMatchFilter = filterMatchFrom === FilterMatchEnum.ANY; | ||
const { current: getIsOptionDisabled } = getIsOptionDisabledRef; | ||
const { current: getFilterOptionStr } = getFilterOptionStringRef; | ||
const normalizedSearch = trimAndFormatFilterStr(searchValue, filterIgnoreCase, filterIgnoreAccents); | ||
const selectedHash = selectedOption.length ? new Set(selectedOption.map((x) => x.value)) : undefined; | ||
const isOptionFilterMatch = (option) => { | ||
const optionStr = getFilterOptionStringRef.current(option); | ||
const optionStr = getFilterOptionStr(option); | ||
const normalizedOptionLabel = trimAndFormatFilterStr(optionStr, filterIgnoreCase, filterIgnoreAccents); | ||
return isMatchFilter | ||
return filterMatchFrom === FilterMatchEnum.ANY | ||
? normalizedOptionLabel.indexOf(normalizedSearch) > -1 | ||
@@ -37,3 +34,3 @@ : normalizedOptionLabel.substr(0, normalizedSearch.length) === normalizedSearch; | ||
label, | ||
...(getIsOptionDisabledRef.current(data) && { isDisabled: true }), | ||
...(getIsOptionDisabled(data) && { isDisabled: true }), | ||
...(selectedHash?.has(value) && { isSelected: true }) | ||
@@ -47,12 +44,23 @@ }; | ||
}; | ||
const { length } = options; | ||
const nextMenuOptions = []; | ||
for (let i = 0; i < length; i++) { | ||
const option = parseMenuOption(options[i]); | ||
option && nextMenuOptions.push(option); | ||
} | ||
const nextMenuOptions = options.reduce((acc, option) => { | ||
const menuOption = parseMenuOption(option); | ||
menuOption && acc.push(menuOption); | ||
return acc; | ||
}, []); | ||
setMenuOptions(nextMenuOptions); | ||
}, [options, selectedOption, searchValue, hideSelectedOptionsOrDefault, filterMatchFrom, filterIgnoreCase, filterIgnoreAccents, getOptionValue, getOptionLabel]); | ||
}, [ | ||
options, | ||
searchValue, | ||
getOptionValue, | ||
getOptionLabel, | ||
selectedOption, | ||
filterMatchFrom, | ||
filterIgnoreCase, | ||
filterIgnoreAccents, | ||
getIsOptionDisabledRef, | ||
getFilterOptionStringRef, | ||
hideSelectedOptionsOrDefault | ||
]); | ||
return menuOptions; | ||
}; | ||
export default useMenuOptions; |
import { MenuPositionEnum } from '../constants'; | ||
import type { RefObject } from 'react'; | ||
import type { CallbackFunction } from '../types'; | ||
import type { RefObject, MutableRefObject } from 'react'; | ||
/** | ||
* useMenuPositioner hook | ||
* | ||
* Handle calculating and maintaining the menuHeight used by react-window. | ||
@@ -11,3 +13,3 @@ * Handle scroll animation and callback execution when menuOpen = true. | ||
*/ | ||
declare const useMenuPositioner: (menuRef: RefObject<HTMLElement | null>, controlRef: RefObject<HTMLElement | null>, menuOpen: boolean, menuPosition: MenuPositionEnum, menuItemSize: number, menuHeightDefault: number, menuOptionsLength: number, isMenuPortaled: boolean, menuScrollDuration?: number | undefined, scrollMenuIntoView?: boolean | undefined, onMenuOpen?: CallbackFunction | undefined, onMenuClose?: CallbackFunction | undefined) => [string | undefined, number]; | ||
declare const useMenuPositioner: (menuRef: RefObject<HTMLElement | null>, controlRef: RefObject<HTMLElement | null>, menuOpen: boolean, menuPosition: MenuPositionEnum, menuItemSize: number, menuHeightDefault: number, menuOptionsLength: number, isMenuPortaled: boolean, onMenuOpenRef: MutableRefObject<CallbackFunction | undefined>, onMenuCloseRef: MutableRefObject<CallbackFunction | undefined>, menuScrollDuration?: number | undefined, scrollMenuIntoView?: boolean | undefined) => [string | undefined, number]; | ||
export default useMenuPositioner; |
@@ -6,2 +6,4 @@ import { useEffect, useState, useRef } from 'react'; | ||
/** | ||
* useMenuPositioner hook | ||
* | ||
* Handle calculating and maintaining the menuHeight used by react-window. | ||
@@ -13,5 +15,3 @@ * Handle scroll animation and callback execution when menuOpen = true. | ||
*/ | ||
const useMenuPositioner = (menuRef, controlRef, menuOpen, menuPosition, menuItemSize, menuHeightDefault, menuOptionsLength, isMenuPortaled, menuScrollDuration, scrollMenuIntoView, onMenuOpen, onMenuClose) => { | ||
const onMenuOpenRef = useRef(); | ||
const onMenuCloseRef = useRef(); | ||
const useMenuPositioner = (menuRef, controlRef, menuOpen, menuPosition, menuItemSize, menuHeightDefault, menuOptionsLength, isMenuPortaled, onMenuOpenRef, onMenuCloseRef, menuScrollDuration, scrollMenuIntoView) => { | ||
const resetMenuHeightRef = useRef(false); | ||
@@ -22,6 +22,2 @@ const shouldScrollRef = useRef(!isMenuPortaled); | ||
useEffect(() => { | ||
onMenuOpenRef.current = onMenuOpen; | ||
onMenuCloseRef.current = onMenuClose; | ||
}, [onMenuOpen, onMenuClose]); | ||
useEffect(() => { | ||
shouldScrollRef.current = !isMenuTopPosition && !isMenuPortaled; | ||
@@ -54,3 +50,3 @@ }, [isMenuTopPosition, isMenuPortaled]); | ||
} | ||
}, [menuRef, menuOpen, menuHeightDefault, scrollMenuIntoView, menuScrollDuration]); | ||
}, [menuRef, menuOpen, menuHeightDefault, scrollMenuIntoView, menuScrollDuration, onMenuCloseRef, onMenuOpenRef]); | ||
// Calculated menu height passed react-window; calculate MenuWrapper <div /> 'top' style prop if menu is positioned above control | ||
@@ -57,0 +53,0 @@ const menuHeightCalc = Math.min(menuHeight, menuOptionsLength * menuItemSize); |
import type { EffectCallback } from 'react'; | ||
/** | ||
* useMountEffect hook | ||
* | ||
* Run an effect only once (on initial mount). | ||
@@ -4,0 +6,0 @@ * Pass an empty array for the dependency list to ensure effect is only fired once. |
import { useEffect } from 'react'; | ||
/** | ||
* useMountEffect hook | ||
* | ||
* Run an effect only once (on initial mount). | ||
@@ -4,0 +6,0 @@ * Pass an empty array for the dependency list to ensure effect is only fired once. |
import { useEffect } from 'react'; | ||
/** | ||
* useUpdateEffect hook | ||
* | ||
* Run an effect only on updates. | ||
@@ -4,0 +6,0 @@ * Skip the first effect execution that occurrs after initial mount. |
import { useEffect, useRef } from 'react'; | ||
/** | ||
* useUpdateEffect hook | ||
* | ||
* Run an effect only on updates. | ||
@@ -4,0 +6,0 @@ * Skip the first effect execution that occurrs after initial mount. |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components"),n=require("react-window"),o=require("react-dom");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=i(e),r=i(t);const l={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container"},s={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input"},d="top",u="auto",c="bottom",p="any",f=0,m=1,g=0,h=1,b=2,v=3,w=t.keyframes(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),y=t.css([""," 0.25s ease-in-out both"],t.keyframes(["from{opacity:0;}to{opacity:1;}"])),x={index:-1},C=[],O=/[\u0300-\u036f]/g;function S(e){return"boolean"==typeof e}function E(e){return Array.isArray(e)&&!!e.length}function I(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}const M=(e,t=!0)=>{t&&e.preventDefault(),e.stopPropagation()};function k(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(O,"")}(o):o}const z=(e,t,n)=>{const o=Array.isArray(e)?e:I(e)?[e]:C;return E(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},L=(e,t)=>{const n={...e};return Object.keys(t).forEach((o=>{const i=t[o];n[o]="animation"!==o&&I(i)?e[o]?L(e[o],i):i:i||""})),n};function N(e){return R(e)?window.pageYOffset:e.scrollTop}function R(e){return e===document.documentElement||e===document.body||e===window}const D=/(auto|scroll)/;function F({overflow:e,overflowX:t,overflowY:n}){return D.test(`${e}${t}${n}`)}function T(e){let t=getComputedStyle(e);const n=document.documentElement,o="absolute"===t.position;if("fixed"===t.position)return n;for(let n=e;n=null===(i=n)||void 0===i?void 0:i.parentElement;){var i;if(t=getComputedStyle(n),(!o||"static"!==t.position)&&F(t))return n}return n}function V(e,t,n=300,o){let i=0;const a=N(e),r=t-a;requestAnimationFrame((function t(){i+=5;const l=r*((s=(s=i)/n-1)*s*s+1)+a;var s;!function(e,t){R(e)?window.scrollTo(0,t):e.scrollTop=t}(e,l),i<n?requestAnimationFrame(t):null==o||o()}))}const A={color:{border:"#ced4da",danger:"#dc3545",primary:"#007bff",disabled:"#e9ecef",placeholder:"#6E7276",dangerLight:"rgba(220, 53, 69, 0.25)"},input:{},select:{},loader:{size:"0.625rem",padding:"0.375rem 0.75rem",animation:t.css([""," 1.19s ease-in-out infinite"],w),color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 0.9375rem",clear:{width:"14px",height:"16px",animation:y,transition:"color 0.2s ease-out"},caret:{size:"7px",transition:"transform 0.3s ease-in-out, color 0.2s ease-out"}},control:{minHeight:"38px",borderWidth:"1px",borderStyle:"solid",borderRadius:"3px",boxShadow:"0 0 0 0.2rem",padding:"0.375rem 0.75rem",boxShadowColor:"rgba(0, 123, 255, 0.25)",focusedBorderColor:"rgba(0, 123, 255, 0.75)",transition:"box-shadow 0.2s ease-out, border-color 0.2s ease-out"},menu:{padding:"0",width:"100%",margin:"0.5rem 0",borderRadius:"3px",backgroundColor:"#fff",animation:y,boxShadow:"0 0.5em 1em -0.125em rgb(10 10 10 / 12%), 0 0 0 1px rgb(10 10 10 / 4%)",option:{textAlign:"left",selectedColor:"#fff",selectedBgColor:"#007bff",padding:"0.375rem 0.75rem",focusedBgColor:"rgba(0, 123, 255, 0.15)"}},noOptions:{fontSize:"1.25rem",margin:"0.25rem 0",color:"hsl(0, 0%, 60%)",padding:"0.375rem 0.75rem"},placeholder:{animation:y},multiValue:{margin:"1px 2px",borderRadius:"3px",backgroundColor:"#e7edf3",animation:y,label:{borderRadius:"3px",fontSize:"0.825em",padding:"1px 0 1px 6px"},clear:{fontWeight:600,padding:"0 6px",color:"#a6a6a6",fontSize:"0.65em",alignSelf:"center",focusColor:"#808080",transition:"color 0.2s ease-out, transform 0.2s ease-out, z-index 0.2s ease-out"}}},B="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,$="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent),q=e.memo((({index:e,style:t,data:{menuOptions:n,selectOption:o,renderOptionLabel:i,focusedOptionIndex:r}})=>{const{data:l,value:s,label:d,isDisabled:u,isSelected:c}=n[e],p=function(e,t,n){let o="rfs-option";return e&&(o+=" rfs-option-disabled"),t&&(o+=" rfs-option-selected"),n&&(o+=" rfs-option-focused"),o}(u,c,e===r);return a.default.createElement("div",{style:t,onClick:u?void 0:()=>o({data:l,value:s,label:d},c),className:p},i(l))}),n.areEqual);q.displayName="Option";const P=r.default.div.withConfig({displayName:"NoOptionsMsg",componentId:"v1y124-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(({theme:e})=>e.noOptions.color),(({theme:e})=>e.noOptions.margin),(({theme:e})=>e.noOptions.padding),(({theme:e})=>e.noOptions.fontSize),(({theme:e})=>e.noOptions.css)),W=({width:t,height:o,itemSize:i,direction:r,isLoading:l,loadingMsg:s,menuOptions:d,selectOption:u,noOptionsMsg:c,overscanCount:p,itemKeySelector:f,fixedSizeListRef:m,renderOptionLabel:g,focusedOptionIndex:h})=>{const b=e.useMemo((()=>({menuOptions:d,selectOption:u,renderOptionLabel:g,focusedOptionIndex:h})),[d,h,u,g]);if(l)return a.default.createElement(P,null,s);return a.default.createElement(e.Fragment,null,a.default.createElement(n.FixedSizeList,{width:t,height:o,itemKey:f?(e,t)=>t.menuOptions[e][f]:void 0,itemSize:i,itemData:b,direction:r,ref:m,overscanCount:p,itemCount:d.length},q),!E(d)&&c&&a.default.createElement(P,null,c))},j=r.default.div.withConfig({displayName:"MenuWrapper",componentId:"yf5myu-0"})(["z-index:999;cursor:default;position:absolute;"," "," .","{display:block;overflow:hidden;user-select:none;white-space:nowrap;text-overflow:ellipsis;-webkit-tap-highlight-color:transparent;","}"],(({menuTop:e,menuOpen:n,hideNoOptionsMsg:o,theme:{menu:i}})=>t.css(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],i.width,i.margin,i.padding,i.animation,i.borderRadius,i.backgroundColor,o?"none":i.boxShadow,n?"":"display: none;",e?`top: ${e};`:"")),(({theme:e})=>e.menu.css),"rfs-option",(({theme:{menu:{option:e}}})=>t.css(["padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}"],e.padding,e.textAlign,"rfs-option-focused","rfs-option-disabled","rfs-option-selected",e.focusedBgColor,"rfs-option-selected",e.selectedColor,e.selectedBgColor,"rfs-option-disabled"))),K=({menuRef:e,menuTop:t,menuOpen:n,onMenuMouseDown:i,menuPortalTarget:r,...l})=>{const{menuOptions:s,noOptionsMsg:d}=l,u=n&&!Boolean(d)&&!E(s),c=a.default.createElement(j,{ref:e,menuTop:t,menuOpen:n,onMouseDown:i,className:"rfs-menu-container",hideNoOptionsMsg:u},a.default.createElement(W,Object.assign({},l)));return r?o.createPortal(c,r):c},H=t.css(["z-index:5000;transform:scale(1.26);color:",";"],(({theme:e})=>e.multiValue.clear.focusColor)),U=r.default.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-211cx7-0"})(["min-width:0;display:flex;"," ",""],(({theme:{multiValue:e}})=>t.css(["margin:",";animation:",";border-radius:",";background-color:",";"],e.margin,e.animation,e.borderRadius,e.backgroundColor)),(({theme:e})=>e.multiValue.css)),Y=r.default.div.withConfig({displayName:"Label",componentId:"sc-211cx7-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(({theme:e})=>e.multiValue.label.padding),(({theme:e})=>e.multiValue.label.fontSize),(({theme:e})=>e.multiValue.label.borderRadius)),_=r.default.i.withConfig({displayName:"Clear",componentId:"sc-211cx7-2"})(["display:flex;font-style:inherit;"," ",""],(({theme:{multiValue:{clear:e}}})=>t.css(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";:hover{","}"],e.color,e.padding,e.fontSize,e.alignSelf,e.transition,e.fontWeight,H)),(({isFocused:e})=>e&&H)),X=e.memo((({data:e,value:t,isFocused:n,renderOptionLabel:o,removeSelectedOption:i})=>a.default.createElement(U,null,a.default.createElement(Y,null,o(e)),a.default.createElement(_,{isFocused:n,onMouseDown:M,onClick:()=>i(t),onTouchEnd:()=>i(t)},"✖"))));X.displayName="MultiValue";const G=(t,n,o,i,a,r,l,s,d,u,c,f,m)=>{const g=e.useRef(),h=e.useRef(),[b,v]=e.useState(C),w=m?"":n,y=S(f)?f:!!c;return e.useEffect((()=>{g.current=l||(e=>!!e.isDisabled),h.current=s||(({label:e})=>"string"==typeof e?e:`${e}`)}),[l,s]),e.useEffect((()=>{const e=o===p,n=k(w,d,u),l=i.length?new Set(i.map((e=>e.value))):void 0,s=t=>{const o=a(t),i={data:t,value:o,label:r(t),...g.current(t)&&{isDisabled:!0},...(null==l?void 0:l.has(o))&&{isSelected:!0}};if(!(n&&!(t=>{const o=k(h.current(t),d,u);return e?o.indexOf(n)>-1:o.substr(0,n.length)===n})(i)||y&&i.isSelected))return i},{length:c}=t,f=[];for(let e=0;e<c;e++){const n=s(t[e]);n&&f.push(n)}v(f)}),[t,i,w,y,o,d,u,a,r]),b},J=(t,n)=>{const o=e.useRef(!0);e.useEffect((()=>{if(!o.current)return t();o.current=!1}),n)},Q=(t,n,o,i,a,r,l,s,c,p,f,m)=>{const g=e.useRef(),h=e.useRef(),b=e.useRef(!1),v=e.useRef(!s),[w,y]=e.useState(r),[x,C]=e.useState(!1);e.useEffect((()=>{g.current=f,h.current=m}),[f,m]),e.useEffect((()=>{v.current=!x&&!s}),[x,s]),e.useEffect((()=>{const e=i===d||i===u&&!(e=>{if(!e)return!0;const t=T(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-N(t)-n>=o})(t.current);C(e)}),[t,i]),J((()=>{if(o){const e=e=>{var t;null===(t=g.current)||void 0===t||t.call(g),e&&(b.current=!0,y(e))};v.current?((e,t,n,o)=>{if(!e)return void o();const{top:i,height:a,bottom:r}=e.getBoundingClientRect(),l=window.innerHeight;if(l-i>=a)return void o();const s=T(e),d=N(s),u=s.getBoundingClientRect().height-d-i,c=u<a;if(c||!n)return void o(c?u:void 0);V(s,r-l+d+parseInt(getComputedStyle(e).marginBottom,10),t,o)})(t.current,c,p,e):e()}else{var e;null===(e=h.current)||void 0===e||e.call(h),b.current&&(b.current=!1,y(r))}}),[t,o,r,p,c]);const O=Math.min(w,l*a);return[x?((e,t,n)=>{const o=e>0||!t?e:t.getBoundingClientRect().height,i=n?n.getBoundingClientRect().height:0,a=t&&getComputedStyle(t),r=a?parseInt(a.marginBottom,10):0,l=a?parseInt(a.marginTop,10):0;return"calc("+-Math.abs(o+i)+"px + "+(r+l)+"px)"})(O,t.current,n.current):void 0,O]},Z=t.css(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),ee=r.default.div.withConfig({displayName:"SingleValue",componentId:"sc-153h0ct-0"})([""," max-width:calc(100% - 0.5rem);"],Z),te=r.default.div.withConfig({displayName:"Placeholder",componentId:"sc-153h0ct-1"})([""," color:",";",""],Z,(({theme:e})=>e.color.placeholder),(({theme:e,isFirstRender:n})=>!n&&t.css(["animation:",";"],e.placeholder.animation))),ne=e.memo((({isMulti:t,inputValue:n,placeholder:o,selectedOption:i,focusedMultiValue:r,renderOptionLabel:l,renderMultiOptions:s,removeSelectedOption:d})=>{const u=(()=>{const t=e.useRef(!0);return t.current?(t.current=!1,!0):t.current})();return!n||t&&(!t||E(i)&&!s)?E(i)?t?a.default.createElement(e.Fragment,null,s?s({renderOptionLabel:l,selected:i}):i.map((({data:e,value:t})=>a.default.createElement(X,{key:t,data:e,value:t,renderOptionLabel:l,isFocused:t===r,removeSelectedOption:d})))):a.default.createElement(ee,null,l(i[0].data)):a.default.createElement(te,{isFirstRender:u},o):null}));ne.displayName="Value";const oe=r.default.div.withConfig({displayName:"SizerDiv",componentId:"o2ype2-0"})(["top:0;left:0;height:0;overflow:scroll;white-space:pre;position:absolute;visibility:hidden;font-size:inherit;font-weight:inherit;font-family:inherit;",""],(({theme:e})=>e.input.css)),ie=r.default.input.attrs(s).withConfig({displayName:"Input",componentId:"o2ype2-1"})(["border:0;outline:0;padding:0;cursor:text;background:0;color:inherit;font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:content-box;:read-only{opacity:0;cursor:default;}:required{","}"," ",""],(({theme:e,isInvalid:t})=>t&&e.input.cssRequired),(({theme:e})=>e.input.css),$&&"::-ms-clear{display:none;}"),ae=e.memo(e.forwardRef((({id:t,onBlur:n,onFocus:o,readOnly:i,required:r,onChange:l,ariaLabel:s,inputValue:d,ariaLabelledBy:u,selectedOption:c},p)=>{const f=e.useRef(null),[m,g]=e.useState(2),h=!!r&&!E(c);return J((()=>{f.current&&g(f.current.scrollWidth+2)}),[d]),a.default.createElement(e.Fragment,null,a.default.createElement(ie,{id:t,ref:p,isInvalid:!0,onBlur:n,onFocus:o,value:d,readOnly:i,required:h,"aria-label":s,style:{width:m},"aria-labelledby":u,onChange:i?void 0:l}),a.default.createElement(oe,{ref:f},d))})));ae.displayName="AutosizeInput";const re=r.default.span.withConfig({displayName:"A11yText",componentId:"zxgkbx-0"})(["border:0;padding:0;width:1px;height:1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(1px,1px,1px,1px);"]),le=({menuOpen:e,isFocused:t,inputValue:n,optionCount:o,isSearchable:i,focusedOption:r,selectedOption:l,ariaLive:s="polite",ariaLabel:d="Select"})=>{if(!t)return null;const u=` ${o} result(s) available${n?" for search input "+n:""}.`,c=e?"Use Up and Down arrow keys to choose options, press Enter or Tab to select the currently focused option, press Escape to close the menu.":`${d} is focused${i?", type to filter options":""}, press Down arrow key to open the menu.`,{index:p,value:f,label:m,isDisabled:g}=r,h=f?`Focused option: ${m}${g?" - disabled":""}, ${p+1} of ${o}.`:"",b=l.length?l.map((e=>e.label)).join(" "):"N/A";return a.default.createElement(re,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},a.default.createElement("span",{id:"aria-selection"},"Selected option: "+b),a.default.createElement("span",{id:"aria-context"},h+u+c))},se=r.default.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1j9e0pa-0"})(["display:flex;align-self:center;text-align:center;margin-right:0.25rem;padding:",";> div{border-radius:100%;display:inline-block;",":nth-of-type(1){animation-delay:-0.272s;}:nth-of-type(2){animation-delay:-0.136s;}}"],(({theme:e})=>e.loader.padding),(({theme:{loader:e}})=>t.css(["width:",";height:",";animation:",";background-color:",";"],e.size,e.size,e.animation,e.color))),de=()=>a.default.createElement(se,{"aria-hidden":!0,className:"rfs-loading-dots"},a.default.createElement("div",null),a.default.createElement("div",null),a.default.createElement("div",null)),ue=r.default.svg.withConfig({displayName:"ClearSvg",componentId:"sc-1v5ipi2-0"})(["fill:currentColor;",""],(({theme:e})=>t.css(["width:",";height:",";animation:",";transition:",";"],e.icon.clear.width,e.icon.clear.height,e.icon.clear.animation,e.icon.clear.transition))),ce=()=>a.default.createElement(ue,{"aria-hidden":!0,viewBox:"0 0 14 16",className:"rfs-clear-icon"},a.default.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})),pe=r.default.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1561oeb-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),fe=r.default.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1561oeb-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(({theme:e})=>e.icon.color),(({theme:e})=>e.icon.padding),(({theme:e})=>e.icon.hoverColor),(({theme:e})=>e.icon.css)),me=r.default.div.withConfig({displayName:"Caret",componentId:"sc-1561oeb-2"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(({theme:e})=>e.icon.caret.transition),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e,menuOpen:n,isInvalid:o})=>n&&t.css(["transform:rotate(180deg);color:",";"],o?e.color.danger:e.color.caretActive||e.color.primary))),ge=r.default.div.withConfig({displayName:"Separator",componentId:"sc-1561oeb-3"})(["width:1px;margin:0.5rem 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(({theme:e})=>e.color.iconSeparator||e.color.border)),he=e.memo((({menuOpen:e,clearIcon:t,caretIcon:n,isInvalid:o,showClear:i,isLoading:r,isDisabled:l,loadingNode:s,onCaretMouseDown:d,onClearMouseDown:u})=>{const c=t=>"function"==typeof t?t({menuOpen:e,isLoading:r,isInvalid:o,isDisabled:l}):t;return a.default.createElement(pe,null,i&&!r&&a.default.createElement(fe,{onTouchEnd:u,onMouseDown:u},c(t)||a.default.createElement(ce,null)),r&&(s||a.default.createElement(de,null)),a.default.createElement(ge,null),a.default.createElement(fe,{onTouchEnd:d,onMouseDown:d},c(n)||a.default.createElement(me,{"aria-hidden":!0,menuOpen:e,isInvalid:o,className:"rfs-caret-icon"})))}));he.displayName="IndicatorIcons";const be=r.default.div.attrs(l).withConfig({displayName:"SelectWrapper",componentId:"kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(({theme:e})=>e.select.css)),ve=r.default.div.withConfig({displayName:"ValueWrapper",componentId:"kcrmu9-1"})(["flex:1 1 0%;display:flex;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;padding:",";"],(({theme:e})=>e.control.padding)),we=r.default.div.withConfig({displayName:"ControlWrapper",componentId:"kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(({isDisabled:e,isFocused:n,isInvalid:o,theme:{control:i,color:a}})=>t.css(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],i.transition,i.borderStyle,i.borderWidth,i.borderRadius,i.height||i.minHeight,o?a.danger:n?i.focusedBorderColor:a.border,i.height?`height: ${i.height};`:"",e?"pointer-events:none;user-select:none;":"",i.backgroundColor||e?`background-color: ${e?a.disabled:i.backgroundColor};`:"",n?`box-shadow: ${i.boxShadow} ${o?a.dangerLight:i.boxShadowColor};`:"")),(({theme:e})=>e.control.css),(({isFocused:e,theme:t})=>e&&t.control.focusedCss)),ye=e.forwardRef((({async:n,isMulti:o,inputId:i,selectId:r,required:l,ariaLive:s,autoFocus:d,isLoading:u,onKeyDown:w,clearIcon:y,caretIcon:O,isInvalid:k,ariaLabel:N,menuWidth:R,isDisabled:D,inputDelay:F,onMenuOpen:T,onMenuClose:V,onInputBlur:$,isClearable:q,themeConfig:P,loadingNode:W,initialValue:j,onInputFocus:H,onInputChange:U,ariaLabelledBy:Y,onOptionChange:_,onSearchChange:X,getOptionLabel:Z,getOptionValue:ee,itemKeySelector:te,openMenuOnFocus:oe,menuPortalTarget:ie,isAriaLiveEnabled:re,menuOverscanCount:se,blurInputOnSelect:de,menuItemDirection:ue,renderOptionLabel:ce,renderMultiOptions:pe,menuScrollDuration:fe,filterIgnoreAccents:me,hideSelectedOptions:ge,getIsOptionDisabled:ye,getFilterOptionString:xe,isSearchable:Ce=!0,lazyLoadMenu:Oe=!1,openMenuOnClick:Se=!0,filterIgnoreCase:Ee=!0,tabSelectsOption:Ie=!0,closeMenuOnSelect:Me=!0,scrollMenuIntoView:ke=!0,backspaceClearsValue:ze=!0,filterMatchFrom:Le=p,menuPosition:Ne=c,options:Re=C,loadingMsg:De="Loading..",placeholder:Fe="Select option..",noOptionsMsg:Te="No options",menuItemSize:Ve=35,menuMaxHeight:Ae=300},Be)=>{const $e=e.useRef(!1),qe=e.useRef(),Pe=e.useRef(!1),We=e.useRef(),je=e.useRef(),Ke=e.useRef(null),He=e.useRef(null),Ue=e.useRef(null),Ye=e.useRef(null),[_e,Xe]=e.useState(""),[Ge,Je]=e.useState(!1),[Qe,Ze]=e.useState(!1),[et,tt]=e.useState(null),[nt,ot]=e.useState(x),it=e.useMemo((()=>(e=>e&&I(e)?L(A,e):A)(P)),[P]),at=e.useMemo((()=>Z||(e=>e.label)),[Z]),rt=e.useMemo((()=>ee||(e=>e.value)),[ee]),lt=e.useMemo((()=>ce||at),[ce,at]),st=((t,n=0)=>{const[o,i]=e.useState(t);return e.useEffect((()=>{if(n<=0)return;const e=setTimeout((()=>{i(t)}),n);return()=>{clearTimeout(e)}}),[t,n]),n<=0?t:o})(_e,F),[dt,ut]=e.useState((()=>z(j,rt,at))),ct=G(Re,st,Le,dt,rt,at,ye,xe,Ee,me,o,ge,n),[pt,ft]=Q(He,Ye,Ge,Ne,Ve,Ae,ct.length,!!ie,fe,ke,T,V),mt=()=>{var e;return null===(e=Ue.current)||void 0===e?void 0:e.blur()},gt=()=>{var e;return null===(e=Ue.current)||void 0===e?void 0:e.focus()},ht=e=>{var t;return null===(t=Ke.current)||void 0===t?void 0:t.scrollToItem(e)},bt=e.useCallback((e=>{if(!E(ct))return void(!$e.current&&Je(!0));const t=o?-1:ct.findIndex((e=>e.isSelected)),n=t>-1?t:e===v?0:ct.length-1;!$e.current&&Je(!0),ot({index:n,...ct[n]}),ht(n)}),[o,ct]),vt=e.useCallback((e=>{ut((t=>t.filter((t=>t.value!==e))))}),[]),wt=e.useCallback(((e,t)=>{t?o&&vt(e.value):ut((t=>o?[...t,e]:[e]));(S(de)?de:B)?mt():Me&&(Je(!1),Xe(""))}),[o,Me,vt,de]);e.useImperativeHandle(Be,(()=>({empty:!E(dt),menuOpen:Ge,blur:mt,focus:gt,clearValue:()=>{wt.length&&ut(C),nt.data&&ot(x)},setValue:e=>{const t=z(e,rt,at);ut(t)},toggleMenu:e=>{!0===e||void 0===e&&!Ge?(!Qe&>(),bt(v)):mt()}}))),e.useEffect((()=>{d&>()}),[]),e.useEffect((()=>{$e.current=Ge}),[Ge]),e.useEffect((()=>{je.current=_,We.current=X}),[_,X]),e.useEffect((()=>{Qe&&oe&&bt(v)}),[Qe,oe,bt]),e.useEffect((()=>{const{current:e}=We;e&&Pe.current&&(Pe.current=!1,e(st))}),[st]),J((()=>{const{current:e}=je;if(e){e(o?dt.map((e=>e.data)):E(dt)?dt[0].data:null)}}),[o,dt]),J((()=>{const{length:e}=ct,t=e>0&&(n||e!==Re.length||0===qe.current);0===e?ot(x):(1===e||t)&&(ot({index:0,...ct[0]}),ht(0)),qe.current=e}),[n,Re,ct]);const yt=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:i}=nt;e&&!i&&wt({data:e,value:t,label:n},o)},xt=e=>{const t="ArrowDown"===e,n=t?v:b;Ge?(e=>{if(!E(ct))return;const t=e===h?(nt.index+1)%ct.length:nt.index>0?nt.index-1:ct.length-1;et&&tt(null),ot({index:t,...ct[t]}),ht(t)})(t?h:g):bt(n)},Ct=e=>{if(D)return;Qe||gt();const t="INPUT"!==e.currentTarget.tagName;Ge?t&&(Ge&&Je(!1),_e&&Xe("")):Se&&bt(v),t&&e.preventDefault()},Ot=e.useCallback((e=>{null==$||$(e),Ze(!1),Je(!1),Xe("")}),[$]),St=e.useCallback((e=>{null==H||H(e),Ze(!0)}),[H]),Et=e.useCallback((e=>{const t=e.currentTarget.value||"";Pe.current=!0,null==U||U(t),!$e.current&&Je(!0),Xe(t)}),[U]),It=e.useCallback((e=>{ut(C),M(e),gt()}),[]),Mt=e.useCallback((e=>{gt(),$e.current?Je(!1):bt(v),M(e)}),[bt]),kt=!Oe||Oe&&Ge,zt=D||!Ce||!!et,Lt=!(!q||D||!E(dt)),Nt=D||Se?void 0:Mt;return a.default.createElement(t.ThemeProvider,{theme:it},a.default.createElement(be,{id:r,"aria-controls":i,"aria-expanded":Ge,onKeyDown:e=>{if(D)return;if(w&&(w(e,_e,nt),e.defaultPrevented))return;const{key:t}=e;switch(t){case"ArrowDown":case"ArrowUp":xt(t);break;case"ArrowLeft":case"ArrowRight":if(!o||_e||pe)return;(e=>{if(!E(dt))return;let t=-1;const n=dt.length-1,o=et?dt.findIndex((e=>e.value===et)):-1;t=e===f?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const i=t>=0?dt[t].value:null;nt.data&&ot(x),i!==et&&tt(i)})("ArrowLeft"===t?m:f);break;case" ":if(_e)return;if(Ge){if(!nt.data)return;yt()}else bt(v);break;case"Enter":Ge&&229!==e.keyCode&&yt();break;case"Escape":Ge&&(Je(!1),Xe(""));break;case"Tab":if(!Ge||!Ie||!nt.data||e.shiftKey)return;yt();break;case"Delete":case"Backspace":if(_e)return;if(et){const e=dt.findIndex((e=>e.value===et)),t=e>-1&&e<dt.length-1?dt[e+1].value:null;vt(et),tt(t)}else{if(!ze)return;if(!E(dt))break;if(o&&!pe){const{value:e}=dt[dt.length-1];vt(e)}else q&&ut(C)}break;default:return}e.preventDefault()}},a.default.createElement(we,{ref:Ye,isInvalid:k,isFocused:Qe,isDisabled:D,className:"rfs-control-container",onTouchEnd:Ct,onMouseDown:Ct},a.default.createElement(ve,null,a.default.createElement(ne,{isMulti:o,inputValue:_e,placeholder:Fe,selectedOption:dt,focusedMultiValue:et,renderOptionLabel:lt,renderMultiOptions:pe,removeSelectedOption:vt}),a.default.createElement(ae,{id:i,ref:Ue,required:l,ariaLabel:N,inputValue:_e,readOnly:zt,onBlur:Ot,onFocus:St,onChange:Et,ariaLabelledBy:Y,selectedOption:dt})),a.default.createElement(he,{menuOpen:Ge,clearIcon:y,caretIcon:O,isInvalid:k,isLoading:u,showClear:Lt,isDisabled:D,loadingNode:W,onClearMouseDown:It,onCaretMouseDown:Nt})),kt&&a.default.createElement(K,{menuRef:He,menuOpen:Ge,isLoading:u,menuTop:pt,height:ft,itemSize:Ve,loadingMsg:De,menuOptions:ct,fixedSizeListRef:Ke,noOptionsMsg:Te,selectOption:wt,direction:ue,itemKeySelector:te,overscanCount:se,menuPortalTarget:ie,width:R||it.menu.width,onMenuMouseDown:e=>{M(e),gt()},renderOptionLabel:lt,focusedOptionIndex:nt.index}),re&&a.default.createElement(le,{ariaLive:s,menuOpen:Ge,isFocused:Qe,ariaLabel:N,inputValue:_e,isSearchable:Ce,focusedOption:nt,selectedOption:dt,optionCount:ct.length})))}));ye.displayName="Select",exports.Select=ye; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components"),n=require("react-window"),o=require("react-dom");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=i(e),r=i(t);const l={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container"},s={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input"},d="top",u="auto",c="bottom",p="any",m=0,f=1,h=0,g=1,b=2,v=3,w=t.keyframes(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),y=t.css([""," 0.25s ease-in-out"],t.keyframes(["from{opacity:0;}to{opacity:1;}"])),x={index:-1},C=e=>e.label,O=e=>e.value,S=e=>!!e.isDisabled,I=({label:e})=>"string"==typeof e?e:`${e}`,E=[],k=/[\u0300-\u036f]/g;function M(e){return"boolean"==typeof e}function z(e){return Array.isArray(e)&&!!e.length}function L(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}const N=e=>{e.preventDefault(),e.stopPropagation()};function D(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(k,"")}(o):o}const R=(e,t,n)=>{const o=Array.isArray(e)?e:L(e)?[e]:E;return z(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},F=(e,t)=>{const n={...e};return Object.keys(t).forEach((o=>{const i=t[o];n[o]="animation"!==o&&L(i)?e[o]?F(e[o],i):i:i||""})),n},T=/(auto|scroll)/;function V(e){return A(e)?window.pageYOffset:e.scrollTop}function A(e){return e===document.body||e===document.documentElement||e===window}function B({overflow:e,overflowX:t,overflowY:n}){return T.test(`${e}${t}${n}`)}function $(e){let t=getComputedStyle(e);const n=document.documentElement,o="absolute"===t.position;if("fixed"===t.position)return n;for(let n=e;n=null===(i=n)||void 0===i?void 0:i.parentElement;){var i;if(t=getComputedStyle(n),(!o||"static"!==t.position)&&B(t))return n}return n}function q(e,t,n=300,o){let i=0;const a=V(e),r=t-a;requestAnimationFrame((function t(){i+=5;const l=r*((s=(s=i)/n-1)*s*s+1)+a;var s;!function(e,t){A(e)?window.scrollTo(0,t):e.scrollTop=t}(e,l),i<n?requestAnimationFrame(t):null==o||o()}))}const P={color:{border:"#ced4da",danger:"#dc3545",primary:"#007bff",disabled:"#e9ecef",placeholder:"#6E7276",dangerLight:"rgba(220, 53, 69, 0.25)"},input:{},select:{},loader:{size:"0.625rem",padding:"0.375rem 0.75rem",animation:t.css([""," 1.19s ease-in-out infinite"],w),color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 0.9375rem",clear:{width:"14px",height:"16px",animation:y,transition:"color 0.2s ease-out"},caret:{size:"7px",transition:"transform 0.3s ease-in-out, color 0.2s ease-out"}},control:{minHeight:"38px",borderWidth:"1px",borderStyle:"solid",borderRadius:"3px",boxShadow:"0 0 0 0.2rem",padding:"0.375rem 0.75rem",boxShadowColor:"rgba(0, 123, 255, 0.25)",focusedBorderColor:"rgba(0, 123, 255, 0.75)",transition:"box-shadow 0.2s ease-out, border-color 0.2s ease-out"},menu:{padding:"0",width:"100%",margin:"0.5rem 0",borderRadius:"3px",backgroundColor:"#fff",animation:y,boxShadow:"0 0.5em 1em -0.125em rgb(10 10 10 / 12%), 0 0 0 1px rgb(10 10 10 / 4%)",option:{textAlign:"left",selectedColor:"#fff",selectedBgColor:"#007bff",padding:"0.375rem 0.75rem",focusedBgColor:"rgba(0, 123, 255, 0.15)"}},noOptions:{fontSize:"1.25rem",margin:"0.25rem 0",color:"hsl(0, 0%, 60%)",padding:"0.375rem 0.75rem"},placeholder:{animation:y},multiValue:{margin:"1px 2px",borderRadius:"3px",backgroundColor:"#e7edf3",animation:y,label:{borderRadius:"3px",fontSize:"0.825em",padding:"1px 0 1px 6px"},clear:{fontWeight:600,padding:"0 6px",color:"#a6a6a6",fontSize:"0.65em",alignSelf:"center",focusColor:"#808080",transition:"color 0.2s ease-out, transform 0.2s ease-out, z-index 0.2s ease-out"}}},W="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,j="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent),K=(t,n,o,i,a,r,l,s,d=!1,u=!1,c=!1,m=!1,f)=>{const[h,g]=e.useState(E),b=m?"":n,v=M(f)?f:c;return e.useEffect((()=>{const{current:e}=l,{current:n}=s,c=D(b,d,u),m=i.length?new Set(i.map((e=>e.value))):void 0,f=t=>{const i=a(t),l={data:t,value:i,label:r(t),...e(t)&&{isDisabled:!0},...(null==m?void 0:m.has(i))&&{isSelected:!0}};if(!(c&&!(e=>{const t=D(n(e),d,u);return o===p?t.indexOf(c)>-1:t.substr(0,c.length)===c})(l)||v&&l.isSelected))return l},h=t.reduce(((e,t)=>{const n=f(t);return n&&e.push(n),e}),[]);g(h)}),[t,b,a,r,i,o,d,u,l,s,v]),h},H=(t,n)=>{const o=e.useRef(t||n);return e.useEffect((()=>{o.current=t||n}),[t,n]),o},U=(t,n)=>{const o=e.useRef(!0);e.useEffect((()=>{if(!o.current)return t();o.current=!1}),n)},Y=(t,n,o,i,a,r,l,s,c,p,m,f)=>{const h=e.useRef(!1),g=e.useRef(!s),[b,v]=e.useState(r),[w,y]=e.useState(!1);e.useEffect((()=>{g.current=!w&&!s}),[w,s]),e.useEffect((()=>{const e=i===d||i===u&&!(e=>{if(!e)return!0;const t=$(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-V(t)-n>=o})(t.current);y(e)}),[t,i]),U((()=>{if(o){const e=e=>{var t;null===(t=c.current)||void 0===t||t.call(c),e&&(h.current=!0,v(e))};g.current?((e,t,n,o)=>{if(!e)return void o();const{top:i,height:a,bottom:r}=e.getBoundingClientRect(),l=window.innerHeight;if(l-i>=a)return void o();const s=$(e),d=V(s),u=s.getBoundingClientRect().height-d-i,c=u<a;if(c||!n)return void o(c?u:void 0);const p=getComputedStyle(e).marginBottom;q(s,r-l+d+parseInt(p,10),t,o)})(t.current,m,f,e):e()}else{var e;null===(e=p.current)||void 0===e||e.call(p),h.current&&(h.current=!1,v(r))}}),[t,o,r,f,m,p,c]);const x=Math.min(b,l*a);return[w?((e,t,n)=>{const o=e>0||!t?e:t.getBoundingClientRect().height,i=n?n.getBoundingClientRect().height:0,a=t&&getComputedStyle(t),r=a?parseInt(a.marginBottom,10):0,l=a?parseInt(a.marginTop,10):0;return`calc(${-Math.abs(o+i)}px + ${r+l}px)`})(x,t.current,n.current):void 0,x]},_=e.memo((({index:e,style:t,data:{menuOptions:n,selectOption:o,renderOptionLabel:i,focusedOptionIndex:r}})=>{const{data:l,value:s,label:d,isDisabled:u,isSelected:c}=n[e],p=function(e,t,n){let o="rfs-option";return e&&(o+=" rfs-option-disabled"),t&&(o+=" rfs-option-selected"),n&&(o+=" rfs-option-focused"),o}(u,c,e===r);return a.default.createElement("div",{style:t,onClick:u?void 0:()=>o({data:l,value:s,label:d},c),className:p},i(l))}),n.areEqual);_.displayName="Option";const X=r.default.div.withConfig({displayName:"NoOptionsMsg",componentId:"v1y124-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(({theme:e})=>e.noOptions.color),(({theme:e})=>e.noOptions.margin),(({theme:e})=>e.noOptions.padding),(({theme:e})=>e.noOptions.fontSize),(({theme:e})=>e.noOptions.css)),G=({width:t,height:o,itemSize:i,direction:r,isLoading:l,loadingMsg:s,menuOptions:d,selectOption:u,noOptionsMsg:c,overscanCount:p,itemKeySelector:m,fixedSizeListRef:f,renderOptionLabel:h,focusedOptionIndex:g})=>{const b=e.useMemo((()=>({menuOptions:d,selectOption:u,renderOptionLabel:h,focusedOptionIndex:g})),[d,g,u,h]);if(l)return a.default.createElement(X,null,s);return a.default.createElement(e.Fragment,null,a.default.createElement(n.FixedSizeList,{width:t,height:o,itemKey:m?(e,t)=>t.menuOptions[e][m]:void 0,itemSize:i,itemData:b,direction:r,ref:f,overscanCount:p,itemCount:d.length},_),!z(d)&&c&&a.default.createElement(X,null,c))},J=r.default.div.withConfig({displayName:"MenuWrapper",componentId:"yf5myu-0"})(["z-index:999;cursor:default;position:absolute;"," "," .","{display:block;overflow:hidden;user-select:none;white-space:nowrap;text-overflow:ellipsis;-webkit-tap-highlight-color:transparent;padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}}"],(({menuTop:e,menuOpen:n,hideNoOptionsMsg:o,theme:{menu:i}})=>t.css(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],i.width,i.margin,i.padding,i.animation,i.borderRadius,i.backgroundColor,o?"none":i.boxShadow,n?"":"display: none;",e?`top: ${e};`:"")),(({theme:e})=>e.menu.css),"rfs-option",(({theme:e})=>e.menu.option.padding),(({theme:e})=>e.menu.option.textAlign),"rfs-option-focused","rfs-option-disabled","rfs-option-selected",(({theme:e})=>e.menu.option.focusedBgColor),"rfs-option-selected",(({theme:e})=>e.menu.option.selectedColor),(({theme:e})=>e.menu.option.selectedBgColor),"rfs-option-disabled"),Q=({menuRef:e,menuTop:t,menuOpen:n,onMenuMouseDown:i,menuPortalTarget:r,...l})=>{const{menuOptions:s,noOptionsMsg:d}=l,u=n&&!Boolean(d)&&!z(s),c=a.default.createElement(J,{ref:e,menuTop:t,menuOpen:n,onMouseDown:i,className:"rfs-menu-container",hideNoOptionsMsg:u},a.default.createElement(G,Object.assign({},l)));return r?o.createPortal(c,r):c},Z=t.css(["z-index:5000;transform:scale(1.26);color:",";"],(({theme:e})=>e.multiValue.clear.focusColor)),ee=r.default.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-211cx7-0"})(["min-width:0;display:flex;"," ",""],(({theme:{multiValue:e}})=>t.css(["margin:",";animation:",";border-radius:",";background-color:",";"],e.margin,e.animation,e.borderRadius,e.backgroundColor)),(({theme:e})=>e.multiValue.css)),te=r.default.div.withConfig({displayName:"Label",componentId:"sc-211cx7-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(({theme:e})=>e.multiValue.label.padding),(({theme:e})=>e.multiValue.label.fontSize),(({theme:e})=>e.multiValue.label.borderRadius)),ne=r.default.i.withConfig({displayName:"Clear",componentId:"sc-211cx7-2"})(["display:flex;font-style:inherit;"," ",""],(({theme:{multiValue:{clear:e}}})=>t.css(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";:hover{","}"],e.color,e.padding,e.fontSize,e.alignSelf,e.transition,e.fontWeight,Z)),(({isFocused:e})=>e&&Z)),oe=e.memo((({data:e,value:t,isFocused:n,renderOptionLabel:o,removeSelectedOption:i})=>{const r=()=>i(t);return a.default.createElement(ee,null,a.default.createElement(te,null,o(e)),a.default.createElement(ne,{isFocused:n,onClick:r,onTouchEnd:r,onMouseDown:N},"✖"))}));oe.displayName="MultiValue";const ie=t.css(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),ae=r.default.div.withConfig({displayName:"SingleValue",componentId:"sc-153h0ct-0"})([""," max-width:calc(100% - 0.5rem);"],ie),re=r.default.div.withConfig({displayName:"Placeholder",componentId:"sc-153h0ct-1"})([""," color:",";",""],ie,(({theme:e})=>e.color.placeholder),(({theme:e,isFirstRender:n})=>!n&&t.css(["animation:",";"],e.placeholder.animation))),le=e.memo((({isMulti:t,inputValue:n,placeholder:o,selectedOption:i,focusedMultiValue:r,renderOptionLabel:l,renderMultiOptions:s,removeSelectedOption:d})=>{const u=(()=>{const t=e.useRef(!0);return t.current?(t.current=!1,!0):t.current})();return!n||t&&(!t||z(i)&&!s)?z(i)?t?a.default.createElement(e.Fragment,null,s?s({renderOptionLabel:l,selected:i}):i.map((({data:e,value:t})=>a.default.createElement(oe,{key:t,data:e,value:t,renderOptionLabel:l,isFocused:t===r,removeSelectedOption:d})))):a.default.createElement(ae,null,l(i[0].data)):a.default.createElement(re,{isFirstRender:u},o):null}));le.displayName="Value";const se=r.default.div.withConfig({displayName:"SizerDiv",componentId:"o2ype2-0"})(["top:0;left:0;height:0;overflow:scroll;white-space:pre;position:absolute;visibility:hidden;font-size:inherit;font-weight:inherit;font-family:inherit;",""],(({theme:e})=>e.input.css)),de=r.default.input.attrs(s).withConfig({displayName:"Input",componentId:"o2ype2-1"})(["border:0;outline:0;padding:0;cursor:text;background:0;color:inherit;font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:content-box;:read-only{opacity:0;cursor:default;}:required{","}"," ",""],(({theme:e,isInvalid:t})=>t&&e.input.cssRequired),(({theme:e})=>e.input.css),j&&"::-ms-clear{display:none;}"),ue=e.memo(e.forwardRef((({id:t,onBlur:n,onFocus:o,readOnly:i,required:r,onChange:l,ariaLabel:s,inputValue:d,ariaLabelledBy:u,hasSelectedOptions:c},p)=>{const m=e.useRef(null),[f,h]=e.useState(2),g=!!r&&!c;return U((()=>{m.current&&h(m.current.scrollWidth+2)}),[d]),a.default.createElement(e.Fragment,null,a.default.createElement(de,{id:t,ref:p,isInvalid:!0,onBlur:n,onFocus:o,value:d,readOnly:i,required:g,"aria-label":s,style:{width:f},"aria-labelledby":u,onChange:i?void 0:l}),a.default.createElement(se,{ref:m},d))})));ue.displayName="AutosizeInput";const ce=r.default.span.withConfig({displayName:"A11yText",componentId:"zxgkbx-0"})(["border:0;padding:0;width:1px;height:1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(1px,1px,1px,1px);"]),pe=({menuOpen:e,isFocused:t,inputValue:n,optionCount:o,isSearchable:i,focusedOption:r,selectedOption:l,ariaLive:s="polite",ariaLabel:d="Select"})=>{if(!t)return null;const u=` ${o} result(s) available${n?" for search input "+n:""}.`,c=e?"Use Up and Down arrow keys to choose options, press Enter or Tab to select the currently focused option, press Escape to close the menu.":`${d} is focused${i?", type to filter options":""}, press Down arrow key to open the menu.`,{index:p,value:m,label:f,isDisabled:h}=r,g=m?`Focused option: ${f}${h?" - disabled":""}, ${p+1} of ${o}.`:"",b="Selected option: "+(l.length?l.map((e=>e.label)).join(" "):"N/A"),v=`${g} ${u} ${c}`.trimStart();return a.default.createElement(ce,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},a.default.createElement("span",{id:"aria-selection"},b),a.default.createElement("span",{id:"aria-context"},v))},me=r.default.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1j9e0pa-0"})(["display:flex;align-self:center;text-align:center;margin-right:0.25rem;padding:",";> div{border-radius:100%;display:inline-block;",":nth-of-type(1){animation-delay:-0.272s;}:nth-of-type(2){animation-delay:-0.136s;}}"],(({theme:e})=>e.loader.padding),(({theme:{loader:e}})=>t.css(["width:",";height:",";animation:",";background-color:",";"],e.size,e.size,e.animation,e.color))),fe=()=>a.default.createElement(me,{"aria-hidden":!0,className:"rfs-loading-dots"},a.default.createElement("div",null),a.default.createElement("div",null),a.default.createElement("div",null)),he=r.default.svg.withConfig({displayName:"ClearSvg",componentId:"sc-1v5ipi2-0"})(["fill:currentColor;",""],(({theme:e})=>t.css(["width:",";height:",";animation:",";transition:",";"],e.icon.clear.width,e.icon.clear.height,e.icon.clear.animation,e.icon.clear.transition))),ge=()=>a.default.createElement(he,{"aria-hidden":!0,viewBox:"0 0 14 16",className:"rfs-clear-icon"},a.default.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})),be=r.default.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1561oeb-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),ve=r.default.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1561oeb-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(({theme:e})=>e.icon.color),(({theme:e})=>e.icon.padding),(({theme:e})=>e.icon.hoverColor),(({theme:e})=>e.icon.css)),we=r.default.div.withConfig({displayName:"Caret",componentId:"sc-1561oeb-2"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(({theme:e})=>e.icon.caret.transition),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e,menuOpen:n,isInvalid:o})=>n&&t.css(["transform:rotate(180deg);color:",";"],o?e.color.danger:e.color.caretActive||e.color.primary))),ye=r.default.div.withConfig({displayName:"Separator",componentId:"sc-1561oeb-3"})(["width:1px;margin:0.5rem 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(({theme:e})=>e.color.iconSeparator||e.color.border)),xe=e.memo((({menuOpen:e,clearIcon:t,caretIcon:n,isInvalid:o,showClear:i,isLoading:r,isDisabled:l,loadingNode:s,onCaretMouseDown:d,onClearMouseDown:u})=>{const c=t=>"function"==typeof t?t({menuOpen:e,isLoading:r,isInvalid:o,isDisabled:l}):t;return a.default.createElement(be,null,i&&!r&&a.default.createElement(ve,{onTouchEnd:u,onMouseDown:u},c(t)||a.default.createElement(ge,null)),r&&(s||a.default.createElement(fe,null)),a.default.createElement(ye,null),a.default.createElement(ve,{onTouchEnd:d,onMouseDown:d},c(n)||a.default.createElement(we,{"aria-hidden":!0,menuOpen:e,isInvalid:o,className:"rfs-caret-icon"})))}));xe.displayName="IndicatorIcons";const Ce=r.default.div.attrs(l).withConfig({displayName:"SelectWrapper",componentId:"kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(({theme:e})=>e.select.css)),Oe=r.default.div.withConfig({displayName:"ValueWrapper",componentId:"kcrmu9-1"})(["flex:1 1 0%;display:flex;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;padding:",";"],(({theme:e})=>e.control.padding)),Se=r.default.div.withConfig({displayName:"ControlWrapper",componentId:"kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(({isDisabled:e,isFocused:n,isInvalid:o,theme:{control:i,color:a}})=>t.css(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],i.transition,i.borderStyle,i.borderWidth,i.borderRadius,i.height||i.minHeight,o?a.danger:n?i.focusedBorderColor:a.border,i.height?`height: ${i.height};`:"",e?"pointer-events:none;user-select:none;":"",i.backgroundColor||e?`background-color: ${e?a.disabled:i.backgroundColor};`:"",n?`box-shadow: ${i.boxShadow} ${o?a.dangerLight:i.boxShadowColor};`:"")),(({theme:e})=>e.control.css),(({isFocused:e,theme:t})=>e&&t.control.focusedCss)),Ie=e.forwardRef((({async:n,isMulti:o,inputId:i,selectId:r,required:l,ariaLive:s,autoFocus:d,isLoading:u,onKeyDown:w,clearIcon:y,caretIcon:k,isInvalid:D,ariaLabel:T,menuWidth:V,isDisabled:A,inputDelay:B,onMenuOpen:$,onMenuClose:q,onInputBlur:j,isClearable:_,themeConfig:X,loadingNode:G,initialValue:J,onInputFocus:Z,onInputChange:ee,ariaLabelledBy:te,onOptionChange:ne,onSearchChange:oe,getOptionLabel:ie,getOptionValue:ae,itemKeySelector:re,openMenuOnFocus:se,menuPortalTarget:de,isAriaLiveEnabled:ce,menuOverscanCount:me,blurInputOnSelect:fe,menuItemDirection:he,renderOptionLabel:ge,renderMultiOptions:be,menuScrollDuration:ve,filterIgnoreAccents:we,hideSelectedOptions:ye,getIsOptionDisabled:Ie,getFilterOptionString:Ee,isSearchable:ke=!0,lazyLoadMenu:Me=!1,openMenuOnClick:ze=!0,filterIgnoreCase:Le=!0,tabSelectsOption:Ne=!0,closeMenuOnSelect:De=!0,scrollMenuIntoView:Re=!0,backspaceClearsValue:Fe=!0,filterMatchFrom:Te=p,menuPosition:Ve=c,options:Ae=E,loadingMsg:Be="Loading..",placeholder:$e="Select option..",noOptionsMsg:qe="No options",menuItemSize:Pe=35,menuMaxHeight:We=300},je)=>{const Ke=e.useRef(!1),He=e.useRef(),Ue=e.useRef(!1),Ye=e.useRef(null),_e=e.useRef(null),Xe=e.useRef(null),Ge=e.useRef(null),[Je,Qe]=e.useState(""),[Ze,et]=e.useState(!1),[tt,nt]=e.useState(!1),[ot,it]=e.useState(null),[at,rt]=e.useState(x),lt=e.useMemo((()=>(e=>e&&L(e)?F(P,e):P)(X)),[X]),st=H($),dt=H(q),ut=H(oe),ct=H(ne),pt=H(Ie,S),mt=H(Ee,I),ft=e.useMemo((()=>ie||C),[ie]),ht=e.useMemo((()=>ae||O),[ae]),gt=e.useMemo((()=>ge||ft),[ge,ft]),bt=((t,n=0)=>{const[o,i]=e.useState(t);return e.useEffect((()=>{if(n<=0)return;const e=setTimeout((()=>{i(t)}),n);return()=>{clearTimeout(e)}}),[t,n]),n<=0?t:o})(Je,B),[vt,wt]=e.useState((()=>R(J,ht,ft))),yt=K(Ae,bt,Te,vt,ht,ft,pt,mt,Le,we,o,n,ye),[xt,Ct]=Y(_e,Ge,Ze,Ve,Pe,We,yt.length,!!de,st,dt,ve,Re),Ot=()=>{var e;return null===(e=Xe.current)||void 0===e?void 0:e.blur()},St=()=>{var e;return null===(e=Xe.current)||void 0===e?void 0:e.focus()},It=e=>{var t;return null===(t=Ye.current)||void 0===t?void 0:t.scrollToItem(e)},Et=e.useCallback((e=>{if(!z(yt))return void(!Ke.current&&et(!0));const t=o?-1:yt.findIndex((e=>e.isSelected)),n=t>-1?t:e===v?0:yt.length-1;!Ke.current&&et(!0),rt({index:n,...yt[n]}),It(n)}),[o,yt]),kt=e.useCallback((e=>{wt((t=>t.filter((t=>t.value!==e))))}),[]),Mt=e.useCallback(((e,t)=>{t?o&&kt(e.value):wt((t=>o?[...t,e]:[e]));(M(fe)?fe:W)?Ot():De&&(et(!1),Qe(""))}),[o,De,kt,fe]),zt=z(vt);e.useImperativeHandle(je,(()=>({empty:!zt,menuOpen:Ke.current,blur:Ot,focus:St,clearValue:()=>{wt(E),rt(x)},setValue:e=>{const t=R(e,ht,ft);wt(t)},toggleMenu:e=>{!0===e||void 0===e&&!Ke.current?(St(),Et(v)):Ot()}})),[zt,ht,ft,Et]),e.useEffect((()=>{d&&St()}),[]),e.useEffect((()=>{Ke.current=Ze}),[Ze]),e.useEffect((()=>{tt&&se&&Et(v)}),[tt,se,Et]),e.useEffect((()=>{const{current:e}=ut;e&&Ue.current&&(Ue.current=!1,e(bt))}),[bt]),U((()=>{const{current:e}=ct;if(e){e(o?vt.map((e=>e.data)):z(vt)?vt[0].data:null)}}),[o,vt]),U((()=>{const{length:e}=yt,t=e>0&&(n||e!==Ae.length||0===He.current);0===e?rt(x):(1===e||t)&&(rt({index:0,...yt[0]}),It(0)),He.current=e}),[n,Ae,yt]);const Lt=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:i}=at;e&&!i&&Mt({data:e,value:t,label:n},o)},Nt=e=>{const t="ArrowDown"===e,n=t?v:b;Ze?(e=>{if(!z(yt))return;const t=e===g?(at.index+1)%yt.length:at.index>0?at.index-1:yt.length-1;ot&&it(null),rt({index:t,...yt[t]}),It(t)})(t?g:h):Et(n)},Dt=e=>{if(A)return;tt||St();const t="INPUT"!==e.currentTarget.tagName;Ze?t&&(Ze&&et(!1),Je&&Qe("")):ze&&Et(v),t&&e.preventDefault()},Rt=e.useCallback((e=>{null==j||j(e),nt(!1),et(!1),Qe("")}),[j]),Ft=e.useCallback((e=>{null==Z||Z(e),nt(!0)}),[Z]),Tt=e.useCallback((e=>{Ue.current=!0;const t=e.currentTarget.value||"";null==ee||ee(t),Qe(t),!Ke.current&&et(!0)}),[ee]),Vt=e.useCallback((e=>{St(),Ke.current?et(!1):Et(v),N(e)}),[Et]),At=e.useCallback((e=>{St(),wt(E),N(e)}),[]),Bt=!Me||Me&&Ze,$t=!(!_||A||!zt),qt=A||!ke||!!ot,Pt=A||ze?void 0:Vt;return a.default.createElement(t.ThemeProvider,{theme:lt},a.default.createElement(Ce,{id:r,"aria-controls":i,"aria-expanded":Ze,onKeyDown:e=>{if(!(A||w&&(w(e,Je,at),e.defaultPrevented))){switch(e.key){case"ArrowDown":case"ArrowUp":Nt(e.key);break;case"ArrowLeft":case"ArrowRight":if(!o||Je||be)return;(e=>{if(!zt)return;let t=-1;const n=vt.length-1,o=ot?vt.findIndex((e=>e.value===ot)):-1;t=e===m?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const i=t>=0?vt[t].value:null;at.data&&rt(x),i!==ot&&it(i)})("ArrowLeft"===e.key?f:m);break;case" ":if(Je)return;if(Ze){if(!at.data)return;Lt()}else Et(v);break;case"Enter":Ze&&229!==e.keyCode&&Lt();break;case"Escape":Ze&&(et(!1),Qe(""));break;case"Tab":if(!Ze||!Ne||!at.data||e.shiftKey)return;Lt();break;case"Delete":case"Backspace":if(Je)return;if(ot){const e=vt.findIndex((e=>e.value===ot)),t=e>-1&&e<vt.length-1?vt[e+1].value:null;kt(ot),it(t)}else{if(!Fe)return;if(!zt)break;if(o&&!be){const{value:e}=vt[vt.length-1];kt(e)}else _&&wt(E)}break;default:return}e.preventDefault()}}},a.default.createElement(Se,{ref:Ge,isInvalid:D,isFocused:tt,isDisabled:A,className:"rfs-control-container",onTouchEnd:Dt,onMouseDown:Dt},a.default.createElement(Oe,null,a.default.createElement(le,{isMulti:o,inputValue:Je,placeholder:$e,selectedOption:vt,focusedMultiValue:ot,renderMultiOptions:be,renderOptionLabel:gt,removeSelectedOption:kt}),a.default.createElement(ue,{id:i,ref:Xe,required:l,ariaLabel:T,inputValue:Je,readOnly:qt,onBlur:Rt,onFocus:Ft,onChange:Tt,ariaLabelledBy:te,hasSelectedOptions:zt})),a.default.createElement(xe,{menuOpen:Ze,clearIcon:y,caretIcon:k,isInvalid:D,isLoading:u,showClear:$t,isDisabled:A,loadingNode:G,onClearMouseDown:At,onCaretMouseDown:Pt})),Bt&&a.default.createElement(Q,{menuRef:_e,menuOpen:Ze,isLoading:u,menuTop:xt,height:Ct,itemSize:Pe,loadingMsg:Be,menuOptions:yt,fixedSizeListRef:Ye,noOptionsMsg:qe,selectOption:Mt,direction:he,itemKeySelector:re,overscanCount:me,menuPortalTarget:de,width:V||lt.menu.width,onMenuMouseDown:e=>{N(e),St()},renderOptionLabel:gt,focusedOptionIndex:at.index}),ce&&a.default.createElement(pe,{ariaLive:s,menuOpen:Ze,isFocused:tt,ariaLabel:T,inputValue:Je,isSearchable:ke,focusedOption:at,selectedOption:vt,optionCount:yt.length})))}));Ie.displayName="Select",exports.Select=Ie; |
@@ -1,2 +0,2 @@ | ||
export { Select } from './Select'; | ||
export { default as Select } from './Select'; | ||
export type { Theme, SelectRef, MenuOption, MultiParams, SelectProps } from './Select'; |
@@ -1,1 +0,1 @@ | ||
import e from"@babel/runtime/helpers/esm/defineProperty";import t,{memo as n,useMemo as o,Fragment as r,useState as i,useEffect as a,useRef as l,forwardRef as s,useCallback as c,useImperativeHandle as d}from"react";import u,{css as p,keyframes as m,ThemeProvider as f}from"styled-components";import g from"@babel/runtime/helpers/esm/objectWithoutProperties";import{areEqual as h,FixedSizeList as b}from"react-window";import{createPortal as v}from"react-dom";const y={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container"},w={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input"},O="top",x="auto",C="bottom",I="any",S=0,E=1,D=0,M=1,k=2,z=3,N=m(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),L=p([""," 0.25s ease-in-out both"],m(["from{opacity:0;}to{opacity:1;}"])),j={index:-1},P=[];function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}const V=/[\u0300-\u036f]/g;function A(e){return"boolean"==typeof e}function B(e){return Array.isArray(e)&&!!e.length}function R(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}const F=(e,t=!0)=>{t&&e.preventDefault(),e.stopPropagation()};function $(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(V,"")}(o):o}const W=(e,t,n)=>{const o=Array.isArray(e)?e:R(e)?[e]:P;return B(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},q=(t,n)=>{const o=function(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?T(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):T(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}({},t);return Object.keys(n).forEach((e=>{const r=n[e];o[e]="animation"!==e&&R(r)?t[e]?q(t[e],r):r:r||""})),o};function K(e){return H(e)?window.pageYOffset:e.scrollTop}function H(e){return e===document.documentElement||e===document.body||e===window}const U=/(auto|scroll)/;function Y({overflow:e,overflowX:t,overflowY:n}){return U.test(`${e}${t}${n}`)}function X(e){let t=getComputedStyle(e);const n=document.documentElement,o="absolute"===t.position;if("fixed"===t.position)return n;for(let n=e;n=null===(r=n)||void 0===r?void 0:r.parentElement;){var r;if(t=getComputedStyle(n),(!o||"static"!==t.position)&&Y(t))return n}return n}function G(e,t,n=300,o){let r=0;const i=K(e),a=t-i;requestAnimationFrame((function t(){r+=5;const l=a*((s=(s=r)/n-1)*s*s+1)+i;var s;!function(e,t){H(e)?window.scrollTo(0,t):e.scrollTop=t}(e,l),r<n?requestAnimationFrame(t):null==o||o()}))}const J={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.5rem 0",borderRadius:"3px",backgroundColor:"#fff",animation:L,boxShadow:"0 0.5em 1em -0.125em rgb(10 10 10 / 12%), 0 0 0 1px rgb(10 10 10 / 4%)",option:{textAlign:"left",selectedColor:"#fff",selectedBgColor:"#007bff",padding:"0.375rem 0.75rem",focusedBgColor:"rgba(0, 123, 255, 0.15)"}},noOptions:{fontSize:"1.25rem",margin:"0.25rem 0",color:"hsl(0, 0%, 60%)",padding:"0.375rem 0.75rem"},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, transform 0.2s ease-out, z-index 0.2s ease-out"}}},Q="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,Z="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent),_=n((({index:e,style:n,data:{menuOptions:o,selectOption:r,renderOptionLabel:i,focusedOptionIndex:a}})=>{const{data:l,value:s,label:c,isDisabled:d,isSelected:u}=o[e],p=function(e,t,n){let o="rfs-option";return e&&(o+=" rfs-option-disabled"),t&&(o+=" rfs-option-selected"),n&&(o+=" rfs-option-focused"),o}(d,u,e===a);return t.createElement("div",{style:n,onClick:d?void 0:()=>r({data:l,value:s,label:c},u),className:p},i(l))}),h);_.displayName="Option";const ee=u.div.withConfig({displayName:"NoOptionsMsg",componentId:"v1y124-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(({theme:e})=>e.noOptions.color),(({theme:e})=>e.noOptions.margin),(({theme:e})=>e.noOptions.padding),(({theme:e})=>e.noOptions.fontSize),(({theme:e})=>e.noOptions.css)),te=({width:e,height:n,itemSize:i,direction:a,isLoading:l,loadingMsg:s,menuOptions:c,selectOption:d,noOptionsMsg:u,overscanCount:p,itemKeySelector:m,fixedSizeListRef:f,renderOptionLabel:g,focusedOptionIndex:h})=>{const v=o((()=>({menuOptions:c,selectOption:d,renderOptionLabel:g,focusedOptionIndex:h})),[c,h,d,g]);if(l)return t.createElement(ee,null,s);return t.createElement(r,null,t.createElement(b,{width:e,height:n,itemKey:m?(e,t)=>t.menuOptions[e][m]:void 0,itemSize:i,itemData:v,direction:a,ref:f,overscanCount:p,itemCount:c.length},_),!B(c)&&u&&t.createElement(ee,null,u))},ne=u.div.withConfig({displayName:"MenuWrapper",componentId:"yf5myu-0"})(["z-index:999;cursor:default;position:absolute;"," "," .","{display:block;overflow:hidden;user-select:none;white-space:nowrap;text-overflow:ellipsis;-webkit-tap-highlight-color:transparent;","}"],(({menuTop:e,menuOpen:t,hideNoOptionsMsg:n,theme:{menu:o}})=>p(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],o.width,o.margin,o.padding,o.animation,o.borderRadius,o.backgroundColor,n?"none":o.boxShadow,t?"":"display: none;",e?`top: ${e};`:"")),(({theme:e})=>e.menu.css),"rfs-option",(({theme:{menu:{option:e}}})=>p(["padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}"],e.padding,e.textAlign,"rfs-option-focused","rfs-option-disabled","rfs-option-selected",e.focusedBgColor,"rfs-option-selected",e.selectedColor,e.selectedBgColor,"rfs-option-disabled"))),oe=e=>{let{menuRef:n,menuTop:o,menuOpen:r,onMenuMouseDown:i,menuPortalTarget:a}=e,l=g(e,["menuRef","menuTop","menuOpen","onMenuMouseDown","menuPortalTarget"]);const{menuOptions:s,noOptionsMsg:c}=l,d=r&&!Boolean(c)&&!B(s),u=t.createElement(ne,{ref:n,menuTop:o,menuOpen:r,onMouseDown:i,className:"rfs-menu-container",hideNoOptionsMsg:d},t.createElement(te,Object.assign({},l)));return a?v(u,a):u},re=p(["z-index:5000;transform:scale(1.26);color:",";"],(({theme:e})=>e.multiValue.clear.focusColor)),ie=u.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-211cx7-0"})(["min-width:0;display:flex;"," ",""],(({theme:{multiValue:e}})=>p(["margin:",";animation:",";border-radius:",";background-color:",";"],e.margin,e.animation,e.borderRadius,e.backgroundColor)),(({theme:e})=>e.multiValue.css)),ae=u.div.withConfig({displayName:"Label",componentId:"sc-211cx7-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(({theme:e})=>e.multiValue.label.padding),(({theme:e})=>e.multiValue.label.fontSize),(({theme:e})=>e.multiValue.label.borderRadius)),le=u.i.withConfig({displayName:"Clear",componentId:"sc-211cx7-2"})(["display:flex;font-style:inherit;"," ",""],(({theme:{multiValue:{clear:e}}})=>p(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";:hover{","}"],e.color,e.padding,e.fontSize,e.alignSelf,e.transition,e.fontWeight,re)),(({isFocused:e})=>e&&re)),se=n((({data:e,value:n,isFocused:o,renderOptionLabel:r,removeSelectedOption:i})=>t.createElement(ie,null,t.createElement(ae,null,r(e)),t.createElement(le,{isFocused:o,onMouseDown:F,onClick:()=>i(n),onTouchEnd:()=>i(n)},"✖"))));se.displayName="MultiValue";function ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function de(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?ce(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):ce(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}const ue=(e,t,n,o,r,s,c,d,u,p,m,f,g)=>{const h=l(),b=l(),[v,y]=i(P),w=g?"":t,O=A(f)?f:!!m;return a((()=>{h.current=c||(e=>!!e.isDisabled),b.current=d||(({label:e})=>"string"==typeof e?e:`${e}`)}),[c,d]),a((()=>{const t=n===I,i=$(w,u,p),a=o.length?new Set(o.map((e=>e.value))):void 0,l=e=>{const n=r(e),o=de(de({data:e,value:n,label:s(e)},h.current(e)&&{isDisabled:!0}),(null==a?void 0:a.has(n))&&{isSelected:!0});if(!(i&&!(e=>{const n=$(b.current(e),u,p);return t?n.indexOf(i)>-1:n.substr(0,i.length)===i})(o)||O&&o.isSelected))return o},{length:c}=e,d=[];for(let t=0;t<c;t++){const n=l(e[t]);n&&d.push(n)}y(d)}),[e,o,w,O,n,u,p,r,s]),v},pe=(e,t)=>{const n=l(!0);a((()=>{if(!n.current)return e();n.current=!1}),t)},me=(e,t,n,o,r,s,c,d,u,p,m,f)=>{const g=l(),h=l(),b=l(!1),v=l(!d),[y,w]=i(s),[C,I]=i(!1);a((()=>{g.current=m,h.current=f}),[m,f]),a((()=>{v.current=!C&&!d}),[C,d]),a((()=>{const t=o===O||o===x&&!(e=>{if(!e)return!0;const t=X(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-K(t)-n>=o})(e.current);I(t)}),[e,o]),pe((()=>{if(n){const t=e=>{var t;null===(t=g.current)||void 0===t||t.call(g),e&&(b.current=!0,w(e))};v.current?((e,t,n,o)=>{if(!e)return void o();const{top:r,height:i,bottom:a}=e.getBoundingClientRect(),l=window.innerHeight;if(l-r>=i)return void o();const s=X(e),c=K(s),d=s.getBoundingClientRect().height-c-r,u=d<i;if(u||!n)return void o(u?d:void 0);G(s,a-l+c+parseInt(getComputedStyle(e).marginBottom,10),t,o)})(e.current,u,p,t):t()}else{var t;null===(t=h.current)||void 0===t||t.call(h),b.current&&(b.current=!1,w(s))}}),[e,n,s,p,u]);const S=Math.min(y,c*r);return[C?((e,t,n)=>{const o=e>0||!t?e:t.getBoundingClientRect().height,r=n?n.getBoundingClientRect().height:0,i=t&&getComputedStyle(t),a=i?parseInt(i.marginBottom,10):0,l=i?parseInt(i.marginTop,10):0;return"calc("+-Math.abs(o+r)+"px + "+(a+l)+"px)"})(S,e.current,t.current):void 0,S]},fe=p(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),ge=u.div.withConfig({displayName:"SingleValue",componentId:"sc-153h0ct-0"})([""," max-width:calc(100% - 0.5rem);"],fe),he=u.div.withConfig({displayName:"Placeholder",componentId:"sc-153h0ct-1"})([""," color:",";",""],fe,(({theme:e})=>e.color.placeholder),(({theme:e,isFirstRender:t})=>!t&&p(["animation:",";"],e.placeholder.animation))),be=n((({isMulti:e,inputValue:n,placeholder:o,selectedOption:i,focusedMultiValue:a,renderOptionLabel:s,renderMultiOptions:c,removeSelectedOption:d})=>{const u=(()=>{const e=l(!0);return e.current?(e.current=!1,!0):e.current})();return!n||e&&(!e||B(i)&&!c)?B(i)?e?t.createElement(r,null,c?c({renderOptionLabel:s,selected:i}):i.map((({data:e,value:n})=>t.createElement(se,{key:n,data:e,value:n,renderOptionLabel:s,isFocused:n===a,removeSelectedOption:d})))):t.createElement(ge,null,s(i[0].data)):t.createElement(he,{isFirstRender:u},o):null}));be.displayName="Value";const ve=u.div.withConfig({displayName:"SizerDiv",componentId:"o2ype2-0"})(["top:0;left:0;height:0;overflow:scroll;white-space:pre;position:absolute;visibility:hidden;font-size:inherit;font-weight:inherit;font-family:inherit;",""],(({theme:e})=>e.input.css)),ye=u.input.attrs(w).withConfig({displayName:"Input",componentId:"o2ype2-1"})(["border:0;outline:0;padding:0;cursor:text;background:0;color:inherit;font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:content-box;:read-only{opacity:0;cursor:default;}:required{","}"," ",""],(({theme:e,isInvalid:t})=>t&&e.input.cssRequired),(({theme:e})=>e.input.css),Z&&"::-ms-clear{display:none;}"),we=n(s((({id:e,onBlur:n,onFocus:o,readOnly:a,required:s,onChange:c,ariaLabel:d,inputValue:u,ariaLabelledBy:p,selectedOption:m},f)=>{const g=l(null),[h,b]=i(2),v=!!s&&!B(m);return pe((()=>{g.current&&b(g.current.scrollWidth+2)}),[u]),t.createElement(r,null,t.createElement(ye,{id:e,ref:f,isInvalid:!0,onBlur:n,onFocus:o,value:u,readOnly:a,required:v,"aria-label":d,style:{width:h},"aria-labelledby":p,onChange:a?void 0:c}),t.createElement(ve,{ref:g},u))})));we.displayName="AutosizeInput";const Oe=u.span.withConfig({displayName:"A11yText",componentId:"zxgkbx-0"})(["border:0;padding:0;width:1px;height:1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(1px,1px,1px,1px);"]),xe=({menuOpen:e,isFocused:n,inputValue:o,optionCount:r,isSearchable:i,focusedOption:a,selectedOption:l,ariaLive:s="polite",ariaLabel:c="Select"})=>{if(!n)return null;const d=` ${r} result(s) available${o?" for search input "+o:""}.`,u=e?"Use Up and Down arrow keys to choose options, press Enter or Tab to select the currently focused option, press Escape to close the menu.":`${c} is focused${i?", type to filter options":""}, press Down arrow key to open the menu.`,{index:p,value:m,label:f,isDisabled:g}=a,h=m?`Focused option: ${f}${g?" - disabled":""}, ${p+1} of ${r}.`:"",b=l.length?l.map((e=>e.label)).join(" "):"N/A";return t.createElement(Oe,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},t.createElement("span",{id:"aria-selection"},"Selected option: "+b),t.createElement("span",{id:"aria-context"},h+d+u))},Ce=u.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1j9e0pa-0"})(["display:flex;align-self:center;text-align:center;margin-right:0.25rem;padding:",";> div{border-radius:100%;display:inline-block;",":nth-of-type(1){animation-delay:-0.272s;}:nth-of-type(2){animation-delay:-0.136s;}}"],(({theme:e})=>e.loader.padding),(({theme:{loader:e}})=>p(["width:",";height:",";animation:",";background-color:",";"],e.size,e.size,e.animation,e.color))),Ie=()=>t.createElement(Ce,{"aria-hidden":!0,className:"rfs-loading-dots"},t.createElement("div",null),t.createElement("div",null),t.createElement("div",null)),Se=u.svg.withConfig({displayName:"ClearSvg",componentId:"sc-1v5ipi2-0"})(["fill:currentColor;",""],(({theme:e})=>p(["width:",";height:",";animation:",";transition:",";"],e.icon.clear.width,e.icon.clear.height,e.icon.clear.animation,e.icon.clear.transition))),Ee=()=>t.createElement(Se,{"aria-hidden":!0,viewBox:"0 0 14 16",className:"rfs-clear-icon"},t.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})),De=u.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1561oeb-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),Me=u.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1561oeb-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(({theme:e})=>e.icon.color),(({theme:e})=>e.icon.padding),(({theme:e})=>e.icon.hoverColor),(({theme:e})=>e.icon.css)),ke=u.div.withConfig({displayName:"Caret",componentId:"sc-1561oeb-2"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(({theme:e})=>e.icon.caret.transition),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e,menuOpen:t,isInvalid:n})=>t&&p(["transform:rotate(180deg);color:",";"],n?e.color.danger:e.color.caretActive||e.color.primary))),ze=u.div.withConfig({displayName:"Separator",componentId:"sc-1561oeb-3"})(["width:1px;margin:0.5rem 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(({theme:e})=>e.color.iconSeparator||e.color.border)),Ne=n((({menuOpen:e,clearIcon:n,caretIcon:o,isInvalid:r,showClear:i,isLoading:a,isDisabled:l,loadingNode:s,onCaretMouseDown:c,onClearMouseDown:d})=>{const u=t=>"function"==typeof t?t({menuOpen:e,isLoading:a,isInvalid:r,isDisabled:l}):t;return t.createElement(De,null,i&&!a&&t.createElement(Me,{onTouchEnd:d,onMouseDown:d},u(n)||t.createElement(Ee,null)),a&&(s||t.createElement(Ie,null)),t.createElement(ze,null),t.createElement(Me,{onTouchEnd:c,onMouseDown:c},u(o)||t.createElement(ke,{"aria-hidden":!0,menuOpen:e,isInvalid:r,className:"rfs-caret-icon"})))}));function Le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function je(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?Le(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):Le(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}Ne.displayName="IndicatorIcons";const Pe=u.div.attrs(y).withConfig({displayName:"SelectWrapper",componentId:"kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(({theme:e})=>e.select.css)),Te=u.div.withConfig({displayName:"ValueWrapper",componentId:"kcrmu9-1"})(["flex:1 1 0%;display:flex;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;padding:",";"],(({theme:e})=>e.control.padding)),Ve=u.div.withConfig({displayName:"ControlWrapper",componentId:"kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(({isDisabled:e,isFocused:t,isInvalid:n,theme:{control:o,color:r}})=>p(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],o.transition,o.borderStyle,o.borderWidth,o.borderRadius,o.height||o.minHeight,n?r.danger:t?o.focusedBorderColor:r.border,o.height?`height: ${o.height};`:"",e?"pointer-events:none;user-select:none;":"",o.backgroundColor||e?`background-color: ${e?r.disabled:o.backgroundColor};`:"",t?`box-shadow: ${o.boxShadow} ${n?r.dangerLight:o.boxShadowColor};`:"")),(({theme:e})=>e.control.css),(({isFocused:e,theme:t})=>e&&t.control.focusedCss)),Ae=s((({async:e,isMulti:n,inputId:r,selectId:s,required:u,ariaLive:p,autoFocus:m,isLoading:g,onKeyDown:h,clearIcon:b,caretIcon:v,isInvalid:y,ariaLabel:w,menuWidth:O,isDisabled:x,inputDelay:N,onMenuOpen:L,onMenuClose:T,onInputBlur:V,isClearable:$,themeConfig:K,loadingNode:H,initialValue:U,onInputFocus:Y,onInputChange:X,ariaLabelledBy:G,onOptionChange:Z,onSearchChange:_,getOptionLabel:ee,getOptionValue:te,itemKeySelector:ne,openMenuOnFocus:re,menuPortalTarget:ie,isAriaLiveEnabled:ae,menuOverscanCount:le,blurInputOnSelect:se,menuItemDirection:ce,renderOptionLabel:de,renderMultiOptions:fe,menuScrollDuration:ge,filterIgnoreAccents:he,hideSelectedOptions:ve,getIsOptionDisabled:ye,getFilterOptionString:Oe,isSearchable:Ce=!0,lazyLoadMenu:Ie=!1,openMenuOnClick:Se=!0,filterIgnoreCase:Ee=!0,tabSelectsOption:De=!0,closeMenuOnSelect:Me=!0,scrollMenuIntoView:ke=!0,backspaceClearsValue:ze=!0,filterMatchFrom:Le=I,menuPosition:Ae=C,options:Be=P,loadingMsg:Re="Loading..",placeholder:Fe="Select option..",noOptionsMsg:$e="No options",menuItemSize:We=35,menuMaxHeight:qe=300},Ke)=>{const He=l(!1),Ue=l(),Ye=l(!1),Xe=l(),Ge=l(),Je=l(null),Qe=l(null),Ze=l(null),_e=l(null),[et,tt]=i(""),[nt,ot]=i(!1),[rt,it]=i(!1),[at,lt]=i(null),[st,ct]=i(j),dt=o((()=>(e=>e&&R(e)?q(J,e):J)(K)),[K]),ut=o((()=>ee||(e=>e.label)),[ee]),pt=o((()=>te||(e=>e.value)),[te]),mt=o((()=>de||ut),[de,ut]),ft=((e,t=0)=>{const[n,o]=i(e);return a((()=>{if(t<=0)return;const n=setTimeout((()=>{o(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),t<=0?e:n})(et,N),[gt,ht]=i((()=>W(U,pt,ut))),bt=ue(Be,ft,Le,gt,pt,ut,ye,Oe,Ee,he,n,ve,e),[vt,yt]=me(Qe,_e,nt,Ae,We,qe,bt.length,!!ie,ge,ke,L,T),wt=()=>{var e;return null===(e=Ze.current)||void 0===e?void 0:e.blur()},Ot=()=>{var e;return null===(e=Ze.current)||void 0===e?void 0:e.focus()},xt=e=>{var t;return null===(t=Je.current)||void 0===t?void 0:t.scrollToItem(e)},Ct=c((e=>{if(!B(bt))return void(!He.current&&ot(!0));const t=n?-1:bt.findIndex((e=>e.isSelected)),o=t>-1?t:e===z?0:bt.length-1;!He.current&&ot(!0),ct(je({index:o},bt[o])),xt(o)}),[n,bt]),It=c((e=>{ht((t=>t.filter((t=>t.value!==e))))}),[]),St=c(((e,t)=>{t?n&&It(e.value):ht((t=>n?[...t,e]:[e]));(A(se)?se:Q)?wt():Me&&(ot(!1),tt(""))}),[n,Me,It,se]);d(Ke,(()=>({empty:!B(gt),menuOpen:nt,blur:wt,focus:Ot,clearValue:()=>{St.length&&ht(P),st.data&&ct(j)},setValue:e=>{const t=W(e,pt,ut);ht(t)},toggleMenu:e=>{!0===e||void 0===e&&!nt?(!rt&&Ot(),Ct(z)):wt()}}))),a((()=>{m&&Ot()}),[]),a((()=>{He.current=nt}),[nt]),a((()=>{Ge.current=Z,Xe.current=_}),[Z,_]),a((()=>{rt&&re&&Ct(z)}),[rt,re,Ct]),a((()=>{const{current:e}=Xe;e&&Ye.current&&(Ye.current=!1,e(ft))}),[ft]),pe((()=>{const{current:e}=Ge;if(e){e(n?gt.map((e=>e.data)):B(gt)?gt[0].data:null)}}),[n,gt]),pe((()=>{const{length:t}=bt,n=t>0&&(e||t!==Be.length||0===Ue.current);0===t?ct(j):(1===t||n)&&(ct(je({index:0},bt[0])),xt(0)),Ue.current=t}),[e,Be,bt]);const Et=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:r}=st;e&&!r&&St({data:e,value:t,label:n},o)},Dt=e=>{const t="ArrowDown"===e,n=t?z:k;nt?(e=>{if(!B(bt))return;const t=e===M?(st.index+1)%bt.length:st.index>0?st.index-1:bt.length-1;at&<(null),ct(je({index:t},bt[t])),xt(t)})(t?M:D):Ct(n)},Mt=e=>{if(x)return;rt||Ot();const t="INPUT"!==e.currentTarget.tagName;nt?t&&(nt&&ot(!1),et&&tt("")):Se&&Ct(z),t&&e.preventDefault()},kt=c((e=>{null==V||V(e),it(!1),ot(!1),tt("")}),[V]),zt=c((e=>{null==Y||Y(e),it(!0)}),[Y]),Nt=c((e=>{const t=e.currentTarget.value||"";Ye.current=!0,null==X||X(t),!He.current&&ot(!0),tt(t)}),[X]),Lt=c((e=>{ht(P),F(e),Ot()}),[]),jt=c((e=>{Ot(),He.current?ot(!1):Ct(z),F(e)}),[Ct]),Pt=!Ie||Ie&&nt,Tt=x||!Ce||!!at,Vt=!(!$||x||!B(gt)),At=x||Se?void 0:jt;return t.createElement(f,{theme:dt},t.createElement(Pe,{id:s,"aria-controls":r,"aria-expanded":nt,onKeyDown:e=>{if(x)return;if(h&&(h(e,et,st),e.defaultPrevented))return;const{key:t}=e;switch(t){case"ArrowDown":case"ArrowUp":Dt(t);break;case"ArrowLeft":case"ArrowRight":if(!n||et||fe)return;(e=>{if(!B(gt))return;let t=-1;const n=gt.length-1,o=at?gt.findIndex((e=>e.value===at)):-1;t=e===S?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const r=t>=0?gt[t].value:null;st.data&&ct(j),r!==at&<(r)})("ArrowLeft"===t?E:S);break;case" ":if(et)return;if(nt){if(!st.data)return;Et()}else Ct(z);break;case"Enter":nt&&229!==e.keyCode&&Et();break;case"Escape":nt&&(ot(!1),tt(""));break;case"Tab":if(!nt||!De||!st.data||e.shiftKey)return;Et();break;case"Delete":case"Backspace":if(et)return;if(at){const e=gt.findIndex((e=>e.value===at)),t=e>-1&&e<gt.length-1?gt[e+1].value:null;It(at),lt(t)}else{if(!ze)return;if(!B(gt))break;if(n&&!fe){const{value:e}=gt[gt.length-1];It(e)}else $&&ht(P)}break;default:return}e.preventDefault()}},t.createElement(Ve,{ref:_e,isInvalid:y,isFocused:rt,isDisabled:x,className:"rfs-control-container",onTouchEnd:Mt,onMouseDown:Mt},t.createElement(Te,null,t.createElement(be,{isMulti:n,inputValue:et,placeholder:Fe,selectedOption:gt,focusedMultiValue:at,renderOptionLabel:mt,renderMultiOptions:fe,removeSelectedOption:It}),t.createElement(we,{id:r,ref:Ze,required:u,ariaLabel:w,inputValue:et,readOnly:Tt,onBlur:kt,onFocus:zt,onChange:Nt,ariaLabelledBy:G,selectedOption:gt})),t.createElement(Ne,{menuOpen:nt,clearIcon:b,caretIcon:v,isInvalid:y,isLoading:g,showClear:Vt,isDisabled:x,loadingNode:H,onClearMouseDown:Lt,onCaretMouseDown:At})),Pt&&t.createElement(oe,{menuRef:Qe,menuOpen:nt,isLoading:g,menuTop:vt,height:yt,itemSize:We,loadingMsg:Re,menuOptions:bt,fixedSizeListRef:Je,noOptionsMsg:$e,selectOption:St,direction:ce,itemKeySelector:ne,overscanCount:le,menuPortalTarget:ie,width:O||dt.menu.width,onMenuMouseDown:e=>{F(e),Ot()},renderOptionLabel:mt,focusedOptionIndex:st.index}),ae&&t.createElement(xe,{ariaLive:p,menuOpen:nt,isFocused:rt,ariaLabel:w,inputValue:et,isSearchable:Ce,focusedOption:st,selectedOption:gt,optionCount:bt.length})))}));Ae.displayName="Select";export{Ae as Select}; | ||
import e from"@babel/runtime/helpers/esm/defineProperty";import t,{useState as n,useEffect as o,useRef as r,memo as i,useMemo as a,Fragment as l,forwardRef as s,useCallback as c,useImperativeHandle as d}from"react";import u,{css as p,keyframes as m,ThemeProvider as f}from"styled-components";import g from"@babel/runtime/helpers/esm/objectWithoutProperties";import{areEqual as h,FixedSizeList as b}from"react-window";import{createPortal as y}from"react-dom";const v={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container"},w={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input"},O="top",x="auto",C="bottom",S="any",I=0,E=1,D=0,M=1,k=2,z=3,N=m(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),L=p([""," 0.25s ease-in-out"],m(["from{opacity:0;}to{opacity:1;}"])),j={index:-1},P=e=>e.label,T=e=>e.value,V=e=>!!e.isDisabled,A=({label:e})=>"string"==typeof e?e:`${e}`,B=[];function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}const F=/[\u0300-\u036f]/g;function $(e){return"boolean"==typeof e}function W(e){return Array.isArray(e)&&!!e.length}function q(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}const K=e=>{e.preventDefault(),e.stopPropagation()};function H(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(F,"")}(o):o}const U=(e,t,n)=>{const o=Array.isArray(e)?e:q(e)?[e]:B;return W(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},Y=(t,n)=>{const o=function(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?R(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):R(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}({},t);return Object.keys(n).forEach((e=>{const r=n[e];o[e]="animation"!==e&&q(r)?t[e]?Y(t[e],r):r:r||""})),o},X=/(auto|scroll)/;function G(e){return J(e)?window.pageYOffset:e.scrollTop}function J(e){return e===document.body||e===document.documentElement||e===window}function Q({overflow:e,overflowX:t,overflowY:n}){return X.test(`${e}${t}${n}`)}function Z(e){let t=getComputedStyle(e);const n=document.documentElement,o="absolute"===t.position;if("fixed"===t.position)return n;for(let n=e;n=null===(r=n)||void 0===r?void 0:r.parentElement;){var r;if(t=getComputedStyle(n),(!o||"static"!==t.position)&&Q(t))return n}return n}function _(e,t,n=300,o){let r=0;const i=G(e),a=t-i;requestAnimationFrame((function t(){r+=5;const l=a*((s=(s=r)/n-1)*s*s+1)+i;var s;!function(e,t){J(e)?window.scrollTo(0,t):e.scrollTop=t}(e,l),r<n?requestAnimationFrame(t):null==o||o()}))}const ee={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.5rem 0",borderRadius:"3px",backgroundColor:"#fff",animation:L,boxShadow:"0 0.5em 1em -0.125em rgb(10 10 10 / 12%), 0 0 0 1px rgb(10 10 10 / 4%)",option:{textAlign:"left",selectedColor:"#fff",selectedBgColor:"#007bff",padding:"0.375rem 0.75rem",focusedBgColor:"rgba(0, 123, 255, 0.15)"}},noOptions:{fontSize:"1.25rem",margin:"0.25rem 0",color:"hsl(0, 0%, 60%)",padding:"0.375rem 0.75rem"},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, transform 0.2s ease-out, z-index 0.2s ease-out"}}},te="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,ne="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent);function oe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function re(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?oe(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):oe(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}const ie=(e,t,r,i,a,l,s,c,d=!1,u=!1,p=!1,m=!1,f)=>{const[g,h]=n(B),b=m?"":t,y=$(f)?f:p;return o((()=>{const{current:t}=s,{current:n}=c,o=H(b,d,u),p=i.length?new Set(i.map((e=>e.value))):void 0,m=e=>{const i=a(e),s=re(re({data:e,value:i,label:l(e)},t(e)&&{isDisabled:!0}),(null==p?void 0:p.has(i))&&{isSelected:!0});if(!(o&&!(e=>{const t=H(n(e),d,u);return r===S?t.indexOf(o)>-1:t.substr(0,o.length)===o})(s)||y&&s.isSelected))return s},f=e.reduce(((e,t)=>{const n=m(t);return n&&e.push(n),e}),[]);h(f)}),[e,b,a,l,i,r,d,u,s,c,y]),g},ae=(e,t)=>{const n=r(e||t);return o((()=>{n.current=e||t}),[e,t]),n},le=(e,t)=>{const n=r(!0);o((()=>{if(!n.current)return e();n.current=!1}),t)},se=(e,t,i,a,l,s,c,d,u,p,m,f)=>{const g=r(!1),h=r(!d),[b,y]=n(s),[v,w]=n(!1);o((()=>{h.current=!v&&!d}),[v,d]),o((()=>{const t=a===O||a===x&&!(e=>{if(!e)return!0;const t=Z(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-G(t)-n>=o})(e.current);w(t)}),[e,a]),le((()=>{if(i){const t=e=>{var t;null===(t=u.current)||void 0===t||t.call(u),e&&(g.current=!0,y(e))};h.current?((e,t,n,o)=>{if(!e)return void o();const{top:r,height:i,bottom:a}=e.getBoundingClientRect(),l=window.innerHeight;if(l-r>=i)return void o();const s=Z(e),c=G(s),d=s.getBoundingClientRect().height-c-r,u=d<i;if(u||!n)return void o(u?d:void 0);const p=getComputedStyle(e).marginBottom;_(s,a-l+c+parseInt(p,10),t,o)})(e.current,m,f,t):t()}else{var t;null===(t=p.current)||void 0===t||t.call(p),g.current&&(g.current=!1,y(s))}}),[e,i,s,f,m,p,u]);const C=Math.min(b,c*l);return[v?((e,t,n)=>{const o=e>0||!t?e:t.getBoundingClientRect().height,r=n?n.getBoundingClientRect().height:0,i=t&&getComputedStyle(t),a=i?parseInt(i.marginBottom,10):0,l=i?parseInt(i.marginTop,10):0;return`calc(${-Math.abs(o+r)}px + ${a+l}px)`})(C,e.current,t.current):void 0,C]},ce=i((({index:e,style:n,data:{menuOptions:o,selectOption:r,renderOptionLabel:i,focusedOptionIndex:a}})=>{const{data:l,value:s,label:c,isDisabled:d,isSelected:u}=o[e],p=function(e,t,n){let o="rfs-option";return e&&(o+=" rfs-option-disabled"),t&&(o+=" rfs-option-selected"),n&&(o+=" rfs-option-focused"),o}(d,u,e===a);return t.createElement("div",{style:n,onClick:d?void 0:()=>r({data:l,value:s,label:c},u),className:p},i(l))}),h);ce.displayName="Option";const de=u.div.withConfig({displayName:"NoOptionsMsg",componentId:"v1y124-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(({theme:e})=>e.noOptions.color),(({theme:e})=>e.noOptions.margin),(({theme:e})=>e.noOptions.padding),(({theme:e})=>e.noOptions.fontSize),(({theme:e})=>e.noOptions.css)),ue=({width:e,height:n,itemSize:o,direction:r,isLoading:i,loadingMsg:s,menuOptions:c,selectOption:d,noOptionsMsg:u,overscanCount:p,itemKeySelector:m,fixedSizeListRef:f,renderOptionLabel:g,focusedOptionIndex:h})=>{const y=a((()=>({menuOptions:c,selectOption:d,renderOptionLabel:g,focusedOptionIndex:h})),[c,h,d,g]);if(i)return t.createElement(de,null,s);return t.createElement(l,null,t.createElement(b,{width:e,height:n,itemKey:m?(e,t)=>t.menuOptions[e][m]:void 0,itemSize:o,itemData:y,direction:r,ref:f,overscanCount:p,itemCount:c.length},ce),!W(c)&&u&&t.createElement(de,null,u))},pe=u.div.withConfig({displayName:"MenuWrapper",componentId:"yf5myu-0"})(["z-index:999;cursor:default;position:absolute;"," "," .","{display:block;overflow:hidden;user-select:none;white-space:nowrap;text-overflow:ellipsis;-webkit-tap-highlight-color:transparent;padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}}"],(({menuTop:e,menuOpen:t,hideNoOptionsMsg:n,theme:{menu:o}})=>p(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],o.width,o.margin,o.padding,o.animation,o.borderRadius,o.backgroundColor,n?"none":o.boxShadow,t?"":"display: none;",e?`top: ${e};`:"")),(({theme:e})=>e.menu.css),"rfs-option",(({theme:e})=>e.menu.option.padding),(({theme:e})=>e.menu.option.textAlign),"rfs-option-focused","rfs-option-disabled","rfs-option-selected",(({theme:e})=>e.menu.option.focusedBgColor),"rfs-option-selected",(({theme:e})=>e.menu.option.selectedColor),(({theme:e})=>e.menu.option.selectedBgColor),"rfs-option-disabled"),me=e=>{let{menuRef:n,menuTop:o,menuOpen:r,onMenuMouseDown:i,menuPortalTarget:a}=e,l=g(e,["menuRef","menuTop","menuOpen","onMenuMouseDown","menuPortalTarget"]);const{menuOptions:s,noOptionsMsg:c}=l,d=r&&!Boolean(c)&&!W(s),u=t.createElement(pe,{ref:n,menuTop:o,menuOpen:r,onMouseDown:i,className:"rfs-menu-container",hideNoOptionsMsg:d},t.createElement(ue,Object.assign({},l)));return a?y(u,a):u},fe=p(["z-index:5000;transform:scale(1.26);color:",";"],(({theme:e})=>e.multiValue.clear.focusColor)),ge=u.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-211cx7-0"})(["min-width:0;display:flex;"," ",""],(({theme:{multiValue:e}})=>p(["margin:",";animation:",";border-radius:",";background-color:",";"],e.margin,e.animation,e.borderRadius,e.backgroundColor)),(({theme:e})=>e.multiValue.css)),he=u.div.withConfig({displayName:"Label",componentId:"sc-211cx7-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(({theme:e})=>e.multiValue.label.padding),(({theme:e})=>e.multiValue.label.fontSize),(({theme:e})=>e.multiValue.label.borderRadius)),be=u.i.withConfig({displayName:"Clear",componentId:"sc-211cx7-2"})(["display:flex;font-style:inherit;"," ",""],(({theme:{multiValue:{clear:e}}})=>p(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";:hover{","}"],e.color,e.padding,e.fontSize,e.alignSelf,e.transition,e.fontWeight,fe)),(({isFocused:e})=>e&&fe)),ye=i((({data:e,value:n,isFocused:o,renderOptionLabel:r,removeSelectedOption:i})=>{const a=()=>i(n);return t.createElement(ge,null,t.createElement(he,null,r(e)),t.createElement(be,{isFocused:o,onClick:a,onTouchEnd:a,onMouseDown:K},"✖"))}));ye.displayName="MultiValue";const ve=p(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),we=u.div.withConfig({displayName:"SingleValue",componentId:"sc-153h0ct-0"})([""," max-width:calc(100% - 0.5rem);"],ve),Oe=u.div.withConfig({displayName:"Placeholder",componentId:"sc-153h0ct-1"})([""," color:",";",""],ve,(({theme:e})=>e.color.placeholder),(({theme:e,isFirstRender:t})=>!t&&p(["animation:",";"],e.placeholder.animation))),xe=i((({isMulti:e,inputValue:n,placeholder:o,selectedOption:i,focusedMultiValue:a,renderOptionLabel:s,renderMultiOptions:c,removeSelectedOption:d})=>{const u=(()=>{const e=r(!0);return e.current?(e.current=!1,!0):e.current})();return!n||e&&(!e||W(i)&&!c)?W(i)?e?t.createElement(l,null,c?c({renderOptionLabel:s,selected:i}):i.map((({data:e,value:n})=>t.createElement(ye,{key:n,data:e,value:n,renderOptionLabel:s,isFocused:n===a,removeSelectedOption:d})))):t.createElement(we,null,s(i[0].data)):t.createElement(Oe,{isFirstRender:u},o):null}));xe.displayName="Value";const Ce=u.div.withConfig({displayName:"SizerDiv",componentId:"o2ype2-0"})(["top:0;left:0;height:0;overflow:scroll;white-space:pre;position:absolute;visibility:hidden;font-size:inherit;font-weight:inherit;font-family:inherit;",""],(({theme:e})=>e.input.css)),Se=u.input.attrs(w).withConfig({displayName:"Input",componentId:"o2ype2-1"})(["border:0;outline:0;padding:0;cursor:text;background:0;color:inherit;font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:content-box;:read-only{opacity:0;cursor:default;}:required{","}"," ",""],(({theme:e,isInvalid:t})=>t&&e.input.cssRequired),(({theme:e})=>e.input.css),ne&&"::-ms-clear{display:none;}"),Ie=i(s((({id:e,onBlur:o,onFocus:i,readOnly:a,required:s,onChange:c,ariaLabel:d,inputValue:u,ariaLabelledBy:p,hasSelectedOptions:m},f)=>{const g=r(null),[h,b]=n(2),y=!!s&&!m;return le((()=>{g.current&&b(g.current.scrollWidth+2)}),[u]),t.createElement(l,null,t.createElement(Se,{id:e,ref:f,isInvalid:!0,onBlur:o,onFocus:i,value:u,readOnly:a,required:y,"aria-label":d,style:{width:h},"aria-labelledby":p,onChange:a?void 0:c}),t.createElement(Ce,{ref:g},u))})));Ie.displayName="AutosizeInput";const Ee=u.span.withConfig({displayName:"A11yText",componentId:"zxgkbx-0"})(["border:0;padding:0;width:1px;height:1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(1px,1px,1px,1px);"]),De=({menuOpen:e,isFocused:n,inputValue:o,optionCount:r,isSearchable:i,focusedOption:a,selectedOption:l,ariaLive:s="polite",ariaLabel:c="Select"})=>{if(!n)return null;const d=` ${r} result(s) available${o?" for search input "+o:""}.`,u=e?"Use Up and Down arrow keys to choose options, press Enter or Tab to select the currently focused option, press Escape to close the menu.":`${c} is focused${i?", type to filter options":""}, press Down arrow key to open the menu.`,{index:p,value:m,label:f,isDisabled:g}=a,h=m?`Focused option: ${f}${g?" - disabled":""}, ${p+1} of ${r}.`:"",b="Selected option: "+(l.length?l.map((e=>e.label)).join(" "):"N/A"),y=`${h} ${d} ${u}`.trimStart();return t.createElement(Ee,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},t.createElement("span",{id:"aria-selection"},b),t.createElement("span",{id:"aria-context"},y))},Me=u.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1j9e0pa-0"})(["display:flex;align-self:center;text-align:center;margin-right:0.25rem;padding:",";> div{border-radius:100%;display:inline-block;",":nth-of-type(1){animation-delay:-0.272s;}:nth-of-type(2){animation-delay:-0.136s;}}"],(({theme:e})=>e.loader.padding),(({theme:{loader:e}})=>p(["width:",";height:",";animation:",";background-color:",";"],e.size,e.size,e.animation,e.color))),ke=()=>t.createElement(Me,{"aria-hidden":!0,className:"rfs-loading-dots"},t.createElement("div",null),t.createElement("div",null),t.createElement("div",null)),ze=u.svg.withConfig({displayName:"ClearSvg",componentId:"sc-1v5ipi2-0"})(["fill:currentColor;",""],(({theme:e})=>p(["width:",";height:",";animation:",";transition:",";"],e.icon.clear.width,e.icon.clear.height,e.icon.clear.animation,e.icon.clear.transition))),Ne=()=>t.createElement(ze,{"aria-hidden":!0,viewBox:"0 0 14 16",className:"rfs-clear-icon"},t.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})),Le=u.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1561oeb-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),je=u.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1561oeb-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(({theme:e})=>e.icon.color),(({theme:e})=>e.icon.padding),(({theme:e})=>e.icon.hoverColor),(({theme:e})=>e.icon.css)),Pe=u.div.withConfig({displayName:"Caret",componentId:"sc-1561oeb-2"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(({theme:e})=>e.icon.caret.transition),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e,menuOpen:t,isInvalid:n})=>t&&p(["transform:rotate(180deg);color:",";"],n?e.color.danger:e.color.caretActive||e.color.primary))),Te=u.div.withConfig({displayName:"Separator",componentId:"sc-1561oeb-3"})(["width:1px;margin:0.5rem 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(({theme:e})=>e.color.iconSeparator||e.color.border)),Ve=i((({menuOpen:e,clearIcon:n,caretIcon:o,isInvalid:r,showClear:i,isLoading:a,isDisabled:l,loadingNode:s,onCaretMouseDown:c,onClearMouseDown:d})=>{const u=t=>"function"==typeof t?t({menuOpen:e,isLoading:a,isInvalid:r,isDisabled:l}):t;return t.createElement(Le,null,i&&!a&&t.createElement(je,{onTouchEnd:d,onMouseDown:d},u(n)||t.createElement(Ne,null)),a&&(s||t.createElement(ke,null)),t.createElement(Te,null),t.createElement(je,{onTouchEnd:c,onMouseDown:c},u(o)||t.createElement(Pe,{"aria-hidden":!0,menuOpen:e,isInvalid:r,className:"rfs-caret-icon"})))}));function Ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Be(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?Ae(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):Ae(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}Ve.displayName="IndicatorIcons";const Re=u.div.attrs(v).withConfig({displayName:"SelectWrapper",componentId:"kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(({theme:e})=>e.select.css)),Fe=u.div.withConfig({displayName:"ValueWrapper",componentId:"kcrmu9-1"})(["flex:1 1 0%;display:flex;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;padding:",";"],(({theme:e})=>e.control.padding)),$e=u.div.withConfig({displayName:"ControlWrapper",componentId:"kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(({isDisabled:e,isFocused:t,isInvalid:n,theme:{control:o,color:r}})=>p(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],o.transition,o.borderStyle,o.borderWidth,o.borderRadius,o.height||o.minHeight,n?r.danger:t?o.focusedBorderColor:r.border,o.height?`height: ${o.height};`:"",e?"pointer-events:none;user-select:none;":"",o.backgroundColor||e?`background-color: ${e?r.disabled:o.backgroundColor};`:"",t?`box-shadow: ${o.boxShadow} ${n?r.dangerLight:o.boxShadowColor};`:"")),(({theme:e})=>e.control.css),(({isFocused:e,theme:t})=>e&&t.control.focusedCss)),We=s((({async:e,isMulti:i,inputId:l,selectId:s,required:u,ariaLive:p,autoFocus:m,isLoading:g,onKeyDown:h,clearIcon:b,caretIcon:y,isInvalid:v,ariaLabel:w,menuWidth:O,isDisabled:x,inputDelay:N,onMenuOpen:L,onMenuClose:R,onInputBlur:F,isClearable:H,themeConfig:X,loadingNode:G,initialValue:J,onInputFocus:Q,onInputChange:Z,ariaLabelledBy:_,onOptionChange:ne,onSearchChange:oe,getOptionLabel:re,getOptionValue:ce,itemKeySelector:de,openMenuOnFocus:ue,menuPortalTarget:pe,isAriaLiveEnabled:fe,menuOverscanCount:ge,blurInputOnSelect:he,menuItemDirection:be,renderOptionLabel:ye,renderMultiOptions:ve,menuScrollDuration:we,filterIgnoreAccents:Oe,hideSelectedOptions:Ce,getIsOptionDisabled:Se,getFilterOptionString:Ee,isSearchable:Me=!0,lazyLoadMenu:ke=!1,openMenuOnClick:ze=!0,filterIgnoreCase:Ne=!0,tabSelectsOption:Le=!0,closeMenuOnSelect:je=!0,scrollMenuIntoView:Pe=!0,backspaceClearsValue:Te=!0,filterMatchFrom:Ae=S,menuPosition:We=C,options:qe=B,loadingMsg:Ke="Loading..",placeholder:He="Select option..",noOptionsMsg:Ue="No options",menuItemSize:Ye=35,menuMaxHeight:Xe=300},Ge)=>{const Je=r(!1),Qe=r(),Ze=r(!1),_e=r(null),et=r(null),tt=r(null),nt=r(null),[ot,rt]=n(""),[it,at]=n(!1),[lt,st]=n(!1),[ct,dt]=n(null),[ut,pt]=n(j),mt=a((()=>(e=>e&&q(e)?Y(ee,e):ee)(X)),[X]),ft=ae(L),gt=ae(R),ht=ae(oe),bt=ae(ne),yt=ae(Se,V),vt=ae(Ee,A),wt=a((()=>re||P),[re]),Ot=a((()=>ce||T),[ce]),xt=a((()=>ye||wt),[ye,wt]),Ct=((e,t=0)=>{const[r,i]=n(e);return o((()=>{if(t<=0)return;const n=setTimeout((()=>{i(e)}),t);return()=>{clearTimeout(n)}}),[e,t]),t<=0?e:r})(ot,N),[St,It]=n((()=>U(J,Ot,wt))),Et=ie(qe,Ct,Ae,St,Ot,wt,yt,vt,Ne,Oe,i,e,Ce),[Dt,Mt]=se(et,nt,it,We,Ye,Xe,Et.length,!!pe,ft,gt,we,Pe),kt=()=>{var e;return null===(e=tt.current)||void 0===e?void 0:e.blur()},zt=()=>{var e;return null===(e=tt.current)||void 0===e?void 0:e.focus()},Nt=e=>{var t;return null===(t=_e.current)||void 0===t?void 0:t.scrollToItem(e)},Lt=c((e=>{if(!W(Et))return void(!Je.current&&at(!0));const t=i?-1:Et.findIndex((e=>e.isSelected)),n=t>-1?t:e===z?0:Et.length-1;!Je.current&&at(!0),pt(Be({index:n},Et[n])),Nt(n)}),[i,Et]),jt=c((e=>{It((t=>t.filter((t=>t.value!==e))))}),[]),Pt=c(((e,t)=>{t?i&&jt(e.value):It((t=>i?[...t,e]:[e]));($(he)?he:te)?kt():je&&(at(!1),rt(""))}),[i,je,jt,he]),Tt=W(St);d(Ge,(()=>({empty:!Tt,menuOpen:Je.current,blur:kt,focus:zt,clearValue:()=>{It(B),pt(j)},setValue:e=>{const t=U(e,Ot,wt);It(t)},toggleMenu:e=>{!0===e||void 0===e&&!Je.current?(zt(),Lt(z)):kt()}})),[Tt,Ot,wt,Lt]),o((()=>{m&&zt()}),[]),o((()=>{Je.current=it}),[it]),o((()=>{lt&&ue&&Lt(z)}),[lt,ue,Lt]),o((()=>{const{current:e}=ht;e&&Ze.current&&(Ze.current=!1,e(Ct))}),[Ct]),le((()=>{const{current:e}=bt;if(e){e(i?St.map((e=>e.data)):W(St)?St[0].data:null)}}),[i,St]),le((()=>{const{length:t}=Et,n=t>0&&(e||t!==qe.length||0===Qe.current);0===t?pt(j):(1===t||n)&&(pt(Be({index:0},Et[0])),Nt(0)),Qe.current=t}),[e,qe,Et]);const Vt=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:r}=ut;e&&!r&&Pt({data:e,value:t,label:n},o)},At=e=>{const t="ArrowDown"===e,n=t?z:k;it?(e=>{if(!W(Et))return;const t=e===M?(ut.index+1)%Et.length:ut.index>0?ut.index-1:Et.length-1;ct&&dt(null),pt(Be({index:t},Et[t])),Nt(t)})(t?M:D):Lt(n)},Bt=e=>{if(x)return;lt||zt();const t="INPUT"!==e.currentTarget.tagName;it?t&&(it&&at(!1),ot&&rt("")):ze&&Lt(z),t&&e.preventDefault()},Rt=c((e=>{null==F||F(e),st(!1),at(!1),rt("")}),[F]),Ft=c((e=>{null==Q||Q(e),st(!0)}),[Q]),$t=c((e=>{Ze.current=!0;const t=e.currentTarget.value||"";null==Z||Z(t),rt(t),!Je.current&&at(!0)}),[Z]),Wt=c((e=>{zt(),Je.current?at(!1):Lt(z),K(e)}),[Lt]),qt=c((e=>{zt(),It(B),K(e)}),[]),Kt=!ke||ke&&it,Ht=!(!H||x||!Tt),Ut=x||!Me||!!ct,Yt=x||ze?void 0:Wt;return t.createElement(f,{theme:mt},t.createElement(Re,{id:s,"aria-controls":l,"aria-expanded":it,onKeyDown:e=>{if(!(x||h&&(h(e,ot,ut),e.defaultPrevented))){switch(e.key){case"ArrowDown":case"ArrowUp":At(e.key);break;case"ArrowLeft":case"ArrowRight":if(!i||ot||ve)return;(e=>{if(!Tt)return;let t=-1;const n=St.length-1,o=ct?St.findIndex((e=>e.value===ct)):-1;t=e===I?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const r=t>=0?St[t].value:null;ut.data&&pt(j),r!==ct&&dt(r)})("ArrowLeft"===e.key?E:I);break;case" ":if(ot)return;if(it){if(!ut.data)return;Vt()}else Lt(z);break;case"Enter":it&&229!==e.keyCode&&Vt();break;case"Escape":it&&(at(!1),rt(""));break;case"Tab":if(!it||!Le||!ut.data||e.shiftKey)return;Vt();break;case"Delete":case"Backspace":if(ot)return;if(ct){const e=St.findIndex((e=>e.value===ct)),t=e>-1&&e<St.length-1?St[e+1].value:null;jt(ct),dt(t)}else{if(!Te)return;if(!Tt)break;if(i&&!ve){const{value:e}=St[St.length-1];jt(e)}else H&&It(B)}break;default:return}e.preventDefault()}}},t.createElement($e,{ref:nt,isInvalid:v,isFocused:lt,isDisabled:x,className:"rfs-control-container",onTouchEnd:Bt,onMouseDown:Bt},t.createElement(Fe,null,t.createElement(xe,{isMulti:i,inputValue:ot,placeholder:He,selectedOption:St,focusedMultiValue:ct,renderMultiOptions:ve,renderOptionLabel:xt,removeSelectedOption:jt}),t.createElement(Ie,{id:l,ref:tt,required:u,ariaLabel:w,inputValue:ot,readOnly:Ut,onBlur:Rt,onFocus:Ft,onChange:$t,ariaLabelledBy:_,hasSelectedOptions:Tt})),t.createElement(Ve,{menuOpen:it,clearIcon:b,caretIcon:y,isInvalid:v,isLoading:g,showClear:Ht,isDisabled:x,loadingNode:G,onClearMouseDown:qt,onCaretMouseDown:Yt})),Kt&&t.createElement(me,{menuRef:et,menuOpen:it,isLoading:g,menuTop:Dt,height:Mt,itemSize:Ye,loadingMsg:Ke,menuOptions:Et,fixedSizeListRef:_e,noOptionsMsg:Ue,selectOption:Pt,direction:be,itemKeySelector:de,overscanCount:ge,menuPortalTarget:pe,width:O||mt.menu.width,onMenuMouseDown:e=>{K(e),zt()},renderOptionLabel:xt,focusedOptionIndex:ut.index}),fe&&t.createElement(De,{ariaLive:p,menuOpen:it,isFocused:lt,ariaLabel:w,inputValue:ot,isSearchable:Me,focusedOption:ut,selectedOption:St,optionCount:Et.length})))}));We.displayName="Select";export{We as Select}; |
@@ -1,1 +0,1 @@ | ||
export { Select } from './Select'; | ||
export { default as Select } from './Select'; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("styled-components"),require("react-window"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","styled-components","react-window","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactFunctionalSelect={},e.React,e.styled,e.ReactWindow,e.ReactDOM)}(this,(function(e,t,n,o,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=i(t),l=i(n);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const c="rfs-option",u="rfs-option-focused",d="rfs-option-selected",p="rfs-option-disabled",f={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container","data-testid":undefined},m={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input","data-testid":undefined},g="top",h="auto",b="bottom",y="any",v=0,w=1,O=0,x=1,C=2,S=3,E=n.keyframes(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),I=n.css([""," 0.25s ease-in-out both"],n.keyframes(["from{opacity:0;}to{opacity:1;}"])),M={index:-1},k=[];function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}const R=/[\u0300-\u036f]/g;function j(e){return"boolean"==typeof e}function z(e){return Array.isArray(e)&&!!e.length}function L(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}const N=(e,t=!0)=>{t&&e.preventDefault(),e.stopPropagation()};function P(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(R,"")}(o):o}const T=(e,t,n)=>{const o=Array.isArray(e)?e:L(e)?[e]:k;return z(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},F=(e,t)=>{const n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e);return Object.keys(t).forEach((o=>{const r=t[o];n[o]="animation"!==o&&L(r)?e[o]?F(e[o],r):r:r||""})),n};function V(e){return A(e)?window.pageYOffset:e.scrollTop}function A(e){return e===document.documentElement||e===document.body||e===window}const B=/(auto|scroll)/;function $({overflow:e,overflowX:t,overflowY:n}){return B.test(`${e}${t}${n}`)}function q(e){let t=getComputedStyle(e);const n=document.documentElement,o="absolute"===t.position;if("fixed"===t.position)return n;for(let n=e;n=null===(r=n)||void 0===r?void 0:r.parentElement;){var r;if(t=getComputedStyle(n),(!o||"static"!==t.position)&&$(t))return n}return n}function W(e,t,n=300,o){let r=0;const i=V(e),a=t-i;requestAnimationFrame((function t(){r+=5;const l=a*((s=(s=r)/n-1)*s*s+1)+i;var s;!function(e,t){A(e)?window.scrollTo(0,t):e.scrollTop=t}(e,l),r<n?requestAnimationFrame(t):null==o||o()}))}const K={color:{border:"#ced4da",danger:"#dc3545",primary:"#007bff",disabled:"#e9ecef",placeholder:"#6E7276",dangerLight:"rgba(220, 53, 69, 0.25)"},input:{},select:{},loader:{size:"0.625rem",padding:"0.375rem 0.75rem",animation:n.css([""," 1.19s ease-in-out infinite"],E),color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 0.9375rem",clear:{width:"14px",height:"16px",animation:I,transition:"color 0.2s ease-out"},caret:{size:"7px",transition:"transform 0.3s ease-in-out, color 0.2s ease-out"}},control:{minHeight:"38px",borderWidth:"1px",borderStyle:"solid",borderRadius:"3px",boxShadow:"0 0 0 0.2rem",padding:"0.375rem 0.75rem",boxShadowColor:"rgba(0, 123, 255, 0.25)",focusedBorderColor:"rgba(0, 123, 255, 0.75)",transition:"box-shadow 0.2s ease-out, border-color 0.2s ease-out"},menu:{padding:"0",width:"100%",margin:"0.5rem 0",borderRadius:"3px",backgroundColor:"#fff",animation:I,boxShadow:"0 0.5em 1em -0.125em rgb(10 10 10 / 12%), 0 0 0 1px rgb(10 10 10 / 4%)",option:{textAlign:"left",selectedColor:"#fff",selectedBgColor:"#007bff",padding:"0.375rem 0.75rem",focusedBgColor:"rgba(0, 123, 255, 0.15)"}},noOptions:{fontSize:"1.25rem",margin:"0.25rem 0",color:"hsl(0, 0%, 60%)",padding:"0.375rem 0.75rem"},placeholder:{animation:I},multiValue:{margin:"1px 2px",borderRadius:"3px",backgroundColor:"#e7edf3",animation:I,label:{borderRadius:"3px",fontSize:"0.825em",padding:"1px 0 1px 6px"},clear:{fontWeight:600,padding:"0 6px",color:"#a6a6a6",fontSize:"0.65em",alignSelf:"center",focusColor:"#808080",transition:"color 0.2s ease-out, transform 0.2s ease-out, z-index 0.2s ease-out"}}},H="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,U="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent);function Y(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}const _=t.memo((({index:e,style:t,data:{menuOptions:n,selectOption:o,renderOptionLabel:r,focusedOptionIndex:i}})=>{const{data:l,value:s,label:u,isDisabled:d,isSelected:p}=n[e],f=function(e,t,n){let o=c;return e&&(o+=" rfs-option-disabled"),t&&(o+=" rfs-option-selected"),n&&(o+=" rfs-option-focused"),o}(d,p,e===i);return a.default.createElement("div",{style:t,onClick:d?void 0:()=>o({data:l,value:s,label:u},p),className:f},r(l))}),o.areEqual);_.displayName="Option";const X=l.default.div.withConfig({displayName:"NoOptionsMsg",componentId:"v1y124-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(({theme:e})=>e.noOptions.color),(({theme:e})=>e.noOptions.margin),(({theme:e})=>e.noOptions.padding),(({theme:e})=>e.noOptions.fontSize),(({theme:e})=>e.noOptions.css)),G=({width:e,height:n,itemSize:r,direction:i,isLoading:l,loadingMsg:s,menuOptions:c,selectOption:u,noOptionsMsg:d,overscanCount:p,itemKeySelector:f,fixedSizeListRef:m,renderOptionLabel:g,focusedOptionIndex:h})=>{const b=t.useMemo((()=>({menuOptions:c,selectOption:u,renderOptionLabel:g,focusedOptionIndex:h})),[c,h,u,g]);if(l)return a.default.createElement(X,null,s);return a.default.createElement(t.Fragment,null,a.default.createElement(o.FixedSizeList,{width:e,height:n,itemKey:f?(e,t)=>t.menuOptions[e][f]:void 0,itemSize:r,itemData:b,direction:i,ref:m,overscanCount:p,itemCount:c.length},_),!z(c)&&d&&a.default.createElement(X,null,d))},J=l.default.div.withConfig({displayName:"MenuWrapper",componentId:"yf5myu-0"})(["z-index:999;cursor:default;position:absolute;"," "," .","{display:block;overflow:hidden;user-select:none;white-space:nowrap;text-overflow:ellipsis;-webkit-tap-highlight-color:transparent;","}"],(({menuTop:e,menuOpen:t,hideNoOptionsMsg:o,theme:{menu:r}})=>n.css(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],r.width,r.margin,r.padding,r.animation,r.borderRadius,r.backgroundColor,o?"none":r.boxShadow,t?"":"display: none;",e?`top: ${e};`:"")),(({theme:e})=>e.menu.css),c,(({theme:{menu:{option:e}}})=>n.css(["padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}"],e.padding,e.textAlign,u,p,d,e.focusedBgColor,d,e.selectedColor,e.selectedBgColor,p))),Q=e=>{let{menuRef:t,menuTop:n,menuOpen:o,onMenuMouseDown:i,menuPortalTarget:l}=e,s=Y(e,["menuRef","menuTop","menuOpen","onMenuMouseDown","menuPortalTarget"]);const{menuOptions:c,noOptionsMsg:u}=s,d=o&&!Boolean(u)&&!z(c),p=a.default.createElement(J,{ref:t,menuTop:n,menuOpen:o,onMouseDown:i,className:"rfs-menu-container","data-testid":undefined,hideNoOptionsMsg:d},a.default.createElement(G,Object.assign({},s)));return l?r.createPortal(p,l):p},Z=n.css(["z-index:5000;transform:scale(1.26);color:",";"],(({theme:e})=>e.multiValue.clear.focusColor)),ee=l.default.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-211cx7-0"})(["min-width:0;display:flex;"," ",""],(({theme:{multiValue:e}})=>n.css(["margin:",";animation:",";border-radius:",";background-color:",";"],e.margin,e.animation,e.borderRadius,e.backgroundColor)),(({theme:e})=>e.multiValue.css)),te=l.default.div.withConfig({displayName:"Label",componentId:"sc-211cx7-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(({theme:e})=>e.multiValue.label.padding),(({theme:e})=>e.multiValue.label.fontSize),(({theme:e})=>e.multiValue.label.borderRadius)),ne=l.default.i.withConfig({displayName:"Clear",componentId:"sc-211cx7-2"})(["display:flex;font-style:inherit;"," ",""],(({theme:{multiValue:{clear:e}}})=>n.css(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";:hover{","}"],e.color,e.padding,e.fontSize,e.alignSelf,e.transition,e.fontWeight,Z)),(({isFocused:e})=>e&&Z)),oe=t.memo((({data:e,value:t,isFocused:n,renderOptionLabel:o,removeSelectedOption:r})=>a.default.createElement(ee,null,a.default.createElement(te,null,o(e)),a.default.createElement(ne,{isFocused:n,"data-testid":undefined,onMouseDown:N,onClick:()=>r(t),onTouchEnd:()=>r(t)},"✖"))));oe.displayName="MultiValue";function re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ie(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?re(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):re(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const ae=(e,n,o,r,i,a,l,s,c,u,d,p,f)=>{const m=t.useRef(),g=t.useRef(),[h,b]=t.useState(k),v=f?"":n,w=j(p)?p:!!d;return t.useEffect((()=>{m.current=l||(e=>!!e.isDisabled),g.current=s||(({label:e})=>"string"==typeof e?e:`${e}`)}),[l,s]),t.useEffect((()=>{const t=o===y,n=P(v,c,u),l=r.length?new Set(r.map((e=>e.value))):void 0,s=e=>{const o=i(e),r=ie(ie({data:e,value:o,label:a(e)},m.current(e)&&{isDisabled:!0}),(null==l?void 0:l.has(o))&&{isSelected:!0});if(!(n&&!(e=>{const o=P(g.current(e),c,u);return t?o.indexOf(n)>-1:o.substr(0,n.length)===n})(r)||w&&r.isSelected))return r},{length:d}=e,p=[];for(let t=0;t<d;t++){const n=s(e[t]);n&&p.push(n)}b(p)}),[e,r,v,w,o,c,u,i,a]),h},le=(e,n)=>{const o=t.useRef(!0);t.useEffect((()=>{if(!o.current)return e();o.current=!1}),n)},se=(e,n,o,r,i,a,l,s,c,u,d,p)=>{const f=t.useRef(),m=t.useRef(),b=t.useRef(!1),y=t.useRef(!s),[v,w]=t.useState(a),[O,x]=t.useState(!1);t.useEffect((()=>{f.current=d,m.current=p}),[d,p]),t.useEffect((()=>{y.current=!O&&!s}),[O,s]),t.useEffect((()=>{const t=r===g||r===h&&!(e=>{if(!e)return!0;const t=q(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-V(t)-n>=o})(e.current);x(t)}),[e,r]),le((()=>{if(o){const t=e=>{var t;null===(t=f.current)||void 0===t||t.call(f),e&&(b.current=!0,w(e))};y.current?((e,t,n,o)=>{if(!e)return void o();const{top:r,height:i,bottom:a}=e.getBoundingClientRect(),l=window.innerHeight;if(l-r>=i)return void o();const s=q(e),c=V(s),u=s.getBoundingClientRect().height-c-r,d=u<i;if(d||!n)return void o(d?u:void 0);W(s,a-l+c+parseInt(getComputedStyle(e).marginBottom,10),t,o)})(e.current,c,u,t):t()}else{var t;null===(t=m.current)||void 0===t||t.call(m),b.current&&(b.current=!1,w(a))}}),[e,o,a,u,c]);const C=Math.min(v,l*i);return[O?((e,t,n)=>{const o=e>0||!t?e:t.getBoundingClientRect().height,r=n?n.getBoundingClientRect().height:0,i=t&&getComputedStyle(t),a=i?parseInt(i.marginBottom,10):0,l=i?parseInt(i.marginTop,10):0;return"calc("+-Math.abs(o+r)+"px + "+(a+l)+"px)"})(C,e.current,n.current):void 0,C]},ce=n.css(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),ue=l.default.div.withConfig({displayName:"SingleValue",componentId:"sc-153h0ct-0"})([""," max-width:calc(100% - 0.5rem);"],ce),de=l.default.div.withConfig({displayName:"Placeholder",componentId:"sc-153h0ct-1"})([""," color:",";",""],ce,(({theme:e})=>e.color.placeholder),(({theme:e,isFirstRender:t})=>!t&&n.css(["animation:",";"],e.placeholder.animation))),pe=t.memo((({isMulti:e,inputValue:n,placeholder:o,selectedOption:r,focusedMultiValue:i,renderOptionLabel:l,renderMultiOptions:s,removeSelectedOption:c})=>{const u=(()=>{const e=t.useRef(!0);return e.current?(e.current=!1,!0):e.current})();return!n||e&&(!e||z(r)&&!s)?z(r)?e?a.default.createElement(t.Fragment,null,s?s({renderOptionLabel:l,selected:r}):r.map((({data:e,value:t})=>a.default.createElement(oe,{key:t,data:e,value:t,renderOptionLabel:l,isFocused:t===i,removeSelectedOption:c})))):a.default.createElement(ue,null,l(r[0].data)):a.default.createElement(de,{isFirstRender:u},o):null}));pe.displayName="Value";const fe=l.default.div.withConfig({displayName:"SizerDiv",componentId:"o2ype2-0"})(["top:0;left:0;height:0;overflow:scroll;white-space:pre;position:absolute;visibility:hidden;font-size:inherit;font-weight:inherit;font-family:inherit;",""],(({theme:e})=>e.input.css)),me=l.default.input.attrs(m).withConfig({displayName:"Input",componentId:"o2ype2-1"})(["border:0;outline:0;padding:0;cursor:text;background:0;color:inherit;font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:content-box;:read-only{opacity:0;cursor:default;}:required{","}"," ",""],(({theme:e,isInvalid:t})=>t&&e.input.cssRequired),(({theme:e})=>e.input.css),U&&"::-ms-clear{display:none;}"),ge=t.memo(t.forwardRef((({id:e,onBlur:n,onFocus:o,readOnly:r,required:i,onChange:l,ariaLabel:s,inputValue:c,ariaLabelledBy:u,selectedOption:d},p)=>{const f=t.useRef(null),[m,g]=t.useState(2),h=!!i&&!z(d);return le((()=>{f.current&&g(f.current.scrollWidth+2)}),[c]),a.default.createElement(t.Fragment,null,a.default.createElement(me,{id:e,ref:p,isInvalid:!0,onBlur:n,onFocus:o,value:c,readOnly:r,required:h,"aria-label":s,style:{width:m},"aria-labelledby":u,onChange:r?void 0:l}),a.default.createElement(fe,{ref:f},c))})));ge.displayName="AutosizeInput";const he=l.default.span.withConfig({displayName:"A11yText",componentId:"zxgkbx-0"})(["border:0;padding:0;width:1px;height:1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(1px,1px,1px,1px);"]),be=({menuOpen:e,isFocused:t,inputValue:n,optionCount:o,isSearchable:r,focusedOption:i,selectedOption:l,ariaLive:s="polite",ariaLabel:c="Select"})=>{if(!t)return null;const u=` ${o} result(s) available${n?" for search input "+n:""}.`,d=e?"Use Up and Down arrow keys to choose options, press Enter or Tab to select the currently focused option, press Escape to close the menu.":`${c} is focused${r?", type to filter options":""}, press Down arrow key to open the menu.`,{index:p,value:f,label:m,isDisabled:g}=i,h=f?`Focused option: ${m}${g?" - disabled":""}, ${p+1} of ${o}.`:"",b=l.length?l.map((e=>e.label)).join(" "):"N/A";return a.default.createElement(he,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},a.default.createElement("span",{id:"aria-selection"},"Selected option: "+b),a.default.createElement("span",{id:"aria-context"},h+u+d))},ye=l.default.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1j9e0pa-0"})(["display:flex;align-self:center;text-align:center;margin-right:0.25rem;padding:",";> div{border-radius:100%;display:inline-block;",":nth-of-type(1){animation-delay:-0.272s;}:nth-of-type(2){animation-delay:-0.136s;}}"],(({theme:e})=>e.loader.padding),(({theme:{loader:e}})=>n.css(["width:",";height:",";animation:",";background-color:",";"],e.size,e.size,e.animation,e.color))),ve=()=>a.default.createElement(ye,{"aria-hidden":!0,className:"rfs-loading-dots"},a.default.createElement("div",null),a.default.createElement("div",null),a.default.createElement("div",null)),we=l.default.svg.withConfig({displayName:"ClearSvg",componentId:"sc-1v5ipi2-0"})(["fill:currentColor;",""],(({theme:e})=>n.css(["width:",";height:",";animation:",";transition:",";"],e.icon.clear.width,e.icon.clear.height,e.icon.clear.animation,e.icon.clear.transition))),Oe=()=>a.default.createElement(we,{"aria-hidden":!0,viewBox:"0 0 14 16",className:"rfs-clear-icon"},a.default.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})),xe=l.default.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1561oeb-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),Ce=l.default.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1561oeb-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(({theme:e})=>e.icon.color),(({theme:e})=>e.icon.padding),(({theme:e})=>e.icon.hoverColor),(({theme:e})=>e.icon.css)),Se=l.default.div.withConfig({displayName:"Caret",componentId:"sc-1561oeb-2"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(({theme:e})=>e.icon.caret.transition),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e,menuOpen:t,isInvalid:o})=>t&&n.css(["transform:rotate(180deg);color:",";"],o?e.color.danger:e.color.caretActive||e.color.primary))),Ee=l.default.div.withConfig({displayName:"Separator",componentId:"sc-1561oeb-3"})(["width:1px;margin:0.5rem 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(({theme:e})=>e.color.iconSeparator||e.color.border)),Ie=t.memo((({menuOpen:e,clearIcon:t,caretIcon:n,isInvalid:o,showClear:r,isLoading:i,isDisabled:l,loadingNode:s,onCaretMouseDown:c,onClearMouseDown:u})=>{const d=t=>"function"==typeof t?t({menuOpen:e,isLoading:i,isInvalid:o,isDisabled:l}):t;return a.default.createElement(xe,null,r&&!i&&a.default.createElement(Ce,{onTouchEnd:u,onMouseDown:u,"data-testid":undefined},d(t)||a.default.createElement(Oe,null)),i&&(s||a.default.createElement(ve,null)),a.default.createElement(Ee,null),a.default.createElement(Ce,{onTouchEnd:c,onMouseDown:c,"data-testid":undefined},d(n)||a.default.createElement(Se,{"aria-hidden":!0,menuOpen:e,isInvalid:o,className:"rfs-caret-icon"})))}));function Me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ke(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}Ie.displayName="IndicatorIcons";const De=l.default.div.attrs(f).withConfig({displayName:"SelectWrapper",componentId:"kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(({theme:e})=>e.select.css)),Re=l.default.div.withConfig({displayName:"ValueWrapper",componentId:"kcrmu9-1"})(["flex:1 1 0%;display:flex;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;padding:",";"],(({theme:e})=>e.control.padding)),je=l.default.div.withConfig({displayName:"ControlWrapper",componentId:"kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(({isDisabled:e,isFocused:t,isInvalid:o,theme:{control:r,color:i}})=>n.css(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],r.transition,r.borderStyle,r.borderWidth,r.borderRadius,r.height||r.minHeight,o?i.danger:t?r.focusedBorderColor:i.border,r.height?`height: ${r.height};`:"",e?"pointer-events:none;user-select:none;":"",r.backgroundColor||e?`background-color: ${e?i.disabled:r.backgroundColor};`:"",t?`box-shadow: ${r.boxShadow} ${o?i.dangerLight:r.boxShadowColor};`:"")),(({theme:e})=>e.control.css),(({isFocused:e,theme:t})=>e&&t.control.focusedCss)),ze=t.forwardRef((({async:e,isMulti:o,inputId:r,selectId:i,required:l,ariaLive:s,autoFocus:c,isLoading:u,onKeyDown:d,clearIcon:p,caretIcon:f,isInvalid:m,ariaLabel:g,menuWidth:h,isDisabled:E,inputDelay:I,onMenuOpen:D,onMenuClose:R,onInputBlur:P,isClearable:V,themeConfig:A,loadingNode:B,initialValue:$,onInputFocus:q,onInputChange:W,ariaLabelledBy:U,onOptionChange:Y,onSearchChange:_,getOptionLabel:X,getOptionValue:G,itemKeySelector:J,openMenuOnFocus:Z,menuPortalTarget:ee,isAriaLiveEnabled:te,menuOverscanCount:ne,blurInputOnSelect:oe,menuItemDirection:re,renderOptionLabel:ie,renderMultiOptions:ce,menuScrollDuration:ue,filterIgnoreAccents:de,hideSelectedOptions:fe,getIsOptionDisabled:me,getFilterOptionString:he,isSearchable:ye=!0,lazyLoadMenu:ve=!1,openMenuOnClick:we=!0,filterIgnoreCase:Oe=!0,tabSelectsOption:xe=!0,closeMenuOnSelect:Ce=!0,scrollMenuIntoView:Se=!0,backspaceClearsValue:Ee=!0,filterMatchFrom:Me=y,menuPosition:ze=b,options:Le=k,loadingMsg:Ne="Loading..",placeholder:Pe="Select option..",noOptionsMsg:Te="No options",menuItemSize:Fe=35,menuMaxHeight:Ve=300},Ae)=>{const Be=t.useRef(!1),$e=t.useRef(),qe=t.useRef(!1),We=t.useRef(),Ke=t.useRef(),He=t.useRef(null),Ue=t.useRef(null),Ye=t.useRef(null),_e=t.useRef(null),[Xe,Ge]=t.useState(""),[Je,Qe]=t.useState(!1),[Ze,et]=t.useState(!1),[tt,nt]=t.useState(null),[ot,rt]=t.useState(M),it=t.useMemo((()=>(e=>e&&L(e)?F(K,e):K)(A)),[A]),at=t.useMemo((()=>X||(e=>e.label)),[X]),lt=t.useMemo((()=>G||(e=>e.value)),[G]),st=t.useMemo((()=>ie||at),[ie,at]),ct=((e,n=0)=>{const[o,r]=t.useState(e);return t.useEffect((()=>{if(n<=0)return;const t=setTimeout((()=>{r(e)}),n);return()=>{clearTimeout(t)}}),[e,n]),n<=0?e:o})(Xe,I),[ut,dt]=t.useState((()=>T($,lt,at))),pt=ae(Le,ct,Me,ut,lt,at,me,he,Oe,de,o,fe,e),[ft,mt]=se(Ue,_e,Je,ze,Fe,Ve,pt.length,!!ee,ue,Se,D,R),gt=()=>{var e;return null===(e=Ye.current)||void 0===e?void 0:e.blur()},ht=()=>{var e;return null===(e=Ye.current)||void 0===e?void 0:e.focus()},bt=e=>{var t;return null===(t=He.current)||void 0===t?void 0:t.scrollToItem(e)},yt=t.useCallback((e=>{if(!z(pt))return void(!Be.current&&Qe(!0));const t=o?-1:pt.findIndex((e=>e.isSelected)),n=t>-1?t:e===S?0:pt.length-1;!Be.current&&Qe(!0),rt(ke({index:n},pt[n])),bt(n)}),[o,pt]),vt=t.useCallback((e=>{dt((t=>t.filter((t=>t.value!==e))))}),[]),wt=t.useCallback(((e,t)=>{t?o&&vt(e.value):dt((t=>o?[...t,e]:[e]));(j(oe)?oe:H)?gt():Ce&&(Qe(!1),Ge(""))}),[o,Ce,vt,oe]);t.useImperativeHandle(Ae,(()=>({empty:!z(ut),menuOpen:Je,blur:gt,focus:ht,clearValue:()=>{wt.length&&dt(k),ot.data&&rt(M)},setValue:e=>{const t=T(e,lt,at);dt(t)},toggleMenu:e=>{!0===e||void 0===e&&!Je?(!Ze&&ht(),yt(S)):gt()}}))),t.useEffect((()=>{c&&ht()}),[]),t.useEffect((()=>{Be.current=Je}),[Je]),t.useEffect((()=>{Ke.current=Y,We.current=_}),[Y,_]),t.useEffect((()=>{Ze&&Z&&yt(S)}),[Ze,Z,yt]),t.useEffect((()=>{const{current:e}=We;e&&qe.current&&(qe.current=!1,e(ct))}),[ct]),le((()=>{const{current:e}=Ke;if(e){e(o?ut.map((e=>e.data)):z(ut)?ut[0].data:null)}}),[o,ut]),le((()=>{const{length:t}=pt,n=t>0&&(e||t!==Le.length||0===$e.current);0===t?rt(M):(1===t||n)&&(rt(ke({index:0},pt[0])),bt(0)),$e.current=t}),[e,Le,pt]);const Ot=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:r}=ot;e&&!r&&wt({data:e,value:t,label:n},o)},xt=e=>{const t="ArrowDown"===e,n=t?S:C;Je?(e=>{if(!z(pt))return;const t=e===x?(ot.index+1)%pt.length:ot.index>0?ot.index-1:pt.length-1;tt&&nt(null),rt(ke({index:t},pt[t])),bt(t)})(t?x:O):yt(n)},Ct=e=>{if(E)return;Ze||ht();const t="INPUT"!==e.currentTarget.tagName;Je?t&&(Je&&Qe(!1),Xe&&Ge("")):we&&yt(S),t&&e.preventDefault()},St=t.useCallback((e=>{null==P||P(e),et(!1),Qe(!1),Ge("")}),[P]),Et=t.useCallback((e=>{null==q||q(e),et(!0)}),[q]),It=t.useCallback((e=>{const t=e.currentTarget.value||"";qe.current=!0,null==W||W(t),!Be.current&&Qe(!0),Ge(t)}),[W]),Mt=t.useCallback((e=>{dt(k),N(e),ht()}),[]),kt=t.useCallback((e=>{ht(),Be.current?Qe(!1):yt(S),N(e)}),[yt]),Dt=!ve||ve&&Je,Rt=E||!ye||!!tt,jt=!(!V||E||!z(ut)),zt=E||we?void 0:kt;return a.default.createElement(n.ThemeProvider,{theme:it},a.default.createElement(De,{id:i,"aria-controls":r,"aria-expanded":Je,onKeyDown:e=>{if(E)return;if(d&&(d(e,Xe,ot),e.defaultPrevented))return;const{key:t}=e;switch(t){case"ArrowDown":case"ArrowUp":xt(t);break;case"ArrowLeft":case"ArrowRight":if(!o||Xe||ce)return;(e=>{if(!z(ut))return;let t=-1;const n=ut.length-1,o=tt?ut.findIndex((e=>e.value===tt)):-1;t=e===v?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const r=t>=0?ut[t].value:null;ot.data&&rt(M),r!==tt&&nt(r)})("ArrowLeft"===t?w:v);break;case" ":if(Xe)return;if(Je){if(!ot.data)return;Ot()}else yt(S);break;case"Enter":Je&&229!==e.keyCode&&Ot();break;case"Escape":Je&&(Qe(!1),Ge(""));break;case"Tab":if(!Je||!xe||!ot.data||e.shiftKey)return;Ot();break;case"Delete":case"Backspace":if(Xe)return;if(tt){const e=ut.findIndex((e=>e.value===tt)),t=e>-1&&e<ut.length-1?ut[e+1].value:null;vt(tt),nt(t)}else{if(!Ee)return;if(!z(ut))break;if(o&&!ce){const{value:e}=ut[ut.length-1];vt(e)}else V&&dt(k)}break;default:return}e.preventDefault()}},a.default.createElement(je,{ref:_e,isInvalid:m,isFocused:Ze,isDisabled:E,className:"rfs-control-container",onTouchEnd:Ct,onMouseDown:Ct,"data-testid":undefined},a.default.createElement(Re,null,a.default.createElement(pe,{isMulti:o,inputValue:Xe,placeholder:Pe,selectedOption:ut,focusedMultiValue:tt,renderOptionLabel:st,renderMultiOptions:ce,removeSelectedOption:vt}),a.default.createElement(ge,{id:r,ref:Ye,required:l,ariaLabel:g,inputValue:Xe,readOnly:Rt,onBlur:St,onFocus:Et,onChange:It,ariaLabelledBy:U,selectedOption:ut})),a.default.createElement(Ie,{menuOpen:Je,clearIcon:p,caretIcon:f,isInvalid:m,isLoading:u,showClear:jt,isDisabled:E,loadingNode:B,onClearMouseDown:Mt,onCaretMouseDown:zt})),Dt&&a.default.createElement(Q,{menuRef:Ue,menuOpen:Je,isLoading:u,menuTop:ft,height:mt,itemSize:Fe,loadingMsg:Ne,menuOptions:pt,fixedSizeListRef:He,noOptionsMsg:Te,selectOption:wt,direction:re,itemKeySelector:J,overscanCount:ne,menuPortalTarget:ee,width:h||it.menu.width,onMenuMouseDown:e=>{N(e),ht()},renderOptionLabel:st,focusedOptionIndex:ot.index}),te&&a.default.createElement(be,{ariaLive:s,menuOpen:Je,isFocused:Ze,ariaLabel:g,inputValue:Xe,isSearchable:ye,focusedOption:ot,selectedOption:ut,optionCount:pt.length})))}));ze.displayName="Select",e.Select=ze,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("styled-components"),require("react-window"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","styled-components","react-window","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactFunctionalSelect={},e.React,e.styled,e.ReactWindow,e.ReactDOM)}(this,(function(e,t,n,o,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=i(t),l=i(n);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const c="rfs-option",d="rfs-option-focused",u="rfs-option-selected",p="rfs-option-disabled",f={role:"combobox","aria-haspopup":"listbox",className:"rfs-select-container","data-testid":undefined},m={tabIndex:0,type:"text",spellCheck:!1,autoCorrect:"off",autoComplete:"off",autoCapitalize:"none","aria-autocomplete":"list",className:"rfs-autosize-input","data-testid":undefined},g="top",h="auto",b="bottom",y="any",v=0,w=1,O=0,x=1,C=2,S=3,E=n.keyframes(["0%,80%,100%{transform:scale(0);}40%{transform:scale(1.0);}"]),I=n.css([""," 0.25s ease-in-out"],n.keyframes(["from{opacity:0;}to{opacity:1;}"])),k={index:-1},M=e=>e.label,D=e=>e.value,j=e=>!!e.isDisabled,z=({label:e})=>"string"==typeof e?e:`${e}`,L=[];function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}const R=/[\u0300-\u036f]/g;function P(e){return"boolean"==typeof e}function T(e){return Array.isArray(e)&&!!e.length}function F(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}const V=e=>{e.preventDefault(),e.stopPropagation()};function A(e,t,n){let o=e.trim();return t&&(o=o.toLowerCase()),n?function(e){return e.normalize("NFD").replace(R,"")}(o):o}const B=(e,t,n)=>{const o=Array.isArray(e)?e:F(e)?[e]:L;return T(o)?o.map((e=>({data:e,value:t(e),label:n(e)}))):o},$=(e,t)=>{const n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e);return Object.keys(t).forEach((o=>{const r=t[o];n[o]="animation"!==o&&F(r)?e[o]?$(e[o],r):r:r||""})),n},q=/(auto|scroll)/;function W(e){return K(e)?window.pageYOffset:e.scrollTop}function K(e){return e===document.body||e===document.documentElement||e===window}function H({overflow:e,overflowX:t,overflowY:n}){return q.test(`${e}${t}${n}`)}function U(e){let t=getComputedStyle(e);const n=document.documentElement,o="absolute"===t.position;if("fixed"===t.position)return n;for(let n=e;n=null===(r=n)||void 0===r?void 0:r.parentElement;){var r;if(t=getComputedStyle(n),(!o||"static"!==t.position)&&H(t))return n}return n}function Y(e,t,n=300,o){let r=0;const i=W(e),a=t-i;requestAnimationFrame((function t(){r+=5;const l=a*((s=(s=r)/n-1)*s*s+1)+i;var s;!function(e,t){K(e)?window.scrollTo(0,t):e.scrollTop=t}(e,l),r<n?requestAnimationFrame(t):null==o||o()}))}const _={color:{border:"#ced4da",danger:"#dc3545",primary:"#007bff",disabled:"#e9ecef",placeholder:"#6E7276",dangerLight:"rgba(220, 53, 69, 0.25)"},input:{},select:{},loader:{size:"0.625rem",padding:"0.375rem 0.75rem",animation:n.css([""," 1.19s ease-in-out infinite"],E),color:"rgba(0, 123, 255, 0.42)"},icon:{color:"#ccc",hoverColor:"#A6A6A6",padding:"0 0.9375rem",clear:{width:"14px",height:"16px",animation:I,transition:"color 0.2s ease-out"},caret:{size:"7px",transition:"transform 0.3s ease-in-out, color 0.2s ease-out"}},control:{minHeight:"38px",borderWidth:"1px",borderStyle:"solid",borderRadius:"3px",boxShadow:"0 0 0 0.2rem",padding:"0.375rem 0.75rem",boxShadowColor:"rgba(0, 123, 255, 0.25)",focusedBorderColor:"rgba(0, 123, 255, 0.75)",transition:"box-shadow 0.2s ease-out, border-color 0.2s ease-out"},menu:{padding:"0",width:"100%",margin:"0.5rem 0",borderRadius:"3px",backgroundColor:"#fff",animation:I,boxShadow:"0 0.5em 1em -0.125em rgb(10 10 10 / 12%), 0 0 0 1px rgb(10 10 10 / 4%)",option:{textAlign:"left",selectedColor:"#fff",selectedBgColor:"#007bff",padding:"0.375rem 0.75rem",focusedBgColor:"rgba(0, 123, 255, 0.15)"}},noOptions:{fontSize:"1.25rem",margin:"0.25rem 0",color:"hsl(0, 0%, 60%)",padding:"0.375rem 0.75rem"},placeholder:{animation:I},multiValue:{margin:"1px 2px",borderRadius:"3px",backgroundColor:"#e7edf3",animation:I,label:{borderRadius:"3px",fontSize:"0.825em",padding:"1px 0 1px 6px"},clear:{fontWeight:600,padding:"0 6px",color:"#a6a6a6",fontSize:"0.65em",alignSelf:"center",focusColor:"#808080",transition:"color 0.2s ease-out, transform 0.2s ease-out, z-index 0.2s ease-out"}}},X="undefined"!=typeof window&&"ontouchstart"in window||"undefined"!=typeof navigator&&!!navigator.maxTouchPoints,G="undefined"!=typeof navigator&&/(MSIE|Trident\/|Edge\/)/i.test(navigator.userAgent);function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const Z=(e,n,o,r,i,a,l,s,c=!1,d=!1,u=!1,p=!1,f)=>{const[m,g]=t.useState(L),h=p?"":n,b=P(f)?f:u;return t.useEffect((()=>{const{current:t}=l,{current:n}=s,u=A(h,c,d),p=r.length?new Set(r.map((e=>e.value))):void 0,f=e=>{const r=i(e),l=Q(Q({data:e,value:r,label:a(e)},t(e)&&{isDisabled:!0}),(null==p?void 0:p.has(r))&&{isSelected:!0});if(!(u&&!(e=>{const t=A(n(e),c,d);return o===y?t.indexOf(u)>-1:t.substr(0,u.length)===u})(l)||b&&l.isSelected))return l},m=e.reduce(((e,t)=>{const n=f(t);return n&&e.push(n),e}),[]);g(m)}),[e,h,i,a,r,o,c,d,l,s,b]),m},ee=(e,n)=>{const o=t.useRef(e||n);return t.useEffect((()=>{o.current=e||n}),[e,n]),o},te=(e,n)=>{const o=t.useRef(!0);t.useEffect((()=>{if(!o.current)return e();o.current=!1}),n)},ne=(e,n,o,r,i,a,l,s,c,d,u,p)=>{const f=t.useRef(!1),m=t.useRef(!s),[b,y]=t.useState(a),[v,w]=t.useState(!1);t.useEffect((()=>{m.current=!v&&!s}),[v,s]),t.useEffect((()=>{const t=r===g||r===h&&!(e=>{if(!e)return!0;const t=U(e),{top:n,height:o}=e.getBoundingClientRect();return t.getBoundingClientRect().height-W(t)-n>=o})(e.current);w(t)}),[e,r]),te((()=>{if(o){const t=e=>{var t;null===(t=c.current)||void 0===t||t.call(c),e&&(f.current=!0,y(e))};m.current?((e,t,n,o)=>{if(!e)return void o();const{top:r,height:i,bottom:a}=e.getBoundingClientRect(),l=window.innerHeight;if(l-r>=i)return void o();const s=U(e),c=W(s),d=s.getBoundingClientRect().height-c-r,u=d<i;if(u||!n)return void o(u?d:void 0);const p=getComputedStyle(e).marginBottom;Y(s,a-l+c+parseInt(p,10),t,o)})(e.current,u,p,t):t()}else{var t;null===(t=d.current)||void 0===t||t.call(d),f.current&&(f.current=!1,y(a))}}),[e,o,a,p,u,d,c]);const O=Math.min(b,l*i);return[v?((e,t,n)=>{const o=e>0||!t?e:t.getBoundingClientRect().height,r=n?n.getBoundingClientRect().height:0,i=t&&getComputedStyle(t),a=i?parseInt(i.marginBottom,10):0,l=i?parseInt(i.marginTop,10):0;return`calc(${-Math.abs(o+r)}px + ${a+l}px)`})(O,e.current,n.current):void 0,O]};function oe(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}const re=t.memo((({index:e,style:t,data:{menuOptions:n,selectOption:o,renderOptionLabel:r,focusedOptionIndex:i}})=>{const{data:l,value:s,label:d,isDisabled:u,isSelected:p}=n[e],f=function(e,t,n){let o=c;return e&&(o+=" rfs-option-disabled"),t&&(o+=" rfs-option-selected"),n&&(o+=" rfs-option-focused"),o}(u,p,e===i);return a.default.createElement("div",{style:t,onClick:u?void 0:()=>o({data:l,value:s,label:d},p),className:f},r(l))}),o.areEqual);re.displayName="Option";const ie=l.default.div.withConfig({displayName:"NoOptionsMsg",componentId:"v1y124-0"})(["text-align:center;color:",";margin:",";padding:",";font-size:",";",""],(({theme:e})=>e.noOptions.color),(({theme:e})=>e.noOptions.margin),(({theme:e})=>e.noOptions.padding),(({theme:e})=>e.noOptions.fontSize),(({theme:e})=>e.noOptions.css)),ae=({width:e,height:n,itemSize:r,direction:i,isLoading:l,loadingMsg:s,menuOptions:c,selectOption:d,noOptionsMsg:u,overscanCount:p,itemKeySelector:f,fixedSizeListRef:m,renderOptionLabel:g,focusedOptionIndex:h})=>{const b=t.useMemo((()=>({menuOptions:c,selectOption:d,renderOptionLabel:g,focusedOptionIndex:h})),[c,h,d,g]);if(l)return a.default.createElement(ie,null,s);return a.default.createElement(t.Fragment,null,a.default.createElement(o.FixedSizeList,{width:e,height:n,itemKey:f?(e,t)=>t.menuOptions[e][f]:void 0,itemSize:r,itemData:b,direction:i,ref:m,overscanCount:p,itemCount:c.length},re),!T(c)&&u&&a.default.createElement(ie,null,u))},le=l.default.div.withConfig({displayName:"MenuWrapper",componentId:"yf5myu-0"})(["z-index:999;cursor:default;position:absolute;"," "," .","{display:block;overflow:hidden;user-select:none;white-space:nowrap;text-overflow:ellipsis;-webkit-tap-highlight-color:transparent;padding:",";text-align:",";&.",",&:hover:not(.","):not(.","){background-color:",";}&.","{color:",";background-color:",";}&.","{opacity:0.35;}}"],(({menuTop:e,menuOpen:t,hideNoOptionsMsg:o,theme:{menu:r}})=>n.css(["width:",";margin:",";padding:",";animation:",";border-radius:",";background-color:",";box-shadow:",";"," ",""],r.width,r.margin,r.padding,r.animation,r.borderRadius,r.backgroundColor,o?"none":r.boxShadow,t?"":"display: none;",e?`top: ${e};`:"")),(({theme:e})=>e.menu.css),c,(({theme:e})=>e.menu.option.padding),(({theme:e})=>e.menu.option.textAlign),d,p,u,(({theme:e})=>e.menu.option.focusedBgColor),u,(({theme:e})=>e.menu.option.selectedColor),(({theme:e})=>e.menu.option.selectedBgColor),p),se=e=>{let{menuRef:t,menuTop:n,menuOpen:o,onMenuMouseDown:i,menuPortalTarget:l}=e,s=oe(e,["menuRef","menuTop","menuOpen","onMenuMouseDown","menuPortalTarget"]);const{menuOptions:c,noOptionsMsg:d}=s,u=o&&!Boolean(d)&&!T(c),p=a.default.createElement(le,{ref:t,menuTop:n,menuOpen:o,onMouseDown:i,className:"rfs-menu-container","data-testid":undefined,hideNoOptionsMsg:u},a.default.createElement(ae,Object.assign({},s)));return l?r.createPortal(p,l):p},ce=n.css(["z-index:5000;transform:scale(1.26);color:",";"],(({theme:e})=>e.multiValue.clear.focusColor)),de=l.default.div.withConfig({displayName:"MultiValueWrapper",componentId:"sc-211cx7-0"})(["min-width:0;display:flex;"," ",""],(({theme:{multiValue:e}})=>n.css(["margin:",";animation:",";border-radius:",";background-color:",";"],e.margin,e.animation,e.borderRadius,e.backgroundColor)),(({theme:e})=>e.multiValue.css)),ue=l.default.div.withConfig({displayName:"Label",componentId:"sc-211cx7-1"})(["overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding:",";font-size:",";border-radius:",";"],(({theme:e})=>e.multiValue.label.padding),(({theme:e})=>e.multiValue.label.fontSize),(({theme:e})=>e.multiValue.label.borderRadius)),pe=l.default.i.withConfig({displayName:"Clear",componentId:"sc-211cx7-2"})(["display:flex;font-style:inherit;"," ",""],(({theme:{multiValue:{clear:e}}})=>n.css(["color:",";padding:",";font-size:",";align-self:",";transition:",";font-weight:",";:hover{","}"],e.color,e.padding,e.fontSize,e.alignSelf,e.transition,e.fontWeight,ce)),(({isFocused:e})=>e&&ce)),fe=t.memo((({data:e,value:t,isFocused:n,renderOptionLabel:o,removeSelectedOption:r})=>{const i=()=>r(t);return a.default.createElement(de,null,a.default.createElement(ue,null,o(e)),a.default.createElement(pe,{isFocused:n,onClick:i,onTouchEnd:i,onMouseDown:V,"data-testid":undefined},"✖"))}));fe.displayName="MultiValue";const me=n.css(["top:50%;overflow:hidden;position:absolute;white-space:nowrap;box-sizing:border-box;text-overflow:ellipsis;transform:translateY(-50%);"]),ge=l.default.div.withConfig({displayName:"SingleValue",componentId:"sc-153h0ct-0"})([""," max-width:calc(100% - 0.5rem);"],me),he=l.default.div.withConfig({displayName:"Placeholder",componentId:"sc-153h0ct-1"})([""," color:",";",""],me,(({theme:e})=>e.color.placeholder),(({theme:e,isFirstRender:t})=>!t&&n.css(["animation:",";"],e.placeholder.animation))),be=t.memo((({isMulti:e,inputValue:n,placeholder:o,selectedOption:r,focusedMultiValue:i,renderOptionLabel:l,renderMultiOptions:s,removeSelectedOption:c})=>{const d=(()=>{const e=t.useRef(!0);return e.current?(e.current=!1,!0):e.current})();return!n||e&&(!e||T(r)&&!s)?T(r)?e?a.default.createElement(t.Fragment,null,s?s({renderOptionLabel:l,selected:r}):r.map((({data:e,value:t})=>a.default.createElement(fe,{key:t,data:e,value:t,renderOptionLabel:l,isFocused:t===i,removeSelectedOption:c})))):a.default.createElement(ge,null,l(r[0].data)):a.default.createElement(he,{isFirstRender:d},o):null}));be.displayName="Value";const ye=l.default.div.withConfig({displayName:"SizerDiv",componentId:"o2ype2-0"})(["top:0;left:0;height:0;overflow:scroll;white-space:pre;position:absolute;visibility:hidden;font-size:inherit;font-weight:inherit;font-family:inherit;",""],(({theme:e})=>e.input.css)),ve=l.default.input.attrs(m).withConfig({displayName:"Input",componentId:"o2ype2-1"})(["border:0;outline:0;padding:0;cursor:text;background:0;color:inherit;font-size:inherit;font-weight:inherit;font-family:inherit;box-sizing:content-box;:read-only{opacity:0;cursor:default;}:required{","}"," ",""],(({theme:e,isInvalid:t})=>t&&e.input.cssRequired),(({theme:e})=>e.input.css),G&&"::-ms-clear{display:none;}"),we=t.memo(t.forwardRef((({id:e,onBlur:n,onFocus:o,readOnly:r,required:i,onChange:l,ariaLabel:s,inputValue:c,ariaLabelledBy:d,hasSelectedOptions:u},p)=>{const f=t.useRef(null),[m,g]=t.useState(2),h=!!i&&!u;return te((()=>{f.current&&g(f.current.scrollWidth+2)}),[c]),a.default.createElement(t.Fragment,null,a.default.createElement(ve,{id:e,ref:p,isInvalid:!0,onBlur:n,onFocus:o,value:c,readOnly:r,required:h,"aria-label":s,style:{width:m},"aria-labelledby":d,onChange:r?void 0:l}),a.default.createElement(ye,{ref:f},c))})));we.displayName="AutosizeInput";const Oe=l.default.span.withConfig({displayName:"A11yText",componentId:"zxgkbx-0"})(["border:0;padding:0;width:1px;height:1px;z-index:9999;overflow:hidden;position:absolute;white-space:nowrap;clip:rect(1px,1px,1px,1px);"]),xe=({menuOpen:e,isFocused:t,inputValue:n,optionCount:o,isSearchable:r,focusedOption:i,selectedOption:l,ariaLive:s="polite",ariaLabel:c="Select"})=>{if(!t)return null;const d=` ${o} result(s) available${n?" for search input "+n:""}.`,u=e?"Use Up and Down arrow keys to choose options, press Enter or Tab to select the currently focused option, press Escape to close the menu.":`${c} is focused${r?", type to filter options":""}, press Down arrow key to open the menu.`,{index:p,value:f,label:m,isDisabled:g}=i,h=f?`Focused option: ${m}${g?" - disabled":""}, ${p+1} of ${o}.`:"",b="Selected option: "+(l.length?l.map((e=>e.label)).join(" "):"N/A"),y=`${h} ${d} ${u}`.trimStart();return a.default.createElement(Oe,{"aria-atomic":"false","aria-live":s,"aria-relevant":"additions text"},a.default.createElement("span",{id:"aria-selection"},b),a.default.createElement("span",{id:"aria-context"},y))},Ce=l.default.div.withConfig({displayName:"StyledLoadingDots",componentId:"sc-1j9e0pa-0"})(["display:flex;align-self:center;text-align:center;margin-right:0.25rem;padding:",";> div{border-radius:100%;display:inline-block;",":nth-of-type(1){animation-delay:-0.272s;}:nth-of-type(2){animation-delay:-0.136s;}}"],(({theme:e})=>e.loader.padding),(({theme:{loader:e}})=>n.css(["width:",";height:",";animation:",";background-color:",";"],e.size,e.size,e.animation,e.color))),Se=()=>a.default.createElement(Ce,{"aria-hidden":!0,className:"rfs-loading-dots"},a.default.createElement("div",null),a.default.createElement("div",null),a.default.createElement("div",null)),Ee=l.default.svg.withConfig({displayName:"ClearSvg",componentId:"sc-1v5ipi2-0"})(["fill:currentColor;",""],(({theme:e})=>n.css(["width:",";height:",";animation:",";transition:",";"],e.icon.clear.width,e.icon.clear.height,e.icon.clear.animation,e.icon.clear.transition))),Ie=()=>a.default.createElement(Ee,{"aria-hidden":!0,viewBox:"0 0 14 16",className:"rfs-clear-icon"},a.default.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})),ke=l.default.div.withConfig({displayName:"IndicatorIconsWrapper",componentId:"sc-1561oeb-0"})(["display:flex;flex-shrink:0;align-items:center;align-self:stretch;box-sizing:border-box;"]),Me=l.default.div.withConfig({displayName:"IndicatorIcon",componentId:"sc-1561oeb-1"})(["height:100%;display:flex;align-items:center;box-sizing:border-box;color:",";padding:",";:hover{color:",";}",""],(({theme:e})=>e.icon.color),(({theme:e})=>e.icon.padding),(({theme:e})=>e.icon.hoverColor),(({theme:e})=>e.icon.css)),De=l.default.div.withConfig({displayName:"Caret",componentId:"sc-1561oeb-2"})(["transition:",";border-top:"," dashed;border-left:"," solid transparent;border-right:"," solid transparent;",""],(({theme:e})=>e.icon.caret.transition),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e})=>e.icon.caret.size),(({theme:e,menuOpen:t,isInvalid:o})=>t&&n.css(["transform:rotate(180deg);color:",";"],o?e.color.danger:e.color.caretActive||e.color.primary))),je=l.default.div.withConfig({displayName:"Separator",componentId:"sc-1561oeb-3"})(["width:1px;margin:0.5rem 0;align-self:stretch;box-sizing:border-box;background-color:",";"],(({theme:e})=>e.color.iconSeparator||e.color.border)),ze=t.memo((({menuOpen:e,clearIcon:t,caretIcon:n,isInvalid:o,showClear:r,isLoading:i,isDisabled:l,loadingNode:s,onCaretMouseDown:c,onClearMouseDown:d})=>{const u=t=>"function"==typeof t?t({menuOpen:e,isLoading:i,isInvalid:o,isDisabled:l}):t;return a.default.createElement(ke,null,r&&!i&&a.default.createElement(Me,{onTouchEnd:d,onMouseDown:d,"data-testid":undefined},u(t)||a.default.createElement(Ie,null)),i&&(s||a.default.createElement(Se,null)),a.default.createElement(je,null),a.default.createElement(Me,{onTouchEnd:c,onMouseDown:c,"data-testid":undefined},u(n)||a.default.createElement(De,{"aria-hidden":!0,menuOpen:e,isInvalid:o,className:"rfs-caret-icon"})))}));function Le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Le(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Le(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}ze.displayName="IndicatorIcons";const Re=l.default.div.attrs(f).withConfig({displayName:"SelectWrapper",componentId:"kcrmu9-0"})(["position:relative;box-sizing:border-box;",""],(({theme:e})=>e.select.css)),Pe=l.default.div.withConfig({displayName:"ValueWrapper",componentId:"kcrmu9-1"})(["flex:1 1 0%;display:flex;flex-wrap:wrap;overflow:hidden;position:relative;align-items:center;box-sizing:border-box;padding:",";"],(({theme:e})=>e.control.padding)),Te=l.default.div.withConfig({displayName:"ControlWrapper",componentId:"kcrmu9-2"})(["outline:0;display:flex;flex-wrap:wrap;cursor:default;position:relative;align-items:center;box-sizing:border-box;justify-content:space-between;"," "," ",""],(({isDisabled:e,isFocused:t,isInvalid:o,theme:{control:r,color:i}})=>n.css(["transition:",";border-style:",";border-width:",";border-radius:",";min-height:",";border-color:",";"," "," "," ",""],r.transition,r.borderStyle,r.borderWidth,r.borderRadius,r.height||r.minHeight,o?i.danger:t?r.focusedBorderColor:i.border,r.height?`height: ${r.height};`:"",e?"pointer-events:none;user-select:none;":"",r.backgroundColor||e?`background-color: ${e?i.disabled:r.backgroundColor};`:"",t?`box-shadow: ${r.boxShadow} ${o?i.dangerLight:r.boxShadowColor};`:"")),(({theme:e})=>e.control.css),(({isFocused:e,theme:t})=>e&&t.control.focusedCss)),Fe=t.forwardRef((({async:e,isMulti:o,inputId:r,selectId:i,required:l,ariaLive:s,autoFocus:c,isLoading:d,onKeyDown:u,clearIcon:p,caretIcon:f,isInvalid:m,ariaLabel:g,menuWidth:h,isDisabled:E,inputDelay:I,onMenuOpen:N,onMenuClose:R,onInputBlur:A,isClearable:q,themeConfig:W,loadingNode:K,initialValue:H,onInputFocus:U,onInputChange:Y,ariaLabelledBy:G,onOptionChange:J,onSearchChange:Q,getOptionLabel:oe,getOptionValue:re,itemKeySelector:ie,openMenuOnFocus:ae,menuPortalTarget:le,isAriaLiveEnabled:ce,menuOverscanCount:de,blurInputOnSelect:ue,menuItemDirection:pe,renderOptionLabel:fe,renderMultiOptions:me,menuScrollDuration:ge,filterIgnoreAccents:he,hideSelectedOptions:ye,getIsOptionDisabled:ve,getFilterOptionString:Oe,isSearchable:Ce=!0,lazyLoadMenu:Se=!1,openMenuOnClick:Ee=!0,filterIgnoreCase:Ie=!0,tabSelectsOption:ke=!0,closeMenuOnSelect:Me=!0,scrollMenuIntoView:De=!0,backspaceClearsValue:je=!0,filterMatchFrom:Le=y,menuPosition:Fe=b,options:Ve=L,loadingMsg:Ae="Loading..",placeholder:Be="Select option..",noOptionsMsg:$e="No options",menuItemSize:qe=35,menuMaxHeight:We=300},Ke)=>{const He=t.useRef(!1),Ue=t.useRef(),Ye=t.useRef(!1),_e=t.useRef(null),Xe=t.useRef(null),Ge=t.useRef(null),Je=t.useRef(null),[Qe,Ze]=t.useState(""),[et,tt]=t.useState(!1),[nt,ot]=t.useState(!1),[rt,it]=t.useState(null),[at,lt]=t.useState(k),st=t.useMemo((()=>(e=>e&&F(e)?$(_,e):_)(W)),[W]),ct=ee(N),dt=ee(R),ut=ee(Q),pt=ee(J),ft=ee(ve,j),mt=ee(Oe,z),gt=t.useMemo((()=>oe||M),[oe]),ht=t.useMemo((()=>re||D),[re]),bt=t.useMemo((()=>fe||gt),[fe,gt]),yt=((e,n=0)=>{const[o,r]=t.useState(e);return t.useEffect((()=>{if(n<=0)return;const t=setTimeout((()=>{r(e)}),n);return()=>{clearTimeout(t)}}),[e,n]),n<=0?e:o})(Qe,I),[vt,wt]=t.useState((()=>B(H,ht,gt))),Ot=Z(Ve,yt,Le,vt,ht,gt,ft,mt,Ie,he,o,e,ye),[xt,Ct]=ne(Xe,Je,et,Fe,qe,We,Ot.length,!!le,ct,dt,ge,De),St=()=>{var e;return null===(e=Ge.current)||void 0===e?void 0:e.blur()},Et=()=>{var e;return null===(e=Ge.current)||void 0===e?void 0:e.focus()},It=e=>{var t;return null===(t=_e.current)||void 0===t?void 0:t.scrollToItem(e)},kt=t.useCallback((e=>{if(!T(Ot))return void(!He.current&&tt(!0));const t=o?-1:Ot.findIndex((e=>e.isSelected)),n=t>-1?t:e===S?0:Ot.length-1;!He.current&&tt(!0),lt(Ne({index:n},Ot[n])),It(n)}),[o,Ot]),Mt=t.useCallback((e=>{wt((t=>t.filter((t=>t.value!==e))))}),[]),Dt=t.useCallback(((e,t)=>{t?o&&Mt(e.value):wt((t=>o?[...t,e]:[e]));(P(ue)?ue:X)?St():Me&&(tt(!1),Ze(""))}),[o,Me,Mt,ue]),jt=T(vt);t.useImperativeHandle(Ke,(()=>({empty:!jt,menuOpen:He.current,blur:St,focus:Et,clearValue:()=>{wt(L),lt(k)},setValue:e=>{const t=B(e,ht,gt);wt(t)},toggleMenu:e=>{!0===e||void 0===e&&!He.current?(Et(),kt(S)):St()}})),[jt,ht,gt,kt]),t.useEffect((()=>{c&&Et()}),[]),t.useEffect((()=>{He.current=et}),[et]),t.useEffect((()=>{nt&&ae&&kt(S)}),[nt,ae,kt]),t.useEffect((()=>{const{current:e}=ut;e&&Ye.current&&(Ye.current=!1,e(yt))}),[yt]),te((()=>{const{current:e}=pt;if(e){e(o?vt.map((e=>e.data)):T(vt)?vt[0].data:null)}}),[o,vt]),te((()=>{const{length:t}=Ot,n=t>0&&(e||t!==Ve.length||0===Ue.current);0===t?lt(k):(1===t||n)&&(lt(Ne({index:0},Ot[0])),It(0)),Ue.current=t}),[e,Ve,Ot]);const zt=()=>{const{data:e,value:t,label:n,isSelected:o,isDisabled:r}=at;e&&!r&&Dt({data:e,value:t,label:n},o)},Lt=e=>{const t="ArrowDown"===e,n=t?S:C;et?(e=>{if(!T(Ot))return;const t=e===x?(at.index+1)%Ot.length:at.index>0?at.index-1:Ot.length-1;rt&&it(null),lt(Ne({index:t},Ot[t])),It(t)})(t?x:O):kt(n)},Nt=e=>{if(E)return;nt||Et();const t="INPUT"!==e.currentTarget.tagName;et?t&&(et&&tt(!1),Qe&&Ze("")):Ee&&kt(S),t&&e.preventDefault()},Rt=t.useCallback((e=>{null==A||A(e),ot(!1),tt(!1),Ze("")}),[A]),Pt=t.useCallback((e=>{null==U||U(e),ot(!0)}),[U]),Tt=t.useCallback((e=>{Ye.current=!0;const t=e.currentTarget.value||"";null==Y||Y(t),Ze(t),!He.current&&tt(!0)}),[Y]),Ft=t.useCallback((e=>{Et(),He.current?tt(!1):kt(S),V(e)}),[kt]),Vt=t.useCallback((e=>{Et(),wt(L),V(e)}),[]),At=!Se||Se&&et,Bt=!(!q||E||!jt),$t=E||!Ce||!!rt,qt=E||Ee?void 0:Ft;return a.default.createElement(n.ThemeProvider,{theme:st},a.default.createElement(Re,{id:i,"aria-controls":r,"aria-expanded":et,onKeyDown:e=>{if(!(E||u&&(u(e,Qe,at),e.defaultPrevented))){switch(e.key){case"ArrowDown":case"ArrowUp":Lt(e.key);break;case"ArrowLeft":case"ArrowRight":if(!o||Qe||me)return;(e=>{if(!jt)return;let t=-1;const n=vt.length-1,o=rt?vt.findIndex((e=>e.value===rt)):-1;t=e===v?o>-1&&o<n?o+1:-1:0!==o?-1===o?n:o-1:0;const r=t>=0?vt[t].value:null;at.data&<(k),r!==rt&&it(r)})("ArrowLeft"===e.key?w:v);break;case" ":if(Qe)return;if(et){if(!at.data)return;zt()}else kt(S);break;case"Enter":et&&229!==e.keyCode&&zt();break;case"Escape":et&&(tt(!1),Ze(""));break;case"Tab":if(!et||!ke||!at.data||e.shiftKey)return;zt();break;case"Delete":case"Backspace":if(Qe)return;if(rt){const e=vt.findIndex((e=>e.value===rt)),t=e>-1&&e<vt.length-1?vt[e+1].value:null;Mt(rt),it(t)}else{if(!je)return;if(!jt)break;if(o&&!me){const{value:e}=vt[vt.length-1];Mt(e)}else q&&wt(L)}break;default:return}e.preventDefault()}}},a.default.createElement(Te,{ref:Je,isInvalid:m,isFocused:nt,isDisabled:E,className:"rfs-control-container",onTouchEnd:Nt,onMouseDown:Nt,"data-testid":undefined},a.default.createElement(Pe,null,a.default.createElement(be,{isMulti:o,inputValue:Qe,placeholder:Be,selectedOption:vt,focusedMultiValue:rt,renderMultiOptions:me,renderOptionLabel:bt,removeSelectedOption:Mt}),a.default.createElement(we,{id:r,ref:Ge,required:l,ariaLabel:g,inputValue:Qe,readOnly:$t,onBlur:Rt,onFocus:Pt,onChange:Tt,ariaLabelledBy:G,hasSelectedOptions:jt})),a.default.createElement(ze,{menuOpen:et,clearIcon:p,caretIcon:f,isInvalid:m,isLoading:d,showClear:Bt,isDisabled:E,loadingNode:K,onClearMouseDown:Vt,onCaretMouseDown:qt})),At&&a.default.createElement(se,{menuRef:Xe,menuOpen:et,isLoading:d,menuTop:xt,height:Ct,itemSize:qe,loadingMsg:Ae,menuOptions:Ot,fixedSizeListRef:_e,noOptionsMsg:$e,selectOption:Dt,direction:pe,itemKeySelector:ie,overscanCount:de,menuPortalTarget:le,width:h||st.menu.width,onMenuMouseDown:e=>{V(e),Et()},renderOptionLabel:bt,focusedOptionIndex:at.index}),ce&&a.default.createElement(xe,{ariaLive:s,menuOpen:et,isFocused:nt,ariaLabel:g,inputValue:Qe,isSearchable:Ce,focusedOption:at,selectedOption:vt,optionCount:Ot.length})))}));Fe.displayName="Select",e.Select=Fe,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -5,3 +5,3 @@ import React from 'react'; | ||
import type { ReactNode, ReactText, KeyboardEvent, FocusEventHandler } from 'react'; | ||
import type { OptionData, PartialDeep, IconRenderer, FocusedOption, SelectedOption, CallbackFunction, AriaLiveAttribute } from './types'; | ||
import type { OptionData, PartialDeep, IconRenderer, FocusedOption, SelectedOption, CallbackFunction, AriaLiveAttribute, OptionLabelCallback, OptionValueCallback } from './types'; | ||
export declare type Theme = PartialDeep<DefaultTheme>; | ||
@@ -76,2 +76,4 @@ export declare type MultiParams = Readonly<{ | ||
menuItemDirection?: 'ltr' | 'rtl'; | ||
getOptionLabel?: OptionLabelCallback; | ||
getOptionValue?: OptionValueCallback; | ||
onInputChange?: (value?: string) => any; | ||
@@ -81,4 +83,2 @@ initialValue?: OptionData | OptionData[]; | ||
onOptionChange?: (data: OptionData) => any; | ||
getOptionLabel?: (data: OptionData) => ReactText; | ||
getOptionValue?: (data: OptionData) => ReactText; | ||
onInputBlur?: FocusEventHandler<HTMLInputElement>; | ||
@@ -140,2 +140,4 @@ onInputFocus?: FocusEventHandler<HTMLInputElement>; | ||
menuItemDirection?: "ltr" | "rtl" | undefined; | ||
getOptionLabel?: OptionLabelCallback | undefined; | ||
getOptionValue?: OptionValueCallback | undefined; | ||
onInputChange?: ((value?: string | undefined) => any) | undefined; | ||
@@ -145,4 +147,2 @@ initialValue?: OptionData | OptionData[]; | ||
onOptionChange?: ((data: OptionData) => any) | undefined; | ||
getOptionLabel?: ((data: OptionData) => ReactText) | undefined; | ||
getOptionValue?: ((data: OptionData) => ReactText) | undefined; | ||
onInputBlur?: React.FocusEventHandler<HTMLInputElement> | undefined; | ||
@@ -164,2 +164,2 @@ onInputFocus?: React.FocusEventHandler<HTMLInputElement> | undefined; | ||
}>>>; | ||
export { Select }; | ||
export default Select; |
import React, { useRef, useMemo, useState, useEffect, forwardRef, useCallback, useImperativeHandle } from 'react'; | ||
import { isBoolean, mergeThemes, normalizeValue, IS_TOUCH_DEVICE, isArrayWithLength, suppressMouseOrTouchEvent } from './utils'; | ||
import { ValueIndexEnum, FilterMatchEnum, OptionIndexEnum, MenuPositionEnum, EMPTY_ARRAY, SELECT_WRAPPER_ATTRS, PLACEHOLDER_DEFAULT, LOADING_MSG_DEFAULT, CONTROL_CONTAINER_CLS, FOCUSED_OPTION_DEFAULT, NO_OPTIONS_MSG_DEFAULT, MENU_ITEM_SIZE_DEFAULT, MENU_MAX_HEIGHT_DEFAULT, CONTROL_CONTAINER_TESTID } from './constants'; | ||
import { isBoolean, mergeThemes, suppressEvent, normalizeValue, IS_TOUCH_DEVICE, isArrayWithLength } from './utils'; | ||
import { ValueIndexEnum, FilterMatchEnum, OptionIndexEnum, MenuPositionEnum, EMPTY_ARRAY, SELECT_WRAPPER_ATTRS, PLACEHOLDER_DEFAULT, LOADING_MSG_DEFAULT, CONTROL_CONTAINER_CLS, FOCUSED_OPTION_DEFAULT, NO_OPTIONS_MSG_DEFAULT, MENU_ITEM_SIZE_DEFAULT, MENU_MAX_HEIGHT_DEFAULT, CONTROL_CONTAINER_TESTID, GET_OPTION_LABEL_DEFAULT, GET_OPTION_VALUE_DEFAULT, GET_OPTION_FILTER_DEFAULT, GET_OPTION_DISABLED_DEFAULT } from './constants'; | ||
import { useDebounce, useCallbackRef, useMenuOptions, useMountEffect, useUpdateEffect, useMenuPositioner } from './hooks'; | ||
import styled, { css, ThemeProvider } from 'styled-components'; | ||
import { Menu, Value, AriaLiveRegion, AutosizeInput, IndicatorIcons } from './components'; | ||
import { useDebounce, useMenuPositioner, useMenuOptions, useMountEffect, useUpdateEffect } from './hooks'; | ||
const SelectWrapper = styled.div.attrs(SELECT_WRAPPER_ATTRS) ` | ||
@@ -65,4 +65,2 @@ position: relative; | ||
const onChangeEventValue = useRef(false); | ||
const onSearchChangeRef = useRef(); | ||
const onOptionChangeRef = useRef(); | ||
// DOM element refs | ||
@@ -81,5 +79,13 @@ const listRef = useRef(null); | ||
const theme = useMemo(() => mergeThemes(themeConfig), [themeConfig]); | ||
// Write certain callback props to ref objects. Prevent effects using these props | ||
// ..from excessive executions if they are not memoized or change frequently. | ||
const onMenuOpenRef = useCallbackRef(onMenuOpen); | ||
const onMenuCloseRef = useCallbackRef(onMenuClose); | ||
const onSearchChangeRef = useCallbackRef(onSearchChange); | ||
const onOptionChangeRef = useCallbackRef(onOptionChange); | ||
const getIsOptionDisabledRef = useCallbackRef(getIsOptionDisabled, GET_OPTION_DISABLED_DEFAULT); | ||
const getFilterOptionStringRef = useCallbackRef(getFilterOptionString, GET_OPTION_FILTER_DEFAULT); | ||
// Memoized callback functions referencing optional function properties on Select.tsx | ||
const getOptionLabelFn = useMemo(() => getOptionLabel || ((data) => data.label), [getOptionLabel]); | ||
const getOptionValueFn = useMemo(() => getOptionValue || ((data) => data.value), [getOptionValue]); | ||
const getOptionLabelFn = useMemo(() => getOptionLabel || GET_OPTION_LABEL_DEFAULT, [getOptionLabel]); | ||
const getOptionValueFn = useMemo(() => getOptionValue || GET_OPTION_VALUE_DEFAULT, [getOptionValue]); | ||
const renderOptionLabelFn = useMemo(() => renderOptionLabel || getOptionLabelFn, [renderOptionLabel, getOptionLabelFn]); | ||
@@ -91,5 +97,5 @@ // Custom hook abstraction that debounces search input value (opt-in) | ||
// Custom hook abstraction that handles the creation of menuOptions | ||
const menuOptions = useMenuOptions(options, debouncedInputValue, filterMatchFrom, selectedOption, getOptionValueFn, getOptionLabelFn, getIsOptionDisabled, getFilterOptionString, filterIgnoreCase, filterIgnoreAccents, isMulti, hideSelectedOptions, async); | ||
const menuOptions = useMenuOptions(options, debouncedInputValue, filterMatchFrom, selectedOption, getOptionValueFn, getOptionLabelFn, getIsOptionDisabledRef, getFilterOptionStringRef, filterIgnoreCase, filterIgnoreAccents, isMulti, async, hideSelectedOptions); | ||
// Custom hook abstraction that handles calculating menuHeightCalc (defaults to menuMaxHeight) / handles executing callbacks/logic on menuOpen state change. | ||
const [menuStyleTop, menuHeightCalc] = useMenuPositioner(menuRef, controlRef, menuOpen, menuPosition, menuItemSize, menuMaxHeight, menuOptions.length, !!menuPortalTarget, menuScrollDuration, scrollMenuIntoView, onMenuOpen, onMenuClose); | ||
const [menuStyleTop, menuHeightCalc] = useMenuPositioner(menuRef, controlRef, menuOpen, menuPosition, menuItemSize, menuMaxHeight, menuOptions.length, !!menuPortalTarget, onMenuOpenRef, onMenuCloseRef, menuScrollDuration, scrollMenuIntoView); | ||
const blurInput = () => inputRef.current?.blur(); | ||
@@ -137,16 +143,16 @@ const focusInput = () => inputRef.current?.focus(); | ||
}, [isMulti, closeMenuOnSelect, removeSelectedOption, blurInputOnSelect]); | ||
const hasSelectedOptions = isArrayWithLength(selectedOption); | ||
/** | ||
* useImperativeHandle. | ||
* Exposed API methods/properties available on a ref instance of this Select.tsx component. | ||
* Dependency list passed as the third param to re-create the handle when one of them updates. | ||
*/ | ||
useImperativeHandle(ref, () => ({ | ||
empty: !isArrayWithLength(selectedOption), | ||
menuOpen, | ||
empty: !hasSelectedOptions, | ||
menuOpen: menuOpenRef.current, | ||
blur: blurInput, | ||
focus: focusInput, | ||
clearValue: () => { | ||
if (selectOption.length) | ||
setSelectedOption(EMPTY_ARRAY); | ||
if (focusedOption.data) | ||
setFocusedOption(FOCUSED_OPTION_DEFAULT); | ||
setSelectedOption(EMPTY_ARRAY); | ||
setFocusedOption(FOCUSED_OPTION_DEFAULT); | ||
}, | ||
@@ -158,4 +164,4 @@ setValue: (option) => { | ||
toggleMenu: (state) => { | ||
if (state === true || (state === undefined && !menuOpen)) { | ||
!isFocused && focusInput(); | ||
if (state === true || (state === undefined && !menuOpenRef.current)) { | ||
focusInput(); | ||
openMenuAndFocusOption(OptionIndexEnum.FIRST); | ||
@@ -167,3 +173,3 @@ } | ||
} | ||
})); | ||
}), [hasSelectedOptions, getOptionValueFn, getOptionLabelFn, openMenuAndFocusOption]); | ||
/** | ||
@@ -184,10 +190,2 @@ * useMountEffect: | ||
/** | ||
* Write value of 'onOptionChange' & 'onSearchChange' props to ref object. | ||
* Prevent effects using these props from excessive executions if they are not memoized or change frequently. | ||
*/ | ||
useEffect(() => { | ||
onOptionChangeRef.current = onOptionChange; | ||
onSearchChangeRef.current = onSearchChange; | ||
}, [onOptionChange, onSearchChange]); | ||
/** | ||
* If control recieves focus & openMenuOnFocus = true, open menu | ||
@@ -252,3 +250,3 @@ */ | ||
const focusValueOnArrowKey = (direction) => { | ||
if (!isArrayWithLength(selectedOption)) | ||
if (!hasSelectedOptions) | ||
return; | ||
@@ -304,7 +302,6 @@ let nextFocusedIdx = -1; | ||
} | ||
const { key } = e; | ||
switch (key) { | ||
switch (e.key) { | ||
case 'ArrowDown': | ||
case 'ArrowUp': { | ||
handleUpDownKeySubRoutine(key); | ||
handleUpDownKeySubRoutine(e.key); | ||
break; | ||
@@ -316,3 +313,3 @@ } | ||
return; | ||
const leftRightIndex = key === 'ArrowLeft' ? ValueIndexEnum.PREVIOUS : ValueIndexEnum.NEXT; | ||
const leftRightIndex = e.key === 'ArrowLeft' ? ValueIndexEnum.PREVIOUS : ValueIndexEnum.NEXT; | ||
focusValueOnArrowKey(leftRightIndex); | ||
@@ -370,3 +367,3 @@ break; | ||
return; | ||
if (!isArrayWithLength(selectedOption)) | ||
if (!hasSelectedOptions) | ||
break; | ||
@@ -405,3 +402,3 @@ if (isMulti && !renderMultiOptions) { | ||
const handleOnMenuMouseDown = (e) => { | ||
suppressMouseOrTouchEvent(e); | ||
suppressEvent(e); | ||
focusInput(); | ||
@@ -420,21 +417,21 @@ }; | ||
const handleOnInputChange = useCallback((e) => { | ||
onChangeEventValue.current = true; | ||
const newInputVal = e.currentTarget.value || ''; | ||
onChangeEventValue.current = true; | ||
onInputChange?.(newInputVal); | ||
setInputValue(newInputVal); | ||
!menuOpenRef.current && setMenuOpen(true); | ||
setInputValue(newInputVal); | ||
}, [onInputChange]); | ||
const handleOnClearMouseDown = useCallback((e) => { | ||
setSelectedOption(EMPTY_ARRAY); | ||
suppressMouseOrTouchEvent(e); | ||
focusInput(); | ||
}, []); | ||
const handleOnCaretMouseDown = useCallback((e) => { | ||
focusInput(); | ||
menuOpenRef.current ? setMenuOpen(false) : openMenuAndFocusOption(OptionIndexEnum.FIRST); | ||
suppressMouseOrTouchEvent(e); | ||
suppressEvent(e); | ||
}, [openMenuAndFocusOption]); | ||
const handleOnClearMouseDown = useCallback((e) => { | ||
focusInput(); | ||
setSelectedOption(EMPTY_ARRAY); | ||
suppressEvent(e); | ||
}, []); | ||
const renderMenu = !lazyLoadMenu || (lazyLoadMenu && menuOpen); | ||
const showClear = !!(isClearable && !isDisabled && hasSelectedOptions); | ||
const inputReadOnly = isDisabled || !isSearchable || !!focusedMultiValue; | ||
const showClear = !!(isClearable && !isDisabled && isArrayWithLength(selectedOption)); | ||
const handleOnCaretMouseDownOrNoop = (!isDisabled && !openMenuOnClick) ? handleOnCaretMouseDown : undefined; | ||
@@ -445,4 +442,4 @@ return (React.createElement(ThemeProvider, { theme: theme }, | ||
React.createElement(ValueWrapper, null, | ||
React.createElement(Value, { isMulti: isMulti, inputValue: inputValue, placeholder: placeholder, selectedOption: selectedOption, focusedMultiValue: focusedMultiValue, renderOptionLabel: renderOptionLabelFn, renderMultiOptions: renderMultiOptions, removeSelectedOption: removeSelectedOption }), | ||
React.createElement(AutosizeInput, { id: inputId, ref: inputRef, required: required, ariaLabel: ariaLabel, inputValue: inputValue, readOnly: inputReadOnly, onBlur: handleOnInputBlur, onFocus: handleOnInputFocus, onChange: handleOnInputChange, ariaLabelledBy: ariaLabelledBy, selectedOption: selectedOption })), | ||
React.createElement(Value, { isMulti: isMulti, inputValue: inputValue, placeholder: placeholder, selectedOption: selectedOption, focusedMultiValue: focusedMultiValue, renderMultiOptions: renderMultiOptions, renderOptionLabel: renderOptionLabelFn, removeSelectedOption: removeSelectedOption }), | ||
React.createElement(AutosizeInput, { id: inputId, ref: inputRef, required: required, ariaLabel: ariaLabel, inputValue: inputValue, readOnly: inputReadOnly, onBlur: handleOnInputBlur, onFocus: handleOnInputFocus, onChange: handleOnInputChange, ariaLabelledBy: ariaLabelledBy, hasSelectedOptions: hasSelectedOptions })), | ||
React.createElement(IndicatorIcons, { menuOpen: menuOpen, clearIcon: clearIcon, caretIcon: caretIcon, isInvalid: isInvalid, isLoading: isLoading, showClear: showClear, isDisabled: isDisabled, loadingNode: loadingNode, onClearMouseDown: handleOnClearMouseDown, onCaretMouseDown: handleOnCaretMouseDownOrNoop })), | ||
@@ -453,2 +450,2 @@ renderMenu && (React.createElement(Menu, { menuRef: menuRef, menuOpen: menuOpen, isLoading: isLoading, menuTop: menuStyleTop, height: menuHeightCalc, itemSize: menuItemSize, loadingMsg: loadingMsg, menuOptions: menuOptions, fixedSizeListRef: listRef, noOptionsMsg: noOptionsMsg, selectOption: selectOption, direction: menuItemDirection, itemKeySelector: itemKeySelector, overscanCount: menuOverscanCount, menuPortalTarget: menuPortalTarget, width: menuWidth || theme.menu.width, onMenuMouseDown: handleOnMenuMouseDown, renderOptionLabel: renderOptionLabelFn, focusedOptionIndex: focusedOption.index })), | ||
Select.displayName = 'Select'; | ||
export { Select }; | ||
export default Select; |
// Test for IE or legacy Edge (exclude "Edg" check for chromium-based Edge browser) | ||
const _msBrowserRegExp = /(MSIE|Trident\/|Edge\/)/i; | ||
const MS_BROWSER_REG_EXP = /(MSIE|Trident\/|Edge\/)/i; | ||
/** | ||
@@ -11,2 +11,2 @@ * Determines if the current device is touch-enabled. | ||
*/ | ||
export const IS_MICROSOFT_BROWSER = typeof navigator !== 'undefined' && _msBrowserRegExp.test(navigator.userAgent); | ||
export const IS_MICROSOFT_BROWSER = typeof navigator !== 'undefined' && MS_BROWSER_REG_EXP.test(navigator.userAgent); |
@@ -0,1 +1,2 @@ | ||
const OVERFLOW_REG_EXP = /(auto|scroll)/; | ||
/** | ||
@@ -27,6 +28,4 @@ * @private | ||
function isDocumentElement(el) { | ||
return el === document.documentElement || el === document.body || el === window; | ||
return el === document.body || el === document.documentElement || el === window; | ||
} | ||
// Test CSSStyleDeclaration props for auto/scroll values - determines scroll eligibility. | ||
const _overflowRegExp = /(auto|scroll)/; | ||
/** | ||
@@ -36,4 +35,3 @@ * @private | ||
function isScrollableStyle({ overflow, overflowX, overflowY }) { | ||
const overflowTestStr = `${overflow}${overflowX}${overflowY}`; | ||
return _overflowRegExp.test(overflowTestStr); | ||
return OVERFLOW_REG_EXP.test(`${overflow}${overflowX}${overflowY}`); | ||
} | ||
@@ -89,3 +87,3 @@ /** | ||
const adjustPx = marginBottom + marginTop; | ||
return 'calc(' + basePx + 'px + ' + adjustPx + 'px)'; | ||
return `calc(${basePx}px + ${adjustPx}px)`; | ||
}; | ||
@@ -97,4 +95,4 @@ export const menuFitsBelowControl = (el) => { | ||
const { top, height } = el.getBoundingClientRect(); | ||
const scrollSpaceBelow = scrollParent.getBoundingClientRect().height - getScrollTop(scrollParent) - top; | ||
return scrollSpaceBelow >= height; | ||
const spaceBelow = scrollParent.getBoundingClientRect().height - getScrollTop(scrollParent) - top; | ||
return spaceBelow >= height; | ||
}; | ||
@@ -120,4 +118,4 @@ /** | ||
const scrollTop = getScrollTop(scrollParent); | ||
const scrollSpaceBelow = scrollParent.getBoundingClientRect().height - scrollTop - top; | ||
const notEnoughSpaceBelow = scrollSpaceBelow < height; | ||
const spaceBelow = scrollParent.getBoundingClientRect().height - scrollTop - top; | ||
const notEnoughSpaceBelow = spaceBelow < height; | ||
// Sufficient space does not exist to scroll menu fully into view | ||
@@ -127,3 +125,3 @@ // ...Calculate available space and use that as the the new menuHeight (use scrollSpaceBelow for now). | ||
if (notEnoughSpaceBelow || !scrollMenuIntoView) { | ||
const condensedMenuHeight = notEnoughSpaceBelow ? scrollSpaceBelow : undefined; | ||
const condensedMenuHeight = notEnoughSpaceBelow ? spaceBelow : undefined; | ||
handleOnMenuOpen(condensedMenuHeight); | ||
@@ -133,5 +131,6 @@ return; | ||
// Do scroll and upon scroll animation completion, execute the callback if defined | ||
const marginBottom = parseInt(getComputedStyle(menuEl).marginBottom, 10); | ||
const marginBottomStyle = getComputedStyle(menuEl).marginBottom; | ||
const marginBottom = parseInt(marginBottomStyle, 10); | ||
const scrollDown = bottom - viewInner + scrollTop + marginBottom; | ||
smoothScrollTo(scrollParent, scrollDown, menuScrollDuration, handleOnMenuOpen); | ||
}; |
@@ -1,3 +0,3 @@ | ||
import type { ReactText } from 'react'; | ||
import type { MouseOrTouchEvent, OptionData, SelectedOption } from '../types'; | ||
import type { SyntheticEvent } from 'react'; | ||
import type { SelectedOption, OptionValueCallback, OptionLabelCallback } from '../types'; | ||
/** | ||
@@ -20,6 +20,5 @@ * Test if typeof parameter is boolean. | ||
/** | ||
* Handle mouse/touch events by suppressing event propagation, | ||
* and in some cases, preventing the default behavior. | ||
* Call preventDefault() and stopPropagation() on event. | ||
*/ | ||
export declare const suppressMouseOrTouchEvent: (e: MouseOrTouchEvent<HTMLElement>, preventDefault?: boolean) => void; | ||
export declare const suppressEvent: (e: SyntheticEvent<Element>) => void; | ||
/** | ||
@@ -29,3 +28,3 @@ * Apply regex to string, and if the value is NOT case sensitive, | ||
*/ | ||
export declare function trimAndFormatFilterStr(value: string, filterIgnoreCase?: boolean, filterIgnoreAccents?: boolean): string; | ||
export declare function trimAndFormatFilterStr(value: string, filterIgnoreCase: boolean, filterIgnoreAccents: boolean): string; | ||
/** | ||
@@ -38,3 +37,3 @@ * Builds the className property in Option.tsx component. | ||
*/ | ||
export declare const normalizeValue: (value: any, getOptionValue: (data: OptionData) => ReactText, getOptionLabel: (data: OptionData) => ReactText) => SelectedOption[]; | ||
export declare const normalizeValue: (value: any, getOptionValue: OptionValueCallback, getOptionLabel: OptionLabelCallback) => SelectedOption[]; | ||
/** | ||
@@ -41,0 +40,0 @@ * Immutable implementation of mergeDeep for two objects. Will return the merged result. |
import { OPTION_CLS, EMPTY_ARRAY, OPTION_FOCUSED_CLS, OPTION_SELECTED_CLS, OPTION_DISABLED_CLS, } from '../constants'; | ||
const _diacriticsRegExp = /[\u0300-\u036f]/g; | ||
const DIACRITICS_REG_EXP = /[\u0300-\u036f]/g; | ||
/** | ||
@@ -10,3 +10,3 @@ * @private | ||
function stripDiacritics(value) { | ||
return value.normalize('NFD').replace(_diacriticsRegExp, ''); | ||
return value.normalize('NFD').replace(DIACRITICS_REG_EXP, ''); | ||
} | ||
@@ -38,7 +38,6 @@ /** | ||
/** | ||
* Handle mouse/touch events by suppressing event propagation, | ||
* and in some cases, preventing the default behavior. | ||
* Call preventDefault() and stopPropagation() on event. | ||
*/ | ||
export const suppressMouseOrTouchEvent = (e, preventDefault = true) => { | ||
preventDefault && e.preventDefault(); | ||
export const suppressEvent = (e) => { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
@@ -45,0 +44,0 @@ }; |
{ | ||
"name": "react-functional-select", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"description": "Micro-sized and micro-optimized select component for React.js", | ||
@@ -52,11 +52,11 @@ "main": "./dist/index.cjs.js", | ||
"@rollup/plugin-typescript": "^8.2.1", | ||
"@storybook/addon-storysource": "^6.2.7", | ||
"@storybook/addons": "^6.2.7", | ||
"@storybook/addon-storysource": "^6.2.8", | ||
"@storybook/addons": "^6.2.8", | ||
"@storybook/preset-create-react-app": "^3.1.7", | ||
"@storybook/react": "^6.2.7", | ||
"@storybook/react": "^6.2.8", | ||
"@testing-library/jest-dom": "^5.11.10", | ||
"@testing-library/react": "^11.2.6", | ||
"@testing-library/user-event": "^13.1.2", | ||
"@testing-library/user-event": "^13.1.3", | ||
"@types/jest": "^26.0.22", | ||
"@types/node": "^14.14.37", | ||
"@types/node": "^14.14.41", | ||
"@types/react": "^17.0.3", | ||
@@ -66,8 +66,8 @@ "@types/react-dom": "^17.0.3", | ||
"@types/styled-components": "^5.1.9", | ||
"@typescript-eslint/eslint-plugin": "^4.21.0", | ||
"@typescript-eslint/parser": "^4.21.0", | ||
"@typescript-eslint/eslint-plugin": "^4.22.0", | ||
"@typescript-eslint/parser": "^4.22.0", | ||
"babel-jest": "^26.6.3", | ||
"babel-loader": "^8.2.2", | ||
"babel-plugin-styled-components": "^1.12.0", | ||
"concurrently": "^6.0.1", | ||
"concurrently": "^6.0.2", | ||
"cross-env": "^7.0.3", | ||
@@ -77,4 +77,4 @@ "enzyme": "^3.11.0", | ||
"eslint-config-poetez": "^1.0.0", | ||
"eslint-config-prettier": "^8.1.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"eslint-config-prettier": "^8.2.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"jest": "^26.6.3", | ||
@@ -92,3 +92,3 @@ "jest-enzyme": "^7.1.2", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.45.1", | ||
"rollup": "^2.45.2", | ||
"rollup-plugin-terser": "^7.0.2", | ||
@@ -95,0 +95,0 @@ "styled-components": "^5.2.3", |
@@ -1,5 +0,6 @@ | ||
[![Latest Stable Version](https://img.shields.io/npm/v/react-functional-select.svg?style=for-the-badge)](https://www.npmjs.com/package/react-functional-select) | ||
[![Issues](https://img.shields.io/github/issues/based-ghost/react-functional-select.svg?style=for-the-badge)](https://github.com/based-ghost/react-functional-select/issues) | ||
[![License](https://img.shields.io/badge/license-mit-red.svg?style=for-the-badge)](https://www.npmjs.com/package/react-functional-select) | ||
[![Downloads](https://img.shields.io/npm/dt/react-functional-select?style=for-the-badge)](https://www.npmjs.com/package/react-functional-select) | ||
[![NPM](https://img.shields.io/npm/v/react-functional-select.svg?style=flat-square)](https://www.npmjs.com/package/react-functional-select) | ||
[![npm downloads](https://img.shields.io/npm/dt/react-functional-select.svg?style=flat-square)](https://www.npmjs.com/package/react-functional-select) | ||
[![Issues](https://img.shields.io/github/issues/based-ghost/react-functional-select.svg?style=flat-square)](https://github.com/based-ghost/react-functional-select/issues) | ||
[![License](https://img.shields.io/badge/license-mit-red.svg?style=flat-square)](LICENSE) | ||
[![style: styled-components](https://img.shields.io/badge/style-%F0%9F%92%85%20styled--components-orange.svg?style=flat-square)](https://github.com/styled-components/styled-components) | ||
@@ -6,0 +7,0 @@ # react-functional-select |
187356
78
2390
187