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A,EACVG,QAASA,EACTJ,YAAaA,EACbS,UAAWA,IAEb,GAAAiC,EAAAsB,GAAA,EAACoC,EAAAA,CAAeA,CAAAA,UACb1B,GAAQ,CAACG,GACR,GAAAnC,EAAAsB,GAAA,EAACqC,EAAkBA,CACjB5G,eAAgBA,EAChBC,eAAgBA,EAChBC,YAAagF,EACb5E,QAASA,EACTW,eAAgBC,MAAAA,EAAAA,KAAAA,EAAAA,OAAAA,CAAAA,EAAAA,EAAKqB,OAAO,GAAZrB,KAAAA,IAAAA,EAAAA,KAAAA,EAAAA,OAAAA,CAAAA,EAAAA,EAAc2F,qBAAqB,GAAnC3F,KAAAA,IAAAA,EAAAA,KAAAA,EAAAA,EAAAA,IAAAA,CAAAA,GAChBN,SAAUA,EACVC,MAAOA,EACPV,OAAQA,EACRC,iBAAkBA,EAClBU,MAAOA,EACPC,QAASA,EACTN,YAAaA,EACbC,QAASA,EACTL,WAAY6F,EACZ1F,SAAUA,EACVQ,UAAWA,EACXL,QAASA,EACTJ,YAAaA,QAMzB,sECnKO,IAAMkD,EAAmB,CAC9BqD,OAAQ,CACNC,EAAG,IACHC,QAAS,EACTC,cAAe,MACjB,EACAC,QAAS,CACPH,EAAG,EACHC,QAAS,EACTG,WAAY,CACVC,SAAU,IACVC,KAAM,SACNC,QAAS,GACTC,UAAW,GACb,EACAN,cAAe,KACjB,EACArD,KAAM,CACJmD,EAAG,IACHC,QAAS,EACTG,WAAY,CACVC,SAAU,IACVC,KAAM,SACNC,QAAS,GACTC,UAAW,GACb,EACAN,cAAe,MACjB,CACF,4CC9BYjF,mCAAAA,EAAAA,GAAAA,CAAAA,EAAAA,CAAAA,CAAAA,8JCCZwF,EAAAC,OAAA,EAAkB,2LCAlBD,EAAAC,OAAA,EAAkB,4ZCAlBD,EAAAC,OAAA,EAAkB,iKCAlBD,EAAAC,OAAA,EAAkB","sources":["webpack://_N_E/../../packages/common/src/components/SelectInput/Options/index.tsx","webpack://_N_E/../../packages/common/src/components/SelectInput/Input/index.tsx","webpack://_N_E/../../packages/common/src/components/SelectInput/index.tsx","webpack://_N_E/../../packages/common/src/components/SelectInput/variants.ts","webpack://_N_E/../../packages/common/src/enums/keyboardKey.ts","webpack://_N_E/../../packages/common/src/components/SelectInput/Options/styles-skeleton.module.scss","webpack://_N_E/../../packages/common/src/components/SelectInput/Options/styles.module.scss","webpack://_N_E/../../packages/common/src/components/SelectInput/styles-skeleton.module.scss","webpack://_N_E/../../packages/common/src/components/SelectInput/styles.module.scss"],"sourcesContent":["import { useInfiniteScroll } from '@starsoft/common/hooks';\nimport { OptionsProps } from './props';\nimport { motion } from 'framer-motion';\nimport { dropIn } from '../variants';\nimport styles from './styles.module.scss';\nimport skeleton from './styles-skeleton.module.scss';\nimport { memo, useCallback, useEffect, useState } from 'react';\nimport { ErrorCard } from '@starsoft/common/components';\nimport { Nullable } from '@starsoft/common/interfaces';\nimport { KeyboardKey } from '@starsoft/common/enums';\n\n/**\n * SelectInputOptions Component\n * A dropdown options list component for SelectInput that supports keyboard navigation,\n * infinite scrolling, async loading, and custom option rendering.\n *\n * @component\n * @template T - The type of the option objects\n * @template V - The type of the selected value\n *\n * @param {Object} props - Component props\n * @param {(option: T) => string} props.getOptionLabel - Function to get display label from option\n * @param {(option: T) => V} props.getOptionValue - Function to get value from option\n * @param {() => void} props.handleClose - Function to close the dropdown\n * @param {boolean} props.cardBg - Whether to use card background styling\n * @param {Object} props.customComponents - Custom rendering components\n * @param {boolean} props.isInverted - Whether dropdown position is inverted\n * @param {T[]} props.options - Array of options to display\n * @param {boolean} props.loadingMore - Whether more options are being loaded\n * @param {() => void} props.loadMore - Function to load more options\n * @param {boolean} props.hasNextPage - Whether more options can be loaded\n * @param {boolean} props.isAsync - Whether options are loaded asynchronously\n * @param {boolean} props.loading - Whether initial options are loading\n * @param {(value: T) => void} props.setValue - Function to set selected value\n * @param {V} props.value - Currently selected value\n * @param {Error} props.error - Error object if request failed\n * @param {() => void} props.refetch - Function to retry failed request\n * @param {string} props.popLayout - Layout style for the dropdown\n * @param {DOMRect} props.parentBounding - Parent element bounding rectangle\n * @returns {JSX.Element} The rendered options dropdown\n *\n * @example\n * type User = {\n * id: number;\n * name: string;\n * };\n *\n * \n * getOptionLabel={(user) => user.name}\n * getOptionValue={(user) => user.id}\n * handleClose={() => setIsOpen(false)}\n * options={users}\n * loading={isLoading}\n * loadingMore={isLoadingMore}\n * loadMore={fetchNextPage}\n * hasNextPage={hasMore}\n * isAsync={true}\n * setValue={(user) => setSelectedUser(user)}\n * value={selectedUserId}\n * />\n */\nfunction SelectInputOptions({\n getOptionLabel,\n getOptionValue,\n handleClose,\n cardBg,\n customComponents,\n isInverted = false,\n options,\n loadingMore = false,\n loadMore = () => {},\n hasNextPage = false,\n isAsync = false,\n loading = false,\n setValue,\n value,\n error,\n refetch,\n popLayout,\n parentBounding,\n}: OptionsProps) {\n // Hook for handling infinite scroll functionality\n const { ref } = useInfiniteScroll({\n hasMore: hasNextPage,\n isLoading: loadingMore || loading,\n loadMore,\n condition: isAsync,\n });\n\n // State to track keyboard-highlighted option index\n const [highlightedIndex, setHighlightedIndex] =\n useState>(null);\n\n /**\n * Handles selection of an option\n * Sets the value and closes the dropdown\n *\n * @param {T} value - The selected option\n */\n const handleSelectFilter = useCallback(\n (value: T) => {\n setValue(value);\n handleClose();\n },\n [setValue, handleClose],\n );\n\n /**\n * Handles keyboard navigation events\n * Supports up/down arrows for navigation and enter for selection\n *\n * @param {KeyboardEvent} e - Keyboard event\n */\n const handleKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (!options.length) return;\n\n switch (e.key) {\n case KeyboardKey.ARROW_DOWN:\n setHighlightedIndex(prevIndex =>\n prevIndex === null || prevIndex === options.length - 1\n ? 0\n : prevIndex + 1,\n );\n break;\n case KeyboardKey.ARROW_UP:\n setHighlightedIndex(prevIndex =>\n prevIndex === null || prevIndex === 0\n ? options.length - 1\n : prevIndex - 1,\n );\n break;\n case KeyboardKey.ENTER:\n if (highlightedIndex === null) {\n break;\n }\n\n e.preventDefault();\n handleSelectFilter(options[highlightedIndex]);\n break;\n }\n },\n [handleSelectFilter, highlightedIndex, options],\n );\n\n /**\n * Sets up keyboard event listeners on mount\n * Cleans up listeners on unmount\n */\n function onMount() {\n window.addEventListener('keydown', handleKeyDown);\n\n return () => {\n window.removeEventListener('keydown', handleKeyDown);\n };\n }\n\n /**\n * Scrolls highlighted option into view when changed\n */\n function onChangeHighlightedIndex() {\n if (!ref.current || !highlightedIndex) {\n return;\n }\n const children: HTMLDivElement[] = Array.from(\n ref.current.children,\n ) as HTMLDivElement[];\n const targetElement: HTMLDivElement = children[highlightedIndex];\n\n if (!targetElement) {\n return;\n }\n\n targetElement.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n });\n }\n\n useEffect(onChangeHighlightedIndex, [highlightedIndex, ref]);\n\n useEffect(onMount, [\n highlightedIndex,\n options,\n handleSelectFilter,\n handleKeyDown,\n ]);\n\n return (\n \n {(loading &&\n (customComponents?.customSkeletonOption\n ? Array.from({ length: 10 }).map((_, index) => {\n return customComponents.customSkeletonOption?.(\n `load-more-options-select-${index}`,\n );\n })\n : Array.from({ length: 10 }).map((_, index) => {\n return (\n \n
\n
\n );\n }))) ||\n options.map((option, index) =>\n customComponents?.customOption ? (\n customComponents?.customOption({\n option,\n selected:\n getOptionValue(option) === value || highlightedIndex === index,\n handleSelect: handleSelectFilter,\n key: `select-input-option-${index}`,\n })\n ) : (\n handleSelectFilter(option)}\n >\n {getOptionLabel(option)}\n \n ),\n )}\n\n {loadingMore &&\n isAsync &&\n (customComponents?.customSkeletonOption\n ? Array.from({ length: 10 }).map((_, index) => {\n return customComponents.customSkeletonOption?.(\n `load-more-options-select-${index}`,\n );\n })\n : Array.from({ length: 10 }).map((_, index) => {\n return (\n \n
\n
\n );\n }))}\n {error && }\n \n );\n}\n\nexport default memo(SelectInputOptions) as typeof SelectInputOptions;\n","import { useEffect, useMemo, useState } from 'react';\nimport { SelectInputProps } from '../props';\n\nimport styles from '../styles.module.scss';\n\n/**\n * SelectInputOptionInput Component\n * A customizable input component for select/dropdown that handles selected option display and dropdown toggling.\n * Supports custom rendering, disabled states, and various visual styles.\n *\n * @component\n * @template T - The type of the option objects\n * @template V - The type of the selected value\n *\n * @param {Object} props - Component props\n * @param {boolean} props.open - Whether the dropdown is open\n * @param {() => void} props.handleToggleFilterDropdown - Function to toggle dropdown open/closed\n * @param {Object} props.customComponents - Custom rendering components\n * @param {(option: T) => string} props.getOptionLabel - Function to get display label from option\n * @param {T[]} props.options - Array of available options\n * @param {(option: T) => V} props.getOptionValue - Function to get value from option\n * @param {V} props.value - Currently selected value\n * @param {boolean} props.cardBg - Whether to use card background styling\n * @param {boolean} props.disabled - Whether the input is disabled\n * @param {boolean} props.secondaryText - Whether to use secondary text styling\n * @returns {JSX.Element} The rendered input component\n *\n * @example\n * setIsOpen(!isOpen)}\n * getOptionLabel={(option) => option.name}\n * options={[{ id: 1, name: 'Option 1' }]}\n * getOptionValue={(option) => option.id}\n * value={1}\n * disabled={false}\n * cardBg={true}\n * secondaryText={false}\n * />\n */\nexport default function SelectInputOptionInput({\n open,\n handleToggleFilterDropdown,\n ...props\n}: SelectInputProps & {\n open: boolean;\n handleToggleFilterDropdown: VoidFunction;\n}) {\n const {\n customComponents,\n getOptionLabel,\n options,\n getOptionValue,\n value,\n cardBg,\n disabled,\n secondaryText,\n } = props ?? {};\n const [selectedOption, setSelectedOption] = useState();\n\n // Find the currently selected option by matching values\n const foundOption: T | undefined = useMemo(\n () =>\n options?.find(option => {\n return getOptionValue(option) === value;\n }),\n [getOptionValue, options, value],\n );\n\n const selectedLabel = selectedOption ? getOptionLabel(selectedOption) : '';\n\n /**\n * Updates the selected option state when foundOption changes\n */\n function onChangeOption() {\n if (!foundOption) {\n return;\n }\n\n setSelectedOption(foundOption);\n }\n\n useEffect(onChangeOption, [foundOption]);\n\n return customComponents?.customInput ? (\n customComponents?.customInput({\n handleOpen: handleToggleFilterDropdown,\n open,\n option: selectedOption,\n })\n ) : (\n \n

{selectedLabel}

\n {disabled ? (\n \n ) : (\n \n )}\n \n );\n}\n","import { SelectInputProps } from './props';\nimport { useRef, useState } from 'react';\nimport { AnimatePresence } from 'framer-motion';\nimport SelectInputOptions from './Options';\nimport styles from './styles.module.scss';\nimport skeleton from './styles-skeleton.module.scss';\nimport { useClickOutside } from '@starsoft/common/hooks';\nimport SelectInputOptionInput from './Input';\n\n/**\n * SelectInput Component\n * A customizable select/dropdown component that supports async loading, pagination, and custom rendering.\n *\n * @component\n * @template T - The type of the option objects\n * @template V - The type of the selected value\n *\n * @param {Object} props - Component props\n * @param {T[]} [props.options=[]] - Array of options to display in the dropdown\n * @param {(value: V) => void} props.setValue - Callback to set the selected value\n * @param {(option: T) => string} props.getOptionLabel - Function to get display label from option\n * @param {(option: T) => V} props.getOptionValue - Function to get value from option\n * @param {V} props.value - Currently selected value\n * @param {boolean} [props.disabled] - Whether the select is disabled\n * @param {boolean} [props.cardBg] - Whether to use card background styling\n * @param {boolean} [props.secondaryText=false] - Whether to use secondary text styling\n * @param {boolean} [props.loading=false] - Whether options are loading\n * @param {boolean} [props.loadingMore=false] - Whether more options are being loaded\n * @param {boolean} [props.invertOptionsPosition=false] - Whether to invert dropdown position\n * @param {() => void} [props.loadMore] - Callback to load more options\n * @param {boolean} [props.hasNextPage=false] - Whether more options can be loaded\n * @param {boolean} [props.isAsync=false] - Whether options are loaded asynchronously\n * @param {Object} [props.customComponents] - Custom rendering components\n * @param {Error} [props.error] - Error object if request failed\n * @param {() => void} [props.refetch] - Function to retry failed request\n * @param {boolean} [props.disableClickOutside] - Whether to disable closing on outside click\n * @param {string} [props.popLayout] - Layout style for the dropdown\n * @returns {JSX.Element} The rendered select input component\n *\n * @example\n * type User = {\n * id: number;\n * name: string;\n * email: string;\n * };\n *\n * \n * options={users}\n * setValue={(id) => setSelectedUser(id)}\n * getOptionLabel={(user) => user.name}\n * getOptionValue={(user) => user.id}\n * value={selectedUserId}\n * loading={isLoading}\n * loadingMore={isLoadingMore}\n * hasNextPage={hasMore}\n * loadMore={fetchNextPage}\n * isAsync={true}\n * />\n */\nexport function SelectInput({\n options = [],\n setValue,\n getOptionLabel,\n getOptionValue,\n value,\n disabled,\n cardBg,\n secondaryText = false,\n loading = false,\n loadingMore = false,\n invertOptionsPosition = false,\n loadMore = () => {},\n hasNextPage = false,\n isAsync = false,\n customComponents,\n error,\n refetch,\n disableClickOutside,\n popLayout,\n}: SelectInputProps) {\n // Reference to the select container element\n const ref = useRef();\n\n // State to control dropdown visibility\n const [open, setOpen] = useState(false);\n\n /**\n * Toggles the dropdown open/closed state\n */\n function handleToggleFilterDropdown() {\n setOpen(state => !state);\n }\n\n // Hook to handle clicking outside the select to close it\n useClickOutside({\n open,\n onClickOutside: handleToggleFilterDropdown,\n customRef: ref,\n disabled: disableClickOutside,\n });\n\n // Show loading skeleton if in loading state\n if (loading) {\n return customComponents?.customSkeletonInput ? (\n customComponents?.customSkeletonInput()\n ) : (\n \n
\n
\n
\n );\n }\n\n return (\n
\n \n \n {open && !disabled && (\n \n )}\n \n
\n );\n}\n","import { Variants } from 'framer-motion';\n\nexport const dropIn: Variants = {\n hidden: {\n y: -30,\n opacity: 0,\n pointerEvents: 'none',\n },\n visible: {\n y: 0,\n opacity: 1,\n transition: {\n duration: 0.25,\n type: 'spring',\n damping: 25,\n stiffness: 500,\n },\n pointerEvents: 'all',\n },\n exit: {\n y: -30,\n opacity: 0,\n transition: {\n duration: 0.25,\n type: 'spring',\n damping: 25,\n stiffness: 500,\n },\n pointerEvents: 'none',\n },\n};\n","export enum KeyboardKey {\n BACKSPACE = 'Backspace',\n ARROW_LEFT = 'ArrowLeft',\n ARROW_RIGHT = 'ArrowRight',\n ARROW_DOWN = 'ArrowDown',\n ARROW_UP = 'ArrowUp',\n ENTER = 'Enter',\n}\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"container__text\":\"styles-skeleton_container__text__8LpEz\",\"skeleton-animation\":\"styles-skeleton_skeleton-animation__TcBqS\",\"container\":\"styles-skeleton_container__Idy_g\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"container\":\"styles_container__YK0ee\",\"container--popLayout\":\"styles_container--popLayout__UWG9Q\",\"container--card-bg\":\"styles_container--card-bg__hXaSS\",\"container--inverted\":\"styles_container--inverted__oYIa_\",\"container__option\":\"styles_container__option__KeM1J\",\"container__option--selected\":\"styles_container__option--selected__wZV7M\",\"skeleton-animation\":\"styles_skeleton-animation__dpZt0\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"text\":\"styles-skeleton_text__uxwVg\",\"chevron\":\"styles-skeleton_chevron__SCKGy\",\"skeleton-animation\":\"styles-skeleton_skeleton-animation__Y3vfm\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"container\":\"styles_container__BhOyU\",\"selected-option\":\"styles_selected-option__Y27pW\",\"selected-option--disabled\":\"styles_selected-option--disabled__KE0Y1\",\"selected-option--secondary-text\":\"styles_selected-option--secondary-text__FNPbj\",\"selected-option--card-bg\":\"styles_selected-option--card-bg__jRHQy\",\"selected-option--open\":\"styles_selected-option--open__JQ7oV\",\"skeleton-animation\":\"styles_skeleton-animation__ow93W\"};"],"names":["Options","memo","param","getOptionLabel","getOptionValue","handleClose","cardBg","customComponents","isInverted","options","loadingMore","loadMore","hasNextPage","isAsync","loading","setValue","value","error","refetch","popLayout","parentBounding","ref","useInfiniteScroll","hasMore","isLoading","condition","highlightedIndex","setHighlightedIndex","useState","handleSelectFilter","useCallback","handleKeyDown","length","e","key","KeyboardKey","ARROW_DOWN","prevIndex","ARROW_UP","ENTER","preventDefault","useEffect","current","targetElement","children","from","scrollIntoView","behavior","block","window","addEventListener","removeEventListener","jsx_runtime","jsxs","motion","div","className","styles","concat","variants","dropIn","initial","animate","exit","style","maxWidth","undefined","width","left","customSkeletonOption","Array","map","_","index","jsx","skeleton","option","customOption","selected","handleSelect","onClick","ErrorCard","isDefaultColor","SelectInputOptionInput","open","handleToggleFilterDropdown","props","disabled","secondaryText","selectedOption","setSelectedOption","foundOption","useMemo","find","selectedLabel","customInput","handleOpen","id","p","i","SelectInput","invertOptionsPosition","disableClickOutside","useRef","setOpen","state","useClickOutside","onClickOutside","customRef","customSkeletonInput","AnimatePresence","SelectInputOptions","getBoundingClientRect","hidden","y","opacity","pointerEvents","visible","transition","duration","type","damping","stiffness","module","exports"],"sourceRoot":""}