@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,19 +1,12 @@
|
|
|
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 = ["className", "skeleton", "data", "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 TimelineItem from './TimelineItem';
|
|
16
|
-
export * from './TimelineItem';
|
|
17
10
|
export const defaultProps = {
|
|
18
11
|
className: null,
|
|
19
12
|
skeleton: false,
|
|
@@ -21,27 +14,38 @@ export const defaultProps = {
|
|
|
21
14
|
children: null
|
|
22
15
|
};
|
|
23
16
|
|
|
24
|
-
|
|
17
|
+
const Timeline = localProps => {
|
|
25
18
|
const context = React.useContext(Context);
|
|
26
19
|
|
|
27
|
-
const
|
|
20
|
+
const _usePropsWithContext = usePropsWithContext(localProps, defaultProps, context === null || context === void 0 ? void 0 : context.Timeline),
|
|
28
21
|
{
|
|
29
22
|
className,
|
|
30
23
|
skeleton,
|
|
31
24
|
data,
|
|
32
|
-
children:
|
|
33
|
-
} =
|
|
34
|
-
props = _objectWithoutProperties(
|
|
25
|
+
children: childrenProp
|
|
26
|
+
} = _usePropsWithContext,
|
|
27
|
+
props = _objectWithoutProperties(_usePropsWithContext, _excluded);
|
|
35
28
|
|
|
36
29
|
const spacingClasses = createSpacingClasses(props);
|
|
30
|
+
let children = childrenProp;
|
|
31
|
+
|
|
32
|
+
if (Array.isArray(childrenProp)) {
|
|
33
|
+
children = childrenProp.map((child, i) => {
|
|
34
|
+
return React.cloneElement(child, {
|
|
35
|
+
skeleton: skeleton,
|
|
36
|
+
key: i
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
37
41
|
return React.createElement("div", _extends({
|
|
38
42
|
className: classnames('dnb-timeline', spacingClasses, className),
|
|
39
43
|
"data-testid": "timeline"
|
|
40
|
-
}, props), data === null || data === void 0 ? void 0 : data.map(timelineItem => React.createElement(TimelineItem, _extends({
|
|
41
|
-
key:
|
|
44
|
+
}, props), data === null || data === void 0 ? void 0 : data.map((timelineItem, i) => React.createElement(TimelineItem, _extends({
|
|
45
|
+
key: i,
|
|
42
46
|
skeleton: skeleton
|
|
43
|
-
}, timelineItem))),
|
|
44
|
-
}
|
|
47
|
+
}, timelineItem))), children);
|
|
48
|
+
};
|
|
45
49
|
|
|
46
50
|
Timeline.Item = TimelineItem;
|
|
47
51
|
export { TimelineItem };
|
|
@@ -6,14 +6,13 @@ import { createSpacingClasses } from '../space/SpacingHelper'
|
|
|
6
6
|
|
|
7
7
|
// Shared
|
|
8
8
|
import Context from '../../shared/Context'
|
|
9
|
-
import { ISpacingProps
|
|
10
|
-
import {
|
|
9
|
+
import { ISpacingProps } from '../../shared/interfaces'
|
|
10
|
+
import { SkeletonShow } from '../skeleton/Skeleton'
|
|
11
|
+
import { usePropsWithContext } from '../../shared/hooks'
|
|
11
12
|
|
|
12
13
|
// Internal
|
|
13
14
|
import TimelineItem, { TimelineItemProps } from './TimelineItem'
|
|
14
15
|
|
|
15
|
-
export * from './TimelineItem'
|
|
16
|
-
|
|
17
16
|
export interface TimelineProps {
|
|
18
17
|
/**
|
|
19
18
|
* Custom className on the component root
|
|
@@ -25,7 +24,7 @@ export interface TimelineProps {
|
|
|
25
24
|
* Skeleton should be applied when loading content
|
|
26
25
|
* Default: null
|
|
27
26
|
*/
|
|
28
|
-
skeleton?:
|
|
27
|
+
skeleton?: SkeletonShow
|
|
29
28
|
|
|
30
29
|
/**
|
|
31
30
|
* Pass in a list of your events as objects of timelineitem, to render them as timelineitems.
|
|
@@ -37,7 +36,9 @@ export interface TimelineProps {
|
|
|
37
36
|
* The content of the component. Can be used instead of prop "data".
|
|
38
37
|
* Default: null
|
|
39
38
|
*/
|
|
40
|
-
children?:
|
|
39
|
+
children?:
|
|
40
|
+
| React.ReactElement<TimelineItemProps>[]
|
|
41
|
+
| React.ReactElement<TimelineItemProps>
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
export const defaultProps = {
|
|
@@ -47,7 +48,7 @@ export const defaultProps = {
|
|
|
47
48
|
children: null,
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
const Timeline = (localProps: TimelineProps & ISpacingProps) => {
|
|
51
52
|
// Every component should have a context
|
|
52
53
|
const context = React.useContext(Context)
|
|
53
54
|
// Extract additional props from global context
|
|
@@ -55,31 +56,34 @@ function Timeline(localProps: TimelineProps & ISpacingProps) {
|
|
|
55
56
|
className,
|
|
56
57
|
skeleton,
|
|
57
58
|
data,
|
|
58
|
-
children:
|
|
59
|
+
children: childrenProp,
|
|
59
60
|
...props
|
|
60
|
-
} =
|
|
61
|
-
{ ...defaultProps, ...localProps },
|
|
62
|
-
defaultProps,
|
|
63
|
-
context?.Timeline
|
|
64
|
-
)
|
|
61
|
+
} = usePropsWithContext(localProps, defaultProps, context?.Timeline)
|
|
65
62
|
|
|
66
63
|
const spacingClasses = createSpacingClasses(props)
|
|
67
64
|
|
|
65
|
+
let children = childrenProp
|
|
66
|
+
|
|
67
|
+
if (Array.isArray(childrenProp)) {
|
|
68
|
+
children = childrenProp.map((child, i) => {
|
|
69
|
+
return React.cloneElement(child, {
|
|
70
|
+
skeleton: skeleton,
|
|
71
|
+
key: i,
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
|
|
68
76
|
return (
|
|
69
77
|
<div
|
|
70
78
|
className={classnames('dnb-timeline', spacingClasses, className)}
|
|
71
79
|
data-testid="timeline"
|
|
72
80
|
{...props}
|
|
73
81
|
>
|
|
74
|
-
{data?.map((timelineItem
|
|
75
|
-
<TimelineItem
|
|
76
|
-
key={timelineItem.name}
|
|
77
|
-
skeleton={skeleton}
|
|
78
|
-
{...timelineItem}
|
|
79
|
-
/>
|
|
82
|
+
{data?.map((timelineItem, i) => (
|
|
83
|
+
<TimelineItem key={i} skeleton={skeleton} {...timelineItem} />
|
|
80
84
|
))}
|
|
81
85
|
|
|
82
|
-
{
|
|
86
|
+
{children}
|
|
83
87
|
</div>
|
|
84
88
|
)
|
|
85
89
|
}
|
|
@@ -1,15 +1,9 @@
|
|
|
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 _span;
|
|
6
5
|
|
|
7
6
|
const _excluded = ["icon", "iconAlt", "name", "date", "infoMessage", "state", "skeleton"];
|
|
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 FormStatus from '../form-status/FormStatus';
|
|
@@ -19,7 +13,7 @@ import checkIcon from '../../icons/check';
|
|
|
19
13
|
import calendarIcon from '../../icons/calendar';
|
|
20
14
|
import pinIcon from '../../icons/pin';
|
|
21
15
|
import Context from '../../shared/Context';
|
|
22
|
-
import {
|
|
16
|
+
import { usePropsWithContext } from '../../shared/hooks';
|
|
23
17
|
const defaultProps = {
|
|
24
18
|
icon: null,
|
|
25
19
|
iconAlt: null,
|
|
@@ -29,7 +23,8 @@ const defaultProps = {
|
|
|
29
23
|
state: null,
|
|
30
24
|
skeleton: false
|
|
31
25
|
};
|
|
32
|
-
|
|
26
|
+
|
|
27
|
+
const TimelineItem = localProps => {
|
|
33
28
|
var _span2, _span3, _span4, _FormStatus;
|
|
34
29
|
|
|
35
30
|
const context = React.useContext(Context);
|
|
@@ -43,7 +38,7 @@ export default function TimelineItem(localProps) {
|
|
|
43
38
|
}
|
|
44
39
|
} = context;
|
|
45
40
|
|
|
46
|
-
const
|
|
41
|
+
const _usePropsWithContext = usePropsWithContext(localProps, defaultProps, context === null || context === void 0 ? void 0 : context.TimelineItem),
|
|
47
42
|
{
|
|
48
43
|
icon,
|
|
49
44
|
iconAlt,
|
|
@@ -52,8 +47,8 @@ export default function TimelineItem(localProps) {
|
|
|
52
47
|
infoMessage,
|
|
53
48
|
state,
|
|
54
49
|
skeleton
|
|
55
|
-
} =
|
|
56
|
-
props = _objectWithoutProperties(
|
|
50
|
+
} = _usePropsWithContext,
|
|
51
|
+
props = _objectWithoutProperties(_usePropsWithContext, _excluded);
|
|
57
52
|
|
|
58
53
|
const stateIsCompleted = state === 'completed';
|
|
59
54
|
const stateIsCurrent = state === 'current';
|
|
@@ -108,4 +103,6 @@ export default function TimelineItem(localProps) {
|
|
|
108
103
|
"data-testid": "timeline-item",
|
|
109
104
|
"aria-current": stateIsCurrent ? 'step' : undefined
|
|
110
105
|
}, props), React.createElement(TimelineItemLabel, null), React.createElement(TimelineItemContent, null));
|
|
111
|
-
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export default TimelineItem;
|
|
@@ -13,8 +13,8 @@ import pinIcon from '../../icons/pin'
|
|
|
13
13
|
|
|
14
14
|
// Shared
|
|
15
15
|
import Context from '../../shared/Context'
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { SkeletonShow } from '../skeleton/Skeleton'
|
|
17
|
+
import { usePropsWithContext } from '../../shared/hooks'
|
|
18
18
|
|
|
19
19
|
export interface TimelineItemProps {
|
|
20
20
|
/**
|
|
@@ -32,7 +32,7 @@ export interface TimelineItemProps {
|
|
|
32
32
|
/**
|
|
33
33
|
* Text displaying the name of the timeline item.
|
|
34
34
|
*/
|
|
35
|
-
name: React.ReactNode
|
|
35
|
+
name: React.ReactNode & string
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Text displaying the date of the timeline item.
|
|
@@ -54,7 +54,7 @@ export interface TimelineItemProps {
|
|
|
54
54
|
* Skeleton should be applied when loading content
|
|
55
55
|
* Default: null
|
|
56
56
|
*/
|
|
57
|
-
skeleton?:
|
|
57
|
+
skeleton?: SkeletonShow
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
const defaultProps = {
|
|
@@ -67,7 +67,7 @@ const defaultProps = {
|
|
|
67
67
|
skeleton: false,
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
const TimelineItem = (localProps: TimelineItemProps) => {
|
|
71
71
|
// Every component should have a context
|
|
72
72
|
const context = React.useContext(Context)
|
|
73
73
|
const {
|
|
@@ -90,11 +90,7 @@ export default function TimelineItem(localProps: TimelineItemProps) {
|
|
|
90
90
|
state,
|
|
91
91
|
skeleton,
|
|
92
92
|
...props
|
|
93
|
-
} =
|
|
94
|
-
{ ...defaultProps, ...localProps },
|
|
95
|
-
defaultProps,
|
|
96
|
-
context?.TimelineItem
|
|
97
|
-
)
|
|
93
|
+
} = usePropsWithContext(localProps, defaultProps, context?.TimelineItem)
|
|
98
94
|
|
|
99
95
|
const stateIsCompleted = state === 'completed'
|
|
100
96
|
const stateIsCurrent = state === 'current'
|
|
@@ -191,3 +187,5 @@ export default function TimelineItem(localProps: TimelineItemProps) {
|
|
|
191
187
|
</div>
|
|
192
188
|
)
|
|
193
189
|
}
|
|
190
|
+
|
|
191
|
+
export default TimelineItem
|
package/es/elements/Div.d.ts
CHANGED
|
@@ -13,10 +13,10 @@ export type DivTop = string | number | boolean;
|
|
|
13
13
|
export type DivRight = string | number | boolean;
|
|
14
14
|
export type DivBottom = string | number | boolean;
|
|
15
15
|
export type DivLeft = string | number | boolean;
|
|
16
|
-
|
|
17
16
|
/**
|
|
18
17
|
* NB: Do not change the docs (comments) in here. The docs are updated during build time by "generateTypes.js" and "fetchPropertiesFromDocs.js".
|
|
19
18
|
*/
|
|
19
|
+
|
|
20
20
|
export interface DivProps extends React.HTMLProps<HTMLElement> {
|
|
21
21
|
space?: DivSpace;
|
|
22
22
|
top?: DivTop;
|
package/es/elements/P.d.ts
CHANGED
|
@@ -25,7 +25,8 @@ export type PSize =
|
|
|
25
25
|
* NB: Do not change the docs (comments) in here. The docs are updated during build time by "generateTypes.js" and "fetchPropertiesFromDocs.js".
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
export interface PProps
|
|
28
|
+
export interface PProps
|
|
29
|
+
extends Omit<React.HTMLProps<HTMLElement>, 'size'> {
|
|
29
30
|
space?: PSpace;
|
|
30
31
|
top?: PTop;
|
|
31
32
|
right?: PRight;
|
|
@@ -56,6 +56,15 @@ export default class AnimateHeight {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
_emitTransitionEnd() {
|
|
60
|
+
try {
|
|
61
|
+
const event = new CustomEvent('transitionend');
|
|
62
|
+
this.elem.dispatchEvent(event);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
warn(e);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
59
68
|
setElement(elem, container = null) {
|
|
60
69
|
var _this$elem;
|
|
61
70
|
|
|
@@ -140,25 +149,18 @@ export default class AnimateHeight {
|
|
|
140
149
|
start(fromHeight, toHeight, {
|
|
141
150
|
animate = true
|
|
142
151
|
} = {}) {
|
|
143
|
-
var _this$opts;
|
|
152
|
+
var _window, _window$location, _window$location$href, _this$opts;
|
|
144
153
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
} catch (e) {}
|
|
154
|
+
if ((_window = window) !== null && _window !== void 0 && (_window$location = _window.location) !== null && _window$location !== void 0 && (_window$location$href = _window$location.href) !== null && _window$location$href !== void 0 && _window$location$href.includes('data-visual-test')) {
|
|
155
|
+
animate = false;
|
|
156
|
+
}
|
|
150
157
|
|
|
151
|
-
if (animate === false || ((_this$opts = this.opts) === null || _this$opts === void 0 ? void 0 : _this$opts.animate) === false) {
|
|
158
|
+
if (fromHeight === toHeight || animate === false || ((_this$opts = this.opts) === null || _this$opts === void 0 ? void 0 : _this$opts.animate) === false) {
|
|
152
159
|
this.elem.style.height = `${toHeight}px`;
|
|
153
160
|
|
|
154
161
|
this._callOnStart();
|
|
155
162
|
|
|
156
|
-
|
|
157
|
-
const event = new CustomEvent('transitionend');
|
|
158
|
-
this.elem.dispatchEvent(event);
|
|
159
|
-
} catch (e) {
|
|
160
|
-
warn(e);
|
|
161
|
-
}
|
|
163
|
+
this._emitTransitionEnd();
|
|
162
164
|
|
|
163
165
|
return;
|
|
164
166
|
}
|
package/es/shared/helpers.js
CHANGED
|
@@ -317,8 +317,15 @@ export async function copyToClipboard(string) {
|
|
|
317
317
|
|
|
318
318
|
return success;
|
|
319
319
|
}
|
|
320
|
-
export const warn = (...
|
|
320
|
+
export const warn = (...params) => {
|
|
321
321
|
if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && typeof console !== 'undefined' && typeof console.log === 'function') {
|
|
322
|
-
|
|
322
|
+
const isBrowser = typeof window !== 'undefined';
|
|
323
|
+
|
|
324
|
+
if (isBrowser) {
|
|
325
|
+
const styles = [`padding: 0.125rem 0.5rem ${IS_SAFARI ? '' : '0'}`, 'font-weight: bold', 'color: #00343E', 'background: #A5E1D2'].join(';');
|
|
326
|
+
console.log('%cEufemia', styles, ...params);
|
|
327
|
+
} else {
|
|
328
|
+
console.log('Eufemia:', ...params);
|
|
329
|
+
}
|
|
323
330
|
}
|
|
324
331
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { usePropsWithContext } from './usePropsWithContext';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { usePropsWithContext } from './usePropsWithContext'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
function usePropsWithContext(props, defaults = {}, ...contexts) {
|
|
8
|
+
const context = contexts.reduce((acc, cur) => {
|
|
9
|
+
if (cur) {
|
|
10
|
+
acc = _objectSpread(_objectSpread({}, acc), cur);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return acc;
|
|
14
|
+
}, {});
|
|
15
|
+
props = _objectSpread(_objectSpread({}, defaults), props);
|
|
16
|
+
return _objectSpread(_objectSpread({}, props), Object.entries(context).reduce((acc, [key, value]) => {
|
|
17
|
+
if (typeof props[key] !== 'undefined' && props[key] === defaults[key]) {
|
|
18
|
+
acc[key] = value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return acc;
|
|
22
|
+
}, {}));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { usePropsWithContext };
|
|
26
|
+
export default usePropsWithContext;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type DefaultsProps = Record<string, unknown>
|
|
2
|
+
export type Contexts = Array<Record<string, unknown>>
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Extends props from a given context
|
|
6
|
+
* but give the context second priority only
|
|
7
|
+
*
|
|
8
|
+
* @param props object of component properties
|
|
9
|
+
* @param defaults object of potential default values
|
|
10
|
+
* @param contexts the rest of all context to merge
|
|
11
|
+
* @returns merged properties
|
|
12
|
+
*/
|
|
13
|
+
function usePropsWithContext<Props>(
|
|
14
|
+
props: Props,
|
|
15
|
+
defaults: DefaultsProps = {},
|
|
16
|
+
...contexts: Contexts
|
|
17
|
+
) {
|
|
18
|
+
const context = contexts.reduce((acc, cur) => {
|
|
19
|
+
if (cur) {
|
|
20
|
+
acc = { ...acc, ...cur }
|
|
21
|
+
}
|
|
22
|
+
return acc
|
|
23
|
+
}, {})
|
|
24
|
+
|
|
25
|
+
props = { ...defaults, ...props }
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
...props,
|
|
29
|
+
...Object.entries(context).reduce((acc, [key, value]) => {
|
|
30
|
+
if (
|
|
31
|
+
// check if a prop of the same name exists
|
|
32
|
+
typeof props[key] !== 'undefined' &&
|
|
33
|
+
// and if it was NOT defined as a component prop, because its still the same as the defaults
|
|
34
|
+
props[key] === defaults[key]
|
|
35
|
+
) {
|
|
36
|
+
// then we use the context value
|
|
37
|
+
acc[key] = value
|
|
38
|
+
}
|
|
39
|
+
return acc
|
|
40
|
+
}, {}),
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { usePropsWithContext }
|
|
45
|
+
export default usePropsWithContext
|
package/es/shared/interfaces.tsx
CHANGED
|
@@ -1072,7 +1072,8 @@
|
|
|
1072
1072
|
.dnb-avatar__group .dnb-avatar--size-x-large {
|
|
1073
1073
|
margin-left: -1.5rem; }
|
|
1074
1074
|
.dnb-avatar__group .dnb-avatar:nth-of-type(2) {
|
|
1075
|
-
margin-left: 0;
|
|
1075
|
+
margin-left: 0;
|
|
1076
|
+
border-left: none; }
|
|
1076
1077
|
.dnb-avatar__group--elements-left {
|
|
1077
1078
|
display: -webkit-inline-box;
|
|
1078
1079
|
display: -ms-inline-flexbox;
|
|
@@ -1083,6 +1084,8 @@
|
|
|
1083
1084
|
-webkit-box-pack: center;
|
|
1084
1085
|
-ms-flex-pack: center;
|
|
1085
1086
|
justify-content: center;
|
|
1087
|
+
-ms-flex-negative: 0;
|
|
1088
|
+
flex-shrink: 0;
|
|
1086
1089
|
color: #737373;
|
|
1087
1090
|
color: var(--color-black-55); }
|
|
1088
1091
|
.dnb-avatar__group--elements-left--size-small {
|