@laerdal/life-react-components 2.1.0-dev.3 → 2.1.0-dev.7
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/AuthPage/AuthPage.d.ts +1 -1
- package/dist/Banners/Banner.d.ts +1 -1
- package/dist/Banners/OverviewBanner.d.ts +1 -1
- package/dist/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/Button/Iconbutton.cjs +6 -4
- package/dist/Button/Iconbutton.cjs.map +1 -1
- package/dist/Button/Iconbutton.d.ts +1 -0
- package/dist/Button/Iconbutton.js +6 -4
- package/dist/Button/Iconbutton.js.map +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardActions.d.ts +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardBody.d.ts +1 -1
- package/dist/Card/HorizontalCard/HorizontalCardThumbnail.d.ts +1 -1
- package/dist/Card/HorizontalCard/types.d.ts +4 -4
- package/dist/Chips/ChipTypes.d.ts +2 -2
- package/dist/ChipsInput/ChipDropdownInput.cjs.map +1 -1
- package/dist/ChipsInput/ChipDropdownInput.d.ts +1 -1
- package/dist/ChipsInput/ChipDropdownInput.js.map +1 -1
- package/dist/ChipsInput/ChipInput.cjs +13 -2
- package/dist/ChipsInput/ChipInput.cjs.map +1 -1
- package/dist/ChipsInput/ChipInput.js +14 -3
- package/dist/ChipsInput/ChipInput.js.map +1 -1
- package/dist/ChipsInput/ChipInputField.cjs +1 -0
- package/dist/ChipsInput/ChipInputField.cjs.map +1 -1
- package/dist/ChipsInput/ChipInputField.js +1 -0
- package/dist/ChipsInput/ChipInputField.js.map +1 -1
- package/dist/ChipsInput/ChipInputTypes.cjs.map +1 -1
- package/dist/ChipsInput/ChipInputTypes.d.ts +2 -1
- package/dist/ChipsInput/ChipInputTypes.js.map +1 -1
- package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
- package/dist/Dropdown/BasicDropdown.d.ts +3 -3
- package/dist/Dropdown/BasicDropdown.js.map +1 -1
- package/dist/Dropdown/CommonStyling.cjs +1 -1
- package/dist/Dropdown/CommonStyling.cjs.map +1 -1
- package/dist/Dropdown/CommonStyling.js +1 -1
- package/dist/Dropdown/CommonStyling.js.map +1 -1
- package/dist/Dropdown/DropdownButtonTypes.d.ts +3 -3
- package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs +1 -1
- package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs.map +1 -1
- package/dist/GlobalNavigationBar/GlobalNavigationBar.d.ts +1 -1
- package/dist/GlobalNavigationBar/GlobalNavigationBar.js +1 -1
- package/dist/GlobalNavigationBar/GlobalNavigationBar.js.map +1 -1
- package/dist/GlobalNavigationBar/Logo.d.ts +1 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.d.ts +1 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.d.ts +1 -1
- package/dist/GlobalNavigationBar/desktop/RightSideNav.d.ts +1 -1
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs +4 -2
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/UserMenu.js +4 -2
- package/dist/GlobalNavigationBar/desktop/UserMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs +3 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenu.d.ts +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenu.js +3 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/types.d.ts +7 -7
- package/dist/HyperLink/index.cjs +10 -2
- package/dist/HyperLink/index.cjs.map +1 -1
- package/dist/HyperLink/index.d.ts +2 -2
- package/dist/HyperLink/index.js +2 -2
- package/dist/HyperLink/index.js.map +1 -1
- package/dist/Image/ImageWithFallbacks.d.ts +1 -1
- package/dist/InputFields/Label.cjs +39 -6
- package/dist/InputFields/Label.cjs.map +1 -1
- package/dist/InputFields/Label.d.ts +2 -1
- package/dist/InputFields/Label.js +41 -9
- package/dist/InputFields/Label.js.map +1 -1
- package/dist/InputFields/QuickSearch.d.ts +1 -1
- package/dist/InputFields/ResponsiveComponentWrapper.d.ts +1 -1
- package/dist/InputFields/SearchBar.d.ts +1 -1
- package/dist/InputFields/components/SearchBarInput.d.ts +1 -1
- package/dist/InputFields/types.d.ts +3 -3
- package/dist/List/ListRow.d.ts +1 -1
- package/dist/LoadingIndicator/LoadingIndicator.d.ts +1 -1
- package/dist/MiniProductCard/MiniProductCard.d.ts +1 -1
- package/dist/Modals/Modal.d.ts +1 -1
- package/dist/Modals/ModalContainer.d.ts +2 -2
- package/dist/Modals/ModalTypes.d.ts +1 -1
- package/dist/NavItem/NavItem.d.ts +1 -1
- package/dist/Paginator/Paginator.d.ts +1 -1
- package/dist/Popover/Popover.d.ts +4 -4
- package/dist/ProfileButton/ProfileButton.d.ts +1 -1
- package/dist/QuizButton/QuizButton.d.ts +1 -1
- package/dist/SideMenu/types.d.ts +3 -3
- package/dist/SkipToContent/SkipToContent.d.ts +1 -1
- package/dist/Table/TableTypes.d.ts +4 -4
- package/dist/Tabs/TabLink.d.ts +1 -1
- package/dist/Tabs/Tabs.d.ts +1 -1
- package/dist/Tag/Tag.cjs +3 -5
- package/dist/Tag/Tag.cjs.map +1 -1
- package/dist/Tag/Tag.d.ts +2 -2
- package/dist/Tag/Tag.js +3 -5
- package/dist/Tag/Tag.js.map +1 -1
- package/dist/Tile/TileTypes.d.ts +8 -8
- package/dist/Toasters/Toast.d.ts +2 -2
- package/dist/Toasters/ToastContext.d.ts +2 -2
- package/dist/assets/index.d.ts +1 -1
- package/dist/icons/index.d.ts +2 -2
- package/dist/styles/typography.cjs +2 -1
- package/dist/styles/typography.cjs.map +1 -1
- package/dist/styles/typography.d.ts +3 -2
- package/dist/styles/typography.js +1 -1
- package/dist/styles/typography.js.map +1 -1
- package/package.json +10 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasicDropdown.js","names":["React","COLORS","ArrowDropDown","ArrowDropUp","Information","TechnicalWarning","LoadingIndicator","Dropdown","StyledField","InputField","DropdownContent","AutofilledMessage","ErrorMessage","Size","defaultOnMouseDownHandler","useClickOutsideRef","useFocusVisibleRef","useFocusOutsideRef","BasicDropdown","forwardRef","props","ref","id","list","placeholder","messageOnNoResults","itemsType","action","actionLabel","actionVariant","actionIcon","actionLoading","actionDisabled","pinTopItem","scrollable","maxHeight","disabled","readOnly","isButton","activeValidationMessage","autofilledMessage","size","margin","minWidth","className","onBlur","onSelect","rest","useState","isOpen","setIsOpen","activeDescendant","setActiveDescendant","isLoading","setIsLoading","input","setInput","focused","setFocused","keyboardNavigated","setKeyboardNavigated","inputRef","useRef","styledFieldRef","dropdownRef","resetDropdown","containerRef","handleKeyDown","e","key","handleValueSelect","values","join","multiSelect","undefined","current","focus","focusVisible","useEffect","value","useImperativeHandle","customSetIsOpen","getDisplayItems","split","map","val","trim","listDisplayLabels","filter","item","includes","l","displayLabel","handleBlur","currentTarget","contains","relatedTarget","cls","concat","stopPropagation","blur","Small","neutral_600","onValueUpdate","items","critical_400","disableSorting"],"sources":["../../src/Dropdown/BasicDropdown.tsx"],"sourcesContent":["import * as React from 'react';\nimport {COLORS} from '../styles';\nimport {ArrowDropDown, ArrowDropUp, Information, TechnicalWarning} from '../icons/systemicons/SystemIcons';\nimport {LoadingIndicator} from '../LoadingIndicator';\nimport {Dropdown, StyledField, InputField} from './CommonStyling';\nimport DropdownContent, {DropdownItem} from './DropdownContent';\nimport {AutofilledMessage, ErrorMessage} from '../InputFields/styling';\nimport {Size} from '../types';\nimport {defaultOnMouseDownHandler, useClickOutsideRef, useFocusVisibleRef} from '../common';\nimport {useFocusOutsideRef} from '../common';\nimport numberField from '../InputFields/NumberField';\n\ninterface BasicDropdownCommonProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect' | 'placeholder' | 'tabIndex' | 'onMouseDown' | 'onClick' | 'onKeyDown'>{\n list: DropdownItem[];\n itemsType?: 'normal' | 'checkbox' | 'radio';\n action?: () => void;\n actionLabel?: string;\n actionVariant?: 'primary' | 'secondary' | 'tertiary' | undefined;\n actionIcon?: React.ReactNode;\n actionLoading?: boolean;\n actionDisabled?: boolean;\n pinTopItem?: boolean;\n scrollable?: boolean;\n maxHeight?: string;\n placeholder?: string;\n disableSorting?: boolean;\n messageOnNoResults?: string;\n disabled?: boolean;\n readOnly?: boolean;\n isButton?: boolean;\n activeValidationMessage?: string;\n autofilledMessage?: string;\n size?: Size.Small | Size.Medium;\n margin?: string;\n minWidth?: string;\n}\n\ntype DropdownFilterMultiSelectProps = BasicDropdownCommonProps & {\n multiSelect: true;\n value?: string[];\n onSelect: (value: string[]) => void;\n}\n\ntype DropdownFilterSingleSelectProps = BasicDropdownCommonProps & {\n multiSelect?: false;\n value?: string;\n onSelect: (value: string) => void;\n}\n\ntype DropdownFilterProps = DropdownFilterSingleSelectProps | DropdownFilterMultiSelectProps;\n\nconst BasicDropdown = React.forwardRef((props: DropdownFilterProps, ref) => {\n const {\n id,\n list,\n placeholder,\n messageOnNoResults,\n itemsType = 'normal',\n action,\n actionLabel,\n actionVariant,\n actionIcon,\n actionLoading,\n actionDisabled,\n pinTopItem,\n scrollable = true,\n maxHeight,\n disabled,\n readOnly,\n isButton,\n activeValidationMessage,\n autofilledMessage,\n size,\n margin = '4px 0',\n minWidth,\n className,\n onBlur,\n onSelect,\n ...rest\n } = props;\n\n const [isOpen, setIsOpen] = React.useState<boolean>(false);\n const [activeDescendant, setActiveDescendant] = React.useState<string>();\n const [isLoading, setIsLoading] = React.useState<boolean>(false);\n const [input, setInput] = React.useState<string>('');\n const [focused, setFocused] = React.useState<number | null>(null);\n const [keyboardNavigated, setKeyboardNavigated] = React.useState<boolean>(false);\n\n const inputRef = React.useRef<HTMLInputElement>(null);\n const styledFieldRef = useFocusVisibleRef([inputRef]);\n const dropdownRef = React.useRef<HTMLDivElement>(null);\n\n const resetDropdown = () => {\n setIsOpen(false);\n setFocused(null);\n };\n\n const containerRef = useFocusOutsideRef(resetDropdown, [dropdownRef]);\n\n useClickOutsideRef(resetDropdown, [], containerRef);\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n setIsOpen(!isOpen);\n setKeyboardNavigated(true);\n }\n };\n\n const handleValueSelect = (values: string[]) => {\n setInput(values.join(', '));\n\n if (props.multiSelect === true) {\n props.onSelect(values);\n } else if (props.multiSelect === false || props.multiSelect === undefined) {\n props.onSelect(values[0]);\n }\n\n //don't close dropdown on item select if have custom action or multiselect\n if (actionLabel || props.multiSelect) return;\n\n if (keyboardNavigated) {\n styledFieldRef.current?.focus({focusVisible: true} as any);\n }\n setIsOpen(false);\n setFocused(null);\n };\n\n React.useEffect(() => {\n if (props.value) {\n if (props.multiSelect) {\n setInput(props.value.join(', '));\n } else if (props.multiSelect === false || props.multiSelect === undefined) {\n setInput(props.value);\n }\n } else {\n setInput('');\n }\n }, [props.value, props.multiSelect]);\n\n React.useEffect(() => {\n setIsLoading(false);\n }, [input]);\n\n React.useEffect(() => {\n !isOpen && setKeyboardNavigated(false);\n }, [isOpen]);\n\n React.useImperativeHandle(ref, () => inputRef.current, [inputRef]);\n\n const customSetIsOpen = (isOpen: boolean) => {\n setIsOpen(isOpen);\n };\n\n const getDisplayItems = () => {\n const values = input.split(',').map((val) => val.trim());\n const listDisplayLabels = list.filter((item) => values.includes(item.value)).map((l) => l.displayLabel);\n return listDisplayLabels.join(', ');\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLDivElement>) => {\n // @ts-ignore\n if (!e.currentTarget.contains(e.relatedTarget)) {\n onBlur && onBlur(e);\n }\n };\n\n const cls = (isOpen ? 'expanded ' : '').concat(size ? size : '').concat(isButton ? ' button ' : '').concat(className ? ` ${className}` : '');\n \n return (\n <>\n <Dropdown ref={containerRef}\n aria-expanded={isOpen ? true : false}\n aria-activedescendant={activeDescendant}\n aria-controls={`${id}_dropdowncontent`}\n role=\"listbox\"\n aria-multiselectable={props.multiSelect}\n isButton={isButton || false}\n className={size ? size : ''}\n readOnly={readOnly}\n disabled={disabled}\n margin={margin}\n onBlur={handleBlur}\n minWidth={minWidth}>\n <StyledField\n ref={styledFieldRef}\n className={cls}\n onMouseDown={defaultOnMouseDownHandler}\n onClick={(e) => {\n if (!readOnly && !disabled) {\n e.stopPropagation();\n setIsOpen(!isOpen);\n if (isOpen) {\n inputRef.current?.blur();\n } else {\n inputRef.current?.focus();\n }\n }\n }}\n tabIndex={disabled || readOnly ? -1 : 0}\n disabled={disabled || false}\n readOnly={readOnly || false}\n isPlaceholder={!input}\n placeholder={placeholder}\n showValidationMessage={!!activeValidationMessage}\n onKeyDown={handleKeyDown}\n minWidth={minWidth}\n {...rest}>\n <InputField\n ref={inputRef}\n type=\"search\"\n readOnly\n placeholder={placeholder}\n value={getDisplayItems()}\n className={size ? `${size} value` : 'value'}\n tabIndex={-1}\n disabled={disabled || false}\n />\n {isLoading ? <LoadingIndicator size={Size.Small} color={COLORS.neutral_600}/> : null}\n <div className={'icon dropdown-arrow'}>\n {isOpen ? <ArrowDropUp size=\"24px\" className={size ? size : ''}/> :\n <ArrowDropDown size=\"24px\" className={size ? size : ''}/>}\n </div>\n </StyledField>\n {!readOnly && !disabled && (\n <DropdownContent\n ref={dropdownRef}\n containerRef={containerRef}\n onActiveDescendantChanged={(id) => setActiveDescendant(id)}\n customizationProps={{\n itemsType: itemsType,\n action: action ?? (() => {\n }),\n actionLabel: actionLabel,\n actionVariant: actionVariant,\n actionDisabled: actionDisabled,\n scrollable: scrollable,\n onValueUpdate: handleValueSelect,\n items: list,\n multiSelect: props.multiSelect,\n pinTopItem: pinTopItem,\n maxHeight: maxHeight,\n actionIcon: actionIcon,\n actionLoading: actionLoading,\n }}\n ariaRolesType=\"input\"\n focused={focused}\n setFocused={setFocused}\n size={size ?? Size.Small}\n filter={''}\n isOpen={isOpen}\n setIsOpen={customSetIsOpen}\n messageOnNoResults={messageOnNoResults ?? ''}\n outline={keyboardNavigated}\n isButton={isButton || false}\n selectedValues={props.multiSelect ? props.value || [] : [props.value || '']}\n setSelectedValues={handleValueSelect}\n id={`${id}_dropdowncontent`}\n />\n )}\n </Dropdown>\n {activeValidationMessage && (\n <ErrorMessage>\n <TechnicalWarning color={COLORS.critical_400}/>\n <span>{activeValidationMessage}</span>\n </ErrorMessage>\n )}\n {autofilledMessage && (\n <AutofilledMessage>\n <Information color={COLORS.neutral_600}/>\n <span>{autofilledMessage}</span>\n </AutofilledMessage>\n )}\n </>\n );\n});\n\nexport default BasicDropdown;\n"],"mappings":";;;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAAQC,MAAM,QAAO,WAAW;AAChC,SAAQC,aAAa,EAAEC,WAAW,EAAEC,WAAW,EAAEC,gBAAgB,QAAO,kCAAkC;AAC1G,SAAQC,gBAAgB,QAAO,qBAAqB;AACpD,SAAQC,QAAQ,EAAEC,WAAW,EAAEC,UAAU,QAAO,iBAAiB;AACjE,OAAOC,eAAe,MAAsB,mBAAmB;AAC/D,SAAQC,iBAAiB,EAAEC,YAAY,QAAO,wBAAwB;AACtE,SAAQC,IAAI,QAAO,UAAU;AAC7B,SAAQC,yBAAyB,EAAEC,kBAAkB,EAAEC,kBAAkB,QAAO,WAAW;AAC3F,SAAQC,kBAAkB,QAAO,WAAW;AAAC;AAAA;AAAA;AA0C7C,IAAMC,aAAa,gBAAGlB,KAAK,CAACmB,UAAU,CAAC,UAACC,KAA0B,EAAEC,GAAG,EAAK;EAC1E,IACEC,EAAE,GA0BAF,KAAK,CA1BPE,EAAE;IACFC,IAAI,GAyBFH,KAAK,CAzBPG,IAAI;IACJC,WAAW,GAwBTJ,KAAK,CAxBPI,WAAW;IACXC,kBAAkB,GAuBhBL,KAAK,CAvBPK,kBAAkB;IAAA,mBAuBhBL,KAAK,CAtBPM,SAAS;IAATA,SAAS,iCAAG,QAAQ;IACpBC,MAAM,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AAG,OAAO;AAsQ7C,eAAe5B,aAAa"}
|
|
1
|
+
{"version":3,"file":"BasicDropdown.js","names":["React","COLORS","ArrowDropDown","ArrowDropUp","Information","TechnicalWarning","LoadingIndicator","Dropdown","StyledField","InputField","DropdownContent","AutofilledMessage","ErrorMessage","Size","defaultOnMouseDownHandler","useClickOutsideRef","useFocusVisibleRef","useFocusOutsideRef","BasicDropdown","forwardRef","props","ref","id","list","placeholder","messageOnNoResults","itemsType","action","actionLabel","actionVariant","actionIcon","actionLoading","actionDisabled","pinTopItem","scrollable","maxHeight","disabled","readOnly","isButton","activeValidationMessage","autofilledMessage","size","margin","minWidth","className","onBlur","onSelect","rest","useState","isOpen","setIsOpen","activeDescendant","setActiveDescendant","isLoading","setIsLoading","input","setInput","focused","setFocused","keyboardNavigated","setKeyboardNavigated","inputRef","useRef","styledFieldRef","dropdownRef","resetDropdown","containerRef","handleKeyDown","e","key","handleValueSelect","values","join","multiSelect","undefined","current","focus","focusVisible","useEffect","value","useImperativeHandle","customSetIsOpen","getDisplayItems","split","map","val","trim","listDisplayLabels","filter","item","includes","l","displayLabel","handleBlur","currentTarget","contains","relatedTarget","cls","concat","stopPropagation","blur","Small","neutral_600","onValueUpdate","items","critical_400","disableSorting"],"sources":["../../src/Dropdown/BasicDropdown.tsx"],"sourcesContent":["import * as React from 'react';\nimport {COLORS} from '../styles';\nimport {ArrowDropDown, ArrowDropUp, Information, TechnicalWarning} from '../icons/systemicons/SystemIcons';\nimport {LoadingIndicator} from '../LoadingIndicator';\nimport {Dropdown, StyledField, InputField} from './CommonStyling';\nimport DropdownContent, {DropdownItem} from './DropdownContent';\nimport {AutofilledMessage, ErrorMessage} from '../InputFields/styling';\nimport {Size} from '../types';\nimport {defaultOnMouseDownHandler, useClickOutsideRef, useFocusVisibleRef} from '../common';\nimport {useFocusOutsideRef} from '../common';\n\ninterface BasicDropdownCommonProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect' | 'placeholder' | 'tabIndex' | 'onMouseDown' | 'onClick' | 'onKeyDown'>{\n list: DropdownItem[];\n itemsType?: 'normal' | 'checkbox' | 'radio';\n action?: () => void;\n actionLabel?: string;\n actionVariant?: 'primary' | 'secondary' | 'tertiary' | undefined;\n actionIcon?: React.ReactNode;\n actionLoading?: boolean;\n actionDisabled?: boolean;\n pinTopItem?: boolean;\n scrollable?: boolean;\n maxHeight?: string;\n placeholder?: string;\n disableSorting?: boolean;\n messageOnNoResults?: string;\n disabled?: boolean;\n readOnly?: boolean;\n isButton?: boolean;\n activeValidationMessage?: string;\n autofilledMessage?: string;\n size?: Size.Small | Size.Medium;\n margin?: string;\n minWidth?: string;\n}\n\ntype DropdownFilterMultiSelectProps = BasicDropdownCommonProps & {\n multiSelect: true;\n value?: string[];\n onSelect: (value: string[]) => void;\n}\n\ntype DropdownFilterSingleSelectProps = BasicDropdownCommonProps & {\n multiSelect?: false;\n value?: string;\n onSelect: (value: string) => void;\n}\n\ntype DropdownFilterProps = DropdownFilterSingleSelectProps | DropdownFilterMultiSelectProps;\n\nconst BasicDropdown = React.forwardRef((props: DropdownFilterProps, ref) => {\n const {\n id,\n list,\n placeholder,\n messageOnNoResults,\n itemsType = 'normal',\n action,\n actionLabel,\n actionVariant,\n actionIcon,\n actionLoading,\n actionDisabled,\n pinTopItem,\n scrollable = true,\n maxHeight,\n disabled,\n readOnly,\n isButton,\n activeValidationMessage,\n autofilledMessage,\n size,\n margin = '4px 0',\n minWidth,\n className,\n onBlur,\n onSelect,\n ...rest\n } = props;\n\n const [isOpen, setIsOpen] = React.useState<boolean>(false);\n const [activeDescendant, setActiveDescendant] = React.useState<string>();\n const [isLoading, setIsLoading] = React.useState<boolean>(false);\n const [input, setInput] = React.useState<string>('');\n const [focused, setFocused] = React.useState<number | null>(null);\n const [keyboardNavigated, setKeyboardNavigated] = React.useState<boolean>(false);\n\n const inputRef = React.useRef<HTMLInputElement>(null);\n const styledFieldRef = useFocusVisibleRef([inputRef]);\n const dropdownRef = React.useRef<HTMLDivElement>(null);\n\n const resetDropdown = () => {\n setIsOpen(false);\n setFocused(null);\n };\n\n const containerRef = useFocusOutsideRef(resetDropdown, [dropdownRef]);\n\n useClickOutsideRef(resetDropdown, [], containerRef);\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n setIsOpen(!isOpen);\n setKeyboardNavigated(true);\n }\n };\n\n const handleValueSelect = (values: string[]) => {\n setInput(values.join(', '));\n\n if (props.multiSelect === true) {\n props.onSelect(values);\n } else if (props.multiSelect === false || props.multiSelect === undefined) {\n props.onSelect(values[0]);\n }\n\n //don't close dropdown on item select if have custom action or multiselect\n if (actionLabel || props.multiSelect) return;\n\n if (keyboardNavigated) {\n styledFieldRef.current?.focus({focusVisible: true} as any);\n }\n setIsOpen(false);\n setFocused(null);\n };\n\n React.useEffect(() => {\n if (props.value) {\n if (props.multiSelect) {\n setInput(props.value.join(', '));\n } else if (props.multiSelect === false || props.multiSelect === undefined) {\n setInput(props.value);\n }\n } else {\n setInput('');\n }\n }, [props.value, props.multiSelect]);\n\n React.useEffect(() => {\n setIsLoading(false);\n }, [input]);\n\n React.useEffect(() => {\n !isOpen && setKeyboardNavigated(false);\n }, [isOpen]);\n\n React.useImperativeHandle(ref, () => inputRef.current, [inputRef]);\n\n const customSetIsOpen = (isOpen: boolean) => {\n setIsOpen(isOpen);\n };\n\n const getDisplayItems = () => {\n const values = input.split(',').map((val) => val.trim());\n const listDisplayLabels = list.filter((item) => values.includes(item.value)).map((l) => l.displayLabel);\n return listDisplayLabels.join(', ');\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLDivElement>) => {\n // @ts-ignore\n if (!e.currentTarget.contains(e.relatedTarget)) {\n onBlur && onBlur(e);\n }\n };\n\n const cls = (isOpen ? 'expanded ' : '').concat(size ? size : '').concat(isButton ? ' button ' : '').concat(className ? ` ${className}` : '');\n \n return (\n <>\n <Dropdown ref={containerRef}\n aria-expanded={isOpen ? true : false}\n aria-activedescendant={activeDescendant}\n aria-controls={`${id}_dropdowncontent`}\n role=\"listbox\"\n aria-multiselectable={props.multiSelect}\n isButton={isButton || false}\n className={size ? size : ''}\n readOnly={readOnly}\n disabled={disabled}\n margin={margin}\n onBlur={handleBlur}\n minWidth={minWidth}>\n <StyledField\n ref={styledFieldRef}\n className={cls}\n onMouseDown={defaultOnMouseDownHandler}\n onClick={(e) => {\n if (!readOnly && !disabled) {\n e.stopPropagation();\n setIsOpen(!isOpen);\n if (isOpen) {\n inputRef.current?.blur();\n } else {\n inputRef.current?.focus();\n }\n }\n }}\n tabIndex={disabled || readOnly ? -1 : 0}\n disabled={disabled || false}\n readOnly={readOnly || false}\n isPlaceholder={!input}\n placeholder={placeholder}\n showValidationMessage={!!activeValidationMessage}\n onKeyDown={handleKeyDown}\n minWidth={minWidth}\n {...rest}>\n <InputField\n ref={inputRef}\n type=\"search\"\n readOnly\n placeholder={placeholder}\n value={getDisplayItems()}\n className={size ? `${size} value` : 'value'}\n tabIndex={-1}\n disabled={disabled || false}\n />\n {isLoading ? <LoadingIndicator size={Size.Small} color={COLORS.neutral_600}/> : null}\n <div className={'icon dropdown-arrow'}>\n {isOpen ? <ArrowDropUp size=\"24px\" className={size ? size : ''}/> :\n <ArrowDropDown size=\"24px\" className={size ? size : ''}/>}\n </div>\n </StyledField>\n {!readOnly && !disabled && (\n <DropdownContent\n ref={dropdownRef}\n containerRef={containerRef}\n onActiveDescendantChanged={(id) => setActiveDescendant(id)}\n customizationProps={{\n itemsType: itemsType,\n action: action ?? (() => {\n }),\n actionLabel: actionLabel,\n actionVariant: actionVariant,\n actionDisabled: actionDisabled,\n scrollable: scrollable,\n onValueUpdate: handleValueSelect,\n items: list,\n multiSelect: props.multiSelect,\n pinTopItem: pinTopItem,\n maxHeight: maxHeight,\n actionIcon: actionIcon,\n actionLoading: actionLoading,\n }}\n ariaRolesType=\"input\"\n focused={focused}\n setFocused={setFocused}\n size={size ?? Size.Small}\n filter={''}\n isOpen={isOpen}\n setIsOpen={customSetIsOpen}\n messageOnNoResults={messageOnNoResults ?? ''}\n outline={keyboardNavigated}\n isButton={isButton || false}\n selectedValues={props.multiSelect ? props.value || [] : [props.value || '']}\n setSelectedValues={handleValueSelect}\n id={`${id}_dropdowncontent`}\n />\n )}\n </Dropdown>\n {activeValidationMessage && (\n <ErrorMessage>\n <TechnicalWarning color={COLORS.critical_400}/>\n <span>{activeValidationMessage}</span>\n </ErrorMessage>\n )}\n {autofilledMessage && (\n <AutofilledMessage>\n <Information color={COLORS.neutral_600}/>\n <span>{autofilledMessage}</span>\n </AutofilledMessage>\n )}\n </>\n );\n});\n\nexport default BasicDropdown;\n"],"mappings":";;;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAAQC,MAAM,QAAO,WAAW;AAChC,SAAQC,aAAa,EAAEC,WAAW,EAAEC,WAAW,EAAEC,gBAAgB,QAAO,kCAAkC;AAC1G,SAAQC,gBAAgB,QAAO,qBAAqB;AACpD,SAAQC,QAAQ,EAAEC,WAAW,EAAEC,UAAU,QAAO,iBAAiB;AACjE,OAAOC,eAAe,MAAsB,mBAAmB;AAC/D,SAAQC,iBAAiB,EAAEC,YAAY,QAAO,wBAAwB;AACtE,SAAQC,IAAI,QAAO,UAAU;AAC7B,SAAQC,yBAAyB,EAAEC,kBAAkB,EAAEC,kBAAkB,QAAO,WAAW;AAC3F,SAAQC,kBAAkB,QAAO,WAAW;AAAC;AAAA;AAAA;AAyC7C,IAAMC,aAAa,gBAAGlB,KAAK,CAACmB,UAAU,CAAC,UAACC,KAA0B,EAAEC,GAAG,EAAK;EAC1E,IACEC,EAAE,GA0BAF,KAAK,CA1BPE,EAAE;IACFC,IAAI,GAyBFH,KAAK,CAzBPG,IAAI;IACJC,WAAW,GAwBTJ,KAAK,CAxBPI,WAAW;IACXC,kBAAkB,GAuBhBL,KAAK,CAvBPK,kBAAkB;IAAA,mBAuBhBL,KAAK,CAtBPM,SAAS;IAATA,SAAS,iCAAG,QAAQ;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EAAG,UAAU,EAAG,OAAO;AAsQ7C,eAAe5B,aAAa"}
|
|
@@ -27,7 +27,7 @@ var lockedState = (0, _styledComponents.css)(_templateObject2 || (_templateObjec
|
|
|
27
27
|
var disabledState = (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", ";\n box-shadow: inset 0px 0px 0px 1px ", ";\n color: ", ";\n pointer-events: none;\n cursor: not-allowed;\n\n .dropdown-arrow {\n color: ", " !important;\n }\n\n input {\n color: ", " !important;\n\n ::placeholder {\n color: ", " !important;\n }\n }\n"])), _styles.COLORS.white, _styles.COLORS.neutral_100, _styles.COLORS.neutral_300, _styles.COLORS.neutral_300, _styles.COLORS.neutral_300, _styles.COLORS.neutral_300);
|
|
28
28
|
var activeValidationMessage = (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n box-shadow: inset 0px 0px 0px 2px ", ";\n"])), _styles.COLORS.critical_400);
|
|
29
29
|
var placeholderStyling = (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n"])), (0, _typography.ComponentMStyling)(_styles.ComponentTextStyle.Italic, _styles.COLORS.neutral_600));
|
|
30
|
-
var InputField = _styledComponents.default.input(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n border: none;\n outline: none;\n background-color: inherit;\n cursor: pointer;\n color: ", " !important;\n padding: 0;\n flex-grow: 1;\n display: flex;\n justify-content: center;\n\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"])), _styles.COLORS.black);
|
|
30
|
+
var InputField = _styledComponents.default.input(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n border: none;\n outline: none;\n background-color: inherit;\n cursor: pointer;\n color: ", " !important;\n padding: 0;\n flex-grow: 1;\n display: flex;\n justify-content: center;\n \n ::placeholder {\n color: ", ";\n font-style: italic;\n }\n\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"])), _styles.COLORS.black, _styles.COLORS.neutral_600);
|
|
31
31
|
exports.InputField = InputField;
|
|
32
32
|
var StyledField = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n\n padding: 12px 16px;\n height: 48px;\n min-width: ", ";\n width: 100%;\n\n background: ", ";\n box-shadow: inset 0px 0px 0px 1px ", ";\n box-sizing: border-box;\n border-radius: 4px;\n cursor: pointer;\n\n display: flex;\n align-items: center;\n gap: 4px;\n position: relative;\n\n input {\n font-size: inherit;\n line-height: inherit;\n color: inherit;\n }\n\n &::placeholder {\n ", "\n }\n\n ", " {\n ", "\n padding: 16px;\n height: 56px;\n\n &::placeholder {\n ", "\n }\n }\n\n &.small {\n ", "\n padding: 12px 16px;\n height: 48px;\n\n &::placeholder {\n ", "\n }\n }\n\n &.medium {\n ", "\n height: 56px;\n padding: 16px;\n\n &::placeholder {\n ", "\n }\n }\n\n .dropdown-arrow {\n pointer-events: none;\n width: 24px;\n height: 24px;\n color: ", ";\n }\n\n &:focus {\n outline: 3px solid #ddd;\n }\n\n &:focus-within,\n &.focus-visible-within {\n box-shadow: inset 0px 0px 0px 2px ", ";\n }\n\n &:hover:not(.action-within) {\n box-shadow: inset 0px 0px 0px 1px ", ";\n\n input {\n ::placeholder {\n color: ", ";\n }\n }\n\n .dropdown-arrow {\n color: ", ";\n }\n\n cursor: pointer;\n }\n\n &:active:not(.action-within) {\n box-shadow: inset 0px 0px 0px 1px ", ";\n\n input {\n ::placeholder {\n color: ", ";\n }\n }\n\n .dropdown-arrow {\n color: ", ";\n }\n }\n\n &.button {\n ", "\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: ", ";\n background: ", ";\n }\n }\n\n\n ", "\n ", "\n ", "\n ", "\n\n ", ";\n\n &.focus-visible,\n &.focus-visible-within {\n z-index: ", " !important;\n ", "\n }\n"])), (0, _typography.ComponentSStyling)(_styles.ComponentTextStyle.Regular, 'inherit'), function (props) {
|
|
33
33
|
return props.minWidth ? "".concat(props.minWidth) : '344px';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonStyling.cjs","names":["Dropdown","styled","div","props","isButton","minWidth","readOnly","disabled","margin","Z_INDEXES","focus","COLORS","primary_600","primary_800","lockedState","css","neutral_100","neutral_300","neutral_600","disabledState","white","activeValidationMessage","critical_400","placeholderStyling","ComponentMStyling","ComponentTextStyle","Italic","InputField","input","black","StyledField","ComponentSStyling","Regular","neutral_400","ComponentXXSStyling","BREAKPOINTS","MEDIUM","ComponentXSStyling","isPlaceholder","undefined","primary_200","primary_300","Bold","neutral_800","neutral_20","showValidationMessage","CommonInteractionStyling","dropdown","focusStyles","ButtonDropdownContentStyling","TextButtonDropdownContent","TextButtonDropdownIcon","TextButtonDropdownArrow","TextButtonDropdownText","TextButtonDropdownWrapper","primary_20","primary_700","primary_100"],"sources":["../../src/Dropdown/CommonStyling.tsx"],"sourcesContent":["import styled, {css} from 'styled-components';\nimport {CommonInteractionStyling} from '../common';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle, focusStyles} from '../styles';\nimport {\n ComponentMStyling,\n ComponentLStyling,\n ComponentSStyling,\n ComponentXSStyling,\n ComponentXXSStyling\n} from '../styles/typography';\nimport {Size} from '../types';\nimport {Z_INDEXES} from '../styles/z-indexes';\n\nexport const Dropdown = styled.div<{ isButton: boolean; readOnly?: boolean; disabled?: boolean; margin?: string; minWidth?: string }>`\n display: inline-block;\n\n ${(props) => !props.isButton && (props?.minWidth ? `width: 100%; min-width: ${props.minWidth};` : 'width: 100%; min-width: 344px;')}\n ${(props) => (props.readOnly || props.disabled ? 'cursor: not-allowed;' : '')}\n ${(props) => (props.margin ? `margin: ${props.margin};` : '')}\n .show {\n display: block;\n }\n\n .value {\n flex-grow: 1;\n }\n\n &:focus-within {\n z-index: ${Z_INDEXES.focus};\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\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\n input {\n color: ${COLORS.neutral_600} !important;\n }\n\n .dropdown-arrow {\n color: ${COLORS.neutral_300} !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\n .dropdown-arrow {\n color: ${COLORS.neutral_300} !important;\n }\n\n input {\n color: ${COLORS.neutral_300} !important;\n\n ::placeholder {\n color: ${COLORS.neutral_300} !important;\n }\n }\n`;\n\nconst activeValidationMessage = css`\n box-shadow: inset 0px 0px 0px 2px ${COLORS.critical_400};\n`;\n\nconst placeholderStyling = css`\n ${ComponentMStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n`;\n\nexport const InputField = styled.input`\n border: none;\n outline: none;\n background-color: inherit;\n cursor: pointer;\n color: ${COLORS.black} !important;\n padding: 0;\n flex-grow: 1;\n display: flex;\n justify-content: center;\n\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`;\n\nexport const StyledField = styled.div<{ disabled: boolean; readOnly: boolean; showValidationMessage?: boolean; isPlaceholder?: boolean; fontSize?: string; minWidth?: string }>`\n ${ComponentSStyling(ComponentTextStyle.Regular, 'inherit')}\n\n padding: 12px 16px;\n height: 48px;\n min-width: ${(props) => (props.minWidth ? `${props.minWidth}` : '344px')};\n width: 100%;\n\n background: ${COLORS.white};\n box-shadow: inset 0px 0px 0px 1px ${COLORS.neutral_400};\n box-sizing: border-box;\n border-radius: 4px;\n cursor: pointer;\n\n display: flex;\n align-items: center;\n gap: 4px;\n position: relative;\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\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\n &::placeholder {\n ${ComponentXXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n }\n\n &.medium {\n ${ComponentMStyling(ComponentTextStyle.Regular, 'inherit')}\n height: 56px;\n padding: 16px;\n\n &::placeholder {\n ${ComponentXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n }\n\n .dropdown-arrow {\n pointer-events: none;\n width: 24px;\n height: 24px;\n color: ${(props) => props.isPlaceholder ? COLORS.neutral_600 : undefined};\n }\n\n &:focus {\n outline: 3px solid #ddd;\n }\n\n &:focus-within,\n &.focus-visible-within {\n box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_800};\n }\n\n &:hover:not(.action-within) {\n box-shadow: inset 0px 0px 0px 1px ${COLORS.primary_200};\n\n input {\n ::placeholder {\n color: ${COLORS.primary_600};\n }\n }\n\n .dropdown-arrow {\n color: ${COLORS.primary_600};\n }\n\n cursor: pointer;\n }\n\n &:active:not(.action-within) {\n box-shadow: inset 0px 0px 0px 1px ${COLORS.primary_300};\n\n input {\n ::placeholder {\n color: ${COLORS.primary_800};\n }\n }\n\n .dropdown-arrow {\n color: ${COLORS.primary_800};\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\n ${(props) => (props.disabled ? disabledState : '')}\n ${(props) => (props.readOnly ? lockedState : '')}\n ${(props) => (props.showValidationMessage ? activeValidationMessage : '')}\n ${(props) => (props.isPlaceholder ? placeholderStyling : '')}\n\n ${CommonInteractionStyling};\n\n &.focus-visible,\n &.focus-visible-within {\n z-index: ${Z_INDEXES.dropdown + 1} !important;\n ${focusStyles}\n }\n`;\n\nexport const ButtonDropdownContentStyling = css`\n min-width: 344px;\n`;\n\n\n\nexport const TextButtonDropdownContent = styled.div`\n display: flex;\n gap: 4px;\n align-items: center;\n box-sizing: border-box;\n min-width: 64px;\n min-height: 32px;\n padding: 4px 8px;\n border-radius: 4px;\n`;\n\nexport const TextButtonDropdownIcon = styled.div`\n width: 24px;\n height: 24px;\n`;\n\nexport const TextButtonDropdownArrow = styled.div`\n width: 24px;\n height: 24px;\n\n svg {\n pointer-events: none;\n }\n`;\n\nexport const TextButtonDropdownText = styled.div`\n flex: 1\n`;\n\nexport const TextButtonDropdownWrapper = styled.div`\n box-sizing: border-box;\n min-height: 48px;\n display: flex;\n align-items: center;\n width: fit-content;\n cursor: pointer;\n\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n\n .expanded {\n color: ${COLORS.neutral_800};\n\n ${TextButtonDropdownContent} {\n background: ${COLORS.neutral_20};\n }\n }\n\n &:focus {\n ${focusStyles}\n }\n\n &:hover:not(.disabled) {\n ${TextButtonDropdownContent} {\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_700};\n }\n }\n\n &:active:not(.disabled) {\n ${TextButtonDropdownContent} {\n background-color: ${COLORS.primary_100};\n color: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U,EAC5B5C,cAAM,CAAC6C,WAAW,EAK3BN,yBAAyB,EACLvC,cAAM,CAAC8C,WAAW,EAC7B9C,cAAM,CAACE,WAAW,EAMpBF,cAAM,CAACM,WAAW,CAG7B;AAAC"}
|
|
1
|
+
{"version":3,"file":"CommonStyling.cjs","names":["Dropdown","styled","div","props","isButton","minWidth","readOnly","disabled","margin","Z_INDEXES","focus","COLORS","primary_600","primary_800","lockedState","css","neutral_100","neutral_300","neutral_600","disabledState","white","activeValidationMessage","critical_400","placeholderStyling","ComponentMStyling","ComponentTextStyle","Italic","InputField","input","black","StyledField","ComponentSStyling","Regular","neutral_400","ComponentXXSStyling","BREAKPOINTS","MEDIUM","ComponentXSStyling","isPlaceholder","undefined","primary_200","primary_300","Bold","neutral_800","neutral_20","showValidationMessage","CommonInteractionStyling","dropdown","focusStyles","ButtonDropdownContentStyling","TextButtonDropdownContent","TextButtonDropdownIcon","TextButtonDropdownArrow","TextButtonDropdownText","TextButtonDropdownWrapper","primary_20","primary_700","primary_100"],"sources":["../../src/Dropdown/CommonStyling.tsx"],"sourcesContent":["import styled, {css} from 'styled-components';\nimport {CommonInteractionStyling} from '../common';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle, focusStyles} from '../styles';\nimport {\n ComponentMStyling,\n ComponentLStyling,\n ComponentSStyling,\n ComponentXSStyling,\n ComponentXXSStyling\n} from '../styles/typography';\nimport {Size} from '../types';\nimport {Z_INDEXES} from '../styles/z-indexes';\n\nexport const Dropdown = styled.div<{ isButton: boolean; readOnly?: boolean; disabled?: boolean; margin?: string; minWidth?: string }>`\n display: inline-block;\n\n ${(props) => !props.isButton && (props?.minWidth ? `width: 100%; min-width: ${props.minWidth};` : 'width: 100%; min-width: 344px;')}\n ${(props) => (props.readOnly || props.disabled ? 'cursor: not-allowed;' : '')}\n ${(props) => (props.margin ? `margin: ${props.margin};` : '')}\n .show {\n display: block;\n }\n\n .value {\n flex-grow: 1;\n }\n\n &:focus-within {\n z-index: ${Z_INDEXES.focus};\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\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\n input {\n color: ${COLORS.neutral_600} !important;\n }\n\n .dropdown-arrow {\n color: ${COLORS.neutral_300} !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\n .dropdown-arrow {\n color: ${COLORS.neutral_300} !important;\n }\n\n input {\n color: ${COLORS.neutral_300} !important;\n\n ::placeholder {\n color: ${COLORS.neutral_300} !important;\n }\n }\n`;\n\nconst activeValidationMessage = css`\n box-shadow: inset 0px 0px 0px 2px ${COLORS.critical_400};\n`;\n\nconst placeholderStyling = css`\n ${ComponentMStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n`;\n\nexport const InputField = styled.input`\n border: none;\n outline: none;\n background-color: inherit;\n cursor: pointer;\n color: ${COLORS.black} !important;\n padding: 0;\n flex-grow: 1;\n display: flex;\n justify-content: center;\n \n ::placeholder {\n color: ${COLORS.neutral_600};\n font-style: italic;\n }\n\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`;\n\nexport const StyledField = styled.div<{ disabled: boolean; readOnly: boolean; showValidationMessage?: boolean; isPlaceholder?: boolean; fontSize?: string; minWidth?: string }>`\n ${ComponentSStyling(ComponentTextStyle.Regular, 'inherit')}\n\n padding: 12px 16px;\n height: 48px;\n min-width: ${(props) => (props.minWidth ? `${props.minWidth}` : '344px')};\n width: 100%;\n\n background: ${COLORS.white};\n box-shadow: inset 0px 0px 0px 1px ${COLORS.neutral_400};\n box-sizing: border-box;\n border-radius: 4px;\n cursor: pointer;\n\n display: flex;\n align-items: center;\n gap: 4px;\n position: relative;\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\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\n &::placeholder {\n ${ComponentXXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n }\n\n &.medium {\n ${ComponentMStyling(ComponentTextStyle.Regular, 'inherit')}\n height: 56px;\n padding: 16px;\n\n &::placeholder {\n ${ComponentXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n }\n\n .dropdown-arrow {\n pointer-events: none;\n width: 24px;\n height: 24px;\n color: ${(props) => props.isPlaceholder ? COLORS.neutral_600 : undefined};\n }\n\n &:focus {\n outline: 3px solid #ddd;\n }\n\n &:focus-within,\n &.focus-visible-within {\n box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_800};\n }\n\n &:hover:not(.action-within) {\n box-shadow: inset 0px 0px 0px 1px ${COLORS.primary_200};\n\n input {\n ::placeholder {\n color: ${COLORS.primary_600};\n }\n }\n\n .dropdown-arrow {\n color: ${COLORS.primary_600};\n }\n\n cursor: pointer;\n }\n\n &:active:not(.action-within) {\n box-shadow: inset 0px 0px 0px 1px ${COLORS.primary_300};\n\n input {\n ::placeholder {\n color: ${COLORS.primary_800};\n }\n }\n\n .dropdown-arrow {\n color: ${COLORS.primary_800};\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\n ${(props) => (props.disabled ? disabledState : '')}\n ${(props) => (props.readOnly ? lockedState : '')}\n ${(props) => (props.showValidationMessage ? activeValidationMessage : '')}\n ${(props) => (props.isPlaceholder ? placeholderStyling : '')}\n\n ${CommonInteractionStyling};\n\n &.focus-visible,\n &.focus-visible-within {\n z-index: ${Z_INDEXES.dropdown + 1} !important;\n ${focusStyles}\n }\n`;\n\nexport const ButtonDropdownContentStyling = css`\n min-width: 344px;\n`;\n\n\n\nexport const TextButtonDropdownContent = styled.div`\n display: flex;\n gap: 4px;\n align-items: center;\n box-sizing: border-box;\n min-width: 64px;\n min-height: 32px;\n padding: 4px 8px;\n border-radius: 4px;\n`;\n\nexport const TextButtonDropdownIcon = styled.div`\n width: 24px;\n height: 24px;\n`;\n\nexport const TextButtonDropdownArrow = styled.div`\n width: 24px;\n height: 24px;\n\n svg {\n pointer-events: none;\n }\n`;\n\nexport const TextButtonDropdownText = styled.div`\n flex: 1\n`;\n\nexport const TextButtonDropdownWrapper = styled.div`\n box-sizing: border-box;\n min-height: 48px;\n display: flex;\n align-items: center;\n width: fit-content;\n cursor: pointer;\n\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n\n .expanded {\n color: ${COLORS.neutral_800};\n\n ${TextButtonDropdownContent} {\n background: ${COLORS.neutral_20};\n }\n }\n\n &:focus {\n ${focusStyles}\n }\n\n &:hover:not(.disabled) {\n ${TextButtonDropdownContent} {\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_700};\n }\n }\n\n &:active:not(.disabled) {\n ${TextButtonDropdownContent} {\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n }\n }\n\n &.disabled {\n cursor: not-allowed;\n color: ${COLORS.neutral_300};\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BAAyB,EACLvC,cAAM,CAAC8C,WAAW,EAC7B9C,cAAM,CAACE,WAAW,EAMpBF,cAAM,CAACM,WAAW,CAG7B;AAAC"}
|
|
@@ -16,7 +16,7 @@ var lockedState = css(_templateObject2 || (_templateObject2 = _taggedTemplateLit
|
|
|
16
16
|
var disabledState = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background-color: ", ";\n box-shadow: inset 0px 0px 0px 1px ", ";\n color: ", ";\n pointer-events: none;\n cursor: not-allowed;\n\n .dropdown-arrow {\n color: ", " !important;\n }\n\n input {\n color: ", " !important;\n\n ::placeholder {\n color: ", " !important;\n }\n }\n"])), COLORS.white, COLORS.neutral_100, COLORS.neutral_300, COLORS.neutral_300, COLORS.neutral_300, COLORS.neutral_300);
|
|
17
17
|
var activeValidationMessage = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n box-shadow: inset 0px 0px 0px 2px ", ";\n"])), COLORS.critical_400);
|
|
18
18
|
var placeholderStyling = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n ", "\n"])), ComponentMStyling(ComponentTextStyle.Italic, COLORS.neutral_600));
|
|
19
|
-
export var InputField = styled.input(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n border: none;\n outline: none;\n background-color: inherit;\n cursor: pointer;\n color: ", " !important;\n padding: 0;\n flex-grow: 1;\n display: flex;\n justify-content: center;\n\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"])), COLORS.black);
|
|
19
|
+
export var InputField = styled.input(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n border: none;\n outline: none;\n background-color: inherit;\n cursor: pointer;\n color: ", " !important;\n padding: 0;\n flex-grow: 1;\n display: flex;\n justify-content: center;\n \n ::placeholder {\n color: ", ";\n font-style: italic;\n }\n\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"])), COLORS.black, COLORS.neutral_600);
|
|
20
20
|
export var StyledField = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n ", "\n\n padding: 12px 16px;\n height: 48px;\n min-width: ", ";\n width: 100%;\n\n background: ", ";\n box-shadow: inset 0px 0px 0px 1px ", ";\n box-sizing: border-box;\n border-radius: 4px;\n cursor: pointer;\n\n display: flex;\n align-items: center;\n gap: 4px;\n position: relative;\n\n input {\n font-size: inherit;\n line-height: inherit;\n color: inherit;\n }\n\n &::placeholder {\n ", "\n }\n\n ", " {\n ", "\n padding: 16px;\n height: 56px;\n\n &::placeholder {\n ", "\n }\n }\n\n &.small {\n ", "\n padding: 12px 16px;\n height: 48px;\n\n &::placeholder {\n ", "\n }\n }\n\n &.medium {\n ", "\n height: 56px;\n padding: 16px;\n\n &::placeholder {\n ", "\n }\n }\n\n .dropdown-arrow {\n pointer-events: none;\n width: 24px;\n height: 24px;\n color: ", ";\n }\n\n &:focus {\n outline: 3px solid #ddd;\n }\n\n &:focus-within,\n &.focus-visible-within {\n box-shadow: inset 0px 0px 0px 2px ", ";\n }\n\n &:hover:not(.action-within) {\n box-shadow: inset 0px 0px 0px 1px ", ";\n\n input {\n ::placeholder {\n color: ", ";\n }\n }\n\n .dropdown-arrow {\n color: ", ";\n }\n\n cursor: pointer;\n }\n\n &:active:not(.action-within) {\n box-shadow: inset 0px 0px 0px 1px ", ";\n\n input {\n ::placeholder {\n color: ", ";\n }\n }\n\n .dropdown-arrow {\n color: ", ";\n }\n }\n\n &.button {\n ", "\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: ", ";\n background: ", ";\n }\n }\n\n\n ", "\n ", "\n ", "\n ", "\n\n ", ";\n\n &.focus-visible,\n &.focus-visible-within {\n z-index: ", " !important;\n ", "\n }\n"])), ComponentSStyling(ComponentTextStyle.Regular, 'inherit'), function (props) {
|
|
21
21
|
return props.minWidth ? "".concat(props.minWidth) : '344px';
|
|
22
22
|
}, COLORS.white, COLORS.neutral_400, ComponentXXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600), BREAKPOINTS.MEDIUM, ComponentMStyling(ComponentTextStyle.Regular, 'inherit'), ComponentXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600), ComponentSStyling(ComponentTextStyle.Regular, 'inherit'), ComponentXXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600), ComponentMStyling(ComponentTextStyle.Regular, 'inherit'), ComponentXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600), function (props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonStyling.js","names":["styled","css","CommonInteractionStyling","BREAKPOINTS","COLORS","ComponentTextStyle","focusStyles","ComponentMStyling","ComponentSStyling","ComponentXSStyling","ComponentXXSStyling","Z_INDEXES","Dropdown","div","props","isButton","minWidth","readOnly","disabled","margin","focus","primary_600","primary_800","lockedState","neutral_100","neutral_300","neutral_600","disabledState","white","activeValidationMessage","critical_400","placeholderStyling","Italic","InputField","input","black","StyledField","Regular","neutral_400","MEDIUM","isPlaceholder","undefined","primary_200","primary_300","Bold","neutral_800","neutral_20","showValidationMessage","dropdown","ButtonDropdownContentStyling","TextButtonDropdownContent","TextButtonDropdownIcon","TextButtonDropdownArrow","TextButtonDropdownText","TextButtonDropdownWrapper","primary_20","primary_700","primary_100"],"sources":["../../src/Dropdown/CommonStyling.tsx"],"sourcesContent":["import styled, {css} from 'styled-components';\nimport {CommonInteractionStyling} from '../common';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle, focusStyles} from '../styles';\nimport {\n ComponentMStyling,\n ComponentLStyling,\n ComponentSStyling,\n ComponentXSStyling,\n ComponentXXSStyling\n} from '../styles/typography';\nimport {Size} from '../types';\nimport {Z_INDEXES} from '../styles/z-indexes';\n\nexport const Dropdown = styled.div<{ isButton: boolean; readOnly?: boolean; disabled?: boolean; margin?: string; minWidth?: string }>`\n display: inline-block;\n\n ${(props) => !props.isButton && (props?.minWidth ? `width: 100%; min-width: ${props.minWidth};` : 'width: 100%; min-width: 344px;')}\n ${(props) => (props.readOnly || props.disabled ? 'cursor: not-allowed;' : '')}\n ${(props) => (props.margin ? `margin: ${props.margin};` : '')}\n .show {\n display: block;\n }\n\n .value {\n flex-grow: 1;\n }\n\n &:focus-within {\n z-index: ${Z_INDEXES.focus};\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\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\n input {\n color: ${COLORS.neutral_600} !important;\n }\n\n .dropdown-arrow {\n color: ${COLORS.neutral_300} !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\n .dropdown-arrow {\n color: ${COLORS.neutral_300} !important;\n }\n\n input {\n color: ${COLORS.neutral_300} !important;\n\n ::placeholder {\n color: ${COLORS.neutral_300} !important;\n }\n }\n`;\n\nconst activeValidationMessage = css`\n box-shadow: inset 0px 0px 0px 2px ${COLORS.critical_400};\n`;\n\nconst placeholderStyling = css`\n ${ComponentMStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n`;\n\nexport const InputField = styled.input`\n border: none;\n outline: none;\n background-color: inherit;\n cursor: pointer;\n color: ${COLORS.black} !important;\n padding: 0;\n flex-grow: 1;\n display: flex;\n justify-content: center;\n\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`;\n\nexport const StyledField = styled.div<{ disabled: boolean; readOnly: boolean; showValidationMessage?: boolean; isPlaceholder?: boolean; fontSize?: string; minWidth?: string }>`\n ${ComponentSStyling(ComponentTextStyle.Regular, 'inherit')}\n\n padding: 12px 16px;\n height: 48px;\n min-width: ${(props) => (props.minWidth ? `${props.minWidth}` : '344px')};\n width: 100%;\n\n background: ${COLORS.white};\n box-shadow: inset 0px 0px 0px 1px ${COLORS.neutral_400};\n box-sizing: border-box;\n border-radius: 4px;\n cursor: pointer;\n\n display: flex;\n align-items: center;\n gap: 4px;\n position: relative;\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\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\n &::placeholder {\n ${ComponentXXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n }\n\n &.medium {\n ${ComponentMStyling(ComponentTextStyle.Regular, 'inherit')}\n height: 56px;\n padding: 16px;\n\n &::placeholder {\n ${ComponentXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n }\n\n .dropdown-arrow {\n pointer-events: none;\n width: 24px;\n height: 24px;\n color: ${(props) => props.isPlaceholder ? COLORS.neutral_600 : undefined};\n }\n\n &:focus {\n outline: 3px solid #ddd;\n }\n\n &:focus-within,\n &.focus-visible-within {\n box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_800};\n }\n\n &:hover:not(.action-within) {\n box-shadow: inset 0px 0px 0px 1px ${COLORS.primary_200};\n\n input {\n ::placeholder {\n color: ${COLORS.primary_600};\n }\n }\n\n .dropdown-arrow {\n color: ${COLORS.primary_600};\n }\n\n cursor: pointer;\n }\n\n &:active:not(.action-within) {\n box-shadow: inset 0px 0px 0px 1px ${COLORS.primary_300};\n\n input {\n ::placeholder {\n color: ${COLORS.primary_800};\n }\n }\n\n .dropdown-arrow {\n color: ${COLORS.primary_800};\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\n ${(props) => (props.disabled ? disabledState : '')}\n ${(props) => (props.readOnly ? lockedState : '')}\n ${(props) => (props.showValidationMessage ? activeValidationMessage : '')}\n ${(props) => (props.isPlaceholder ? placeholderStyling : '')}\n\n ${CommonInteractionStyling};\n\n &.focus-visible,\n &.focus-visible-within {\n z-index: ${Z_INDEXES.dropdown + 1} !important;\n ${focusStyles}\n }\n`;\n\nexport const ButtonDropdownContentStyling = css`\n min-width: 344px;\n`;\n\n\n\nexport const TextButtonDropdownContent = styled.div`\n display: flex;\n gap: 4px;\n align-items: center;\n box-sizing: border-box;\n min-width: 64px;\n min-height: 32px;\n padding: 4px 8px;\n border-radius: 4px;\n`;\n\nexport const TextButtonDropdownIcon = styled.div`\n width: 24px;\n height: 24px;\n`;\n\nexport const TextButtonDropdownArrow = styled.div`\n width: 24px;\n height: 24px;\n\n svg {\n pointer-events: none;\n }\n`;\n\nexport const TextButtonDropdownText = styled.div`\n flex: 1\n`;\n\nexport const TextButtonDropdownWrapper = styled.div`\n box-sizing: border-box;\n min-height: 48px;\n display: flex;\n align-items: center;\n width: fit-content;\n cursor: pointer;\n\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n\n .expanded {\n color: ${COLORS.neutral_800};\n\n ${TextButtonDropdownContent} {\n background: ${COLORS.neutral_20};\n }\n }\n\n &:focus {\n ${focusStyles}\n }\n\n &:hover:not(.disabled) {\n ${TextButtonDropdownContent} {\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_700};\n }\n }\n\n &:active:not(.disabled) {\n ${TextButtonDropdownContent} {\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n }\n }\n\n &.disabled {\n cursor: not-allowed;\n color: ${COLORS.neutral_300};\n }\n\n}`;\n"],"mappings":";;AAAA,OAAOA,MAAM,IAAGC,GAAG,QAAO,mBAAmB;AAC7C,SAAQC,wBAAwB,QAAO,WAAW;AAClD,SAAQC,WAAW,EAAEC,MAAM,EAAEC,kBAAkB,EAAEC,WAAW,QAAO,WAAW;AAC9E,SACEC,iBAAiB,EAEjBC,iBAAiB,EACjBC,kBAAkB,EAClBC,mBAAmB,QACd,sBAAsB;AAE7B,SAAQC,SAAS,QAAO,qBAAqB;AAE7C,OAAO,IAAMC,QAAQ,GAAGZ,MAAM,CAACa,GAAG,2VAG9B,UAACC,KAAK;EAAA,OAAK,CAACA,KAAK,CAACC,QAAQ,KAAKD,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEE,QAAQ,qCAA8BF,KAAK,CAACE,QAAQ,SAAM,gCAAgC,CAAC;AAAA,GACjI,UAACF,KAAK;EAAA,OAAMA,KAAK,CAACG,QAAQ,IAAIH,KAAK,CAACI,QAAQ,GAAG,sBAAsB,GAAG,EAAE;AAAA,CAAC,EAC3E,UAACJ,KAAK;EAAA,OAAMA,KAAK,CAACK,MAAM,qBAAcL,KAAK,CAACK,MAAM,SAAM,EAAE;AAAA,CAAC,EAUhDR,SAAS,CAACS,KAAK,EAIjBhB,MAAM,CAACiB,WAAW,EAIlBjB,MAAM,CAACkB,WAAW,CAI9B;AAED,IAAMC,WAAW,GAAGtB,GAAG,yTACDG,MAAM,CAACoB,WAAW,EACFpB,MAAM,CAACqB,WAAW,EAC7CrB,MAAM,CAACsB,WAAW,EAKhBtB,MAAM,CAACsB,WAAW,EAIlBtB,MAAM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;AAED,OAAO,IAAMuC,uBAAuB,GAAGpD,MAAM,CAACa,GAAG,uJAOhD;AAED,OAAO,IAAMwC,sBAAsB,GAAGrD,MAAM,CAACa,GAAG,sFAE/C;AAED,OAAO,IAAMyC,yBAAyB,GAAGtD,MAAM,CAACa,GAAG,wmBAQ/CL,iBAAiB,CAACH,kBAAkB,CAACuC,IAAI,EAAExC,MAAM,CAACsB,WAAW,CAAC,EAGrDtB,MAAM,CAACyC,WAAW,EAEzBK,yBAAyB,EACX9C,MAAM,CAAC0C,UAAU,EAK/BxC,WAAW,EAIX4C,yBAAyB,EACL9C,MAAM,CAACmD,UAAU,EAC5BnD,MAAM,CAACoD,WAAW,EAK3BN,yBAAyB,EACL9C,MAAM,CAACqD,WAAW,EAC7BrD,MAAM,CAACkB,WAAW,EAMpBlB,MAAM,CAACqB,WAAW,CAG7B"}
|
|
1
|
+
{"version":3,"file":"CommonStyling.js","names":["styled","css","CommonInteractionStyling","BREAKPOINTS","COLORS","ComponentTextStyle","focusStyles","ComponentMStyling","ComponentSStyling","ComponentXSStyling","ComponentXXSStyling","Z_INDEXES","Dropdown","div","props","isButton","minWidth","readOnly","disabled","margin","focus","primary_600","primary_800","lockedState","neutral_100","neutral_300","neutral_600","disabledState","white","activeValidationMessage","critical_400","placeholderStyling","Italic","InputField","input","black","StyledField","Regular","neutral_400","MEDIUM","isPlaceholder","undefined","primary_200","primary_300","Bold","neutral_800","neutral_20","showValidationMessage","dropdown","ButtonDropdownContentStyling","TextButtonDropdownContent","TextButtonDropdownIcon","TextButtonDropdownArrow","TextButtonDropdownText","TextButtonDropdownWrapper","primary_20","primary_700","primary_100"],"sources":["../../src/Dropdown/CommonStyling.tsx"],"sourcesContent":["import styled, {css} from 'styled-components';\nimport {CommonInteractionStyling} from '../common';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle, focusStyles} from '../styles';\nimport {\n ComponentMStyling,\n ComponentLStyling,\n ComponentSStyling,\n ComponentXSStyling,\n ComponentXXSStyling\n} from '../styles/typography';\nimport {Size} from '../types';\nimport {Z_INDEXES} from '../styles/z-indexes';\n\nexport const Dropdown = styled.div<{ isButton: boolean; readOnly?: boolean; disabled?: boolean; margin?: string; minWidth?: string }>`\n display: inline-block;\n\n ${(props) => !props.isButton && (props?.minWidth ? `width: 100%; min-width: ${props.minWidth};` : 'width: 100%; min-width: 344px;')}\n ${(props) => (props.readOnly || props.disabled ? 'cursor: not-allowed;' : '')}\n ${(props) => (props.margin ? `margin: ${props.margin};` : '')}\n .show {\n display: block;\n }\n\n .value {\n flex-grow: 1;\n }\n\n &:focus-within {\n z-index: ${Z_INDEXES.focus};\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\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\n input {\n color: ${COLORS.neutral_600} !important;\n }\n\n .dropdown-arrow {\n color: ${COLORS.neutral_300} !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\n .dropdown-arrow {\n color: ${COLORS.neutral_300} !important;\n }\n\n input {\n color: ${COLORS.neutral_300} !important;\n\n ::placeholder {\n color: ${COLORS.neutral_300} !important;\n }\n }\n`;\n\nconst activeValidationMessage = css`\n box-shadow: inset 0px 0px 0px 2px ${COLORS.critical_400};\n`;\n\nconst placeholderStyling = css`\n ${ComponentMStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n`;\n\nexport const InputField = styled.input`\n border: none;\n outline: none;\n background-color: inherit;\n cursor: pointer;\n color: ${COLORS.black} !important;\n padding: 0;\n flex-grow: 1;\n display: flex;\n justify-content: center;\n \n ::placeholder {\n color: ${COLORS.neutral_600};\n font-style: italic;\n }\n\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`;\n\nexport const StyledField = styled.div<{ disabled: boolean; readOnly: boolean; showValidationMessage?: boolean; isPlaceholder?: boolean; fontSize?: string; minWidth?: string }>`\n ${ComponentSStyling(ComponentTextStyle.Regular, 'inherit')}\n\n padding: 12px 16px;\n height: 48px;\n min-width: ${(props) => (props.minWidth ? `${props.minWidth}` : '344px')};\n width: 100%;\n\n background: ${COLORS.white};\n box-shadow: inset 0px 0px 0px 1px ${COLORS.neutral_400};\n box-sizing: border-box;\n border-radius: 4px;\n cursor: pointer;\n\n display: flex;\n align-items: center;\n gap: 4px;\n position: relative;\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\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\n &::placeholder {\n ${ComponentXXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n }\n\n &.medium {\n ${ComponentMStyling(ComponentTextStyle.Regular, 'inherit')}\n height: 56px;\n padding: 16px;\n\n &::placeholder {\n ${ComponentXSStyling(ComponentTextStyle.Italic, COLORS.neutral_600)}\n }\n }\n\n .dropdown-arrow {\n pointer-events: none;\n width: 24px;\n height: 24px;\n color: ${(props) => props.isPlaceholder ? COLORS.neutral_600 : undefined};\n }\n\n &:focus {\n outline: 3px solid #ddd;\n }\n\n &:focus-within,\n &.focus-visible-within {\n box-shadow: inset 0px 0px 0px 2px ${COLORS.primary_800};\n }\n\n &:hover:not(.action-within) {\n box-shadow: inset 0px 0px 0px 1px ${COLORS.primary_200};\n\n input {\n ::placeholder {\n color: ${COLORS.primary_600};\n }\n }\n\n .dropdown-arrow {\n color: ${COLORS.primary_600};\n }\n\n cursor: pointer;\n }\n\n &:active:not(.action-within) {\n box-shadow: inset 0px 0px 0px 1px ${COLORS.primary_300};\n\n input {\n ::placeholder {\n color: ${COLORS.primary_800};\n }\n }\n\n .dropdown-arrow {\n color: ${COLORS.primary_800};\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\n ${(props) => (props.disabled ? disabledState : '')}\n ${(props) => (props.readOnly ? lockedState : '')}\n ${(props) => (props.showValidationMessage ? activeValidationMessage : '')}\n ${(props) => (props.isPlaceholder ? placeholderStyling : '')}\n\n ${CommonInteractionStyling};\n\n &.focus-visible,\n &.focus-visible-within {\n z-index: ${Z_INDEXES.dropdown + 1} !important;\n ${focusStyles}\n }\n`;\n\nexport const ButtonDropdownContentStyling = css`\n min-width: 344px;\n`;\n\n\n\nexport const TextButtonDropdownContent = styled.div`\n display: flex;\n gap: 4px;\n align-items: center;\n box-sizing: border-box;\n min-width: 64px;\n min-height: 32px;\n padding: 4px 8px;\n border-radius: 4px;\n`;\n\nexport const TextButtonDropdownIcon = styled.div`\n width: 24px;\n height: 24px;\n`;\n\nexport const TextButtonDropdownArrow = styled.div`\n width: 24px;\n height: 24px;\n\n svg {\n pointer-events: none;\n }\n`;\n\nexport const TextButtonDropdownText = styled.div`\n flex: 1\n`;\n\nexport const TextButtonDropdownWrapper = styled.div`\n box-sizing: border-box;\n min-height: 48px;\n display: flex;\n align-items: center;\n width: fit-content;\n cursor: pointer;\n\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n\n .expanded {\n color: ${COLORS.neutral_800};\n\n ${TextButtonDropdownContent} {\n background: ${COLORS.neutral_20};\n }\n }\n\n &:focus {\n ${focusStyles}\n }\n\n &:hover:not(.disabled) {\n ${TextButtonDropdownContent} {\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_700};\n }\n }\n\n &:active:not(.disabled) {\n ${TextButtonDropdownContent} {\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_800};\n }\n }\n\n &.disabled {\n cursor: not-allowed;\n color: ${COLORS.neutral_300};\n }\n\n}`;\n"],"mappings":";;AAAA,OAAOA,MAAM,IAAGC,GAAG,QAAO,mBAAmB;AAC7C,SAAQC,wBAAwB,QAAO,WAAW;AAClD,SAAQC,WAAW,EAAEC,MAAM,EAAEC,kBAAkB,EAAEC,WAAW,QAAO,WAAW;AAC9E,SACEC,iBAAiB,EAEjBC,iBAAiB,EACjBC,kBAAkB,EAClBC,mBAAmB,QACd,sBAAsB;AAE7B,SAAQC,SAAS,QAAO,qBAAqB;AAE7C,OAAO,IAAMC,QAAQ,GAAGZ,MAAM,CAACa,GAAG,2VAG9B,UAACC,KAAK;EAAA,OAAK,CAACA,KAAK,CAACC,QAAQ,KAAKD,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEE,QAAQ,qCAA8BF,KAAK,CAACE,QAAQ,SAAM,gCAAgC,CAAC;AAAA,GACjI,UAACF,KAAK;EAAA,OAAMA,KAAK,CAACG,QAAQ,IAAIH,KAAK,CAACI,QAAQ,GAAG,sBAAsB,GAAG,EAAE;AAAA,CAAC,EAC3E,UAACJ,KAAK;EAAA,OAAMA,KAAK,CAACK,MAAM,qBAAcL,KAAK,CAACK,MAAM,SAAM,EAAE;AAAA,CAAC,EAUhDR,SAAS,CAACS,KAAK,EAIjBhB,MAAM,CAACiB,WAAW,EAIlBjB,MAAM,CAACkB,WAAW,CAI9B;AAED,IAAMC,WAAW,GAAG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,IAAM2C,4BAA4B,GAAGhD,GAAG,8FAE9C;AAID,OAAO,IAAMiD,yBAAyB,GAAGlD,MAAM,CAACa,GAAG,gPASlD;AAED,OAAO,IAAMsC,sBAAsB,GAAGnD,MAAM,CAACa,GAAG,4GAG/C;AAED,OAAO,IAAMuC,uBAAuB,GAAGpD,MAAM,CAACa,GAAG,uJAOhD;AAED,OAAO,IAAMwC,sBAAsB,GAAGrD,MAAM,CAACa,GAAG,sFAE/C;AAED,OAAO,IAAMyC,yBAAyB,GAAGtD,MAAM,CAACa,GAAG,wmBAQ/CL,iBAAiB,CAACH,kBAAkB,CAACuC,IAAI,EAAExC,MAAM,CAACsB,WAAW,CAAC,EAGrDtB,MAAM,CAACyC,WAAW,EAEzBK,yBAAyB,EACX9C,MAAM,CAAC0C,UAAU,EAK/BxC,WAAW,EAIX4C,yBAAyB,EACL9C,MAAM,CAACmD,UAAU,EAC5BnD,MAAM,CAACoD,WAAW,EAK3BN,yBAAyB,EACL9C,MAAM,CAACqD,WAAW,EAC7BrD,MAAM,CAACkB,WAAW,EAMpBlB,MAAM,CAACqB,WAAW,CAG7B"}
|
|
@@ -22,13 +22,13 @@ export interface DropdownButtonBaseProps {
|
|
|
22
22
|
width?: string;
|
|
23
23
|
alignLeft?: boolean;
|
|
24
24
|
}
|
|
25
|
-
export
|
|
25
|
+
export type IconDropdownButtonProps = DropdownButtonBaseProps & {
|
|
26
26
|
type: 'icon';
|
|
27
27
|
icon: React.ReactNode;
|
|
28
28
|
};
|
|
29
|
-
export
|
|
29
|
+
export type TextDropdownButtonProps = DropdownButtonBaseProps & {
|
|
30
30
|
type: 'text';
|
|
31
31
|
label?: string;
|
|
32
32
|
keepLabel?: boolean;
|
|
33
33
|
};
|
|
34
|
-
export
|
|
34
|
+
export type DropdownButtonProps = IconDropdownButtonProps | TextDropdownButtonProps;
|
|
@@ -36,7 +36,7 @@ var HeaderWrapper = _styledComponents.default.header(_templateObject || (_templa
|
|
|
36
36
|
var RowLayout = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n"])));
|
|
37
37
|
var HamburgerButton = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n ", " button {\n height: 56px;\n }\n\n ", " {\n display: none;\n }\n"])), _styles.BREAKPOINTS.SMALL, _styles.BREAKPOINTS.LARGE);
|
|
38
38
|
var RightSide = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n\n ", " {\n margin: 0 0 0 auto;\n }\n\n &.reverse {\n ", " {\n order: -1;\n }\n\n flex-direction: row-reverse;\n }\n"])), _styles.BREAKPOINTS.XSMALL, HamburgerButton);
|
|
39
|
-
var MobileMenuBackdrop = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n position: fixed;\n left: 0;\n top: 0;\n
|
|
39
|
+
var MobileMenuBackdrop = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n position: fixed;\n left: 0;\n top: 0;\n height: 100%;\n width: 100%;\n overflow: hidden;\n z-index: ", ";\n visibility: hidden;\n\n &.open {\n visibility: visible;\n animation: ", " 0.3s ease-in-out;\n }\n\n &.closed {\n visibility: hidden;\n animation: ", " 0.3s ease-in-out;\n }\n\n ", " {\n visibility: hidden !important;\n }\n"])), _styles.Z_INDEXES.backdrop, _CommonStyles.fadeIn, _CommonStyles.fadeOut, _styles.BREAKPOINTS.LARGE);
|
|
40
40
|
var UserMenuWrapper = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", ";\n display: flex;\n position: absolute;\n\n ", " {\n top: 56px;\n right: ", ";\n }\n"])), _styles.COLORS.white, _styles.BREAKPOINTS.LARGE, function (props) {
|
|
41
41
|
return props.offsetRight && (0, _utils.hasWindow)() ? "".concat(window.innerWidth - props.offsetRight + 296, "px") : '10%';
|
|
42
42
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalNavigationBar.cjs","names":["HeaderWrapper","styled","header","COLORS","neutral_200","Z_INDEXES","sticky_menu","BREAKPOINTS","SMALL","LARGE","RowLayout","div","HamburgerButton","RightSide","XSMALL","MobileMenuBackdrop","backdrop","fadeIn","fadeOut","UserMenuWrapper","white","props","offsetRight","hasWindow","window","innerWidth","GlobalNavigationBar","name","isAuthenticated","logo","profile","mobile","desktop","testId","useMaxWidth","maxWidth","React","useState","showMobileMenu","setShowMobileMenu","wasMobileMenuOpen","usePreviousImmediate","showUserMenu","setShowUserMenu","actionsRef","useRef","profileButtonRef","current","buttons","find","a","type","ref","mobileMenuButtonRef","rightSideRef","avatarRight","setAvatarRight","userMenuRef","useClickOutsideRef","mobileMenuRef","useEffect","handleResize","profileRightOffset","getBoundingClientRect","right","addEventListener","removeEventListener","showBetaTag","onClick","to","items","filter","pinned","reverseRightSideOrder","action","user","some"],"sources":["../../src/GlobalNavigationBar/GlobalNavigationBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\n\nimport Logo from './Logo';\nimport MainMenu from './desktop/MainMenu';\nimport {PageWidth} from '../Layouts';\nimport {COLORS, BREAKPOINTS} from '../styles';\nimport RightSideNav from './desktop/RightSideNav';\nimport MobileMenu from './mobile/MobileMenu';\nimport {Menu} from '../icons/systemicons/SystemIcons';\nimport UserMenu from './desktop/UserMenu';\nimport {fadeIn, fadeOut, Menu as MobileMenuWrapper} from './mobile/CommonStyles';\nimport {Z_INDEXES} from '../styles';\nimport {\n DesktopNavigationMenuProps, MenuProfileButton,\n MobileNavigationMenuProps,\n ProfileMenu\n} from './types';\nimport {IconButton} from '../Button';\nimport DesktopActions, {DesktopActionsRef} from './desktop/DesktopActions';\nimport {usePreviousImmediate} from 'rooks';\nimport {useClickOutsideRef} from '../common';\nimport { hasWindow } from '../utils/utils';\n\nconst HeaderWrapper = styled.header`\n background: white;\n box-sizing: border-box;\n border-bottom: 1px solid ${COLORS.neutral_200};\n\n z-index: ${Z_INDEXES.sticky_menu};\n position: relative;\n\n height: 48px;\n\n ${BREAKPOINTS.SMALL} {\n height: 56px;\n }\n\n ${BREAKPOINTS.LARGE} {\n height: 64px;\n }\n\n @media all and (-ms-high-contrast: none) {\n height: auto;\n }\n\n @media print {\n border-bottom: none;\n }\n`;\n\nconst RowLayout = styled.div`\n display: flex;\n align-items: center;\n`;\n\n\nconst HamburgerButton = styled.div`\n ${BREAKPOINTS.SMALL} button {\n height: 56px;\n }\n\n ${BREAKPOINTS.LARGE} {\n display: none;\n }\n`;\n\nconst RightSide = styled.div`\n display: flex;\n align-items: center;\n\n ${BREAKPOINTS.XSMALL} {\n margin: 0 0 0 auto;\n }\n\n &.reverse {\n ${HamburgerButton} {\n order: -1;\n }\n\n flex-direction: row-reverse;\n }\n`;\n\nconst MobileMenuBackdrop = styled.div`\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n position: fixed;\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n height: 100vh;\n width: 100vw;\n overflow: hidden;\n z-index: ${Z_INDEXES.backdrop};\n visibility: hidden;\n\n\n &.open {\n visibility: visible;\n animation: ${fadeIn} 0.3s ease-in-out;\n }\n\n &.closed {\n visibility: hidden;\n animation: ${fadeOut} 0.3s ease-in-out;\n }\n\n ${BREAKPOINTS.LARGE} {\n visibility: hidden !important;\n }\n`;\n\nconst UserMenuWrapper = styled.div<{ offsetRight?: number }>`\n background-color: ${COLORS.white};\n display: flex;\n position: absolute;\n\n ${BREAKPOINTS.LARGE} {\n top: 56px;\n right: ${(props) => (props.offsetRight && hasWindow() ? `${window.innerWidth - props.offsetRight + 296}px` : '10%')};\n }\n`;\n\n\ntype GlobalNavigationBarProps = {\n isAuthenticated?: boolean;\n useMaxWidth?: boolean;\n maxWidth?: number;\n\n name?: string;\n logo?: { onClick?: () => void; to?: string; showBetaTag?: boolean; };\n\n profile?: ProfileMenu;\n\n mobile?: MobileNavigationMenuProps;\n desktop?: DesktopNavigationMenuProps;\n\n testId?: string;\n};\n\n/**\n * @param props\n * @constructor\n * @description This component is a global navigation header bar\n */\nconst GlobalNavigationBar = ({\n name,\n isAuthenticated,\n logo,\n profile,\n mobile,\n desktop,\n testId,\n useMaxWidth = true,\n maxWidth,\n }: GlobalNavigationBarProps): React.ReactElement<GlobalNavigationBarProps> => {\n const [showMobileMenu, setShowMobileMenu] = React.useState(false);\n const wasMobileMenuOpen = usePreviousImmediate(showMobileMenu);\n\n const [showUserMenu, setShowUserMenu] = React.useState(false);\n\n const actionsRef = React.useRef<DesktopActionsRef>(null);\n const profileButtonRef = React.useRef<HTMLButtonElement | null>() as React.MutableRefObject<HTMLButtonElement | null | undefined>;\n profileButtonRef.current = actionsRef?.current?.buttons?.find(a => a.type === 'profile')?.ref?.current;\n\n const mobileMenuButtonRef = React.useRef<HTMLButtonElement>(null);\n\n const rightSideRef = React.useRef(null);\n const [avatarRight, setAvatarRight] = React.useState<number>(0);\n\n\n const userMenuRef = useClickOutsideRef(() => setShowUserMenu(false), [profileButtonRef]);\n const mobileMenuRef = useClickOutsideRef(() => setShowMobileMenu(false), [mobileMenuButtonRef]);\n\n React.useEffect(() => {\n if (!profileButtonRef.current) return;\n\n const handleResize = () => {\n const profileRightOffset = profileButtonRef.current?.getBoundingClientRect()?.right;\n setAvatarRight(profileRightOffset || 0);\n };\n\n handleResize();\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, [profileButtonRef.current]);\n\n\n return (\n <>\n <HeaderWrapper data-testid={testId}>\n <PageWidth useMaxWidth={useMaxWidth} maxWidth={maxWidth}>\n <RowLayout>\n <Logo name={name || ''} showBetaTag={logo?.showBetaTag} onClick={logo?.onClick} to={logo?.to}/>\n {\n isAuthenticated &&\n <MainMenu items={desktop?.items.filter(a => !a.pinned) || []} rightSideRef={rightSideRef}/>\n }\n <RightSide className={`${desktop?.reverseRightSideOrder ? 'reverse' : ''}`}\n ref={rightSideRef}>\n <RightSideNav items={desktop?.items?.filter(a => a.pinned)} action={desktop?.action}/>\n <DesktopActions ref={actionsRef}\n buttons={desktop?.buttons}\n onShowUserMenu={() => setShowUserMenu(!showUserMenu)}\n user={profile?.user}/>\n <HamburgerButton hidden={!isAuthenticated}>\n <IconButton action={() => setShowMobileMenu(!showMobileMenu)}\n ref={mobileMenuButtonRef}\n shape={'circular'}\n variant={'secondary'}>\n <Menu size=\"24px\"/>\n </IconButton>\n </HamburgerButton>\n </RightSide>\n </RowLayout>\n </PageWidth>\n </HeaderWrapper>\n <MobileMenuBackdrop className={showMobileMenu ? 'open' : !showUserMenu && wasMobileMenuOpen ? 'closed' : ''}>\n <MobileMenuWrapper ref={mobileMenuRef}\n role=\"menu\"\n aria-labelledby=\"UserMenuButton\">\n <MobileMenu {...mobile}\n show={showMobileMenu}\n onClose={() => setShowMobileMenu(false)}\n profile={profile}/>\n </MobileMenuWrapper>\n </MobileMenuBackdrop>\n {\n desktop?.buttons?.some(a => a.type === 'profile') && !!profile &&\n <UserMenuWrapper ref={userMenuRef}\n offsetRight={avatarRight}\n data-testid=\"testUserMenuWrapper\">\n <UserMenu {...profile}\n show={showUserMenu}\n onHideUserMenu={() => setShowUserMenu(false)}/>\n </UserMenuWrapper>\n }\n </>\n );\n};\n\nexport default GlobalNavigationBar;\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AAA2C;AAAA;AAAA;AAAA;AAAA;AAAA;AAE3C,IAAMA,aAAa,GAAGC,yBAAM,CAACC,MAAM,0aAGNC,cAAM,CAACC,WAAW,EAElCC,iBAAS,CAACC,WAAW,EAK9BC,mBAAW,CAACC,KAAK,EAIjBD,mBAAW,CAACE,KAAK,CAWpB;AAED,IAAMC,SAAS,GAA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,WAAW,EAAEF,WAAY;MACzB,eAAY,qBAAqB;MAAA,uBAChD,qBAAC,iBAAQ,kCAAKzB,OAAO;QACX,IAAI,EAAEY,YAAa;QACnB,cAAc,EAAE;UAAA,OAAMC,eAAe,CAAC,KAAK,CAAC;QAAA;MAAC;IAAE,EACzC;EAAA,EAEnB;AAEP,CAAC;AAAC;EAlHAf,eAAe;EACfM,WAAW;EACXC,QAAQ;EAERR,IAAI;EACJE,IAAI;IAAKuC,OAAO;IAAeC,EAAE;IAAWF,WAAW;EAAA;EAOvDlC,MAAM;AAAA;AAAA,eAwGOP,mBAAmB;AAAA"}
|
|
1
|
+
{"version":3,"file":"GlobalNavigationBar.cjs","names":["HeaderWrapper","styled","header","COLORS","neutral_200","Z_INDEXES","sticky_menu","BREAKPOINTS","SMALL","LARGE","RowLayout","div","HamburgerButton","RightSide","XSMALL","MobileMenuBackdrop","backdrop","fadeIn","fadeOut","UserMenuWrapper","white","props","offsetRight","hasWindow","window","innerWidth","GlobalNavigationBar","name","isAuthenticated","logo","profile","mobile","desktop","testId","useMaxWidth","maxWidth","React","useState","showMobileMenu","setShowMobileMenu","wasMobileMenuOpen","usePreviousImmediate","showUserMenu","setShowUserMenu","actionsRef","useRef","profileButtonRef","current","buttons","find","a","type","ref","mobileMenuButtonRef","rightSideRef","avatarRight","setAvatarRight","userMenuRef","useClickOutsideRef","mobileMenuRef","useEffect","handleResize","profileRightOffset","getBoundingClientRect","right","addEventListener","removeEventListener","showBetaTag","onClick","to","items","filter","pinned","reverseRightSideOrder","action","user","some"],"sources":["../../src/GlobalNavigationBar/GlobalNavigationBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\n\nimport Logo from './Logo';\nimport MainMenu from './desktop/MainMenu';\nimport {PageWidth} from '../Layouts';\nimport {COLORS, BREAKPOINTS} from '../styles';\nimport RightSideNav from './desktop/RightSideNav';\nimport MobileMenu from './mobile/MobileMenu';\nimport {Menu} from '../icons/systemicons/SystemIcons';\nimport UserMenu from './desktop/UserMenu';\nimport {fadeIn, fadeOut, Menu as MobileMenuWrapper} from './mobile/CommonStyles';\nimport {Z_INDEXES} from '../styles';\nimport {\n DesktopNavigationMenuProps, MenuProfileButton,\n MobileNavigationMenuProps,\n ProfileMenu\n} from './types';\nimport {IconButton} from '../Button';\nimport DesktopActions, {DesktopActionsRef} from './desktop/DesktopActions';\nimport {usePreviousImmediate} from 'rooks';\nimport {useClickOutsideRef} from '../common';\nimport { hasWindow } from '../utils/utils';\n\nconst HeaderWrapper = styled.header`\n background: white;\n box-sizing: border-box;\n border-bottom: 1px solid ${COLORS.neutral_200};\n\n z-index: ${Z_INDEXES.sticky_menu};\n position: relative;\n\n height: 48px;\n\n ${BREAKPOINTS.SMALL} {\n height: 56px;\n }\n\n ${BREAKPOINTS.LARGE} {\n height: 64px;\n }\n\n @media all and (-ms-high-contrast: none) {\n height: auto;\n }\n\n @media print {\n border-bottom: none;\n }\n`;\n\nconst RowLayout = styled.div`\n display: flex;\n align-items: center;\n`;\n\n\nconst HamburgerButton = styled.div`\n ${BREAKPOINTS.SMALL} button {\n height: 56px;\n }\n\n ${BREAKPOINTS.LARGE} {\n display: none;\n }\n`;\n\nconst RightSide = styled.div`\n display: flex;\n align-items: center;\n\n ${BREAKPOINTS.XSMALL} {\n margin: 0 0 0 auto;\n }\n\n &.reverse {\n ${HamburgerButton} {\n order: -1;\n }\n\n flex-direction: row-reverse;\n }\n`;\n\nconst MobileMenuBackdrop = styled.div`\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n position: fixed;\n left: 0;\n top: 0;\n height: 100%;\n width: 100%;\n overflow: hidden;\n z-index: ${Z_INDEXES.backdrop};\n visibility: hidden;\n\n &.open {\n visibility: visible;\n animation: ${fadeIn} 0.3s ease-in-out;\n }\n\n &.closed {\n visibility: hidden;\n animation: ${fadeOut} 0.3s ease-in-out;\n }\n\n ${BREAKPOINTS.LARGE} {\n visibility: hidden !important;\n }\n`;\n\nconst UserMenuWrapper = styled.div<{ offsetRight?: number }>`\n background-color: ${COLORS.white};\n display: flex;\n position: absolute;\n\n ${BREAKPOINTS.LARGE} {\n top: 56px;\n right: ${(props) => (props.offsetRight && hasWindow() ? `${window.innerWidth - props.offsetRight + 296}px` : '10%')};\n }\n`;\n\n\ntype GlobalNavigationBarProps = {\n isAuthenticated?: boolean;\n useMaxWidth?: boolean;\n maxWidth?: number;\n\n name?: string;\n logo?: { onClick?: () => void; to?: string; showBetaTag?: boolean; };\n\n profile?: ProfileMenu;\n\n mobile?: MobileNavigationMenuProps;\n desktop?: DesktopNavigationMenuProps;\n\n testId?: string;\n};\n\n/**\n * @param props\n * @constructor\n * @description This component is a global navigation header bar\n */\nconst GlobalNavigationBar = ({\n name,\n isAuthenticated,\n logo,\n profile,\n mobile,\n desktop,\n testId,\n useMaxWidth = true,\n maxWidth,\n }: GlobalNavigationBarProps): React.ReactElement<GlobalNavigationBarProps> => {\n const [showMobileMenu, setShowMobileMenu] = React.useState(false);\n const wasMobileMenuOpen = usePreviousImmediate(showMobileMenu);\n\n const [showUserMenu, setShowUserMenu] = React.useState(false);\n\n const actionsRef = React.useRef<DesktopActionsRef>(null);\n const profileButtonRef = React.useRef<HTMLButtonElement | null>() as React.MutableRefObject<HTMLButtonElement | null | undefined>;\n profileButtonRef.current = actionsRef?.current?.buttons?.find(a => a.type === 'profile')?.ref?.current;\n\n const mobileMenuButtonRef = React.useRef<HTMLButtonElement>(null);\n\n const rightSideRef = React.useRef(null);\n const [avatarRight, setAvatarRight] = React.useState<number>(0);\n\n\n const userMenuRef = useClickOutsideRef(() => setShowUserMenu(false), [profileButtonRef]);\n const mobileMenuRef = useClickOutsideRef(() => setShowMobileMenu(false), [mobileMenuButtonRef]);\n\n React.useEffect(() => {\n if (!profileButtonRef.current) return;\n\n const handleResize = () => {\n const profileRightOffset = profileButtonRef.current?.getBoundingClientRect()?.right;\n setAvatarRight(profileRightOffset || 0);\n };\n\n handleResize();\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, [profileButtonRef.current]);\n\n\n return (\n <>\n <HeaderWrapper data-testid={testId}>\n <PageWidth useMaxWidth={useMaxWidth} maxWidth={maxWidth}>\n <RowLayout>\n <Logo name={name || ''} showBetaTag={logo?.showBetaTag} onClick={logo?.onClick} to={logo?.to}/>\n {\n isAuthenticated &&\n <MainMenu items={desktop?.items.filter(a => !a.pinned) || []} rightSideRef={rightSideRef}/>\n }\n <RightSide className={`${desktop?.reverseRightSideOrder ? 'reverse' : ''}`}\n ref={rightSideRef}>\n <RightSideNav items={desktop?.items?.filter(a => a.pinned)} action={desktop?.action}/>\n <DesktopActions ref={actionsRef}\n buttons={desktop?.buttons}\n onShowUserMenu={() => setShowUserMenu(!showUserMenu)}\n user={profile?.user}/>\n <HamburgerButton hidden={!isAuthenticated}>\n <IconButton action={() => setShowMobileMenu(!showMobileMenu)}\n ref={mobileMenuButtonRef}\n shape={'circular'}\n variant={'secondary'}>\n <Menu size=\"24px\"/>\n </IconButton>\n </HamburgerButton>\n </RightSide>\n </RowLayout>\n </PageWidth>\n </HeaderWrapper>\n <MobileMenuBackdrop className={showMobileMenu ? 'open' : !showUserMenu && wasMobileMenuOpen ? 'closed' : ''}>\n <MobileMenuWrapper ref={mobileMenuRef}\n role=\"menu\"\n aria-labelledby=\"UserMenuButton\">\n <MobileMenu {...mobile}\n show={showMobileMenu}\n onClose={() => setShowMobileMenu(false)}\n profile={profile}/>\n </MobileMenuWrapper>\n </MobileMenuBackdrop>\n {\n desktop?.buttons?.some(a => a.type === 'profile') && !!profile &&\n <UserMenuWrapper ref={userMenuRef}\n offsetRight={avatarRight}\n data-testid=\"testUserMenuWrapper\">\n <UserMenu {...profile}\n show={showUserMenu}\n onHideUserMenu={() => setShowUserMenu(false)}/>\n </UserMenuWrapper>\n }\n </>\n );\n};\n\nexport default GlobalNavigationBar;\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;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AAAE,OAAO,aAAPA,OAAO,2CAAPA,OAAO,CAAEgB,OAAO,qDAAhB,iBAAkB4B,IAAI,CAAC,UAAA1B,CAAC;MAAA,OAAIA,CAAC,CAACC,IAAI,KAAK,SAAS;IAAA,EAAC,KAAI,CAAC,CAACrB,OAAO,iBAC9D,qBAAC,eAAe;MAAC,GAAG,EAAE2B,WAAY;MACjB,WAAW,EAAEF,WAAY;MACzB,eAAY,qBAAqB;MAAA,uBAChD,qBAAC,iBAAQ,kCAAKzB,OAAO;QACX,IAAI,EAAEY,YAAa;QACnB,cAAc,EAAE;UAAA,OAAMC,eAAe,CAAC,KAAK,CAAC;QAAA;MAAC;IAAE,EACzC;EAAA,EAEnB;AAEP,CAAC;AAAC;EAlHAf,eAAe;EACfM,WAAW;EACXC,QAAQ;EAERR,IAAI;EACJE,IAAI;IAAKuC,OAAO;IAAeC,EAAE;IAAWF,WAAW;EAAA;EAOvDlC,MAAM;AAAA;AAAA,eAwGOP,mBAAmB;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DesktopNavigationMenuProps, MobileNavigationMenuProps, ProfileMenu } from './types';
|
|
3
|
-
|
|
3
|
+
type GlobalNavigationBarProps = {
|
|
4
4
|
isAuthenticated?: boolean;
|
|
5
5
|
useMaxWidth?: boolean;
|
|
6
6
|
maxWidth?: number;
|
|
@@ -29,7 +29,7 @@ var HeaderWrapper = styled.header(_templateObject || (_templateObject = _taggedT
|
|
|
29
29
|
var RowLayout = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n"])));
|
|
30
30
|
var HamburgerButton = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", " button {\n height: 56px;\n }\n\n ", " {\n display: none;\n }\n"])), BREAKPOINTS.SMALL, BREAKPOINTS.LARGE);
|
|
31
31
|
var RightSide = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n\n ", " {\n margin: 0 0 0 auto;\n }\n\n &.reverse {\n ", " {\n order: -1;\n }\n\n flex-direction: row-reverse;\n }\n"])), BREAKPOINTS.XSMALL, HamburgerButton);
|
|
32
|
-
var MobileMenuBackdrop = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n position: fixed;\n left: 0;\n top: 0;\n
|
|
32
|
+
var MobileMenuBackdrop = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n position: fixed;\n left: 0;\n top: 0;\n height: 100%;\n width: 100%;\n overflow: hidden;\n z-index: ", ";\n visibility: hidden;\n\n &.open {\n visibility: visible;\n animation: ", " 0.3s ease-in-out;\n }\n\n &.closed {\n visibility: hidden;\n animation: ", " 0.3s ease-in-out;\n }\n\n ", " {\n visibility: hidden !important;\n }\n"])), Z_INDEXES.backdrop, fadeIn, fadeOut, BREAKPOINTS.LARGE);
|
|
33
33
|
var UserMenuWrapper = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n background-color: ", ";\n display: flex;\n position: absolute;\n\n ", " {\n top: 56px;\n right: ", ";\n }\n"])), COLORS.white, BREAKPOINTS.LARGE, function (props) {
|
|
34
34
|
return props.offsetRight && hasWindow() ? "".concat(window.innerWidth - props.offsetRight + 296, "px") : '10%';
|
|
35
35
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalNavigationBar.js","names":["React","styled","Logo","MainMenu","PageWidth","COLORS","BREAKPOINTS","RightSideNav","MobileMenu","Menu","UserMenu","fadeIn","fadeOut","MobileMenuWrapper","Z_INDEXES","IconButton","DesktopActions","usePreviousImmediate","useClickOutsideRef","hasWindow","HeaderWrapper","header","neutral_200","sticky_menu","SMALL","LARGE","RowLayout","div","HamburgerButton","RightSide","XSMALL","MobileMenuBackdrop","backdrop","UserMenuWrapper","white","props","offsetRight","window","innerWidth","GlobalNavigationBar","name","isAuthenticated","logo","profile","mobile","desktop","testId","useMaxWidth","maxWidth","useState","showMobileMenu","setShowMobileMenu","wasMobileMenuOpen","showUserMenu","setShowUserMenu","actionsRef","useRef","profileButtonRef","current","buttons","find","a","type","ref","mobileMenuButtonRef","rightSideRef","avatarRight","setAvatarRight","userMenuRef","mobileMenuRef","useEffect","handleResize","profileRightOffset","getBoundingClientRect","right","addEventListener","removeEventListener","showBetaTag","onClick","to","items","filter","pinned","reverseRightSideOrder","action","user","some"],"sources":["../../src/GlobalNavigationBar/GlobalNavigationBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\n\nimport Logo from './Logo';\nimport MainMenu from './desktop/MainMenu';\nimport {PageWidth} from '../Layouts';\nimport {COLORS, BREAKPOINTS} from '../styles';\nimport RightSideNav from './desktop/RightSideNav';\nimport MobileMenu from './mobile/MobileMenu';\nimport {Menu} from '../icons/systemicons/SystemIcons';\nimport UserMenu from './desktop/UserMenu';\nimport {fadeIn, fadeOut, Menu as MobileMenuWrapper} from './mobile/CommonStyles';\nimport {Z_INDEXES} from '../styles';\nimport {\n DesktopNavigationMenuProps, MenuProfileButton,\n MobileNavigationMenuProps,\n ProfileMenu\n} from './types';\nimport {IconButton} from '../Button';\nimport DesktopActions, {DesktopActionsRef} from './desktop/DesktopActions';\nimport {usePreviousImmediate} from 'rooks';\nimport {useClickOutsideRef} from '../common';\nimport { hasWindow } from '../utils/utils';\n\nconst HeaderWrapper = styled.header`\n background: white;\n box-sizing: border-box;\n border-bottom: 1px solid ${COLORS.neutral_200};\n\n z-index: ${Z_INDEXES.sticky_menu};\n position: relative;\n\n height: 48px;\n\n ${BREAKPOINTS.SMALL} {\n height: 56px;\n }\n\n ${BREAKPOINTS.LARGE} {\n height: 64px;\n }\n\n @media all and (-ms-high-contrast: none) {\n height: auto;\n }\n\n @media print {\n border-bottom: none;\n }\n`;\n\nconst RowLayout = styled.div`\n display: flex;\n align-items: center;\n`;\n\n\nconst HamburgerButton = styled.div`\n ${BREAKPOINTS.SMALL} button {\n height: 56px;\n }\n\n ${BREAKPOINTS.LARGE} {\n display: none;\n }\n`;\n\nconst RightSide = styled.div`\n display: flex;\n align-items: center;\n\n ${BREAKPOINTS.XSMALL} {\n margin: 0 0 0 auto;\n }\n\n &.reverse {\n ${HamburgerButton} {\n order: -1;\n }\n\n flex-direction: row-reverse;\n }\n`;\n\nconst MobileMenuBackdrop = styled.div`\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n position: fixed;\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n height: 100vh;\n width: 100vw;\n overflow: hidden;\n z-index: ${Z_INDEXES.backdrop};\n visibility: hidden;\n\n\n &.open {\n visibility: visible;\n animation: ${fadeIn} 0.3s ease-in-out;\n }\n\n &.closed {\n visibility: hidden;\n animation: ${fadeOut} 0.3s ease-in-out;\n }\n\n ${BREAKPOINTS.LARGE} {\n visibility: hidden !important;\n }\n`;\n\nconst UserMenuWrapper = styled.div<{ offsetRight?: number }>`\n background-color: ${COLORS.white};\n display: flex;\n position: absolute;\n\n ${BREAKPOINTS.LARGE} {\n top: 56px;\n right: ${(props) => (props.offsetRight && hasWindow() ? `${window.innerWidth - props.offsetRight + 296}px` : '10%')};\n }\n`;\n\n\ntype GlobalNavigationBarProps = {\n isAuthenticated?: boolean;\n useMaxWidth?: boolean;\n maxWidth?: number;\n\n name?: string;\n logo?: { onClick?: () => void; to?: string; showBetaTag?: boolean; };\n\n profile?: ProfileMenu;\n\n mobile?: MobileNavigationMenuProps;\n desktop?: DesktopNavigationMenuProps;\n\n testId?: string;\n};\n\n/**\n * @param props\n * @constructor\n * @description This component is a global navigation header bar\n */\nconst GlobalNavigationBar = ({\n name,\n isAuthenticated,\n logo,\n profile,\n mobile,\n desktop,\n testId,\n useMaxWidth = true,\n maxWidth,\n }: GlobalNavigationBarProps): React.ReactElement<GlobalNavigationBarProps> => {\n const [showMobileMenu, setShowMobileMenu] = React.useState(false);\n const wasMobileMenuOpen = usePreviousImmediate(showMobileMenu);\n\n const [showUserMenu, setShowUserMenu] = React.useState(false);\n\n const actionsRef = React.useRef<DesktopActionsRef>(null);\n const profileButtonRef = React.useRef<HTMLButtonElement | null>() as React.MutableRefObject<HTMLButtonElement | null | undefined>;\n profileButtonRef.current = actionsRef?.current?.buttons?.find(a => a.type === 'profile')?.ref?.current;\n\n const mobileMenuButtonRef = React.useRef<HTMLButtonElement>(null);\n\n const rightSideRef = React.useRef(null);\n const [avatarRight, setAvatarRight] = React.useState<number>(0);\n\n\n const userMenuRef = useClickOutsideRef(() => setShowUserMenu(false), [profileButtonRef]);\n const mobileMenuRef = useClickOutsideRef(() => setShowMobileMenu(false), [mobileMenuButtonRef]);\n\n React.useEffect(() => {\n if (!profileButtonRef.current) return;\n\n const handleResize = () => {\n const profileRightOffset = profileButtonRef.current?.getBoundingClientRect()?.right;\n setAvatarRight(profileRightOffset || 0);\n };\n\n handleResize();\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, [profileButtonRef.current]);\n\n\n return (\n <>\n <HeaderWrapper data-testid={testId}>\n <PageWidth useMaxWidth={useMaxWidth} maxWidth={maxWidth}>\n <RowLayout>\n <Logo name={name || ''} showBetaTag={logo?.showBetaTag} onClick={logo?.onClick} to={logo?.to}/>\n {\n isAuthenticated &&\n <MainMenu items={desktop?.items.filter(a => !a.pinned) || []} rightSideRef={rightSideRef}/>\n }\n <RightSide className={`${desktop?.reverseRightSideOrder ? 'reverse' : ''}`}\n ref={rightSideRef}>\n <RightSideNav items={desktop?.items?.filter(a => a.pinned)} action={desktop?.action}/>\n <DesktopActions ref={actionsRef}\n buttons={desktop?.buttons}\n onShowUserMenu={() => setShowUserMenu(!showUserMenu)}\n user={profile?.user}/>\n <HamburgerButton hidden={!isAuthenticated}>\n <IconButton action={() => setShowMobileMenu(!showMobileMenu)}\n ref={mobileMenuButtonRef}\n shape={'circular'}\n variant={'secondary'}>\n <Menu size=\"24px\"/>\n </IconButton>\n </HamburgerButton>\n </RightSide>\n </RowLayout>\n </PageWidth>\n </HeaderWrapper>\n <MobileMenuBackdrop className={showMobileMenu ? 'open' : !showUserMenu && wasMobileMenuOpen ? 'closed' : ''}>\n <MobileMenuWrapper ref={mobileMenuRef}\n role=\"menu\"\n aria-labelledby=\"UserMenuButton\">\n <MobileMenu {...mobile}\n show={showMobileMenu}\n onClose={() => setShowMobileMenu(false)}\n profile={profile}/>\n </MobileMenuWrapper>\n </MobileMenuBackdrop>\n {\n desktop?.buttons?.some(a => a.type === 'profile') && !!profile &&\n <UserMenuWrapper ref={userMenuRef}\n offsetRight={avatarRight}\n data-testid=\"testUserMenuWrapper\">\n <UserMenu {...profile}\n show={showUserMenu}\n onHideUserMenu={() => setShowUserMenu(false)}/>\n </UserMenuWrapper>\n }\n </>\n );\n};\n\nexport default GlobalNavigationBar;\n"],"mappings":";;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,QAAQ,MAAM,oBAAoB;AACzC,SAAQC,SAAS,QAAO,YAAY;AACpC,SAAQC,MAAM,EAAEC,WAAW,QAAO,WAAW;AAC7C,OAAOC,YAAY,MAAM,wBAAwB;AACjD,OAAOC,UAAU,MAAM,qBAAqB;AAC5C,SAAQC,IAAI,QAAO,kCAAkC;AACrD,OAAOC,QAAQ,MAAM,oBAAoB;AACzC,SAAQC,MAAM,EAAEC,OAAO,EAAEH,IAAI,IAAII,iBAAiB,QAAO,uBAAuB;AAChF,SAAQC,SAAS,QAAO,WAAW;AAMnC,SAAQC,UAAU,QAAO,WAAW;AACpC,OAAOC,cAAc,MAA2B,0BAA0B;AAC1E,SAAQC,oBAAoB,QAAO,OAAO;AAC1C,SAAQC,kBAAkB,QAAO,WAAW;AAC5C,SAASC,SAAS,QAAQ,gBAAgB;AAAC;AAAA;AAAA;AAE3C,IAAMC,aAAa,GA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zB,CAAC;MAAA,OAAIA,CAAC,CAACC,IAAI,KAAK,SAAS;IAAA,EAAC,KAAI,CAAC,CAACnB,OAAO,iBAC9D,KAAC,eAAe;MAAC,GAAG,EAAEyB,WAAY;MACjB,WAAW,EAAEF,WAAY;MACzB,eAAY,qBAAqB;MAAA,uBAChD,KAAC,QAAQ,kCAAKvB,OAAO;QACX,IAAI,EAAEU,YAAa;QACnB,cAAc,EAAE;UAAA,OAAMC,eAAe,CAAC,KAAK,CAAC;QAAA;MAAC;IAAE,EACzC;EAAA,EAEnB;AAEP,CAAC;AAAC;EAlHAb,eAAe;EACfM,WAAW;EACXC,QAAQ;EAERR,IAAI;EACJE,IAAI;IAAKoC,OAAO;IAAeC,EAAE;IAAWF,WAAW;EAAA;EAOvD/B,MAAM;AAAA;AAwGR,eAAeP,mBAAmB"}
|
|
1
|
+
{"version":3,"file":"GlobalNavigationBar.js","names":["React","styled","Logo","MainMenu","PageWidth","COLORS","BREAKPOINTS","RightSideNav","MobileMenu","Menu","UserMenu","fadeIn","fadeOut","MobileMenuWrapper","Z_INDEXES","IconButton","DesktopActions","usePreviousImmediate","useClickOutsideRef","hasWindow","HeaderWrapper","header","neutral_200","sticky_menu","SMALL","LARGE","RowLayout","div","HamburgerButton","RightSide","XSMALL","MobileMenuBackdrop","backdrop","UserMenuWrapper","white","props","offsetRight","window","innerWidth","GlobalNavigationBar","name","isAuthenticated","logo","profile","mobile","desktop","testId","useMaxWidth","maxWidth","useState","showMobileMenu","setShowMobileMenu","wasMobileMenuOpen","showUserMenu","setShowUserMenu","actionsRef","useRef","profileButtonRef","current","buttons","find","a","type","ref","mobileMenuButtonRef","rightSideRef","avatarRight","setAvatarRight","userMenuRef","mobileMenuRef","useEffect","handleResize","profileRightOffset","getBoundingClientRect","right","addEventListener","removeEventListener","showBetaTag","onClick","to","items","filter","pinned","reverseRightSideOrder","action","user","some"],"sources":["../../src/GlobalNavigationBar/GlobalNavigationBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\n\nimport Logo from './Logo';\nimport MainMenu from './desktop/MainMenu';\nimport {PageWidth} from '../Layouts';\nimport {COLORS, BREAKPOINTS} from '../styles';\nimport RightSideNav from './desktop/RightSideNav';\nimport MobileMenu from './mobile/MobileMenu';\nimport {Menu} from '../icons/systemicons/SystemIcons';\nimport UserMenu from './desktop/UserMenu';\nimport {fadeIn, fadeOut, Menu as MobileMenuWrapper} from './mobile/CommonStyles';\nimport {Z_INDEXES} from '../styles';\nimport {\n DesktopNavigationMenuProps, MenuProfileButton,\n MobileNavigationMenuProps,\n ProfileMenu\n} from './types';\nimport {IconButton} from '../Button';\nimport DesktopActions, {DesktopActionsRef} from './desktop/DesktopActions';\nimport {usePreviousImmediate} from 'rooks';\nimport {useClickOutsideRef} from '../common';\nimport { hasWindow } from '../utils/utils';\n\nconst HeaderWrapper = styled.header`\n background: white;\n box-sizing: border-box;\n border-bottom: 1px solid ${COLORS.neutral_200};\n\n z-index: ${Z_INDEXES.sticky_menu};\n position: relative;\n\n height: 48px;\n\n ${BREAKPOINTS.SMALL} {\n height: 56px;\n }\n\n ${BREAKPOINTS.LARGE} {\n height: 64px;\n }\n\n @media all and (-ms-high-contrast: none) {\n height: auto;\n }\n\n @media print {\n border-bottom: none;\n }\n`;\n\nconst RowLayout = styled.div`\n display: flex;\n align-items: center;\n`;\n\n\nconst HamburgerButton = styled.div`\n ${BREAKPOINTS.SMALL} button {\n height: 56px;\n }\n\n ${BREAKPOINTS.LARGE} {\n display: none;\n }\n`;\n\nconst RightSide = styled.div`\n display: flex;\n align-items: center;\n\n ${BREAKPOINTS.XSMALL} {\n margin: 0 0 0 auto;\n }\n\n &.reverse {\n ${HamburgerButton} {\n order: -1;\n }\n\n flex-direction: row-reverse;\n }\n`;\n\nconst MobileMenuBackdrop = styled.div`\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n position: fixed;\n left: 0;\n top: 0;\n height: 100%;\n width: 100%;\n overflow: hidden;\n z-index: ${Z_INDEXES.backdrop};\n visibility: hidden;\n\n &.open {\n visibility: visible;\n animation: ${fadeIn} 0.3s ease-in-out;\n }\n\n &.closed {\n visibility: hidden;\n animation: ${fadeOut} 0.3s ease-in-out;\n }\n\n ${BREAKPOINTS.LARGE} {\n visibility: hidden !important;\n }\n`;\n\nconst UserMenuWrapper = styled.div<{ offsetRight?: number }>`\n background-color: ${COLORS.white};\n display: flex;\n position: absolute;\n\n ${BREAKPOINTS.LARGE} {\n top: 56px;\n right: ${(props) => (props.offsetRight && hasWindow() ? `${window.innerWidth - props.offsetRight + 296}px` : '10%')};\n }\n`;\n\n\ntype GlobalNavigationBarProps = {\n isAuthenticated?: boolean;\n useMaxWidth?: boolean;\n maxWidth?: number;\n\n name?: string;\n logo?: { onClick?: () => void; to?: string; showBetaTag?: boolean; };\n\n profile?: ProfileMenu;\n\n mobile?: MobileNavigationMenuProps;\n desktop?: DesktopNavigationMenuProps;\n\n testId?: string;\n};\n\n/**\n * @param props\n * @constructor\n * @description This component is a global navigation header bar\n */\nconst GlobalNavigationBar = ({\n name,\n isAuthenticated,\n logo,\n profile,\n mobile,\n desktop,\n testId,\n useMaxWidth = true,\n maxWidth,\n }: GlobalNavigationBarProps): React.ReactElement<GlobalNavigationBarProps> => {\n const [showMobileMenu, setShowMobileMenu] = React.useState(false);\n const wasMobileMenuOpen = usePreviousImmediate(showMobileMenu);\n\n const [showUserMenu, setShowUserMenu] = React.useState(false);\n\n const actionsRef = React.useRef<DesktopActionsRef>(null);\n const profileButtonRef = React.useRef<HTMLButtonElement | null>() as React.MutableRefObject<HTMLButtonElement | null | undefined>;\n profileButtonRef.current = actionsRef?.current?.buttons?.find(a => a.type === 'profile')?.ref?.current;\n\n const mobileMenuButtonRef = React.useRef<HTMLButtonElement>(null);\n\n const rightSideRef = React.useRef(null);\n const [avatarRight, setAvatarRight] = React.useState<number>(0);\n\n\n const userMenuRef = useClickOutsideRef(() => setShowUserMenu(false), [profileButtonRef]);\n const mobileMenuRef = useClickOutsideRef(() => setShowMobileMenu(false), [mobileMenuButtonRef]);\n\n React.useEffect(() => {\n if (!profileButtonRef.current) return;\n\n const handleResize = () => {\n const profileRightOffset = profileButtonRef.current?.getBoundingClientRect()?.right;\n setAvatarRight(profileRightOffset || 0);\n };\n\n handleResize();\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, [profileButtonRef.current]);\n\n\n return (\n <>\n <HeaderWrapper data-testid={testId}>\n <PageWidth useMaxWidth={useMaxWidth} maxWidth={maxWidth}>\n <RowLayout>\n <Logo name={name || ''} showBetaTag={logo?.showBetaTag} onClick={logo?.onClick} to={logo?.to}/>\n {\n isAuthenticated &&\n <MainMenu items={desktop?.items.filter(a => !a.pinned) || []} rightSideRef={rightSideRef}/>\n }\n <RightSide className={`${desktop?.reverseRightSideOrder ? 'reverse' : ''}`}\n ref={rightSideRef}>\n <RightSideNav items={desktop?.items?.filter(a => a.pinned)} action={desktop?.action}/>\n <DesktopActions ref={actionsRef}\n buttons={desktop?.buttons}\n onShowUserMenu={() => setShowUserMenu(!showUserMenu)}\n user={profile?.user}/>\n <HamburgerButton hidden={!isAuthenticated}>\n <IconButton action={() => setShowMobileMenu(!showMobileMenu)}\n ref={mobileMenuButtonRef}\n shape={'circular'}\n variant={'secondary'}>\n <Menu size=\"24px\"/>\n </IconButton>\n </HamburgerButton>\n </RightSide>\n </RowLayout>\n </PageWidth>\n </HeaderWrapper>\n <MobileMenuBackdrop className={showMobileMenu ? 'open' : !showUserMenu && wasMobileMenuOpen ? 'closed' : ''}>\n <MobileMenuWrapper ref={mobileMenuRef}\n role=\"menu\"\n aria-labelledby=\"UserMenuButton\">\n <MobileMenu {...mobile}\n show={showMobileMenu}\n onClose={() => setShowMobileMenu(false)}\n profile={profile}/>\n </MobileMenuWrapper>\n </MobileMenuBackdrop>\n {\n desktop?.buttons?.some(a => a.type === 'profile') && !!profile &&\n <UserMenuWrapper ref={userMenuRef}\n offsetRight={avatarRight}\n data-testid=\"testUserMenuWrapper\">\n <UserMenu {...profile}\n show={showUserMenu}\n onHideUserMenu={() => setShowUserMenu(false)}/>\n </UserMenuWrapper>\n }\n </>\n );\n};\n\nexport default GlobalNavigationBar;\n"],"mappings":";;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,QAAQ,MAAM,oBAAoB;AACzC,SAAQC,SAAS,QAAO,YAAY;AACpC,SAAQC,MAAM,EAAEC,WAAW,QAAO,WAAW;AAC7C,OAAOC,YAAY,MAAM,wBAAwB;AACjD,OAAOC,UAAU,MAAM,qBAAqB;AAC5C,SAAQC,IAAI,QAAO,kCAAkC;AACrD,OAAOC,QAAQ,MAAM,oBAAoB;AACzC,SAAQC,MAAM,EAAEC,OAAO,EAAEH,IAAI,IAAII,iBAAiB,QAAO,uBAAuB;AAChF,SAAQC,SAAS,QAAO,WAAW;AAMnC,SAAQC,UAAU,QAAO,WAAW;AACpC,OAAOC,cAAc,MAA2B,0BAA0B;AAC1E,SAAQC,oBAAoB,QAAO,OAAO;AAC1C,SAAQC,kBAAkB,QAAO,WAAW;AAC5C,SAASC,SAAS,QAAQ,gBAAgB;AAAC;AAAA;AAAA;AAE3C,IAAMC,aAAa,GAAGnB,MAAM,CAACoB,MAAM,4ZAGNhB,MAAM,CAACiB,WAAW,EAElCR,SAAS,CAACS,WAAW,EAK9BjB,WAAW,CAACkB,KAAK,EAIjBlB,WAAW,CAACmB,KAAK,CAWpB;AAED,IAAMC,SAAS,GAAGzB,MAAM,CAAC0B,GAAG,mHAG3B;AAGD,IAAMC,eAAe,GAAG3B,MAAM,CAAC0B,GAAG,wJAC9BrB,WAAW,CAACkB,KAAK,EAIjBlB,WAAW,CAACmB,KAAK,CAGpB;AAED,IAAMI,SAAS,GAAG5B,MAAM,CAAC0B,GAAG,6PAIxBrB,WAAW,CAACwB,MAAM,EAKhBF,eAAe,CAMpB;AAED,IAAM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AKoC,OAAO;IAAeC,EAAE;IAAWF,WAAW;EAAA;EAOvD/B,MAAM;AAAA;AAwGR,eAAeP,mBAAmB"}
|
|
@@ -48,15 +48,17 @@ var UserMenu = function UserMenu(_ref) {
|
|
|
48
48
|
navigate = _useNavigationHelper.navigate,
|
|
49
49
|
isActiveRoute = _useNavigationHelper.isActiveRoute;
|
|
50
50
|
React.useEffect(function () {
|
|
51
|
+
var _document;
|
|
51
52
|
if (!onHideUserMenu) return;
|
|
52
53
|
function handleKeyPress(e) {
|
|
53
54
|
if (e.key === 'Escape' || e.key === 'Esc') {
|
|
54
55
|
onHideUserMenu();
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
|
-
document.addEventListener('keydown', handleKeyPress, false);
|
|
58
|
+
(_document = document) === null || _document === void 0 ? void 0 : _document.addEventListener('keydown', handleKeyPress, false);
|
|
58
59
|
return function () {
|
|
59
|
-
|
|
60
|
+
var _document2;
|
|
61
|
+
(_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.removeEventListener('keydown', handleKeyPress, false);
|
|
60
62
|
};
|
|
61
63
|
}, [onHideUserMenu]);
|
|
62
64
|
var renderItem = function renderItem(item, section, index) {
|