@dnb/eufemia 9.19.0 → 9.20.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/CHANGELOG.md +20 -198
- package/cjs/components/avatar/Avatar.js +14 -12
- package/cjs/components/avatar/AvatarGroup.js +11 -11
- package/cjs/components/avatar/style/_avatar.scss +2 -0
- package/cjs/components/avatar/style/dnb-avatar.css +4 -1
- package/cjs/components/avatar/style/dnb-avatar.min.css +1 -1
- package/cjs/components/breadcrumb/Breadcrumb.js +27 -52
- package/cjs/components/breadcrumb/BreadcrumbItem.js +15 -29
- package/cjs/components/button/Button.d.ts +11 -7
- package/cjs/components/icon-primary/IconPrimary.d.ts +2 -1
- package/cjs/components/info-card/InfoCard.js +22 -22
- package/cjs/components/pagination/Pagination.d.ts +6 -6
- package/cjs/components/pagination/Pagination.js +2 -2
- package/cjs/components/skeleton/Skeleton.d.ts +1 -1
- package/cjs/components/skeleton/SkeletonHelper.d.ts +2 -1
- package/cjs/components/step-indicator/StepIndicatorTriggerButton.js +4 -4
- package/cjs/components/tag/Tag.js +17 -29
- package/cjs/components/tag/TagGroup.js +10 -24
- package/cjs/components/timeline/Timeline.js +24 -64
- package/cjs/components/timeline/TimelineItem.js +16 -29
- package/cjs/elements/Div.d.ts +1 -1
- package/cjs/elements/P.d.ts +2 -1
- package/cjs/shared/AnimateHeight.js +19 -13
- package/cjs/shared/helpers.js +16 -4
- package/cjs/shared/hooks/index.js +13 -0
- package/cjs/shared/hooks/usePropsWithContext.js +92 -0
- package/cjs/style/dnb-ui-components.css +4 -1
- package/cjs/style/dnb-ui-components.min.css +1 -1
- package/cjs/style/dnb-ui-elements.css +1 -3
- package/cjs/style/dnb-ui-elements.min.css +1 -1
- package/cjs/style/dnb-ui-tags.css +2 -6
- package/cjs/style/dnb-ui-tags.min.css +2 -2
- package/cjs/style/elements/code.scss +1 -3
- package/cjs/style/stylis.d.ts +38 -0
- package/cjs/style/themes/theme-open-banking/dnb-theme-open-banking.css +1 -3
- package/cjs/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
- package/cjs/style/themes/theme-ui/dnb-theme-ui.css +1 -3
- package/cjs/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
- package/components/avatar/Avatar.js +14 -13
- package/components/avatar/Avatar.tsx +8 -9
- package/components/avatar/AvatarGroup.js +20 -20
- package/components/avatar/AvatarGroup.tsx +4 -8
- package/components/avatar/style/_avatar.scss +2 -0
- package/components/avatar/style/dnb-avatar.css +4 -1
- package/components/avatar/style/dnb-avatar.min.css +1 -1
- package/components/breadcrumb/Breadcrumb.js +22 -35
- package/components/breadcrumb/Breadcrumb.tsx +10 -10
- package/components/breadcrumb/BreadcrumbItem.js +14 -25
- package/components/breadcrumb/BreadcrumbItem.tsx +8 -11
- package/components/button/Button.d.ts +11 -7
- package/components/icon-primary/IconPrimary.d.ts +2 -1
- package/components/info-card/InfoCard.js +22 -22
- package/components/info-card/InfoCard.tsx +13 -12
- package/components/modal/Modal.tsx +1 -1
- package/components/modal/ModalContent.tsx +6 -2
- package/components/modal/components/ModalHeader.tsx +2 -2
- package/components/modal/types.ts +2 -2
- package/components/pagination/Pagination.d.ts +6 -6
- package/components/pagination/Pagination.js +2 -2
- package/components/skeleton/SkeletonHelper.d.ts +2 -1
- package/components/step-indicator/StepIndicatorTriggerButton.js +4 -4
- package/components/tag/Tag.js +17 -27
- package/components/tag/Tag.tsx +15 -13
- package/components/tag/TagGroup.js +9 -22
- package/components/tag/TagGroup.tsx +6 -10
- package/components/timeline/Timeline.js +23 -27
- package/components/timeline/Timeline.tsx +24 -20
- package/components/timeline/TimelineItem.js +15 -25
- package/components/timeline/TimelineItem.tsx +8 -10
- package/elements/P.d.ts +2 -1
- package/es/components/avatar/Avatar.js +7 -6
- package/es/components/avatar/Avatar.tsx +8 -9
- package/es/components/avatar/AvatarGroup.js +6 -6
- package/es/components/avatar/AvatarGroup.tsx +4 -8
- package/es/components/avatar/style/_avatar.scss +2 -0
- package/es/components/avatar/style/dnb-avatar.css +4 -1
- package/es/components/avatar/style/dnb-avatar.min.css +1 -1
- package/es/components/breadcrumb/Breadcrumb.js +8 -14
- package/es/components/breadcrumb/Breadcrumb.tsx +10 -10
- package/es/components/breadcrumb/BreadcrumbItem.js +9 -13
- package/es/components/breadcrumb/BreadcrumbItem.tsx +8 -11
- package/es/components/button/Button.d.ts +11 -7
- package/es/components/icon-primary/IconPrimary.d.ts +2 -1
- package/es/components/info-card/InfoCard.js +8 -8
- package/es/components/info-card/InfoCard.tsx +13 -12
- package/es/components/modal/Modal.tsx +1 -1
- package/es/components/modal/ModalContent.tsx +6 -2
- package/es/components/modal/components/ModalHeader.tsx +2 -2
- package/es/components/modal/types.ts +2 -2
- package/es/components/pagination/Pagination.d.ts +6 -6
- package/es/components/pagination/Pagination.js +2 -2
- package/es/components/skeleton/Skeleton.d.ts +1 -1
- package/es/components/skeleton/SkeletonHelper.d.ts +2 -1
- package/es/components/step-indicator/StepIndicatorTriggerButton.js +4 -4
- package/es/components/tag/Tag.js +11 -14
- package/es/components/tag/Tag.tsx +15 -13
- package/es/components/tag/TagGroup.js +7 -13
- package/es/components/tag/TagGroup.tsx +6 -10
- package/es/components/timeline/Timeline.js +21 -17
- package/es/components/timeline/Timeline.tsx +24 -20
- package/es/components/timeline/TimelineItem.js +9 -12
- package/es/components/timeline/TimelineItem.tsx +8 -10
- package/es/elements/Div.d.ts +1 -1
- package/es/elements/P.d.ts +2 -1
- package/es/shared/AnimateHeight.js +15 -13
- package/es/shared/helpers.js +9 -2
- package/es/shared/hooks/index.js +1 -0
- package/es/shared/hooks/index.ts +1 -0
- package/es/shared/hooks/usePropsWithContext.js +26 -0
- package/es/shared/hooks/usePropsWithContext.ts +45 -0
- package/es/shared/interfaces.tsx +0 -2
- package/es/style/dnb-ui-components.css +4 -1
- package/es/style/dnb-ui-components.min.css +1 -1
- package/es/style/dnb-ui-elements.css +1 -3
- package/es/style/dnb-ui-elements.min.css +1 -1
- package/es/style/dnb-ui-tags.css +2 -6
- package/es/style/dnb-ui-tags.min.css +2 -2
- package/es/style/elements/code.scss +1 -3
- package/es/style/stylis.d.ts +38 -0
- package/es/style/themes/theme-open-banking/dnb-theme-open-banking.css +1 -3
- package/es/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
- package/es/style/themes/theme-ui/dnb-theme-ui.css +1 -3
- package/es/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
- package/esm/components/avatar/Avatar.js +14 -13
- package/esm/components/avatar/Avatar.tsx +8 -9
- package/esm/components/avatar/AvatarGroup.js +20 -20
- package/esm/components/avatar/AvatarGroup.tsx +4 -8
- package/esm/components/avatar/style/_avatar.scss +2 -0
- package/esm/components/avatar/style/dnb-avatar.css +4 -1
- package/esm/components/avatar/style/dnb-avatar.min.css +1 -1
- package/esm/components/breadcrumb/Breadcrumb.js +22 -35
- package/esm/components/breadcrumb/Breadcrumb.tsx +10 -10
- package/esm/components/breadcrumb/BreadcrumbItem.js +14 -25
- package/esm/components/breadcrumb/BreadcrumbItem.tsx +8 -11
- package/esm/components/button/Button.d.ts +11 -7
- package/esm/components/icon-primary/IconPrimary.d.ts +2 -1
- package/esm/components/info-card/InfoCard.js +22 -22
- package/esm/components/info-card/InfoCard.tsx +13 -12
- package/esm/components/modal/Modal.tsx +1 -1
- package/esm/components/modal/ModalContent.tsx +6 -2
- package/esm/components/modal/components/ModalHeader.tsx +2 -2
- package/esm/components/modal/types.ts +2 -2
- package/esm/components/pagination/Pagination.d.ts +6 -6
- package/esm/components/pagination/Pagination.js +2 -2
- package/esm/components/skeleton/SkeletonHelper.d.ts +2 -1
- package/esm/components/step-indicator/StepIndicatorTriggerButton.js +4 -4
- package/esm/components/tag/Tag.js +17 -27
- package/esm/components/tag/Tag.tsx +15 -13
- package/esm/components/tag/TagGroup.js +9 -22
- package/esm/components/tag/TagGroup.tsx +6 -10
- package/esm/components/timeline/Timeline.js +23 -27
- package/esm/components/timeline/Timeline.tsx +24 -20
- package/esm/components/timeline/TimelineItem.js +15 -25
- package/esm/components/timeline/TimelineItem.tsx +8 -10
- package/esm/dnb-ui-components.min.mjs +3 -3
- package/esm/dnb-ui-lib.min.mjs +3 -3
- package/esm/dnb-ui-web-components.min.mjs +4 -4
- package/esm/elements/P.d.ts +2 -1
- package/esm/shared/AnimateHeight.js +19 -13
- package/esm/shared/helpers.js +15 -4
- package/esm/shared/hooks/index.js +1 -0
- package/esm/shared/hooks/index.ts +1 -0
- package/esm/shared/hooks/usePropsWithContext.js +47 -0
- package/esm/shared/hooks/usePropsWithContext.ts +45 -0
- package/esm/shared/interfaces.tsx +0 -2
- package/esm/style/dnb-ui-components.css +4 -1
- package/esm/style/dnb-ui-components.min.css +1 -1
- package/esm/style/dnb-ui-elements.css +1 -3
- package/esm/style/dnb-ui-elements.min.css +1 -1
- package/esm/style/dnb-ui-tags.css +2 -6
- package/esm/style/dnb-ui-tags.min.css +2 -2
- package/esm/style/elements/code.scss +1 -3
- package/esm/style/stylis.d.ts +38 -0
- package/esm/style/themes/theme-open-banking/dnb-theme-open-banking.css +1 -3
- package/esm/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
- package/esm/style/themes/theme-ui/dnb-theme-ui.css +1 -3
- package/esm/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
- package/package.json +1 -1
- package/shared/AnimateHeight.js +19 -13
- package/shared/helpers.js +15 -4
- package/shared/hooks/index.js +1 -0
- package/shared/hooks/index.ts +1 -0
- package/shared/hooks/usePropsWithContext.js +47 -0
- package/shared/hooks/usePropsWithContext.ts +45 -0
- package/shared/interfaces.tsx +0 -2
- package/style/dnb-ui-components.css +4 -1
- package/style/dnb-ui-components.min.css +1 -1
- package/style/dnb-ui-elements.css +1 -3
- package/style/dnb-ui-elements.min.css +1 -1
- package/style/dnb-ui-tags.css +2 -6
- package/style/dnb-ui-tags.min.css +2 -2
- package/style/elements/code.scss +1 -3
- package/style/stylis.d.ts +38 -0
- package/style/themes/theme-open-banking/dnb-theme-open-banking.css +1 -3
- package/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
- package/style/themes/theme-ui/dnb-theme-ui.css +1 -3
- package/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
- package/umd/dnb-ui-components.min.js +3 -3
- package/umd/dnb-ui-lib.min.js +4 -4
- package/umd/dnb-ui-web-components.min.js +3 -3
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { SkeletonShow } from '../skeleton/Skeleton';
|
|
3
|
+
import { IconPrimaryIcon } from '../icon-primary/IconPrimary';
|
|
2
4
|
export type ButtonText = string | React.ReactNode;
|
|
3
5
|
export type ButtonVariant =
|
|
4
6
|
| 'primary'
|
|
5
7
|
| 'secondary'
|
|
6
8
|
| 'tertiary'
|
|
7
|
-
| 'signal'
|
|
9
|
+
| 'signal'
|
|
10
|
+
| 'unstyled';
|
|
8
11
|
export type ButtonSize = 'default' | 'small' | 'medium' | 'large';
|
|
9
|
-
export type ButtonIcon =
|
|
10
|
-
| string
|
|
11
|
-
| React.ReactNode
|
|
12
|
-
| ((...args: any[]) => any);
|
|
12
|
+
export type ButtonIcon = IconPrimaryIcon;
|
|
13
13
|
export type ButtonIconPosition = 'left' | 'right' | 'top';
|
|
14
14
|
export type ButtonIconSize = string | number;
|
|
15
15
|
export type ButtonTooltip =
|
|
@@ -26,7 +26,7 @@ export type ButtonTo = string | any | ((...args: any[]) => any);
|
|
|
26
26
|
export type ButtonWrap = string | boolean;
|
|
27
27
|
export type ButtonBounding = string | boolean;
|
|
28
28
|
export type ButtonStretch = string | boolean;
|
|
29
|
-
export type ButtonSkeleton =
|
|
29
|
+
export type ButtonSkeleton = SkeletonShow;
|
|
30
30
|
export type ButtonDisabled = string | boolean;
|
|
31
31
|
export type ButtonChildren =
|
|
32
32
|
| string
|
|
@@ -70,7 +70,11 @@ export type ButtonOnClick = string | ((...args: any[]) => any);
|
|
|
70
70
|
* NB: Do not change the docs (comments) in here. The docs are updated during build time by "generateTypes.js" and "fetchPropertiesFromDocs.js".
|
|
71
71
|
*/
|
|
72
72
|
|
|
73
|
-
export interface ButtonProps
|
|
73
|
+
export interface ButtonProps
|
|
74
|
+
extends Omit<
|
|
75
|
+
React.HTMLProps<HTMLElement>,
|
|
76
|
+
'disabled' | 'size' | 'title' | 'wrap'
|
|
77
|
+
> {
|
|
74
78
|
/**
|
|
75
79
|
* The content of the button can be a string or a React Element.
|
|
76
80
|
*/
|
|
@@ -53,7 +53,8 @@ export type IconPrimaryChildren =
|
|
|
53
53
|
* NB: Do not change the docs (comments) in here. The docs are updated during build time by "generateTypes.js" and "fetchPropertiesFromDocs.js".
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
|
-
export interface IconPrimaryProps
|
|
56
|
+
export interface IconPrimaryProps
|
|
57
|
+
extends Omit<React.HTMLProps<HTMLElement>, 'size'> {
|
|
57
58
|
/**
|
|
58
59
|
* <em>(required)</em> a React SVG Component or the icon name (in case we use `IconPrimary` or `dnb-icon-primary`).
|
|
59
60
|
*/
|
|
@@ -19,7 +19,7 @@ import { lightbulb_medium as LightbulbIcon } from '../../icons';
|
|
|
19
19
|
import { createSpacingClasses } from '../space/SpacingHelper';
|
|
20
20
|
import { createSkeletonClass } from '../skeleton/SkeletonHelper';
|
|
21
21
|
import Context from '../../shared/Context';
|
|
22
|
-
import {
|
|
22
|
+
import { usePropsWithContext } from '../../shared/hooks';
|
|
23
23
|
export const defaultProps = {
|
|
24
24
|
alt: null,
|
|
25
25
|
centered: false,
|
|
@@ -37,12 +37,12 @@ export const defaultProps = {
|
|
|
37
37
|
acceptButtonAttributes: null
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
const InfoCard = localProps => {
|
|
41
41
|
var _IconPrimary;
|
|
42
42
|
|
|
43
43
|
const context = React.useContext(Context);
|
|
44
44
|
|
|
45
|
-
const
|
|
45
|
+
const _usePropsWithContext = usePropsWithContext(_objectSpread(_objectSpread({}, defaultProps), localProps)),
|
|
46
46
|
{
|
|
47
47
|
alt,
|
|
48
48
|
centered,
|
|
@@ -59,8 +59,8 @@ function InfoCard(localProps) {
|
|
|
59
59
|
acceptButtonText,
|
|
60
60
|
closeButtonAttributes,
|
|
61
61
|
acceptButtonAttributes
|
|
62
|
-
} =
|
|
63
|
-
props = _objectWithoutProperties(
|
|
62
|
+
} = _usePropsWithContext,
|
|
63
|
+
props = _objectWithoutProperties(_usePropsWithContext, _excluded);
|
|
64
64
|
|
|
65
65
|
const skeletonClasses = createSkeletonClass('shape', skeleton, context);
|
|
66
66
|
const spacingClasses = createSpacingClasses(props);
|
|
@@ -93,14 +93,14 @@ function InfoCard(localProps) {
|
|
|
93
93
|
className: 'dnb-info-card--buttons' + (centered ? " dnb-info-card--buttons-centered" : "")
|
|
94
94
|
}, !acceptButtonIsHidden && React.createElement(Button, _extends({
|
|
95
95
|
type: "button",
|
|
96
|
-
"data-testid": "
|
|
96
|
+
"data-testid": "info-card-accept-button",
|
|
97
97
|
variant: "secondary",
|
|
98
98
|
right: !centered && 'small',
|
|
99
99
|
on_click: onAccept,
|
|
100
100
|
text: acceptButtonText
|
|
101
101
|
}, acceptButtonAttributes)), !closeButtonIsHidden && React.createElement(Button, _extends({
|
|
102
102
|
type: "button",
|
|
103
|
-
"data-testid": "
|
|
103
|
+
"data-testid": "info-card-close-button",
|
|
104
104
|
variant: "tertiary",
|
|
105
105
|
top: centered && 'small',
|
|
106
106
|
on_click: onClose,
|
|
@@ -130,6 +130,6 @@ function InfoCard(localProps) {
|
|
|
130
130
|
"data-testid": "info-card-icon"
|
|
131
131
|
}));
|
|
132
132
|
}
|
|
133
|
-
}
|
|
133
|
+
};
|
|
134
134
|
|
|
135
135
|
export default InfoCard;
|
|
@@ -15,16 +15,17 @@ import { lightbulb_medium as LightbulbIcon } from '../../icons'
|
|
|
15
15
|
// Shared
|
|
16
16
|
import { createSpacingClasses } from '../space/SpacingHelper'
|
|
17
17
|
import { createSkeletonClass } from '../skeleton/SkeletonHelper'
|
|
18
|
+
import { SkeletonShow } from '../skeleton/Skeleton'
|
|
18
19
|
import Context from '../../shared/Context'
|
|
19
|
-
import { ISpacingProps
|
|
20
|
-
import {
|
|
20
|
+
import { ISpacingProps } from '../../shared/interfaces'
|
|
21
|
+
import { usePropsWithContext } from '../../shared/hooks'
|
|
21
22
|
|
|
22
23
|
export interface InfoCardProps {
|
|
23
24
|
/**
|
|
24
25
|
* Used in combination with `src` to provide an alt attribute for the `img` element.
|
|
25
26
|
* Default: null
|
|
26
27
|
*/
|
|
27
|
-
alt?:
|
|
28
|
+
alt?: React.ReactNode
|
|
28
29
|
/**
|
|
29
30
|
* Aligns the content to center, rather than left
|
|
30
31
|
* Default: false
|
|
@@ -49,7 +50,7 @@ export interface InfoCardProps {
|
|
|
49
50
|
* Skeleton should be applied when loading content
|
|
50
51
|
* Default: null
|
|
51
52
|
*/
|
|
52
|
-
skeleton?:
|
|
53
|
+
skeleton?: SkeletonShow
|
|
53
54
|
/**
|
|
54
55
|
* Specifies the path to the image
|
|
55
56
|
* Default: null
|
|
@@ -59,12 +60,12 @@ export interface InfoCardProps {
|
|
|
59
60
|
* Image src, will replace the 'icon' with the image
|
|
60
61
|
* Default: null
|
|
61
62
|
*/
|
|
62
|
-
text:
|
|
63
|
+
text: React.ReactNode
|
|
63
64
|
/**
|
|
64
65
|
* Component title
|
|
65
66
|
* Default: null
|
|
66
67
|
*/
|
|
67
|
-
title?:
|
|
68
|
+
title?: React.ReactNode
|
|
68
69
|
/**
|
|
69
70
|
* Is called when the close button is clicked
|
|
70
71
|
* Default: null
|
|
@@ -74,7 +75,7 @@ export interface InfoCardProps {
|
|
|
74
75
|
* The text of the close button.
|
|
75
76
|
* Default: null
|
|
76
77
|
*/
|
|
77
|
-
closeButtonText?:
|
|
78
|
+
closeButtonText?: React.ReactNode
|
|
78
79
|
/**
|
|
79
80
|
* Is called when the accept button is clicked
|
|
80
81
|
* Default: null
|
|
@@ -84,7 +85,7 @@ export interface InfoCardProps {
|
|
|
84
85
|
* The text of the accept button.
|
|
85
86
|
* Default: null
|
|
86
87
|
*/
|
|
87
|
-
acceptButtonText?:
|
|
88
|
+
acceptButtonText?: React.ReactNode
|
|
88
89
|
/**
|
|
89
90
|
* Additional attributes for the close button.
|
|
90
91
|
* Default: null
|
|
@@ -114,7 +115,7 @@ export const defaultProps = {
|
|
|
114
115
|
acceptButtonAttributes: null,
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
|
|
118
|
+
const InfoCard = (localProps: InfoCardProps & ISpacingProps) => {
|
|
118
119
|
// Every component should have a context
|
|
119
120
|
const context = React.useContext(Context)
|
|
120
121
|
// Extract additional props from global context
|
|
@@ -135,7 +136,7 @@ function InfoCard(localProps: InfoCardProps & ISpacingProps) {
|
|
|
135
136
|
closeButtonAttributes,
|
|
136
137
|
acceptButtonAttributes,
|
|
137
138
|
...props
|
|
138
|
-
} =
|
|
139
|
+
} = usePropsWithContext({
|
|
139
140
|
...defaultProps,
|
|
140
141
|
...localProps,
|
|
141
142
|
})
|
|
@@ -199,7 +200,7 @@ function InfoCard(localProps: InfoCardProps & ISpacingProps) {
|
|
|
199
200
|
{!acceptButtonIsHidden && (
|
|
200
201
|
<Button
|
|
201
202
|
type="button"
|
|
202
|
-
data-testid="
|
|
203
|
+
data-testid="info-card-accept-button"
|
|
203
204
|
variant="secondary"
|
|
204
205
|
right={!centered && 'small'}
|
|
205
206
|
on_click={onAccept}
|
|
@@ -210,7 +211,7 @@ function InfoCard(localProps: InfoCardProps & ISpacingProps) {
|
|
|
210
211
|
{!closeButtonIsHidden && (
|
|
211
212
|
<Button
|
|
212
213
|
type="button"
|
|
213
|
-
data-testid="
|
|
214
|
+
data-testid="info-card-close-button"
|
|
214
215
|
variant="tertiary"
|
|
215
216
|
top={centered && 'small'}
|
|
216
217
|
on_click={onClose}
|
|
@@ -25,7 +25,7 @@ import ModalHeader from './components/ModalHeader'
|
|
|
25
25
|
import ModalHeaderBar from './components/ModalHeaderBar'
|
|
26
26
|
import CloseButton from './components/CloseButton'
|
|
27
27
|
import ModalRoot from './ModalRoot'
|
|
28
|
-
import { ISpacingProps } from '
|
|
28
|
+
import { ISpacingProps } from '../../shared/interfaces'
|
|
29
29
|
|
|
30
30
|
export const ANIMATION_DURATION = 300
|
|
31
31
|
|
|
@@ -47,6 +47,10 @@ declare global {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
interface CSSPropertiesWithVars extends React.CSSProperties {
|
|
51
|
+
'--modal-background-color': string
|
|
52
|
+
}
|
|
53
|
+
|
|
50
54
|
export default class ModalContent extends React.PureComponent<
|
|
51
55
|
ModalContentProps,
|
|
52
56
|
ModalContentState
|
|
@@ -476,9 +480,9 @@ export default class ModalContent extends React.PureComponent<
|
|
|
476
480
|
tabIndex={-1}
|
|
477
481
|
className="dnb-modal__content__spacing dnb-no-focus"
|
|
478
482
|
style={
|
|
479
|
-
color
|
|
483
|
+
(color
|
|
480
484
|
? { '--modal-background-color': `var(--color-${color})` }
|
|
481
|
-
: null
|
|
485
|
+
: null) as CSSPropertiesWithVars
|
|
482
486
|
}
|
|
483
487
|
ref={this._contentRef}
|
|
484
488
|
>
|
|
@@ -21,7 +21,7 @@ interface ModalHeaderProps {
|
|
|
21
21
|
/**
|
|
22
22
|
* The modal/drawer title. Displays on the very top of the content.
|
|
23
23
|
*/
|
|
24
|
-
title?: React.ReactNode
|
|
24
|
+
title?: React.ReactNode
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Give the inner content wrapper a class name (maps to `dnb-modal__content__inner`).
|
|
@@ -30,7 +30,7 @@ interface ModalHeaderProps {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export default class ModalHeader extends React.PureComponent<
|
|
33
|
-
ModalHeaderProps & SectionProps
|
|
33
|
+
ModalHeaderProps & Omit<SectionProps, 'title'>
|
|
34
34
|
> {
|
|
35
35
|
static contextType = ModalContext
|
|
36
36
|
render() {
|
|
@@ -180,7 +180,7 @@ export interface ModalContentProps {
|
|
|
180
180
|
/**
|
|
181
181
|
* The modal/drawer title. Displays on the very top of the content.
|
|
182
182
|
*/
|
|
183
|
-
title?: React.ReactNode
|
|
183
|
+
title?: React.ReactNode
|
|
184
184
|
|
|
185
185
|
dialog_title?: string
|
|
186
186
|
|
|
@@ -255,7 +255,7 @@ export interface ModalContentProps {
|
|
|
255
255
|
*/
|
|
256
256
|
overlay_class?: string
|
|
257
257
|
|
|
258
|
-
closeModal
|
|
258
|
+
closeModal?: (...args: any[]) => any
|
|
259
259
|
|
|
260
260
|
/**
|
|
261
261
|
* Give the inner content wrapper a class name (maps to `dnb-modal__content__inner`).
|
|
@@ -128,7 +128,7 @@ export interface PaginationProps extends React.HTMLProps<HTMLElement> {
|
|
|
128
128
|
skeleton?: PaginationSkeleton;
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
|
-
* If set to `infinity`, then the pagination bar will be now shown and but infinity scrolling will do the content presentation. Defaults to `pagination`.
|
|
131
|
+
* If set to `infinity`, then the pagination bar will be now shown and but infinity scrolling will do the content presentation. For more information, check out the <a href="https://eufemia.dnb.no/uilib/components/pagination/infinity-scroller">Infinity Scroller</a>. Defaults to `pagination`.
|
|
132
132
|
*/
|
|
133
133
|
mode?: PaginationMode;
|
|
134
134
|
|
|
@@ -214,7 +214,7 @@ export interface PaginationProps extends React.HTMLProps<HTMLElement> {
|
|
|
214
214
|
is_loading_text?: string;
|
|
215
215
|
|
|
216
216
|
/**
|
|
217
|
-
* Used during infinity mode. If `use_load_button` is set to true, then a button is show on the bottom. If the `startup_page` is higher than 1
|
|
217
|
+
* Used during infinity mode. If `use_load_button` is set to true, then a button is show on the bottom. If the `startup_page` is higher than 1. Defaults to `Vis mer innhold`.
|
|
218
218
|
*/
|
|
219
219
|
load_button_text?: string;
|
|
220
220
|
|
|
@@ -406,7 +406,7 @@ export interface PaginationInstanceProps {
|
|
|
406
406
|
skeleton?: PaginationInstanceSkeleton;
|
|
407
407
|
|
|
408
408
|
/**
|
|
409
|
-
* If set to `infinity`, then the pagination bar will be now shown and but infinity scrolling will do the content presentation. Defaults to `pagination`.
|
|
409
|
+
* If set to `infinity`, then the pagination bar will be now shown and but infinity scrolling will do the content presentation. For more information, check out the <a href="https://eufemia.dnb.no/uilib/components/pagination/infinity-scroller">Infinity Scroller</a>. Defaults to `pagination`.
|
|
410
410
|
*/
|
|
411
411
|
mode?: PaginationInstanceMode;
|
|
412
412
|
|
|
@@ -492,7 +492,7 @@ export interface PaginationInstanceProps {
|
|
|
492
492
|
is_loading_text?: string;
|
|
493
493
|
|
|
494
494
|
/**
|
|
495
|
-
* Used during infinity mode. If `use_load_button` is set to true, then a button is show on the bottom. If the `startup_page` is higher than 1
|
|
495
|
+
* Used during infinity mode. If `use_load_button` is set to true, then a button is show on the bottom. If the `startup_page` is higher than 1. Defaults to `Vis mer innhold`.
|
|
496
496
|
*/
|
|
497
497
|
load_button_text?: string;
|
|
498
498
|
|
|
@@ -686,7 +686,7 @@ export interface InfinityMarkerProps {
|
|
|
686
686
|
skeleton?: InfinityMarkerSkeleton;
|
|
687
687
|
|
|
688
688
|
/**
|
|
689
|
-
* If set to `infinity`, then the pagination bar will be now shown and but infinity scrolling will do the content presentation. Defaults to `pagination`.
|
|
689
|
+
* If set to `infinity`, then the pagination bar will be now shown and but infinity scrolling will do the content presentation. For more information, check out the <a href="https://eufemia.dnb.no/uilib/components/pagination/infinity-scroller">Infinity Scroller</a>. Defaults to `pagination`.
|
|
690
690
|
*/
|
|
691
691
|
mode?: InfinityMarkerMode;
|
|
692
692
|
|
|
@@ -772,7 +772,7 @@ export interface InfinityMarkerProps {
|
|
|
772
772
|
is_loading_text?: string;
|
|
773
773
|
|
|
774
774
|
/**
|
|
775
|
-
* Used during infinity mode. If `use_load_button` is set to true, then a button is show on the bottom. If the `startup_page` is higher than 1
|
|
775
|
+
* Used during infinity mode. If `use_load_button` is set to true, then a button is show on the bottom. If the `startup_page` is higher than 1. Defaults to `Vis mer innhold`.
|
|
776
776
|
*/
|
|
777
777
|
load_button_text?: string;
|
|
778
778
|
|
|
@@ -161,13 +161,13 @@ class PaginationInstance extends React.PureComponent {
|
|
|
161
161
|
const content = (_items$find = items.find(({
|
|
162
162
|
pageNumber
|
|
163
163
|
}) => pageNumber === currentPage)) === null || _items$find === void 0 ? void 0 : _items$find.content;
|
|
164
|
-
return React.createElement(
|
|
164
|
+
return React.createElement("div", mainParams, React.createElement(PaginationBar, {
|
|
165
165
|
contentRef: this._contentRef
|
|
166
166
|
}, children), items.length > 0 && React.createElement(PaginationContent, {
|
|
167
167
|
ref: this._contentRef
|
|
168
168
|
}, content || React.createElement(PaginationIndicator, {
|
|
169
169
|
indicator_element: indicator_element || fallback_element
|
|
170
|
-
})))
|
|
170
|
+
})));
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
return _InfinityScroller || (_InfinityScroller = React.createElement(InfinityScroller, null));
|
|
@@ -39,10 +39,10 @@ export type SkeletonChildren =
|
|
|
39
39
|
| string
|
|
40
40
|
| ((...args: any[]) => any)
|
|
41
41
|
| React.ReactNode;
|
|
42
|
-
|
|
43
42
|
/**
|
|
44
43
|
* NB: Do not change the docs (comments) in here. The docs are updated during build time by "generateTypes.js" and "fetchPropertiesFromDocs.js".
|
|
45
44
|
*/
|
|
45
|
+
|
|
46
46
|
export interface SkeletonProps extends React.HTMLProps<HTMLElement> {
|
|
47
47
|
/**
|
|
48
48
|
* Use `true` to enable/show the skeleton for the component used inside. Defaults to `false`.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { SkeletonShow } from './Skeleton';
|
|
2
3
|
export interface AutoSizeProps {
|
|
3
4
|
__element?: React.ReactNode;
|
|
4
5
|
children?: React.ReactNode;
|
|
@@ -20,7 +21,7 @@ export interface SkeletonContextProps {
|
|
|
20
21
|
}
|
|
21
22
|
export const createSkeletonClass: (
|
|
22
23
|
method: 'shape' | 'font',
|
|
23
|
-
skeleton:
|
|
24
|
+
skeleton: SkeletonShow,
|
|
24
25
|
context?: SkeletonContextProps
|
|
25
26
|
) => React.HTMLProps<HTMLElement>;
|
|
26
27
|
export interface skeletonDOMAttributesContext {
|
|
@@ -32,6 +32,8 @@ export default class StepIndicatorTriggerButton extends React.PureComponent {
|
|
|
32
32
|
|
|
33
33
|
componentDidMount() {
|
|
34
34
|
this._heightAnim.setElement(this._buttonRef.current);
|
|
35
|
+
|
|
36
|
+
this._prevStep = this.context.activeStep;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
componentWillUnmount() {
|
|
@@ -42,12 +44,10 @@ export default class StepIndicatorTriggerButton extends React.PureComponent {
|
|
|
42
44
|
if (this._prevStep !== this.context.activeStep) {
|
|
43
45
|
const toHeight = this._heightAnim.getUnknownHeight();
|
|
44
46
|
|
|
45
|
-
this._heightAnim.adjustFrom(height);
|
|
46
|
-
|
|
47
47
|
this._heightAnim.adjustTo(height, toHeight);
|
|
48
|
-
}
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
this._prevStep = this.context.activeStep;
|
|
50
|
+
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
render() {
|
package/es/components/tag/Tag.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
3
|
|
|
5
4
|
var _IconPrimary;
|
|
6
5
|
|
|
7
6
|
const _excluded = ["className", "skeleton", "children", "text", "onClick", "onDelete", "omitOnKeyUpDeleteEvent"];
|
|
8
|
-
|
|
9
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
-
|
|
11
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
12
|
-
|
|
13
7
|
import React from 'react';
|
|
14
8
|
import classnames from 'classnames';
|
|
15
9
|
import IconPrimary from '../icon-primary/IconPrimary';
|
|
16
10
|
import Button from '../button/Button';
|
|
17
11
|
import Context from '../../shared/Context';
|
|
18
|
-
import { warn
|
|
12
|
+
import { warn } from '../../shared/component-helper';
|
|
13
|
+
import { usePropsWithContext } from '../../shared/hooks';
|
|
19
14
|
import TagGroup from './TagGroup';
|
|
20
15
|
import { TagGroupContext } from './TagContext';
|
|
21
16
|
export const defaultProps = {
|
|
@@ -35,7 +30,7 @@ const Tag = localProps => {
|
|
|
35
30
|
const context = React.useContext(Context);
|
|
36
31
|
const tagGroupContext = React.useContext(TagGroupContext);
|
|
37
32
|
|
|
38
|
-
const
|
|
33
|
+
const _usePropsWithContext = usePropsWithContext(localProps, defaultProps, context === null || context === void 0 ? void 0 : (_context$translation = context.translation) === null || _context$translation === void 0 ? void 0 : _context$translation.Tag, context === null || context === void 0 ? void 0 : context.Tag, tagGroupContext),
|
|
39
34
|
{
|
|
40
35
|
className,
|
|
41
36
|
skeleton,
|
|
@@ -44,8 +39,8 @@ const Tag = localProps => {
|
|
|
44
39
|
onClick,
|
|
45
40
|
onDelete,
|
|
46
41
|
omitOnKeyUpDeleteEvent
|
|
47
|
-
} =
|
|
48
|
-
props = _objectWithoutProperties(
|
|
42
|
+
} = _usePropsWithContext,
|
|
43
|
+
props = _objectWithoutProperties(_usePropsWithContext, _excluded);
|
|
49
44
|
|
|
50
45
|
const content = text || children;
|
|
51
46
|
const isClickable = !!onClick;
|
|
@@ -63,13 +58,15 @@ const Tag = localProps => {
|
|
|
63
58
|
}
|
|
64
59
|
};
|
|
65
60
|
|
|
61
|
+
const buttonAttr = props;
|
|
62
|
+
|
|
66
63
|
if (!isInteractive) {
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
buttonAttr.element = 'span';
|
|
65
|
+
buttonAttr.type = '';
|
|
69
66
|
}
|
|
70
67
|
|
|
71
68
|
if (isRemovable) {
|
|
72
|
-
|
|
69
|
+
buttonAttr.icon = getDeleteIcon();
|
|
73
70
|
}
|
|
74
71
|
|
|
75
72
|
if (!tagGroupContext) {
|
|
@@ -86,7 +83,7 @@ const Tag = localProps => {
|
|
|
86
83
|
text: content,
|
|
87
84
|
skeleton: skeleton,
|
|
88
85
|
onKeyUp: isRemovable && !omitOnKeyUpDeleteEvent ? e => handleKeyUp(e) : undefined
|
|
89
|
-
},
|
|
86
|
+
}, buttonAttr));
|
|
90
87
|
|
|
91
88
|
function getDeleteIcon() {
|
|
92
89
|
return _IconPrimary || (_IconPrimary = React.createElement(IconPrimary, {
|
|
@@ -3,15 +3,14 @@ import classnames from 'classnames'
|
|
|
3
3
|
|
|
4
4
|
// Components
|
|
5
5
|
import IconPrimary, { IconPrimaryIcon } from '../icon-primary/IconPrimary'
|
|
6
|
-
import Button from '../button/Button'
|
|
6
|
+
import Button, { ButtonProps } from '../button/Button'
|
|
7
7
|
|
|
8
8
|
// Shared
|
|
9
9
|
import Context from '../../shared/Context'
|
|
10
|
-
import { ISpacingProps
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from '../../shared/component-helper'
|
|
10
|
+
import { ISpacingProps } from '../../shared/interfaces'
|
|
11
|
+
import { SkeletonShow } from '../skeleton/Skeleton'
|
|
12
|
+
import { warn } from '../../shared/component-helper'
|
|
13
|
+
import { usePropsWithContext } from '../../shared/hooks'
|
|
15
14
|
|
|
16
15
|
// Internal
|
|
17
16
|
import TagGroup from './TagGroup'
|
|
@@ -40,7 +39,7 @@ export interface TagProps {
|
|
|
40
39
|
* Skeleton should be applied when loading content
|
|
41
40
|
* Default: null
|
|
42
41
|
*/
|
|
43
|
-
skeleton?:
|
|
42
|
+
skeleton?: SkeletonShow
|
|
44
43
|
|
|
45
44
|
/**
|
|
46
45
|
* The content of the tag element, can be a string or a React Element. Will be overwritten by text prop
|
|
@@ -93,8 +92,8 @@ const Tag = (localProps: TagProps & ISpacingProps) => {
|
|
|
93
92
|
onDelete,
|
|
94
93
|
omitOnKeyUpDeleteEvent,
|
|
95
94
|
...props
|
|
96
|
-
} =
|
|
97
|
-
|
|
95
|
+
} = usePropsWithContext(
|
|
96
|
+
localProps,
|
|
98
97
|
defaultProps,
|
|
99
98
|
context?.translation?.Tag,
|
|
100
99
|
context?.Tag,
|
|
@@ -125,13 +124,16 @@ const Tag = (localProps: TagProps & ISpacingProps) => {
|
|
|
125
124
|
}
|
|
126
125
|
}
|
|
127
126
|
|
|
127
|
+
const buttonAttr: typeof props & Pick<ButtonProps, 'element' | 'type'> =
|
|
128
|
+
props
|
|
129
|
+
|
|
128
130
|
if (!isInteractive) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
buttonAttr.element = 'span'
|
|
132
|
+
buttonAttr.type = ''
|
|
131
133
|
}
|
|
132
134
|
|
|
133
135
|
if (isRemovable) {
|
|
134
|
-
|
|
136
|
+
buttonAttr.icon = getDeleteIcon()
|
|
135
137
|
}
|
|
136
138
|
|
|
137
139
|
if (!tagGroupContext) {
|
|
@@ -155,7 +157,7 @@ const Tag = (localProps: TagProps & ISpacingProps) => {
|
|
|
155
157
|
? (e) => handleKeyUp(e)
|
|
156
158
|
: undefined
|
|
157
159
|
}
|
|
158
|
-
{...
|
|
160
|
+
{...buttonAttr}
|
|
159
161
|
/>
|
|
160
162
|
)
|
|
161
163
|
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
3
|
const _excluded = ["label", "className", "children"];
|
|
5
|
-
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
-
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
|
-
|
|
10
4
|
import React from 'react';
|
|
11
5
|
import classnames from 'classnames';
|
|
12
6
|
import { createSpacingClasses } from '../space/SpacingHelper';
|
|
13
7
|
import Context from '../../shared/Context';
|
|
14
|
-
import {
|
|
8
|
+
import { usePropsWithContext } from '../../shared/hooks';
|
|
15
9
|
import { TagGroupContext } from './TagContext';
|
|
16
10
|
export const defaultProps = {
|
|
17
11
|
label: null,
|
|
@@ -19,16 +13,16 @@ export const defaultProps = {
|
|
|
19
13
|
children: null
|
|
20
14
|
};
|
|
21
15
|
|
|
22
|
-
|
|
16
|
+
const TagGroup = localProps => {
|
|
23
17
|
const context = React.useContext(Context);
|
|
24
18
|
|
|
25
|
-
const
|
|
19
|
+
const _usePropsWithContext = usePropsWithContext(localProps, defaultProps, context === null || context === void 0 ? void 0 : context.TagGroup),
|
|
26
20
|
{
|
|
27
21
|
label,
|
|
28
22
|
className,
|
|
29
23
|
children: childrenProp
|
|
30
|
-
} =
|
|
31
|
-
props = _objectWithoutProperties(
|
|
24
|
+
} = _usePropsWithContext,
|
|
25
|
+
props = _objectWithoutProperties(_usePropsWithContext, _excluded);
|
|
32
26
|
|
|
33
27
|
let children = childrenProp;
|
|
34
28
|
|
|
@@ -41,13 +35,13 @@ function TagGroup(localProps) {
|
|
|
41
35
|
const spacingClasses = createSpacingClasses(props);
|
|
42
36
|
return React.createElement(TagGroupContext.Provider, {
|
|
43
37
|
value: props
|
|
44
|
-
}, React.createElement("
|
|
38
|
+
}, React.createElement("span", _extends({
|
|
45
39
|
className: classnames('dnb-tag__group', spacingClasses, className),
|
|
46
40
|
"data-testid": "tag-group"
|
|
47
41
|
}, props), React.createElement("span", {
|
|
48
42
|
"data-testid": "tag-group-label",
|
|
49
43
|
className: "dnb-sr-only"
|
|
50
44
|
}, label), children));
|
|
51
|
-
}
|
|
45
|
+
};
|
|
52
46
|
|
|
53
47
|
export default TagGroup;
|
|
@@ -7,7 +7,7 @@ import { createSpacingClasses } from '../space/SpacingHelper'
|
|
|
7
7
|
// Shared
|
|
8
8
|
import Context from '../../shared/Context'
|
|
9
9
|
import { ISpacingProps } from '../../shared/interfaces'
|
|
10
|
-
import {
|
|
10
|
+
import { usePropsWithContext } from '../../shared/hooks'
|
|
11
11
|
import { TagGroupContext } from './TagContext'
|
|
12
12
|
|
|
13
13
|
export interface TagGroupProps {
|
|
@@ -15,7 +15,7 @@ export interface TagGroupProps {
|
|
|
15
15
|
* Aria label to describe the tag group
|
|
16
16
|
* Default: null
|
|
17
17
|
*/
|
|
18
|
-
label:
|
|
18
|
+
label: React.ReactNode
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Custom className on the component root
|
|
@@ -36,7 +36,7 @@ export const defaultProps = {
|
|
|
36
36
|
children: null,
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
const TagGroup = (localProps: TagGroupProps & ISpacingProps) => {
|
|
40
40
|
// Every component should have a context
|
|
41
41
|
const context = React.useContext(Context)
|
|
42
42
|
// Extract additional props from global context
|
|
@@ -45,11 +45,7 @@ function TagGroup(localProps: TagGroupProps & ISpacingProps) {
|
|
|
45
45
|
className,
|
|
46
46
|
children: childrenProp,
|
|
47
47
|
...props
|
|
48
|
-
} =
|
|
49
|
-
{ ...defaultProps, ...localProps },
|
|
50
|
-
defaultProps,
|
|
51
|
-
context?.TagGroup
|
|
52
|
-
)
|
|
48
|
+
} = usePropsWithContext(localProps, defaultProps, context?.TagGroup)
|
|
53
49
|
|
|
54
50
|
let children = childrenProp
|
|
55
51
|
|
|
@@ -63,7 +59,7 @@ function TagGroup(localProps: TagGroupProps & ISpacingProps) {
|
|
|
63
59
|
|
|
64
60
|
return (
|
|
65
61
|
<TagGroupContext.Provider value={props}>
|
|
66
|
-
<
|
|
62
|
+
<span
|
|
67
63
|
className={classnames('dnb-tag__group', spacingClasses, className)}
|
|
68
64
|
data-testid="tag-group"
|
|
69
65
|
{...props}
|
|
@@ -72,7 +68,7 @@ function TagGroup(localProps: TagGroupProps & ISpacingProps) {
|
|
|
72
68
|
{label}
|
|
73
69
|
</span>
|
|
74
70
|
{children}
|
|
75
|
-
</
|
|
71
|
+
</span>
|
|
76
72
|
</TagGroupContext.Provider>
|
|
77
73
|
)
|
|
78
74
|
}
|