@helsenorge/designsystem-react 15.7.2 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Button.js +2 -2
- package/lib/Button.js.map +1 -1
- package/lib/CHANGELOG.md +2652 -997
- package/lib/Close.js +1 -1
- package/lib/Close.js.map +1 -1
- package/lib/Drawer.js +2 -4
- package/lib/Drawer.js.map +1 -1
- package/lib/DrawerNavigation.js +1 -0
- package/lib/DrawerNavigation.js.map +1 -1
- package/lib/Duolist.js +5 -1
- package/lib/Duolist.js.map +1 -1
- package/lib/ElementHeader.js.map +1 -1
- package/lib/FilterLinkList.js +1 -1
- package/lib/FilterLinkList.js.map +1 -1
- package/lib/FormGroup.js +3 -3
- package/lib/FormGroup.js.map +1 -1
- package/lib/HelpDetails.js +1 -1
- package/lib/HelpTriggerIcon.js +2 -2
- package/lib/HelpTriggerIcon.js.map +1 -1
- package/lib/HelpTriggerStandalone.js +1 -1
- package/lib/HelpTriggerStandalone.js.map +1 -1
- package/lib/LazyIcon.js +1 -0
- package/lib/LazyIcon.js.map +1 -1
- package/lib/LazyIllustration.js +2 -0
- package/lib/LazyIllustration.js.map +1 -1
- package/lib/LinkList.js +10 -10
- package/lib/LinkList.js.map +1 -1
- package/lib/ListEditMode.js +1 -1
- package/lib/ListEditMode.js.map +1 -1
- package/lib/PopOver.js +2 -2
- package/lib/PopOver.js.map +1 -1
- package/lib/Radio.js +65 -55
- package/lib/Radio.js.map +1 -1
- package/lib/Radio2.js +74 -0
- package/lib/Radio2.js.map +1 -0
- package/lib/RadioMarker.js +2 -2
- package/lib/RadioMarker.js.map +1 -1
- package/lib/TabList.js +5 -5
- package/lib/TabList.js.map +1 -1
- package/lib/Toggle.js +2 -2
- package/lib/Toggle.js.map +1 -1
- package/lib/VisualRadio.js +1 -1
- package/lib/VisualRadio.js.map +1 -1
- package/lib/components/AnchorLink/styles.module.scss +3 -4
- package/lib/components/ArticleTeaser/styles.module.scss +12 -12
- package/lib/components/Button/Button.d.ts +1 -1
- package/lib/components/Button/styles.module.scss +111 -60
- package/lib/components/Button/styles.module.scss.d.ts +1 -1
- package/lib/components/Checkbox/CheckboxMarker/styles.module.scss +6 -6
- package/lib/components/Chip/styles.module.scss +2 -3
- package/lib/components/Close/styles.module.scss +2 -3
- package/lib/components/DictionaryTrigger/index.js +26 -1
- package/lib/{DictionaryTrigger.js.map → components/DictionaryTrigger/index.js.map} +1 -1
- package/lib/components/DictionaryTrigger/styles.module.scss +6 -8
- package/lib/components/Drawer/Drawer.d.ts +0 -4
- package/lib/components/Drawer/DrawerBackButton.module.scss +1 -2
- package/lib/components/Drawer/styles.module.scss +6 -3
- package/lib/components/Dropdown/SingleSelect/styles.module.scss +0 -2
- package/lib/components/Dropdown/index.js +9 -17
- package/lib/components/Dropdown/index.js.map +1 -1
- package/lib/components/Dropdown/styles.module.scss +12 -14
- package/lib/components/Duolist/Duolist.d.ts +14 -2
- package/lib/components/Duolist/styles.module.scss +32 -8
- package/lib/components/Duolist/styles.module.scss.d.ts +3 -0
- package/lib/components/ElementHeader/ElementHeader.d.ts +1 -1
- package/lib/components/ElementHeader/styles.module.scss +1 -1
- package/lib/components/EmptyState/styles.module.scss +1 -2
- package/lib/components/ErrorWrapper/styles.module.scss +3 -3
- package/lib/components/Expander/styles.module.scss +0 -2
- package/lib/components/Expander/styles.module.scss.d.ts +1 -1
- package/lib/components/ExpanderList/index.js +20 -19
- package/lib/components/ExpanderList/index.js.map +1 -1
- package/lib/components/ExpanderList/styles.module.scss +10 -11
- package/lib/components/FavoriteButton/index.js +3 -3
- package/lib/components/FavoriteButton/index.js.map +1 -1
- package/lib/components/FavoriteButton/styles.module.scss +0 -1
- package/lib/components/Filter/FilterButton/styles.module.scss +5 -6
- package/lib/components/Filter/FilterButtonAndChipsWrapper/styles.module.scss +0 -1
- package/lib/components/Filter/FilterDrawer/styles.module.scss +0 -1
- package/lib/components/Filter/FilterLinkList/FilterLinkList.module.scss +5 -6
- package/lib/components/Filter/FilterOverviewSearch/styles.module.scss +1 -4
- package/lib/components/Filter/FilterSearch/styles.module.scss +14 -15
- package/lib/components/Filter/FilterSort/styles.module.scss +1 -2
- package/lib/components/Filter/FilterStateWrapper/styles.module.scss +0 -2
- package/lib/components/Filter/LoaderSpinner/styles.module.scss +2 -4
- package/lib/components/FormFieldTag/styles.module.scss +0 -1
- package/lib/components/FormGroup/styles.module.scss +0 -1
- package/lib/components/HelpBubble/styles.module.scss +0 -1
- package/lib/components/HelpDetails/styles.module.scss +2 -4
- package/lib/components/HelpDrawer/styles.module.scss +1 -2
- package/lib/components/HelpPanel/HelpPanel.d.ts +2 -2
- package/lib/components/HelpPanel/index.js +1 -17
- package/lib/components/HelpPanel/index.js.map +1 -1
- package/lib/components/HelpPanel/styles.module.scss +2 -22
- package/lib/components/HelpPanel/styles.module.scss.d.ts +0 -4
- package/lib/components/HelpTeaser/styles.module.scss +7 -9
- package/lib/components/HelpTriggerIcon/HelpTriggerIcon.d.ts +2 -2
- package/lib/components/HelpTriggerIcon/styles.module.scss +20 -22
- package/lib/components/HelpTriggerIcon/styles.module.scss.d.ts +1 -1
- package/lib/components/HelpTriggerInline/styles.module.scss +3 -5
- package/lib/components/HelpTriggerStandalone/styles.module.scss +3 -5
- package/lib/components/HighlightPanel/styles.module.scss +2 -3
- package/lib/components/Icons/AdditionalIconInformation.d.ts +4 -0
- package/lib/components/Icons/AdditionalIconInformation.js +14 -10
- package/lib/components/Icons/AdditionalIconInformation.js.map +1 -1
- package/lib/components/Icons/HistoryDocument.js +6 -7
- package/lib/components/Icons/HistoryDocument.js.map +1 -1
- package/lib/components/Icons/IconNames.d.ts +1 -1
- package/lib/components/Icons/IconNames.js +1 -0
- package/lib/components/Icons/IconNames.js.map +1 -1
- package/lib/components/Icons/YesNo.d.ts +3 -0
- package/lib/components/Icons/YesNo.js +53 -0
- package/lib/components/Icons/YesNo.js.map +1 -0
- package/lib/components/Illustrations/IllustrationNames.d.ts +1 -1
- package/lib/components/Illustrations/IllustrationNames.js +2 -0
- package/lib/components/Illustrations/IllustrationNames.js.map +1 -1
- package/lib/components/Illustrations/MoveAway.d.ts +11 -0
- package/lib/components/Illustrations/MoveAway.js +18 -0
- package/lib/components/Illustrations/MoveAway.js.map +1 -0
- package/lib/components/Illustrations/MoveAwayMedium.d.ts +3 -0
- package/lib/components/Illustrations/MoveAwayMedium.js +114 -0
- package/lib/components/Illustrations/MoveAwayMedium.js.map +1 -0
- package/lib/components/InfoTeaser/styles.module.scss +6 -8
- package/lib/components/Label/styles.module.scss +1 -1
- package/lib/components/LinkList/LinkList.d.ts +1 -1
- package/lib/components/LinkList/styles.module.scss +9 -11
- package/lib/components/LinkList/styles.module.scss.d.ts +1 -1
- package/lib/components/ListEditMode/styles.module.scss +5 -7
- package/lib/components/Loader/Loader.d.ts +1 -1
- package/lib/components/Loader/index.js +4 -4
- package/lib/components/Loader/index.js.map +1 -1
- package/lib/components/Loader/styles.module.scss +7 -7
- package/lib/components/Loader/styles.module.scss.d.ts +3 -3
- package/lib/components/Modal/constants.d.ts +1 -1
- package/lib/components/Modal/index.js +2 -2
- package/lib/components/Modal/index.js.map +1 -1
- package/lib/components/Modal/styles.module.scss +14 -19
- package/lib/components/Modal/styles.module.scss.d.ts +2 -3
- package/lib/components/Panel/index.js +1 -1
- package/lib/components/Panel/index.js.map +1 -1
- package/lib/components/Panel/styles.module.scss +15 -16
- package/lib/components/Panel/styles.module.scss.d.ts +1 -1
- package/lib/components/PopMenu/index.js +7 -4
- package/lib/components/PopMenu/index.js.map +1 -1
- package/lib/components/PopOver/styles.module.scss +1 -3
- package/lib/components/Progressbar/Progressbar.d.ts +1 -1
- package/lib/components/Progressbar/constants.d.ts +1 -1
- package/lib/components/Progressbar/index.js +4 -4
- package/lib/components/Progressbar/index.js.map +1 -1
- package/lib/components/Radio/Radio.d.ts +28 -0
- package/lib/components/Radio/index.d.ts +3 -0
- package/lib/components/Radio/index.js +7 -0
- package/lib/components/Radio/index.js.map +1 -0
- package/lib/components/{RadioButton → Radio}/styles.module.scss +8 -9
- package/lib/components/Radio/styles.module.scss.d.ts +26 -0
- package/lib/components/ServiceMessage/styles.module.scss +20 -22
- package/lib/components/Slider/styles.module.scss +1 -2
- package/lib/components/StatusDot/styles.module.scss +4 -5
- package/lib/components/StickyNote/index.js +2 -2
- package/lib/components/StickyNote/index.js.map +1 -1
- package/lib/components/StickyNote/styles.module.scss +9 -10
- package/lib/components/Tabs/TabList/styles.module.scss +20 -18
- package/lib/components/Tabs/TabPanel/styles.module.scss +2 -3
- package/lib/components/Tabs/styles.module.scss +0 -1
- package/lib/components/Tag/styles.module.scss +0 -1
- package/lib/components/Tile/styles.module.scss +5 -7
- package/lib/components/Toast/styles.module.scss +0 -1
- package/lib/components/Toggle/styles.module.scss +9 -10
- package/lib/components/Validation/index.js +2 -2
- package/lib/components/Validation/index.js.map +1 -1
- package/lib/components/VisualCheckboxCloud/Checkbox/styles.module.scss +0 -2
- package/lib/components/VisualCheckboxCloud/styles.module.scss +0 -1
- package/lib/components/VisualCheckboxGroup/VisualCheckbox/styles.module.scss +0 -2
- package/lib/components/VisualCheckboxGroup/styles.module.scss +0 -1
- package/lib/components/VisualContentgroupWithImage/styles.module.scss +0 -1
- package/lib/components/VisualRadioCloud/Radio/index.js +1 -1
- package/lib/components/VisualRadioCloud/Radio/styles.module.scss +0 -2
- package/lib/components/VisualRadioCloud/index.js +1 -1
- package/lib/components/VisualRadioCloud/styles.module.scss +0 -1
- package/lib/components/VisualRadioGroup/VisualRadio/styles.module.scss +0 -2
- package/lib/components/VisualRadioGroup/styles.module.scss +0 -1
- package/lib/constants.d.ts +2 -3
- package/lib/constants.js +2 -3
- package/lib/constants.js.map +1 -1
- package/lib/floating-ui.react.js +1 -458
- package/lib/floating-ui.react.js.map +1 -1
- package/lib/hooks/useDismissablePopover.d.ts +20 -0
- package/lib/hooks/useDismissablePopover.js +66 -0
- package/lib/hooks/useDismissablePopover.js.map +1 -0
- package/lib/hooks/useOutsideEvent.d.ts +3 -0
- package/lib/hooks/useOutsideEvent.js +24 -3
- package/lib/hooks/useOutsideEvent.js.map +1 -1
- package/lib/hooks/useReturnFocusOnClose.d.ts +7 -0
- package/lib/hooks/useReturnFocusOnClose.js +22 -0
- package/lib/hooks/useReturnFocusOnClose.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -1
- package/lib/scss/_visual-form.scss +47 -47
- package/lib/scss/helsenorge.scss +1 -0
- package/lib/scss/supernova/styles/colors.css +177 -122
- package/lib/scss/supernova/styles/typography.css +58 -51
- package/lib/scss/supernova-legacy/index.css +2 -0
- package/lib/scss/supernova-legacy/styles/legacy-colors.css +111 -0
- package/lib/utils/formSpacing.js +3 -3
- package/lib/utils/formSpacing.js.map +1 -1
- package/package.json +8 -14
- package/scss/_visual-form.scss +47 -47
- package/scss/helsenorge.scss +1 -0
- package/scss/supernova/styles/colors.css +177 -122
- package/scss/supernova/styles/typography.css +58 -51
- package/scss/supernova-legacy/index.css +2 -0
- package/scss/supernova-legacy/styles/legacy-colors.css +111 -0
- package/lib/DictionaryTrigger.js +0 -27
- package/lib/RadioButton.js +0 -84
- package/lib/RadioButton.js.map +0 -1
- package/lib/components/HelpTooltip/HelpTooltip.d.ts +0 -12
- package/lib/components/HelpTooltip/index.d.ts +0 -3
- package/lib/components/HelpTooltip/index.js +0 -48
- package/lib/components/HelpTooltip/index.js.map +0 -1
- package/lib/components/RadioButton/RadioButton.d.ts +0 -28
- package/lib/components/RadioButton/index.d.ts +0 -3
- package/lib/components/RadioButton/index.js +0 -7
- package/lib/components/RadioButton/index.js.map +0 -1
- package/lib/components/RadioButton/styles.module.scss.d.ts +0 -26
- package/lib/designsystem-react.css +0 -273
- /package/lib/components/{RadioButton → Radio}/RadioMarker/RadioMarker.d.ts +0 -0
- /package/lib/components/{RadioButton → Radio}/RadioMarker/styles.module.scss +0 -0
- /package/lib/components/{RadioButton → Radio}/RadioMarker/styles.module.scss.d.ts +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface UseDismissablePopover {
|
|
2
|
+
/** Elementet/elementene som utgjør popoveren */
|
|
3
|
+
popoverRef: React.RefObject<HTMLElement | null> | React.RefObject<HTMLElement | null>[];
|
|
4
|
+
/** Trigger-elementet som får fokus tilbake når fokus ellers ville gått tapt */
|
|
5
|
+
triggerRef: React.RefObject<HTMLElement | null>;
|
|
6
|
+
/** Om popoveren er åpen */
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
/** Lukker popoveren (oppdaterer komponentens state) */
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
/** Scroller popoveren inn i viewport når den åpnes, uten at trigger mister synlighet */
|
|
11
|
+
scrollPopoverIntoView?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Lukkeatferd for popovers: klikk utenfor, Escape og Tab ut av komponenten lukker.
|
|
15
|
+
* Fokus fortsetter til neste element (WCAG 2.4.3), og flyttes bare tilbake til
|
|
16
|
+
* trigger når det ellers ville gått tapt.
|
|
17
|
+
* @returns Lukkefunksjon som også kan brukes av komponentens egne lukkeknapper/valg
|
|
18
|
+
*/
|
|
19
|
+
export declare const useDismissablePopover: ({ popoverRef, triggerRef, isOpen, onClose, scrollPopoverIntoView, }: UseDismissablePopover) => (() => void);
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { KeyboardEventKey } from "../constants.js";
|
|
2
|
+
import { getDocumentActiveElement } from "../utils/focus.js";
|
|
3
|
+
import { useOutsideEvent } from "./useOutsideEvent.js";
|
|
4
|
+
import { deepContains } from "../utils/deepContains.js";
|
|
5
|
+
import { useReturnFocusOnClose } from "./useReturnFocusOnClose.js";
|
|
6
|
+
import { useEffect } from "react";
|
|
7
|
+
//#region src/hooks/useDismissablePopover.ts
|
|
8
|
+
/**
|
|
9
|
+
* Lukkeatferd for popovers: klikk utenfor, Escape og Tab ut av komponenten lukker.
|
|
10
|
+
* Fokus fortsetter til neste element (WCAG 2.4.3), og flyttes bare tilbake til
|
|
11
|
+
* trigger når det ellers ville gått tapt.
|
|
12
|
+
* @returns Lukkefunksjon som også kan brukes av komponentens egne lukkeknapper/valg
|
|
13
|
+
*/
|
|
14
|
+
var useDismissablePopover = ({ popoverRef, triggerRef, isOpen, onClose, scrollPopoverIntoView = false }) => {
|
|
15
|
+
const refs = [...Array.isArray(popoverRef) ? popoverRef : [popoverRef], triggerRef];
|
|
16
|
+
const returnFocusOnClose = useReturnFocusOnClose(refs, triggerRef);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!isOpen || !scrollPopoverIntoView) return;
|
|
19
|
+
const scroll = () => {
|
|
20
|
+
(Array.isArray(popoverRef) ? popoverRef : [popoverRef]).forEach((ref) => ref.current?.scrollIntoView?.({
|
|
21
|
+
block: "nearest",
|
|
22
|
+
inline: "nearest"
|
|
23
|
+
}));
|
|
24
|
+
triggerRef.current?.scrollIntoView?.({
|
|
25
|
+
block: "nearest",
|
|
26
|
+
inline: "nearest"
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
if (typeof window.requestAnimationFrame === "function") {
|
|
30
|
+
const frame = window.requestAnimationFrame(scroll);
|
|
31
|
+
return () => window.cancelAnimationFrame(frame);
|
|
32
|
+
}
|
|
33
|
+
const timeout = window.setTimeout(scroll);
|
|
34
|
+
return () => window.clearTimeout(timeout);
|
|
35
|
+
}, [isOpen, scrollPopoverIntoView]);
|
|
36
|
+
const close = () => {
|
|
37
|
+
if (!isOpen) return;
|
|
38
|
+
onClose();
|
|
39
|
+
returnFocusOnClose();
|
|
40
|
+
};
|
|
41
|
+
useOutsideEvent(refs, close, ["click"]);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
const allElements = [...new Set(refs.flatMap((r) => r.current ? [r.current] : []))];
|
|
44
|
+
const elements = allElements.filter((el) => !allElements.some((other) => other !== el && other.contains(el)));
|
|
45
|
+
const handleKeyDown = (event) => {
|
|
46
|
+
if (!isOpen) return;
|
|
47
|
+
if (event.key === KeyboardEventKey.Escape) {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
event.stopPropagation();
|
|
50
|
+
close();
|
|
51
|
+
} else if (event.key === KeyboardEventKey.Tab) setTimeout(() => {
|
|
52
|
+
const focusIsInside = elements.some((el) => deepContains(el, getDocumentActiveElement(el)));
|
|
53
|
+
if (!document.hasFocus() || !focusIsInside) close();
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
elements.forEach((el) => el.addEventListener("keydown", handleKeyDown));
|
|
57
|
+
return () => {
|
|
58
|
+
elements.forEach((el) => el.removeEventListener("keydown", handleKeyDown));
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
return close;
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { useDismissablePopover };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=useDismissablePopover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDismissablePopover.js","names":[],"sources":["../../src/hooks/useDismissablePopover.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nimport { KeyboardEventKey } from '../constants';\nimport { useOutsideEvent } from './useOutsideEvent';\nimport { useReturnFocusOnClose } from './useReturnFocusOnClose';\nimport { deepContains } from '../utils/deepContains';\nimport { getDocumentActiveElement } from '../utils/focus';\n\ninterface UseDismissablePopover {\n /** Elementet/elementene som utgjør popoveren */\n popoverRef: React.RefObject<HTMLElement | null> | React.RefObject<HTMLElement | null>[];\n /** Trigger-elementet som får fokus tilbake når fokus ellers ville gått tapt */\n triggerRef: React.RefObject<HTMLElement | null>;\n /** Om popoveren er åpen */\n isOpen: boolean;\n /** Lukker popoveren (oppdaterer komponentens state) */\n onClose: () => void;\n /** Scroller popoveren inn i viewport når den åpnes, uten at trigger mister synlighet */\n scrollPopoverIntoView?: boolean;\n}\n\n/**\n * Lukkeatferd for popovers: klikk utenfor, Escape og Tab ut av komponenten lukker.\n * Fokus fortsetter til neste element (WCAG 2.4.3), og flyttes bare tilbake til\n * trigger når det ellers ville gått tapt.\n * @returns Lukkefunksjon som også kan brukes av komponentens egne lukkeknapper/valg\n */\nexport const useDismissablePopover = ({\n popoverRef,\n triggerRef,\n isOpen,\n onClose,\n scrollPopoverIntoView = false,\n}: UseDismissablePopover): (() => void) => {\n const refs = [...(Array.isArray(popoverRef) ? popoverRef : [popoverRef]), triggerRef];\n const returnFocusOnClose = useReturnFocusOnClose(refs, triggerRef);\n\n useEffect(() => {\n if (!isOpen || !scrollPopoverIntoView) {\n return;\n }\n\n const scroll = (): void => {\n const popoverRefs = Array.isArray(popoverRef) ? popoverRef : [popoverRef];\n popoverRefs.forEach(ref => ref.current?.scrollIntoView?.({ block: 'nearest', inline: 'nearest' }));\n // Trigger sist, slik at den ikke mister synlighet hvis popoveren dyttet den ut av viewport\n triggerRef.current?.scrollIntoView?.({ block: 'nearest', inline: 'nearest' });\n };\n\n // Vent en frame slik at popoveren er posisjonert (f.eks. av floating-ui) før scrolling.\n // requestAnimationFrame finnes ikke i ikke-visuelle DOM-miljøer (f.eks. jsdom uten pretendToBeVisual)\n if (typeof window.requestAnimationFrame === 'function') {\n const frame = window.requestAnimationFrame(scroll);\n return (): void => window.cancelAnimationFrame(frame);\n }\n const timeout = window.setTimeout(scroll);\n return (): void => window.clearTimeout(timeout);\n }, [isOpen, scrollPopoverIntoView]);\n\n const close = (): void => {\n if (!isOpen) {\n return;\n }\n\n onClose();\n returnFocusOnClose();\n };\n\n useOutsideEvent(refs, close, ['click']);\n\n useEffect(() => {\n const allElements = [...new Set(refs.flatMap(r => (r.current ? [r.current] : [])))];\n // Elementer som ligger inni et annet dekkes av forelderens listener via bobling\n const elements = allElements.filter(el => !allElements.some(other => other !== el && other.contains(el)));\n\n const handleKeyDown = (event: KeyboardEvent): void => {\n if (!isOpen) {\n return;\n }\n\n if (event.key === KeyboardEventKey.Escape) {\n event.preventDefault();\n // Ikke la Escape boble videre til omkringliggende lukkbare elementer (f.eks. Drawer)\n event.stopPropagation();\n close();\n } else if (event.key === KeyboardEventKey.Tab) {\n // Etter at nettleseren har flyttet fokus: lukk hvis fokus forlot komponenten\n setTimeout(() => {\n const focusIsInside = elements.some(el => deepContains(el, getDocumentActiveElement(el)));\n if (!document.hasFocus() || !focusIsInside) {\n close();\n }\n });\n }\n };\n\n elements.forEach(el => el.addEventListener('keydown', handleKeyDown));\n\n return (): void => {\n elements.forEach(el => el.removeEventListener('keydown', handleKeyDown));\n };\n });\n\n return close;\n};\n"],"mappings":";;;;;;;;;;;;;AA2BA,IAAa,yBAAyB,EACpC,YACA,YACA,QACA,SACA,wBAAwB,YACiB;CACzC,MAAM,OAAO,CAAC,GAAI,MAAM,QAAQ,UAAU,IAAI,aAAa,CAAC,UAAU,GAAI,UAAU;CACpF,MAAM,qBAAqB,sBAAsB,MAAM,UAAU;CAEjE,gBAAgB;EACd,IAAI,CAAC,UAAU,CAAC,uBACd;EAGF,MAAM,eAAqB;GAEzB,CADoB,MAAM,QAAQ,UAAU,IAAI,aAAa,CAAC,UAAU,EAAA,CAC5D,SAAQ,QAAO,IAAI,SAAS,iBAAiB;IAAE,OAAO;IAAW,QAAQ;GAAU,CAAC,CAAC;GAEjG,WAAW,SAAS,iBAAiB;IAAE,OAAO;IAAW,QAAQ;GAAU,CAAC;EAC9E;EAIA,IAAI,OAAO,OAAO,0BAA0B,YAAY;GACtD,MAAM,QAAQ,OAAO,sBAAsB,MAAM;GACjD,aAAmB,OAAO,qBAAqB,KAAK;EACtD;EACA,MAAM,UAAU,OAAO,WAAW,MAAM;EACxC,aAAmB,OAAO,aAAa,OAAO;CAChD,GAAG,CAAC,QAAQ,qBAAqB,CAAC;CAElC,MAAM,cAAoB;EACxB,IAAI,CAAC,QACH;EAGF,QAAQ;EACR,mBAAmB;CACrB;CAEA,gBAAgB,MAAM,OAAO,CAAC,OAAO,CAAC;CAEtC,gBAAgB;EACd,MAAM,cAAc,CAAC,GAAG,IAAI,IAAI,KAAK,SAAQ,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,IAAI,CAAC,CAAE,CAAC,CAAC;EAElF,MAAM,WAAW,YAAY,QAAO,OAAM,CAAC,YAAY,MAAK,UAAS,UAAU,MAAM,MAAM,SAAS,EAAE,CAAC,CAAC;EAExG,MAAM,iBAAiB,UAA+B;GACpD,IAAI,CAAC,QACH;GAGF,IAAI,MAAM,QAAQ,iBAAiB,QAAQ;IACzC,MAAM,eAAe;IAErB,MAAM,gBAAgB;IACtB,MAAM;GACR,OAAO,IAAI,MAAM,QAAQ,iBAAiB,KAExC,iBAAiB;IACf,MAAM,gBAAgB,SAAS,MAAK,OAAM,aAAa,IAAI,yBAAyB,EAAE,CAAC,CAAC;IACxF,IAAI,CAAC,SAAS,SAAS,KAAK,CAAC,eAC3B,MAAM;GAEV,CAAC;EAEL;EAEA,SAAS,SAAQ,OAAM,GAAG,iBAAiB,WAAW,aAAa,CAAC;EAEpE,aAAmB;GACjB,SAAS,SAAQ,OAAM,GAAG,oBAAoB,WAAW,aAAa,CAAC;EACzE;CACF,CAAC;CAED,OAAO;AACT"}
|
|
@@ -3,6 +3,9 @@ type OutsideEvents = {
|
|
|
3
3
|
}[keyof DocumentEventMap];
|
|
4
4
|
/**
|
|
5
5
|
* Custom hook for klikk eller fokus utenfor et gitt element (eller flere elementer)
|
|
6
|
+
*
|
|
7
|
+
* Fokus-eventer som er bieffekter av et pekertrykk (scrollbar, focus trap, `<dialog>`) ignoreres.
|
|
8
|
+
*
|
|
6
9
|
* @param ref Sjekker om det klikkes utenfor dette elementet/elementene
|
|
7
10
|
* @param callback Callback-funksjon ved klikk utenfor elementet/elementene
|
|
8
11
|
* @param events Type eventer å lytte på. Default: mousedown
|
|
@@ -2,6 +2,9 @@ import { useEffect } from "react";
|
|
|
2
2
|
//#region src/hooks/useOutsideEvent.ts
|
|
3
3
|
/**
|
|
4
4
|
* Custom hook for klikk eller fokus utenfor et gitt element (eller flere elementer)
|
|
5
|
+
*
|
|
6
|
+
* Fokus-eventer som er bieffekter av et pekertrykk (scrollbar, focus trap, `<dialog>`) ignoreres.
|
|
7
|
+
*
|
|
5
8
|
* @param ref Sjekker om det klikkes utenfor dette elementet/elementene
|
|
6
9
|
* @param callback Callback-funksjon ved klikk utenfor elementet/elementene
|
|
7
10
|
* @param events Type eventer å lytte på. Default: mousedown
|
|
@@ -12,10 +15,28 @@ var useOutsideEvent = (ref, callback, events = ["mousedown"]) => {
|
|
|
12
15
|
if (refArray.every((r) => r.current && !event.composedPath().includes(r.current))) callback(event);
|
|
13
16
|
};
|
|
14
17
|
useEffect(() => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
const controller = new AbortController();
|
|
19
|
+
const { signal } = controller;
|
|
20
|
+
let isPointerDown = false;
|
|
21
|
+
const releasePointer = () => {
|
|
22
|
+
setTimeout(() => isPointerDown = false);
|
|
18
23
|
};
|
|
24
|
+
document.addEventListener("pointerdown", () => isPointerDown = true, {
|
|
25
|
+
capture: true,
|
|
26
|
+
signal
|
|
27
|
+
});
|
|
28
|
+
document.addEventListener("pointerup", releasePointer, {
|
|
29
|
+
capture: true,
|
|
30
|
+
signal
|
|
31
|
+
});
|
|
32
|
+
document.addEventListener("pointercancel", releasePointer, {
|
|
33
|
+
capture: true,
|
|
34
|
+
signal
|
|
35
|
+
});
|
|
36
|
+
events.forEach((eventName) => document.addEventListener(eventName, (event) => {
|
|
37
|
+
if (!(event instanceof FocusEvent && isPointerDown)) handleOutsideEvent(event);
|
|
38
|
+
}, { signal }));
|
|
39
|
+
return () => controller.abort();
|
|
19
40
|
}, [
|
|
20
41
|
refArray,
|
|
21
42
|
callback,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOutsideEvent.js","names":[],"sources":["../../src/hooks/useOutsideEvent.ts"],"sourcesContent":["import { useEffect } from 'react';\n\ntype OutsideEvents = {\n [K in keyof DocumentEventMap]: DocumentEventMap[K] extends MouseEvent | FocusEvent ? K : never;\n}[keyof DocumentEventMap];\n\n/**\n * Custom hook for klikk eller fokus utenfor et gitt element (eller flere elementer)\n * @param ref Sjekker om det klikkes utenfor dette elementet/elementene\n * @param callback Callback-funksjon ved klikk utenfor elementet/elementene\n * @param events Type eventer å lytte på. Default: mousedown\n */\nexport const useOutsideEvent = (\n ref: React.RefObject<HTMLElement | null> | React.RefObject<HTMLElement | null>[],\n callback: (event: MouseEvent | FocusEvent) => void,\n events: OutsideEvents[] = ['mousedown']\n): void => {\n const refArray = Array.isArray(ref) ? ref : [ref];\n\n const handleOutsideEvent = (event: MouseEvent | FocusEvent): void => {\n if (refArray.every(r => r.current && !event.composedPath().includes(r.current))) {\n callback(event);\n }\n };\n\n useEffect(() => {\n
|
|
1
|
+
{"version":3,"file":"useOutsideEvent.js","names":[],"sources":["../../src/hooks/useOutsideEvent.ts"],"sourcesContent":["import { useEffect } from 'react';\n\ntype OutsideEvents = {\n [K in keyof DocumentEventMap]: DocumentEventMap[K] extends MouseEvent | FocusEvent ? K : never;\n}[keyof DocumentEventMap];\n\n/**\n * Custom hook for klikk eller fokus utenfor et gitt element (eller flere elementer)\n *\n * Fokus-eventer som er bieffekter av et pekertrykk (scrollbar, focus trap, `<dialog>`) ignoreres.\n *\n * @param ref Sjekker om det klikkes utenfor dette elementet/elementene\n * @param callback Callback-funksjon ved klikk utenfor elementet/elementene\n * @param events Type eventer å lytte på. Default: mousedown\n */\nexport const useOutsideEvent = (\n ref: React.RefObject<HTMLElement | null> | React.RefObject<HTMLElement | null>[],\n callback: (event: MouseEvent | FocusEvent) => void,\n events: OutsideEvents[] = ['mousedown']\n): void => {\n const refArray = Array.isArray(ref) ? ref : [ref];\n\n const handleOutsideEvent = (event: MouseEvent | FocusEvent): void => {\n if (refArray.every(r => r.current && !event.composedPath().includes(r.current))) {\n callback(event);\n }\n };\n\n useEffect(() => {\n const controller = new AbortController();\n const { signal } = controller;\n\n // Holder styr på om pekeren er trykket ned, slik at fokus-eventer utløst av selve trykket kan ignoreres.\n // setTimeout holder guarden aktiv for fokus-eventer nettleseren sender rett etter pointerup/pointercancel.\n let isPointerDown = false;\n const releasePointer = (): void => {\n setTimeout(() => (isPointerDown = false));\n };\n document.addEventListener('pointerdown', () => (isPointerDown = true), { capture: true, signal });\n document.addEventListener('pointerup', releasePointer, { capture: true, signal });\n document.addEventListener('pointercancel', releasePointer, { capture: true, signal });\n\n events.forEach(eventName =>\n document.addEventListener(\n eventName,\n event => {\n if (!(event instanceof FocusEvent && isPointerDown)) {\n handleOutsideEvent(event);\n }\n },\n { signal }\n )\n );\n\n return (): void => controller.abort();\n }, [refArray, callback, events]);\n};\n"],"mappings":";;;;;;;;;;;AAeA,IAAa,mBACX,KACA,UACA,SAA0B,CAAC,WAAW,MAC7B;CACT,MAAM,WAAW,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,GAAG;CAEhD,MAAM,sBAAsB,UAAyC;EACnE,IAAI,SAAS,OAAM,MAAK,EAAE,WAAW,CAAC,MAAM,aAAa,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,GAC5E,SAAS,KAAK;CAElB;CAEA,gBAAgB;EACd,MAAM,aAAa,IAAI,gBAAgB;EACvC,MAAM,EAAE,WAAW;EAInB,IAAI,gBAAgB;EACpB,MAAM,uBAA6B;GACjC,iBAAkB,gBAAgB,KAAM;EAC1C;EACA,SAAS,iBAAiB,qBAAsB,gBAAgB,MAAO;GAAE,SAAS;GAAM;EAAO,CAAC;EAChG,SAAS,iBAAiB,aAAa,gBAAgB;GAAE,SAAS;GAAM;EAAO,CAAC;EAChF,SAAS,iBAAiB,iBAAiB,gBAAgB;GAAE,SAAS;GAAM;EAAO,CAAC;EAEpF,OAAO,SAAQ,cACb,SAAS,iBACP,YACA,UAAS;GACP,IAAI,EAAE,iBAAiB,cAAc,gBACnC,mBAAmB,KAAK;EAE5B,GACA,EAAE,OAAO,CACX,CACF;EAEA,aAAmB,WAAW,MAAM;CACtC,GAAG;EAAC;EAAU;EAAU;CAAM,CAAC;AACjC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gir en funksjon som flytter fokus tilbake til trigger-elementet hvis fokus står inne i elementet som lukkes.
|
|
3
|
+
* @param ref Elementet/elementene som utgjør innholdet som lukkes
|
|
4
|
+
* @param triggerRef Trigger-elementet som skal få fokus tilbake
|
|
5
|
+
* @returns Funksjon som flytter fokus til triggeren ved behov
|
|
6
|
+
*/
|
|
7
|
+
export declare const useReturnFocusOnClose: (ref: React.RefObject<HTMLElement | null> | React.RefObject<HTMLElement | null>[], triggerRef: React.RefObject<HTMLElement | null>) => (() => void);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getDocumentActiveElement } from "../utils/focus.js";
|
|
2
|
+
import { deepContains } from "../utils/deepContains.js";
|
|
3
|
+
//#region src/hooks/useReturnFocusOnClose.ts
|
|
4
|
+
/**
|
|
5
|
+
* Gir en funksjon som flytter fokus tilbake til trigger-elementet hvis fokus står inne i elementet som lukkes.
|
|
6
|
+
* @param ref Elementet/elementene som utgjør innholdet som lukkes
|
|
7
|
+
* @param triggerRef Trigger-elementet som skal få fokus tilbake
|
|
8
|
+
* @returns Funksjon som flytter fokus til triggeren ved behov
|
|
9
|
+
*/
|
|
10
|
+
var useReturnFocusOnClose = (ref, triggerRef) => {
|
|
11
|
+
const refArray = Array.isArray(ref) ? ref : [ref];
|
|
12
|
+
return () => {
|
|
13
|
+
if (refArray.some((r) => {
|
|
14
|
+
const activeElement = r.current ? getDocumentActiveElement(r.current) : null;
|
|
15
|
+
return !!r.current && deepContains(r.current, activeElement);
|
|
16
|
+
})) triggerRef.current?.focus();
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { useReturnFocusOnClose };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=useReturnFocusOnClose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReturnFocusOnClose.js","names":[],"sources":["../../src/hooks/useReturnFocusOnClose.ts"],"sourcesContent":["import { deepContains } from '../utils/deepContains';\nimport { getDocumentActiveElement } from '../utils/focus';\n\n/**\n * Gir en funksjon som flytter fokus tilbake til trigger-elementet hvis fokus står inne i elementet som lukkes.\n * @param ref Elementet/elementene som utgjør innholdet som lukkes\n * @param triggerRef Trigger-elementet som skal få fokus tilbake\n * @returns Funksjon som flytter fokus til triggeren ved behov\n */\nexport const useReturnFocusOnClose = (\n ref: React.RefObject<HTMLElement | null> | React.RefObject<HTMLElement | null>[],\n triggerRef: React.RefObject<HTMLElement | null>\n): (() => void) => {\n const refArray = Array.isArray(ref) ? ref : [ref];\n\n return (): void => {\n const focusIsInside = refArray.some(r => {\n const activeElement = r.current ? getDocumentActiveElement(r.current) : null;\n return !!r.current && deepContains(r.current, activeElement);\n });\n\n if (focusIsInside) {\n triggerRef.current?.focus();\n }\n };\n};\n"],"mappings":";;;;;;;;;AASA,IAAa,yBACX,KACA,eACiB;CACjB,MAAM,WAAW,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,GAAG;CAEhD,aAAmB;EAMjB,IALsB,SAAS,MAAK,MAAK;GACvC,MAAM,gBAAgB,EAAE,UAAU,yBAAyB,EAAE,OAAO,IAAI;GACxE,OAAO,CAAC,CAAC,EAAE,WAAW,aAAa,EAAE,SAAS,aAAa;EAC7D,CAEI,GACF,WAAW,SAAS,MAAM;CAE9B;AACF"}
|
package/lib/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export { useResizeObserver } from './hooks/useResizeObserver';
|
|
|
12
12
|
export { useToggle } from './hooks/useToggle';
|
|
13
13
|
export { useKeyboardEvent } from './hooks/useKeyboardEvent';
|
|
14
14
|
export { useOutsideEvent } from './hooks/useOutsideEvent';
|
|
15
|
+
export { useDismissablePopover } from './hooks/useDismissablePopover';
|
|
16
|
+
export { useReturnFocusOnClose } from './hooks/useReturnFocusOnClose';
|
|
15
17
|
export { useLanguage } from './hooks/useLanguage';
|
|
16
18
|
export { isMobileUA } from './utils/mobile';
|
|
17
19
|
export { uuid } from './utils/uuid';
|
package/lib/index.js
CHANGED
|
@@ -15,6 +15,8 @@ import { useResizeObserver } from "./hooks/useResizeObserver.js";
|
|
|
15
15
|
import { useToggle } from "./hooks/useToggle.js";
|
|
16
16
|
import { useKeyboardEvent } from "./hooks/useKeyboardEvent.js";
|
|
17
17
|
import { useOutsideEvent } from "./hooks/useOutsideEvent.js";
|
|
18
|
+
import { useReturnFocusOnClose } from "./hooks/useReturnFocusOnClose.js";
|
|
19
|
+
import { useDismissablePopover } from "./hooks/useDismissablePopover.js";
|
|
18
20
|
import { isMobileUA } from "./utils/mobile.js";
|
|
19
21
|
import { formatResource } from "./utils/resource.js";
|
|
20
|
-
export { AVERAGE_CHARACTER_WIDTH_PX, AnalyticsId, Breakpoint, FormOnColor, FormSize, IconSize, KeyboardEventKey, LanguageLocales, ZIndex, formatResource, isMobileUA, theme, useBreakpoint, useFocusToggle, useFocusTrap, useIntersectionObserver, useIsVisible, useKeyboardEvent, useLanguage, useLayoutEvent, useOutsideEvent, usePrevious, usePseudoClasses, useResizeObserver, useSize, useToggle, uuid };
|
|
22
|
+
export { AVERAGE_CHARACTER_WIDTH_PX, AnalyticsId, Breakpoint, FormOnColor, FormSize, IconSize, KeyboardEventKey, LanguageLocales, ZIndex, formatResource, isMobileUA, theme, useBreakpoint, useDismissablePopover, useFocusToggle, useFocusTrap, useIntersectionObserver, useIsVisible, useKeyboardEvent, useLanguage, useLayoutEvent, useOutsideEvent, usePrevious, usePseudoClasses, useResizeObserver, useReturnFocusOnClose, useSize, useToggle, uuid };
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
min-height: var(--core-space-l);
|
|
52
52
|
padding: $pill-padding-mobile;
|
|
53
53
|
border-radius: 100px;
|
|
54
|
-
background-color: var(--color-action-background-
|
|
55
|
-
border: 1px solid var(--color-action-border-
|
|
56
|
-
color: var(--color-base-text-
|
|
54
|
+
background-color: var(--color-action-background-light-normal);
|
|
55
|
+
border: 1px solid var(--color-action-border-dark-normal);
|
|
56
|
+
color: var(--color-base-text-dark);
|
|
57
57
|
|
|
58
58
|
@include fonts.title6;
|
|
59
59
|
|
|
@@ -64,20 +64,20 @@
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
&:hover &__pill {
|
|
67
|
-
background-color: var(--color-action-background-
|
|
68
|
-
border-color: var(--color-action-border-
|
|
67
|
+
background-color: var(--color-action-background-light-hover);
|
|
68
|
+
border-color: var(--color-action-border-dark-plus1-hover);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
&:active &__pill {
|
|
72
|
-
background-color: var(--color-action-background-
|
|
73
|
-
border-color: var(--color-action-border-
|
|
72
|
+
background-color: var(--color-action-background-light-selected);
|
|
73
|
+
border-color: var(--color-action-border-dark-plus1-hover);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
&--checked &__pill,
|
|
77
77
|
&:has(input:checked) &__pill {
|
|
78
|
-
background-color: var(--color-action-background-
|
|
79
|
-
color: var(--color-action-text-
|
|
80
|
-
border-color: var(--color-action-background-
|
|
78
|
+
background-color: var(--color-action-background-dark-normal);
|
|
79
|
+
color: var(--color-action-text-light-normal);
|
|
80
|
+
border-color: var(--color-action-background-dark-normal);
|
|
81
81
|
padding: var(--core-space-3xs) var(--core-space-s);
|
|
82
82
|
|
|
83
83
|
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
@@ -87,52 +87,52 @@
|
|
|
87
87
|
|
|
88
88
|
&--checked:hover &__pill,
|
|
89
89
|
&:has(input:checked):hover &__pill {
|
|
90
|
-
background-color: var(--color-action-graphics-
|
|
91
|
-
border-color: var(--color-action-graphics-
|
|
90
|
+
background-color: var(--color-action-graphics-dark-hover);
|
|
91
|
+
border-color: var(--color-action-graphics-dark-hover);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
&--checked:active &__pill,
|
|
95
95
|
&:has(input:checked):active &__pill {
|
|
96
|
-
background-color: var(--color-action-background-
|
|
97
|
-
border-color: var(--color-action-background-
|
|
96
|
+
background-color: var(--color-action-background-dark-plus1-active);
|
|
97
|
+
border-color: var(--color-action-background-dark-plus1-active);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
&--invalid &__pill {
|
|
101
|
-
background-color: var(--color-action-background-
|
|
102
|
-
border-color: var(--color-destructive-border-normal);
|
|
101
|
+
background-color: var(--color-action-background-light-normal);
|
|
102
|
+
border-color: var(--color-destructive-border-dark-normal);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
&--invalid:hover &__pill {
|
|
106
|
-
background-color: var(--color-destructive-background-normal);
|
|
107
|
-
border-color: var(--color-destructive-border-normal);
|
|
106
|
+
background-color: var(--color-destructive-background-light-plus1-normal);
|
|
107
|
+
border-color: var(--color-destructive-border-dark-normal);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
&--invalid:active &__pill {
|
|
111
|
-
background-color: var(--color-destructive-background-
|
|
112
|
-
border-color: var(--color-destructive-border-normal);
|
|
111
|
+
background-color: var(--color-destructive-background-light-plus1-hover);
|
|
112
|
+
border-color: var(--color-destructive-border-dark-normal);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
&--invalid#{&}--checked &__pill,
|
|
116
116
|
&--invalid:has(input:checked) &__pill {
|
|
117
|
-
background-color: var(--color-destructive-graphics-normal);
|
|
118
|
-
border-color: var(--color-destructive-graphics-normal);
|
|
117
|
+
background-color: var(--color-destructive-graphics-dark-normal);
|
|
118
|
+
border-color: var(--color-destructive-graphics-dark-normal);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
&--invalid#{&}--checked:hover &__pill,
|
|
122
122
|
&--invalid:has(input:checked):hover &__pill {
|
|
123
|
-
background-color: var(--color-destructive-graphics-hover);
|
|
124
|
-
border-color: var(--color-destructive-graphics-hover);
|
|
123
|
+
background-color: var(--color-destructive-graphics-dark-hover);
|
|
124
|
+
border-color: var(--color-destructive-graphics-dark-hover);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
&--invalid#{&}--checked:active &__pill,
|
|
128
128
|
&--invalid:has(input:checked):active &__pill {
|
|
129
|
-
background-color: var(--color-destructive-graphics-
|
|
130
|
-
border-color: var(--color-destructive-graphics-
|
|
129
|
+
background-color: var(--color-destructive-graphics-dark-active);
|
|
130
|
+
border-color: var(--color-destructive-graphics-dark-active);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
&__input:focus-visible + &__pill {
|
|
134
|
-
outline: 3px solid var(--color-action-border-
|
|
135
|
-
border-color: var(--color-action-border-
|
|
134
|
+
outline: 3px solid var(--color-action-border-dark-focus);
|
|
135
|
+
border-color: var(--color-action-border-light-normal);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
&__icon {
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
justify-content: center;
|
|
142
142
|
|
|
143
143
|
svg {
|
|
144
|
-
fill: var(--color-action-graphics-
|
|
144
|
+
fill: var(--color-action-graphics-light-normal);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
|
|
@@ -206,9 +206,9 @@
|
|
|
206
206
|
z-index: 1;
|
|
207
207
|
display: inline-flex;
|
|
208
208
|
border-radius: 4px;
|
|
209
|
-
background: var(--color-action-background-
|
|
210
|
-
border: 2px solid var(--color-action-border-
|
|
211
|
-
color: var(--color-base-text-
|
|
209
|
+
background: var(--color-action-background-light-normal);
|
|
210
|
+
border: 2px solid var(--color-action-border-dark-normal);
|
|
211
|
+
color: var(--color-base-text-dark);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
&--variant-line &__frame {
|
|
@@ -243,8 +243,8 @@
|
|
|
243
243
|
justify-content: center;
|
|
244
244
|
overflow: hidden;
|
|
245
245
|
border-radius: 100%;
|
|
246
|
-
background: var(--color-action-background-
|
|
247
|
-
border: 2px solid var(--color-action-border-
|
|
246
|
+
background: var(--color-action-background-light-normal);
|
|
247
|
+
border: 2px solid var(--color-action-border-light-normal);
|
|
248
248
|
|
|
249
249
|
> * {
|
|
250
250
|
width: 100%;
|
|
@@ -272,35 +272,35 @@
|
|
|
272
272
|
|
|
273
273
|
&--checked &__frame,
|
|
274
274
|
&:has(input:checked) &__frame {
|
|
275
|
-
background: var(--color-action-background-
|
|
276
|
-
color: var(--color-action-text-
|
|
277
|
-
border-color: var(--color-action-background-
|
|
275
|
+
background: var(--color-action-background-dark-normal);
|
|
276
|
+
color: var(--color-action-text-light-normal);
|
|
277
|
+
border-color: var(--color-action-background-dark-normal);
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
&--invalid &__frame {
|
|
281
|
-
background: var(--color-action-background-
|
|
281
|
+
background: var(--color-action-background-light-normal);
|
|
282
282
|
border-color: var(--core-color-cherry-500);
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
&:hover &__frame {
|
|
286
286
|
background: var(--core-color-neutral-50);
|
|
287
|
-
border-color: var(--color-action-border-
|
|
287
|
+
border-color: var(--color-action-border-dark-plus1-hover);
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
&:active &__frame {
|
|
291
291
|
background: var(--core-color-neutral-100);
|
|
292
|
-
border-color: var(--color-action-border-
|
|
292
|
+
border-color: var(--color-action-border-dark-plus1-hover);
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
&--checked:hover &__frame,
|
|
296
296
|
&:has(input:checked):hover &__frame {
|
|
297
|
-
background: var(--color-action-background-
|
|
297
|
+
background: var(--color-action-background-dark-plus1-hover);
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
&--checked:active &__frame,
|
|
301
301
|
&:has(input:checked):active &__frame {
|
|
302
|
-
background: var(--color-action-background-
|
|
303
|
-
border-color: var(--color-action-background-
|
|
302
|
+
background: var(--color-action-background-dark-plus1-active);
|
|
303
|
+
border-color: var(--color-action-background-dark-plus1-active);
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
&--invalid:hover &__frame {
|
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
&--invalid#{&}--checked &__frame,
|
|
317
317
|
&--invalid:has(input:checked) &__frame {
|
|
318
318
|
background: var(--core-color-cherry-50);
|
|
319
|
-
color: var(--color-base-text-
|
|
319
|
+
color: var(--color-base-text-dark);
|
|
320
320
|
border-color: var(--core-color-cherry-500);
|
|
321
321
|
}
|
|
322
322
|
|
|
@@ -333,8 +333,8 @@
|
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
&__input:focus-visible + &__frame {
|
|
336
|
-
outline: 4px solid var(--color-action-border-
|
|
337
|
-
border-color: var(--color-action-border-
|
|
336
|
+
outline: 4px solid var(--color-action-border-dark-focus);
|
|
337
|
+
border-color: var(--color-action-border-light-normal);
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
&__icon {
|
|
@@ -343,7 +343,7 @@
|
|
|
343
343
|
justify-content: center;
|
|
344
344
|
|
|
345
345
|
svg {
|
|
346
|
-
fill: var(--color-action-graphics-
|
|
346
|
+
fill: var(--color-action-graphics-light-normal);
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
|
package/lib/scss/helsenorge.scss
CHANGED