@skatteetaten/ds-overlays 2.2.2 → 2.3.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/styles.css +1 -1
- package/Popover/defaults.esm.js +2 -1
- package/Popover/index.esm.js +1 -1
- package/PopoverContent/index.esm.js +10 -8
- package/README.md +3 -0
- package/RolePicker/index.esm.js +5 -1
- package/WordInfo/defaults.esm.js +3 -0
- package/WordInfo/index.d.ts +1 -0
- package/WordInfo/index.esm.js +18 -0
- package/WordInfoContent/WordInfoContent.module.scss.esm.js +7 -0
- package/WordInfoContent/index.d.ts +1 -0
- package/WordInfoContent/index.esm.js +25 -0
- package/WordInfoContent/styles.css +1 -0
- package/WordInfoTrigger/WordInfoTrigger.module.scss.esm.js +7 -0
- package/WordInfoTrigger/index.d.ts +1 -0
- package/WordInfoTrigger/index.esm.js +50 -0
- package/WordInfoTrigger/styles.css +1 -0
- package/index.esm.js +3 -1
- package/package.json +11 -11
- package/src/Popover/Popover.d.ts +2 -2
- package/src/Popover/Popover.types.d.ts +3 -3
- package/src/Popover/defaults.d.ts +2 -0
- package/src/PopoverContent/PopoverContent.d.ts +1 -1
- package/src/PopoverContent/PopoverContent.types.d.ts +12 -1
- package/src/WordInfo/WordInfo.d.ts +4 -0
- package/src/WordInfo/WordInfo.types.d.ts +18 -0
- package/src/WordInfo/defaults.d.ts +1 -0
- package/src/WordInfoContent/WordInfoContent.d.ts +6 -0
- package/src/WordInfoContent/WordInfoContent.types.d.ts +10 -0
- package/src/WordInfoTrigger/WordInfoTrigger.d.ts +6 -0
- package/src/WordInfoTrigger/WordInfoTrigger.types.d.ts +14 -0
- package/src/index.d.ts +2 -0
- /package/Modal/{index.esm.d.ts → index.d.ts} +0 -0
- /package/Popover/{index.esm.d.ts → index.d.ts} +0 -0
- /package/PopoverContent/{index.esm.d.ts → index.d.ts} +0 -0
- /package/PopoverContext/{index.esm.d.ts → index.d.ts} +0 -0
- /package/PopoverTrigger/{index.esm.d.ts → index.d.ts} +0 -0
- /package/RolePicker/{index.esm.d.ts → index.d.ts} +0 -0
- /package/RolePickerBusinessList/{index.esm.d.ts → index.d.ts} +0 -0
- /package/RolePickerContext/{index.esm.d.ts → index.d.ts} +0 -0
- /package/RolePickerFilterInput/{index.esm.d.ts → index.d.ts} +0 -0
- /package/RolePickerPeopleList/{index.esm.d.ts → index.d.ts} +0 -0
- /package/RolePickerRow/{index.esm.d.ts → index.d.ts} +0 -0
- /package/{index.esm.d.ts → index.d.ts} +0 -0
package/Modal/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
html:has(dialog[open]){overflow:hidden}.Modal-module_modal__Kyr-Y{background-color:var(--palette-graphite-0);border:.25rem solid var(--theme-primary);box-shadow:0 0 8px 2px rgba(0,0,0,.16),0 2px 4px -4px rgba(0,0,0,.16);box-sizing:border-box;font-size:var(--font-size-m);font-weight:var(--font-weight-regular);line-height:var(--semantic-line-height-article);max-height:calc(
|
|
1
|
+
html:has(dialog[open]){overflow:hidden}.Modal-module_modal__Kyr-Y{--ds-modal-footer-height:0px;background-color:var(--palette-graphite-0);border:.25rem solid var(--theme-primary);box-shadow:0 0 8px 2px rgba(0,0,0,.16),0 2px 4px -4px rgba(0,0,0,.16);box-sizing:border-box;font-size:var(--font-size-m);font-weight:var(--font-weight-regular);line-height:var(--semantic-line-height-article);max-height:calc(100dvh - var(--spacing-m)*2);max-width:calc(var(--semantic-responsive-article) - var(--spacing-m)*2);min-width:calc(300px - var(--spacing-m)*2);overflow-y:auto;padding:0;padding-bottom:calc(env(safe-area-inset-bottom, 0px) + var(--ds-modal-footer-height));position:fixed}@supports not (height:100dvh){.Modal-module_modal__Kyr-Y{max-height:calc(100vh - var(--spacing-m)*2)}}.Modal-module_modal__Kyr-Y::backdrop{background:hsla(0,0%,100%,.8)}.Modal-module_modalContainer__muf75{outline:none}.Modal-module_modalHeading__uwT1R{padding-right:var(--spacing-xl)}.Modal-module_modalHeadingNoPadding__t2hkH{padding-right:0}.Modal-module_modalIllustration__jbA32{margin-bottom:var(--spacing-m);width:100%}.Modal-module_modal__Kyr-Y[data-variant=plain]{border:none}.Modal-module_modalPaddingNONE__02HaX{padding:0}.Modal-module_modalPaddingS__O93ax{padding:calc(var(--spacing-s) - .25rem)}.Modal-module_modalPaddingM__c5Wi2{padding:calc(var(--spacing-m) - .25rem)}.Modal-module_modalPaddingL__IbVyg{padding:calc(var(--spacing-l) - .25rem)}.Modal-module_modalPaddingMEGA__wWHwS{padding:calc(var(--spacing-mega) - .25rem)}.Modal-module_modalNoPaddingTop__REBWr{padding-top:0}.Modal-module_closeButton__jgbDq{margin:var(--spacing-s);position:absolute;right:0;top:0}.Modal-module_closeButton__jgbDq:not(:active)>svg{fill:var(--palette-graphite-100)}.Modal-module_srOnly__W8dQv{clip:rect(0,0,0,0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}
|
package/Popover/defaults.esm.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const getPopoverColorDefault = ()=>'forest';
|
|
2
2
|
const getPopoverPositionDefault = ()=>'bottomStart';
|
|
3
3
|
const getPopoverRestoreFocusDefault = ()=>true;
|
|
4
|
+
const getPopoverContentAsDefault = ()=>'div';
|
|
4
5
|
|
|
5
|
-
export { getPopoverColorDefault, getPopoverPositionDefault, getPopoverRestoreFocusDefault };
|
|
6
|
+
export { getPopoverColorDefault, getPopoverContentAsDefault, getPopoverPositionDefault, getPopoverRestoreFocusDefault };
|
package/Popover/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useRef, useState, useEffect, useMemo } from 'react';
|
|
|
3
3
|
import { useFloating, offset, flip, shift, arrow, autoUpdate, useDismiss, useInteractions } from '@floating-ui/react';
|
|
4
4
|
import { useMediaQuery } from '@skatteetaten/ds-core-utils';
|
|
5
5
|
import { getPopoverPositionDefault } from './defaults.esm.js';
|
|
6
|
-
export { getPopoverColorDefault, getPopoverRestoreFocusDefault } from './defaults.esm.js';
|
|
6
|
+
export { getPopoverColorDefault, getPopoverContentAsDefault, getPopoverRestoreFocusDefault } from './defaults.esm.js';
|
|
7
7
|
import { PopoverContent } from '../PopoverContent/index.esm.js';
|
|
8
8
|
import { PopoverContext } from '../PopoverContext/index.esm.js';
|
|
9
9
|
import { PopoverTrigger } from '../PopoverTrigger/index.esm.js';
|
|
@@ -5,13 +5,13 @@ import { useMergeRefs } from '@floating-ui/react';
|
|
|
5
5
|
import { IconButton } from '@skatteetaten/ds-buttons';
|
|
6
6
|
import { dsI18n, getCommonClassNameDefault } from '@skatteetaten/ds-core-utils';
|
|
7
7
|
import { CancelSVGpath } from '@skatteetaten/ds-icons';
|
|
8
|
-
import { getPopoverColorDefault, getPopoverRestoreFocusDefault } from '../Popover/defaults.esm.js';
|
|
8
|
+
import { getPopoverColorDefault, getPopoverRestoreFocusDefault, getPopoverContentAsDefault } from '../Popover/defaults.esm.js';
|
|
9
9
|
import { PopoverContext } from '../PopoverContext/index.esm.js';
|
|
10
10
|
import styles from './PopoverContent.module.scss.esm.js';
|
|
11
11
|
import './styles.css';
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const PopoverContent = ({ ref, id, className = getCommonClassNameDefault(), classNames, lang, 'data-testid': dataTestId, as: Tag = getPopoverContentAsDefault(), children })=>{
|
|
15
15
|
const { floatingData, interactions, arrowRef, isOpen, setIsOpen, color = getPopoverColorDefault(), shouldRestoreFocus = getPopoverRestoreFocusDefault(), onClose } = useContext(PopoverContext);
|
|
16
16
|
const { refs, floatingStyles, placement, middlewareData } = floatingData;
|
|
17
17
|
const { getFloatingProps } = interactions;
|
|
@@ -34,24 +34,25 @@ import './styles.css';
|
|
|
34
34
|
if (!isOpen) {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
|
-
return /*#__PURE__*/ jsxs(
|
|
37
|
+
return /*#__PURE__*/ jsxs(Tag, {
|
|
38
38
|
...getFloatingProps(),
|
|
39
39
|
ref: mergedRef,
|
|
40
|
+
// eslint-disable-next-line react/forbid-component-props
|
|
40
41
|
style: floatingStyles,
|
|
41
42
|
id: id,
|
|
42
43
|
lang: lang,
|
|
43
44
|
"data-testid": dataTestId,
|
|
44
45
|
className: `${styles.popover} ${colorClassName} ${className}`.trim(),
|
|
45
46
|
children: [
|
|
46
|
-
/*#__PURE__*/ jsxs(
|
|
47
|
+
/*#__PURE__*/ jsxs(Tag, {
|
|
47
48
|
className: styles.popoverContent,
|
|
48
49
|
children: [
|
|
49
|
-
/*#__PURE__*/ jsx(
|
|
50
|
-
className: styles.popoverContentWrapper,
|
|
50
|
+
/*#__PURE__*/ jsx(Tag, {
|
|
51
|
+
className: `${styles.popoverContentWrapper} ${classNames?.contentWrapper ?? ''}`.trim(),
|
|
51
52
|
children: children
|
|
52
53
|
}),
|
|
53
54
|
/*#__PURE__*/ jsx(IconButton, {
|
|
54
|
-
className: styles.popoverContentCloseButton,
|
|
55
|
+
className: `${styles.popoverContentCloseButton} ${classNames?.closeButton ?? ''}`.trim(),
|
|
55
56
|
svgPath: CancelSVGpath,
|
|
56
57
|
title: t('shared.Close'),
|
|
57
58
|
onClick: ()=>{
|
|
@@ -64,8 +65,9 @@ import './styles.css';
|
|
|
64
65
|
})
|
|
65
66
|
]
|
|
66
67
|
}),
|
|
67
|
-
/*#__PURE__*/ jsx(
|
|
68
|
+
/*#__PURE__*/ jsx(Tag, {
|
|
68
69
|
ref: arrowRef,
|
|
70
|
+
// eslint-disable-next-line react/forbid-component-props
|
|
69
71
|
style: {
|
|
70
72
|
left: middlewareData.arrow?.x,
|
|
71
73
|
top: middlewareData.arrow?.y,
|
package/README.md
CHANGED
package/RolePicker/index.esm.js
CHANGED
|
@@ -37,6 +37,10 @@ const RolePicker = ({ ref, id, className = getCommonClassNameDefault(), lang, 'd
|
|
|
37
37
|
setLoadingEntityId(undefined);
|
|
38
38
|
onClose?.();
|
|
39
39
|
};
|
|
40
|
+
const handleCancel = ()=>{
|
|
41
|
+
modalRef.current?.close();
|
|
42
|
+
handleClose();
|
|
43
|
+
};
|
|
40
44
|
const getRepresentationText = ()=>{
|
|
41
45
|
if (people && people.total > 0 && businesses && businesses.total > 0) {
|
|
42
46
|
return /*#__PURE__*/ jsxs(Paragraph, {
|
|
@@ -173,7 +177,7 @@ const RolePicker = ({ ref, id, className = getCommonClassNameDefault(), lang, 'd
|
|
|
173
177
|
}),
|
|
174
178
|
!hideCloseButton ? /*#__PURE__*/ jsx(Button, {
|
|
175
179
|
variant: 'secondary',
|
|
176
|
-
onClick:
|
|
180
|
+
onClick: handleCancel,
|
|
177
181
|
children: t('rolepicker.Cancel')
|
|
178
182
|
}) : null
|
|
179
183
|
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/WordInfo/WordInfo";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
export { getWordInfoHasIconDefault } from './defaults.esm.js';
|
|
3
|
+
import { Popover } from '../Popover/index.esm.js';
|
|
4
|
+
import { WordInfoContent } from '../WordInfoContent/index.esm.js';
|
|
5
|
+
import { WordInfoTrigger } from '../WordInfoTrigger/index.esm.js';
|
|
6
|
+
|
|
7
|
+
const WordInfo = (props)=>{
|
|
8
|
+
return /*#__PURE__*/ jsx(Popover, {
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
WordInfo.displayName = 'WordInfo';
|
|
13
|
+
WordInfo.Content = WordInfoContent;
|
|
14
|
+
WordInfo.Content.displayName = 'WordInfo.Content';
|
|
15
|
+
WordInfo.Trigger = WordInfoTrigger;
|
|
16
|
+
WordInfo.Trigger.displayName = 'WordInfo.Trigger';
|
|
17
|
+
|
|
18
|
+
export { WordInfo };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/WordInfoContent/WordInfoContent";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { getCommonClassNameDefault } from '@skatteetaten/ds-core-utils';
|
|
3
|
+
import { PopoverContent } from '../PopoverContent/index.esm.js';
|
|
4
|
+
import styles from './WordInfoContent.module.scss.esm.js';
|
|
5
|
+
import './styles.css';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const WordInfoContent = ({ ref, id, className = getCommonClassNameDefault(), lang, 'data-testid': dataTestId, children })=>{
|
|
9
|
+
return /*#__PURE__*/ jsx(PopoverContent, {
|
|
10
|
+
ref: ref,
|
|
11
|
+
id: id,
|
|
12
|
+
className: `${styles.wordInfoContent} ${className}`.trim(),
|
|
13
|
+
classNames: {
|
|
14
|
+
contentWrapper: styles.contentWrapper,
|
|
15
|
+
closeButton: styles.closeButton
|
|
16
|
+
},
|
|
17
|
+
lang: lang,
|
|
18
|
+
"data-testid": dataTestId,
|
|
19
|
+
as: 'span',
|
|
20
|
+
children: children
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
WordInfoContent.displayName = 'WordInfoContent';
|
|
24
|
+
|
|
25
|
+
export { WordInfoContent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.WordInfoContent-module_wordInfoContent__KyB0L{--background-color:var(--palette-denim-10);--border-color:var(--palette-denim-100)}.WordInfoContent-module_contentWrapper__-GbIP{padding:.5625rem var(--spacing-s)}.WordInfoContent-module_closeButton__qGgbC{margin:var(--spacing-xs)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/WordInfoTrigger/WordInfoTrigger";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { useMergeRefs } from '@floating-ui/react';
|
|
5
|
+
import { dsI18n, getCommonClassNameDefault } from '@skatteetaten/ds-core-utils';
|
|
6
|
+
import { BookOpenIcon } from '@skatteetaten/ds-icons';
|
|
7
|
+
import { PopoverContext } from '../PopoverContext/index.esm.js';
|
|
8
|
+
import styles from './WordInfoTrigger.module.scss.esm.js';
|
|
9
|
+
import './styles.css';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const WordInfoTrigger = ({ ref, id, className = getCommonClassNameDefault(), lang, 'data-testid': dataTestId, hasIcon = true, children, onClick })=>{
|
|
13
|
+
const { floatingData, setIsOpen, isOpen } = useContext(PopoverContext);
|
|
14
|
+
const { setReference } = floatingData.refs;
|
|
15
|
+
const mergedRef = useMergeRefs([
|
|
16
|
+
setReference,
|
|
17
|
+
ref
|
|
18
|
+
]);
|
|
19
|
+
const { t } = useTranslation('ds_overlays', {
|
|
20
|
+
i18n: dsI18n
|
|
21
|
+
});
|
|
22
|
+
return /*#__PURE__*/ jsxs("button", {
|
|
23
|
+
ref: mergedRef,
|
|
24
|
+
id: id,
|
|
25
|
+
className: `${styles.wordInfoTrigger} ${className}`.trim(),
|
|
26
|
+
lang: lang,
|
|
27
|
+
"data-testid": dataTestId,
|
|
28
|
+
"aria-expanded": isOpen,
|
|
29
|
+
onClick: (event)=>{
|
|
30
|
+
onClick?.(event);
|
|
31
|
+
setIsOpen(!isOpen);
|
|
32
|
+
},
|
|
33
|
+
children: [
|
|
34
|
+
children,
|
|
35
|
+
/*#__PURE__*/ jsxs("span", {
|
|
36
|
+
className: styles.srOnly,
|
|
37
|
+
children: [
|
|
38
|
+
" ",
|
|
39
|
+
t('wordinfo.WordExplanation')
|
|
40
|
+
]
|
|
41
|
+
}),
|
|
42
|
+
hasIcon && /*#__PURE__*/ jsx(BookOpenIcon, {
|
|
43
|
+
className: styles.icon
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
WordInfoTrigger.displayName = 'WordInfoTrigger';
|
|
49
|
+
|
|
50
|
+
export { WordInfoTrigger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
html:has(dialog[open]){overflow:hidden}.WordInfoTrigger-module_wordInfoTrigger__Ef023{background:none;border:none;color:inherit;display:inline-block;font-size:inherit;font-weight:inherit;line-height:inherit;padding:0;position:relative;text-decoration-line:underline;text-decoration-style:dotted;text-decoration-thickness:2px;text-underline-offset:3px}.WordInfoTrigger-module_wordInfoTrigger__Ef023 .WordInfoTrigger-module_icon__Q789Z{fill:var(--semantic-interactive-main);height:var(--size-extra-small);margin-left:2px;min-width:var(--size-extra-small);vertical-align:top!important;width:var(--size-extra-small)}.WordInfoTrigger-module_wordInfoTrigger__Ef023:hover{background-color:var(--semantic-interactive-background);text-decoration:none}.WordInfoTrigger-module_wordInfoTrigger__Ef023:focus-visible{outline:2px solid var(--semantic-interactive-main);text-decoration:none}.WordInfoTrigger-module_wordInfoTrigger__Ef023:active{background-color:var(--semantic-interactive-main);color:var(--palette-graphite-0);text-decoration:none}.WordInfoTrigger-module_wordInfoTrigger__Ef023:active .WordInfoTrigger-module_icon__Q789Z{fill:var(--palette-graphite-0)}.WordInfoTrigger-module_srOnly__FR7qs{clip:rect(0,0,0,0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}
|
package/index.esm.js
CHANGED
|
@@ -3,6 +3,8 @@ export { modalPaddingArr, modalVariantArr } from './Modal/Modal.types.esm.js';
|
|
|
3
3
|
export { Popover } from './Popover/index.esm.js';
|
|
4
4
|
export { popoverColorArr } from './Popover/Popover.types.esm.js';
|
|
5
5
|
export { RolePicker } from './RolePicker/index.esm.js';
|
|
6
|
+
export { WordInfo } from './WordInfo/index.esm.js';
|
|
6
7
|
export { getModalDismissOnEscDefault, getModalDismissOnOutsideClickDefault, getModalPaddingDefault, getModalVariantDefault } from './Modal/defaults.esm.js';
|
|
7
|
-
export { getPopoverColorDefault, getPopoverPositionDefault, getPopoverRestoreFocusDefault } from './Popover/defaults.esm.js';
|
|
8
|
+
export { getPopoverColorDefault, getPopoverContentAsDefault, getPopoverPositionDefault, getPopoverRestoreFocusDefault } from './Popover/defaults.esm.js';
|
|
8
9
|
export { getRolePickerHideCloseButtonDefault, getRolePickerMinimumEntitiesForSearchDefault, getRolePickerShowDeceasedPeopleDefault, getRolePickerShowInactiveBusinessesDefault, getRolePickerShowSubunitsDefault } from './RolePicker/defaults.esm.js';
|
|
10
|
+
export { getWordInfoHasIconDefault } from './WordInfo/defaults.esm.js';
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skatteetaten/ds-overlays",
|
|
3
3
|
"groupId": "no.skatteetaten.aurora",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.3.0",
|
|
5
5
|
"main": "./index.esm.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"module": "./index.esm.js",
|
|
8
|
-
"types": "./index.
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/Skatteetaten/designsystemet.git"
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"i18next": "^24 || ^25",
|
|
17
17
|
"react": "^19 ",
|
|
18
18
|
"react-i18next": "^15",
|
|
19
|
-
"@skatteetaten/ds-core-utils": "2.
|
|
20
|
-
"@skatteetaten/ds-buttons": "2.
|
|
21
|
-
"@skatteetaten/ds-forms": "2.
|
|
22
|
-
"@skatteetaten/ds-icons": "2.
|
|
23
|
-
"@skatteetaten/ds-navigation": "2.
|
|
24
|
-
"@skatteetaten/ds-typography": "2.
|
|
25
|
-
"@skatteetaten/ds-progress": "2.
|
|
26
|
-
"@skatteetaten/ds-status": "2.
|
|
19
|
+
"@skatteetaten/ds-core-utils": "2.3.0",
|
|
20
|
+
"@skatteetaten/ds-buttons": "2.3.0",
|
|
21
|
+
"@skatteetaten/ds-forms": "2.3.0",
|
|
22
|
+
"@skatteetaten/ds-icons": "2.3.0",
|
|
23
|
+
"@skatteetaten/ds-navigation": "2.3.0",
|
|
24
|
+
"@skatteetaten/ds-typography": "2.3.0",
|
|
25
|
+
"@skatteetaten/ds-progress": "2.3.0",
|
|
26
|
+
"@skatteetaten/ds-status": "2.3.0",
|
|
27
27
|
"date-fns": "^4",
|
|
28
|
-
"@skatteetaten/ds-content": "2.
|
|
28
|
+
"@skatteetaten/ds-content": "2.3.0",
|
|
29
29
|
"@floating-ui/react": "0.26.28"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {},
|
package/src/Popover/Popover.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getPopoverColorDefault, getPopoverPositionDefault, getPopoverRestoreFocusDefault } from './defaults';
|
|
1
|
+
import { getPopoverColorDefault, getPopoverContentAsDefault, getPopoverPositionDefault, getPopoverRestoreFocusDefault } from './defaults';
|
|
2
2
|
import { PopoverComponent } from './Popover.types';
|
|
3
3
|
export declare const Popover: PopoverComponent;
|
|
4
|
-
export { getPopoverColorDefault, getPopoverPositionDefault, getPopoverRestoreFocusDefault, };
|
|
4
|
+
export { getPopoverColorDefault, getPopoverPositionDefault, getPopoverRestoreFocusDefault, getPopoverContentAsDefault, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dispatch, FunctionComponent,
|
|
1
|
+
import { Dispatch, FunctionComponent, RefObject, ReactNode, SetStateAction } from 'react';
|
|
2
2
|
import { UseFloatingReturn, useInteractions } from '@floating-ui/react';
|
|
3
3
|
import { positionArr } from '@skatteetaten/ds-core-utils';
|
|
4
4
|
import { PopoverContent } from '../PopoverContent/PopoverContent';
|
|
@@ -17,7 +17,7 @@ export interface PopoverProps {
|
|
|
17
17
|
disableAutoDismissOnMobile?: boolean;
|
|
18
18
|
/** Om Popover er synlig */
|
|
19
19
|
isOpen?: boolean;
|
|
20
|
-
/** Om
|
|
20
|
+
/** Om fokus skal settes tilbake til trigger ved bruk av lukkekrysset. Hvis denne settes til false, så må fokus håndteres manuelt. */
|
|
21
21
|
shouldRestoreFocus?: boolean;
|
|
22
22
|
/** Callback når Popover lukkes */
|
|
23
23
|
onClose?: () => void;
|
|
@@ -29,7 +29,7 @@ export interface PopoverComponent extends FunctionComponent<PopoverProps> {
|
|
|
29
29
|
Trigger: typeof PopoverTrigger;
|
|
30
30
|
}
|
|
31
31
|
export interface PopoverContextProps extends Exclude<PopoverProps, 'children'> {
|
|
32
|
-
arrowRef:
|
|
32
|
+
arrowRef: RefObject<HTMLDivElement | null>;
|
|
33
33
|
floatingData: UseFloatingReturn<HTMLButtonElement>;
|
|
34
34
|
interactions: ReturnType<typeof useInteractions>;
|
|
35
35
|
isOpen: boolean;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PopoverPosition, PopoverColor } from './Popover.types';
|
|
2
|
+
import { PopoverContentAs } from '../PopoverContent/PopoverContent.types';
|
|
2
3
|
export declare const getPopoverColorDefault: () => PopoverColor;
|
|
3
4
|
export declare const getPopoverPositionDefault: () => PopoverPosition;
|
|
4
5
|
export declare const getPopoverRestoreFocusDefault: () => boolean;
|
|
6
|
+
export declare const getPopoverContentAsDefault: () => PopoverContentAs;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
2
|
import { PopoverContentProps } from './PopoverContent.types';
|
|
3
3
|
export declare const PopoverContent: {
|
|
4
|
-
({ ref, id, className, lang, "data-testid": dataTestId, children, }: PopoverContentProps): JSX.Element | null;
|
|
4
|
+
({ ref, id, className, classNames, lang, "data-testid": dataTestId, as: Tag, children, }: PopoverContentProps): JSX.Element | null;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import { ReactNode, Ref } from 'react';
|
|
2
2
|
import { BaseProps } from '@skatteetaten/ds-core-utils';
|
|
3
3
|
export declare const popoverPositionArr: readonly ["top-start", "top-end", "bottom-start", "bottom-end"];
|
|
4
|
+
export declare const popoverContentAsArr: readonly ["div", "span"];
|
|
5
|
+
export type PopoverContentAs = (typeof popoverContentAsArr)[number];
|
|
4
6
|
export type PopoverPosition = (typeof popoverPositionArr)[number];
|
|
5
7
|
export interface PopoverContentProps extends BaseProps {
|
|
6
8
|
ref?: Ref<HTMLDivElement>;
|
|
7
|
-
|
|
9
|
+
classNames?: {
|
|
10
|
+
contentWrapper?: string;
|
|
11
|
+
closeButton?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Innhold i popup-boksen. NB! Hvis as-prop er satt til span, må innholdet være en string eller et HTML-element som er tillatt i en span.
|
|
15
|
+
* Finn ut hvilke elementer som er tillatt i en span: {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Guides/Content_categories#phrasing_content}.
|
|
16
|
+
*/
|
|
8
17
|
children: ReactNode;
|
|
18
|
+
/** HTML-element til innholdet. */
|
|
19
|
+
as?: PopoverContentAs;
|
|
9
20
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import { PopoverPosition, PopoverProps } from '../Popover/Popover.types';
|
|
3
|
+
import { WordInfoContent } from '../WordInfoContent/WordInfoContent';
|
|
4
|
+
import { WordInfoTrigger } from '../WordInfoTrigger/WordInfoTrigger';
|
|
5
|
+
export interface WordInfoProps extends Omit<PopoverProps, 'color' | 'disableAutoDismissOnMobile'> {
|
|
6
|
+
/** Om popup-boksen er synlig */
|
|
7
|
+
isOpen?: boolean;
|
|
8
|
+
/** Callback når popup-boksen lukkes */
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
/** Plassering av popup-boksen i forhold til teksten */
|
|
11
|
+
position?: PopoverPosition;
|
|
12
|
+
/** WordInfo.Trigger og WordInfo.Content */
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export interface WordInfoComponent extends FunctionComponent<WordInfoProps> {
|
|
16
|
+
Content: typeof WordInfoContent;
|
|
17
|
+
Trigger: typeof WordInfoTrigger;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getWordInfoHasIconDefault: () => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { WordInfoContentProps } from './WordInfoContent.types';
|
|
3
|
+
export declare const WordInfoContent: {
|
|
4
|
+
({ ref, id, className, lang, "data-testid": dataTestId, children, }: WordInfoContentProps): JSX.Element | null;
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode, Ref } from 'react';
|
|
2
|
+
import { BaseProps } from '@skatteetaten/ds-core-utils';
|
|
3
|
+
export interface WordInfoContentProps extends BaseProps {
|
|
4
|
+
ref?: Ref<HTMLDivElement>;
|
|
5
|
+
/**
|
|
6
|
+
* Innhold i popup-boksen. Må være string eller et HTML-element som er tillatt i en span.
|
|
7
|
+
* Finn ut hvilke elementer som er tillatt i en span: {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Guides/Content_categories#phrasing_content}.
|
|
8
|
+
*/
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { WordInfoTriggerProps } from './WordInfoTrigger.types';
|
|
3
|
+
export declare const WordInfoTrigger: {
|
|
4
|
+
({ ref, id, className, lang, "data-testid": dataTestId, hasIcon, children, onClick, }: WordInfoTriggerProps): JSX.Element;
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
2
|
+
import { ButtonProps } from '@skatteetaten/ds-buttons';
|
|
3
|
+
import { BaseProps } from '@skatteetaten/ds-core-utils';
|
|
4
|
+
type PropsFromButton = Pick<ButtonProps, 'onClick'>;
|
|
5
|
+
type WordInfoTriggerCommonProps = BaseProps & {
|
|
6
|
+
ref?: Ref<HTMLButtonElement>;
|
|
7
|
+
/** Om bok-ikonet er synlig */
|
|
8
|
+
hasIcon?: boolean;
|
|
9
|
+
/** Tekst som trenger ordforklaring */
|
|
10
|
+
children: string;
|
|
11
|
+
};
|
|
12
|
+
export interface WordInfoTriggerProps extends WordInfoTriggerCommonProps, Partial<PropsFromButton> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
package/src/index.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|