@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
|
@@ -1,2 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnalyticsId } from "../../constants.js";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import styles from "./styles.module.scss";
|
|
5
|
+
//#region src/components/DictionaryTrigger/DictionaryTrigger.tsx
|
|
6
|
+
var DictionaryTrigger = (props) => {
|
|
7
|
+
const { children, selected = false, className, testId, ref, ...rest } = props;
|
|
8
|
+
const triggerClasses = classNames(styles.dictionarytrigger, className);
|
|
9
|
+
return /* @__PURE__ */ jsx("button", {
|
|
10
|
+
type: "button",
|
|
11
|
+
"data-testid": testId,
|
|
12
|
+
"data-analyticsid": AnalyticsId.DictionaryTrigger,
|
|
13
|
+
className: triggerClasses,
|
|
14
|
+
"aria-expanded": selected,
|
|
15
|
+
ref,
|
|
16
|
+
...rest,
|
|
17
|
+
children
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
DictionaryTrigger.displayName = "DictionaryTrigger";
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/components/DictionaryTrigger/index.ts
|
|
23
|
+
var DictionaryTrigger_default = DictionaryTrigger;
|
|
24
|
+
//#endregion
|
|
2
25
|
export { DictionaryTrigger_default as default };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/DictionaryTrigger/DictionaryTrigger.tsx","../../../src/components/DictionaryTrigger/index.ts"],"sourcesContent":["import classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\n\nimport styles from './styles.module.scss';\n\nexport interface DictionaryTriggerProps extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onFocus' | 'onBlur'> {\n /**\n * Sets the content of the trigger.\n */\n children: React.ReactNode;\n /**\n * Indicates that the trigger is in use.\n */\n selected?: boolean;\n /**\n * Classname will be applied to the button element.\n */\n className?: string;\n /**\n * Sets the data-testid attribute.\n */\n testId?: string;\n /**\n * ref that is passed to the component\n */\n ref?: React.Ref<HTMLButtonElement | null>;\n}\n\nconst DictionaryTrigger: React.FC<DictionaryTriggerProps> = (props: DictionaryTriggerProps) => {\n const { children, selected = false, className, testId, ref, ...rest } = props;\n const triggerClasses = classNames(styles.dictionarytrigger, className);\n\n return (\n <button\n type=\"button\"\n data-testid={testId}\n data-analyticsid={AnalyticsId.DictionaryTrigger}\n className={triggerClasses}\n aria-expanded={selected}\n ref={ref}\n {...rest}\n >\n {children}\n </button>\n );\n};\n\nDictionaryTrigger.displayName = 'DictionaryTrigger';\n\nexport default DictionaryTrigger;\n","import DictionaryTrigger from './DictionaryTrigger';\nexport * from './DictionaryTrigger';\nexport default DictionaryTrigger;\n"],"mappings":";;;;;AA6BA,IAAM,qBAAuD,UAAkC;CAC7F,MAAM,EAAE,UAAU,WAAW,OAAO,WAAW,QAAQ,KAAK,GAAG,SAAS;CACxE,MAAM,iBAAiB,WAAW,OAAO,mBAAmB,SAAS;CAErE,OACE,oBAAC,UAAD;EACE,MAAK;EACL,eAAa;EACb,oBAAkB,YAAY;EAC9B,WAAW;EACX,iBAAe;EACV;EACL,GAAI;EAEH;CACK,CAAA;AAEZ;AAEA,kBAAkB,cAAc;;;AC9ChC,IAAA,4BAAe"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
@use '../../scss/palette' as palette;
|
|
2
|
-
@import '../../scss/supernova/styles/colors.css';
|
|
3
|
-
@import '../../scss/supernova/styles/spacers.css';
|
|
4
2
|
|
|
5
3
|
.dictionarytrigger {
|
|
6
4
|
all: unset;
|
|
@@ -10,7 +8,7 @@
|
|
|
10
8
|
padding: 0 var(--core-space-4xs);
|
|
11
9
|
background-color: transparent;
|
|
12
10
|
|
|
13
|
-
--dot-color: var(--color-help-border
|
|
11
|
+
--dot-color: var(--color-help-border);
|
|
14
12
|
|
|
15
13
|
// The radial-gradient consists of a circle with empty space to the right, making up a dotted pattern when repeated horizontally
|
|
16
14
|
background-image: radial-gradient(circle at 1.5px 1.5px, var(--dot-color) 1.5px, transparent 1.5px);
|
|
@@ -21,7 +19,7 @@
|
|
|
21
19
|
&:hover {
|
|
22
20
|
background-color: var(--color-help-background-transparent-onlight-hover);
|
|
23
21
|
|
|
24
|
-
--dot-color: var(--color-help-border-
|
|
22
|
+
--dot-color: var(--color-help-border-plus1);
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
&:focus-visible {
|
|
@@ -32,11 +30,11 @@
|
|
|
32
30
|
&[aria-expanded='true'] {
|
|
33
31
|
background-color: var(--color-help-background-transparent-onlight-hover);
|
|
34
32
|
|
|
35
|
-
--dot-color: var(--color-help-border-
|
|
33
|
+
--dot-color: var(--color-help-border-plus1);
|
|
36
34
|
|
|
37
35
|
&:hover,
|
|
38
36
|
&:focus-visible {
|
|
39
|
-
background-color: var(--color-help-background-transparent-onlight-
|
|
37
|
+
background-color: var(--color-help-background-transparent-onlight-hoverselected);
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
&:focus-visible {
|
|
@@ -45,8 +43,8 @@
|
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
&:active {
|
|
48
|
-
background-color: var(--color-help-background-transparent-onlight-
|
|
46
|
+
background-color: var(--color-help-background-transparent-onlight-hoverselected);
|
|
49
47
|
|
|
50
|
-
--dot-color: var(--color-help-border-
|
|
48
|
+
--dot-color: var(--color-help-border-plus1);
|
|
51
49
|
}
|
|
52
50
|
}
|
|
@@ -48,10 +48,6 @@ export interface InnerDrawerProps {
|
|
|
48
48
|
resources?: Partial<HNDesignsystemDrawer>;
|
|
49
49
|
/** Sets mobile styling and animation from outer level Drawer */
|
|
50
50
|
isMobile?: boolean;
|
|
51
|
-
/** Shows a back button to the left of title */
|
|
52
|
-
withBackButton?: boolean;
|
|
53
|
-
/** Callback for the back button */
|
|
54
|
-
onRequestBack?: () => void;
|
|
55
51
|
/** Sets classname for content part in Drawer */
|
|
56
52
|
contentClassName?: string;
|
|
57
53
|
/** Sets the content padding of the Drawer */
|
|
@@ -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
|
$desktop-size: 3rem;
|
|
6
5
|
$mobile-inner-size: 2.375rem;
|
|
@@ -44,7 +43,7 @@ $mobile-outer-size: 2.75rem;
|
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
:focus-visible > & {
|
|
47
|
-
outline: 3px solid var(--color-action-border-
|
|
46
|
+
outline: 3px solid var(--color-action-border-dark-focus);
|
|
48
47
|
border-radius: 0;
|
|
49
48
|
border: 0;
|
|
50
49
|
}
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
@use '../../scss/palette' as palette;
|
|
3
3
|
@use '../../scss/font-settings' as font-settings;
|
|
4
4
|
@use '../../scss/breakpoints' as breakpoints;
|
|
5
|
-
@import '../../scss/supernova/styles/colors.css';
|
|
6
|
-
@import '../../scss/supernova/styles/spacers.css';
|
|
7
5
|
|
|
8
6
|
.drawer {
|
|
9
7
|
position: fixed;
|
|
@@ -115,7 +113,12 @@
|
|
|
115
113
|
}
|
|
116
114
|
|
|
117
115
|
&--padding-extra {
|
|
118
|
-
padding: var(--core-space-xs)
|
|
116
|
+
padding-top: var(--core-space-xs);
|
|
117
|
+
padding-bottom: var(--core-space-xs);
|
|
118
|
+
|
|
119
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, xs)) {
|
|
120
|
+
padding: var(--core-space-xs) var(--core-space-s);
|
|
121
|
+
}
|
|
119
122
|
|
|
120
123
|
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
121
124
|
padding: var(--core-space-xs) var(--core-space-m);
|
|
@@ -9,9 +9,9 @@ import { useIsMobileBreakpoint } from "../../hooks/useIsMobileBreakpoint.js";
|
|
|
9
9
|
import { t as Button_default } from "../../Button.js";
|
|
10
10
|
import { useToggle } from "../../hooks/useToggle.js";
|
|
11
11
|
import { useKeyboardEvent } from "../../hooks/useKeyboardEvent.js";
|
|
12
|
-
import {
|
|
12
|
+
import { useDismissablePopover } from "../../hooks/useDismissablePopover.js";
|
|
13
13
|
import Checkbox_default from "../Checkbox/index.js";
|
|
14
|
-
import {
|
|
14
|
+
import { a as useFloating, d as offset, f as shift, l as flip, m as autoUpdate, p as size } from "../../floating-ui.react.js";
|
|
15
15
|
import { n as HN_Designsystem_Dropdown_en_GB_default, t as HN_Designsystem_Dropdown_nb_NO_default } from "../../HN.Designsystem.Dropdown.nb-NO.js";
|
|
16
16
|
import { n as SingleSelectContext, t as SingleSelectItem } from "../../SingleSelectItem.js";
|
|
17
17
|
import ChevronDown from "../Icons/ChevronDown.js";
|
|
@@ -126,11 +126,12 @@ var DropdownBase = (props) => {
|
|
|
126
126
|
openedByKeyboard.current = isKeyboard;
|
|
127
127
|
toggleIsOpen();
|
|
128
128
|
};
|
|
129
|
-
const handleClose = (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
const handleClose = useDismissablePopover({
|
|
130
|
+
popoverRef: dropdownRef,
|
|
131
|
+
triggerRef: buttonRef,
|
|
132
|
+
isOpen,
|
|
133
|
+
onClose: toggleIsOpen
|
|
134
|
+
});
|
|
134
135
|
useEffect(() => {
|
|
135
136
|
if (isOpen && openedByKeyboard.current) {
|
|
136
137
|
(childrenRefList.current?.find((r) => r.current && !r.current.hasAttribute("disabled")))?.current?.focus();
|
|
@@ -144,13 +145,6 @@ var DropdownBase = (props) => {
|
|
|
144
145
|
const handleKeyboardNavigation = (event) => {
|
|
145
146
|
if (!childrenRefList.current) return;
|
|
146
147
|
const key = event.key;
|
|
147
|
-
if (key === KeyboardEventKey.Escape) {
|
|
148
|
-
if (isOpen) {
|
|
149
|
-
event.preventDefault();
|
|
150
|
-
handleClose();
|
|
151
|
-
}
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
148
|
if (!isOpen) {
|
|
155
149
|
if (isListNavKey(key)) {
|
|
156
150
|
event.preventDefault();
|
|
@@ -175,11 +169,9 @@ var DropdownBase = (props) => {
|
|
|
175
169
|
KeyboardEventKey.ArrowUp,
|
|
176
170
|
KeyboardEventKey.End,
|
|
177
171
|
KeyboardEventKey.Enter,
|
|
178
|
-
KeyboardEventKey.Escape,
|
|
179
172
|
KeyboardEventKey.Home,
|
|
180
173
|
KeyboardEventKey.Space
|
|
181
174
|
]);
|
|
182
|
-
useOutsideEvent(dropdownRef, () => isOpen && handleClose());
|
|
183
175
|
const renderChildren = React.Children.map(children, (child, index) => {
|
|
184
176
|
const element = child;
|
|
185
177
|
return /* @__PURE__ */ jsx("li", {
|
|
@@ -258,7 +250,7 @@ var DropdownBase = (props) => {
|
|
|
258
250
|
}), !isSingleSelect && !noCloseButton && /* @__PURE__ */ jsx("div", {
|
|
259
251
|
className: styles.dropdown__close,
|
|
260
252
|
children: /* @__PURE__ */ jsx(Button_default, {
|
|
261
|
-
onClick: handleClose,
|
|
253
|
+
onClick: () => handleClose(),
|
|
262
254
|
children: mergedResources.closeText
|
|
263
255
|
})
|
|
264
256
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Dropdown/resourceHelper.ts","../../../src/components/Dropdown/SingleSelect/SingleSelect.tsx","../../../src/components/Dropdown/Dropdown.tsx","../../../src/components/Dropdown/index.ts"],"sourcesContent":["import type { HNDesignsystemDropdown } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Dropdown.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Dropdown.nb-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemDropdown => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport { SingleSelectContext } from './utils';\n\nexport type SingleSelectContextType = {\n name?: string;\n disabled?: boolean;\n required?: boolean;\n value?: string;\n onValueChange?: (newValue: string, e?: React.SyntheticEvent) => void;\n};\n\nexport interface SingleSelectProps {\n name?: string;\n disabled?: boolean;\n defaultValue?: string;\n onValueChange?: (newValue: string, e?: React.SyntheticEvent) => void;\n children: React.ReactNode;\n}\n\nexport const SingleSelect: React.FC<SingleSelectProps> = ({ name, disabled, defaultValue, onValueChange, children }) => {\n const [selected, setSelected] = React.useState<string | undefined>(defaultValue);\n\n const context = React.useMemo<SingleSelectContextType>(\n () => ({\n name,\n disabled,\n value: selected,\n onValueChange: (v, e): void => {\n setSelected(v);\n onValueChange?.(v, e);\n },\n }),\n [name, disabled, selected, onValueChange]\n );\n\n return <SingleSelectContext.Provider value={context}>{children}</SingleSelectContext.Provider>;\n};\n","import type { ComponentType } from 'react';\nimport React, { useEffect, useRef, useId } from 'react';\n\nimport { autoUpdate, offset, shift, size, useFloating, flip } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { clamp } from 'motion/react';\n\nimport type { SingleSelectItemProps } from './SingleSelect/SingleSelectItem';\nimport type { HNDesignsystemDropdown } from '../../resources/Resources';\nimport type { CheckboxProps } from '../Checkbox';\nimport type { SvgIcon } from '../Icon';\nimport type { IconName } from '../Icons/IconNames';\nimport type { LabelProps } from '../Label';\n\nimport {\n AnalyticsId,\n IconSize,\n KeyboardEventKey,\n LanguageLocales,\n ZIndex,\n usePseudoClasses,\n useKeyboardEvent,\n useOutsideEvent,\n useToggle,\n} from '../..';\nimport { getResources } from './resourceHelper';\nimport { SingleSelectItem } from './SingleSelect/SingleSelectItem';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport { isComponent } from '../../utils/component';\nimport { mergeRefs } from '../../utils/refs';\nimport Button from '../Button';\nimport Checkbox from '../Checkbox';\nimport Icon from '../Icon';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport PlusSmall from '../Icons/PlusSmall';\nimport Label from '../Label';\nimport LazyIcon from '../LazyIcon';\nimport { SingleSelect } from './SingleSelect/SingleSelect';\n\nimport styles from './styles.module.scss';\n\ntype DropdownVariants = 'fill' | 'transparent' | 'borderless';\n\nexport interface DropdownProps {\n /** Text on the trigger button that opens the dropdown */\n triggerText: string;\n /** Sets the dropdown content */\n children: React.ReactNode;\n /** Minimum width for the dropdown in pixels. Does not affect trigger button. */\n dropdownMinWidth?: number;\n /** Minimum width for the trigger in pixels. Does not apply for borderless variant */\n triggerMinWidth?: number;\n /** Disables rendring of the close button in the list */\n noCloseButton?: boolean;\n /** Called when dropdown is open/closed */\n onToggle?: (isOpen: boolean) => void;\n /** Whether the dropdown is open or not */\n open?: boolean;\n /** Makes the dropdown disabled */\n disabled?: boolean;\n /** Sets the data-testid attribute on the dropdown button */\n testId?: string;\n /** Overrides the default z-index of the DropDownContent */\n zIndex?: number;\n /** Resources for component */\n resources?: Partial<HNDesignsystemDropdown>;\n /** Adds an icon to the trigger */\n svgIcon?: SvgIcon | IconName;\n /** Sets the visual variant of the Dropdown */\n variant?: DropdownVariants;\n}\n\nexport const DropdownBase: React.FC<DropdownProps> = props => {\n const {\n triggerText,\n noCloseButton = false,\n onToggle,\n dropdownMinWidth,\n triggerMinWidth,\n open = false,\n children,\n testId,\n disabled,\n zIndex = ZIndex.PopOver,\n resources,\n svgIcon,\n variant = 'fill',\n } = props;\n\n const dropdownRef = useRef<HTMLDivElement>(null);\n const optionsRef = useRef<HTMLUListElement>(null);\n const childrenRefList = useRef(React.Children.map(children, () => React.createRef<HTMLElement>()));\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const { isHovered } = usePseudoClasses<HTMLButtonElement | null>(buttonRef);\n const openedByKeyboard = useRef<boolean>(false);\n const { value: isOpen, toggleValue: toggleIsOpen } = useToggle(!disabled && open, onToggle);\n const isMobile = useIsMobileBreakpoint();\n const triggerActualMinWidth = variant !== 'borderless' && typeof triggerMinWidth != 'undefined' ? `${triggerMinWidth}px` : 'auto';\n const triggerMinWidthLimit = isMobile ? 96 : 112;\n const dropdownFloatingPadding = 15;\n const maxWidth = isMobile ? 384 : 400;\n const maxHeight = isMobile ? 384 : 464;\n const toggleTextId = useId();\n const optionIdPrefix = useId();\n const contentId = useId();\n const leftIconProps = {\n className: styles['dropdown__left-icon'],\n size: IconSize.XSmall,\n isHovered: !disabled && isHovered,\n };\n\n const isSingleSelect = React.Children.toArray(children).every(\n child => React.isValidElement(child) && isComponent<SingleSelectItemProps>(child, SingleSelectItem)\n );\n const isMultiSelect = React.Children.toArray(children).every(\n child => React.isValidElement(child) && isComponent<CheckboxProps>(child, Checkbox)\n );\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n const mergedResources: HNDesignsystemDropdown = {\n ...defaultResources,\n ...resources,\n };\n\n const toggleClasses = classNames(styles.dropdown__toggle, {\n [styles['dropdown__toggle--open']]: isOpen && !disabled,\n [styles['dropdown__toggle--with-icon']]: typeof svgIcon !== 'undefined',\n [styles['dropdown__toggle--transparent']]: variant === 'transparent',\n [styles['dropdown__toggle--borderless']]: variant === 'borderless',\n });\n const contentClasses = classNames(styles.dropdown__content, isOpen && styles['dropdown__content--open']);\n const listItemClasses = classNames(styles['dropdown__list-item'], { [styles['dropdown__list-item--single-select']]: isSingleSelect });\n\n const { refs, floatingStyles } = useFloating({\n strategy: 'fixed',\n placement: 'bottom-start',\n middleware: [\n offset(8),\n // Hvis det ikke er plass på høyre side flipper vi dropdownlisten fra bottom-start til bottom-end\n flip({ mainAxis: false, fallbackPlacements: ['bottom-end'], padding: dropdownFloatingPadding }),\n // Shift fungerer som en fallback for flip og unngår at availableWidth ikke oppdaterer seg ved skjermbreddeendring\n shift({ padding: dropdownFloatingPadding }),\n // Hvis det ikke er plass på noen av sidene krymper vi bredden på listen med size\n size({\n padding: dropdownFloatingPadding,\n apply({ availableWidth, availableHeight, elements, rects }) {\n const triggerW = rects.reference.width;\n const minProp = typeof dropdownMinWidth !== 'undefined' ? clamp(0, maxWidth, dropdownMinWidth) : 0;\n const targetW = Math.max(triggerW, minProp);\n\n Object.assign(elements.floating.style, {\n maxWidth: `${Math.min(targetW, availableWidth)}px`,\n maxHeight: `${Math.min(maxHeight, availableHeight)}px`,\n overflowY: 'auto',\n overflowX: 'hidden',\n });\n },\n }),\n ],\n whileElementsMounted: isOpen ? autoUpdate : undefined,\n });\n\n const handleOpen = (isKeyboard: boolean): void => {\n openedByKeyboard.current = isKeyboard;\n toggleIsOpen();\n };\n\n const handleClose = (): void => {\n if (!isOpen) return;\n\n toggleIsOpen();\n buttonRef.current?.focus();\n };\n\n useEffect(() => {\n if (isOpen && openedByKeyboard.current) {\n const firstEnabled = childrenRefList.current?.find(r => r.current && !r.current.hasAttribute('disabled'));\n firstEnabled?.current?.focus();\n openedByKeyboard.current = false;\n }\n }, [isOpen]);\n\n const focusByIndex = (nextIndex: number): void => {\n childrenRefList.current?.[nextIndex]?.current?.focus();\n };\n\n const isListNavKey = (key: string): boolean =>\n key === KeyboardEventKey.ArrowDown || key === KeyboardEventKey.ArrowUp || key === KeyboardEventKey.Home || key === KeyboardEventKey.End;\n\n const handleKeyboardNavigation = (event: KeyboardEvent): void => {\n if (!childrenRefList.current) return;\n\n const key = event.key as KeyboardEventKey;\n\n if (key === KeyboardEventKey.Escape) {\n if (isOpen) {\n event.preventDefault();\n handleClose();\n }\n return;\n }\n\n if (!isOpen) {\n if (isListNavKey(key)) {\n event.preventDefault();\n handleOpen(true);\n }\n return;\n }\n\n if (!isListNavKey(key)) {\n return;\n }\n\n const index = childrenRefList.current.findIndex(x => x.current === (event.target as HTMLElement));\n let nextIndex = index;\n\n if (key === KeyboardEventKey.Home) {\n nextIndex = 0;\n } else if (key === KeyboardEventKey.End) {\n nextIndex = childrenRefList.current.length - 1;\n } else if (key === KeyboardEventKey.ArrowDown && index < childrenRefList.current.length - 1) {\n nextIndex = index + 1;\n } else if (key === KeyboardEventKey.ArrowUp && index > 0) {\n nextIndex = index - 1;\n }\n\n if (nextIndex !== -1) {\n event.preventDefault();\n focusByIndex(nextIndex);\n }\n };\n\n useKeyboardEvent(dropdownRef, handleKeyboardNavigation, [\n KeyboardEventKey.ArrowDown,\n KeyboardEventKey.ArrowUp,\n KeyboardEventKey.End,\n KeyboardEventKey.Enter,\n KeyboardEventKey.Escape,\n KeyboardEventKey.Home,\n KeyboardEventKey.Space,\n ]);\n\n useOutsideEvent(dropdownRef, () => isOpen && handleClose());\n\n const renderChildren = React.Children.map(children, (child, index) => {\n const element = child as React.ReactElement<{ ref?: React.Ref<HTMLElement | null> }>;\n\n return (\n <li className={listItemClasses} id={`${optionIdPrefix}-${index}`}>\n {React.isValidElement(element) && childrenRefList.current && childrenRefList.current[index]\n ? ((): React.ReactElement => {\n if (isMultiSelect && isComponent<CheckboxProps>(element, Checkbox)) {\n const label = element.props.label;\n if (React.isValidElement(label) && isComponent<LabelProps>(label, Label)) {\n return React.cloneElement(element, {\n ref: mergeRefs([element.props.ref, childrenRefList.current[index]]),\n label: React.cloneElement(label, {\n labelClassName: classNames((label.props as LabelProps)?.labelClassName, styles['dropdown__multiselect-item']),\n }),\n });\n }\n }\n\n return React.cloneElement(child as React.ReactElement<Record<string, unknown>>, {\n ref: mergeRefs([element.props.ref, childrenRefList.current[index]]),\n });\n })()\n : child}\n </li>\n );\n });\n\n return (\n <div className={styles.dropdown} ref={dropdownRef}>\n <button\n type=\"button\"\n onClick={(): false | void => handleOpen(false)}\n className={toggleClasses}\n ref={mergeRefs([buttonRef, refs.setReference])}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Dropdown}\n disabled={disabled}\n aria-labelledby={toggleTextId}\n aria-haspopup={true}\n aria-controls={contentId}\n aria-expanded={isOpen}\n style={{\n width: triggerActualMinWidth,\n maxWidth: '100%',\n minWidth: `${triggerMinWidthLimit}px`,\n }}\n >\n {svgIcon && (\n <>\n {typeof svgIcon === 'string' ? (\n <LazyIcon {...leftIconProps} iconName={svgIcon} />\n ) : (\n <Icon {...leftIconProps} svgIcon={svgIcon} />\n )}\n </>\n )}\n <span id={toggleTextId} className={styles.dropdown__toggle__text}>\n {triggerText}\n </span>\n <Icon\n svgIcon={!isSingleSelect ? PlusSmall : isOpen ? ChevronUp : ChevronDown}\n className={styles['dropdown__right-icon']}\n isHovered={!disabled && isHovered}\n size={IconSize.XSmall}\n />\n </button>\n <div\n key={dropdownMinWidth ?? 'auto'}\n id={contentId}\n className={contentClasses}\n ref={refs.setFloating}\n style={{\n ...floatingStyles,\n zIndex: zIndex,\n }}\n >\n <ul className={styles.dropdown__options} role=\"group\" aria-labelledby={toggleTextId} tabIndex={-1} ref={optionsRef}>\n {isSingleSelect && <SingleSelect onValueChange={() => handleClose()}>{renderChildren}</SingleSelect>}\n {isMultiSelect && renderChildren}\n </ul>\n {!isSingleSelect && !noCloseButton && (\n <div className={styles.dropdown__close}>\n <Button onClick={handleClose}>{mergedResources.closeText}</Button>\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport interface DropdownCompound extends React.FC<DropdownProps> {\n SingleSelectItem: ComponentType<SingleSelectItemProps>;\n}\nconst Dropdown = DropdownBase as DropdownCompound;\nDropdown.SingleSelectItem = SingleSelectItem;\nDropdownBase.displayName = 'Dropdown';\n\nexport default Dropdown;\n","import Dropdown from './Dropdown';\nexport * from './Dropdown';\nexport default Dropdown;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAa,gBAAgB,aAAsD;CACjF,QAAQ,UAAR;EACE,KAAK,gBAAgB,SACnB,OAAO;EACT,KAAK,gBAAgB;EACrB,SACE,OAAO;CACX;AACF;;;ACMA,IAAa,gBAA6C,EAAE,MAAM,UAAU,cAAc,eAAe,eAAe;CACtH,MAAM,CAAC,UAAU,eAAe,M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L,OAAO;IACP,UAAU;IACV,UAAU,GAAG,qBAAqB;GACpC;GAhBF,UAAA;IAkBG,WACC,oBAAA,UAAA,EAAA,UACG,OAAO,YAAY,WAClB,oBAAC,kBAAD;KAAU,GAAI;KAAe,UAAU;IAAU,CAAA,IAEjD,oBAAC,cAAD;KAAM,GAAI;KAAwB;IAAU,CAAA,EAE9C,CAAA;IAEJ,oBAAC,QAAD;KAAM,IAAI;KAAc,WAAW,OAAO;KACvC,UAAA;IACG,CAAA;IACN,oBAAC,cAAD;KACE,SAAS,CAAC,iBAAiB,YAAY,SAAS,YAAY;KAC5D,WAAW,OAAO;KAClB,WAAW,CAAC,YAAY;KACxB,MAAM,SAAS;IAChB,CAAA;GACK;EACR,CAAA,GAAA,qBAAC,OAAD;GAEE,IAAI;GACJ,WAAW;GACX,KAAK,KAAK;GACV,OAAO;IACL,GAAG;IACK;GACV;GARF,UAAA,CAUE,qBAAC,MAAD;IAAI,WAAW,OAAO;IAAmB,MAAK;IAAQ,mBAAiB;IAAc,UAAU;IAAI,KAAK;IAAxG,UAAA,CACG,kBAAkB,oBAAC,cAAD;KAAc,qBAAqB,YAAY;KAAI,UAAA;IAA6B,CAAA,GAClG,iBAAiB,cAChB;GACH,CAAA,GAAA,CAAC,kBAAkB,CAAC,iBACnB,oBAAC,OAAD;IAAK,WAAW,OAAO;IACrB,UAAA,oBAAC,gBAAD;KAAQ,SAAS;KAAc,UAAA,gBAAgB;IAAkB,CAAA;GAC9D,CAAA,CAEJ;EAlBE,GAAA,oBAAoB,MAkBtB,CACF;;AAET;AAKA,IAAM,WAAW;AACjB,SAAS,mBAAmB;AAC5B,aAAa,cAAc;;;ACtV3B,IAAA,mBAAe"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Dropdown/resourceHelper.ts","../../../src/components/Dropdown/SingleSelect/SingleSelect.tsx","../../../src/components/Dropdown/Dropdown.tsx","../../../src/components/Dropdown/index.ts"],"sourcesContent":["import type { HNDesignsystemDropdown } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Dropdown.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Dropdown.nb-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemDropdown => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport { SingleSelectContext } from './utils';\n\nexport type SingleSelectContextType = {\n name?: string;\n disabled?: boolean;\n required?: boolean;\n value?: string;\n onValueChange?: (newValue: string, e?: React.SyntheticEvent) => void;\n};\n\nexport interface SingleSelectProps {\n name?: string;\n disabled?: boolean;\n defaultValue?: string;\n onValueChange?: (newValue: string, e?: React.SyntheticEvent) => void;\n children: React.ReactNode;\n}\n\nexport const SingleSelect: React.FC<SingleSelectProps> = ({ name, disabled, defaultValue, onValueChange, children }) => {\n const [selected, setSelected] = React.useState<string | undefined>(defaultValue);\n\n const context = React.useMemo<SingleSelectContextType>(\n () => ({\n name,\n disabled,\n value: selected,\n onValueChange: (v, e): void => {\n setSelected(v);\n onValueChange?.(v, e);\n },\n }),\n [name, disabled, selected, onValueChange]\n );\n\n return <SingleSelectContext.Provider value={context}>{children}</SingleSelectContext.Provider>;\n};\n","import type { ComponentType } from 'react';\nimport React, { useEffect, useRef, useId } from 'react';\n\nimport { autoUpdate, offset, shift, size, useFloating, flip } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { clamp } from 'motion/react';\n\nimport type { SingleSelectItemProps } from './SingleSelect/SingleSelectItem';\nimport type { HNDesignsystemDropdown } from '../../resources/Resources';\nimport type { CheckboxProps } from '../Checkbox';\nimport type { SvgIcon } from '../Icon';\nimport type { IconName } from '../Icons/IconNames';\nimport type { LabelProps } from '../Label';\n\nimport {\n AnalyticsId,\n IconSize,\n KeyboardEventKey,\n LanguageLocales,\n ZIndex,\n usePseudoClasses,\n useDismissablePopover,\n useKeyboardEvent,\n useToggle,\n} from '../..';\nimport { getResources } from './resourceHelper';\nimport { SingleSelectItem } from './SingleSelect/SingleSelectItem';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport { isComponent } from '../../utils/component';\nimport { mergeRefs } from '../../utils/refs';\nimport Button from '../Button';\nimport Checkbox from '../Checkbox';\nimport Icon from '../Icon';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport PlusSmall from '../Icons/PlusSmall';\nimport Label from '../Label';\nimport LazyIcon from '../LazyIcon';\nimport { SingleSelect } from './SingleSelect/SingleSelect';\n\nimport styles from './styles.module.scss';\n\ntype DropdownVariants = 'fill' | 'transparent' | 'borderless';\n\nexport interface DropdownProps {\n /** Text on the trigger button that opens the dropdown */\n triggerText: string;\n /** Sets the dropdown content */\n children: React.ReactNode;\n /** Minimum width for the dropdown in pixels. Does not affect trigger button. */\n dropdownMinWidth?: number;\n /** Minimum width for the trigger in pixels. Does not apply for borderless variant */\n triggerMinWidth?: number;\n /** Disables rendring of the close button in the list */\n noCloseButton?: boolean;\n /** Called when dropdown is open/closed */\n onToggle?: (isOpen: boolean) => void;\n /** Whether the dropdown is open or not */\n open?: boolean;\n /** Makes the dropdown disabled */\n disabled?: boolean;\n /** Sets the data-testid attribute on the dropdown button */\n testId?: string;\n /** Overrides the default z-index of the DropDownContent */\n zIndex?: number;\n /** Resources for component */\n resources?: Partial<HNDesignsystemDropdown>;\n /** Adds an icon to the trigger */\n svgIcon?: SvgIcon | IconName;\n /** Sets the visual variant of the Dropdown */\n variant?: DropdownVariants;\n}\n\nexport const DropdownBase: React.FC<DropdownProps> = props => {\n const {\n triggerText,\n noCloseButton = false,\n onToggle,\n dropdownMinWidth,\n triggerMinWidth,\n open = false,\n children,\n testId,\n disabled,\n zIndex = ZIndex.PopOver,\n resources,\n svgIcon,\n variant = 'fill',\n } = props;\n\n const dropdownRef = useRef<HTMLDivElement>(null);\n const optionsRef = useRef<HTMLUListElement>(null);\n const childrenRefList = useRef(React.Children.map(children, () => React.createRef<HTMLElement>()));\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const { isHovered } = usePseudoClasses<HTMLButtonElement | null>(buttonRef);\n const openedByKeyboard = useRef<boolean>(false);\n const { value: isOpen, toggleValue: toggleIsOpen } = useToggle(!disabled && open, onToggle);\n const isMobile = useIsMobileBreakpoint();\n const triggerActualMinWidth = variant !== 'borderless' && typeof triggerMinWidth != 'undefined' ? `${triggerMinWidth}px` : 'auto';\n const triggerMinWidthLimit = isMobile ? 96 : 112;\n const dropdownFloatingPadding = 15;\n const maxWidth = isMobile ? 384 : 400;\n const maxHeight = isMobile ? 384 : 464;\n const toggleTextId = useId();\n const optionIdPrefix = useId();\n const contentId = useId();\n const leftIconProps = {\n className: styles['dropdown__left-icon'],\n size: IconSize.XSmall,\n isHovered: !disabled && isHovered,\n };\n\n const isSingleSelect = React.Children.toArray(children).every(\n child => React.isValidElement(child) && isComponent<SingleSelectItemProps>(child, SingleSelectItem)\n );\n const isMultiSelect = React.Children.toArray(children).every(\n child => React.isValidElement(child) && isComponent<CheckboxProps>(child, Checkbox)\n );\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n const mergedResources: HNDesignsystemDropdown = {\n ...defaultResources,\n ...resources,\n };\n\n const toggleClasses = classNames(styles.dropdown__toggle, {\n [styles['dropdown__toggle--open']]: isOpen && !disabled,\n [styles['dropdown__toggle--with-icon']]: typeof svgIcon !== 'undefined',\n [styles['dropdown__toggle--transparent']]: variant === 'transparent',\n [styles['dropdown__toggle--borderless']]: variant === 'borderless',\n });\n const contentClasses = classNames(styles.dropdown__content, isOpen && styles['dropdown__content--open']);\n const listItemClasses = classNames(styles['dropdown__list-item'], { [styles['dropdown__list-item--single-select']]: isSingleSelect });\n\n const { refs, floatingStyles } = useFloating({\n strategy: 'fixed',\n placement: 'bottom-start',\n middleware: [\n offset(8),\n // Hvis det ikke er plass på høyre side flipper vi dropdownlisten fra bottom-start til bottom-end\n flip({ mainAxis: false, fallbackPlacements: ['bottom-end'], padding: dropdownFloatingPadding }),\n // Shift fungerer som en fallback for flip og unngår at availableWidth ikke oppdaterer seg ved skjermbreddeendring\n shift({ padding: dropdownFloatingPadding }),\n // Hvis det ikke er plass på noen av sidene krymper vi bredden på listen med size\n size({\n padding: dropdownFloatingPadding,\n apply({ availableWidth, availableHeight, elements, rects }) {\n const triggerW = rects.reference.width;\n const minProp = typeof dropdownMinWidth !== 'undefined' ? clamp(0, maxWidth, dropdownMinWidth) : 0;\n const targetW = Math.max(triggerW, minProp);\n\n Object.assign(elements.floating.style, {\n maxWidth: `${Math.min(targetW, availableWidth)}px`,\n maxHeight: `${Math.min(maxHeight, availableHeight)}px`,\n overflowY: 'auto',\n overflowX: 'hidden',\n });\n },\n }),\n ],\n whileElementsMounted: isOpen ? autoUpdate : undefined,\n });\n\n const handleOpen = (isKeyboard: boolean): void => {\n openedByKeyboard.current = isKeyboard;\n toggleIsOpen();\n };\n\n const handleClose = useDismissablePopover({ popoverRef: dropdownRef, triggerRef: buttonRef, isOpen, onClose: toggleIsOpen });\n\n useEffect(() => {\n if (isOpen && openedByKeyboard.current) {\n const firstEnabled = childrenRefList.current?.find(r => r.current && !r.current.hasAttribute('disabled'));\n firstEnabled?.current?.focus();\n openedByKeyboard.current = false;\n }\n }, [isOpen]);\n\n const focusByIndex = (nextIndex: number): void => {\n childrenRefList.current?.[nextIndex]?.current?.focus();\n };\n\n const isListNavKey = (key: string): boolean =>\n key === KeyboardEventKey.ArrowDown || key === KeyboardEventKey.ArrowUp || key === KeyboardEventKey.Home || key === KeyboardEventKey.End;\n\n const handleKeyboardNavigation = (event: KeyboardEvent): void => {\n if (!childrenRefList.current) return;\n\n const key = event.key as KeyboardEventKey;\n\n if (!isOpen) {\n if (isListNavKey(key)) {\n event.preventDefault();\n handleOpen(true);\n }\n return;\n }\n\n if (!isListNavKey(key)) {\n return;\n }\n\n const index = childrenRefList.current.findIndex(x => x.current === (event.target as HTMLElement));\n let nextIndex = index;\n\n if (key === KeyboardEventKey.Home) {\n nextIndex = 0;\n } else if (key === KeyboardEventKey.End) {\n nextIndex = childrenRefList.current.length - 1;\n } else if (key === KeyboardEventKey.ArrowDown && index < childrenRefList.current.length - 1) {\n nextIndex = index + 1;\n } else if (key === KeyboardEventKey.ArrowUp && index > 0) {\n nextIndex = index - 1;\n }\n\n if (nextIndex !== -1) {\n event.preventDefault();\n focusByIndex(nextIndex);\n }\n };\n\n useKeyboardEvent(dropdownRef, handleKeyboardNavigation, [\n KeyboardEventKey.ArrowDown,\n KeyboardEventKey.ArrowUp,\n KeyboardEventKey.End,\n KeyboardEventKey.Enter,\n KeyboardEventKey.Home,\n KeyboardEventKey.Space,\n ]);\n\n const renderChildren = React.Children.map(children, (child, index) => {\n const element = child as React.ReactElement<{ ref?: React.Ref<HTMLElement | null> }>;\n\n return (\n <li className={listItemClasses} id={`${optionIdPrefix}-${index}`}>\n {React.isValidElement(element) && childrenRefList.current && childrenRefList.current[index]\n ? ((): React.ReactElement => {\n if (isMultiSelect && isComponent<CheckboxProps>(element, Checkbox)) {\n const label = element.props.label;\n if (React.isValidElement(label) && isComponent<LabelProps>(label, Label)) {\n return React.cloneElement(element, {\n ref: mergeRefs([element.props.ref, childrenRefList.current[index]]),\n label: React.cloneElement(label, {\n labelClassName: classNames((label.props as LabelProps)?.labelClassName, styles['dropdown__multiselect-item']),\n }),\n });\n }\n }\n\n return React.cloneElement(child as React.ReactElement<Record<string, unknown>>, {\n ref: mergeRefs([element.props.ref, childrenRefList.current[index]]),\n });\n })()\n : child}\n </li>\n );\n });\n\n return (\n <div className={styles.dropdown} ref={dropdownRef}>\n <button\n type=\"button\"\n onClick={(): false | void => handleOpen(false)}\n className={toggleClasses}\n ref={mergeRefs([buttonRef, refs.setReference])}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Dropdown}\n disabled={disabled}\n aria-labelledby={toggleTextId}\n aria-haspopup={true}\n aria-controls={contentId}\n aria-expanded={isOpen}\n style={{\n width: triggerActualMinWidth,\n maxWidth: '100%',\n minWidth: `${triggerMinWidthLimit}px`,\n }}\n >\n {svgIcon && (\n <>\n {typeof svgIcon === 'string' ? (\n <LazyIcon {...leftIconProps} iconName={svgIcon} />\n ) : (\n <Icon {...leftIconProps} svgIcon={svgIcon} />\n )}\n </>\n )}\n <span id={toggleTextId} className={styles.dropdown__toggle__text}>\n {triggerText}\n </span>\n <Icon\n svgIcon={!isSingleSelect ? PlusSmall : isOpen ? ChevronUp : ChevronDown}\n className={styles['dropdown__right-icon']}\n isHovered={!disabled && isHovered}\n size={IconSize.XSmall}\n />\n </button>\n <div\n key={dropdownMinWidth ?? 'auto'}\n id={contentId}\n className={contentClasses}\n ref={refs.setFloating}\n style={{\n ...floatingStyles,\n zIndex: zIndex,\n }}\n >\n <ul className={styles.dropdown__options} role=\"group\" aria-labelledby={toggleTextId} tabIndex={-1} ref={optionsRef}>\n {isSingleSelect && <SingleSelect onValueChange={() => handleClose()}>{renderChildren}</SingleSelect>}\n {isMultiSelect && renderChildren}\n </ul>\n {!isSingleSelect && !noCloseButton && (\n <div className={styles.dropdown__close}>\n <Button onClick={(): void => handleClose()}>{mergedResources.closeText}</Button>\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport interface DropdownCompound extends React.FC<DropdownProps> {\n SingleSelectItem: ComponentType<SingleSelectItemProps>;\n}\nconst Dropdown = DropdownBase as DropdownCompound;\nDropdown.SingleSelectItem = SingleSelectItem;\nDropdownBase.displayName = 'Dropdown';\n\nexport default Dropdown;\n","import Dropdown from './Dropdown';\nexport * from './Dropdown';\nexport default Dropdown;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAa,gBAAgB,aAAsD;CACjF,QAAQ,UAAR;EACE,KAAK,gBAAgB,SACnB,OAAO;EACT,KAAK,gBAAgB;EACrB,SACE,OAAO;CACX;AACF;;;ACMA,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AAA,UAAA,EAAA,UACG,OAAO,YAAY,WAClB,oBAAC,kBAAD;KAAU,GAAI;KAAe,UAAU;IAAU,CAAA,IAEjD,oBAAC,cAAD;KAAM,GAAI;KAAwB;IAAU,CAAA,EAE9C,CAAA;IAEJ,oBAAC,QAAD;KAAM,IAAI;KAAc,WAAW,OAAO;KACvC,UAAA;IACG,CAAA;IACN,oBAAC,cAAD;KACE,SAAS,CAAC,iBAAiB,YAAY,SAAS,YAAY;KAC5D,WAAW,OAAO;KAClB,WAAW,CAAC,YAAY;KACxB,MAAM,SAAS;IAChB,CAAA;GACK;EACR,CAAA,GAAA,qBAAC,OAAD;GAEE,IAAI;GACJ,WAAW;GACX,KAAK,KAAK;GACV,OAAO;IACL,GAAG;IACK;GACV;GARF,UAAA,CAUE,qBAAC,MAAD;IAAI,WAAW,OAAO;IAAmB,MAAK;IAAQ,mBAAiB;IAAc,UAAU;IAAI,KAAK;IAAxG,UAAA,CACG,kBAAkB,oBAAC,cAAD;KAAc,qBAAqB,YAAY;KAAI,UAAA;IAA6B,CAAA,GAClG,iBAAiB,cAChB;GACH,CAAA,GAAA,CAAC,kBAAkB,CAAC,iBACnB,oBAAC,OAAD;IAAK,WAAW,OAAO;IACrB,UAAA,oBAAC,gBAAD;KAAQ,eAAqB,YAAY;KAAI,UAAA,gBAAgB;IAAkB,CAAA;GAC5E,CAAA,CAEJ;EAlBE,GAAA,oBAAoB,MAkBtB,CACF;;AAET;AAKA,IAAM,WAAW;AACjB,SAAS,mBAAmB;AAC5B,aAAa,cAAc;;;ACtU3B,IAAA,mBAAe"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use '../../scss/font-settings' as font-settings;
|
|
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
|
.dropdown {
|
|
8
6
|
position: relative;
|
|
@@ -21,11 +19,11 @@
|
|
|
21
19
|
font-family: inherit;
|
|
22
20
|
font-size: font-settings.$font-size-sm;
|
|
23
21
|
line-height: 1.3rem; // Custom fordi teksten skal henge bedre sammen om den går over to linjer
|
|
24
|
-
border-color: var(--color-base-border-
|
|
22
|
+
border-color: var(--color-base-emphasized-border-dark);
|
|
25
23
|
background-color: var(--core-color-white);
|
|
26
24
|
|
|
27
25
|
&:hover:not(:disabled) {
|
|
28
|
-
background-color: var(--color-base-background-
|
|
26
|
+
background-color: var(--color-base-neutral-background-light);
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
&:active:not(:disabled) {
|
|
@@ -40,15 +38,15 @@
|
|
|
40
38
|
|
|
41
39
|
&:focus-visible {
|
|
42
40
|
outline: none;
|
|
43
|
-
border-color: var(--color-action-border-
|
|
44
|
-
box-shadow: 0 0 0 1px var(--color-action-border-
|
|
41
|
+
border-color: var(--color-action-border-dark-focus);
|
|
42
|
+
box-shadow: 0 0 0 1px var(--color-action-border-dark-focus);
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
&:disabled {
|
|
48
46
|
cursor: initial;
|
|
49
47
|
color: var(--color-disabled-text);
|
|
50
48
|
background-color: transparent;
|
|
51
|
-
border-color: var(--color-disabled-border);
|
|
49
|
+
border-color: var(--color-disabled-border-dark);
|
|
52
50
|
border-style: dashed;
|
|
53
51
|
}
|
|
54
52
|
|
|
@@ -79,7 +77,7 @@
|
|
|
79
77
|
}
|
|
80
78
|
|
|
81
79
|
&--borderless#{&}--open {
|
|
82
|
-
border-color: var(--color-base-border-
|
|
80
|
+
border-color: var(--color-base-emphasized-border-dark);
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
&__text {
|
|
@@ -104,14 +102,14 @@
|
|
|
104
102
|
|
|
105
103
|
&__left-icon,
|
|
106
104
|
&__right-icon {
|
|
107
|
-
fill: var(--color-action-graphics-
|
|
105
|
+
fill: var(--color-action-graphics-dark-normal);
|
|
108
106
|
|
|
109
107
|
:hover > & {
|
|
110
|
-
fill: var(--color-action-graphics-
|
|
108
|
+
fill: var(--color-action-graphics-dark-hover);
|
|
111
109
|
}
|
|
112
110
|
|
|
113
111
|
:disabled > & {
|
|
114
|
-
fill: var(--color-disabled-graphics);
|
|
112
|
+
fill: var(--color-disabled-graphics-dark);
|
|
115
113
|
}
|
|
116
114
|
}
|
|
117
115
|
|
|
@@ -144,7 +142,7 @@
|
|
|
144
142
|
|
|
145
143
|
&__list-item {
|
|
146
144
|
min-height: 44px;
|
|
147
|
-
border-bottom: 1px solid var(--color-base-border-
|
|
145
|
+
border-bottom: 1px solid var(--color-base-neutral-border-light-plus1);
|
|
148
146
|
|
|
149
147
|
&:last-child {
|
|
150
148
|
border-bottom: none;
|
|
@@ -172,8 +170,8 @@
|
|
|
172
170
|
}
|
|
173
171
|
|
|
174
172
|
&--single-select:has(:focus-visible) {
|
|
175
|
-
border-color: var(--color-action-border-
|
|
176
|
-
outline: 4px solid var(--color-action-border-
|
|
173
|
+
border-color: var(--color-action-border-dark-focus);
|
|
174
|
+
outline: 4px solid var(--color-action-border-dark-focus);
|
|
177
175
|
outline-offset: -4px;
|
|
178
176
|
}
|
|
179
177
|
}
|
|
@@ -2,13 +2,20 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { TitleProps } from '../Title';
|
|
3
3
|
import { Breakpoint } from '../../hooks/useBreakpoint';
|
|
4
4
|
export type DuolistVariants = 'normal' | 'line';
|
|
5
|
-
export type BoldColumn = 'first' | 'second' | 'none';
|
|
6
5
|
export type Border = 'no-border' | 'border';
|
|
6
|
+
export type HideLines = 'top' | 'bottom' | 'both';
|
|
7
|
+
export interface ResponsiveHideLines {
|
|
8
|
+
/** Hides lines on desktop (when the list is not collapsed) */
|
|
9
|
+
desktop?: HideLines;
|
|
10
|
+
/** Hides lines on mobile (when the list is collapsed, see useCollapsedFromAndBelowBreakpoint) */
|
|
11
|
+
mobile?: HideLines;
|
|
12
|
+
}
|
|
13
|
+
export type BoldColumn = 'first' | 'second' | 'none';
|
|
7
14
|
export type Formats = 'formatted' | 'non-formatted';
|
|
8
15
|
export interface DuolistProps {
|
|
9
16
|
/** Determines which column is bold */
|
|
10
17
|
boldColumn?: BoldColumn;
|
|
11
|
-
|
|
18
|
+
/**@deprecated Border around the Duolist */
|
|
12
19
|
border?: Border;
|
|
13
20
|
/** Label of the Duolist */
|
|
14
21
|
label?: React.ReactElement<TitleProps>;
|
|
@@ -16,8 +23,13 @@ export interface DuolistProps {
|
|
|
16
23
|
format?: Formats;
|
|
17
24
|
/** Character separator for non-formatted format */
|
|
18
25
|
separator?: string;
|
|
26
|
+
/** Turns the built-in padding of the list on/off. Default: true */
|
|
27
|
+
padding?: boolean;
|
|
19
28
|
/** Sets the visual variant of the Duolist. */
|
|
20
29
|
variant?: DuolistVariants;
|
|
30
|
+
/** Hides the top line, bottom line or both. Only applies to the 'line' variant.
|
|
31
|
+
* Accepts a single value for all screen sizes, or an object to configure desktop and mobile (collapsed) separately. */
|
|
32
|
+
hideLines?: HideLines | ResponsiveHideLines;
|
|
21
33
|
/** Sets the content of the Duolist. */
|
|
22
34
|
children: React.ReactNode;
|
|
23
35
|
/** Adds custom classes to the element. */
|
|
@@ -78,30 +78,50 @@
|
|
|
78
78
|
dt {
|
|
79
79
|
padding-top: spacers.getSpacer(3xs);
|
|
80
80
|
padding-top: spacers.getSpacer(2xs);
|
|
81
|
+
|
|
82
|
+
&:first-of-type {
|
|
83
|
+
border-top: 1px solid var(--color-base-border-dark);
|
|
84
|
+
}
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
dd {
|
|
84
88
|
padding-bottom: spacers.getSpacer(2xs);
|
|
85
|
-
border-bottom: 1px solid var(--color-base-border-
|
|
86
|
-
|
|
87
|
-
&:last-of-type {
|
|
88
|
-
border-bottom: 0;
|
|
89
|
-
}
|
|
89
|
+
border-bottom: 1px solid var(--color-base-border-dark);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
&--line#{&}--not-collapsed {
|
|
94
94
|
dt,
|
|
95
95
|
dd {
|
|
96
|
-
border-
|
|
96
|
+
border-bottom: 1px solid var(--color-base-border-dark);
|
|
97
97
|
padding-top: spacers.getSpacer(2xs);
|
|
98
98
|
|
|
99
|
-
&:
|
|
100
|
-
border-
|
|
99
|
+
&:first-of-type {
|
|
100
|
+
border-top: 1px solid var(--color-base-border-dark);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
&--line#{&}--hide-top-line {
|
|
106
|
+
dt:first-of-type,
|
|
107
|
+
dd:first-of-type {
|
|
108
|
+
border-top: 0;
|
|
109
|
+
padding-top: 0;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&--line#{&}--hide-bottom-line {
|
|
114
|
+
dt:last-of-type,
|
|
115
|
+
dd:last-of-type {
|
|
116
|
+
border-bottom: 0;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&--no-padding {
|
|
121
|
+
margin-top: 0;
|
|
122
|
+
margin-bottom: 0;
|
|
123
|
+
}
|
|
124
|
+
|
|
105
125
|
&--non-formatted {
|
|
106
126
|
display: unset;
|
|
107
127
|
}
|
|
@@ -7,7 +7,10 @@ export type Styles = {
|
|
|
7
7
|
'duolist__dt--bold': string;
|
|
8
8
|
'duolist__dt--non-formatted': string;
|
|
9
9
|
'duolist--collapsed': string;
|
|
10
|
+
'duolist--hide-bottom-line': string;
|
|
11
|
+
'duolist--hide-top-line': string;
|
|
10
12
|
'duolist--line': string;
|
|
13
|
+
'duolist--no-padding': string;
|
|
11
14
|
'duolist--non-formatted': string;
|
|
12
15
|
'duolist--not-collapsed': string;
|
|
13
16
|
'duolist-wrapper--border': string;
|
|
@@ -6,7 +6,7 @@ import { StatusDotProps, StatusDotType } from '../StatusDot';
|
|
|
6
6
|
import { TitleTags } from '../Title';
|
|
7
7
|
import { ElementHeaderTextProps, ElementHeaderTextType } from './ElementHeaderText/ElementHeaderText';
|
|
8
8
|
import { StatusDotListProps, StatusDotListType } from './StatusDotList/StatusDotList';
|
|
9
|
-
export type ElementHeaderSize = 'compact' | 'small' | '
|
|
9
|
+
export type ElementHeaderSize = 'compact' | 'small' | 'normal' | 'large';
|
|
10
10
|
export type ParentType = 'linklist' | 'expanderlist';
|
|
11
11
|
export interface ElementHeaderType extends React.FC<ElementHeaderProps> {
|
|
12
12
|
Avatar?: AvatarType;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
@use '../../scss/font-mixins' as fonts;
|
|
3
3
|
@use '../../scss/spacers' as spacers;
|
|
4
4
|
@use '../../scss/breakpoints' as breakpoints;
|
|
5
|
-
@import '../../scss/supernova/styles/colors.css';
|
|
6
5
|
|
|
7
6
|
.emptystate {
|
|
8
7
|
display: flex;
|
|
@@ -20,7 +19,7 @@
|
|
|
20
19
|
border-radius: 16px;
|
|
21
20
|
border-style: dashed;
|
|
22
21
|
border-width: 1px;
|
|
23
|
-
border-color: var(--color-base-border-
|
|
22
|
+
border-color: var(--color-base-emphasized-border-dark);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
&--blank {
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
.error-wrapper {
|
|
7
7
|
&--with-error {
|
|
8
8
|
padding: spacers.getSpacer(s) spacers.getSpacer(xs) spacers.getSpacer(m) spacers.getSpacer(2xs);
|
|
9
|
-
background-color: var(--color-notification-background
|
|
9
|
+
background-color: var(--color-notification-error-background);
|
|
10
10
|
border: 1px solid var(--core-color-cherry-400);
|
|
11
|
-
border-left: 4px solid var(--color-notification-border
|
|
11
|
+
border-left: 4px solid var(--color-notification-error-border);
|
|
12
12
|
|
|
13
13
|
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
14
14
|
padding: spacers.getSpacer(s) spacers.getSpacer(m) spacers.getSpacer(l) spacers.getSpacer(m);
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
&__errors {
|
|
19
19
|
margin-top: 0;
|
|
20
|
-
color: var(--color-notification-border
|
|
20
|
+
color: var(--color-notification-error-border);
|
|
21
21
|
|
|
22
22
|
@include fonts.label;
|
|
23
23
|
}
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
@use '../../scss/font-settings' as font-settings;
|
|
5
5
|
@use '../Button/styles.module' as button;
|
|
6
6
|
@use '../../scss/breakpoints' as breakpoints;
|
|
7
|
-
@import '../../scss/supernova/styles/colors.css';
|
|
8
|
-
@import '../../scss/supernova/styles/spacers.css';
|
|
9
7
|
|
|
10
8
|
.expander {
|
|
11
9
|
position: initial;
|
|
@@ -18,7 +18,7 @@ export type Styles = {
|
|
|
18
18
|
'button--large-borderless': string;
|
|
19
19
|
'button--large-non-borderless': string;
|
|
20
20
|
'button--left-icon': string;
|
|
21
|
-
'button--
|
|
21
|
+
'button--normal': string;
|
|
22
22
|
'button--on-dark': string;
|
|
23
23
|
'button--only-icon': string;
|
|
24
24
|
'button--outline': string;
|
|
@@ -69,6 +69,7 @@ var Expander = ({ title, htmlMarkup = "h2", level = 1, print, expanded = false,
|
|
|
69
69
|
children: title
|
|
70
70
|
}), /* @__PURE__ */ jsx("div", {
|
|
71
71
|
className: contentClasses,
|
|
72
|
+
"data-overflow-boundary": true,
|
|
72
73
|
children: React.Children.map(children, (child) => isComponent(child, ExpanderHierarchy) ? React.cloneElement(child, {
|
|
73
74
|
htmlMarkup: getHeadingTag(htmlMarkup),
|
|
74
75
|
level: level + 1,
|