@helsenorge/designsystem-react 15.0.0 → 15.2.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 +24 -19
- package/lib/Button.js.map +1 -1
- package/lib/CHANGELOG.md +25 -0
- package/lib/Drawer.js +46 -18
- package/lib/Drawer.js.map +1 -1
- package/lib/Expander.js +4 -4
- package/lib/Expander.js.map +1 -1
- package/lib/FilterButtonAndChipsWrapper.js +15 -3
- package/lib/FilterButtonAndChipsWrapper.js.map +1 -1
- package/lib/FilterLinkList.js +3 -2
- package/lib/FilterLinkList.js.map +1 -1
- package/lib/FilterOverviewLinkList.js +10 -1
- package/lib/FilterOverviewLinkList.js.map +1 -1
- package/lib/InfoTeaser.js +1 -1
- package/lib/InfoTeaser.js.map +1 -1
- package/lib/components/Button/styles.module.scss +39 -16
- package/lib/components/Button/styles.module.scss.d.ts +3 -2
- package/lib/components/Drawer/DrawerBackButton.d.ts +10 -0
- package/lib/components/Drawer/DrawerBackButton.module.scss +52 -0
- package/lib/components/Drawer/DrawerBackButton.module.scss.d.ts +10 -0
- package/lib/components/Drawer/styles.module.scss +0 -9
- package/lib/components/Expander/Expander.d.ts +2 -0
- package/lib/components/Expander/styles.module.scss +24 -12
- package/lib/components/Expander/styles.module.scss.d.ts +5 -2
- package/lib/components/Filter/FilterButtonAndChipsWrapper/FilterButtonAndChipsWrapper.d.ts +3 -0
- package/lib/components/Filter/FilterButtonAndChipsWrapper/styles.module.scss +18 -2
- package/lib/components/Filter/FilterButtonAndChipsWrapper/styles.module.scss.d.ts +1 -0
- package/lib/components/Filter/FilterLinkList/FilterLinkList.d.ts +2 -0
- package/lib/components/Filter/FilterLinkList/FilterLinkList.module.scss +10 -0
- package/lib/components/Filter/FilterOverviewLinkList/FilterOverviewLinkList.d.ts +4 -1
- package/lib/components/InfoTeaser/InfoTeaser.d.ts +1 -1
- package/lib/components/InfoTeaser/styles.module.scss +13 -16
- package/lib/components/Panel/styles.module.scss.d.ts +3 -2
- package/lib/components/Tabs/index.js +5 -0
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/components/VisualContentgroupWithImage/VisualContentgroupWithImage.d.ts +13 -0
- package/lib/components/VisualContentgroupWithImage/index.d.ts +3 -0
- package/lib/components/VisualContentgroupWithImage/index.js +22 -0
- package/lib/components/VisualContentgroupWithImage/index.js.map +1 -0
- package/lib/components/VisualContentgroupWithImage/styles.module.scss +50 -0
- package/lib/components/VisualContentgroupWithImage/styles.module.scss.d.ts +12 -0
- package/lib/getFilterChips.js +3 -3
- package/lib/getFilterChips.js.map +1 -1
- package/lib/resourceHelper.js +32 -2
- package/lib/resourceHelper.js.map +1 -1
- package/lib/resources/HN.Designsystem.Drawer.se-NO.json.d.ts +7 -0
- package/lib/resources/HN.Designsystem.Filter.en-GB.json.d.ts +2 -1
- package/lib/resources/HN.Designsystem.Filter.nb-NO.json.d.ts +2 -1
- package/lib/resources/HN.Designsystem.Filter.nn-NO.json.d.ts +16 -0
- package/lib/resources/HN.Designsystem.Filter.se-NO.json.d.ts +16 -0
- package/lib/resources/HN.Designsystem.Tabs.se-NO.json.d.ts +7 -0
- package/lib/resources/Resources.d.ts +4 -0
- package/package.json +19 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterLinkList.js","names":[],"sources":["../src/components/Filter/FilterLinkList/FilterLinkList.tsx"],"sourcesContent":["import React from 'react';\n\nimport cn from 'classnames';\n\nimport { AnalyticsId, IconSize } from '../../../constants';\nimport { usePseudoClasses } from '../../../hooks/usePseudoClasses';\nimport Icon from '../../Icon';\nimport ChevronRight from '../../Icons/ChevronRight';\n\nimport styles from './FilterLinkList.module.scss';\n\nexport type LinkType = React.FC<LinkProps>;\n\nexport interface CompoundComponent extends React.FC<LinkListProps> {\n Link: LinkType;\n}\n\nexport interface LinkListProps {\n /** Items in the LinkList */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\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\nexport type LinkProps = Modify<\n React.HTMLAttributes<HTMLAnchorElement | HTMLButtonElement>,\n {\n /** If needed children will be content instead of title and chips. Use only in edge cases */\n children?: React.ReactNode;\n /** Title text on link element */\n title?: string;\n /** Texts rendered inside non-interactive chips on link element */\n chips?: string[];\n /** Custom classname for link element */\n className?: string;\n /** Ref for button */\n linkRef?: React.RefObject<HTMLButtonElement | null>;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Ref passed to the list item element */\n ref?: React.Ref<HTMLLIElement | null>;\n }\n>;\n\nexport const Link: LinkType = (props: LinkProps) => {\n const { children, title, chips, className = '', linkRef, testId, ref, ...restProps } = props;\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement | null>(linkRef);\n\n const liClasses = cn(styles['link-list__item']);\n const linkClasses = cn(styles['link-list__button'], className);\n\n return (\n <li className={liClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.Link}>\n <button className={linkClasses} ref={refObject as React.RefObject<HTMLButtonElement>} type=\"button\" {...restProps}>\n <div className={styles['link-list__button__content']}>\n {title ? (\n <>\n <span>{title}</span>\n {chips && chips.length > 0 && (\n <
|
|
1
|
+
{"version":3,"file":"FilterLinkList.js","names":[],"sources":["../src/components/Filter/FilterLinkList/FilterLinkList.tsx"],"sourcesContent":["import React from 'react';\n\nimport cn from 'classnames';\n\nimport { AnalyticsId, IconSize } from '../../../constants';\nimport { usePseudoClasses } from '../../../hooks/usePseudoClasses';\nimport Icon from '../../Icon';\nimport ChevronRight from '../../Icons/ChevronRight';\n\nimport styles from './FilterLinkList.module.scss';\n\nexport type LinkType = React.FC<LinkProps>;\n\nexport interface CompoundComponent extends React.FC<LinkListProps> {\n Link: LinkType;\n}\n\nexport interface LinkListProps {\n /** Items in the LinkList */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\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\nexport type LinkProps = Modify<\n React.HTMLAttributes<HTMLAnchorElement | HTMLButtonElement>,\n {\n /** If needed children will be content instead of title and chips. Use only in edge cases */\n children?: React.ReactNode;\n /** Title text on link element */\n title?: string;\n /** Texts rendered inside non-interactive chips on link element */\n chips?: string[];\n /** Aria label for the list of chips */\n chipsGroupAriaLabel?: string;\n /** Custom classname for link element */\n className?: string;\n /** Ref for button */\n linkRef?: React.RefObject<HTMLButtonElement | null>;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Ref passed to the list item element */\n ref?: React.Ref<HTMLLIElement | null>;\n }\n>;\n\nexport const Link: LinkType = (props: LinkProps) => {\n const { children, title, chips, className = '', linkRef, testId, ref, ...restProps } = props;\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement | null>(linkRef);\n\n const liClasses = cn(styles['link-list__item']);\n const linkClasses = cn(styles['link-list__button'], className);\n\n return (\n <li className={liClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.Link}>\n <button className={linkClasses} ref={refObject as React.RefObject<HTMLButtonElement>} type=\"button\" {...restProps}>\n <div className={styles['link-list__button__content']}>\n {title ? (\n <>\n <span>{title}</span>\n {chips && chips.length > 0 && (\n <ul className={styles['link-list__chip-list']} aria-label={props.chipsGroupAriaLabel}>\n {chips.map(chip => (\n <li className={styles['link-list__chip']} key={chip}>\n {chip}\n </li>\n ))}\n </ul>\n )}\n </>\n ) : (\n <>{children}</>\n )}\n </div>\n <Icon svgIcon={ChevronRight} isHovered={isHovered} size={IconSize.XSmall} color={'var(--color-action-graphics-onlight)'} />\n </button>\n </li>\n );\n};\n\nconst LinkListComponent: React.FC<LinkListProps> = (props: LinkListProps) => {\n const { children, className = '', testId, ref } = props;\n\n const listClassNames = cn(styles['link-list'], className);\n\n return (\n <ul ref={ref} className={listClassNames} data-testid={testId} data-analyticsid={AnalyticsId.LinkList}>\n {React.Children.map(children, (child: React.ReactNode) => {\n if (React.isValidElement<LinkProps>(child) && child.type === Link) {\n return React.cloneElement(child);\n }\n })}\n </ul>\n );\n};\n\nexport const FilterLinkList = LinkListComponent as CompoundComponent;\n\nFilterLinkList.displayName = 'FilterLinkList';\nFilterLinkList.Link = Link;\nLink.displayName = 'FilterLinkList.Link';\n\nexport default FilterLinkList;\n"],"mappings":";;;;;;;;;AAoDA,IAAa,QAAkB,UAAqB;CAClD,MAAM,EAAE,UAAU,OAAO,OAAO,YAAY,IAAI,SAAS,QAAQ,KAAK,GAAG,cAAc;CACvF,MAAM,EAAE,WAAW,cAAc,iBAA2C,OAAO;CAEnF,MAAM,YAAY,WAAG,OAAO,kBAAkB;CAC9C,MAAM,cAAc,WAAG,OAAO,sBAAsB,SAAS;CAE7D,OACE,oBAAC,MAAD;EAAI,WAAW;EAAgB;EAAK,eAAa;EAAQ,oBAAkB,YAAY;YACrF,qBAAC,UAAD;GAAQ,WAAW;GAAa,KAAK;GAAiD,MAAK;GAAS,GAAI;aAAxG,CACE,oBAAC,OAAD;IAAK,WAAW,OAAO;cACpB,QACC,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAD,EAAA,UAAO,MAAY,CAAA,GAClB,SAAS,MAAM,SAAS,KACvB,oBAAC,MAAD;KAAI,WAAW,OAAO;KAAyB,cAAY,MAAM;eAC9D,MAAM,KAAI,SACT,oBAAC,MAAD;MAAI,WAAW,OAAO;gBACnB;KACC,GAF2C,IAE3C,CACL;IACC,CAAA,CAEN,EAAA,CAAA,IAEF,oBAAA,UAAA,EAAG,SAAW,CAAA;GAEb,CAAA,GACL,oBAAC,cAAD;IAAM,SAAS;IAAyB;IAAW,MAAM,SAAS;IAAQ,OAAO;GAAyC,CAAA,CACpH;;CACN,CAAA;AAER;AAEA,IAAM,qBAA8C,UAAyB;CAC3E,MAAM,EAAE,UAAU,YAAY,IAAI,QAAQ,QAAQ;CAIlD,OACE,oBAAC,MAAD;EAAS;EAAK,WAHO,WAAG,OAAO,cAAc,SAGpB;EAAgB,eAAa;EAAQ,oBAAkB,YAAY;YACzF,MAAM,SAAS,IAAI,WAAW,UAA2B;GACxD,IAAI,MAAM,eAA0B,KAAK,KAAK,MAAM,SAAS,MAC3D,OAAO,MAAM,aAAa,KAAK;EAEnC,CAAC;CACC,CAAA;AAER;AAEA,IAAa,iBAAiB;AAE9B,eAAe,cAAc;AAC7B,eAAe,OAAO;AACtB,KAAK,cAAc"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import { LanguageLocales } from "./constants.js";
|
|
2
|
+
import { useLanguage } from "./hooks/useLanguage.js";
|
|
1
3
|
import { r as useDrawerNavigation } from "./DrawerNavigation.js";
|
|
4
|
+
import { t as getResources } from "./resourceHelper.js";
|
|
2
5
|
import { t as FilterLinkList } from "./FilterLinkList.js";
|
|
3
6
|
import { jsx } from "react/jsx-runtime";
|
|
4
7
|
//#region src/components/Filter/FilterOverviewLinkList/FilterOverviewLinkList.tsx
|
|
5
|
-
function FilterOverviewLinkList({ filter, getLabel, links }) {
|
|
8
|
+
function FilterOverviewLinkList({ filter, getLabel, links, resources }) {
|
|
6
9
|
const { goToView } = useDrawerNavigation();
|
|
10
|
+
const { language } = useLanguage(LanguageLocales.NORWEGIAN);
|
|
11
|
+
const mergedResources = {
|
|
12
|
+
...getResources(language),
|
|
13
|
+
...resources
|
|
14
|
+
};
|
|
7
15
|
return /* @__PURE__ */ jsx(FilterLinkList, { children: links.map(({ filterKey, title, viewId }) => {
|
|
8
16
|
const raw = filter.filters[filterKey];
|
|
9
17
|
let chips;
|
|
@@ -13,6 +21,7 @@ function FilterOverviewLinkList({ filter, getLabel, links }) {
|
|
|
13
21
|
return /* @__PURE__ */ jsx(FilterLinkList.Link, {
|
|
14
22
|
title,
|
|
15
23
|
chips,
|
|
24
|
+
chipsGroupAriaLabel: mergedResources.activeFiltersListLabel,
|
|
16
25
|
onClick: () => goToView(viewId ?? filterKey)
|
|
17
26
|
}, filterKey);
|
|
18
27
|
}) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterOverviewLinkList.js","names":[],"sources":["../src/components/Filter/FilterOverviewLinkList/FilterOverviewLinkList.tsx","../src/components/Filter/FilterOverviewLinkList/index.ts"],"sourcesContent":["import type { FilterValues, UseFilterReturn } from '../useFilter';\n\nimport { useDrawerNavigation } from '../DrawerNavigation';\nimport FilterLinkList from '../FilterLinkList/FilterLinkList';\n\nexport interface FilterOverviewLink {\n /** The filter key to read values from */\n filterKey: string;\n /** Display title for the link */\n title: string;\n /** View ID to navigate to when clicked. Defaults to filterKey */\n viewId?: string;\n}\n\nexport interface FilterOverviewLinkListProps<T extends FilterValues> {\n /** The filter instance from useFilter */\n filter: UseFilterReturn<T>;\n /** Look up the display label for a filter key + value */\n getLabel: (key: keyof T, value: unknown) => string;\n /** Configuration for which filter keys to show as links */\n links: FilterOverviewLink[];\n}\n\nfunction FilterOverviewLinkList<T extends FilterValues>({
|
|
1
|
+
{"version":3,"file":"FilterOverviewLinkList.js","names":[],"sources":["../src/components/Filter/FilterOverviewLinkList/FilterOverviewLinkList.tsx","../src/components/Filter/FilterOverviewLinkList/index.ts"],"sourcesContent":["import type { HNDesignsystemFilter } from '../../../resources/Resources';\nimport type { FilterValues, UseFilterReturn } from '../useFilter';\n\nimport { LanguageLocales } from '../../../constants';\nimport { useLanguage } from '../../../hooks/useLanguage';\nimport { useDrawerNavigation } from '../DrawerNavigation';\nimport FilterLinkList from '../FilterLinkList/FilterLinkList';\nimport { getResources } from '../resourceHelper';\n\nexport interface FilterOverviewLink {\n /** The filter key to read values from */\n filterKey: string;\n /** Display title for the link */\n title: string;\n /** View ID to navigate to when clicked. Defaults to filterKey */\n viewId?: string;\n}\n\nexport interface FilterOverviewLinkListProps<T extends FilterValues> {\n /** The filter instance from useFilter */\n filter: UseFilterReturn<T>;\n /** Look up the display label for a filter key + value */\n getLabel: (key: keyof T, value: unknown) => string;\n /** Configuration for which filter keys to show as links */\n links: FilterOverviewLink[];\n /** Resources for the component */\n resources?: Partial<HNDesignsystemFilter>;\n}\n\nfunction FilterOverviewLinkList<T extends FilterValues>({\n filter,\n getLabel,\n links,\n resources,\n}: FilterOverviewLinkListProps<T>): React.ReactNode {\n const { goToView } = useDrawerNavigation();\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n const mergedResources = {\n ...defaultResources,\n ...resources,\n };\n\n return (\n <FilterLinkList>\n {links.map(({ filterKey, title, viewId }) => {\n const raw = filter.filters[filterKey as keyof T];\n\n let chips: string[];\n if (Array.isArray(raw)) {\n chips = raw.map(v => getLabel(filterKey as keyof T, v));\n } else if (raw !== undefined && raw !== null) {\n chips = [getLabel(filterKey as keyof T, raw)];\n } else {\n chips = [];\n }\n\n return (\n <FilterLinkList.Link\n key={filterKey}\n title={title}\n chips={chips}\n chipsGroupAriaLabel={mergedResources.activeFiltersListLabel}\n onClick={() => goToView(viewId ?? filterKey)}\n />\n );\n })}\n </FilterLinkList>\n );\n}\n\nexport default FilterOverviewLinkList;\n","import FilterOverviewLinkList from './FilterOverviewLinkList';\nexport * from './FilterOverviewLinkList';\nexport default FilterOverviewLinkList;\n"],"mappings":";;;;;;;AA6BA,SAAS,uBAA+C,EACtD,QACA,UACA,OACA,aACkD;CAClD,MAAM,EAAE,aAAa,oBAAoB;CACzC,MAAM,EAAE,aAAa,YAA6B,gBAAgB,SAAS;CAE3E,MAAM,kBAAkB;EACtB,GAFuB,aAAa,QAEjC;EACH,GAAG;CACL;CAEA,OACE,oBAAC,gBAAD,EAAA,UACG,MAAM,KAAK,EAAE,WAAW,OAAO,aAAa;EAC3C,MAAM,MAAM,OAAO,QAAQ;EAE3B,IAAI;EACJ,IAAI,MAAM,QAAQ,GAAG,GACnB,QAAQ,IAAI,KAAI,MAAK,SAAS,WAAsB,CAAC,CAAC;OACjD,IAAI,QAAQ,KAAA,KAAa,QAAQ,MACtC,QAAQ,CAAC,SAAS,WAAsB,GAAG,CAAC;OAE5C,QAAQ,CAAC;EAGX,OACE,oBAAC,eAAe,MAAhB;GAES;GACA;GACP,qBAAqB,gBAAgB;GACrC,eAAe,SAAS,UAAU,SAAS;EAC5C,GALM,SAKN;CAEL,CAAC,EACa,CAAA;AAEpB;;;ACnEA,IAAA,iCAAe"}
|
package/lib/InfoTeaser.js
CHANGED
|
@@ -53,7 +53,7 @@ var InfoTeaser = (props) => {
|
|
|
53
53
|
size: IconSize.Small,
|
|
54
54
|
className: styles.infoteaser__icon
|
|
55
55
|
})),
|
|
56
|
-
/* @__PURE__ */ jsx(Title_default, {
|
|
56
|
+
title && typeof title !== "undefined" && /* @__PURE__ */ jsx(Title_default, {
|
|
57
57
|
testId: "titleId",
|
|
58
58
|
htmlMarkup: titleHtmlMarkup,
|
|
59
59
|
appearance: "title4",
|
package/lib/InfoTeaser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfoTeaser.js","names":[],"sources":["../src/resources/HN.Designsystem.InfoTeaser.en-GB.json","../src/resources/HN.Designsystem.InfoTeaser.nb-NO.json","../src/components/InfoTeaser/resourceHelper.ts","../src/components/InfoTeaser/InfoTeaser.tsx","../src/components/InfoTeaser/index.ts"],"sourcesContent":["{\n \"expandButtonOpen\": \"Show less\",\n \"expandButtonClose\": \"Show more\"\n}\n","{\n \"expandButtonOpen\": \"Vis mindre\",\n \"expandButtonClose\": \"Vis mer\"\n}\n","import type { HNDesignsystemInfoTeaser } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.InfoTeaser.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.InfoTeaser.nb-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemInfoTeaser => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import { useId, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { HNDesignsystemInfoTeaser } from '../../resources/Resources';\nimport type { SvgIcon } from '../Icon';\nimport type { IconName } from '../Icons/IconNames';\nimport type { TitleTags } from '../Title';\n\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport Icon, { IconSize } from '../Icon';\nimport LazyIcon from '../LazyIcon';\nimport Title from '../Title';\nimport { getResources } from './resourceHelper';\n\nimport styles from './styles.module.scss';\n\nexport type InfoTeaserTags = 'div' | 'section' | 'aside' | 'article';\n\nexport interface InfoTeaserProps {\n /** For overriding styling on the button */\n buttonClassName?: string;\n /** What's in the box? */\n children: React.ReactNode;\n /** Override the default max height for collapsed teaser. Default is 12.25rem */\n collapsedMaxHeight?: string;\n /** For overriding styling on infoteaser box */\n className?: string;\n /** Changes the underlying element of the wrapper */\n htmlMarkup?: InfoTeaserTags;\n /** Resources for component */\n resources?: Partial<HNDesignsystemInfoTeaser>;\n /** Adds an icon */\n svgIcon?: SvgIcon | IconName;\n /** Sets the data-testid attribute */\n testId?: string;\n /** Title on top of the component */\n title
|
|
1
|
+
{"version":3,"file":"InfoTeaser.js","names":[],"sources":["../src/resources/HN.Designsystem.InfoTeaser.en-GB.json","../src/resources/HN.Designsystem.InfoTeaser.nb-NO.json","../src/components/InfoTeaser/resourceHelper.ts","../src/components/InfoTeaser/InfoTeaser.tsx","../src/components/InfoTeaser/index.ts"],"sourcesContent":["{\n \"expandButtonOpen\": \"Show less\",\n \"expandButtonClose\": \"Show more\"\n}\n","{\n \"expandButtonOpen\": \"Vis mindre\",\n \"expandButtonClose\": \"Vis mer\"\n}\n","import type { HNDesignsystemInfoTeaser } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.InfoTeaser.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.InfoTeaser.nb-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemInfoTeaser => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import { useId, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { HNDesignsystemInfoTeaser } from '../../resources/Resources';\nimport type { SvgIcon } from '../Icon';\nimport type { IconName } from '../Icons/IconNames';\nimport type { TitleTags } from '../Title';\n\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport Icon, { IconSize } from '../Icon';\nimport LazyIcon from '../LazyIcon';\nimport Title from '../Title';\nimport { getResources } from './resourceHelper';\n\nimport styles from './styles.module.scss';\n\nexport type InfoTeaserTags = 'div' | 'section' | 'aside' | 'article';\n\nexport interface InfoTeaserProps {\n /** For overriding styling on the button */\n buttonClassName?: string;\n /** What's in the box? */\n children: React.ReactNode;\n /** Override the default max height for collapsed teaser. Default is 12.25rem */\n collapsedMaxHeight?: string;\n /** For overriding styling on infoteaser box */\n className?: string;\n /** Changes the underlying element of the wrapper */\n htmlMarkup?: InfoTeaserTags;\n /** Resources for component */\n resources?: Partial<HNDesignsystemInfoTeaser>;\n /** Adds an icon */\n svgIcon?: SvgIcon | IconName;\n /** Sets the data-testid attribute */\n testId?: string;\n /** Title on top of the component */\n title?: string;\n /** Markup props for title */\n titleHtmlMarkup?: TitleTags;\n}\n\nconst InfoTeaser: React.FC<InfoTeaserProps> = props => {\n const {\n buttonClassName,\n children,\n className,\n htmlMarkup = 'div',\n resources,\n svgIcon,\n testId,\n title,\n titleHtmlMarkup = 'h2',\n collapsedMaxHeight,\n } = props;\n const [expanded, setExpanded] = useState(false);\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n const infoteaserTextId = useId();\n\n const mergedResources: HNDesignsystemInfoTeaser = {\n ...defaultResources,\n ...resources,\n };\n\n const WrapperTag = htmlMarkup;\n\n return (\n <WrapperTag className={styles.wrapper} data-testid={testId} data-analyticsid={AnalyticsId.InfoTeaser}>\n <div\n className={classNames(styles.infoteaser, className, {\n [styles['infoteaser--collapsed']]: !expanded,\n })}\n style={{ maxHeight: !expanded ? (collapsedMaxHeight ? collapsedMaxHeight : '12.25rem') : undefined }}\n >\n {svgIcon &&\n (typeof svgIcon === 'string' ? (\n <LazyIcon iconName={svgIcon} size={IconSize.Small} className={styles.infoteaser__icon} />\n ) : (\n <Icon svgIcon={svgIcon} size={IconSize.Small} className={styles.infoteaser__icon} />\n ))}\n {title && typeof title !== 'undefined' && (\n <Title testId=\"titleId\" htmlMarkup={titleHtmlMarkup} appearance=\"title4\" className={styles.infoteaser__title}>\n {title}\n </Title>\n )}\n <div className={styles.infoteaser__text} aria-hidden={expanded ? false : true} id={infoteaserTextId}>\n {children}\n </div>\n </div>\n <button\n type=\"button\"\n className={classNames(styles.infoteaser__button, buttonClassName)}\n onClick={() => {\n setExpanded(!expanded);\n }}\n aria-expanded={expanded}\n aria-controls={infoteaserTextId}\n >\n {expanded ? mergedResources.expandButtonOpen : mergedResources.expandButtonClose}\n </button>\n </WrapperTag>\n );\n};\n\nexport default InfoTeaser;\n","import InfoTeaser from './InfoTeaser';\nexport * from './InfoTeaser';\nexport default InfoTeaser;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AEMA,IAAa,gBAAgB,aAAwD;CACnF,QAAQ,UAAR;EACE,KAAK,gBAAgB,SACnB,OAAO;EACT,KAAK,gBAAgB;EACrB,SACE,OAAO;CACX;AACF;;;AC6BA,IAAM,cAAwC,UAAS;CACrD,MAAM,EACJ,iBACA,UACA,WACA,aAAa,OACb,WACA,SACA,QACA,OACA,kBAAkB,MAClB,uBACE;CACJ,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,EAAE,aAAa,YAA6B,gBAAgB,SAAS;CAC3E,MAAM,mBAAmB,aAAa,QAAQ;CAC9C,MAAM,mBAAmB,MAAM;CAE/B,MAAM,kBAA4C;EAChD,GAAG;EACH,GAAG;CACL;CAIA,OACE,qBAAC,YAAD;EAAY,WAAW,OAAO;EAAS,eAAa;EAAQ,oBAAkB,YAAY;YAA1F,CACE,qBAAC,OAAD;GACE,WAAW,WAAW,OAAO,YAAY,WAAW,GACjD,OAAO,2BAA2B,CAAC,SACtC,CAAC;GACD,OAAO,EAAE,WAAW,CAAC,WAAY,qBAAqB,qBAAqB,aAAc,KAAA,EAAU;aAJrG;IAMG,YACE,OAAO,YAAY,WAClB,oBAAC,kBAAD;KAAU,UAAU;KAAS,MAAM,SAAS;KAAO,WAAW,OAAO;IAAmB,CAAA,IAExF,oBAAC,cAAD;KAAe;KAAS,MAAM,SAAS;KAAO,WAAW,OAAO;IAAmB,CAAA;IAEtF,SAAS,OAAO,UAAU,eACzB,oBAAC,eAAD;KAAO,QAAO;KAAU,YAAY;KAAiB,YAAW;KAAS,WAAW,OAAO;eACxF;IACI,CAAA;IAET,oBAAC,OAAD;KAAK,WAAW,OAAO;KAAkB,eAAa,WAAW,QAAQ;KAAM,IAAI;KAChF;IACE,CAAA;GACF;MACL,oBAAC,UAAD;GACE,MAAK;GACL,WAAW,WAAW,OAAO,oBAAoB,eAAe;GAChE,eAAe;IACb,YAAY,CAAC,QAAQ;GACvB;GACA,iBAAe;GACf,iBAAe;aAEd,WAAW,gBAAgB,mBAAmB,gBAAgB;EACzD,CAAA,CACE;;AAEhB;;;ACtGA,IAAA,qBAAe"}
|
|
@@ -8,24 +8,29 @@
|
|
|
8
8
|
|
|
9
9
|
$dark-mode-disabled-transparrent: #ffffffb3;
|
|
10
10
|
$with-icons: // icon-class, size-class, padding-left, padding-right, padding-left desktop, padding-right desktop, svg-margin-left, svg-margin-right, svg-margin-left desktop, svg-margin-right desktop
|
|
11
|
-
'left-icon' '
|
|
11
|
+
'left-icon' 'medium' spacers.getSpacer(xs) spacers.getSpacer(s) spacers.getSpacer(xs) spacers.getSpacer(m) 0 spacers.getSpacer(3xs) 0
|
|
12
12
|
spacers.getSpacer(2xs),
|
|
13
|
-
'right-icon' '
|
|
13
|
+
'right-icon' 'medium' spacers.getSpacer(s) spacers.getSpacer(xs) spacers.getSpacer(m) spacers.getSpacer(xs) spacers.getSpacer(3xs) 0
|
|
14
14
|
spacers.getSpacer(2xs) 0,
|
|
15
|
-
'left-icon' 'large' spacers.getSpacer(xs) spacers.getSpacer(m) spacers.getSpacer(s) spacers.getSpacer(l) 0
|
|
16
|
-
spacers.getSpacer(xs),
|
|
17
|
-
'right-icon' 'large' spacers.getSpacer(m) spacers.getSpacer(xs) spacers.getSpacer(l) spacers.getSpacer(s)
|
|
18
|
-
spacers.getSpacer(xs) 0,
|
|
19
|
-
'arrow' '
|
|
15
|
+
'left-icon' 'large-non-borderless' spacers.getSpacer(xs) spacers.getSpacer(m) spacers.getSpacer(s) spacers.getSpacer(l) 0
|
|
16
|
+
spacers.getSpacer(2xs) 0 spacers.getSpacer(xs),
|
|
17
|
+
'right-icon' 'large-non-borderless' spacers.getSpacer(m) spacers.getSpacer(xs) spacers.getSpacer(l) spacers.getSpacer(s)
|
|
18
|
+
spacers.getSpacer(2xs) 0 spacers.getSpacer(xs) 0,
|
|
19
|
+
'arrow' 'medium' spacers.getSpacer(s) spacers.getSpacer(xs) spacers.getSpacer(m) spacers.getSpacer(xs) spacers.getSpacer(m) 0
|
|
20
20
|
spacers.getSpacer(l) 0,
|
|
21
|
-
'arrow' 'large' spacers.getSpacer(m) spacers.getSpacer(xs) spacers.getSpacer(l) spacers.getSpacer(xs) spacers.getSpacer(l)
|
|
22
|
-
spacers.getSpacer(xl) 0,
|
|
23
|
-
'arrow--both-icons' '
|
|
24
|
-
'arrow--both-icons' 'large' 0 0 0 0 spacers.getSpacer(m) 0 spacers.getSpacer(l) 0,
|
|
25
|
-
'only-icon' '
|
|
26
|
-
'only-icon' 'large' 0.312rem 0.312rem spacers.getSpacer(3xs) spacers.getSpacer(3xs) 0 0 0 0,
|
|
27
|
-
'both-icons' '
|
|
28
|
-
'both-icons' 'large' spacers.getSpacer(xs) spacers.getSpacer(xs) spacers.getSpacer(xs) spacers.getSpacer(xs) 0 0 0 0
|
|
21
|
+
'arrow' 'large-non-borderless' spacers.getSpacer(m) spacers.getSpacer(xs) spacers.getSpacer(l) spacers.getSpacer(xs) spacers.getSpacer(l)
|
|
22
|
+
0 spacers.getSpacer(xl) 0,
|
|
23
|
+
'arrow--both-icons' 'medium' 0 0 0 0 spacers.getSpacer(s) 0 spacers.getSpacer(m) 0,
|
|
24
|
+
'arrow--both-icons' 'large-non-borderless' 0 0 0 0 spacers.getSpacer(m) 0 spacers.getSpacer(l) 0,
|
|
25
|
+
'only-icon' 'medium' 0.0625rem 0.0625rem 0.375rem 0.375rem 0 0 0 0,
|
|
26
|
+
'only-icon' 'large-non-borderless' 0.312rem 0.312rem spacers.getSpacer(3xs) spacers.getSpacer(3xs) 0 0 0 0,
|
|
27
|
+
'both-icons' 'medium' spacers.getSpacer(xs) spacers.getSpacer(xs) spacers.getSpacer(xs) spacers.getSpacer(xs) 0 0 0 0,
|
|
28
|
+
'both-icons' 'large-non-borderless' spacers.getSpacer(xs) spacers.getSpacer(xs) spacers.getSpacer(xs) spacers.getSpacer(xs) 0 0 0 0,
|
|
29
|
+
'left-icon' 'large-borderless' spacers.getSpacer(xs) spacers.getSpacer(s) spacers.getSpacer(xs) spacers.getSpacer(m) 0
|
|
30
|
+
spacers.getSpacer(3xs) 0 spacers.getSpacer(3xs),
|
|
31
|
+
'right-icon' 'large-borderless' spacers.getSpacer(s) spacers.getSpacer(xs) spacers.getSpacer(m) spacers.getSpacer(xs)
|
|
32
|
+
spacers.getSpacer(3xs) 0 spacers.getSpacer(3xs) 0,
|
|
33
|
+
'only-icon' 'large-borderless' 0 0 0.0625rem 0.0625rem 0 0 0 0;
|
|
29
34
|
|
|
30
35
|
// Brukes til å aktivere hover styling uten at button hovres
|
|
31
36
|
@mixin outline-borderless-hover {
|
|
@@ -44,6 +49,8 @@ $with-icons: // icon-class, size-class, padding-left, padding-right, padding-lef
|
|
|
44
49
|
|
|
45
50
|
@if $with-uu-border {
|
|
46
51
|
border: 1px solid var(--color-action-border-ondark-focus);
|
|
52
|
+
} @else {
|
|
53
|
+
border: none;
|
|
47
54
|
}
|
|
48
55
|
}
|
|
49
56
|
|
|
@@ -259,7 +266,7 @@ $with-icons: // icon-class, size-class, padding-left, padding-right, padding-lef
|
|
|
259
266
|
line-height: 1.5rem;
|
|
260
267
|
}
|
|
261
268
|
|
|
262
|
-
&--large {
|
|
269
|
+
&--large-non-borderless {
|
|
263
270
|
min-height: 3.5rem;
|
|
264
271
|
padding: 0 spacers.getSpacer(l);
|
|
265
272
|
font-size: 1.3125rem;
|
|
@@ -272,6 +279,16 @@ $with-icons: // icon-class, size-class, padding-left, padding-right, padding-lef
|
|
|
272
279
|
}
|
|
273
280
|
}
|
|
274
281
|
|
|
282
|
+
// Medium box sizing with large font-size, used for borderless + large
|
|
283
|
+
&--large-borderless {
|
|
284
|
+
font-size: 1.3125rem;
|
|
285
|
+
|
|
286
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
287
|
+
font-size: font-settings.$font-size-lg;
|
|
288
|
+
line-height: 1.5rem;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
275
292
|
@each $icon-class, $size-class, $pl, $pr, $pld, $prd, $svgml, $svgmr, $svgmld, $svgmrd in $with-icons {
|
|
276
293
|
&--#{$icon-class}#{&}--#{$size-class} {
|
|
277
294
|
padding-left: $pl;
|
|
@@ -320,6 +337,8 @@ $with-icons: // icon-class, size-class, padding-left, padding-right, padding-lef
|
|
|
320
337
|
&--borderless {
|
|
321
338
|
@include outline-borderless-background(transparent, var(--color-action-background-transparent-onlight-hover));
|
|
322
339
|
|
|
340
|
+
border: none;
|
|
341
|
+
|
|
323
342
|
:focus > & {
|
|
324
343
|
@include focus-shadow(false);
|
|
325
344
|
|
|
@@ -408,6 +427,10 @@ $with-icons: // icon-class, size-class, padding-left, padding-right, padding-lef
|
|
|
408
427
|
@include text-color(palette.$cherry600, palette.$cherry700);
|
|
409
428
|
}
|
|
410
429
|
|
|
430
|
+
&--only-icon {
|
|
431
|
+
justify-content: center;
|
|
432
|
+
}
|
|
433
|
+
|
|
411
434
|
/* stylelint-disable-next-line */
|
|
412
435
|
&--only-icon &__text {
|
|
413
436
|
@include sr-only;
|
|
@@ -15,9 +15,10 @@ export type Styles = {
|
|
|
15
15
|
'button--borderless': string;
|
|
16
16
|
'button--both-icons': string;
|
|
17
17
|
'button--destructive': string;
|
|
18
|
-
'button--large': string;
|
|
18
|
+
'button--large-borderless': string;
|
|
19
|
+
'button--large-non-borderless': string;
|
|
19
20
|
'button--left-icon': string;
|
|
20
|
-
'button--
|
|
21
|
+
'button--medium': string;
|
|
21
22
|
'button--on-dark': string;
|
|
22
23
|
'button--only-icon': string;
|
|
23
24
|
'button--outline': string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface DrawerBackButtonProps {
|
|
2
|
+
/** Function is called when user clicks the button */
|
|
3
|
+
onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
4
|
+
/** Sets the aria-label of the button */
|
|
5
|
+
ariaLabel?: string;
|
|
6
|
+
/** Adds custom classes to the element. */
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const DrawerBackButton: React.FC<DrawerBackButtonProps>;
|
|
10
|
+
export default DrawerBackButton;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../../scss/breakpoints' as breakpoints;
|
|
3
|
+
@import '../../scss/supernova/styles/colors.css';
|
|
4
|
+
|
|
5
|
+
$desktop-size: 3rem;
|
|
6
|
+
$mobile-inner-size: 2.375rem;
|
|
7
|
+
$mobile-outer-size: 2.75rem;
|
|
8
|
+
|
|
9
|
+
.back-button {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
height: $mobile-outer-size;
|
|
14
|
+
width: $mobile-outer-size;
|
|
15
|
+
padding: 0;
|
|
16
|
+
border: 0;
|
|
17
|
+
background-color: transparent;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
|
|
20
|
+
&:focus-visible {
|
|
21
|
+
outline: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
25
|
+
height: $desktop-size;
|
|
26
|
+
width: $desktop-size;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&__inner-container {
|
|
30
|
+
width: $mobile-inner-size;
|
|
31
|
+
height: $mobile-inner-size;
|
|
32
|
+
|
|
33
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
34
|
+
height: $desktop-size;
|
|
35
|
+
width: $desktop-size;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:hover > & {
|
|
39
|
+
background-color: var(--color-action-background-transparent-onlight-hover);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:active > & {
|
|
43
|
+
background-color: var(--color-action-background-transparent-onlight-active);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:focus-visible > & {
|
|
47
|
+
outline: 3px solid var(--color-action-border-onlight-focus);
|
|
48
|
+
border-radius: 0;
|
|
49
|
+
border: 0;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -98,15 +98,6 @@
|
|
|
98
98
|
&__back-button {
|
|
99
99
|
// Moves the button visually to the left but keeps it in the DOM order for screen readers and keyboard navigation
|
|
100
100
|
order: -1;
|
|
101
|
-
|
|
102
|
-
// Temporary fix for the back button, until we decide if we want to implement this more properly
|
|
103
|
-
width: 48px;
|
|
104
|
-
height: 48px;
|
|
105
|
-
|
|
106
|
-
svg {
|
|
107
|
-
width: 48px;
|
|
108
|
-
height: 48px;
|
|
109
|
-
}
|
|
110
101
|
}
|
|
111
102
|
}
|
|
112
103
|
|
|
@@ -21,6 +21,8 @@ export interface ExpanderProps {
|
|
|
21
21
|
expanded?: boolean;
|
|
22
22
|
/** Removes border to the left of the content. Requires size=ExpanderSize.small. */
|
|
23
23
|
noNestedLine?: boolean;
|
|
24
|
+
/** Emphasizes the content section. Intended for size=ExpanderSize.small. */
|
|
25
|
+
emphasized?: boolean;
|
|
24
26
|
/** Stick expander trigger to top of screen while scrolling down */
|
|
25
27
|
sticky?: boolean;
|
|
26
28
|
/** Called when expander is open/closed. */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* stylelint-disable no-descending-specificity */
|
|
2
2
|
@use 'sass:map';
|
|
3
|
-
@use '../../scss/spacers' as spacers;
|
|
4
3
|
@use '../../scss/palette' as palette;
|
|
5
4
|
@use '../../scss/font-settings' as font-settings;
|
|
6
5
|
@use '../Button/styles.module' as button;
|
|
7
6
|
@use '../../scss/breakpoints' as breakpoints;
|
|
8
7
|
@import '../../scss/supernova/styles/colors.css';
|
|
8
|
+
@import '../../scss/supernova/styles/spacers.css';
|
|
9
9
|
|
|
10
10
|
.expander {
|
|
11
11
|
position: initial;
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
align-items: center;
|
|
25
25
|
|
|
26
26
|
&--left {
|
|
27
|
-
margin-right:
|
|
27
|
+
margin-right: var(--core-space-2xs);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
&--right {
|
|
31
31
|
margin-left: auto;
|
|
32
|
-
padding-left:
|
|
32
|
+
padding-left: var(--core-space-2xs);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
&__button {
|
|
37
37
|
position: relative;
|
|
38
|
-
padding-right:
|
|
38
|
+
padding-right: var(--core-space-s);
|
|
39
39
|
text-align: left;
|
|
40
40
|
|
|
41
41
|
&--expanded {
|
|
@@ -67,19 +67,19 @@
|
|
|
67
67
|
|
|
68
68
|
&--large {
|
|
69
69
|
width: 100%;
|
|
70
|
-
padding:
|
|
70
|
+
padding: var(--core-space-xs) var(--core-space-2xs) var(--core-space-xs) var(--core-space-s);
|
|
71
71
|
cursor: pointer;
|
|
72
72
|
|
|
73
73
|
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
74
|
-
padding:
|
|
74
|
+
padding: var(--core-space-xs) var(--core-space-s) var(--core-space-xs) var(--core-space-l);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
&--icon {
|
|
79
|
-
padding-left:
|
|
79
|
+
padding-left: var(--core-space-2xs);
|
|
80
80
|
|
|
81
81
|
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
82
|
-
padding-left:
|
|
82
|
+
padding-left: var(--core-space-s);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
0 0 0 1.5px palette.$neutral600,
|
|
99
99
|
inset 0 0 0 1.5px palette.$neutral600;
|
|
100
100
|
}
|
|
101
|
+
|
|
101
102
|
&#{$trigger}--expanded {
|
|
102
103
|
background-color: map.get(palette.$palette-map, #{$color}100);
|
|
103
104
|
|
|
@@ -121,6 +122,7 @@
|
|
|
121
122
|
0 0 0 1.5px palette.$neutral600,
|
|
122
123
|
inset 0 0 0 1.5px palette.$neutral600;
|
|
123
124
|
}
|
|
125
|
+
|
|
124
126
|
&#{$trigger}--expanded {
|
|
125
127
|
box-shadow: inset 0 0 0 6px palette.$neutral100;
|
|
126
128
|
|
|
@@ -135,6 +137,8 @@
|
|
|
135
137
|
}
|
|
136
138
|
|
|
137
139
|
&__button-container {
|
|
140
|
+
display: flex;
|
|
141
|
+
|
|
138
142
|
&--sticky {
|
|
139
143
|
background-color: palette.$white;
|
|
140
144
|
}
|
|
@@ -163,12 +167,19 @@
|
|
|
163
167
|
}
|
|
164
168
|
|
|
165
169
|
&--small {
|
|
166
|
-
margin-top:
|
|
170
|
+
margin-top: var(--core-space-s);
|
|
167
171
|
}
|
|
172
|
+
|
|
168
173
|
&--small#{&}--sticky {
|
|
169
174
|
margin-top: 1.25rem;
|
|
170
175
|
}
|
|
171
176
|
|
|
177
|
+
&--emphasized {
|
|
178
|
+
padding: var(--core-space-m) var(--core-space-s);
|
|
179
|
+
margin-top: var(--core-space-3xs);
|
|
180
|
+
background: var(--color-base-background-neutral, #f5f3f3);
|
|
181
|
+
}
|
|
182
|
+
|
|
172
183
|
&--nested-line {
|
|
173
184
|
&--outer {
|
|
174
185
|
padding-left: 0;
|
|
@@ -179,7 +190,7 @@
|
|
|
179
190
|
}
|
|
180
191
|
|
|
181
192
|
&--inner {
|
|
182
|
-
padding-left:
|
|
193
|
+
padding-left: var(--core-space-s);
|
|
183
194
|
border-left: solid 3px palette.$neutral200;
|
|
184
195
|
|
|
185
196
|
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
@@ -191,11 +202,12 @@
|
|
|
191
202
|
}
|
|
192
203
|
|
|
193
204
|
&--large {
|
|
194
|
-
padding:
|
|
205
|
+
padding: var(--core-space-s) var(--core-space-m) var(--core-space-l) var(--core-space-s);
|
|
195
206
|
|
|
196
207
|
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
197
|
-
padding:
|
|
208
|
+
padding: var(--core-space-m) var(--core-space-l) var(--core-space-xl);
|
|
198
209
|
}
|
|
210
|
+
|
|
199
211
|
&#{$content}--icon {
|
|
200
212
|
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
201
213
|
padding-left: 70px;
|
|
@@ -15,9 +15,10 @@ export type Styles = {
|
|
|
15
15
|
'button--borderless': string;
|
|
16
16
|
'button--both-icons': string;
|
|
17
17
|
'button--destructive': string;
|
|
18
|
-
'button--large': string;
|
|
18
|
+
'button--large-borderless': string;
|
|
19
|
+
'button--large-non-borderless': string;
|
|
19
20
|
'button--left-icon': string;
|
|
20
|
-
'button--
|
|
21
|
+
'button--medium': string;
|
|
21
22
|
'button--on-dark': string;
|
|
22
23
|
'button--only-icon': string;
|
|
23
24
|
'button--outline': string;
|
|
@@ -31,11 +32,13 @@ export type Styles = {
|
|
|
31
32
|
expander__button: string;
|
|
32
33
|
expander__button__text: string;
|
|
33
34
|
'expander__button--expanded': string;
|
|
35
|
+
'expander__button-container': string;
|
|
34
36
|
'expander__button-container--sticky': string;
|
|
35
37
|
expander__content: string;
|
|
36
38
|
'expander__content--banana': string;
|
|
37
39
|
'expander__content--blueberry': string;
|
|
38
40
|
'expander__content--cherry': string;
|
|
41
|
+
'expander__content--emphasized': string;
|
|
39
42
|
'expander__content--expanded': string;
|
|
40
43
|
'expander__content--icon': string;
|
|
41
44
|
'expander__content--kiwi': string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { HNDesignsystemFilter } from '../../../resources/Resources';
|
|
2
3
|
export interface FilterButtonAndChipsWrapperProps {
|
|
3
4
|
/** FilterButton content area */
|
|
4
5
|
filterButtonComponent: React.ReactNode;
|
|
@@ -6,6 +7,8 @@ export interface FilterButtonAndChipsWrapperProps {
|
|
|
6
7
|
filterChips: React.ReactNode[];
|
|
7
8
|
/** test id that is placed on the wrapper */
|
|
8
9
|
testId?: string;
|
|
10
|
+
/** Resources for the component */
|
|
11
|
+
resources?: Partial<HNDesignsystemFilter>;
|
|
9
12
|
}
|
|
10
13
|
declare const FilterButtonAndChipsWrapper: React.FC<FilterButtonAndChipsWrapperProps>;
|
|
11
14
|
export default FilterButtonAndChipsWrapper;
|
|
@@ -1,8 +1,24 @@
|
|
|
1
|
+
@use '../../../scss/screen-reader' as *;
|
|
1
2
|
@import '../../../scss/supernova/styles/spacers.css';
|
|
2
3
|
|
|
3
4
|
.filter-chip-bar {
|
|
4
5
|
display: flex;
|
|
5
|
-
flex-flow: row wrap;
|
|
6
6
|
column-gap: var(--core-space-xs);
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
&__list {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
flex-flow: row wrap;
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
column-gap: var(--core-space-xs);
|
|
13
|
+
|
|
14
|
+
/* Override list styling */
|
|
15
|
+
list-style: none;
|
|
16
|
+
margin-block: 0;
|
|
17
|
+
padding-inline-start: 0;
|
|
18
|
+
|
|
19
|
+
li {
|
|
20
|
+
list-style: none;
|
|
21
|
+
display: inline;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
8
24
|
}
|
|
@@ -21,6 +21,8 @@ export type LinkProps = Modify<React.HTMLAttributes<HTMLAnchorElement | HTMLButt
|
|
|
21
21
|
title?: string;
|
|
22
22
|
/** Texts rendered inside non-interactive chips on link element */
|
|
23
23
|
chips?: string[];
|
|
24
|
+
/** Aria label for the list of chips */
|
|
25
|
+
chipsGroupAriaLabel?: string;
|
|
24
26
|
/** Custom classname for link element */
|
|
25
27
|
className?: string;
|
|
26
28
|
/** Ref for button */
|
|
@@ -59,6 +59,16 @@
|
|
|
59
59
|
display: flex;
|
|
60
60
|
flex-flow: row wrap;
|
|
61
61
|
column-gap: 0.5rem;
|
|
62
|
+
|
|
63
|
+
/* Override list styling */
|
|
64
|
+
list-style: none;
|
|
65
|
+
margin-block: 0;
|
|
66
|
+
padding-inline-start: 0;
|
|
67
|
+
|
|
68
|
+
li {
|
|
69
|
+
list-style: none;
|
|
70
|
+
display: inline;
|
|
71
|
+
}
|
|
62
72
|
}
|
|
63
73
|
|
|
64
74
|
&__chip {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HNDesignsystemFilter } from '../../../resources/Resources';
|
|
1
2
|
import { FilterValues, UseFilterReturn } from '../useFilter';
|
|
2
3
|
export interface FilterOverviewLink {
|
|
3
4
|
/** The filter key to read values from */
|
|
@@ -14,6 +15,8 @@ export interface FilterOverviewLinkListProps<T extends FilterValues> {
|
|
|
14
15
|
getLabel: (key: keyof T, value: unknown) => string;
|
|
15
16
|
/** Configuration for which filter keys to show as links */
|
|
16
17
|
links: FilterOverviewLink[];
|
|
18
|
+
/** Resources for the component */
|
|
19
|
+
resources?: Partial<HNDesignsystemFilter>;
|
|
17
20
|
}
|
|
18
|
-
declare function FilterOverviewLinkList<T extends FilterValues>({ filter, getLabel, links }: FilterOverviewLinkListProps<T>): React.ReactNode;
|
|
21
|
+
declare function FilterOverviewLinkList<T extends FilterValues>({ filter, getLabel, links, resources, }: FilterOverviewLinkListProps<T>): React.ReactNode;
|
|
19
22
|
export default FilterOverviewLinkList;
|