@helsenorge/designsystem-react 15.7.1 → 16.0.0
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/lib/Button.js +2 -2
- package/lib/Button.js.map +1 -1
- package/lib/CHANGELOG.md +2657 -996
- package/lib/Close.js +1 -1
- package/lib/Close.js.map +1 -1
- package/lib/Drawer.js +2 -4
- package/lib/Drawer.js.map +1 -1
- package/lib/DrawerNavigation.js +1 -0
- package/lib/DrawerNavigation.js.map +1 -1
- package/lib/Duolist.js +5 -1
- package/lib/Duolist.js.map +1 -1
- package/lib/ElementHeader.js.map +1 -1
- package/lib/FilterLinkList.js +1 -1
- package/lib/FilterLinkList.js.map +1 -1
- package/lib/FormGroup.js +3 -3
- package/lib/FormGroup.js.map +1 -1
- package/lib/HelpDetails.js +1 -1
- package/lib/HelpTriggerIcon.js +2 -2
- package/lib/HelpTriggerIcon.js.map +1 -1
- package/lib/HelpTriggerStandalone.js +1 -1
- package/lib/HelpTriggerStandalone.js.map +1 -1
- package/lib/LazyIcon.js +1 -0
- package/lib/LazyIcon.js.map +1 -1
- package/lib/LazyIllustration.js +2 -0
- package/lib/LazyIllustration.js.map +1 -1
- package/lib/LinkList.js +10 -10
- package/lib/LinkList.js.map +1 -1
- package/lib/ListEditMode.js +1 -1
- package/lib/ListEditMode.js.map +1 -1
- package/lib/PopOver.js +2 -2
- package/lib/PopOver.js.map +1 -1
- package/lib/Radio.js +65 -55
- package/lib/Radio.js.map +1 -1
- package/lib/Radio2.js +74 -0
- package/lib/Radio2.js.map +1 -0
- package/lib/RadioMarker.js +2 -2
- package/lib/RadioMarker.js.map +1 -1
- package/lib/TabList.js +5 -5
- package/lib/TabList.js.map +1 -1
- package/lib/Toggle.js +2 -2
- package/lib/Toggle.js.map +1 -1
- package/lib/VisualRadio.js +1 -1
- package/lib/VisualRadio.js.map +1 -1
- package/lib/components/AnchorLink/styles.module.scss +3 -4
- package/lib/components/ArticleTeaser/styles.module.scss +12 -12
- package/lib/components/Button/Button.d.ts +1 -1
- package/lib/components/Button/styles.module.scss +111 -60
- package/lib/components/Button/styles.module.scss.d.ts +1 -1
- package/lib/components/Checkbox/CheckboxMarker/styles.module.scss +6 -6
- package/lib/components/Chip/styles.module.scss +2 -3
- package/lib/components/Close/styles.module.scss +2 -3
- package/lib/components/DictionaryTrigger/index.js +26 -1
- package/lib/{DictionaryTrigger.js.map → components/DictionaryTrigger/index.js.map} +1 -1
- package/lib/components/DictionaryTrigger/styles.module.scss +6 -8
- package/lib/components/Drawer/Drawer.d.ts +0 -4
- package/lib/components/Drawer/DrawerBackButton.module.scss +1 -2
- package/lib/components/Drawer/styles.module.scss +6 -3
- package/lib/components/Dropdown/SingleSelect/styles.module.scss +0 -2
- package/lib/components/Dropdown/index.js +9 -17
- package/lib/components/Dropdown/index.js.map +1 -1
- package/lib/components/Dropdown/styles.module.scss +12 -14
- package/lib/components/Duolist/Duolist.d.ts +14 -2
- package/lib/components/Duolist/styles.module.scss +32 -8
- package/lib/components/Duolist/styles.module.scss.d.ts +3 -0
- package/lib/components/ElementHeader/ElementHeader.d.ts +1 -1
- package/lib/components/ElementHeader/styles.module.scss +1 -1
- package/lib/components/EmptyState/styles.module.scss +1 -2
- package/lib/components/ErrorWrapper/styles.module.scss +3 -3
- package/lib/components/Expander/styles.module.scss +0 -2
- package/lib/components/Expander/styles.module.scss.d.ts +1 -1
- package/lib/components/ExpanderList/index.js +20 -19
- package/lib/components/ExpanderList/index.js.map +1 -1
- package/lib/components/ExpanderList/styles.module.scss +10 -11
- package/lib/components/FavoriteButton/index.js +3 -3
- package/lib/components/FavoriteButton/index.js.map +1 -1
- package/lib/components/FavoriteButton/styles.module.scss +0 -1
- package/lib/components/Filter/FilterButton/styles.module.scss +5 -6
- package/lib/components/Filter/FilterButtonAndChipsWrapper/styles.module.scss +0 -1
- package/lib/components/Filter/FilterDrawer/styles.module.scss +0 -1
- package/lib/components/Filter/FilterLinkList/FilterLinkList.module.scss +5 -6
- package/lib/components/Filter/FilterOverviewSearch/styles.module.scss +1 -4
- package/lib/components/Filter/FilterSearch/styles.module.scss +14 -15
- package/lib/components/Filter/FilterSort/styles.module.scss +1 -2
- package/lib/components/Filter/FilterStateWrapper/styles.module.scss +0 -2
- package/lib/components/Filter/LoaderSpinner/styles.module.scss +2 -4
- package/lib/components/FormFieldTag/styles.module.scss +0 -1
- package/lib/components/FormGroup/styles.module.scss +0 -1
- package/lib/components/HelpBubble/styles.module.scss +0 -1
- package/lib/components/HelpDetails/styles.module.scss +2 -4
- package/lib/components/HelpDrawer/styles.module.scss +1 -2
- package/lib/components/HelpPanel/HelpPanel.d.ts +2 -2
- package/lib/components/HelpPanel/index.js +1 -17
- package/lib/components/HelpPanel/index.js.map +1 -1
- package/lib/components/HelpPanel/styles.module.scss +2 -22
- package/lib/components/HelpPanel/styles.module.scss.d.ts +0 -4
- package/lib/components/HelpTeaser/styles.module.scss +7 -9
- package/lib/components/HelpTriggerIcon/HelpTriggerIcon.d.ts +2 -2
- package/lib/components/HelpTriggerIcon/styles.module.scss +20 -22
- package/lib/components/HelpTriggerIcon/styles.module.scss.d.ts +1 -1
- package/lib/components/HelpTriggerInline/styles.module.scss +3 -5
- package/lib/components/HelpTriggerStandalone/styles.module.scss +3 -5
- package/lib/components/HighlightPanel/styles.module.scss +2 -3
- package/lib/components/Icons/AdditionalIconInformation.d.ts +4 -0
- package/lib/components/Icons/AdditionalIconInformation.js +14 -10
- package/lib/components/Icons/AdditionalIconInformation.js.map +1 -1
- package/lib/components/Icons/HealthcarePersonnelSecurity.js +4 -4
- package/lib/components/Icons/HealthcarePersonnelSecurity.js.map +1 -1
- package/lib/components/Icons/HistoryDocument.js +6 -7
- package/lib/components/Icons/HistoryDocument.js.map +1 -1
- package/lib/components/Icons/IconNames.d.ts +1 -1
- package/lib/components/Icons/IconNames.js +1 -0
- package/lib/components/Icons/IconNames.js.map +1 -1
- package/lib/components/Icons/YesNo.d.ts +3 -0
- package/lib/components/Icons/YesNo.js +53 -0
- package/lib/components/Icons/YesNo.js.map +1 -0
- package/lib/components/Illustrations/IllustrationNames.d.ts +1 -1
- package/lib/components/Illustrations/IllustrationNames.js +2 -0
- package/lib/components/Illustrations/IllustrationNames.js.map +1 -1
- package/lib/components/Illustrations/MoveAway.d.ts +11 -0
- package/lib/components/Illustrations/MoveAway.js +18 -0
- package/lib/components/Illustrations/MoveAway.js.map +1 -0
- package/lib/components/Illustrations/MoveAwayMedium.d.ts +3 -0
- package/lib/components/Illustrations/MoveAwayMedium.js +114 -0
- package/lib/components/Illustrations/MoveAwayMedium.js.map +1 -0
- package/lib/components/InfoTeaser/styles.module.scss +6 -8
- package/lib/components/Label/styles.module.scss +1 -1
- package/lib/components/LinkList/LinkList.d.ts +1 -1
- package/lib/components/LinkList/styles.module.scss +9 -11
- package/lib/components/LinkList/styles.module.scss.d.ts +1 -1
- package/lib/components/ListEditMode/styles.module.scss +5 -7
- package/lib/components/Loader/Loader.d.ts +1 -1
- package/lib/components/Loader/index.js +4 -4
- package/lib/components/Loader/index.js.map +1 -1
- package/lib/components/Loader/styles.module.scss +7 -7
- package/lib/components/Loader/styles.module.scss.d.ts +3 -3
- package/lib/components/Modal/constants.d.ts +1 -1
- package/lib/components/Modal/index.js +2 -2
- package/lib/components/Modal/index.js.map +1 -1
- package/lib/components/Modal/styles.module.scss +14 -19
- package/lib/components/Modal/styles.module.scss.d.ts +2 -3
- package/lib/components/Panel/index.js +1 -1
- package/lib/components/Panel/index.js.map +1 -1
- package/lib/components/Panel/styles.module.scss +15 -16
- package/lib/components/Panel/styles.module.scss.d.ts +1 -1
- package/lib/components/PopMenu/index.js +7 -4
- package/lib/components/PopMenu/index.js.map +1 -1
- package/lib/components/PopOver/styles.module.scss +1 -3
- package/lib/components/Progressbar/Progressbar.d.ts +1 -1
- package/lib/components/Progressbar/constants.d.ts +1 -1
- package/lib/components/Progressbar/index.js +4 -4
- package/lib/components/Progressbar/index.js.map +1 -1
- package/lib/components/Radio/Radio.d.ts +28 -0
- package/lib/components/Radio/index.d.ts +3 -0
- package/lib/components/Radio/index.js +7 -0
- package/lib/components/Radio/index.js.map +1 -0
- package/lib/components/{RadioButton → Radio}/styles.module.scss +8 -9
- package/lib/components/Radio/styles.module.scss.d.ts +26 -0
- package/lib/components/ServiceMessage/styles.module.scss +20 -22
- package/lib/components/Slider/styles.module.scss +1 -2
- package/lib/components/StatusDot/styles.module.scss +4 -5
- package/lib/components/StickyNote/index.js +2 -2
- package/lib/components/StickyNote/index.js.map +1 -1
- package/lib/components/StickyNote/styles.module.scss +9 -10
- package/lib/components/Tabs/TabList/styles.module.scss +20 -18
- package/lib/components/Tabs/TabPanel/styles.module.scss +2 -3
- package/lib/components/Tabs/styles.module.scss +0 -1
- package/lib/components/Tag/styles.module.scss +0 -1
- package/lib/components/Tile/styles.module.scss +5 -7
- package/lib/components/Toast/styles.module.scss +0 -1
- package/lib/components/Toggle/styles.module.scss +9 -10
- package/lib/components/Validation/index.js +2 -2
- package/lib/components/Validation/index.js.map +1 -1
- package/lib/components/VisualCheckboxCloud/Checkbox/styles.module.scss +0 -2
- package/lib/components/VisualCheckboxCloud/styles.module.scss +0 -1
- package/lib/components/VisualCheckboxGroup/VisualCheckbox/styles.module.scss +0 -2
- package/lib/components/VisualCheckboxGroup/styles.module.scss +0 -1
- package/lib/components/VisualContentgroupWithImage/styles.module.scss +0 -1
- package/lib/components/VisualRadioCloud/Radio/index.js +1 -1
- package/lib/components/VisualRadioCloud/Radio/styles.module.scss +0 -2
- package/lib/components/VisualRadioCloud/index.js +1 -1
- package/lib/components/VisualRadioCloud/styles.module.scss +0 -1
- package/lib/components/VisualRadioGroup/VisualRadio/styles.module.scss +0 -2
- package/lib/components/VisualRadioGroup/styles.module.scss +0 -1
- package/lib/constants.d.ts +2 -3
- package/lib/constants.js +2 -3
- package/lib/constants.js.map +1 -1
- package/lib/floating-ui.react.js +1 -458
- package/lib/floating-ui.react.js.map +1 -1
- package/lib/hooks/useDismissablePopover.d.ts +20 -0
- package/lib/hooks/useDismissablePopover.js +66 -0
- package/lib/hooks/useDismissablePopover.js.map +1 -0
- package/lib/hooks/useOutsideEvent.d.ts +3 -0
- package/lib/hooks/useOutsideEvent.js +24 -3
- package/lib/hooks/useOutsideEvent.js.map +1 -1
- package/lib/hooks/useReturnFocusOnClose.d.ts +7 -0
- package/lib/hooks/useReturnFocusOnClose.js +22 -0
- package/lib/hooks/useReturnFocusOnClose.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -1
- package/lib/scss/_visual-form.scss +47 -47
- package/lib/scss/helsenorge.scss +1 -0
- package/lib/scss/supernova/styles/colors.css +177 -122
- package/lib/scss/supernova/styles/typography.css +58 -51
- package/lib/scss/supernova-legacy/index.css +2 -0
- package/lib/scss/supernova-legacy/styles/legacy-colors.css +111 -0
- package/lib/utils/formSpacing.js +3 -3
- package/lib/utils/formSpacing.js.map +1 -1
- package/package.json +8 -14
- package/scss/_visual-form.scss +47 -47
- package/scss/helsenorge.scss +1 -0
- package/scss/supernova/styles/colors.css +177 -122
- package/scss/supernova/styles/typography.css +58 -51
- package/scss/supernova-legacy/index.css +2 -0
- package/scss/supernova-legacy/styles/legacy-colors.css +111 -0
- package/lib/DictionaryTrigger.js +0 -27
- package/lib/RadioButton.js +0 -84
- package/lib/RadioButton.js.map +0 -1
- package/lib/components/HelpTooltip/HelpTooltip.d.ts +0 -12
- package/lib/components/HelpTooltip/index.d.ts +0 -3
- package/lib/components/HelpTooltip/index.js +0 -48
- package/lib/components/HelpTooltip/index.js.map +0 -1
- package/lib/components/RadioButton/RadioButton.d.ts +0 -28
- package/lib/components/RadioButton/index.d.ts +0 -3
- package/lib/components/RadioButton/index.js +0 -7
- package/lib/components/RadioButton/index.js.map +0 -1
- package/lib/components/RadioButton/styles.module.scss.d.ts +0 -26
- package/lib/designsystem-react.css +0 -273
- /package/lib/components/{RadioButton → Radio}/RadioMarker/RadioMarker.d.ts +0 -0
- /package/lib/components/{RadioButton → Radio}/RadioMarker/styles.module.scss +0 -0
- /package/lib/components/{RadioButton → Radio}/RadioMarker/styles.module.scss.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/ExpanderList/ExpanderList.tsx","../../../src/components/ExpanderList/index.ts"],"sourcesContent":["import React, { useEffect, useId, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { PaletteNames } from '../../theme/palette';\nimport type { ElementHeaderType } from '../ElementHeader/ElementHeader';\nimport type { ListEditModeItemProps } from '../ListEditMode';\nimport type { TitleTags } from '../Title';\n\nimport { AnalyticsId } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { mergeRefs } from '../../utils/refs';\nimport { isElementInViewport } from '../../utils/viewport';\nimport { renderElementHeader } from '../ElementHeader/utils';\nimport Highlighter from '../Highlighter';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport ListEditModeItem from '../ListEditMode';\nimport { listEditModeWrapperClassnames } from '../ListEditMode/constants';\n\nimport expanderListStyles from './styles.module.scss';\n\nexport type ExpanderListColors = Extract<PaletteNames, 'white' | 'blueberry' | 'cherry' | 'neutral'>;\nexport interface ExpanderType extends React.FC<ExpanderProps> {\n ElementHeader?: ElementHeaderType;\n}\n\nexport interface ExpanderListCompound extends React.FC<ExpanderListProps> {\n Expander: ExpanderType;\n}\n\nexport type ExpanderListVariant = 'line' | 'outline' | 'fill' | 'fill-negative';\n\nexport type ExpanderListStatus = 'none' | 'new';\n\ninterface ExpanderListProps {\n /** Toggles accordion functionality for the expanders. */\n accordion?: boolean;\n /** Items in the ExpanderList */\n children: React.ReactNode;\n /** Toggles padding of child elements */\n childPadding?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the colors of the list. */\n color?: ExpanderListColors;\n /** Changes the font size. */\n large?: boolean;\n /** Whether to render children when closed (in which case they are hidden with CSS). Default: false */\n renderChildrenWhenClosed?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets visual priority */\n variant?: ExpanderListVariant;\n /** Overrides the default z-index of the expander header */\n zIndex?: number;\n /** Highlights text in title and content. Used for search results */\n highlightText?: string;\n /**\n * @experimental This prop is experimental and may change in the future.\n * Enables ListEditMode\n */\n editMode?: boolean;\n /** Ref passed to the ul element */\n ref?: React.Ref<HTMLUListElement | null>;\n}\n\ntype Modify<T, R> = Omit<T, keyof R> & R;\n\ntype ExpanderProps = Modify<\n React.HTMLAttributes<HTMLButtonElement>,\n {\n id?: string;\n title: React.ReactElement | string;\n /** Changes the underlying element of the title. Default: span*/\n titleHtmlMarkup?: TitleTags;\n children: React.ReactNode;\n className?: string;\n color?: ExpanderListColors;\n icon?: React.ReactElement;\n padding?: boolean;\n expanded?: boolean;\n large?: boolean;\n testId?: string;\n handleExpanderClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Called when expander is open/closed. */\n onExpand?: (isExpanded: boolean) => void;\n /** Overrides the default z-index of the expander header */\n zIndex?: number;\n /** Highlights text in title and content. Override if different from list. */\n highlightText?: string;\n /** Displays a status on the left side: default none */\n status?: ExpanderListStatus;\n /** Ref passed to the li element */\n ref?: React.Ref<HTMLLIElement | null>;\n }\n> &\n Pick<ExpanderListProps, 'renderChildrenWhenClosed' | 'variant'> &\n ListEditModeItemProps;\n\nexport const Expander: ExpanderType = (props: ExpanderProps) => {\n const {\n id,\n children,\n padding = true,\n color = 'neutral',\n className = '',\n icon,\n large = false,\n title,\n titleHtmlMarkup = 'span',\n expanded = false,\n testId,\n handleExpanderClick,\n onExpand,\n renderChildrenWhenClosed,\n variant = 'line',\n zIndex = 0,\n highlightText,\n status = 'none',\n editMode = false,\n ref,\n } = props;\n const [isExpanded] = useExpand(expanded, onExpand);\n const expanderRef = useRef<HTMLLIElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const { isHovered, isFocused } = usePseudoClasses(triggerRef);\n\n const isFill = variant === 'fill';\n const isFillNegative = variant === 'fill-negative';\n const isOutline = variant === 'outline';\n const isLine = variant === 'line';\n\n const itemClasses = classNames(className, expanderListStyles['expander-list__item'], {\n [expanderListStyles[`expander-list__item--fill`]]: isFill,\n [expanderListStyles[`expander-list__item--fill--${color}`]]: isFill,\n [expanderListStyles[`expander-list__item--fill-negative`]]: isFillNegative,\n [expanderListStyles[`expander-list__item--fill-negative--${color}`]]: isFillNegative,\n [expanderListStyles['expander-list__item--outline']]: isOutline,\n [expanderListStyles[`expander-list__item--outline--${color}`]]: isOutline,\n [expanderListStyles['expander-list__item--line']]: isLine,\n [expanderListStyles[`expander-list__item--line--${color}`]]: isLine,\n [expanderListStyles[`expander-list__item--new`]]: status === 'new',\n });\n\n const expanderClasses = classNames(expanderListStyles['expander-list-link'], expanderListStyles[`expander-list-link--${color}`], {\n [expanderListStyles[`expander-list-link--fill--${color}`]]: isFill,\n [expanderListStyles[`expander-list-link--fill-negative`]]: isFillNegative,\n [expanderListStyles[`expander-list-link--fill-negative--${color}`]]: isFillNegative,\n [expanderListStyles['expander-list-link--outline']]: isOutline,\n [expanderListStyles[`expander-list-link--outline--${color}`]]: isOutline,\n [expanderListStyles[`expander-list-link--line--${color}`]]: isLine,\n [expanderListStyles['expander-list-link--open']]: isExpanded,\n [expanderListStyles['expander-list-link--large']]: large,\n [expanderListStyles[`expander-list-link--new`]]: status === 'new',\n });\n\n const renderContent = (): React.ReactNode => {\n if (!renderChildrenWhenClosed && !isExpanded) {\n return null;\n }\n\n const mainContentClasses = classNames(expanderListStyles['expander-list-link__main-content'], {\n [expanderListStyles['expander-list-link__main-content--expanded']]: isExpanded,\n [expanderListStyles['expander-list-link__main-content--padding']]: padding,\n [expanderListStyles[`expander-list-link__main-content--outline--${color}`]]: isOutline,\n [expanderListStyles[`expander-list-link__main-content--new`]]: status === 'new',\n });\n\n return (\n <div className={mainContentClasses} data-state={isExpanded ? 'open' : 'closed'}>\n <Highlighter searchText={highlightText}>{children}</Highlighter>\n </div>\n );\n };\n\n const statusMarkerClasses = classNames(expanderListStyles['expander-list__item__status-marker'], {\n [expanderListStyles['expander-list__item__status-marker--new']]: status === 'new',\n });\n\n return (\n <>\n {editMode ? (\n <div className={itemClasses}>\n {status !== 'none' && <div className={statusMarkerClasses}></div>}\n <div id={id} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderListExpander} className={expanderClasses}>\n {renderElementHeader(title, {\n titleHtmlMarkup,\n isHovered: false,\n size: large ? 'large' : 'medium',\n parentType: 'expanderlist',\n chevronIcon: undefined,\n icon,\n highlightText,\n })}\n </div>\n </div>\n ) : (\n <li className={itemClasses} ref={mergeRefs([ref, expanderRef])}>\n {status !== 'none' && <div className={statusMarkerClasses}></div>}\n <button\n type=\"button\"\n id={id}\n onClick={handleExpanderClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.ExpanderListExpander}\n className={expanderClasses}\n ref={triggerRef}\n aria-expanded={isExpanded}\n style={{\n zIndex: isFocused ? zIndex + 1 : zIndex,\n }}\n >\n {renderElementHeader(title, {\n titleHtmlMarkup,\n isHovered: isHovered || isFocused,\n size: large ? 'large' : 'medium',\n parentType: 'expanderlist',\n chevronIcon: isExpanded ? ChevronUp : ChevronDown,\n icon,\n highlightText,\n })}\n </button>\n {renderContent()}\n </li>\n )}\n </>\n );\n};\n\ntype ActiveExpander = Record<string, boolean>;\n\nconst isExpanderComponent = (element: unknown | null | undefined): element is React.ReactElement<ExpanderProps> =>\n React.isValidElement<ExpanderProps>(element) && (element as React.ReactElement).type === Expander;\n\nconst ExpanderListComponent: React.FC<ExpanderListProps> = (props: ExpanderListProps) => {\n const {\n children,\n childPadding = true,\n large,\n renderChildrenWhenClosed = false,\n color = 'white',\n className = '',\n accordion = false,\n testId,\n variant,\n zIndex,\n highlightText,\n editMode = false,\n ref,\n } = props;\n const [prevChildren, setPrevChildren] = useState(children);\n const [activeExpander, setActiveExpander] = useState<ActiveExpander>();\n const [latestExpander, setLatestExpander] = useState<HTMLElement>();\n const expanderIdBase = useId();\n const expanderListClasses = classNames(expanderListStyles['expander-list'], className, {\n [expanderListStyles[`expander-list--outline--${color}`]]: variant === 'outline',\n [expanderListStyles[`expander-list--fill`]]: variant === 'fill' || variant === 'fill-negative',\n [listEditModeWrapperClassnames]: editMode,\n });\n\n function handleExpanderClick(event: React.MouseEvent<HTMLElement, MouseEvent>, id: string): void {\n setActiveExpander(prevState => (accordion ? { [id]: !prevState?.[id] } : { ...prevState, [id]: !prevState?.[id] }));\n setLatestExpander(event.currentTarget);\n }\n\n const getExpanderId = (index: number): string => `${expanderIdBase}-${index}`;\n\n useEffect(() => {\n if (accordion && latestExpander && !isElementInViewport(latestExpander)) {\n latestExpander.scrollIntoView();\n }\n }, [accordion, latestExpander]);\n\n const getExpanderStateFromChildren = (): ActiveExpander | undefined => {\n return React.Children.map(children, child => {\n if (isExpanderComponent(child)) {\n return child;\n }\n })?.reduce((acc, child, index) => {\n // Expanded-status skal bare settes dersom prop er satt av den som bruker komponenten\n if (typeof child.props.expanded !== 'undefined') {\n acc[getExpanderId(index)] = child.props.expanded;\n }\n return acc;\n }, {} as ActiveExpander);\n };\n\n if (children !== prevChildren) {\n setPrevChildren(children);\n const newActiveExpander = getExpanderStateFromChildren();\n if (newActiveExpander) {\n setActiveExpander({ ...activeExpander, ...newActiveExpander });\n }\n }\n\n if (activeExpander === undefined) {\n const initialState = getExpanderStateFromChildren();\n if (initialState && Object.keys(initialState).length > 0) {\n setActiveExpander(initialState);\n }\n }\n\n return (\n <ul className={expanderListClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderList}>\n {React.Children.map(children, (child, index) => {\n if (isExpanderComponent(child)) {\n const id = getExpanderId(index);\n const expanded = activeExpander?.[id];\n const highlightTextChild: string | undefined = child.props.highlightText || highlightText;\n\n if (editMode) {\n return (\n <ListEditModeItem color={color} variant={variant} onDelete={child.props.onDelete}>\n {React.cloneElement(child, {\n id,\n key: index,\n expanded,\n padding: childPadding,\n color,\n large,\n 'aria-expanded': false,\n className: expanderListStyles['expander-list__item'],\n renderChildrenWhenClosed: false,\n variant,\n zIndex: zIndex,\n highlightText: highlightTextChild,\n editMode: true,\n })}\n </ListEditModeItem>\n );\n } else {\n return React.cloneElement(child as React.ReactElement<ExpanderProps>, {\n id,\n key: index,\n expanded,\n padding: childPadding,\n color,\n large,\n 'aria-expanded': expanded,\n className: expanderListStyles['expander-list__item'],\n handleExpanderClick: (event: React.MouseEvent<HTMLElement>) => handleExpanderClick(event, `${expanderIdBase}-${index}`),\n renderChildrenWhenClosed,\n variant,\n zIndex: zIndex,\n highlightText: highlightTextChild,\n });\n }\n }\n return child;\n })}\n </ul>\n );\n};\n\nconst ExpanderList = ExpanderListComponent as ExpanderListCompound;\n\nExpanderList.displayName = 'ExpanderList';\nExpanderList.Expander = Expander;\nExpander.displayName = 'ExpanderList.Expander';\n\nexport default ExpanderList;\n","import ExpanderList from './ExpanderList';\nexport * from './ExpanderList';\nexport default ExpanderList;\n"],"mappings":";;;;;;;;;;;;;;;AAqGA,IAAa,YAA0B,UAAyB;CAC9D,MAAM,EACJ,IACA,UACA,UAAU,MACV,QAAQ,WACR,YAAY,IACZ,MACA,QAAQ,OACR,OACA,kBAAkB,QAClB,WAAW,OACX,QACA,qBACA,UACA,0BACA,UAAU,QACV,SAAS,GACT,eACA,SAAS,QACT,WAAW,OACX,QACE;CACJ,MAAM,CAAC,cAAc,UAAU,UAAU,QAAQ;CACjD,MAAM,cAAc,OAAsB,IAAI;CAC9C,MAAM,aAAa,OAA0B,IAAI;CACjD,MAAM,EAAE,WAAW,cAAc,iBAAiB,UAAU;CAE5D,MAAM,SAAS,YAAY;CAC3B,MAAM,iBAAiB,YAAY;CACnC,MAAM,YAAY,YAAY;CAC9B,MAAM,SAAS,YAAY;CAE3B,MAAM,cAAc,WAAW,WAAW,mBAAmB,wBAAwB;GAClF,mBAAmB,+BAA+B;GAClD,mBAAmB,8BAA8B,WAAW;GAC5D,mBAAmB,wCAAwC;G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MACQ;MACR,eAAe;MACf,UAAU;KACZ,CAAC;IACe,CAAA;SAGpB,OAAO,MAAM,aAAa,OAA4C;KACpE;KACA,KAAK;KACL;KACA,SAAS;KACT;KACA;KACA,iBAAiB;KACjB,WAAW,mBAAmB;KAC9B,sBAAsB,UAAyC,oBAAoB,OAAO,GAAG,eAAe,GAAG,OAAO;KACtH;KACA;KACQ;KACR,eAAe;IACjB,CAAC;GAEL;GACA,OAAO;EACT,CAAC;CACC,CAAA;AAER;AAEA,IAAM,eAAe;AAErB,aAAa,cAAc;AAC3B,aAAa,WAAW;AACxB,SAAS,cAAc;;;ACtWvB,IAAA,uBAAe"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/ExpanderList/ExpanderList.tsx","../../../src/components/ExpanderList/index.ts"],"sourcesContent":["import React, { useEffect, useId, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { PaletteNames } from '../../theme/palette';\nimport type { ElementHeaderType } from '../ElementHeader/ElementHeader';\nimport type { ListEditModeItemProps } from '../ListEditMode';\nimport type { TitleTags } from '../Title';\n\nimport { AnalyticsId } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { mergeRefs } from '../../utils/refs';\nimport { isElementInViewport } from '../../utils/viewport';\nimport { renderElementHeader } from '../ElementHeader/utils';\nimport Highlighter from '../Highlighter';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport ListEditModeItem from '../ListEditMode';\nimport { listEditModeWrapperClassnames } from '../ListEditMode/constants';\n\nimport expanderListStyles from './styles.module.scss';\n\nexport type ExpanderListColors = Extract<PaletteNames, 'white' | 'blueberry' | 'cherry' | 'neutral'>;\nexport interface ExpanderType extends React.FC<ExpanderProps> {\n ElementHeader?: ElementHeaderType;\n}\n\nexport interface ExpanderListCompound extends React.FC<ExpanderListProps> {\n Expander: ExpanderType;\n}\n\nexport type ExpanderListVariant = 'line' | 'outline' | 'fill' | 'fill-negative';\n\nexport type ExpanderListStatus = 'none' | 'new';\n\ninterface ExpanderListProps {\n /** Toggles accordion functionality for the expanders. */\n accordion?: boolean;\n /** Items in the ExpanderList */\n children: React.ReactNode;\n /** Toggles padding of child elements */\n childPadding?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the colors of the list. */\n color?: ExpanderListColors;\n /** Changes the font size. */\n large?: boolean;\n /** Whether to render children when closed (in which case they are hidden with CSS). Default: false */\n renderChildrenWhenClosed?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets visual priority */\n variant?: ExpanderListVariant;\n /** Overrides the default z-index of the expander header */\n zIndex?: number;\n /** Highlights text in title and content. Used for search results */\n highlightText?: string;\n /**\n * @experimental This prop is experimental and may change in the future.\n * Enables ListEditMode\n */\n editMode?: boolean;\n /** Ref passed to the ul element */\n ref?: React.Ref<HTMLUListElement | null>;\n}\n\ntype Modify<T, R> = Omit<T, keyof R> & R;\n\ntype ExpanderProps = Modify<\n React.HTMLAttributes<HTMLButtonElement>,\n {\n id?: string;\n title: React.ReactElement | string;\n /** Changes the underlying element of the title. Default: span*/\n titleHtmlMarkup?: TitleTags;\n children: React.ReactNode;\n className?: string;\n color?: ExpanderListColors;\n icon?: React.ReactElement;\n padding?: boolean;\n expanded?: boolean;\n large?: boolean;\n testId?: string;\n handleExpanderClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Called when expander is open/closed. */\n onExpand?: (isExpanded: boolean) => void;\n /** Overrides the default z-index of the expander header */\n zIndex?: number;\n /** Highlights text in title and content. Override if different from list. */\n highlightText?: string;\n /** Displays a status on the left side: default none */\n status?: ExpanderListStatus;\n /** Ref passed to the li element */\n ref?: React.Ref<HTMLLIElement | null>;\n }\n> &\n Pick<ExpanderListProps, 'renderChildrenWhenClosed' | 'variant'> &\n ListEditModeItemProps;\n\nexport const Expander: ExpanderType = (props: ExpanderProps) => {\n const {\n id,\n children,\n padding = true,\n color = 'neutral',\n className = '',\n icon,\n large = false,\n title,\n titleHtmlMarkup = 'span',\n expanded = false,\n testId,\n handleExpanderClick,\n onExpand,\n renderChildrenWhenClosed,\n variant = 'line',\n zIndex = 0,\n highlightText,\n status = 'none',\n editMode = false,\n ref,\n } = props;\n const [isExpanded] = useExpand(expanded, onExpand);\n const expanderRef = useRef<HTMLLIElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const { isHovered, isFocused } = usePseudoClasses(triggerRef);\n\n const isFill = variant === 'fill';\n const isFillNegative = variant === 'fill-negative';\n const isOutline = variant === 'outline';\n const isLine = variant === 'line';\n\n const itemClasses = classNames(className, expanderListStyles['expander-list__item'], {\n [expanderListStyles[`expander-list__item--fill`]]: isFill,\n [expanderListStyles[`expander-list__item--fill--${color}`]]: isFill,\n [expanderListStyles[`expander-list__item--fill-negative`]]: isFillNegative,\n [expanderListStyles[`expander-list__item--fill-negative--${color}`]]: isFillNegative,\n [expanderListStyles['expander-list__item--outline']]: isOutline,\n [expanderListStyles[`expander-list__item--outline--${color}`]]: isOutline,\n [expanderListStyles['expander-list__item--line']]: isLine,\n [expanderListStyles[`expander-list__item--line--${color}`]]: isLine,\n [expanderListStyles[`expander-list__item--new`]]: status === 'new',\n });\n\n const expanderClasses = classNames(expanderListStyles['expander-list-link'], expanderListStyles[`expander-list-link--${color}`], {\n [expanderListStyles[`expander-list-link--fill--${color}`]]: isFill,\n [expanderListStyles[`expander-list-link--fill-negative`]]: isFillNegative,\n [expanderListStyles[`expander-list-link--fill-negative--${color}`]]: isFillNegative,\n [expanderListStyles['expander-list-link--outline']]: isOutline,\n [expanderListStyles[`expander-list-link--outline--${color}`]]: isOutline,\n [expanderListStyles[`expander-list-link--line--${color}`]]: isLine,\n [expanderListStyles['expander-list-link--open']]: isExpanded,\n [expanderListStyles['expander-list-link--large']]: large,\n [expanderListStyles[`expander-list-link--new`]]: status === 'new',\n });\n\n const renderContent = (): React.ReactNode => {\n if (!renderChildrenWhenClosed && !isExpanded) {\n return null;\n }\n\n const mainContentClasses = classNames(expanderListStyles['expander-list-link__main-content'], {\n [expanderListStyles['expander-list-link__main-content--expanded']]: isExpanded,\n [expanderListStyles['expander-list-link__main-content--padding']]: padding,\n [expanderListStyles[`expander-list-link__main-content--outline--${color}`]]: isOutline,\n [expanderListStyles[`expander-list-link__main-content--new`]]: status === 'new',\n });\n\n return (\n <div className={mainContentClasses} data-state={isExpanded ? 'open' : 'closed'}>\n <Highlighter searchText={highlightText}>{children}</Highlighter>\n </div>\n );\n };\n\n const statusMarkerClasses = classNames(expanderListStyles['expander-list__item__status-marker'], {\n [expanderListStyles['expander-list__item__status-marker--new']]: status === 'new',\n });\n\n return (\n <>\n {editMode ? (\n <div className={itemClasses}>\n {status !== 'none' && <div className={statusMarkerClasses}></div>}\n <div id={id} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderListExpander} className={expanderClasses}>\n {renderElementHeader(title, {\n titleHtmlMarkup,\n isHovered: false,\n size: large ? 'large' : 'normal',\n parentType: 'expanderlist',\n chevronIcon: undefined,\n icon,\n highlightText,\n })}\n </div>\n </div>\n ) : (\n <li className={itemClasses} ref={mergeRefs([ref, expanderRef])}>\n {status !== 'none' && <div className={statusMarkerClasses}></div>}\n <button\n type=\"button\"\n id={id}\n onClick={handleExpanderClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.ExpanderListExpander}\n className={expanderClasses}\n ref={triggerRef}\n aria-expanded={isExpanded}\n style={{\n zIndex: isFocused ? zIndex + 1 : zIndex,\n }}\n >\n {renderElementHeader(title, {\n titleHtmlMarkup,\n isHovered: isHovered || isFocused,\n size: large ? 'large' : 'normal',\n parentType: 'expanderlist',\n chevronIcon: isExpanded ? ChevronUp : ChevronDown,\n icon,\n highlightText,\n })}\n </button>\n {renderContent()}\n </li>\n )}\n </>\n );\n};\n\ntype ActiveExpander = Record<string, boolean>;\n\nconst isExpanderComponent = (element: unknown | null | undefined): element is React.ReactElement<ExpanderProps> =>\n React.isValidElement<ExpanderProps>(element) && (element as React.ReactElement).type === Expander;\n\nconst ExpanderListComponent: React.FC<ExpanderListProps> = (props: ExpanderListProps) => {\n const {\n children,\n childPadding = true,\n large,\n renderChildrenWhenClosed = false,\n color = 'white',\n className = '',\n accordion = false,\n testId,\n variant,\n zIndex,\n highlightText,\n editMode = false,\n ref,\n } = props;\n const [prevChildren, setPrevChildren] = useState(children);\n const [activeExpander, setActiveExpander] = useState<ActiveExpander>();\n const [latestExpander, setLatestExpander] = useState<HTMLElement>();\n const expanderIdBase = useId();\n const expanderListClasses = classNames(expanderListStyles['expander-list'], className, {\n [expanderListStyles[`expander-list--outline--${color}`]]: variant === 'outline',\n [expanderListStyles[`expander-list--fill`]]: variant === 'fill' || variant === 'fill-negative',\n [listEditModeWrapperClassnames]: editMode,\n });\n\n function handleExpanderClick(event: React.MouseEvent<HTMLElement, MouseEvent>, id: string): void {\n setActiveExpander(prevState => (accordion ? { [id]: !prevState?.[id] } : { ...prevState, [id]: !prevState?.[id] }));\n setLatestExpander(event.currentTarget);\n }\n\n const getExpanderId = (index: number): string => `${expanderIdBase}-${index}`;\n\n useEffect(() => {\n if (accordion && latestExpander && !isElementInViewport(latestExpander)) {\n latestExpander.scrollIntoView();\n }\n }, [accordion, latestExpander]);\n\n const getExpanderStateFromChildren = (): ActiveExpander | undefined => {\n return React.Children.map(children, child => {\n if (isExpanderComponent(child)) {\n return child;\n }\n })?.reduce((acc, child, index) => {\n // Expanded-status skal bare settes dersom prop er satt av den som bruker komponenten\n if (typeof child.props.expanded !== 'undefined') {\n acc[getExpanderId(index)] = child.props.expanded;\n }\n return acc;\n }, {} as ActiveExpander);\n };\n\n if (children !== prevChildren) {\n setPrevChildren(children);\n const newActiveExpander = getExpanderStateFromChildren();\n if (newActiveExpander) {\n setActiveExpander({ ...activeExpander, ...newActiveExpander });\n }\n }\n\n if (activeExpander === undefined) {\n const initialState = getExpanderStateFromChildren();\n if (initialState && Object.keys(initialState).length > 0) {\n setActiveExpander(initialState);\n }\n }\n\n return (\n <ul className={expanderListClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderList}>\n {React.Children.map(children, (child, index) => {\n if (isExpanderComponent(child)) {\n const id = getExpanderId(index);\n const expanded = activeExpander?.[id];\n const highlightTextChild: string | undefined = child.props.highlightText || highlightText;\n const childProps = child.props;\n const sharedProps = {\n padding: childProps.padding ?? childPadding,\n color: childProps.color ?? color,\n large: childProps.large ?? large,\n className: classNames(expanderListStyles['expander-list__item'], childProps.className),\n variant: childProps.variant ?? variant,\n zIndex: childProps.zIndex ?? zIndex,\n highlightText: highlightTextChild,\n };\n\n if (editMode) {\n return (\n <ListEditModeItem color={color} variant={variant} onDelete={childProps.onDelete}>\n {React.cloneElement(child, {\n ...sharedProps,\n id,\n key: index,\n expanded,\n 'aria-expanded': false,\n renderChildrenWhenClosed: false,\n editMode: true,\n })}\n </ListEditModeItem>\n );\n } else {\n return React.cloneElement(child as React.ReactElement<ExpanderProps>, {\n ...sharedProps,\n id,\n key: index,\n expanded,\n 'aria-expanded': expanded,\n handleExpanderClick: (event: React.MouseEvent<HTMLElement>) => {\n childProps.handleExpanderClick?.(event);\n handleExpanderClick(event, id);\n },\n renderChildrenWhenClosed: childProps.renderChildrenWhenClosed ?? renderChildrenWhenClosed,\n });\n }\n }\n return child;\n })}\n </ul>\n );\n};\n\nconst ExpanderList = ExpanderListComponent as ExpanderListCompound;\n\nExpanderList.displayName = 'ExpanderList';\nExpanderList.Expander = Expander;\nExpander.displayName = 'ExpanderList.Expander';\n\nexport default ExpanderList;\n","import ExpanderList from './ExpanderList';\nexport * from './ExpanderList';\nexport default ExpanderList;\n"],"mappings":";;;;;;;;;;;;;;;AAqGA,IAAa,YAA0B,UAAyB;CAC9D,MAAM,EACJ,IACA,UACA,UAAU,MACV,QAAQ,WACR,YAAY,IACZ,MACA,QAAQ,OACR,OACA,kBAAkB,QAClB,WAAW,OACX,QACA,qBACA,UACA,0BACA,UAAU,QACV,SAAS,GACT,eACA,S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,oBAAkB,YAAY;EAC9F,UAAA,MAAM,SAAS,IAAI,WAAW,OAAO,UAAU;GAC9C,IAAI,oBAAoB,KAAK,GAAG;IAC9B,MAAM,KAAK,cAAc,KAAK;IAC9B,MAAM,WAAW,iBAAiB;IAClC,MAAM,qBAAyC,MAAM,MAAM,iBAAiB;IAC5E,MAAM,aAAa,MAAM;IACzB,MAAM,cAAc;KAClB,SAAS,WAAW,WAAW;KAC/B,OAAO,WAAW,SAAS;KAC3B,OAAO,WAAW,SAAS;KAC3B,WAAW,WAAW,mBAAmB,wBAAwB,WAAW,SAAS;KACrF,SAAS,WAAW,WAAW;KAC/B,QAAQ,WAAW,UAAU;KAC7B,eAAe;IACjB;IAEA,IAAI,UACF,OACE,oBAAC,sBAAD;KAAyB;KAAgB;KAAS,UAAU,WAAW;KACpE,UAAA,MAAM,aAAa,OAAO;MACzB,GAAG;MACH;MACA,KAAK;MACL;MACA,iBAAiB;MACjB,0BAA0B;MAC1B,UAAU;KACZ,CAAC;IACe,CAAA;SAGpB,OAAO,MAAM,aAAa,OAA4C;KACpE,GAAG;KACH;KACA,KAAK;KACL;KACA,iBAAiB;KACjB,sBAAsB,UAAyC;MAC7D,WAAW,sBAAsB,KAAK;MACtC,oBAAoB,OAAO,EAAE;KAC/B;KACA,0BAA0B,WAAW,4BAA4B;IACnE,CAAC;GAEL;GACA,OAAO;EACT,CAAC;CACC,CAAA;AAER;AAEA,IAAM,eAAe;AAErB,aAAa,cAAc;AAC3B,aAAa,WAAW;AACxB,SAAS,cAAc;;;ACvWvB,IAAA,uBAAe"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
@use '../../scss/spacers' as spacers;
|
|
3
3
|
@use '../../scss/font-settings' as font-settings;
|
|
4
4
|
@use '../../scss/breakpoints' as breakpoints;
|
|
5
|
-
@import '../../scss/supernova/styles/colors.css';
|
|
6
5
|
|
|
7
6
|
.expander-list {
|
|
8
7
|
--statusmarker-left-space: 8px;
|
|
@@ -73,12 +72,12 @@
|
|
|
73
72
|
|
|
74
73
|
&--white,
|
|
75
74
|
.expander-list-link--line--white {
|
|
76
|
-
background-color: var(--color-base-background-
|
|
75
|
+
background-color: var(--color-base-background-light);
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
&--outline {
|
|
81
|
-
background-color: var(--color-base-background-
|
|
80
|
+
background-color: var(--color-base-background-light);
|
|
82
81
|
|
|
83
82
|
&--white,
|
|
84
83
|
&--neutral {
|
|
@@ -130,12 +129,12 @@
|
|
|
130
129
|
|
|
131
130
|
&--white,
|
|
132
131
|
.expander-list-link--fill--white {
|
|
133
|
-
background-color: var(--color-base-background-
|
|
132
|
+
background-color: var(--color-base-background-light);
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
135
|
|
|
137
136
|
&--fill-negative {
|
|
138
|
-
background-color: var(--color-base-background-
|
|
137
|
+
background-color: var(--color-base-background-light);
|
|
139
138
|
}
|
|
140
139
|
|
|
141
140
|
&--fill,
|
|
@@ -161,7 +160,7 @@
|
|
|
161
160
|
background-color: transparent;
|
|
162
161
|
|
|
163
162
|
&--new {
|
|
164
|
-
background-color: var(--color-notification-
|
|
163
|
+
background-color: var(--color-notification-info);
|
|
165
164
|
}
|
|
166
165
|
}
|
|
167
166
|
}
|
|
@@ -178,7 +177,7 @@
|
|
|
178
177
|
justify-content: space-between;
|
|
179
178
|
align-items: center;
|
|
180
179
|
letter-spacing: unset;
|
|
181
|
-
color: var(--color-base-text-
|
|
180
|
+
color: var(--color-base-text-dark);
|
|
182
181
|
border: 0;
|
|
183
182
|
width: 100%;
|
|
184
183
|
outline: none;
|
|
@@ -195,7 +194,7 @@
|
|
|
195
194
|
}
|
|
196
195
|
|
|
197
196
|
&[aria-expanded='true'] {
|
|
198
|
-
border-bottom: 1px solid var(--color-action-border-
|
|
197
|
+
border-bottom: 1px solid var(--color-action-border-light-normal);
|
|
199
198
|
}
|
|
200
199
|
|
|
201
200
|
&--open {
|
|
@@ -203,11 +202,11 @@
|
|
|
203
202
|
}
|
|
204
203
|
|
|
205
204
|
&--fill-negative {
|
|
206
|
-
background-color: var(--color-base-background-
|
|
205
|
+
background-color: var(--color-base-background-light);
|
|
207
206
|
}
|
|
208
207
|
|
|
209
208
|
&:focus-visible {
|
|
210
|
-
outline: 0.25rem solid var(--color-action-border-
|
|
209
|
+
outline: 0.25rem solid var(--color-action-border-dark-focus);
|
|
211
210
|
}
|
|
212
211
|
|
|
213
212
|
&--white:not(.expander-list-link--outline, .expander-list-link--fill-negative) {
|
|
@@ -335,7 +334,7 @@
|
|
|
335
334
|
|
|
336
335
|
&--outline,
|
|
337
336
|
&--fill-negative {
|
|
338
|
-
background-color: var(--color-base-background-
|
|
337
|
+
background-color: var(--color-base-background-light);
|
|
339
338
|
|
|
340
339
|
&--blueberry {
|
|
341
340
|
&[aria-expanded='false'] {
|
|
@@ -17,10 +17,10 @@ var getResources = (language) => {
|
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/components/FavoriteButton/StarIcon.tsx
|
|
20
|
-
var normalStroke = "var(--color-action-graphics-
|
|
20
|
+
var normalStroke = "var(--color-action-graphics-dark-normal)";
|
|
21
21
|
var normalFill = "transparent";
|
|
22
|
-
var hoverFill = "var(--color-action-graphics-
|
|
23
|
-
var hoverStroke = "var(--color-action-graphics-
|
|
22
|
+
var hoverFill = "var(--color-action-graphics-dark-hover)";
|
|
23
|
+
var hoverStroke = "var(--color-action-graphics-dark-hover)";
|
|
24
24
|
var activeStroke = "var(--core-color-blueberry-800)";
|
|
25
25
|
var fillColor = (isChecked, isActive, isHovered) => {
|
|
26
26
|
if (isChecked) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/resources/HN.Designsystem.FavoriteButton.nb-NO.json","../../../src/components/FavoriteButton/resourceHelper.ts","../../../src/components/FavoriteButton/StarIcon.tsx","../../../src/components/FavoriteButton/FavoriteButton.tsx","../../../src/components/FavoriteButton/index.ts"],"sourcesContent":["{\n \"ariaLabel\": \"Favorittmarkering\"\n}\n","import type { HNDesignsystemFavoriteButton } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport nbNO from '../../resources/HN.Designsystem.FavoriteButton.nb-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemFavoriteButton => {\n switch (language) {\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import styles from './styles.module.scss';\n\nconst normalStroke = 'var(--color-action-graphics-onlight)';\nconst normalFill = 'transparent';\nconst hoverFill = 'var(--color-action-graphics-onlight-hover)';\nconst hoverStroke = 'var(--color-action-graphics-onlight-hover)';\nconst activeStroke = 'var(--core-color-blueberry-800)';\n\nconst fillColor = (isChecked: boolean, isActive: boolean, isHovered: boolean): string => {\n if (isChecked) {\n if (isActive) {\n return activeStroke;\n } else {\n if (isHovered) {\n return hoverStroke;\n } else {\n return normalStroke;\n }\n }\n } else {\n if (isHovered) {\n return hoverFill;\n } else {\n return normalFill;\n }\n }\n};\n\nconst strokeColor = (isActive: boolean, isHovered: boolean): string => {\n if (isActive) {\n return activeStroke;\n } else {\n if (isHovered) {\n return hoverStroke;\n } else {\n return normalStroke;\n }\n }\n};\n\nexport const starIconNormalMobile = (isChecked: boolean, isActive: boolean): React.JSX.Element => {\n return (\n <>\n <path\n d=\"M20.1026 31.1787L13.4007 34.7023C10.833 36.0523 7.83185 33.8719 8.32233 31.0126L9.60261 23.5492L4.17653 18.2675C2.09656 16.2428 3.24317 12.712 6.11581 12.2956L13.5982 11.2112L16.9493 4.42107C18.2332 1.81969 21.9426 1.81969 23.2265 4.42107L26.5776 11.2112L34.06 12.2956C36.9326 12.712 38.0792 16.2428 35.9993 18.2675L30.5732 23.5492L31.852 31.0044C32.3428 33.8651 29.3386 36.0456 26.7708 34.6925L20.1026 31.1787Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n display=\"block\"\n />\n <path\n d=\"M20.0961 26.5515L12.6372 30.4731L14.0621 22.1671L8.01953 16.2853L16.3582 15.0768L20.0877 7.52002L23.8171 15.0768L32.1558 16.2853L26.1133 22.1671L27.5381 30.4731L20.0961 26.5515Z\"\n stroke={strokeColor(isActive, false)}\n fill={fillColor(isChecked, isActive, false)}\n strokeWidth=\"2.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n );\n};\n\nexport const starIconHoverMobile = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M22.2128 31.4832L16.2246 36.117C13.9303 37.8924 10.5961 36.2662 10.5826 33.3653L10.5475 25.7929L4.28665 21.5336C1.88672 19.9009 2.40278 16.2246 5.15948 15.3158L12.3399 12.9486L14.461 5.67964C15.2736 2.89484 18.9267 2.2507 20.6428 4.58962L25.1221 10.6947L32.6791 10.4633C35.5804 10.3745 37.3227 13.6526 35.6259 16.0077L31.1994 22.1514L33.7534 29.2712C34.7335 32.0033 32.1536 34.6724 29.3898 33.7857L22.2128 31.4832Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M21.4079 26.8365L14.7433 31.9937L14.7041 23.5664L7.73204 18.8233L15.7342 16.1851L18.0947 8.09555L23.0798 14.8899L31.5016 14.6321L26.5722 21.4738L29.4178 29.4062L21.4079 26.8365Z\"\n stroke={strokeColor(isActive, true)}\n fill={fillColor(isChecked, isActive, true)}\n fillOpacity={isChecked ? '1' : '0.13'}\n strokeWidth=\"2.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\nexport const starIconNormalDesktop = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M30.1061 44.1854L20.3139 49.3338C17.7461 50.6838 14.745 48.5034 15.2355 45.6441L17.1061 34.7394L9.17653 27.0207C7.09656 24.9961 8.24318 21.4653 11.1158 21.0489L22.053 19.4638L26.9493 9.54278C28.2331 6.9414 31.9426 6.94139 33.2265 9.54278L38.1227 19.4638L49.06 21.0489C51.9326 21.4653 53.0792 24.9961 50.9993 27.0207L43.0697 34.7394L44.9389 45.6359C45.4296 48.4966 42.4254 50.6772 39.8576 49.324L30.1061 44.1854Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M30.0998 39.4723L19.5927 44.9966L21.5998 33.2961L13.0879 25.0106L24.8343 23.3082L30.0879 12.6632L35.3414 23.3082L47.0879 25.0106L38.576 33.2961L40.5831 44.9966L30.0998 39.4723Z\"\n stroke={strokeColor(isActive, false)}\n fill={fillColor(isChecked, isActive, false)}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\n\nexport const starIconHoverDesktop = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M33.1609 44.7458L24.4114 51.5164C22.1171 53.2918 18.783 51.6656 18.7695 48.7646L18.7181 37.7007L9.56864 31.4763C7.1687 29.8436 7.68476 26.1672 10.4415 25.2584L20.9373 21.7982L24.0364 11.1776C24.849 8.39281 28.5021 7.74867 30.2182 10.0876L36.7629 19.0077L47.8092 18.6695C50.7105 18.5807 52.4528 21.8588 50.756 24.2138L44.2872 33.1922L48.0201 43.5985C49.0002 46.3306 46.4203 48.9997 43.6565 48.113L33.1609 44.7458Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M32.3991 40.1029L23.0108 47.3678L22.9557 35.4965L13.1343 28.815L24.4067 25.0987L27.732 13.7031L34.7542 23.2741L46.6178 22.9109L39.674 32.5486L43.6823 43.7228L32.3991 40.1029Z\"\n stroke={strokeColor(isActive, true)}\n fill={fillColor(isChecked, isActive, true)}\n fillOpacity={isChecked ? '1' : '0.13'}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\n","import type { AriaAttributes } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { HTMLButtonProps } from '../../constants';\nimport type { HNDesignsystemFavoriteButton } from '../../resources/Resources';\n\nimport { getResources } from './resourceHelper';\nimport { starIconHoverDesktop, starIconHoverMobile, starIconNormalDesktop, starIconNormalMobile } from './StarIcon';\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { isMutableRefObject } from '../../utils/refs';\n\nimport styles from './styles.module.scss';\n\nexport interface FavoriteButtonProps extends Omit<HTMLButtonProps, 'type'>, AriaAttributes {\n /** Determines if the FavoriteButton is checked */\n checked: boolean;\n /** Gives a unique id to the button */\n id?: string;\n /** Function that is called when clicked */\n onClick: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Resources for component */\n resources?: Partial<HNDesignsystemFavoriteButton>;\n /** Specifies the focus order relative to the other buttons or controls on the page */\n tabIndex?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Ref passed to the button element */\n ref?: React.Ref<HTMLButtonElement | null>;\n}\n\nexport const FavoriteButton: React.FC<FavoriteButtonProps> = (props: FavoriteButtonProps) => {\n const { checked, id, onClick, resources, tabIndex, testId, ref, ...other } = props;\n\n const buttonWrapperClasses = classNames(styles.favoritebutton);\n const { refObject, isHovered, isActive } = usePseudoClasses<HTMLButtonElement>(isMutableRefObject(ref) ? ref : null);\n const breakpoint = useBreakpoint();\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemFavoriteButton = {\n ...defaultResources,\n ...resources,\n ariaLabel: other['aria-label'] || resources?.ariaLabel || defaultResources.ariaLabel,\n };\n\n const isMobile = breakpoint <= Breakpoint.sm;\n\n const starIcon = ((): React.JSX.Element => {\n if (isMobile) {\n if (isHovered) {\n return starIconHoverMobile(checked, isActive);\n } else {\n return starIconNormalMobile(checked, isActive);\n }\n } else {\n if (isHovered) {\n return starIconHoverDesktop(checked, isActive);\n } else {\n return starIconNormalDesktop(checked, isActive);\n }\n }\n })();\n\n return (\n <button\n id={id}\n onClick={onClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.FavoriteButton}\n className={buttonWrapperClasses}\n ref={refObject}\n tabIndex={tabIndex}\n role=\"switch\"\n aria-checked={checked}\n type=\"button\"\n aria-label={mergedResources.ariaLabel}\n {...other}\n >\n <svg focusable={false} overflow=\"visible\" role=\"presentation\" viewBox={isMobile ? '0 0 41 41' : '0 0 61 61'}>\n {starIcon}\n </svg>\n </button>\n );\n};\n\nFavoriteButton.displayName = 'FavoriteButton';\n\nexport default FavoriteButton;\n","export * from './FavoriteButton';\n\nimport { FavoriteButton } from './FavoriteButton';\nexport default FavoriteButton;\n"],"mappings":";;;;;;;;;;;ACKA,IAAa,gBAAgB,aAA4D;CACvF,QAAQ,UAAR;EACE,KAAK,gBAAgB;EACrB,SACE,OAAO;CACX;AACF;;;ACTA,IAAM,eAAe;AACrB,IAAM,aAAa;AACnB,IAAM,YAAY;AAClB,IAAM,cAAc;AACpB,IAAM,eAAe;AAErB,IAAM,aAAa,WAAoB,UAAmB,cAA+B;CACvF,IAAI,WAAW;EACb,IAAI,UACF,OAAO;OAEP,IAAI,WACF,OAAO;OAEP,OAAO;CAGb,OACE,IAAI,WACF,OAAO;MAEP,OAAO;AAGb;AAEA,IAAM,eAAe,UAAmB,cAA+B;CACrE,IAAI,UACF,OAAO;MAEP,IAAI,WACF,OAAO;MAEP,OAAO;AAGb;AAEA,IAAa,wBAAwB,WAAoB,aAAyC;CAChG,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAD;EACE,GA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;CACd,gBAAe;AAChB,CAAA,CACD,EAAA,CAAA;;;AC3FJ,IAAa,kBAAiD,UAA+B;CAC3F,MAAM,EAAE,SAAS,IAAI,SAAS,WAAW,UAAU,QAAQ,KAAK,GAAG,UAAU;CAE7E,MAAM,uBAAuB,WAAW,OAAO,cAAc;CAC7D,MAAM,EAAE,WAAW,WAAW,aAAa,iBAAoC,mBAAmB,GAAG,IAAI,MAAM,IAAI;CACnH,MAAM,aAAa,cAAc;CACjC,MAAM,EAAE,aAAa,YAA6B,gBAAgB,SAAS;CAC3E,MAAM,mBAAmB,aAAa,QAAQ;CAE9C,MAAM,kBAAgD;EACpD,GAAG;EACH,GAAG;EACH,WAAW,MAAM,iBAAiB,WAAW,aAAa,iBAAiB;CAC7E;CAEA,MAAM,WAAW,cAAc,WAAW;CAE1C,MAAM,kBAAqC;EACzC,IAAI,UAAU;GACZ,IAAI,WACF,OAAO,oBAAoB,SAAS,QAAQ;QAE5C,OAAO,qBAAqB,SAAS,QAAQ;EAEjD,OACE,IAAI,WACF,OAAO,qBAAqB,SAAS,QAAQ;OAE7C,OAAO,sBAAsB,SAAS,QAAQ;CAGpD,EAAA,CAAG;CAEH,OACE,oBAAC,UAAD;EACM;EACK;EACT,eAAa;EACb,oBAAkB,YAAY;EAC9B,WAAW;EACX,KAAK;EACK;EACV,MAAK;EACL,gBAAc;EACd,MAAK;EACL,cAAY,gBAAgB;EAC5B,GAAI;EAEJ,UAAA,oBAAC,OAAD;GAAK,WAAW;GAAO,UAAS;GAAU,MAAK;GAAe,SAAS,WAAW,cAAc;GAC7F,UAAA;EACE,CAAA;CACC,CAAA;AAEZ;AAEA,eAAe,cAAc;;;ACtF7B,IAAA,yBAAe"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/resources/HN.Designsystem.FavoriteButton.nb-NO.json","../../../src/components/FavoriteButton/resourceHelper.ts","../../../src/components/FavoriteButton/StarIcon.tsx","../../../src/components/FavoriteButton/FavoriteButton.tsx","../../../src/components/FavoriteButton/index.ts"],"sourcesContent":["{\n \"ariaLabel\": \"Favorittmarkering\"\n}\n","import type { HNDesignsystemFavoriteButton } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport nbNO from '../../resources/HN.Designsystem.FavoriteButton.nb-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemFavoriteButton => {\n switch (language) {\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import styles from './styles.module.scss';\n\nconst normalStroke = 'var(--color-action-graphics-dark-normal)';\nconst normalFill = 'transparent';\nconst hoverFill = 'var(--color-action-graphics-dark-hover)';\nconst hoverStroke = 'var(--color-action-graphics-dark-hover)';\nconst activeStroke = 'var(--core-color-blueberry-800)';\n\nconst fillColor = (isChecked: boolean, isActive: boolean, isHovered: boolean): string => {\n if (isChecked) {\n if (isActive) {\n return activeStroke;\n } else {\n if (isHovered) {\n return hoverStroke;\n } else {\n return normalStroke;\n }\n }\n } else {\n if (isHovered) {\n return hoverFill;\n } else {\n return normalFill;\n }\n }\n};\n\nconst strokeColor = (isActive: boolean, isHovered: boolean): string => {\n if (isActive) {\n return activeStroke;\n } else {\n if (isHovered) {\n return hoverStroke;\n } else {\n return normalStroke;\n }\n }\n};\n\nexport const starIconNormalMobile = (isChecked: boolean, isActive: boolean): React.JSX.Element => {\n return (\n <>\n <path\n d=\"M20.1026 31.1787L13.4007 34.7023C10.833 36.0523 7.83185 33.8719 8.32233 31.0126L9.60261 23.5492L4.17653 18.2675C2.09656 16.2428 3.24317 12.712 6.11581 12.2956L13.5982 11.2112L16.9493 4.42107C18.2332 1.81969 21.9426 1.81969 23.2265 4.42107L26.5776 11.2112L34.06 12.2956C36.9326 12.712 38.0792 16.2428 35.9993 18.2675L30.5732 23.5492L31.852 31.0044C32.3428 33.8651 29.3386 36.0456 26.7708 34.6925L20.1026 31.1787Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n display=\"block\"\n />\n <path\n d=\"M20.0961 26.5515L12.6372 30.4731L14.0621 22.1671L8.01953 16.2853L16.3582 15.0768L20.0877 7.52002L23.8171 15.0768L32.1558 16.2853L26.1133 22.1671L27.5381 30.4731L20.0961 26.5515Z\"\n stroke={strokeColor(isActive, false)}\n fill={fillColor(isChecked, isActive, false)}\n strokeWidth=\"2.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n );\n};\n\nexport const starIconHoverMobile = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M22.2128 31.4832L16.2246 36.117C13.9303 37.8924 10.5961 36.2662 10.5826 33.3653L10.5475 25.7929L4.28665 21.5336C1.88672 19.9009 2.40278 16.2246 5.15948 15.3158L12.3399 12.9486L14.461 5.67964C15.2736 2.89484 18.9267 2.2507 20.6428 4.58962L25.1221 10.6947L32.6791 10.4633C35.5804 10.3745 37.3227 13.6526 35.6259 16.0077L31.1994 22.1514L33.7534 29.2712C34.7335 32.0033 32.1536 34.6724 29.3898 33.7857L22.2128 31.4832Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M21.4079 26.8365L14.7433 31.9937L14.7041 23.5664L7.73204 18.8233L15.7342 16.1851L18.0947 8.09555L23.0798 14.8899L31.5016 14.6321L26.5722 21.4738L29.4178 29.4062L21.4079 26.8365Z\"\n stroke={strokeColor(isActive, true)}\n fill={fillColor(isChecked, isActive, true)}\n fillOpacity={isChecked ? '1' : '0.13'}\n strokeWidth=\"2.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\nexport const starIconNormalDesktop = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M30.1061 44.1854L20.3139 49.3338C17.7461 50.6838 14.745 48.5034 15.2355 45.6441L17.1061 34.7394L9.17653 27.0207C7.09656 24.9961 8.24318 21.4653 11.1158 21.0489L22.053 19.4638L26.9493 9.54278C28.2331 6.9414 31.9426 6.94139 33.2265 9.54278L38.1227 19.4638L49.06 21.0489C51.9326 21.4653 53.0792 24.9961 50.9993 27.0207L43.0697 34.7394L44.9389 45.6359C45.4296 48.4966 42.4254 50.6772 39.8576 49.324L30.1061 44.1854Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M30.0998 39.4723L19.5927 44.9966L21.5998 33.2961L13.0879 25.0106L24.8343 23.3082L30.0879 12.6632L35.3414 23.3082L47.0879 25.0106L38.576 33.2961L40.5831 44.9966L30.0998 39.4723Z\"\n stroke={strokeColor(isActive, false)}\n fill={fillColor(isChecked, isActive, false)}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\n\nexport const starIconHoverDesktop = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M33.1609 44.7458L24.4114 51.5164C22.1171 53.2918 18.783 51.6656 18.7695 48.7646L18.7181 37.7007L9.56864 31.4763C7.1687 29.8436 7.68476 26.1672 10.4415 25.2584L20.9373 21.7982L24.0364 11.1776C24.849 8.39281 28.5021 7.74867 30.2182 10.0876L36.7629 19.0077L47.8092 18.6695C50.7105 18.5807 52.4528 21.8588 50.756 24.2138L44.2872 33.1922L48.0201 43.5985C49.0002 46.3306 46.4203 48.9997 43.6565 48.113L33.1609 44.7458Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M32.3991 40.1029L23.0108 47.3678L22.9557 35.4965L13.1343 28.815L24.4067 25.0987L27.732 13.7031L34.7542 23.2741L46.6178 22.9109L39.674 32.5486L43.6823 43.7228L32.3991 40.1029Z\"\n stroke={strokeColor(isActive, true)}\n fill={fillColor(isChecked, isActive, true)}\n fillOpacity={isChecked ? '1' : '0.13'}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\n","import type { AriaAttributes } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { HTMLButtonProps } from '../../constants';\nimport type { HNDesignsystemFavoriteButton } from '../../resources/Resources';\n\nimport { getResources } from './resourceHelper';\nimport { starIconHoverDesktop, starIconHoverMobile, starIconNormalDesktop, starIconNormalMobile } from './StarIcon';\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { isMutableRefObject } from '../../utils/refs';\n\nimport styles from './styles.module.scss';\n\nexport interface FavoriteButtonProps extends Omit<HTMLButtonProps, 'type'>, AriaAttributes {\n /** Determines if the FavoriteButton is checked */\n checked: boolean;\n /** Gives a unique id to the button */\n id?: string;\n /** Function that is called when clicked */\n onClick: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Resources for component */\n resources?: Partial<HNDesignsystemFavoriteButton>;\n /** Specifies the focus order relative to the other buttons or controls on the page */\n tabIndex?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Ref passed to the button element */\n ref?: React.Ref<HTMLButtonElement | null>;\n}\n\nexport const FavoriteButton: React.FC<FavoriteButtonProps> = (props: FavoriteButtonProps) => {\n const { checked, id, onClick, resources, tabIndex, testId, ref, ...other } = props;\n\n const buttonWrapperClasses = classNames(styles.favoritebutton);\n const { refObject, isHovered, isActive } = usePseudoClasses<HTMLButtonElement>(isMutableRefObject(ref) ? ref : null);\n const breakpoint = useBreakpoint();\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemFavoriteButton = {\n ...defaultResources,\n ...resources,\n ariaLabel: other['aria-label'] || resources?.ariaLabel || defaultResources.ariaLabel,\n };\n\n const isMobile = breakpoint <= Breakpoint.sm;\n\n const starIcon = ((): React.JSX.Element => {\n if (isMobile) {\n if (isHovered) {\n return starIconHoverMobile(checked, isActive);\n } else {\n return starIconNormalMobile(checked, isActive);\n }\n } else {\n if (isHovered) {\n return starIconHoverDesktop(checked, isActive);\n } else {\n return starIconNormalDesktop(checked, isActive);\n }\n }\n })();\n\n return (\n <button\n id={id}\n onClick={onClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.FavoriteButton}\n className={buttonWrapperClasses}\n ref={refObject}\n tabIndex={tabIndex}\n role=\"switch\"\n aria-checked={checked}\n type=\"button\"\n aria-label={mergedResources.ariaLabel}\n {...other}\n >\n <svg focusable={false} overflow=\"visible\" role=\"presentation\" viewBox={isMobile ? '0 0 41 41' : '0 0 61 61'}>\n {starIcon}\n </svg>\n </button>\n );\n};\n\nFavoriteButton.displayName = 'FavoriteButton';\n\nexport default FavoriteButton;\n","export * from './FavoriteButton';\n\nimport { FavoriteButton } from './FavoriteButton';\nexport default FavoriteButton;\n"],"mappings":";;;;;;;;;;;ACKA,IAAa,gBAAgB,aAA4D;CACvF,QAAQ,UAAR;EACE,KAAK,gBAAgB;EACrB,SACE,OAAO;CACX;AACF;;;ACTA,IAAM,eAAe;AACrB,IAAM,aAAa;AACnB,IAAM,YAAY;AAClB,IAAM,cAAc;AACpB,IAAM,eAAe;AAErB,IAAM,aAAa,WAAoB,UAAmB,cAA+B;CACvF,IAAI,WAAW;EACb,IAAI,UACF,OAAO;OAEP,IAAI,WACF,OAAO;OAEP,OAAO;CAGb,OACE,IAAI,WACF,OAAO;MAEP,OAAO;AAGb;AAEA,IAAM,eAAe,UAAmB,cAA+B;CACrE,IAAI,UACF,OAAO;MAEP,IAAI,WACF,OAAO;MAEP,OAAO;AAGb;AAEA,IAAa,wBAAwB,WAAoB,aAAyC;CAChG,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oB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button {
|
|
6
5
|
width: fit-content;
|
|
@@ -15,7 +14,7 @@
|
|
|
15
14
|
&__inner {
|
|
16
15
|
border-radius: 100px;
|
|
17
16
|
height: 2rem;
|
|
18
|
-
background-color: var(--color-action-graphics-
|
|
17
|
+
background-color: var(--color-action-graphics-dark-normal);
|
|
19
18
|
border: 1px solid transparent;
|
|
20
19
|
display: flex;
|
|
21
20
|
flex-flow: row nowrap;
|
|
@@ -28,16 +27,16 @@
|
|
|
28
27
|
|
|
29
28
|
&--hovered,
|
|
30
29
|
&:hover {
|
|
31
|
-
background-color: var(--color-action-graphics-
|
|
30
|
+
background-color: var(--color-action-graphics-dark-hover);
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
.filter-button:active & {
|
|
35
|
-
background-color: var(--color-action-background-
|
|
34
|
+
background-color: var(--color-action-background-dark-plus1-active, #06596c);
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
.filter-button:focus-visible & {
|
|
39
|
-
outline: 4px solid var(--color-action-border-
|
|
40
|
-
border-color: var(--color-action-border-
|
|
38
|
+
outline: 4px solid var(--color-action-border-dark-focus);
|
|
39
|
+
border-color: var(--color-action-border-light-focus);
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
svg {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use '../../../scss/breakpoints' as breakpoints;
|
|
3
|
-
@import '../../../scss/supernova/styles/colors.css';
|
|
4
3
|
|
|
5
4
|
.link-list {
|
|
6
5
|
list-style: none;
|
|
@@ -24,10 +23,10 @@
|
|
|
24
23
|
padding-right: 0;
|
|
25
24
|
min-height: 4rem;
|
|
26
25
|
text-decoration: none;
|
|
27
|
-
color: var(--color-base-text-
|
|
26
|
+
color: var(--color-base-text-dark);
|
|
28
27
|
cursor: pointer;
|
|
29
28
|
width: 100%;
|
|
30
|
-
background-color: var(--color-base-background-
|
|
29
|
+
background-color: var(--color-base-background-light);
|
|
31
30
|
border: none;
|
|
32
31
|
text-align: left;
|
|
33
32
|
box-sizing: border-box;
|
|
@@ -48,7 +47,7 @@
|
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
&:focus-visible {
|
|
51
|
-
outline: 4px solid var(--color-action-border-
|
|
50
|
+
outline: 4px solid var(--color-action-border-dark-focus);
|
|
52
51
|
outline-offset: 0; // Override user agent default
|
|
53
52
|
position: relative;
|
|
54
53
|
z-index: 1;
|
|
@@ -73,7 +72,7 @@
|
|
|
73
72
|
|
|
74
73
|
&__chip {
|
|
75
74
|
box-sizing: border-box;
|
|
76
|
-
height: 1.625rem;
|
|
75
|
+
min-height: 1.625rem;
|
|
77
76
|
margin-top: 0.375rem;
|
|
78
77
|
margin-bottom: 6px;
|
|
79
78
|
background-color: var(--core-color-blueberry-50);
|
|
@@ -90,7 +89,7 @@
|
|
|
90
89
|
padding-right: 0.75rem;
|
|
91
90
|
|
|
92
91
|
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
93
|
-
height: 1.875rem;
|
|
92
|
+
min-height: 1.875rem;
|
|
94
93
|
padding-top: 0.3125rem;
|
|
95
94
|
margin-top: 0.4375rem;
|
|
96
95
|
margin-bottom: 0.4375rem;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
@import '../../../scss/supernova/styles/colors.css';
|
|
2
|
-
@import '../../../scss/supernova/styles/spacers.css';
|
|
3
|
-
|
|
4
1
|
.filter-overview-search {
|
|
5
2
|
width: 100%;
|
|
6
3
|
padding: var(--core-space-s);
|
|
7
4
|
padding-right: var(--core-space-xl);
|
|
8
|
-
background-color: var(--color-base-background-
|
|
5
|
+
background-color: var(--color-base-background-light);
|
|
9
6
|
border-bottom: 1px solid var(--component-listelements-border-neutral-normal);
|
|
10
7
|
|
|
11
8
|
&:first-child {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use '../../../scss/breakpoints' as breakpoints;
|
|
3
3
|
@use '../../../scss/screen-reader' as sr;
|
|
4
|
-
@import '../../../scss/supernova/styles/spacers.css';
|
|
5
4
|
|
|
6
5
|
.filter-search {
|
|
7
6
|
&__wrapper {
|
|
@@ -31,7 +30,7 @@
|
|
|
31
30
|
height: 2rem;
|
|
32
31
|
width: 100%;
|
|
33
32
|
border-radius: 100px;
|
|
34
|
-
border: 2px solid var(--color-base-border-
|
|
33
|
+
border: 2px solid var(--color-base-emphasized-border-dark);
|
|
35
34
|
background-color: var(--core-color-white);
|
|
36
35
|
padding: 0.375rem calc(var(--core-space-2xs) + var(--icon-size) + var(--core-space-3xs));
|
|
37
36
|
text-overflow: ellipsis;
|
|
@@ -64,26 +63,26 @@
|
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
&:not(:disabled)::placeholder {
|
|
67
|
-
color: var(--color-base-text-
|
|
66
|
+
color: var(--color-base-text-dark);
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
&--hovered,
|
|
71
70
|
&:hover,
|
|
72
71
|
&:active {
|
|
73
|
-
outline: 1px solid var(--color-base-border-
|
|
72
|
+
outline: 1px solid var(--color-base-emphasized-border-dark);
|
|
74
73
|
background-color: var(--core-color-neutral-50);
|
|
75
74
|
z-index: 1;
|
|
76
75
|
}
|
|
77
76
|
|
|
78
77
|
&:focus-visible {
|
|
79
|
-
border-color: var(--color-action-border-
|
|
80
|
-
outline: 2px solid var(--color-action-border-
|
|
78
|
+
border-color: var(--color-action-border-dark-focus);
|
|
79
|
+
outline: 2px solid var(--color-action-border-dark-focus);
|
|
81
80
|
z-index: 1;
|
|
82
81
|
}
|
|
83
82
|
|
|
84
83
|
&:disabled {
|
|
85
84
|
cursor: not-allowed;
|
|
86
|
-
border: 2px dashed var(--color-disabled-border);
|
|
85
|
+
border: 2px dashed var(--color-disabled-border-dark);
|
|
87
86
|
outline: none;
|
|
88
87
|
color: var(--color-disabled-text);
|
|
89
88
|
background-color: transparent;
|
|
@@ -102,14 +101,14 @@
|
|
|
102
101
|
padding: 0;
|
|
103
102
|
|
|
104
103
|
svg {
|
|
105
|
-
fill: var(--color-action-graphics-
|
|
104
|
+
fill: var(--color-action-graphics-dark-normal);
|
|
106
105
|
}
|
|
107
106
|
|
|
108
107
|
&:disabled {
|
|
109
108
|
cursor: not-allowed;
|
|
110
109
|
|
|
111
110
|
svg {
|
|
112
|
-
fill: var(--color-disabled-graphics);
|
|
111
|
+
fill: var(--color-disabled-graphics-dark);
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
114
|
}
|
|
@@ -133,7 +132,7 @@
|
|
|
133
132
|
width: 2.75rem;
|
|
134
133
|
height: 2rem;
|
|
135
134
|
background-color: var(--core-color-white);
|
|
136
|
-
border: 2px solid var(--color-base-border-
|
|
135
|
+
border: 2px solid var(--color-base-emphasized-border-dark);
|
|
137
136
|
border-radius: 0 100px 100px 0;
|
|
138
137
|
padding-right: 0.3125rem;
|
|
139
138
|
|
|
@@ -143,13 +142,13 @@
|
|
|
143
142
|
}
|
|
144
143
|
|
|
145
144
|
:disabled > & {
|
|
146
|
-
border: 2px dashed var(--color-disabled-border);
|
|
145
|
+
border: 2px dashed var(--color-disabled-border-dark);
|
|
147
146
|
background: transparent;
|
|
148
147
|
}
|
|
149
148
|
|
|
150
149
|
:hover > &:not(:disabled > &),
|
|
151
150
|
:active > &:not(:disabled > &) {
|
|
152
|
-
outline: 1px solid var(--color-base-border-
|
|
151
|
+
outline: 1px solid var(--color-base-emphasized-border-dark);
|
|
153
152
|
}
|
|
154
153
|
|
|
155
154
|
:hover > &:not(:disabled > &) {
|
|
@@ -161,8 +160,8 @@
|
|
|
161
160
|
}
|
|
162
161
|
|
|
163
162
|
:focus-visible > &:not(:disabled > &) {
|
|
164
|
-
border-color: var(--color-action-border-
|
|
165
|
-
outline: 2px solid var(--color-action-border-
|
|
163
|
+
border-color: var(--color-action-border-dark-focus);
|
|
164
|
+
outline: 2px solid var(--color-action-border-dark-focus);
|
|
166
165
|
z-index: 1;
|
|
167
166
|
}
|
|
168
167
|
|
|
@@ -195,7 +194,7 @@
|
|
|
195
194
|
}
|
|
196
195
|
|
|
197
196
|
&:focus-visible:not(:disabled) {
|
|
198
|
-
outline: 4px solid var(--color-action-border-
|
|
197
|
+
outline: 4px solid var(--color-action-border-dark-focus);
|
|
199
198
|
}
|
|
200
199
|
|
|
201
200
|
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use '../../../scss/breakpoints' as breakpoints;
|
|
3
|
-
@import '../../../scss/supernova/styles/spacers.css';
|
|
4
3
|
|
|
5
4
|
.select {
|
|
6
5
|
select {
|
|
7
6
|
outline: none;
|
|
8
7
|
text-align: right;
|
|
9
8
|
text-align-last: right;
|
|
10
|
-
color: var(--color-action-text-
|
|
9
|
+
color: var(--color-action-text-dark-normal);
|
|
11
10
|
padding-right: 3rem;
|
|
12
11
|
height: 2.75rem;
|
|
13
12
|
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use '../../../scss/font-settings' as fontSettings;
|
|
3
3
|
@use '../../../scss/breakpoints' as breakpoints;
|
|
4
|
-
@import '../../../scss/supernova/styles/colors.css';
|
|
5
|
-
@import '../../../scss/supernova/styles/spacers.css';
|
|
6
4
|
|
|
7
5
|
.loader-spinner {
|
|
8
6
|
display: inline-flex;
|
|
@@ -13,7 +11,7 @@
|
|
|
13
11
|
position: relative;
|
|
14
12
|
display: inline-flex;
|
|
15
13
|
flex-shrink: 0;
|
|
16
|
-
stroke: var(--color-action-graphics-
|
|
14
|
+
stroke: var(--color-action-graphics-dark-normal);
|
|
17
15
|
top: 6px;
|
|
18
16
|
|
|
19
17
|
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
@@ -22,6 +20,6 @@
|
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
&__text {
|
|
25
|
-
color: var(--color-base-text-
|
|
23
|
+
color: var(--color-base-text-dark);
|
|
26
24
|
}
|
|
27
25
|
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use '../../scss/breakpoints' as breakpoints;
|
|
3
3
|
@use '../../scss/font-mixins' as fonts;
|
|
4
|
-
@import '../../scss/supernova/styles/colors.css';
|
|
5
|
-
@import '../../scss/supernova/styles/spacers.css';
|
|
6
4
|
|
|
7
5
|
.help-details {
|
|
8
6
|
@include fonts.help-text;
|
|
9
7
|
|
|
10
|
-
color: var(--color-base-text-
|
|
11
|
-
background-color: var(--color-help-background
|
|
8
|
+
color: var(--color-base-text-dark);
|
|
9
|
+
background-color: var(--color-help-background);
|
|
12
10
|
border: 1px solid var(--color-help-border-subtle-wcag);
|
|
13
11
|
border-radius: 0.25rem;
|
|
14
12
|
position: relative;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type HelpPanelVariants = 'normal' | '
|
|
1
|
+
export type HelpPanelVariants = 'normal' | 'subdued';
|
|
2
2
|
export interface HelpPanelProps {
|
|
3
3
|
/** The content of the component */
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
-
/**
|
|
5
|
+
/** Sets the visual variant */
|
|
6
6
|
variant?: HelpPanelVariants;
|
|
7
7
|
/** Adds custom classes to the element. */
|
|
8
8
|
className?: string;
|
|
@@ -9,10 +9,7 @@ import styles from "./styles.module.scss";
|
|
|
9
9
|
//#region src/components/HelpPanel/HelpPanel.tsx
|
|
10
10
|
var HelpPanel = ({ className, variant = "normal", testId, children, title }) => {
|
|
11
11
|
const isMobile = useIsMobileBreakpoint();
|
|
12
|
-
const containerClassName = classNames(styles["help-panel"], {
|
|
13
|
-
[styles["help-panel--compact"]]: variant === "compact",
|
|
14
|
-
[styles["help-panel--subdued"]]: variant === "subdued"
|
|
15
|
-
}, className);
|
|
12
|
+
const containerClassName = classNames(styles["help-panel"], { [styles["help-panel--subdued"]]: variant === "subdued" }, className);
|
|
16
13
|
const renderContent = () => {
|
|
17
14
|
const titleElement = title && /* @__PURE__ */ jsx(Title_default, {
|
|
18
15
|
testId: "titleId",
|
|
@@ -21,19 +18,6 @@ var HelpPanel = ({ className, variant = "normal", testId, children, title }) =>
|
|
|
21
18
|
children: title
|
|
22
19
|
});
|
|
23
20
|
const iconSize = isMobile ? IconSize.XSmall : IconSize.Small;
|
|
24
|
-
if (variant === "compact") return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
25
|
-
className: classNames(styles["help-panel__icon"], styles["help-panel__icon--compact"]),
|
|
26
|
-
children: /* @__PURE__ */ jsx(Icon_default, {
|
|
27
|
-
svgIcon: HandWaving,
|
|
28
|
-
size: iconSize
|
|
29
|
-
})
|
|
30
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
31
|
-
className: classNames(styles["help-panel__content"], styles["help-panel__content--compact"]),
|
|
32
|
-
children: [title && /* @__PURE__ */ jsx("div", {
|
|
33
|
-
className: styles["help-panel__title-wrapper"],
|
|
34
|
-
children: titleElement
|
|
35
|
-
}), children]
|
|
36
|
-
})] });
|
|
37
21
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
38
22
|
className: styles["help-panel__icon"],
|
|
39
23
|
children: /* @__PURE__ */ jsx(Icon_default, {
|