@helsenorge/designsystem-react 15.7.2 → 16.1.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 +2664 -997
- package/lib/Close.js +1 -1
- package/lib/Close.js.map +1 -1
- package/lib/Drawer.js +3 -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/Expander.js +1 -0
- package/lib/Expander.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/HorizontalScroll.js +6 -10
- package/lib/HorizontalScroll.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/StackedCellContent.js +15 -0
- package/lib/StackedCellContent.js.map +1 -0
- package/lib/TabList.js +5 -5
- package/lib/TabList.js.map +1 -1
- package/lib/TabPanel.js +1 -0
- package/lib/TabPanel.js.map +1 -1
- package/lib/TableContext.js +26 -0
- package/lib/TableContext.js.map +1 -0
- package/lib/Toggle.js +2 -2
- package/lib/Toggle.js.map +1 -1
- package/lib/UNSAFE_TableBody.js +22 -0
- package/lib/UNSAFE_TableBody.js.map +1 -0
- package/lib/UNSAFE_TableCell.js +26 -0
- package/lib/UNSAFE_TableCell.js.map +1 -0
- package/lib/UNSAFE_TableDetail.js +17 -0
- package/lib/UNSAFE_TableDetail.js.map +1 -0
- package/lib/UNSAFE_TableExpandedRow.js +46 -0
- package/lib/UNSAFE_TableExpandedRow.js.map +1 -0
- package/lib/UNSAFE_TableHead.js +25 -0
- package/lib/UNSAFE_TableHead.js.map +1 -0
- package/lib/UNSAFE_TableHeadCell.js +182 -0
- package/lib/UNSAFE_TableHeadCell.js.map +1 -0
- package/lib/UNSAFE_TableRow.js +130 -0
- package/lib/UNSAFE_TableRow.js.map +1 -0
- package/lib/VisualRadio.js +1 -1
- package/lib/VisualRadio.js.map +1 -1
- package/lib/__mocks__/ResizeObserver.js +4 -1
- package/lib/__mocks__/ResizeObserver.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 +28 -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/ExpanderHierarchy/index.js +1 -0
- package/lib/components/ExpanderHierarchy/index.js.map +1 -1
- package/lib/components/ExpanderList/index.js +21 -19
- package/lib/components/ExpanderList/index.js.map +1 -1
- package/lib/components/ExpanderList/styles.module.scss +11 -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/HorizontalScroll/HorizontalScroll.d.ts +0 -4
- package/lib/components/HorizontalScroll/styles.module.scss +1 -4
- package/lib/components/HorizontalScroll/styles.module.scss.d.ts +0 -1
- 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/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 +6 -3
- 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/PopMenu.d.ts +4 -0
- package/lib/components/PopMenu/index.js +10 -5
- 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/Table/index.js +0 -1
- package/lib/components/Table/index.js.map +1 -1
- 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/UNSAFE_Table/StackedCellContent.d.ts +9 -0
- package/lib/components/UNSAFE_Table/TableCaption.d.ts +10 -0
- package/lib/components/UNSAFE_Table/TableContext.d.ts +22 -0
- package/lib/components/UNSAFE_Table/UNSAFE_Table.d.ts +37 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableBody/UNSAFE_TableBody.d.ts +10 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableBody/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableBody/index.js +2 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableCell/UNSAFE_TableCell.d.ts +15 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableCell/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableCell/index.js +7 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableCell/index.js.map +1 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/UNSAFE_TableDetail.d.ts +12 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/index.js +7 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/index.js.map +1 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/UNSAFE_TableExpandedRow.d.ts +17 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/index.js +7 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/index.js.map +1 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableExpanderCell/UNSAFE_TableExpanderCellMobile.d.ts +4 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHead/UNSAFE_TableHead.d.ts +8 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHead/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHead/index.js +7 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHead/index.js.map +1 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHeadCell/UNSAFE_TableHeadCell.d.ts +15 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHeadCell/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableHeadCell/index.js +2 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TablePopMenuCell/UNSAFE_TablePopMenuCell.d.ts +8 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableRow/UNSAFE_TableRow.d.ts +20 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableRow/index.d.ts +3 -0
- package/lib/components/UNSAFE_Table/UNSAFE_TableRow/index.js +2 -0
- package/lib/components/UNSAFE_Table/constants.d.ts +29 -0
- package/lib/components/UNSAFE_Table/index.d.ts +19 -0
- package/lib/components/UNSAFE_Table/index.js +182 -0
- package/lib/components/UNSAFE_Table/index.js.map +1 -0
- package/lib/components/UNSAFE_Table/resourceHelper.d.ts +3 -0
- package/lib/components/UNSAFE_Table/styles.module.scss +621 -0
- package/lib/components/UNSAFE_Table/styles.module.scss.d.ts +62 -0
- package/lib/components/UNSAFE_Table/useTableExpandedRows.d.ts +12 -0
- package/lib/components/UNSAFE_Table/useTableShowMore.d.ts +25 -0
- package/lib/components/UNSAFE_Table/utils.d.ts +47 -0
- 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/constants3.js +42 -0
- package/lib/constants3.js.map +1 -0
- package/lib/floating-ui.react.js +3 -460
- 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/hooks/useSort.d.ts +88 -0
- package/lib/hooks/useSort.js +91 -0
- package/lib/hooks/useSort.js.map +1 -0
- package/lib/hooks/useSort.test.js +11739 -0
- package/lib/hooks/useSort.test.js.map +1 -0
- package/lib/hooks/useSynchronousResizeObserver.d.ts +11 -0
- package/lib/hooks/useSynchronousResizeObserver.js +29 -0
- package/lib/hooks/useSynchronousResizeObserver.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -1
- package/lib/resources/HN.Designsystem.Table.nb-NO.json.d.ts +9 -0
- package/lib/resources/Resources.d.ts +19 -0
- package/lib/rolldown-runtime.js +33 -0
- package/lib/scss/_font-mixins.scss +28 -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/scss/typography.module.scss +8 -0
- package/lib/scss/typography.module.scss.d.ts +2 -0
- package/lib/scss/typography.stories.tsx +8 -0
- package/lib/utils/formSpacing.js +3 -3
- package/lib/utils/formSpacing.js.map +1 -1
- package/lib/utils/uuid.js +1 -12
- package/lib/utils/uuid.js.map +1 -1
- package/package.json +61 -15
- package/scss/_font-mixins.scss +28 -1
- 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/scss/typography.module.scss +8 -0
- package/scss/typography.module.scss.d.ts +2 -0
- package/scss/typography.stories.tsx +8 -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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/UNSAFE_Table/TableCaption.tsx","../../../src/components/UNSAFE_Table/resourceHelper.ts","../../../src/components/UNSAFE_Table/UNSAFE_Table.tsx","../../../src/components/UNSAFE_Table/useTableExpandedRows.ts","../../../src/components/UNSAFE_Table/useTableShowMore.ts"],"sourcesContent":["import classNames from 'classnames';\n\nimport styles from './styles.module.scss';\n\nexport interface TableCaptionProps {\n /** Unique ID. Can be used with aria-labelledby, e.g. for the scroll container. */\n id?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the content of the caption. */\n children: React.ReactNode;\n}\n\nexport const TableCaption: React.FC<TableCaptionProps> = ({ id, className, children }) => (\n <caption id={id} className={classNames(styles['table-caption'], className)}>\n {children}\n </caption>\n);\n\nexport default TableCaption;\n","import type { HNDesignsystemTable } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport nbNO from '../../resources/HN.Designsystem.Table.nb-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemTable => {\n switch (language) {\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import { useId, useMemo, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { TableContextValue } from './TableContext';\nimport type { HNDesignsystemTable } from '../../resources/Resources';\n\nimport { ResponsiveTableVariant, defaultConfig, TableColors, TableSizes } from './constants';\nimport { getResources } from './resourceHelper';\nimport TableCaption from './TableCaption';\nimport { TableContext } from './TableContext';\nimport {\n getAvailableWidth,\n getColumnHeadingTexts,\n getHiddenColumns,\n getBreakpointClass,\n getCenteredOverflowTableStyle,\n getCurrentConfig,\n omitProps,\n} from './utils';\nimport { LanguageLocales } from '../../constants';\nimport { useBreakpoint, type Breakpoint } from '../../hooks/useBreakpoint';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport { useLayoutEvent } from '../../hooks/useLayoutEvent';\nimport { useSynchronousResizeObserver } from '../../hooks/useSynchronousResizeObserver';\nimport HorizontalScroll from '../HorizontalScroll';\n\nimport styles from './styles.module.scss';\n\nexport interface BreakpointConfig {\n /** Breakpoint at which responsive behaviour will be applied. The table component uses a \"desktop first\" approach. */\n breakpoint: keyof typeof Breakpoint;\n /** Desired behaviour on this breakpoint and all smaller screens. */\n variant: keyof typeof ResponsiveTableVariant;\n /** If variant is horizontallscroll, use a fallback instead of device is not a touch device. */\n fallbackVariant?: keyof typeof ResponsiveTableVariant;\n}\n\nexport interface UNSAFE_TableProps extends Omit<React.ComponentPropsWithoutRef<'table'>, 'style'> {\n /** Customize how the table behaves on various screen widths */\n breakpointConfig?: BreakpointConfig | BreakpointConfig[];\n /** Description of the table for screen readers. Rendered as a visually hidden caption and used to label the scroll container. */\n caption: string;\n /** Sets the content of the table. Use TableHead and UNSAFE_TableBody */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Header category for styling. Default: normal */\n color?: TableColors;\n /** Unique ID */\n id?: string;\n /** Resources for component */\n resources?: Partial<HNDesignsystemTable>;\n /** For display with less space. Discouraged to use together with interactive elements. */\n size?: TableSizes;\n /** Width of the head column in percentage in the stack variant. When not set, the column follows the widest heading in the table, but wraps (minimum 30%) when the content needs the space. */\n stackHeadWidth?: number;\n /** Id used for testing */\n testId?: string;\n /** Applies zebra stripes to every other row. Default: false */\n zebraStripes?: boolean;\n}\n\nexport const UNSAFE_Table: React.FC<UNSAFE_TableProps> = ({\n breakpointConfig = defaultConfig,\n caption,\n children,\n className,\n color,\n id,\n resources,\n size = TableSizes.normal,\n stackHeadWidth,\n testId,\n zebraStripes = false,\n ...rest\n}) => {\n const captionElementId = useId();\n\n const [tableWidth, setTableWidth] = useState<number>(0);\n const [parentWidth, setParentWidth] = useState<number>(0);\n const [windowWidth, setWindowWidth] = useState(document.documentElement.clientWidth || window.innerWidth);\n const tableRef = useRef<HTMLTableElement>(null);\n const breakpoint = useBreakpoint();\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n const mergedResources: HNDesignsystemTable = {\n ...defaultResources,\n ...resources,\n };\n\n const currentConfig = useMemo(\n () => getCurrentConfig(breakpointConfig, breakpoint, tableWidth, windowWidth),\n [breakpointConfig, breakpoint, tableWidth, windowWidth]\n );\n\n useSynchronousResizeObserver(\n tableRef,\n (tableElement, parentElement) => {\n if (currentConfig?.variant !== ResponsiveTableVariant.stack) {\n setTableWidth(tableElement.getBoundingClientRect().width);\n }\n const parentStyle = getComputedStyle(parentElement);\n const horizontalSpacing = [\n parentStyle.paddingLeft,\n parentStyle.paddingRight,\n parentStyle.borderLeftWidth,\n parentStyle.borderRightWidth,\n ].reduce((total, value) => total + (Number.parseFloat(value) || 0), 0);\n setParentWidth(Math.max(0, parentElement.getBoundingClientRect().width - horizontalSpacing));\n setWindowWidth(getAvailableWidth(parentElement));\n },\n [currentConfig?.variant]\n );\n\n useLayoutEvent(\n () => {\n if (tableRef.current?.parentElement) {\n setWindowWidth(getAvailableWidth(tableRef.current.parentElement));\n }\n },\n ['resize'],\n 100\n );\n\n const tableStyle: React.CSSProperties | undefined =\n currentConfig?.variant === ResponsiveTableVariant.centeredoverflow || stackHeadWidth !== undefined\n ? {\n ...(currentConfig?.variant === ResponsiveTableVariant.centeredoverflow\n ? getCenteredOverflowTableStyle(parentWidth, tableWidth)\n : undefined),\n ...(stackHeadWidth !== undefined ? { '--table-stack-columns': `${stackHeadWidth}% minmax(0, 1fr)` } : undefined),\n }\n : undefined;\n\n const breakpointClass = getBreakpointClass(currentConfig);\n const tableClass = classNames(styles.table, breakpointClass, className);\n const domRest = omitProps(rest as Record<string, unknown>, ['breakpoint', 'variant', 'fallbackVariant', 'headerCategory']);\n\n const hiddenColumns = useMemo(() => getHiddenColumns(children), [children]);\n const headingTexts = useMemo(() => getColumnHeadingTexts(children), [children]);\n\n const tableContext = useMemo<TableContextValue>(\n () => ({\n variant: currentConfig?.variant ?? ResponsiveTableVariant.normal,\n color: color ?? TableColors.normal,\n size,\n zebraStripes,\n hiddenColumns,\n headingTexts,\n resources: mergedResources,\n }),\n [currentConfig?.variant, color, size, zebraStripes, hiddenColumns, headingTexts]\n );\n\n const table = (\n <table className={tableClass} id={id} data-testid={testId} ref={tableRef} style={tableStyle} {...domRest}>\n <TableCaption id={captionElementId}>{caption}</TableCaption>\n {children}\n </table>\n );\n\n return (\n <TableContext.Provider value={tableContext}>\n {currentConfig?.variant === ResponsiveTableVariant.horizontalscroll ? (\n <HorizontalScroll testId=\"horizontal-scroll\" aria-labelledby={captionElementId}>\n {table}\n </HorizontalScroll>\n ) : (\n table\n )}\n </TableContext.Provider>\n );\n};\n\nexport default UNSAFE_Table;\n","import { useState } from 'react';\n\nexport interface UseTableExpandedRowsReturn {\n /** Current expanded state per row key */\n expandedRows: Record<string, boolean>;\n /** Whether a row is expanded */\n isExpanded: (rowKey: string) => boolean;\n /** Toggle the expanded state of a row */\n toggleExpanded: (rowKey: string) => void;\n /** Collapse all rows, e.g. when the table is re-sorted */\n collapseAll: () => void;\n}\n\n/** Expanded state per row for tables with expandable rows (UNSAFE_TableRow expandedContent/hideBehindExpander). */\nexport const useTableExpandedRows = (): UseTableExpandedRowsReturn => {\n const [expandedRows, setExpandedRows] = useState<Record<string, boolean>>({});\n\n const isExpanded = (rowKey: string): boolean => !!expandedRows[rowKey];\n\n const toggleExpanded = (rowKey: string): void => {\n setExpandedRows(prev => ({ ...prev, [rowKey]: !prev[rowKey] }));\n };\n\n const collapseAll = (): void => {\n setExpandedRows({});\n };\n\n return { expandedRows, isExpanded, toggleExpanded, collapseAll };\n};\n","import { useEffect, useMemo, useRef, useState } from 'react';\n\nexport interface UseTableShowMoreOptions<TData> {\n /** All rows */\n data: TData[];\n /** Number of rows to show initially and to reveal per showMore(). Shows all rows when not set. */\n pageSize?: number;\n}\n\nexport interface UseTableShowMoreReturn<TData, TElement extends HTMLElement> {\n /** The rows that are currently visible */\n visibleData: TData[];\n /** Whether there are more rows to show */\n hasMore: boolean;\n /** Reveal the next page of rows */\n showMore: () => void;\n /** Reset to the initial number of visible rows */\n reset: () => void;\n /** Index of the first row revealed by the last showMore() call */\n newRowsStartIndex?: number;\n /**\n * Attach to a focusable element in the first newly revealed row (index === newRowsStartIndex).\n * The element receives focus when the last page is revealed and the show more button disappears.\n */\n firstNewRowRef: React.RefObject<TElement | null>;\n}\n\n/** Progressive disclosure (\"show more\") of table rows, with focus management when the show more button disappears. */\nexport const useTableShowMore = <TData, TElement extends HTMLElement = HTMLElement>({\n data,\n pageSize,\n}: UseTableShowMoreOptions<TData>): UseTableShowMoreReturn<TData, TElement> => {\n const [visibleCount, setVisibleCount] = useState(pageSize);\n const [newRowsStartIndex, setNewRowsStartIndex] = useState<number>();\n const firstNewRowRef = useRef<TElement>(null);\n const shouldFocusNewRow = useRef(false);\n\n const visibleData = useMemo(() => (visibleCount === undefined ? data : data.slice(0, visibleCount)), [data, visibleCount]);\n const hasMore = visibleCount !== undefined && visibleCount < data.length;\n\n const showMore = (): void => {\n if (visibleCount === undefined || pageSize === undefined) {\n return;\n }\n const newCount = Math.min(visibleCount + pageSize, data.length);\n // Flytt fokus når \"vis mer\"-knappen forsvinner, slik at fokus ikke går tapt\n shouldFocusNewRow.current = newCount >= data.length;\n setNewRowsStartIndex(visibleCount);\n setVisibleCount(newCount);\n };\n\n useEffect(() => {\n if (shouldFocusNewRow.current) {\n shouldFocusNewRow.current = false;\n firstNewRowRef.current?.focus();\n }\n }, [visibleCount]);\n\n const reset = (): void => {\n setVisibleCount(pageSize);\n setNewRowsStartIndex(undefined);\n };\n\n return { visibleData, hasMore, showMore, reset, newRowsStartIndex, firstNewRowRef };\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../../scss/font-settings' as font-settings;
|
|
3
|
+
@use '../../scss/font-mixins' as fonts;
|
|
4
|
+
@use '../../scss/screen-reader' as sr;
|
|
5
|
+
@import '../../scss/breakpoints';
|
|
6
|
+
@import '../../scss/grid';
|
|
7
|
+
|
|
8
|
+
$table-border: 1px solid var(--color-base-neutral-border-normal);
|
|
9
|
+
$expanded-row-shadow: inset 3px 0 var(--color-base-neutral-border-normal);
|
|
10
|
+
$zebra-background: var(--color-base-neutral-background-light);
|
|
11
|
+
$zebra-cell-hover: var(--color-action-background-light-plus1-hover);
|
|
12
|
+
$zebra-cell-active: var(--color-action-background-light-plus1-active);
|
|
13
|
+
|
|
14
|
+
.table-caption {
|
|
15
|
+
@include sr.sr-only;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.table__cell {
|
|
19
|
+
@include fonts.table-cell;
|
|
20
|
+
|
|
21
|
+
height: 2.6875rem;
|
|
22
|
+
padding: var(--core-space-2xs) var(--core-space-xs);
|
|
23
|
+
border: 0 solid var(--color-base-neutral-border-normal);
|
|
24
|
+
border-width: 1px 0 0 1px;
|
|
25
|
+
vertical-align: top;
|
|
26
|
+
text-align: left;
|
|
27
|
+
|
|
28
|
+
&--transparent {
|
|
29
|
+
background: transparent;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&--center {
|
|
33
|
+
text-align: center;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&--right {
|
|
37
|
+
text-align: right;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&--nowrap {
|
|
41
|
+
white-space: nowrap;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
45
|
+
height: 2.6875rem;
|
|
46
|
+
padding: var(--core-space-s);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&--compact {
|
|
50
|
+
height: 1.75rem;
|
|
51
|
+
padding: var(--core-space-3xs);
|
|
52
|
+
|
|
53
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
54
|
+
height: 2.375rem;
|
|
55
|
+
padding: var(--core-space-3xs);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// På cellen, innenfor kantlinjen, slik at den er like bred som skyggen på expander-knappen i raden over
|
|
61
|
+
.table__expanded-row--expanded > .table__cell {
|
|
62
|
+
box-shadow: $expanded-row-shadow;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Krymper Button sitt indre element slik at Button sin egen fokusmarkering legger seg rundt knappen og ikke hele cellen.
|
|
66
|
+
@mixin table-button-content-reset {
|
|
67
|
+
width: auto;
|
|
68
|
+
background: none;
|
|
69
|
+
|
|
70
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
71
|
+
margin-top: 0.19rem;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@mixin table-button-content-no-hover-fill {
|
|
76
|
+
&:hover,
|
|
77
|
+
&:active {
|
|
78
|
+
background: none;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@mixin centeredoverflow {
|
|
83
|
+
position: relative;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@mixin stack {
|
|
87
|
+
display: block;
|
|
88
|
+
clear: both;
|
|
89
|
+
border-width: 0;
|
|
90
|
+
|
|
91
|
+
.table__head {
|
|
92
|
+
display: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.table__head-cell {
|
|
96
|
+
display: block;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.table-body {
|
|
100
|
+
display: grid;
|
|
101
|
+
grid-template-columns: var(--table-stack-columns, minmax(30%, max-content) minmax(30%, auto));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.table__row {
|
|
105
|
+
display: grid;
|
|
106
|
+
grid-template-columns: subgrid;
|
|
107
|
+
grid-column: 1 / -1;
|
|
108
|
+
padding: 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.table__cell {
|
|
112
|
+
position: relative;
|
|
113
|
+
grid-column: 1 / -1;
|
|
114
|
+
align-items: baseline;
|
|
115
|
+
box-sizing: border-box;
|
|
116
|
+
display: block;
|
|
117
|
+
height: auto;
|
|
118
|
+
padding: var(--core-space-2xs) var(--core-space-xs);
|
|
119
|
+
float: none;
|
|
120
|
+
clear: both;
|
|
121
|
+
width: 100%;
|
|
122
|
+
border-width: 0 1px;
|
|
123
|
+
outline: 0;
|
|
124
|
+
|
|
125
|
+
&--stacked {
|
|
126
|
+
// Arver kolonnesporene fra .table-body
|
|
127
|
+
// slik at ledetekstkolonnen er like bred i alle rader
|
|
128
|
+
display: grid;
|
|
129
|
+
grid-template-columns: subgrid;
|
|
130
|
+
|
|
131
|
+
&:nth-child(1 of .table__cell--stacked) {
|
|
132
|
+
padding-block-start: var(--core-space-xs);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&:nth-last-child(1 of .table__cell--stacked) {
|
|
136
|
+
padding-block-end: var(--core-space-xs);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
141
|
+
padding: var(--core-space-xs);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&--compact {
|
|
145
|
+
padding-block: var(--core-space-3xs);
|
|
146
|
+
|
|
147
|
+
&:nth-child(1 of .table__cell--compact):not(.table__cell-pop-menu, .table__expander-cell-mobile) {
|
|
148
|
+
padding-block-start: var(--core-space-2xs);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&:nth-last-child(1 of .table__cell--compact):not(.table__cell-pop-menu, .table__expander-cell-mobile) {
|
|
152
|
+
padding-block-end: var(--core-space-2xs);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&--center {
|
|
157
|
+
text-align: left;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&--right {
|
|
161
|
+
text-align: left;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&:not(.expandable-container) {
|
|
165
|
+
font-weight: 400;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
> .table__cell-heading-text {
|
|
169
|
+
@include fonts.table-header-stack;
|
|
170
|
+
|
|
171
|
+
display: block;
|
|
172
|
+
box-sizing: border-box;
|
|
173
|
+
padding-right: var(--core-space-xs);
|
|
174
|
+
overflow-wrap: break-word;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
> .table__cell-content {
|
|
178
|
+
min-width: 0;
|
|
179
|
+
overflow-wrap: break-word;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Celler markert med hideBehindExpander vises i den utvidbare raden i stedet
|
|
184
|
+
.table__cell--behind-expander {
|
|
185
|
+
display: none;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.table__cell-expander {
|
|
189
|
+
display: none;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.table__expander-cell-mobile,
|
|
193
|
+
.table__cell-pop-menu {
|
|
194
|
+
display: block;
|
|
195
|
+
float: none;
|
|
196
|
+
clear: both;
|
|
197
|
+
grid-column: 1 / -1;
|
|
198
|
+
box-sizing: border-box;
|
|
199
|
+
width: 100%;
|
|
200
|
+
min-width: 0;
|
|
201
|
+
max-width: 100%;
|
|
202
|
+
padding: 0;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.table__expander-cell-mobile {
|
|
206
|
+
height: auto;
|
|
207
|
+
border-bottom: $table-border;
|
|
208
|
+
|
|
209
|
+
&--expanded {
|
|
210
|
+
border-bottom: 0;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.table__expander-trigger {
|
|
214
|
+
display: flex;
|
|
215
|
+
width: 100%;
|
|
216
|
+
justify-content: center;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.table__cell-pop-menu {
|
|
221
|
+
height: auto;
|
|
222
|
+
|
|
223
|
+
.table__pop-menu {
|
|
224
|
+
position: static;
|
|
225
|
+
display: flex;
|
|
226
|
+
|
|
227
|
+
.table__pop-menu__trigger {
|
|
228
|
+
height: auto;
|
|
229
|
+
justify-content: flex-start;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.table__pop-menu__content {
|
|
233
|
+
width: 100%;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.table__expanded-row > .table__cell {
|
|
239
|
+
height: auto;
|
|
240
|
+
text-align: left;
|
|
241
|
+
padding: 0.75rem;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.table__row--expanded > .table__cell {
|
|
245
|
+
border-left: $table-border;
|
|
246
|
+
box-shadow: $expanded-row-shadow;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.table__expanded-row--expanded {
|
|
250
|
+
box-shadow: none;
|
|
251
|
+
|
|
252
|
+
> .table__cell {
|
|
253
|
+
border-left: $table-border;
|
|
254
|
+
box-shadow: $expanded-row-shadow;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.table__cell:first-child {
|
|
259
|
+
border-top: $table-border;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.table__expanded-row {
|
|
263
|
+
display: none;
|
|
264
|
+
|
|
265
|
+
&--expanded {
|
|
266
|
+
display: grid;
|
|
267
|
+
grid-template-columns: subgrid;
|
|
268
|
+
grid-column: 1 / -1;
|
|
269
|
+
border-bottom: $table-border;
|
|
270
|
+
|
|
271
|
+
> .table__cell:first-child {
|
|
272
|
+
border-top: 0;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.table__row:last-child .table__cell:last-child {
|
|
278
|
+
border-bottom: $table-border;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.table__row--expandable + .table__row > .table__cell:first-child {
|
|
282
|
+
border-top: 0;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.table__row--expanded .table__expander-trigger,
|
|
286
|
+
.table__row--expanded .table__cell-pop-menu > .table__pop-menu .table__pop-menu__trigger {
|
|
287
|
+
box-shadow: $expanded-row-shadow;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// UNSAFE_TableDetail i utvidet rad: samme kolonnebredder som resten av tabellen
|
|
291
|
+
.table__expanded-row > td.table__expanded-row__cell:has(> .table__detail) {
|
|
292
|
+
display: grid;
|
|
293
|
+
grid-template-columns: subgrid;
|
|
294
|
+
padding: 0;
|
|
295
|
+
|
|
296
|
+
> .table__cell {
|
|
297
|
+
border: 0;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
> :not(.table__detail, button) {
|
|
301
|
+
grid-column: 1 / -1;
|
|
302
|
+
|
|
303
|
+
// Innholdet skal ikke påvirke kolonnebreddene som resten av tabellen bruker
|
|
304
|
+
contain: inline-size;
|
|
305
|
+
padding: 0 0.75rem;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
> button {
|
|
309
|
+
grid-column: 1 / -1;
|
|
310
|
+
justify-self: start;
|
|
311
|
+
margin: 0 var(--core-space-xs);
|
|
312
|
+
|
|
313
|
+
&:last-child {
|
|
314
|
+
margin: var(--core-space-xs);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.table__row--expandable + .table__expanded-row + .table__row > .table__cell:first-child {
|
|
320
|
+
border-top: 0;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.table-body > .table__row--expandable:first-child {
|
|
324
|
+
border-top: $table-border;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.table-body > .table__row--expandable:first-child > .table__cell:first-child {
|
|
328
|
+
border-top: 0;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.table-body--zebra > .table__row:nth-child(even of .table__row:not(.table__row--expanded)) > .table__cell {
|
|
332
|
+
background: $zebra-background;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
select {
|
|
336
|
+
max-width: 100%;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.table {
|
|
341
|
+
width: 100%;
|
|
342
|
+
|
|
343
|
+
// Separate i stedet for collapse: sammenslåtte borders deles i halve piksler og kan bli 2px på enkelte skjermer
|
|
344
|
+
border-collapse: separate;
|
|
345
|
+
border-spacing: 0;
|
|
346
|
+
|
|
347
|
+
// Høyre og nederste linje tegnes av tabellen, så de ikke avhenger av hvilken celle som er sist
|
|
348
|
+
border: 0 solid var(--color-base-neutral-border-normal);
|
|
349
|
+
border-width: 0 1px 1px 0;
|
|
350
|
+
|
|
351
|
+
@each $breakpoint in map.keys($grid-breakpoints) {
|
|
352
|
+
&--centeredoverflow-#{$breakpoint} {
|
|
353
|
+
@include media-breakpoint-down($breakpoint) {
|
|
354
|
+
@include centeredoverflow;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
&--stack-#{$breakpoint} {
|
|
359
|
+
@include media-breakpoint-down($breakpoint) {
|
|
360
|
+
@include stack;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
&__expander-cell-mobile {
|
|
366
|
+
position: relative;
|
|
367
|
+
display: none;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.table__head-cell {
|
|
372
|
+
height: 2.6875rem;
|
|
373
|
+
padding: var(--core-space-2xs) var(--core-space-xs);
|
|
374
|
+
background: var(--color-base-neutral-background-light);
|
|
375
|
+
border: 0 solid var(--color-base-neutral-border-normal);
|
|
376
|
+
border-width: 1px 0 0 1px;
|
|
377
|
+
text-align: left;
|
|
378
|
+
vertical-align: bottom;
|
|
379
|
+
|
|
380
|
+
@include fonts.table-header;
|
|
381
|
+
|
|
382
|
+
&--transparent {
|
|
383
|
+
background: transparent;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
387
|
+
height: 2.6875rem;
|
|
388
|
+
padding: var(--core-space-s);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
&--compact {
|
|
392
|
+
height: 1.75rem;
|
|
393
|
+
padding: var(--core-space-3xs);
|
|
394
|
+
vertical-align: top;
|
|
395
|
+
|
|
396
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
397
|
+
height: 2.6875rem;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.table__cell-heading-text {
|
|
403
|
+
display: none;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.table__cell-expander,
|
|
407
|
+
.table__cell-pop-menu {
|
|
408
|
+
position: relative;
|
|
409
|
+
padding: 0;
|
|
410
|
+
width: 2.75rem;
|
|
411
|
+
min-width: 2.75rem;
|
|
412
|
+
|
|
413
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
414
|
+
width: 3.375rem;
|
|
415
|
+
min-width: 3.375rem;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
&:where(.table__cell--compact) {
|
|
419
|
+
height: 2.75rem;
|
|
420
|
+
|
|
421
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
422
|
+
height: 2.75rem;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.table__expander-button {
|
|
428
|
+
position: absolute;
|
|
429
|
+
inset: 0;
|
|
430
|
+
display: flex;
|
|
431
|
+
align-items: flex-start;
|
|
432
|
+
justify-content: center;
|
|
433
|
+
min-width: 0;
|
|
434
|
+
min-height: 0;
|
|
435
|
+
background: none;
|
|
436
|
+
border: 0;
|
|
437
|
+
padding: 0;
|
|
438
|
+
cursor: pointer;
|
|
439
|
+
|
|
440
|
+
&:hover {
|
|
441
|
+
background: var(--color-action-background-light-hover);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
&:active {
|
|
445
|
+
background: var(--color-action-background-light-active);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.table__expander-button__content {
|
|
450
|
+
@include table-button-content-reset;
|
|
451
|
+
@include table-button-content-no-hover-fill;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.table__expander-trigger {
|
|
455
|
+
&:hover {
|
|
456
|
+
background: var(--color-action-background-light-hover);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
&:active {
|
|
460
|
+
background: var(--color-action-background-light-active);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.table__expander-trigger__content {
|
|
465
|
+
background: none;
|
|
466
|
+
|
|
467
|
+
@include table-button-content-no-hover-fill;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.table__pop-menu {
|
|
471
|
+
position: absolute;
|
|
472
|
+
inset: 0;
|
|
473
|
+
|
|
474
|
+
// Trekkerknappen skal fylle hele cellen, overstyrer Button-stilene
|
|
475
|
+
.table__pop-menu__trigger {
|
|
476
|
+
width: 100%;
|
|
477
|
+
height: 100%;
|
|
478
|
+
min-width: 0;
|
|
479
|
+
min-height: 0;
|
|
480
|
+
padding: 0;
|
|
481
|
+
border-radius: 0;
|
|
482
|
+
align-items: flex-start;
|
|
483
|
+
justify-content: center;
|
|
484
|
+
|
|
485
|
+
&:hover {
|
|
486
|
+
background: var(--color-action-background-light-hover);
|
|
487
|
+
box-shadow: none;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
&:active {
|
|
491
|
+
background: var(--color-action-background-light-active);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.table__pop-menu__content {
|
|
496
|
+
@include table-button-content-reset;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.table__row {
|
|
501
|
+
background: var(--color-action-background-light-normal);
|
|
502
|
+
|
|
503
|
+
&--transparent {
|
|
504
|
+
background: transparent;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
&--expanded {
|
|
508
|
+
background: var(--color-action-background-light-plus2-normal);
|
|
509
|
+
|
|
510
|
+
.table__expander-button,
|
|
511
|
+
.table__expander-trigger {
|
|
512
|
+
box-shadow: $expanded-row-shadow;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.table__expander-button:hover,
|
|
516
|
+
.table__expander-trigger:hover {
|
|
517
|
+
background: var(--color-action-background-light-plus2-hover);
|
|
518
|
+
box-shadow: $expanded-row-shadow;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.table__expander-button:active,
|
|
522
|
+
.table__expander-trigger:active {
|
|
523
|
+
background: var(--color-action-background-light-plus2-active);
|
|
524
|
+
box-shadow: $expanded-row-shadow;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.table__pop-menu .table__pop-menu__trigger:hover {
|
|
528
|
+
background: var(--color-action-background-light-plus2-hover);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.table__pop-menu .table__pop-menu__trigger:active {
|
|
532
|
+
background: var(--color-action-background-light-plus2-active);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.table__cell-expander:focus-within,
|
|
538
|
+
.table__cell-pop-menu:focus-within,
|
|
539
|
+
.table__expander-cell-mobile:focus-within {
|
|
540
|
+
z-index: 1;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.table-body--zebra {
|
|
544
|
+
> .table__row:nth-child(even of .table__row:not(.table__row--expanded)) {
|
|
545
|
+
background: $zebra-background;
|
|
546
|
+
|
|
547
|
+
> .table__cell-expander,
|
|
548
|
+
> .table__cell-pop-menu,
|
|
549
|
+
> .table__expander-cell-mobile {
|
|
550
|
+
background: $zebra-background;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.table__expander-button:hover,
|
|
554
|
+
.table__expander-trigger:hover,
|
|
555
|
+
.table__pop-menu .table__pop-menu__trigger:hover {
|
|
556
|
+
background: $zebra-cell-hover;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
.table__expander-button:active,
|
|
560
|
+
.table__expander-trigger:active,
|
|
561
|
+
.table__pop-menu .table__pop-menu__trigger:active {
|
|
562
|
+
background: $zebra-cell-active;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// Vises kun i stack-visning
|
|
568
|
+
.table__detail {
|
|
569
|
+
display: none;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.table__expanded-row {
|
|
573
|
+
display: none;
|
|
574
|
+
|
|
575
|
+
&--expanded {
|
|
576
|
+
display: table-row;
|
|
577
|
+
background: var(--color-base-blueberry-background-light);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
// Skjul-knappen ligger alltid på egen linje, også når innholdet inneholder knapper
|
|
581
|
+
&__cell > button:last-child {
|
|
582
|
+
display: flex;
|
|
583
|
+
width: fit-content;
|
|
584
|
+
margin-top: var(--core-space-xs);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// Kolonner bak expander vises i selve raden utenfor stack-visning
|
|
588
|
+
&--stack-only {
|
|
589
|
+
display: none;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
&-details {
|
|
593
|
+
margin: 0;
|
|
594
|
+
|
|
595
|
+
dt {
|
|
596
|
+
font-weight: 600;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
dd {
|
|
600
|
+
margin: 0 0 var(--core-space-2xs);
|
|
601
|
+
|
|
602
|
+
&:last-child {
|
|
603
|
+
margin-bottom: 0;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
&-container {
|
|
609
|
+
padding: 0.5rem;
|
|
610
|
+
|
|
611
|
+
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
612
|
+
&--open {
|
|
613
|
+
border-bottom: 1px solid var(--color-base-neutral-border-normal);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
&__cell {
|
|
619
|
+
padding: var(--core-space-s);
|
|
620
|
+
}
|
|
621
|
+
}
|