@norges-domstoler/dds-components 0.0.0-dev-20260319072239 → 0.0.0-dev-20260319140133
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/dist/index.css +6 -3
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +9 -5
- package/dist/index.d.ts +9 -5
- package/dist/index.js +29 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +112 -104
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1748,7 +1748,6 @@ declare function useTheme(): {
|
|
|
1748
1748
|
ddsFontLineheightX1: 1.5;
|
|
1749
1749
|
ddsFontLineheightX3: 1.2;
|
|
1750
1750
|
ddsFontLineheightX2: 1.3;
|
|
1751
|
-
ddsFontLineheightList: 2;
|
|
1752
1751
|
ddsFontLetterSpacingTight: "-0.01em";
|
|
1753
1752
|
ddsFontLetterSpacingNormal: "0em";
|
|
1754
1753
|
ddsFontLetterSpacingLoose: "0.01em";
|
|
@@ -1758,6 +1757,8 @@ declare function useTheme(): {
|
|
|
1758
1757
|
ddsFontParagraphSpacingMediumNumberEm: 0.66;
|
|
1759
1758
|
ddsFontParagraphSpacingLarge: "0.5em";
|
|
1760
1759
|
ddsFontParagraphSpacingLargeNumberEm: 0.5;
|
|
1760
|
+
ddsFontParagraphSpacingList: "0.5em";
|
|
1761
|
+
ddsFontParagraphSpacingListNumberEm: 0.5;
|
|
1761
1762
|
ddsFontParagraphSpacingHeading: "0.4em";
|
|
1762
1763
|
ddsFontParagraphSpacingHeadingNumberEm: 0.4;
|
|
1763
1764
|
ddsFontStyleUnderline: "underline";
|
|
@@ -2176,7 +2177,6 @@ declare function useTheme(): {
|
|
|
2176
2177
|
ddsFontLineheightX1: 1.5;
|
|
2177
2178
|
ddsFontLineheightX3: 1.2;
|
|
2178
2179
|
ddsFontLineheightX2: 1.3;
|
|
2179
|
-
ddsFontLineheightList: 2;
|
|
2180
2180
|
ddsFontLetterSpacingTight: "-0.01em";
|
|
2181
2181
|
ddsFontLetterSpacingNormal: "0em";
|
|
2182
2182
|
ddsFontLetterSpacingLoose: "0.01em";
|
|
@@ -2186,6 +2186,8 @@ declare function useTheme(): {
|
|
|
2186
2186
|
ddsFontParagraphSpacingMediumNumberEm: 0.66;
|
|
2187
2187
|
ddsFontParagraphSpacingLarge: "0.5em";
|
|
2188
2188
|
ddsFontParagraphSpacingLargeNumberEm: 0.5;
|
|
2189
|
+
ddsFontParagraphSpacingList: "0.5em";
|
|
2190
|
+
ddsFontParagraphSpacingListNumberEm: 0.5;
|
|
2189
2191
|
ddsFontParagraphSpacingHeading: "0.4em";
|
|
2190
2192
|
ddsFontParagraphSpacingHeadingNumberEm: 0.4;
|
|
2191
2193
|
ddsFontStyleUnderline: "underline";
|
|
@@ -2604,7 +2606,6 @@ declare function useTheme(): {
|
|
|
2604
2606
|
ddsFontLineheightX1: 1.5;
|
|
2605
2607
|
ddsFontLineheightX3: 1.2;
|
|
2606
2608
|
ddsFontLineheightX2: 1.3;
|
|
2607
|
-
ddsFontLineheightList: 2;
|
|
2608
2609
|
ddsFontLetterSpacingTight: "-0.01em";
|
|
2609
2610
|
ddsFontLetterSpacingNormal: "0em";
|
|
2610
2611
|
ddsFontLetterSpacingLoose: "0.01em";
|
|
@@ -2614,6 +2615,8 @@ declare function useTheme(): {
|
|
|
2614
2615
|
ddsFontParagraphSpacingMediumNumberEm: 0.66;
|
|
2615
2616
|
ddsFontParagraphSpacingLarge: "0.5em";
|
|
2616
2617
|
ddsFontParagraphSpacingLargeNumberEm: 0.5;
|
|
2618
|
+
ddsFontParagraphSpacingList: "0.5em";
|
|
2619
|
+
ddsFontParagraphSpacingListNumberEm: 0.5;
|
|
2617
2620
|
ddsFontParagraphSpacingHeading: "0.4em";
|
|
2618
2621
|
ddsFontParagraphSpacingHeadingNumberEm: 0.4;
|
|
2619
2622
|
ddsFontStyleUnderline: "underline";
|
|
@@ -3032,7 +3035,6 @@ declare function useTheme(): {
|
|
|
3032
3035
|
ddsFontLineheightX1: 1.5;
|
|
3033
3036
|
ddsFontLineheightX3: 1.2;
|
|
3034
3037
|
ddsFontLineheightX2: 1.3;
|
|
3035
|
-
ddsFontLineheightList: 2;
|
|
3036
3038
|
ddsFontLetterSpacingTight: "-0.01em";
|
|
3037
3039
|
ddsFontLetterSpacingNormal: "0em";
|
|
3038
3040
|
ddsFontLetterSpacingLoose: "0.01em";
|
|
@@ -3042,6 +3044,8 @@ declare function useTheme(): {
|
|
|
3042
3044
|
ddsFontParagraphSpacingMediumNumberEm: 0.66;
|
|
3043
3045
|
ddsFontParagraphSpacingLarge: "0.5em";
|
|
3044
3046
|
ddsFontParagraphSpacingLargeNumberEm: 0.5;
|
|
3047
|
+
ddsFontParagraphSpacingList: "0.5em";
|
|
3048
|
+
ddsFontParagraphSpacingListNumberEm: 0.5;
|
|
3045
3049
|
ddsFontParagraphSpacingHeading: "0.4em";
|
|
3046
3050
|
ddsFontParagraphSpacingHeadingNumberEm: 0.4;
|
|
3047
3051
|
ddsFontStyleUnderline: "underline";
|
|
@@ -3860,7 +3864,7 @@ type CookieBannerProps = BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
|
3860
3864
|
/**Brekkpunkt for sammentrukket variant; Brukes på siden med detaljer om informasjonskapsler. */
|
|
3861
3865
|
collapsedBreakpoint?: Breakpoint;
|
|
3862
3866
|
} & Pick<ResponsiveProps, 'position' | 'top' | 'bottom' | 'left' | 'right' | 'width' | 'maxHeight'>>;
|
|
3863
|
-
declare function CookieBanner({ headerText, description, buttons, checkboxes, id, className, style, htmlProps, maxHeight, width, children, collapsedBreakpoint, ...rest }: CookieBannerProps): react_jsx_runtime.JSX.Element;
|
|
3867
|
+
declare function CookieBanner({ headerText, description, buttons, checkboxes, id, className, style, htmlProps, maxHeight, width, children, collapsedBreakpoint, ref, ...rest }: CookieBannerProps): react_jsx_runtime.JSX.Element;
|
|
3864
3868
|
declare namespace CookieBanner {
|
|
3865
3869
|
var displayName: string;
|
|
3866
3870
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1748,7 +1748,6 @@ declare function useTheme(): {
|
|
|
1748
1748
|
ddsFontLineheightX1: 1.5;
|
|
1749
1749
|
ddsFontLineheightX3: 1.2;
|
|
1750
1750
|
ddsFontLineheightX2: 1.3;
|
|
1751
|
-
ddsFontLineheightList: 2;
|
|
1752
1751
|
ddsFontLetterSpacingTight: "-0.01em";
|
|
1753
1752
|
ddsFontLetterSpacingNormal: "0em";
|
|
1754
1753
|
ddsFontLetterSpacingLoose: "0.01em";
|
|
@@ -1758,6 +1757,8 @@ declare function useTheme(): {
|
|
|
1758
1757
|
ddsFontParagraphSpacingMediumNumberEm: 0.66;
|
|
1759
1758
|
ddsFontParagraphSpacingLarge: "0.5em";
|
|
1760
1759
|
ddsFontParagraphSpacingLargeNumberEm: 0.5;
|
|
1760
|
+
ddsFontParagraphSpacingList: "0.5em";
|
|
1761
|
+
ddsFontParagraphSpacingListNumberEm: 0.5;
|
|
1761
1762
|
ddsFontParagraphSpacingHeading: "0.4em";
|
|
1762
1763
|
ddsFontParagraphSpacingHeadingNumberEm: 0.4;
|
|
1763
1764
|
ddsFontStyleUnderline: "underline";
|
|
@@ -2176,7 +2177,6 @@ declare function useTheme(): {
|
|
|
2176
2177
|
ddsFontLineheightX1: 1.5;
|
|
2177
2178
|
ddsFontLineheightX3: 1.2;
|
|
2178
2179
|
ddsFontLineheightX2: 1.3;
|
|
2179
|
-
ddsFontLineheightList: 2;
|
|
2180
2180
|
ddsFontLetterSpacingTight: "-0.01em";
|
|
2181
2181
|
ddsFontLetterSpacingNormal: "0em";
|
|
2182
2182
|
ddsFontLetterSpacingLoose: "0.01em";
|
|
@@ -2186,6 +2186,8 @@ declare function useTheme(): {
|
|
|
2186
2186
|
ddsFontParagraphSpacingMediumNumberEm: 0.66;
|
|
2187
2187
|
ddsFontParagraphSpacingLarge: "0.5em";
|
|
2188
2188
|
ddsFontParagraphSpacingLargeNumberEm: 0.5;
|
|
2189
|
+
ddsFontParagraphSpacingList: "0.5em";
|
|
2190
|
+
ddsFontParagraphSpacingListNumberEm: 0.5;
|
|
2189
2191
|
ddsFontParagraphSpacingHeading: "0.4em";
|
|
2190
2192
|
ddsFontParagraphSpacingHeadingNumberEm: 0.4;
|
|
2191
2193
|
ddsFontStyleUnderline: "underline";
|
|
@@ -2604,7 +2606,6 @@ declare function useTheme(): {
|
|
|
2604
2606
|
ddsFontLineheightX1: 1.5;
|
|
2605
2607
|
ddsFontLineheightX3: 1.2;
|
|
2606
2608
|
ddsFontLineheightX2: 1.3;
|
|
2607
|
-
ddsFontLineheightList: 2;
|
|
2608
2609
|
ddsFontLetterSpacingTight: "-0.01em";
|
|
2609
2610
|
ddsFontLetterSpacingNormal: "0em";
|
|
2610
2611
|
ddsFontLetterSpacingLoose: "0.01em";
|
|
@@ -2614,6 +2615,8 @@ declare function useTheme(): {
|
|
|
2614
2615
|
ddsFontParagraphSpacingMediumNumberEm: 0.66;
|
|
2615
2616
|
ddsFontParagraphSpacingLarge: "0.5em";
|
|
2616
2617
|
ddsFontParagraphSpacingLargeNumberEm: 0.5;
|
|
2618
|
+
ddsFontParagraphSpacingList: "0.5em";
|
|
2619
|
+
ddsFontParagraphSpacingListNumberEm: 0.5;
|
|
2617
2620
|
ddsFontParagraphSpacingHeading: "0.4em";
|
|
2618
2621
|
ddsFontParagraphSpacingHeadingNumberEm: 0.4;
|
|
2619
2622
|
ddsFontStyleUnderline: "underline";
|
|
@@ -3032,7 +3035,6 @@ declare function useTheme(): {
|
|
|
3032
3035
|
ddsFontLineheightX1: 1.5;
|
|
3033
3036
|
ddsFontLineheightX3: 1.2;
|
|
3034
3037
|
ddsFontLineheightX2: 1.3;
|
|
3035
|
-
ddsFontLineheightList: 2;
|
|
3036
3038
|
ddsFontLetterSpacingTight: "-0.01em";
|
|
3037
3039
|
ddsFontLetterSpacingNormal: "0em";
|
|
3038
3040
|
ddsFontLetterSpacingLoose: "0.01em";
|
|
@@ -3042,6 +3044,8 @@ declare function useTheme(): {
|
|
|
3042
3044
|
ddsFontParagraphSpacingMediumNumberEm: 0.66;
|
|
3043
3045
|
ddsFontParagraphSpacingLarge: "0.5em";
|
|
3044
3046
|
ddsFontParagraphSpacingLargeNumberEm: 0.5;
|
|
3047
|
+
ddsFontParagraphSpacingList: "0.5em";
|
|
3048
|
+
ddsFontParagraphSpacingListNumberEm: 0.5;
|
|
3045
3049
|
ddsFontParagraphSpacingHeading: "0.4em";
|
|
3046
3050
|
ddsFontParagraphSpacingHeadingNumberEm: 0.4;
|
|
3047
3051
|
ddsFontStyleUnderline: "underline";
|
|
@@ -3860,7 +3864,7 @@ type CookieBannerProps = BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
|
3860
3864
|
/**Brekkpunkt for sammentrukket variant; Brukes på siden med detaljer om informasjonskapsler. */
|
|
3861
3865
|
collapsedBreakpoint?: Breakpoint;
|
|
3862
3866
|
} & Pick<ResponsiveProps, 'position' | 'top' | 'bottom' | 'left' | 'right' | 'width' | 'maxHeight'>>;
|
|
3863
|
-
declare function CookieBanner({ headerText, description, buttons, checkboxes, id, className, style, htmlProps, maxHeight, width, children, collapsedBreakpoint, ...rest }: CookieBannerProps): react_jsx_runtime.JSX.Element;
|
|
3867
|
+
declare function CookieBanner({ headerText, description, buttons, checkboxes, id, className, style, htmlProps, maxHeight, width, children, collapsedBreakpoint, ref, ...rest }: CookieBannerProps): react_jsx_runtime.JSX.Element;
|
|
3864
3868
|
declare namespace CookieBanner {
|
|
3865
3869
|
var displayName: string;
|
|
3866
3870
|
}
|
package/dist/index.js
CHANGED
|
@@ -878,36 +878,38 @@ function useElementHeight(element) {
|
|
|
878
878
|
|
|
879
879
|
// src/hooks/useFocusTrap/useFocusTrap.tsx
|
|
880
880
|
function useFocusTrap(active, initialFocusRef = void 0) {
|
|
881
|
-
const
|
|
882
|
-
(0, import_react5.
|
|
881
|
+
const containerRef = (0, import_react5.useRef)(null);
|
|
882
|
+
(0, import_react5.useLayoutEffect)(() => {
|
|
883
|
+
const container2 = containerRef.current;
|
|
884
|
+
if (!active || !container2) return;
|
|
885
|
+
if (initialFocusRef == null ? void 0 : initialFocusRef.current) {
|
|
886
|
+
initialFocusRef.current.focus();
|
|
887
|
+
} else {
|
|
888
|
+
container2.tabIndex = container2.tabIndex || -1;
|
|
889
|
+
container2.focus();
|
|
890
|
+
}
|
|
883
891
|
function handleFocus(e) {
|
|
884
|
-
if (e.key !== "Tab"
|
|
885
|
-
const
|
|
886
|
-
|
|
887
|
-
const
|
|
888
|
-
|
|
889
|
-
|
|
892
|
+
if (e.key !== "Tab") return;
|
|
893
|
+
const focusableEls = getFocusableElements(containerRef);
|
|
894
|
+
if (focusableEls.length < 1) return;
|
|
895
|
+
const firstEl = focusableEls[0];
|
|
896
|
+
const lastEl = focusableEls[focusableEls.length - 1];
|
|
897
|
+
const activeEl = document.activeElement;
|
|
898
|
+
if (!e.shiftKey && activeEl === lastEl) {
|
|
899
|
+
firstEl.focus();
|
|
890
900
|
e.preventDefault();
|
|
891
901
|
}
|
|
892
|
-
if (e.shiftKey &&
|
|
893
|
-
|
|
902
|
+
if (e.shiftKey && activeEl === firstEl) {
|
|
903
|
+
lastEl.focus();
|
|
894
904
|
e.preventDefault();
|
|
895
905
|
}
|
|
896
906
|
}
|
|
897
|
-
|
|
898
|
-
if (element && active) {
|
|
899
|
-
if (initialFocusRef == null ? void 0 : initialFocusRef.current) {
|
|
900
|
-
initialFocusRef.current.focus();
|
|
901
|
-
} else {
|
|
902
|
-
element.focus();
|
|
903
|
-
element.addEventListener("keydown", handleFocus);
|
|
904
|
-
}
|
|
905
|
-
}
|
|
907
|
+
document.addEventListener("keydown", handleFocus);
|
|
906
908
|
return () => {
|
|
907
|
-
|
|
909
|
+
document.removeEventListener("keydown", handleFocus);
|
|
908
910
|
};
|
|
909
911
|
}, [active]);
|
|
910
|
-
return
|
|
912
|
+
return containerRef;
|
|
911
913
|
}
|
|
912
914
|
|
|
913
915
|
// src/hooks/useIsMounted/useIsMounted.ts
|
|
@@ -6499,6 +6501,7 @@ var import_react38 = require("react");
|
|
|
6499
6501
|
|
|
6500
6502
|
// src/components/CookieBanner/CookieBanner.module.css
|
|
6501
6503
|
var CookieBanner_default = {
|
|
6504
|
+
container: "CookieBanner_container",
|
|
6502
6505
|
"checkbox-label": "CookieBanner_checkbox-label"
|
|
6503
6506
|
};
|
|
6504
6507
|
|
|
@@ -6548,9 +6551,12 @@ function CookieBanner({
|
|
|
6548
6551
|
width = "fit-content",
|
|
6549
6552
|
children,
|
|
6550
6553
|
collapsedBreakpoint,
|
|
6554
|
+
ref,
|
|
6551
6555
|
...rest
|
|
6552
6556
|
}) {
|
|
6553
6557
|
const { t } = useTranslation();
|
|
6558
|
+
const containerRef = useFocusTrap(true);
|
|
6559
|
+
const combinedRef = useCombinedRef(containerRef, ref);
|
|
6554
6560
|
const hasBp = !!collapsedBreakpoint;
|
|
6555
6561
|
const [isCollapsedOnBreakpoint, setIsCollapsedOnBreakpoint] = (0, import_react38.useState)(hasBp);
|
|
6556
6562
|
const generatedId = (0, import_react38.useId)();
|
|
@@ -6563,6 +6569,7 @@ function CookieBanner({
|
|
|
6563
6569
|
id,
|
|
6564
6570
|
cn(
|
|
6565
6571
|
className,
|
|
6572
|
+
CookieBanner_default.container,
|
|
6566
6573
|
utilStyles_default.scrollbar,
|
|
6567
6574
|
utilStyles_default["scrollable-y"],
|
|
6568
6575
|
typographyStyles_default["tertiary-medium"]
|
|
@@ -6571,6 +6578,7 @@ function CookieBanner({
|
|
|
6571
6578
|
htmlProps,
|
|
6572
6579
|
rest
|
|
6573
6580
|
),
|
|
6581
|
+
ref: combinedRef,
|
|
6574
6582
|
role: "region",
|
|
6575
6583
|
"aria-labelledby": headingId,
|
|
6576
6584
|
padding: styleUpToBreakpoint("x1", "sm", "x1.5"),
|