@laerdal/life-react-components 1.0.1-dev.30.full → 1.0.1-dev.35.full
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/Button/Button.js +12 -6
- package/dist/esm/Button/Button.js.map +1 -1
- package/dist/esm/Button/DualFunctionButton.js +7 -6
- package/dist/esm/Button/DualFunctionButton.js.map +1 -1
- package/dist/esm/Dropdown/BasicDropdown.js +27 -25
- package/dist/esm/Dropdown/BasicDropdown.js.map +1 -1
- package/dist/esm/Dropdown/ChipDropdownInput.js +6 -2
- package/dist/esm/Dropdown/ChipDropdownInput.js.map +1 -1
- package/dist/esm/Dropdown/CommonStyling.js +44 -4
- package/dist/esm/Dropdown/CommonStyling.js.map +1 -1
- package/dist/esm/Dropdown/DropdownButton.js +50 -97
- package/dist/esm/Dropdown/DropdownButton.js.map +1 -1
- package/dist/esm/Dropdown/DropdownContent.js +53 -20
- package/dist/esm/Dropdown/DropdownContent.js.map +1 -1
- package/dist/esm/Dropdown/DropdownFilter.js +7 -33
- package/dist/esm/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/esm/Footer/Components/FooterTop.js +0 -1
- package/dist/esm/Footer/Components/FooterTop.js.map +1 -1
- package/dist/esm/GlobalNavigationBar/Logo.js +7 -4
- package/dist/esm/GlobalNavigationBar/Logo.js.map +1 -1
- package/dist/esm/HyperLink/styling.js +9 -1
- package/dist/esm/HyperLink/styling.js.map +1 -1
- package/dist/js/Button/Button.js +6 -4
- package/dist/js/Button/Button.js.map +1 -1
- package/dist/js/Button/DualFunctionButton.js +16 -6
- package/dist/js/Button/DualFunctionButton.js.map +1 -1
- package/dist/js/Dropdown/BasicDropdown.d.ts +2 -2
- package/dist/js/Dropdown/BasicDropdown.js +28 -34
- package/dist/js/Dropdown/BasicDropdown.js.map +1 -1
- package/dist/js/Dropdown/ChipDropdownInput.js +10 -2
- package/dist/js/Dropdown/ChipDropdownInput.js.map +1 -1
- package/dist/js/Dropdown/CommonStyling.d.ts +1 -0
- package/dist/js/Dropdown/CommonStyling.js +11 -7
- package/dist/js/Dropdown/CommonStyling.js.map +1 -1
- package/dist/js/Dropdown/DropdownButton.d.ts +1 -1
- package/dist/js/Dropdown/DropdownButton.js +63 -92
- package/dist/js/Dropdown/DropdownButton.js.map +1 -1
- package/dist/js/Dropdown/DropdownButtonTypes.d.ts +14 -13
- package/dist/js/Dropdown/DropdownContent.d.ts +5 -1
- package/dist/js/Dropdown/DropdownContent.js +65 -33
- package/dist/js/Dropdown/DropdownContent.js.map +1 -1
- package/dist/js/Dropdown/DropdownFilter.js +11 -12
- package/dist/js/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/js/Footer/Components/FooterTop.js +0 -1
- package/dist/js/Footer/Components/FooterTop.js.map +1 -1
- package/dist/js/GlobalNavigationBar/Logo.js +2 -2
- package/dist/js/GlobalNavigationBar/Logo.js.map +1 -1
- package/dist/js/HyperLink/styling.js +2 -2
- package/dist/js/HyperLink/styling.js.map +1 -1
- package/dist/umd/Button/Button.js +12 -6
- package/dist/umd/Button/Button.js.map +1 -1
- package/dist/umd/Button/DualFunctionButton.js +7 -6
- package/dist/umd/Button/DualFunctionButton.js.map +1 -1
- package/dist/umd/Dropdown/BasicDropdown.js +26 -24
- package/dist/umd/Dropdown/BasicDropdown.js.map +1 -1
- package/dist/umd/Dropdown/ChipDropdownInput.js +6 -2
- package/dist/umd/Dropdown/ChipDropdownInput.js.map +1 -1
- package/dist/umd/Dropdown/CommonStyling.js +45 -5
- package/dist/umd/Dropdown/CommonStyling.js.map +1 -1
- package/dist/umd/Dropdown/DropdownButton.js +62 -98
- package/dist/umd/Dropdown/DropdownButton.js.map +1 -1
- package/dist/umd/Dropdown/DropdownContent.js +55 -22
- package/dist/umd/Dropdown/DropdownContent.js.map +1 -1
- package/dist/umd/Dropdown/DropdownFilter.js +9 -37
- package/dist/umd/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/umd/Footer/Components/FooterTop.js +0 -1
- package/dist/umd/Footer/Components/FooterTop.js.map +1 -1
- package/dist/umd/GlobalNavigationBar/Logo.js +7 -4
- package/dist/umd/GlobalNavigationBar/Logo.js.map +1 -1
- package/dist/umd/HyperLink/styling.js +9 -1
- package/dist/umd/HyperLink/styling.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Dropdown/ChipDropdownInput.tsx"],"names":["React","styled","InputChip","Search","TechnicalWarning","WarningMessage","ErrorMessage","COLORS","ChipInputContainer","DropdownButton","DropdownContent","LoadingIndicator","ComponentMStyling","ComponentTextStyle","Wrapper","div","StyledChipInputContainer","neutral_300","primary_100","critical_400","warning_400","primary_600","primary_800","primary_700","white","neutral_500","neutral_700","ChipInput","input","Regular","black","StyledDropdownButton","Loading","ChipDropdownInput","list","onInputChange","disableSorting","messageOnNoResults","values","inputId","variants","placeholder","validationType","validationMessage","onValueChange","suggestion","excludeIcon","loading","maxSelectedItems","givenList","setGivenList","useState","chips","setChips","value","setValue","dropdownIsOpen","setDropdownIsOpen","currentSearchResult","setCurrentSearchResult","restartFilter","setRestartFilter","chipInput","useRef","styledFieldRef","useEffect","newList","map","e","label","addChip","newChip","current","onAddChip","event","keyCode","find","preventDefault","onRemoveChip","length","index","elementToAdd","newChips","splice","onEditChip","text","options","filter","option","toUpperCase","indexOf","sort","o","includes","handleValueUpdate","focus","handleKeyPress","contains","target","matches","c","toLowerCase","handleClickOutside","document","addEventListener","removeEventListener","dropdownItems","x","displayLabel","noteLabel","secondaryLabel","stopPropagation","chip","l","undefined","neutral_600","isButton","action","pinTopItem","itemsType","scrollable","actionLabel","multiSelect","onValueUpdate","items","critical_500","autofilledMessage"],"mappings":";;AAAA;AACA;AACA;AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,gBAA1B;AACA,SAASC,MA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,IAAA,kBAAkB,EAAE,KAbtB;AAcE,IAAA,cAAc,EAAE,EAdlB;AAeE,IAAA,kBAAkB,EAAErE,kBAAkB,IAAI,EAf5C;AAgBE,IAAA,iBAAiB,EAAE,MAAM,CAAE,CAhB7B;AAiBE,IAAA,MAAM,EAAEmB,cAjBV;AAkBE,IAAA,SAAS,EAAEC,iBAlBb;AAmBE,IAAA,MAAM,EAAE,EAnBV;AAoBE,IAAA,QAAQ,EAAE,KApBZ;AAqBE,IAAA,EAAE,EAAG,GAAElB,OAAQ;AArBjB,IApDJ,EA6EGI,iBAAiB,IAAID,cAAc,KAAK,SAAxC,gBACC,oBAAC,cAAD,qBACE,oBAAC,gBAAD;AAAkB,IAAA,IAAI,EAAC,MAAvB;AAA8B,IAAA,KAAK,EAAEnC,MAAM,CAACsH;AAA5C,IADF,eAEE,kCAAOlF,iBAAP,CAFF,CADD,GAMCD,cAAc,KAAK,OAAnB,iBACE,oBAAC,YAAD,qBACE,oBAAC,gBAAD;AAAkB,IAAA,IAAI,EAAC,MAAvB;AAA8B,IAAA,KAAK,EAAEnC,MAAM,CAACY;AAA5C,IADF,eAEE,kCAAOwB,iBAAP,CAFF,CApFN,CADF;AA6FD,CA5RD;;;AAZET,EAAAA,I;AANAmC,IAAAA,K;AACAyC,IAAAA,c;AACAxD,IAAAA,K;;AAKAnB,EAAAA,a;AACAC,EAAAA,c;AACAC,EAAAA,kB;AACA+E,EAAAA,Q;AACAU,EAAAA,iB;AACAjF,EAAAA,U;AAZAwB,IAAAA,K;AACAyC,IAAAA,c;AACAxD,IAAAA,K;;AAWAR,EAAAA,W;AACAC,EAAAA,O;AACAC,EAAAA,gB;;AAiSF,eAAef,iBAAf","sourcesContent":["/**\n * Import React libraries.\n */\nimport * as React from 'react';\n\n/**\n * Import third-party libraries.\n */\nimport styled from 'styled-components';\n\n/**\n * Import custom components.\n */\nimport { InputChip } from '../Chips/index';\nimport { Search, TechnicalWarning, User } from '../icons/systemicons/SystemIcons';\nimport { WarningMessage, ErrorMessage } from '../InputFields/styling';\nimport { COLORS } from '../styles';\n\n/**\n * Import custom styles.\n */\nimport { ChipInputContainer } from '../Chips/ChipStyles';\n\n/**\n * Import custom types.\n */\nimport { ChipInputProps } from '../Chips/ChipTypes';\nimport { DropdownButton } from './CommonStyling';\nimport DropdownContent, { DropdownItem } from './DropdownContent';\nimport { LoadingIndicator } from '../LoadingIndicator';\nimport { ComponentMStyling, ComponentXXSStyling, ComponentTextStyle } from '../styles/typography';\n\nconst Wrapper = styled.div`\n position: relative;\n display: inline-block;\n width: 100%;\n min-width: 344px;\n`;\n\nconst StyledChipInputContainer = styled(ChipInputContainer)`\n padding: 2px 2px 2px 48px !important;\n min-height: 56px;\n max-height: 176px;\n overflow-y: auto;\n box-shadow: 0px 0px 0px 1px ${COLORS.neutral_300};\n\n .medium {\n margin-right: 8px !important;\n }\n .SearchIcon {\n position: absolute;\n left: 18px;\n top: 18px;\n }\n\n &:active {\n background-color: ${COLORS.primary_100};\n }\n\n &.invalid {\n -webkit-box-shadow: inset 0px 0px 0px 2px ${COLORS.critical_400};\n -moz-box-shadow: inset 0px 0px 0px 2px ${COLORS.critical_400};\n box-shadow: inset 0px 0px 0px 2px ${COLORS.critical_400};\n }\n &.alreadyInOrganization {\n -webkit-box-shadow: inset 0px 0px 0px 2px ${COLORS.warning_400};\n -moz-box-shadow: inset 0px 0px 0px 2px ${COLORS.warning_400};\n box-shadow: inset 0px 0px 0px 2px ${COLORS.warning_400};\n }\n\n &.empty:hover {\n -webkit-box-shadow: 0px 0px 0px 2px ${COLORS.primary_600};\n -moz-box-shadow: 0px 0px 0px 2px ${COLORS.primary_600};\n box-shadow: 0px 0px 0px 2px ${COLORS.primary_600};\n }\n\n &.inputHasFocus {\n -webkit-box-shadow: 0px 0px 0px 2px ${COLORS.primary_800};\n -moz-box-shadow: 0px 0px 0px 2px ${COLORS.primary_800};\n box-shadow: 0px 0px 0px 2px ${COLORS.primary_800};\n }\n &:hover {\n -webkit-box-shadow: 0px 0px 0px 2px ${COLORS.primary_700};\n -moz-box-shadow: 0px 0px 0px 2px ${COLORS.primary_700};\n box-shadow: 0px 0px 0px 2px ${COLORS.primary_700};\n }\n\n /* width */\n ::-webkit-scrollbar {\n width: 4px;\n cursor: pointer;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: ${COLORS.white};\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background: ${COLORS.neutral_500};\n border-radius: 8px;\n }\n\n /* Handle on hover */\n ::-webkit-scrollbar-thumb:hover {\n background: ${COLORS.neutral_700};\n cursor: pointer;\n }\n`;\n\nconst ChipInput = styled.input`\n height: 40px;\n width: auto;\n display: inline-flex;\n border: none;\n outline: none;\n margin: 4px;\n\n ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.black)}\n color: ${COLORS.black} !important;\n background-color: inherit;\n`;\n\nconst StyledDropdownButton = styled(DropdownButton)`\n display: flex;\n width: 98%;\n margin-left: 3px;\n svg {\n margin: auto 0 auto 0;\n }\n`;\n\nconst Loading = styled.div`\n margin: auto 16px auto auto !important;\n height: 20px;\n div {\n height: 20px;\n }\n`;\n\ninterface List {\n label: string;\n secondaryLabel?: string;\n value: string;\n}\n\ninterface ChipDropdownInputProps extends ChipInputProps {\n list: List[] | string[];\n onInputChange?: (input: string) => void;\n disableSorting?: boolean;\n messageOnNoResults?: string;\n isButton?: boolean;\n autofilledMessage?: string;\n suggestion?: List;\n excludeIcon?: boolean;\n loading?: boolean;\n maxSelectedItems?: number;\n}\n\nconst ChipDropdownInput: React.FunctionComponent<ChipDropdownInputProps> = ({\n list,\n onInputChange,\n disableSorting,\n messageOnNoResults,\n values,\n inputId,\n variants,\n placeholder,\n validationType,\n validationMessage,\n onValueChange,\n suggestion,\n excludeIcon,\n loading,\n maxSelectedItems,\n}: ChipDropdownInputProps) => {\n // Initiate states\n const [givenList, setGivenList] = React.useState<List[]>([]);\n const [chips, setChips] = React.useState<string[]>([]);\n const [value, setValue] = React.useState<string>('');\n const [dropdownIsOpen, setDropdownIsOpen] = React.useState<boolean>(false);\n const [currentSearchResult, setCurrentSearchResult] = React.useState<List[]>();\n const [restartFilter, setRestartFilter] = React.useState<boolean>(false);\n\n // Initiate refs\n const chipInput = React.useRef<any>();\n const styledFieldRef = React.useRef<HTMLDivElement>(null);\n\n /**\n * Sets initial values for the chips.\n */\n React.useEffect(() => {\n // Let's add initial chip values\n setChips(values);\n }, [values]);\n\n /**\n * Convert string[] to List[] if necessary\n */\n React.useEffect(() => {\n if (typeof list[0] === 'string') {\n const newList: List[] = (list as string[]).map((e: string) => ({ label: e, value: e }));\n setGivenList(newList);\n } else {\n setGivenList(list as List[]);\n }\n }, [list]);\n\n const addChip = (newChip: string) => {\n // Let's add the chip\n setChips([...chips, newChip]);\n onValueChange([...chips, newChip]);\n\n // Let's clear the old value\n chipInput.current.value = '';\n setValue('');\n };\n\n /**\n * Adds a chip to the chip list.\n * @param event - Event handler from the key down event.\n */\n const onAddChip = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n // Let's trigger only on enter, comma and space key press\n if ((event.keyCode === 13 || event.keyCode === 32 || event.keyCode === 188) && value) {\n if (!givenList.find((e) => e.value === value)) {\n setValue('');\n return;\n }\n // Let's prevent default action - adding new key to the value\n event.preventDefault();\n\n addChip(value);\n }\n if (event.keyCode === 8 && value === '') {\n onRemoveChip(chips.length - 1);\n }\n };\n\n /**\n * Removes a specific chip from the chip list.\n * @param index - Index of the chip that needs to be removed.\n * @param elementToAdd - Element which needs to be added in the deleted element place.\n */\n const onRemoveChip = (index: number, elementToAdd?: string): void => {\n // Let's copy the chips\n const newChips = [...chips];\n\n // Let's delete the chip\n // If necessary, let's replace it with a different chip\n if (elementToAdd) {\n newChips.splice(index, 1, elementToAdd);\n } else {\n newChips.splice(index, 1);\n }\n\n // Let's update the chip list\n setChips([...newChips]);\n onValueChange([...newChips]);\n };\n\n /**\n * Changes a status of the chip to edit.\n * @param text - Text of the chip that is being edited.\n * @param index - Index of the chip in the array.\n */\n const onEditChip = (text: string, index: number): void => {\n // Let's check if we have to add value as a chip (in case we have entered something in the input field)\n if (chipInput.current.value !== '') {\n // Let's replace the chip\n onRemoveChip(index, chipInput.current.value);\n } else {\n // Let's just remove the chip\n onRemoveChip(index);\n }\n\n // Let's update the text value of input field\n chipInput.current.value = text;\n setValue(text);\n };\n\n React.useEffect(() => {\n var options = [...givenList];\n if (!restartFilter && value !== '') {\n options = options.filter((option) => option.label.toUpperCase().indexOf(value.toUpperCase()) !== -1);\n }\n if (!disableSorting) {\n options = options.sort();\n }\n options = options.filter((o) => !chips.includes(o.value));\n setCurrentSearchResult(options);\n }, [value, givenList, chips]);\n\n const handleValueUpdate = (values: string[]) => {\n setRestartFilter(true);\n addChip(values[0]);\n chipInput?.current?.focus();\n }\n\n const handleKeyPress = (e: any) => {\n if (styledFieldRef?.current && styledFieldRef.current.contains(e.target)) {\n if (e.keyCode === 13) {\n const matches = currentSearchResult?.filter((c) => c.value.toLowerCase() === value.toLowerCase());\n if (matches?.length === 1 /*&& onSelect*/) {\n addChip(matches[0].value);\n //onSelect(chips);\n } else if (e.target.value === suggestion?.label) {\n addChip(e.target.value);\n }\n setDropdownIsOpen(!dropdownIsOpen);\n if (matches?.length === 0) {\n setValue('');\n }\n } else if (e.keyCode === 40) {\n setDropdownIsOpen(!dropdownIsOpen);\n }\n }\n };\n\n const handleClickOutside = (e: any) => {\n if (styledFieldRef?.current && !styledFieldRef.current.contains(e.target)) {\n if (dropdownIsOpen) {\n setDropdownIsOpen(false);\n if (!givenList.find((e) => e.value === value)) {\n setValue('');\n }\n }\n }\n };\n\n React.useEffect(() => {\n document.addEventListener('keypress', handleKeyPress);\n document.addEventListener('click', handleClickOutside);\n return () => {\n document.removeEventListener('keypress', handleKeyPress);\n document.removeEventListener('click', handleClickOutside);\n };\n });\n\n /**\n * Return Chip Input component.\n */\n\n let dropdownItems: DropdownItem[] = [];\n if(currentSearchResult)\n dropdownItems = currentSearchResult.map(x => ({ value: x.value, displayLabel: x.label, noteLabel: x.secondaryLabel }));\n \n if(suggestion && !chips.includes(suggestion.value))\n dropdownItems = [{ value: suggestion.value, displayLabel: suggestion.label, noteLabel: suggestion.secondaryLabel, suggestion: true }, ...dropdownItems];\n\n return (\n <Wrapper>\n <StyledChipInputContainer\n id={inputId}\n onClick={(e: any) => {\n e.stopPropagation();\n setDropdownIsOpen(true);\n chipInput.current.focus();\n }}\n className={validationType}\n ref={styledFieldRef}>\n <Search size=\"24px\" className=\"SearchIcon\" />\n {chips?.map((chip: string, index: number) => (\n <InputChip\n icon={givenList.find((l: List) => l.value === chip) ? 'User' : undefined}\n size=\"medium\"\n variant={variants && variants?.length && variants[index] ? variants[index] : 'normal'}\n text={chip}\n onRemove={() => onRemoveChip(index)}\n onClick={() => onEditChip(chip, index)}\n key={`chip_${index}`}></InputChip>\n ))}\n\n <ChipInput\n type=\"text\"\n onChange={(event: React.ChangeEvent<HTMLInputElement>) => {\n setValue(event.target.value);\n setRestartFilter(false);\n setDropdownIsOpen(true);\n if (onInputChange) {\n onInputChange(event.target.value || '');\n }\n }}\n onKeyDown={(event: React.KeyboardEvent<HTMLInputElement>) => {\n onAddChip(event);\n }}\n placeholder={placeholder && chips?.length === 0 ? placeholder : ''}\n onClick={(e: any) => {\n e.stopPropagation();\n setDropdownIsOpen(true);\n }}\n onFocus={() => {\n setDropdownIsOpen(true);\n }}\n ref={chipInput}\n />\n {loading ? (\n <Loading>\n <LoadingIndicator size=\"small\" color={COLORS.neutral_600} />\n </Loading>\n ) : null}\n </StyledChipInputContainer>\n {(!maxSelectedItems || (maxSelectedItems && chips.length < maxSelectedItems)) && (\n <DropdownContent \n customizationProps={{\n isButton: false,\n action: () => {},\n pinTopItem: true,\n \n itemsType: 'normal',\n scrollable: true,\n actionLabel: '',\n multiSelect: false,\n onValueUpdate: handleValueUpdate,\n items: dropdownItems\n }}\n hideOnClickOutside={false}\n selectedValues={[]}\n messageOnNoResults={messageOnNoResults ?? ''}\n setSelectedValues={() => {}}\n isOpen={dropdownIsOpen}\n setIsOpen={setDropdownIsOpen}\n filter={''}\n isButton={false} \n id={`${inputId}_dropdowncontent`} />\n )}\n\n {/* If there is an error, let's render the error */}\n {validationMessage && validationType === 'warning' ? (\n <WarningMessage>\n <TechnicalWarning size=\"20px\" color={COLORS.critical_500} />\n <span>{validationMessage}</span>\n </WarningMessage>\n ) : (\n validationType === 'error' && (\n <ErrorMessage>\n <TechnicalWarning size=\"20px\" color={COLORS.critical_400} />\n <span>{validationMessage}</span>\n </ErrorMessage>\n )\n )}\n </Wrapper>\n );\n};\n\nexport default ChipDropdownInput;\n"],"file":"ChipDropdownInput.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/Dropdown/ChipDropdownInput.tsx"],"names":["React","styled","InputChip","Search","TechnicalWarning","WarningMessage","ErrorMessage","COLORS","ChipInputContainer","DropdownButton","DropdownContent","LoadingIndicator","ComponentMStyling","ComponentTextStyle","Wrapper","div","StyledChipInputContainer","neutral_300","primary_100","critical_400","warning_400","primary_600","primary_800","primary_700","white","neutral_500","neutral_700","ChipInput","input","Regular","black","StyledDropdownButton","Loading","ChipDropdownInput","list","onInputChange","disableSorting","messageOnNoResults","values","inputId","variants","placeholder","validationType","validationMessage","onValueChange","suggestion","excludeIcon","loading","maxSelectedItems","givenList","setGivenList","useState","chips","setChips","value","setValue","dropdownIsOpen","setDropdownIsOpen","currentSearchResult","setCurrentSearchResult","restartFilter","setRestartFilter","focused","setFocused","chipInput","useRef","styledFieldRef","useEffect","newList","map","e","label","addChip","newChip","current","onAddChip","event","keyCode","find","preventDefault","onRemoveChip","length","index","elementToAdd","newChips","splice","onEditChip","text","options","filter","option","toUpperCase","indexOf","sort","o","includes","handleValueUpdate","focus","handleKeyPress","contains","target","matches","c","toLowerCase","handleClickOutside","document","addEventListener","removeEventListener","dropdownItems","x","displayLabel","noteLabel","secondaryLabel","stopPropagation","chip","l","undefined","neutral_600","action","pinTopItem","itemsType","scrollable","actionLabel","multiSelect","onValueUpdate","items","critical_500","isBut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1D,IAAAA,K;;AAKAnB,EAAAA,a;AACAC,EAAAA,c;AACAC,EAAAA,kB;AACA0F,EAAAA,Q;AACAC,EAAAA,iB;AACAnF,EAAAA,U;AAZA0B,IAAAA,K;AACAyC,IAAAA,c;AACA1D,IAAAA,K;;AAWAR,EAAAA,W;AACAC,EAAAA,O;AACAC,EAAAA,gB;;AA0SF,eAAef,iBAAf","sourcesContent":["/**\n * Import React libraries.\n */\nimport * as React from 'react';\n\n/**\n * Import third-party libraries.\n */\nimport styled from 'styled-components';\n\n/**\n * Import custom components.\n */\nimport { InputChip } from '../Chips/index';\nimport { Search, TechnicalWarning, User } from '../icons/systemicons/SystemIcons';\nimport { WarningMessage, ErrorMessage } from '../InputFields/styling';\nimport { COLORS } from '../styles';\n\n/**\n * Import custom styles.\n */\nimport { ChipInputContainer } from '../Chips/ChipStyles';\n\n/**\n * Import custom types.\n */\nimport { ChipInputProps } from '../Chips/ChipTypes';\nimport { DropdownButton } from './CommonStyling';\nimport DropdownContent, { DropdownItem } from './DropdownContent';\nimport { LoadingIndicator } from '../LoadingIndicator';\nimport { ComponentMStyling, ComponentXXSStyling, ComponentTextStyle } from '../styles/typography';\n\nconst Wrapper = styled.div`\n position: relative;\n display: inline-block;\n width: 100%;\n min-width: 344px;\n`;\n\nconst StyledChipInputContainer = styled(ChipInputContainer)`\n padding: 2px 2px 2px 48px !important;\n min-height: 56px;\n max-height: 176px;\n overflow-y: auto;\n box-shadow: 0px 0px 0px 1px ${COLORS.neutral_300};\n\n .medium {\n margin-right: 8px !important;\n }\n .SearchIcon {\n position: absolute;\n left: 18px;\n top: 18px;\n }\n\n &:active {\n background-color: ${COLORS.primary_100};\n }\n\n &.invalid {\n -webkit-box-shadow: inset 0px 0px 0px 2px ${COLORS.critical_400};\n -moz-box-shadow: inset 0px 0px 0px 2px ${COLORS.critical_400};\n box-shadow: inset 0px 0px 0px 2px ${COLORS.critical_400};\n }\n &.alreadyInOrganization {\n -webkit-box-shadow: inset 0px 0px 0px 2px ${COLORS.warning_400};\n -moz-box-shadow: inset 0px 0px 0px 2px ${COLORS.warning_400};\n box-shadow: inset 0px 0px 0px 2px ${COLORS.warning_400};\n }\n\n &.empty:hover {\n -webkit-box-shadow: 0px 0px 0px 2px ${COLORS.primary_600};\n -moz-box-shadow: 0px 0px 0px 2px ${COLORS.primary_600};\n box-shadow: 0px 0px 0px 2px ${COLORS.primary_600};\n }\n\n &.inputHasFocus {\n -webkit-box-shadow: 0px 0px 0px 2px ${COLORS.primary_800};\n -moz-box-shadow: 0px 0px 0px 2px ${COLORS.primary_800};\n box-shadow: 0px 0px 0px 2px ${COLORS.primary_800};\n }\n &:hover {\n -webkit-box-shadow: 0px 0px 0px 2px ${COLORS.primary_700};\n -moz-box-shadow: 0px 0px 0px 2px ${COLORS.primary_700};\n box-shadow: 0px 0px 0px 2px ${COLORS.primary_700};\n }\n\n /* width */\n ::-webkit-scrollbar {\n width: 4px;\n cursor: pointer;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: ${COLORS.white};\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background: ${COLORS.neutral_500};\n border-radius: 8px;\n }\n\n /* Handle on hover */\n ::-webkit-scrollbar-thumb:hover {\n background: ${COLORS.neutral_700};\n cursor: pointer;\n }\n`;\n\nconst ChipInput = styled.input`\n height: 40px;\n width: auto;\n display: inline-flex;\n border: none;\n outline: none;\n margin: 4px;\n\n ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.black)}\n color: ${COLORS.black} !important;\n background-color: inherit;\n`;\n\nconst StyledDropdownButton = styled(DropdownButton)`\n display: flex;\n width: 98%;\n margin-left: 3px;\n svg {\n margin: auto 0 auto 0;\n }\n`;\n\nconst Loading = styled.div`\n margin: auto 16px auto auto !important;\n height: 20px;\n div {\n height: 20px;\n }\n`;\n\ninterface List {\n label: string;\n secondaryLabel?: string;\n value: string;\n}\n\ninterface ChipDropdownInputProps extends ChipInputProps {\n list: List[] | string[];\n onInputChange?: (input: string) => void;\n disableSorting?: boolean;\n messageOnNoResults?: string;\n isButton?: boolean;\n autofilledMessage?: string;\n suggestion?: List;\n excludeIcon?: boolean;\n loading?: boolean;\n maxSelectedItems?: number;\n}\n\nconst ChipDropdownInput: React.FunctionComponent<ChipDropdownInputProps> = ({\n list,\n onInputChange,\n disableSorting,\n messageOnNoResults,\n values,\n inputId,\n variants,\n placeholder,\n validationType,\n validationMessage,\n onValueChange,\n suggestion,\n excludeIcon,\n loading,\n maxSelectedItems,\n}: ChipDropdownInputProps) => {\n // Initiate states\n const [givenList, setGivenList] = React.useState<List[]>([]);\n const [chips, setChips] = React.useState<string[]>([]);\n const [value, setValue] = React.useState<string>('');\n const [dropdownIsOpen, setDropdownIsOpen] = React.useState<boolean>(false);\n const [currentSearchResult, setCurrentSearchResult] = React.useState<List[]>();\n const [restartFilter, setRestartFilter] = React.useState<boolean>(false);\n const [focused, setFocused] = React.useState<number | null>(null);\n\n // Initiate refs\n const chipInput = React.useRef<any>();\n const styledFieldRef = React.useRef<HTMLDivElement>(null);\n\n /**\n * Sets initial values for the chips.\n */\n React.useEffect(() => {\n // Let's add initial chip values\n setChips(values);\n }, [values]);\n\n /**\n * Convert string[] to List[] if necessary\n */\n React.useEffect(() => {\n if (typeof list[0] === 'string') {\n const newList: List[] = (list as string[]).map((e: string) => ({ label: e, value: e }));\n setGivenList(newList);\n } else {\n setGivenList(list as List[]);\n }\n }, [list]);\n\n const addChip = (newChip: string) => {\n // Let's add the chip\n setChips([...chips, newChip]);\n onValueChange([...chips, newChip]);\n\n // Let's clear the old value\n chipInput.current.value = '';\n setValue('');\n };\n\n /**\n * Adds a chip to the chip list.\n * @param event - Event handler from the key down event.\n */\n const onAddChip = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n // Let's trigger only on enter, comma and space key press\n if ((event.keyCode === 13 || event.keyCode === 32 || event.keyCode === 188) && value) {\n if (!givenList.find((e) => e.value === value)) {\n setValue('');\n return;\n }\n // Let's prevent default action - adding new key to the value\n event.preventDefault();\n\n addChip(value);\n }\n if (event.keyCode === 8 && value === '') {\n onRemoveChip(chips.length - 1);\n }\n };\n\n /**\n * Removes a specific chip from the chip list.\n * @param index - Index of the chip that needs to be removed.\n * @param elementToAdd - Element which needs to be added in the deleted element place.\n */\n const onRemoveChip = (index: number, elementToAdd?: string): void => {\n // Let's copy the chips\n const newChips = [...chips];\n\n // Let's delete the chip\n // If necessary, let's replace it with a different chip\n if (elementToAdd) {\n newChips.splice(index, 1, elementToAdd);\n } else {\n newChips.splice(index, 1);\n }\n\n // Let's update the chip list\n setChips([...newChips]);\n onValueChange([...newChips]);\n };\n\n /**\n * Changes a status of the chip to edit.\n * @param text - Text of the chip that is being edited.\n * @param index - Index of the chip in the array.\n */\n const onEditChip = (text: string, index: number): void => {\n // Let's check if we have to add value as a chip (in case we have entered something in the input field)\n if (chipInput.current.value !== '') {\n // Let's replace the chip\n onRemoveChip(index, chipInput.current.value);\n } else {\n // Let's just remove the chip\n onRemoveChip(index);\n }\n\n // Let's update the text value of input field\n chipInput.current.value = text;\n setValue(text);\n };\n\n React.useEffect(() => {\n var options = [...givenList];\n if (!restartFilter && value !== '') {\n options = options.filter((option) => option.label.toUpperCase().indexOf(value.toUpperCase()) !== -1);\n }\n if (!disableSorting) {\n options = options.sort();\n }\n options = options.filter((o) => !chips.includes(o.value));\n setCurrentSearchResult(options);\n }, [value, givenList, chips]);\n\n const handleValueUpdate = (values: string[]) => {\n setRestartFilter(true);\n addChip(values[0]);\n chipInput?.current?.focus();\n }\n\n const handleKeyPress = (e: any) => {\n if (styledFieldRef?.current && styledFieldRef.current.contains(e.target)) {\n if (e.keyCode === 13) {\n const matches = currentSearchResult?.filter((c) => c.value.toLowerCase() === value.toLowerCase());\n if (matches?.length === 1 /*&& onSelect*/) {\n addChip(matches[0].value);\n //onSelect(chips);\n } else if (e.target.value === suggestion?.label) {\n addChip(e.target.value);\n }\n\n if(!dropdownIsOpen)\n setFocused(0);\n\n setDropdownIsOpen(!dropdownIsOpen);\n if (matches?.length === 0) {\n setValue('');\n }\n } else if (e.keyCode === 40) {\n if(!dropdownIsOpen)\n setFocused(0);\n\n setDropdownIsOpen(!dropdownIsOpen);\n }\n }\n };\n\n const handleClickOutside = (e: any) => {\n if (styledFieldRef?.current && !styledFieldRef.current.contains(e.target)) {\n if (dropdownIsOpen) {\n setDropdownIsOpen(false);\n if (!givenList.find((e) => e.value === value)) {\n setValue('');\n }\n }\n }\n };\n\n React.useEffect(() => {\n document.addEventListener('keypress', handleKeyPress);\n document.addEventListener('click', handleClickOutside);\n return () => {\n document.removeEventListener('keypress', handleKeyPress);\n document.removeEventListener('click', handleClickOutside);\n };\n });\n\n /**\n * Return Chip Input component.\n */\n\n let dropdownItems: DropdownItem[] = [];\n if(currentSearchResult)\n dropdownItems = currentSearchResult.map(x => ({ value: x.value, displayLabel: x.label, noteLabel: x.secondaryLabel }));\n \n if(suggestion && !chips.includes(suggestion.value))\n dropdownItems = [{ value: suggestion.value, displayLabel: suggestion.label, noteLabel: suggestion.secondaryLabel, suggestion: true }, ...dropdownItems];\n\n return (\n <Wrapper>\n <StyledChipInputContainer\n id={inputId}\n onClick={(e: any) => {\n e.stopPropagation();\n setDropdownIsOpen(true);\n chipInput.current.focus();\n }}\n className={validationType}\n ref={styledFieldRef}>\n <Search size=\"24px\" className=\"SearchIcon\" />\n {chips?.map((chip: string, index: number) => (\n <InputChip\n icon={givenList.find((l: List) => l.value === chip) ? 'User' : undefined}\n size=\"medium\"\n variant={variants && variants?.length && variants[index] ? variants[index] : 'normal'}\n text={chip}\n onRemove={() => onRemoveChip(index)}\n onClick={() => onEditChip(chip, index)}\n key={`chip_${index}`}></InputChip>\n ))}\n\n <ChipInput\n type=\"text\"\n onChange={(event: React.ChangeEvent<HTMLInputElement>) => {\n setValue(event.target.value);\n setRestartFilter(false);\n setDropdownIsOpen(true);\n if (onInputChange) {\n onInputChange(event.target.value || '');\n }\n }}\n onKeyDown={(event: React.KeyboardEvent<HTMLInputElement>) => {\n onAddChip(event);\n }}\n placeholder={placeholder && chips?.length === 0 ? placeholder : ''}\n onClick={(e: any) => {\n e.stopPropagation();\n setDropdownIsOpen(true);\n }}\n onFocus={() => {\n setDropdownIsOpen(true);\n }}\n ref={chipInput}\n />\n {loading ? (\n <Loading>\n <LoadingIndicator size=\"small\" color={COLORS.neutral_600} />\n </Loading>\n ) : null}\n </StyledChipInputContainer>\n {(!maxSelectedItems || (maxSelectedItems && chips.length < maxSelectedItems)) && (\n <DropdownContent \n customizationProps={{\n action: () => {},\n pinTopItem: true,\n \n itemsType: 'normal',\n scrollable: true,\n actionLabel: '',\n multiSelect: false,\n onValueUpdate: handleValueUpdate,\n items: dropdownItems\n }}\n focused={focused}\n setFocused={setFocused}\n hideOnClickOutside={false}\n selectedValues={[]}\n messageOnNoResults={messageOnNoResults ?? ''}\n setSelectedValues={() => {}}\n isOpen={dropdownIsOpen}\n setIsOpen={setDropdownIsOpen}\n filter={''}\n isButton={false} \n id={`${inputId}_dropdowncontent`} />\n )}\n\n {/* If there is an error, let's render the error */}\n {validationMessage && validationType === 'warning' ? (\n <WarningMessage>\n <TechnicalWarning size=\"20px\" color={COLORS.critical_500} />\n <span>{validationMessage}</span>\n </WarningMessage>\n ) : (\n validationType === 'error' && (\n <ErrorMessage>\n <TechnicalWarning size=\"20px\" color={COLORS.critical_400} />\n <span>{validationMessage}</span>\n </ErrorMessage>\n )\n )}\n </Wrapper>\n );\n};\n\nexport default ChipDropdownInput;\n"],"file":"ChipDropdownInput.js"}
|
|
@@ -60,6 +60,34 @@ const activeValidationMessage = css`
|
|
|
60
60
|
const placeholderStyling = css`
|
|
61
61
|
${ComponentMStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}
|
|
62
62
|
`;
|
|
63
|
+
export const InputField = styled.input`
|
|
64
|
+
${ComponentMStyling(ComponentTextStyle.Regular, COLORS.black)}
|
|
65
|
+
border: none;
|
|
66
|
+
outline: none;
|
|
67
|
+
background-color: inherit;
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
color: ${COLORS.black} !important;
|
|
70
|
+
padding: 0;
|
|
71
|
+
::-webkit-search-decoration,
|
|
72
|
+
::-webkit-search-cancel-button,
|
|
73
|
+
::-webkit-search-results-button,
|
|
74
|
+
::-webkit-search-results-decoration {
|
|
75
|
+
-webkit-appearance: none;
|
|
76
|
+
}
|
|
77
|
+
::placeholder {
|
|
78
|
+
${ComponentSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}
|
|
79
|
+
|
|
80
|
+
${BREAKPOINTS.MEDIUM} {
|
|
81
|
+
${ComponentMStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}
|
|
82
|
+
}
|
|
83
|
+
&.small {
|
|
84
|
+
${ComponentSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}
|
|
85
|
+
}
|
|
86
|
+
&.medium {
|
|
87
|
+
${ComponentMStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
63
91
|
export const StyledField = styled.div`
|
|
64
92
|
${ComponentSStyling(ComponentTextStyle.Regular, 'inherit')}
|
|
65
93
|
|
|
@@ -98,7 +126,7 @@ export const StyledField = styled.div`
|
|
|
98
126
|
}
|
|
99
127
|
|
|
100
128
|
&.small {
|
|
101
|
-
${
|
|
129
|
+
${ComponentSStyling(ComponentTextStyle.Regular, 'inherit')}
|
|
102
130
|
padding: 12px 16px;
|
|
103
131
|
height: 48px;
|
|
104
132
|
&::placeholder {
|
|
@@ -238,11 +266,13 @@ export const DropdownButton = styled.button`
|
|
|
238
266
|
width: 100%;
|
|
239
267
|
text-align: left;
|
|
240
268
|
|
|
241
|
-
|
|
242
|
-
&.show-divider-above > div {
|
|
269
|
+
div.divider {
|
|
243
270
|
display: block;
|
|
244
|
-
width: calc(100% -
|
|
271
|
+
width: calc(100% - 40px);
|
|
272
|
+
margin-left: 16px;
|
|
245
273
|
border-top: 1px solid #e5e5e5;
|
|
274
|
+
position: absolute;
|
|
275
|
+
top: 0px;
|
|
246
276
|
}
|
|
247
277
|
|
|
248
278
|
span {
|
|
@@ -318,6 +348,16 @@ export const ButtonDropdownWrapper = styled.div`
|
|
|
318
348
|
align-items: center;
|
|
319
349
|
width: fit-content;
|
|
320
350
|
|
|
351
|
+
.button {
|
|
352
|
+
min-width: 64px;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.value {
|
|
356
|
+
flex-grow: 1;
|
|
357
|
+
display: flex;
|
|
358
|
+
justify-content: center;
|
|
359
|
+
}
|
|
360
|
+
|
|
321
361
|
.dropdown-arrow {
|
|
322
362
|
width: 24px;
|
|
323
363
|
height: 24px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Dropdown/CommonStyling.tsx"],"names":["styled","css","CommonInteractionStyling","BREAKPOINTS","COLORS","ComponentTextStyle","ComponentMStyling","ComponentLStyling","ComponentSStyling","ComponentXSStyling","ComponentXXSStyling","Size","Dropdown","div","props","isButton","locked","disabled","margin","primary_600","primary_800","lockedState","neutral_100","neutral_300","neutral_600","disabledState","white","activeValidationMessage","warning_400","placeholderStyling","Italic","StyledField","Regular","MEDIUM","primary_200","primary_300","Bold","neutral_800","neutral_20","showValidationMessage","isPlaceholder","ButtonDropdownContentStyling","DropdownContentStyling","neutral_200","neutral_400","DropdownButton","button","size","Small","Medium","Large","primary_500","primary_20","primary_100","ButtonDropdownWrapper","primary_700"],"mappings":"AAAA,OAAOA,MAAP,IAAgBC,GAAhB,QAA0B,mBAA1B;AACA,SAAQC,wBAAR,QAAuC,WAAvC;AACA,SAAQC,WAAR,EAAqBC,MAArB,EAA6BC,kBAA7B,QAAsD,WAAtD;AACA,SAAQC,iBAAR,EAA2BC,iBAA3B,EAA8CC,iBAA9C,EAAiEC,kBAAjE,EAAqFC,mBAArF,QAA+G,sBAA/G;AACA,SAASC,IAAT,QAAqB,UAArB;AAEA,OAAO,MAAMC,QAAQ,GAAGZ,MAAM,CAACa,GAAkF;AACjH;AACA;AACA,IA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A,0BAA0BlC,MAAM,CAAC+C,WAAY;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB/C,MAAM,CAACgD,UAAW;AAC1C;AACA;AACA,eAAehD,MAAM,CAACe,WAAY;AAClC;AACA;AACA;AACA,0BAA0Bf,MAAM,CAAC+C,WAAY;AAC7C;AACA;AACA;AACA;AACA,wBAAwB/C,MAAM,CAACiD,WAAY;AAC3C;AACA;AACA,eAAejD,MAAM,CAACgB,WAAY;AAClC;AACA;AACA;AACA,0BAA0BhB,MAAM,CAAC+C,WAAY;AAC7C;AACA;AACA,CA3FO;AA6FP,OAAO,MAAMG,qBAAqB,GAAGtD,MAAM,CAACa,GAA8C;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAKC,KAAD,IAAYA,KAAK,CAACE,MAAN,IAAgBF,KAAK,CAACG,QAAtB,GAAiC,sBAAjC,GAA0D,kBAAoB;AAC9F,IAAKH,KAAD,IAAYA,KAAK,CAACG,QAAN,GAAiB,uBAAjB,GAA2C,EAAI;AAC/D;AACA;AACA;AACA,wBAAwBb,MAAM,CAACgD,UAAW;AAC1C,aAAahD,MAAM,CAACmD,WAAY;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwBnD,MAAM,CAACiD,WAAY;AAC3C,aAAajD,MAAM,CAACgB,WAAY;AAChC;AACA;AACA,EAlCO","sourcesContent":["import styled, {css} from 'styled-components';\nimport {CommonInteractionStyling} from '../common';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle} from '../styles';\nimport {ComponentMStyling, ComponentLStyling, ComponentSStyling, ComponentXSStyling, ComponentXXSStyling} from '../styles/typography';\nimport { Size } from '../types';\n\nexport const Dropdown = styled.div<{ isButton: boolean; locked?: boolean; disabled?: boolean; margin?: string }>`\n position: relative;\n display: inline-block;\n ${(props) => !props.isButton && 'width: 100%; min-width: 344px;'}\n ${(props) => (props.locked || props.disabled ? 'cursor: not-allowed;' : '')}\n ${(props) => (props.margin ? `margin: ${props.margin};` : '')}\n\n .show {\n display: block;\n }\n\n .value {\n flex-grow: 1;\n }\n\n input:hover + div {\n color: ${COLORS.primary_600};\n }\n\n input:active + div {\n color: ${COLORS.primary_800};\n }\n`;\n\nconst lockedState = css`\n background-color: ${COLORS.neutral_100};\n box-shadow: inset 0px 0px 0px 1px ${COLORS.neutral_300};\n color: ${COLORS.neutral_600};\n pointer-events: none;\n cursor: not-allowed;\n input {\n color: ${COLORS.neutral_600} !important;\n }\n`;\n\nconst disabledState = css`\n background-color: ${COLORS.white};\n box-shadow: inset 0px 0px 0px 1px ${COLORS.neutral_100};\n color: ${COLORS.neutral_300};\n pointer-events: none;\n cursor: not-allowed;\n svg {\n color: ${COLORS.neutral_300} !important;\n }\n input {\n color: ${COLORS.neutral_300} !important;\n ::placeholder {\n color: ${COLORS.neutral_300} !important;\n }\n }\n`;\n\nconst activeValidationMessage = css`\n -webkit-box-shadow: inset 0px 0px 0px 2px ${COLORS.warning_400};\n -moz-box-shadow: inset 0px 0px 0px 2px ${COLORS.warning_400};\n box-shadow: inset 0px 0px 0px 2px ${COLORS.warning_400};\n`;\n\nconst placeholderStyling = css`\n ${ComponentMStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n`;\n\nexport const StyledField = styled.div<{ disabled: boolean; locked: boolean; showValidationMessage?: boolean; isPlaceholder?: boolean; fontSize?: string }>`\n ${ComponentSStyling(ComponentTextStyle.Regular, 'inherit')}\n\n padding: 12px 16px;\n height: 48px;\n min-width: 344px;\n width: 100%;\n\n background: ${COLORS.white};\n box-shadow: inset 0px 0px 0px 1px ${COLORS.neutral_300};\n box-sizing: border-box;\n border-radius: 4px;\n cursor: pointer;\n\n display: flex;\n align-items: center;\n gap: 4px;\n \n input{\n font-size: inherit;\n line-height: inherit;\n color: inherit;\n }\n\n &::placeholder {\n ${ComponentXXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n\n ${BREAKPOINTS.MEDIUM} {\n ${ComponentMStyling(ComponentTextStyle.Regular, 'inherit')}\n padding: 16px;\n height: 56px;\n &::placeholder {\n ${ComponentXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n }\n\n &.small {\n ${ComponentXSStyling(ComponentTextStyle.Regular, 'inherit')}\n padding: 12px 16px;\n height: 48px;\n &::placeholder {\n ${ComponentXXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n }\n &.medium {\n ${ComponentMStyling(ComponentTextStyle.Regular, 'inherit')}\n height: 56px;\n padding: 16px;\n &::placeholder {\n ${ComponentXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n }\n\n &:focus {\n outline: 3px solid #ddd;\n }\n &:focus-within {\n -webkit-box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_800};\n -moz-box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_800};\n box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_800};\n }\n &:hover {\n box-shadow: inset 0px 0px 0px 1px ${COLORS.primary_200};\n input {\n ::placeholder {\n color: ${COLORS.primary_600};\n }\n }\n cursor: pointer;\n }\n &:active {\n box-shadow: inset 0px 0px 0px 1px ${COLORS.primary_300};\n input {\n ::placeholder {\n color: ${COLORS.primary_800};\n }\n }\n }\n\n &.button {\n ${(props) => ComponentSStyling(ComponentTextStyle.Bold, props.disabled ? COLORS.neutral_300 : COLORS.neutral_600)}\n\n box-sizing: border-box;\n height: 32px;\n padding: 0 8px;\n width: initial;\n min-width: initial;\n border: none !important;\n box-shadow: none;\n border-radius: 4px;\n\n &.expanded {\n color: ${COLORS.neutral_800};\n background: ${COLORS.neutral_20};\n }\n }\n\n ${(props) => (props.disabled ? disabledState : '')}\n ${(props) => (props.locked ? lockedState : '')}\n ${(props) => (props.showValidationMessage ? activeValidationMessage : '')}\n ${(props) => (props.isPlaceholder ? placeholderStyling : '')}\n\n ${CommonInteractionStyling};\n`;\n\nexport const ButtonDropdownContentStyling = css`\n min-width: 344px;\n right: 0;\n`;\n\nexport const DropdownContentStyling = styled.div<{ isButton: boolean }>`\n display: none;\n position: absolute;\n background-color: ${COLORS.white};\n width: 100%;\n z-index: 1;\n margin-top: ${(props) => (props.isButton ? '-4px' : '2px')};\n\n &.show {\n display: block;\n }\n\n &.up {\n top: auto;\n bottom: 100%;\n }\n\n ${(props) => (props.isButton ? ButtonDropdownContentStyling : '')};\n\n border: 1px solid ${COLORS.neutral_100};\n box-sizing: border-box;\n box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);\n border-radius: 4px;\n padding: 4px 0;\n\n max-height: 240px;\n overflow-y: auto;\n\n /* width */\n ::-webkit-scrollbar {\n width: 4px;\n cursor: pointer;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: ${COLORS.white};\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background: ${COLORS.neutral_200};\n border-radius: 8px;\n }\n\n /* Handle on hover */\n ::-webkit-scrollbar-thumb:hover {\n background: ${COLORS.neutral_400};\n }\n`;\n\nexport const DropdownButton = styled.button<{ size?: Size }>`\n\n ${props => props.size == Size.Small && ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${props => props.size == Size.Medium && ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${props => props.size == Size.Large && ComponentLStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ${props => props.size == Size.Large ? '64px' : props.size == Size.Medium ? '56px' : '48px'};\n background-color: ${COLORS.white};\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n &.show-divider-above > span,\n &.show-divider-above > div {\n display: block;\n width: calc(100% - 32px);\n border-top: 1px solid #e5e5e5;\n }\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n div.item-content {\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n\n div.item-label {\n flex: 1 0 calc(100% - 40px);\n }\n\n div.item-icon {\n margin-right: 6px;\n }\n div.item-icon-old {\n flex: 1 0 40px;\n display: flex;\n justify-content: flex-end;\n }\n }\n\n ${CommonInteractionStyling};\n\n &.active {\n background: ${COLORS.neutral_20};\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 0;\n bottom: 0;\n left: 2px;\n background-color: ${COLORS.primary_500};\n\n border-radius: 2px;\n }\n }\n\n &.active:hover {\n background-color: ${COLORS.primary_20};\n\n svg {\n color: ${COLORS.primary_600};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n\n &.active:active {\n background-color: ${COLORS.primary_100};\n\n svg {\n color: ${COLORS.primary_800};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n`;\n\nexport const ButtonDropdownWrapper = styled.div<{ locked?: boolean; disabled?: boolean }>`\n box-sizing: border-box;\n min-height: 48px;\n display: flex;\n align-items: center;\n width: fit-content;\n\n .dropdown-arrow {\n width: 24px;\n height: 24px;\n }\n\n ${(props) => (props.locked || props.disabled ? 'cursor: not-allowed;' : 'cursor: pointer;')}\n ${(props) => (props.disabled ? 'pointer-events: none;' : '')}\n \n &:hover .button,\n & > .button:hover {\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_700};\n }\n\n &:focus .button,\n & > .button:focus {\n box-shadow: 0 4px 12px rgba(46, 127, 161, 0.25), 0 0 8px #2e7fa1;\n outline: none;\n }\n\n &:active .button,\n & > .button:active {\n box-shadow: none;\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n }\n\n}`;\n"],"file":"CommonStyling.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/Dropdown/CommonStyling.tsx"],"names":["styled","css","CommonInteractionStyling","BREAKPOINTS","COLORS","ComponentTextStyle","ComponentMStyling","ComponentLStyling","ComponentSStyling","ComponentXSStyling","ComponentXXSStyling","Size","Dropdown","div","props","isButton","locked","disabled","margin","primary_600","primary_800","lockedState","neutral_100","neutral_300","neutral_600","disabledState","white","activeValidationMessage","warning_400","placeholderStyling","Italic","InputField","input","Regular","black","MEDIUM","StyledField","primary_200","primary_300","Bold","neutral_800","neutral_20","showValidationMessage","isPlaceholder","ButtonDropdownContentStyling","DropdownContentStyling","neutral_200","neutral_400","DropdownButton","button","size","Small","Medium","Large","primary_500","primary_20","primary_100","ButtonDropdownWrapper","primary_700"],"mappings":"AAAA,OAAOA,MAAP,IAAgBC,GAAhB,QAA0B,mBAA1B;AACA,SAAQC,wBAAR,QAAuC,WAAvC;AACA,SAAQC,WAAR,EAAqBC,MAArB,EAA6BC,kBAA7B,QAAsD,WAAtD;AACA,SAAQC,iBAAR,EAA2BC,iBAA3B,EAA8CC,iBAA9C,EAAiEC,kBAAjE,EAAqFC,mBAArF,QAA+G,sBAA/G;AACA,SAASC,IAAT,QAAqB,UAArB;AAEA,OAAO,MAAMC,QAAQ,GAAGZ,MAAM,CAACa,GAAkF;AACjH;AACA;AACA,IAAKC,KAAD,IAAW,CAACA,KAAK,CAACC,QAAP,IAAmB,gCAAiC;AACnE,IAAKD,KAAD,IAAYA,KAAK,CAACE,MAAN,IAAgBF,KAAK,CAACG,QAAtB,GAAiC,sBAAjC,GAA0D,EAAI;AAC9E,IAAKH,KAAD,IAAYA,KAAK,CAACI,MAAN,GAAgB,WAAUJ,KAAK,CAACI,MAAO,GAAvC,GAA4C,EAAI;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAad,MAAM,CAACe,WAAY;AAChC;AACA;AACA;AACA,aAAaf,MAAM,CAACgB,WAAY;AAChC;AACA,CAtBO;AAwBP,MAAMC,WAAW,GAAGpB,GAAI;AACxB,sBAAsBG,MAAM,CAACkB,WAAY;AACzC,sCAAsClB,MAAM,CAACmB,WAAY;AACzD,WAAWnB,MAAM,CAACoB,WAAY;AAC9B;AACA;AACA;AACA,aAAapB,MAAM,CAACoB,WAAY;AAChC;AACA,CATA;AAWA,MAAMC,aAAa,GAAGxB,GAAI;AAC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C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0BrC,MAAM,CAACkD,WAAY;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwBlD,MAAM,CAACmD,UAAW;AAC1C;AACA;AACA,eAAenD,MAAM,CAACe,WAAY;AAClC;AACA;AACA;AACA,0BAA0Bf,MAAM,CAACkD,WAAY;AAC7C;AACA;AACA;AACA;AACA,wBAAwBlD,MAAM,CAACoD,WAAY;AAC3C;AACA;AACA,eAAepD,MAAM,CAACgB,WAAY;AAClC;AACA;AACA;AACA,0BAA0BhB,MAAM,CAACkD,WAAY;AAC7C;AACA;AACA,CA7FO;AA+FP,OAAO,MAAMG,qBAAqB,GAAGzD,MAAM,CAACa,GAA8C;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAKC,KAAD,IAAYA,KAAK,CAACE,MAAN,IAAgBF,KAAK,CAACG,QAAtB,GAAiC,sBAAjC,GAA0D,kBAAoB;AAC9F,IAAKH,KAAD,IAAYA,KAAK,CAACG,QAAN,GAAiB,uBAAjB,GAA2C,EAAI;AAC/D;AACA;AACA;AACA,wBAAwBb,MAAM,CAACmD,UAAW;AAC1C,aAAanD,MAAM,CAACsD,WAAY;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwBtD,MAAM,CAACoD,WAAY;AAC3C,aAAapD,MAAM,CAACgB,WAAY;AAChC;AACA;AACA,EA5CO","sourcesContent":["import styled, {css} from 'styled-components';\nimport {CommonInteractionStyling} from '../common';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle} from '../styles';\nimport {ComponentMStyling, ComponentLStyling, ComponentSStyling, ComponentXSStyling, ComponentXXSStyling} from '../styles/typography';\nimport { Size } from '../types';\n\nexport const Dropdown = styled.div<{ isButton: boolean; locked?: boolean; disabled?: boolean; margin?: string }>`\n position: relative;\n display: inline-block;\n ${(props) => !props.isButton && 'width: 100%; min-width: 344px;'}\n ${(props) => (props.locked || props.disabled ? 'cursor: not-allowed;' : '')}\n ${(props) => (props.margin ? `margin: ${props.margin};` : '')}\n\n .show {\n display: block;\n }\n\n .value {\n flex-grow: 1;\n }\n\n input:hover + div {\n color: ${COLORS.primary_600};\n }\n\n input:active + div {\n color: ${COLORS.primary_800};\n }\n`;\n\nconst lockedState = css`\n background-color: ${COLORS.neutral_100};\n box-shadow: inset 0px 0px 0px 1px ${COLORS.neutral_300};\n color: ${COLORS.neutral_600};\n pointer-events: none;\n cursor: not-allowed;\n input {\n color: ${COLORS.neutral_600} !important;\n }\n`;\n\nconst disabledState = css`\n background-color: ${COLORS.white};\n box-shadow: inset 0px 0px 0px 1px ${COLORS.neutral_100};\n color: ${COLORS.neutral_300};\n pointer-events: none;\n cursor: not-allowed;\n svg {\n color: ${COLORS.neutral_300} !important;\n }\n input {\n color: ${COLORS.neutral_300} !important;\n ::placeholder {\n color: ${COLORS.neutral_300} !important;\n }\n }\n`;\n\nconst activeValidationMessage = css`\n -webkit-box-shadow: inset 0px 0px 0px 2px ${COLORS.warning_400};\n -moz-box-shadow: inset 0px 0px 0px 2px ${COLORS.warning_400};\n box-shadow: inset 0px 0px 0px 2px ${COLORS.warning_400};\n`;\n\nconst placeholderStyling = css`\n ${ComponentMStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n`;\n\nexport const InputField = styled.input`\n ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.black)}\n border: none;\n outline: none;\n background-color: inherit;\n cursor: pointer;\n color: ${COLORS.black} !important;\n padding: 0;\n ::-webkit-search-decoration,\n ::-webkit-search-cancel-button,\n ::-webkit-search-results-button,\n ::-webkit-search-results-decoration {\n -webkit-appearance: none;\n }\n ::placeholder {\n ${ComponentSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n\n ${BREAKPOINTS.MEDIUM} {\n ${ComponentMStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n &.small {\n ${ComponentSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n &.medium {\n ${ComponentMStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n }\n`;\n\nexport const StyledField = styled.div<{ disabled: boolean; locked: boolean; showValidationMessage?: boolean; isPlaceholder?: boolean; fontSize?: string }>`\n ${ComponentSStyling(ComponentTextStyle.Regular, 'inherit')}\n\n padding: 12px 16px;\n height: 48px;\n min-width: 344px;\n width: 100%;\n\n background: ${COLORS.white};\n box-shadow: inset 0px 0px 0px 1px ${COLORS.neutral_300};\n box-sizing: border-box;\n border-radius: 4px;\n cursor: pointer;\n\n display: flex;\n align-items: center;\n gap: 4px;\n \n input{\n font-size: inherit;\n line-height: inherit;\n color: inherit;\n }\n\n &::placeholder {\n ${ComponentXXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n\n ${BREAKPOINTS.MEDIUM} {\n ${ComponentMStyling(ComponentTextStyle.Regular, 'inherit')}\n padding: 16px;\n height: 56px;\n &::placeholder {\n ${ComponentXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n }\n\n &.small {\n ${ComponentSStyling(ComponentTextStyle.Regular, 'inherit')}\n padding: 12px 16px;\n height: 48px;\n &::placeholder {\n ${ComponentXXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n }\n &.medium {\n ${ComponentMStyling(ComponentTextStyle.Regular, 'inherit')}\n height: 56px;\n padding: 16px;\n &::placeholder {\n ${ComponentXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n }\n\n &:focus {\n outline: 3px solid #ddd;\n }\n &:focus-within {\n -webkit-box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_800};\n -moz-box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_800};\n box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_800};\n }\n &:hover {\n box-shadow: inset 0px 0px 0px 1px ${COLORS.primary_200};\n input {\n ::placeholder {\n color: ${COLORS.primary_600};\n }\n }\n cursor: pointer;\n }\n &:active {\n box-shadow: inset 0px 0px 0px 1px ${COLORS.primary_300};\n input {\n ::placeholder {\n color: ${COLORS.primary_800};\n }\n }\n }\n\n &.button {\n ${(props) => ComponentSStyling(ComponentTextStyle.Bold, props.disabled ? COLORS.neutral_300 : COLORS.neutral_600)}\n\n box-sizing: border-box;\n height: 32px;\n padding: 0 8px;\n width: initial;\n min-width: initial;\n border: none !important;\n box-shadow: none;\n border-radius: 4px;\n\n &.expanded {\n color: ${COLORS.neutral_800};\n background: ${COLORS.neutral_20};\n }\n }\n\n ${(props) => (props.disabled ? disabledState : '')}\n ${(props) => (props.locked ? lockedState : '')}\n ${(props) => (props.showValidationMessage ? activeValidationMessage : '')}\n ${(props) => (props.isPlaceholder ? placeholderStyling : '')}\n\n ${CommonInteractionStyling};\n`;\n\nexport const ButtonDropdownContentStyling = css`\n min-width: 344px;\n right: 0;\n`;\n\nexport const DropdownContentStyling = styled.div<{ isButton: boolean }>`\n display: none;\n position: absolute;\n background-color: ${COLORS.white};\n width: 100%;\n z-index: 1;\n margin-top: ${(props) => (props.isButton ? '-4px' : '2px')};\n\n &.show {\n display: block;\n }\n\n &.up {\n top: auto;\n bottom: 100%;\n }\n\n ${(props) => (props.isButton ? ButtonDropdownContentStyling : '')};\n\n border: 1px solid ${COLORS.neutral_100};\n box-sizing: border-box;\n box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);\n border-radius: 4px;\n padding: 4px 0;\n\n max-height: 240px;\n overflow-y: auto;\n\n /* width */\n ::-webkit-scrollbar {\n width: 4px;\n cursor: pointer;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: ${COLORS.white};\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background: ${COLORS.neutral_200};\n border-radius: 8px;\n }\n\n /* Handle on hover */\n ::-webkit-scrollbar-thumb:hover {\n background: ${COLORS.neutral_400};\n }\n`;\n\nexport const DropdownButton = styled.button<{ size?: Size }>`\n\n ${props => props.size == Size.Small && ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${props => props.size == Size.Medium && ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${props => props.size == Size.Large && ComponentLStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ${props => props.size == Size.Large ? '64px' : props.size == Size.Medium ? '56px' : '48px'};\n background-color: ${COLORS.white};\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n div.divider {\n display: block;\n width: calc(100% - 40px);\n margin-left: 16px;\n border-top: 1px solid #e5e5e5;\n position: absolute;\n top: 0px;\n }\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n div.item-content {\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n\n div.item-label {\n flex: 1 0 calc(100% - 40px);\n }\n\n div.item-icon {\n margin-right: 6px;\n }\n div.item-icon-old {\n flex: 1 0 40px;\n display: flex;\n justify-content: flex-end;\n }\n }\n\n ${CommonInteractionStyling};\n\n &.active {\n background: ${COLORS.neutral_20};\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 0;\n bottom: 0;\n left: 2px;\n background-color: ${COLORS.primary_500};\n\n border-radius: 2px;\n }\n }\n\n &.active:hover {\n background-color: ${COLORS.primary_20};\n\n svg {\n color: ${COLORS.primary_600};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n\n &.active:active {\n background-color: ${COLORS.primary_100};\n\n svg {\n color: ${COLORS.primary_800};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n`;\n\nexport const ButtonDropdownWrapper = styled.div<{ locked?: boolean; disabled?: boolean }>`\n box-sizing: border-box;\n min-height: 48px;\n display: flex;\n align-items: center;\n width: fit-content;\n\n .button {\n min-width: 64px;\n }\n\n .value {\n flex-grow: 1;\n display: flex;\n justify-content: center;\n }\n\n .dropdown-arrow {\n width: 24px;\n height: 24px;\n }\n\n ${(props) => (props.locked || props.disabled ? 'cursor: not-allowed;' : 'cursor: pointer;')}\n ${(props) => (props.disabled ? 'pointer-events: none;' : '')}\n \n &:hover .button,\n & > .button:hover {\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_700};\n }\n\n &:focus .button,\n & > .button:focus {\n box-shadow: 0 4px 12px rgba(46, 127, 161, 0.25), 0 0 8px #2e7fa1;\n outline: none;\n }\n\n &:active .button,\n & > .button:active {\n box-shadow: none;\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n }\n\n}`;\n"],"file":"CommonStyling.js"}
|
|
@@ -7,95 +7,41 @@ import * as React from 'react';
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { IconButton } from '../Button';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
/**
|
|
13
|
-
* Import custom styles.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { DropdownContentStyling, DropdownButton as DB } from './CommonStyling';
|
|
10
|
+
import DropdownContent from './DropdownContent';
|
|
11
|
+
import styled from 'styled-components';
|
|
17
12
|
/**
|
|
18
13
|
* Import custom types.
|
|
19
14
|
*/
|
|
20
15
|
|
|
16
|
+
const Wrapper = styled.div`
|
|
17
|
+
position: relative;
|
|
18
|
+
display: inline-block;
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
21
|
const DropdownButton = ({
|
|
22
|
-
|
|
22
|
+
items,
|
|
23
23
|
icon,
|
|
24
|
-
iconSize,
|
|
25
24
|
disabled,
|
|
25
|
+
onClick,
|
|
26
|
+
itemsType = 'normal',
|
|
27
|
+
action,
|
|
28
|
+
actionLabel = '',
|
|
26
29
|
width,
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
size,
|
|
31
|
+
alignLeft,
|
|
32
|
+
multiSelect = false,
|
|
33
|
+
scrollable = false,
|
|
34
|
+
pinTopItem = false,
|
|
35
|
+
maxHeight
|
|
29
36
|
}) => {
|
|
30
37
|
// Globally used variables within the view.
|
|
31
38
|
const [dropdownOpen, setDropdownOpen] = React.useState(false);
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
* Adds custom event handler.
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
React.useEffect(() => {
|
|
38
|
-
document.addEventListener('click', handleClickOutside);
|
|
39
|
-
return () => {
|
|
40
|
-
document.removeEventListener('click', handleClickOutside);
|
|
41
|
-
};
|
|
42
|
-
});
|
|
43
|
-
/**
|
|
44
|
-
* Checks if we have clicked outside the dropdown - then close the dropdown.
|
|
45
|
-
* @param event - Event handler from the mouse click.
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
const handleClickOutside = event => {
|
|
49
|
-
if (dropdownContentRef?.current && !dropdownContentRef.current.contains(event.target)) {
|
|
50
|
-
if (dropdownOpen) {
|
|
51
|
-
setDropdownOpen(false);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Does all required actions when list item was selected.
|
|
57
|
-
* @param {Object} event - Event handler from the mouse click.
|
|
58
|
-
* @param {string} id - ID of the clicked list item.
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const clickListItem = (event, id) => {
|
|
63
|
-
// Prevent default actions
|
|
64
|
-
event.preventDefault(); // Do all required actions
|
|
65
|
-
|
|
66
|
-
onClick(id);
|
|
67
|
-
setDropdownOpen(false);
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Retrieves elements for the dropdown list.
|
|
71
|
-
* @returns Dropdown list elements HTML code.
|
|
72
|
-
*/
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const getElements = () => {
|
|
76
|
-
var options = list;
|
|
39
|
+
const [selectedValues, setSelectedValues] = React.useState([]);
|
|
40
|
+
const [focused, setFocused] = React.useState(null);
|
|
77
41
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}, /*#__PURE__*/React.createElement("span", null, "There are no options available"));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return options.map(item => {
|
|
85
|
-
return /*#__PURE__*/React.createElement(DB, {
|
|
86
|
-
type: "button",
|
|
87
|
-
onClick: event => {
|
|
88
|
-
if (!item.disabled) clickListItem(event, item.id);
|
|
89
|
-
},
|
|
90
|
-
key: item.id,
|
|
91
|
-
disabled: item.disabled,
|
|
92
|
-
className: item.showDividerAbove ? 'show-divider-above' : ''
|
|
93
|
-
}, item.icon && /*#__PURE__*/React.createElement("div", {
|
|
94
|
-
className: "item-content"
|
|
95
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
96
|
-
className: "item-label"
|
|
97
|
-
}, item.label), renderItemIcon(item.icon)), !item.icon && /*#__PURE__*/React.createElement("span", null, item.label));
|
|
98
|
-
});
|
|
42
|
+
const handleValueSelect = values => {
|
|
43
|
+
// Do all required actions
|
|
44
|
+
onClick(values);
|
|
99
45
|
};
|
|
100
46
|
/**
|
|
101
47
|
* Renders Icon Button dropdown menu.
|
|
@@ -109,29 +55,36 @@ const DropdownButton = ({
|
|
|
109
55
|
shape: "circular",
|
|
110
56
|
action: () => setDropdownOpen(!dropdownOpen),
|
|
111
57
|
disabled: disabled
|
|
112
|
-
}, icon
|
|
113
|
-
size: iconSize,
|
|
114
|
-
color: iconColor
|
|
115
|
-
}));
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const renderItemIcon = i => {
|
|
119
|
-
return i && /*#__PURE__*/React.createElement("div", {
|
|
120
|
-
className: "item-icon"
|
|
121
|
-
}, icons[i]({
|
|
122
|
-
size: '20px',
|
|
123
|
-
color: COLORS.neutral_600
|
|
124
|
-
}));
|
|
58
|
+
}, icon);
|
|
125
59
|
};
|
|
126
60
|
|
|
127
|
-
return /*#__PURE__*/React.createElement(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
61
|
+
return /*#__PURE__*/React.createElement(Wrapper, null, renderIconButton(), /*#__PURE__*/React.createElement(DropdownContent, {
|
|
62
|
+
customizationProps: {
|
|
63
|
+
itemsType: itemsType,
|
|
64
|
+
action: action ?? (() => {}),
|
|
65
|
+
actionLabel: actionLabel,
|
|
66
|
+
onValueUpdate: handleValueSelect,
|
|
67
|
+
multiSelect: multiSelect,
|
|
68
|
+
scrollable: scrollable,
|
|
69
|
+
pinTopItem: pinTopItem,
|
|
70
|
+
maxHeight: maxHeight,
|
|
71
|
+
items: items
|
|
131
72
|
},
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
73
|
+
focused: focused,
|
|
74
|
+
setFocused: setFocused,
|
|
75
|
+
size: size,
|
|
76
|
+
width: width,
|
|
77
|
+
alignLeft: alignLeft,
|
|
78
|
+
isOpen: dropdownOpen,
|
|
79
|
+
setIsOpen: setDropdownOpen,
|
|
80
|
+
hideOnClickOutside: true,
|
|
81
|
+
filter: "",
|
|
82
|
+
selectedValues: itemsType == 'normal' ? [] : selectedValues,
|
|
83
|
+
setSelectedValues: setSelectedValues,
|
|
84
|
+
messageOnNoResults: "No results",
|
|
85
|
+
isButton: true,
|
|
86
|
+
id: "dropdown-content"
|
|
87
|
+
}));
|
|
135
88
|
};
|
|
136
89
|
|
|
137
90
|
export default DropdownButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Dropdown/DropdownButton.tsx"],"names":["React","IconButton","
|
|
1
|
+
{"version":3,"sources":["../../../src/Dropdown/DropdownButton.tsx"],"names":["React","IconButton","DropdownContent","styled","Wrapper","div","DropdownButton","items","icon","disabled","onClick","itemsType","action","actionLabel","width","size","alignLeft","multiSelect","scrollable","pinTopItem","maxHeight","dropdownOpen","setDropdownOpen","useState","selectedValues","setSelectedValues","focused","setFocused","handleValueSelect","values","renderIconButton","onValueUpdate"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,WAA3B;AACA,OAAOC,eAA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B,eAEE,oBAAC,eAAD;AACE,IAAA,kBAAkB,EAAE;AAClBnB,MAAAA,SAAS,EAAEA,SADO;AAElBC,MAAAA,MAAM,EAAEA,MAAM,KAAK,MAAM,CAAE,CAAb,CAFI;AAGlBC,MAAAA,WAAW,EAAEA,WAHK;AAIlBkB,MAAAA,aAAa,EAAEH,iBAJG;AAKlBX,MAAAA,WAAW,EAAEA,WALK;AAMlBC,MAAAA,UAAU,EAAEA,UANM;AAOlBC,MAAAA,UAAU,EAAEA,UAPM;AAQlBC,MAAAA,SAAS,EAAEA,SARO;AASlBb,MAAAA,KAAK,EAAEA;AATW,KADtB;AAYE,IAAA,OAAO,EAAEmB,OAZX;AAaE,IAAA,UAAU,EAAEC,UAbd;AAcE,IAAA,IAAI,EAAEZ,IAdR;AAeE,IAAA,KAAK,EAAED,KAfT;AAgBE,IAAA,SAAS,EAAEE,SAhBb;AAiBE,IAAA,MAAM,EAAEK,YAjBV;AAkBE,IAAA,SAAS,EAAEC,eAlBb;AAmBE,IAAA,kBAAkB,EAAE,IAnBtB;AAoBE,IAAA,MAAM,EAAC,EApBT;AAqBE,IAAA,cAAc,EAAEX,SAAS,IAAI,QAAb,GAAwB,EAAxB,GAA6Ba,cArB/C;AAsBE,IAAA,iBAAiB,EAAEC,iBAtBrB;AAuBE,IAAA,kBAAkB,EAAC,YAvBrB;AAwBE,IAAA,QAAQ,EAAE,IAxBZ;AAyBE,IAAA,EAAE,EAAC;AAzBL,IAFF,CADF;AAgCD,CArED;;AAuEA,eAAenB,cAAf","sourcesContent":["/**\n * Import React libraries.\n */\nimport * as React from 'react';\n\n/**\n * Import custom components.\n */\nimport { IconButton } from '../Button';\nimport DropdownContent from './DropdownContent';\nimport styled from 'styled-components';\n\n/**\n * Import custom types.\n */\nimport { DropdownButtonProps } from './DropdownButtonTypes';\n\nconst Wrapper = styled.div`\n position: relative;\n display: inline-block;\n`;\n\nconst DropdownButton = ({ \n items, \n icon, \n disabled,\n onClick,\n itemsType = 'normal',\n action,\n actionLabel = '',\n width,\n size,\n alignLeft,\n multiSelect = false,\n scrollable = false,\n pinTopItem = false,\n maxHeight }: DropdownButtonProps) => {\n // Globally used variables within the view.\n const [dropdownOpen, setDropdownOpen] = React.useState<boolean>(false);\n const [selectedValues, setSelectedValues] = React.useState<string[]>([]);\n const [focused, setFocused] = React.useState<number | null>(null);\n\n const handleValueSelect = (values: string[]) => {\n // Do all required actions\n onClick(values);\n };\n\n /**\n * Renders Icon Button dropdown menu.\n * @returns HTML View for the Icon button dropdown menu.\n */\n const renderIconButton = () => {\n return (\n <IconButton variant=\"secondary\" shape=\"circular\" action={() => setDropdownOpen(!dropdownOpen)} disabled={disabled}>\n {icon}\n </IconButton>\n );\n };\n\n return (\n <Wrapper>\n {renderIconButton()}\n <DropdownContent\n customizationProps={{\n itemsType: itemsType,\n action: action ?? (() => {}),\n actionLabel: actionLabel,\n onValueUpdate: handleValueSelect,\n multiSelect: multiSelect,\n scrollable: scrollable,\n pinTopItem: pinTopItem,\n maxHeight: maxHeight,\n items: items\n }}\n focused={focused}\n setFocused={setFocused}\n size={size}\n width={width}\n alignLeft={alignLeft}\n isOpen={dropdownOpen}\n setIsOpen={setDropdownOpen}\n hideOnClickOutside={true}\n filter=''\n selectedValues={itemsType == 'normal' ? [] : selectedValues}\n setSelectedValues={setSelectedValues}\n messageOnNoResults='No results'\n isButton={true}\n id='dropdown-content'\n />\n </Wrapper>\n );\n};\n\nexport default DropdownButton;\n"],"file":"DropdownButton.js"}
|