@skatteetaten/ds-overlays 1.3.0 → 1.4.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/Modal/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef, useId, useRef, useImperativeHandle } from 'react';
|
|
2
|
+
import { forwardRef, useId, useRef, useImperativeHandle, useEffect } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { IconButton } from '@skatteetaten/ds-buttons';
|
|
5
5
|
import { dsI18n, SkatteetatenLogo, Separator, getCommonClassNameDefault } from '@skatteetaten/ds-core-utils';
|
|
@@ -42,6 +42,17 @@ shadowRootNode, onClose, children }, ref)=>{
|
|
|
42
42
|
});
|
|
43
43
|
const modalRef = useRef(null);
|
|
44
44
|
useImperativeHandle(ref, ()=>modalRef?.current);
|
|
45
|
+
useEffect(()=>{
|
|
46
|
+
/**
|
|
47
|
+
* Hvis konsument endrer children i en åpen modal, vil fokus settes til body og dismissOnEsc vil slutte å fungere.
|
|
48
|
+
* Setter derfor fokus tilbake til modalen.
|
|
49
|
+
*/ if (!dismissOnEsc && modalRef.current?.open && document.activeElement?.nodeName === 'BODY') {
|
|
50
|
+
modalRef.current.focus();
|
|
51
|
+
}
|
|
52
|
+
}, [
|
|
53
|
+
children,
|
|
54
|
+
dismissOnEsc
|
|
55
|
+
]);
|
|
45
56
|
const isClickOutside = (event)=>{
|
|
46
57
|
if (!(event.target instanceof HTMLElement)) {
|
|
47
58
|
return true;
|
|
@@ -78,7 +89,8 @@ shadowRootNode, onClose, children }, ref)=>{
|
|
|
78
89
|
"data-testid": dataTestId,
|
|
79
90
|
"aria-labelledby": headingId,
|
|
80
91
|
autoFocus: true,
|
|
81
|
-
/*
|
|
92
|
+
/* Må bruke onCancel i kombinasjon med onKeyDown siden to trykk på esc lukker modalen i chrome (https://issues.chromium.org/issues/41491338) */ onCancel: (e)=>!dismissOnEsc && e.preventDefault(),
|
|
93
|
+
onKeyDown: (e)=>{
|
|
82
94
|
if (e.key === 'Escape') {
|
|
83
95
|
if (dismissOnEsc) {
|
|
84
96
|
onClose?.();
|
package/Popover/index.esm.js
CHANGED
|
@@ -2,8 +2,8 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useRef, useState, useEffect, useMemo } from 'react';
|
|
3
3
|
import { useFloating, autoUpdate, offset, flip, shift, arrow, useDismiss, useInteractions } from '@floating-ui/react';
|
|
4
4
|
import { useMediaQuery } from '@skatteetaten/ds-core-utils';
|
|
5
|
-
import { P as PopoverContent, a as getPopoverPositionDefault } from '../PopoverContent
|
|
6
|
-
export { g as getPopoverColorDefault, b as getPopoverRestoreFocusDefault } from '../PopoverContent
|
|
5
|
+
import { P as PopoverContent, a as getPopoverPositionDefault } from '../PopoverContent.esm.js';
|
|
6
|
+
export { g as getPopoverColorDefault, b as getPopoverRestoreFocusDefault } from '../PopoverContent.esm.js';
|
|
7
7
|
import { PopoverContext } from '../PopoverContext/index.esm.js';
|
|
8
8
|
import { PopoverTrigger } from '../PopoverTrigger/index.esm.js';
|
|
9
9
|
import 'react-i18next';
|
|
@@ -5,5 +5,5 @@ import '@floating-ui/react';
|
|
|
5
5
|
import '@skatteetaten/ds-buttons';
|
|
6
6
|
import '@skatteetaten/ds-core-utils';
|
|
7
7
|
import '@skatteetaten/ds-icons';
|
|
8
|
-
export { P as PopoverContent } from '../PopoverContent
|
|
8
|
+
export { P as PopoverContent } from '../PopoverContent.esm.js';
|
|
9
9
|
import '../PopoverContext/index.esm.js';
|
package/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Modal, getModalDismissOnEscDefault, getModalDismissOnOutsideClickDefault, getModalPaddingDefault, getModalVariantDefault } from './Modal/index.esm.js';
|
|
2
2
|
export { Popover } from './Popover/index.esm.js';
|
|
3
3
|
import { colorNamesArr } from '@skatteetaten/ds-core-utils';
|
|
4
|
-
export { g as getPopoverColorDefault, a as getPopoverPositionDefault, b as getPopoverRestoreFocusDefault } from './PopoverContent
|
|
4
|
+
export { g as getPopoverColorDefault, a as getPopoverPositionDefault, b as getPopoverRestoreFocusDefault } from './PopoverContent.esm.js';
|
|
5
5
|
import 'react/jsx-runtime';
|
|
6
6
|
import 'react';
|
|
7
7
|
import 'react-i18next';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skatteetaten/ds-overlays",
|
|
3
3
|
"groupId": "no.skatteetaten.aurora",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"main": "./index.esm.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"module": "./index.esm.js",
|
|
@@ -10,16 +10,17 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/Skatteetaten/designsystemet.git"
|
|
12
12
|
},
|
|
13
|
+
"license": "Apache-2.0",
|
|
13
14
|
"homepage": "https://www.skatteetaten.no/stilogtone/designsystemet/",
|
|
14
15
|
"peerDependencies": {
|
|
15
16
|
"i18next": "^23",
|
|
16
17
|
"react": "^18",
|
|
17
18
|
"react-i18next": "^14",
|
|
18
|
-
"@skatteetaten/ds-core-utils": "1.
|
|
19
|
-
"@skatteetaten/ds-buttons": "1.
|
|
20
|
-
"@skatteetaten/ds-icons": "1.
|
|
21
|
-
"@skatteetaten/ds-typography": "1.
|
|
22
|
-
"@skatteetaten/ds-progress": "1.
|
|
19
|
+
"@skatteetaten/ds-core-utils": "1.4.0",
|
|
20
|
+
"@skatteetaten/ds-buttons": "1.4.0",
|
|
21
|
+
"@skatteetaten/ds-icons": "1.4.0",
|
|
22
|
+
"@skatteetaten/ds-typography": "1.4.0",
|
|
23
|
+
"@skatteetaten/ds-progress": "1.4.0",
|
|
23
24
|
"@floating-ui/react": "0.26.17"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {},
|
|
File without changes
|