@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.
Files changed (200) hide show
  1. package/CHANGELOG.md +20 -198
  2. package/cjs/components/avatar/Avatar.js +14 -12
  3. package/cjs/components/avatar/AvatarGroup.js +11 -11
  4. package/cjs/components/avatar/style/_avatar.scss +2 -0
  5. package/cjs/components/avatar/style/dnb-avatar.css +4 -1
  6. package/cjs/components/avatar/style/dnb-avatar.min.css +1 -1
  7. package/cjs/components/breadcrumb/Breadcrumb.js +27 -52
  8. package/cjs/components/breadcrumb/BreadcrumbItem.js +15 -29
  9. package/cjs/components/button/Button.d.ts +11 -7
  10. package/cjs/components/icon-primary/IconPrimary.d.ts +2 -1
  11. package/cjs/components/info-card/InfoCard.js +22 -22
  12. package/cjs/components/pagination/Pagination.d.ts +6 -6
  13. package/cjs/components/pagination/Pagination.js +2 -2
  14. package/cjs/components/skeleton/Skeleton.d.ts +1 -1
  15. package/cjs/components/skeleton/SkeletonHelper.d.ts +2 -1
  16. package/cjs/components/step-indicator/StepIndicatorTriggerButton.js +4 -4
  17. package/cjs/components/tag/Tag.js +17 -29
  18. package/cjs/components/tag/TagGroup.js +10 -24
  19. package/cjs/components/timeline/Timeline.js +24 -64
  20. package/cjs/components/timeline/TimelineItem.js +16 -29
  21. package/cjs/elements/Div.d.ts +1 -1
  22. package/cjs/elements/P.d.ts +2 -1
  23. package/cjs/shared/AnimateHeight.js +19 -13
  24. package/cjs/shared/helpers.js +16 -4
  25. package/cjs/shared/hooks/index.js +13 -0
  26. package/cjs/shared/hooks/usePropsWithContext.js +92 -0
  27. package/cjs/style/dnb-ui-components.css +4 -1
  28. package/cjs/style/dnb-ui-components.min.css +1 -1
  29. package/cjs/style/dnb-ui-elements.css +1 -3
  30. package/cjs/style/dnb-ui-elements.min.css +1 -1
  31. package/cjs/style/dnb-ui-tags.css +2 -6
  32. package/cjs/style/dnb-ui-tags.min.css +2 -2
  33. package/cjs/style/elements/code.scss +1 -3
  34. package/cjs/style/stylis.d.ts +38 -0
  35. package/cjs/style/themes/theme-open-banking/dnb-theme-open-banking.css +1 -3
  36. package/cjs/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
  37. package/cjs/style/themes/theme-ui/dnb-theme-ui.css +1 -3
  38. package/cjs/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
  39. package/components/avatar/Avatar.js +14 -13
  40. package/components/avatar/Avatar.tsx +8 -9
  41. package/components/avatar/AvatarGroup.js +20 -20
  42. package/components/avatar/AvatarGroup.tsx +4 -8
  43. package/components/avatar/style/_avatar.scss +2 -0
  44. package/components/avatar/style/dnb-avatar.css +4 -1
  45. package/components/avatar/style/dnb-avatar.min.css +1 -1
  46. package/components/breadcrumb/Breadcrumb.js +22 -35
  47. package/components/breadcrumb/Breadcrumb.tsx +10 -10
  48. package/components/breadcrumb/BreadcrumbItem.js +14 -25
  49. package/components/breadcrumb/BreadcrumbItem.tsx +8 -11
  50. package/components/button/Button.d.ts +11 -7
  51. package/components/icon-primary/IconPrimary.d.ts +2 -1
  52. package/components/info-card/InfoCard.js +22 -22
  53. package/components/info-card/InfoCard.tsx +13 -12
  54. package/components/modal/Modal.tsx +1 -1
  55. package/components/modal/ModalContent.tsx +6 -2
  56. package/components/modal/components/ModalHeader.tsx +2 -2
  57. package/components/modal/types.ts +2 -2
  58. package/components/pagination/Pagination.d.ts +6 -6
  59. package/components/pagination/Pagination.js +2 -2
  60. package/components/skeleton/SkeletonHelper.d.ts +2 -1
  61. package/components/step-indicator/StepIndicatorTriggerButton.js +4 -4
  62. package/components/tag/Tag.js +17 -27
  63. package/components/tag/Tag.tsx +15 -13
  64. package/components/tag/TagGroup.js +9 -22
  65. package/components/tag/TagGroup.tsx +6 -10
  66. package/components/timeline/Timeline.js +23 -27
  67. package/components/timeline/Timeline.tsx +24 -20
  68. package/components/timeline/TimelineItem.js +15 -25
  69. package/components/timeline/TimelineItem.tsx +8 -10
  70. package/elements/P.d.ts +2 -1
  71. package/es/components/avatar/Avatar.js +7 -6
  72. package/es/components/avatar/Avatar.tsx +8 -9
  73. package/es/components/avatar/AvatarGroup.js +6 -6
  74. package/es/components/avatar/AvatarGroup.tsx +4 -8
  75. package/es/components/avatar/style/_avatar.scss +2 -0
  76. package/es/components/avatar/style/dnb-avatar.css +4 -1
  77. package/es/components/avatar/style/dnb-avatar.min.css +1 -1
  78. package/es/components/breadcrumb/Breadcrumb.js +8 -14
  79. package/es/components/breadcrumb/Breadcrumb.tsx +10 -10
  80. package/es/components/breadcrumb/BreadcrumbItem.js +9 -13
  81. package/es/components/breadcrumb/BreadcrumbItem.tsx +8 -11
  82. package/es/components/button/Button.d.ts +11 -7
  83. package/es/components/icon-primary/IconPrimary.d.ts +2 -1
  84. package/es/components/info-card/InfoCard.js +8 -8
  85. package/es/components/info-card/InfoCard.tsx +13 -12
  86. package/es/components/modal/Modal.tsx +1 -1
  87. package/es/components/modal/ModalContent.tsx +6 -2
  88. package/es/components/modal/components/ModalHeader.tsx +2 -2
  89. package/es/components/modal/types.ts +2 -2
  90. package/es/components/pagination/Pagination.d.ts +6 -6
  91. package/es/components/pagination/Pagination.js +2 -2
  92. package/es/components/skeleton/Skeleton.d.ts +1 -1
  93. package/es/components/skeleton/SkeletonHelper.d.ts +2 -1
  94. package/es/components/step-indicator/StepIndicatorTriggerButton.js +4 -4
  95. package/es/components/tag/Tag.js +11 -14
  96. package/es/components/tag/Tag.tsx +15 -13
  97. package/es/components/tag/TagGroup.js +7 -13
  98. package/es/components/tag/TagGroup.tsx +6 -10
  99. package/es/components/timeline/Timeline.js +21 -17
  100. package/es/components/timeline/Timeline.tsx +24 -20
  101. package/es/components/timeline/TimelineItem.js +9 -12
  102. package/es/components/timeline/TimelineItem.tsx +8 -10
  103. package/es/elements/Div.d.ts +1 -1
  104. package/es/elements/P.d.ts +2 -1
  105. package/es/shared/AnimateHeight.js +15 -13
  106. package/es/shared/helpers.js +9 -2
  107. package/es/shared/hooks/index.js +1 -0
  108. package/es/shared/hooks/index.ts +1 -0
  109. package/es/shared/hooks/usePropsWithContext.js +26 -0
  110. package/es/shared/hooks/usePropsWithContext.ts +45 -0
  111. package/es/shared/interfaces.tsx +0 -2
  112. package/es/style/dnb-ui-components.css +4 -1
  113. package/es/style/dnb-ui-components.min.css +1 -1
  114. package/es/style/dnb-ui-elements.css +1 -3
  115. package/es/style/dnb-ui-elements.min.css +1 -1
  116. package/es/style/dnb-ui-tags.css +2 -6
  117. package/es/style/dnb-ui-tags.min.css +2 -2
  118. package/es/style/elements/code.scss +1 -3
  119. package/es/style/stylis.d.ts +38 -0
  120. package/es/style/themes/theme-open-banking/dnb-theme-open-banking.css +1 -3
  121. package/es/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
  122. package/es/style/themes/theme-ui/dnb-theme-ui.css +1 -3
  123. package/es/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
  124. package/esm/components/avatar/Avatar.js +14 -13
  125. package/esm/components/avatar/Avatar.tsx +8 -9
  126. package/esm/components/avatar/AvatarGroup.js +20 -20
  127. package/esm/components/avatar/AvatarGroup.tsx +4 -8
  128. package/esm/components/avatar/style/_avatar.scss +2 -0
  129. package/esm/components/avatar/style/dnb-avatar.css +4 -1
  130. package/esm/components/avatar/style/dnb-avatar.min.css +1 -1
  131. package/esm/components/breadcrumb/Breadcrumb.js +22 -35
  132. package/esm/components/breadcrumb/Breadcrumb.tsx +10 -10
  133. package/esm/components/breadcrumb/BreadcrumbItem.js +14 -25
  134. package/esm/components/breadcrumb/BreadcrumbItem.tsx +8 -11
  135. package/esm/components/button/Button.d.ts +11 -7
  136. package/esm/components/icon-primary/IconPrimary.d.ts +2 -1
  137. package/esm/components/info-card/InfoCard.js +22 -22
  138. package/esm/components/info-card/InfoCard.tsx +13 -12
  139. package/esm/components/modal/Modal.tsx +1 -1
  140. package/esm/components/modal/ModalContent.tsx +6 -2
  141. package/esm/components/modal/components/ModalHeader.tsx +2 -2
  142. package/esm/components/modal/types.ts +2 -2
  143. package/esm/components/pagination/Pagination.d.ts +6 -6
  144. package/esm/components/pagination/Pagination.js +2 -2
  145. package/esm/components/skeleton/SkeletonHelper.d.ts +2 -1
  146. package/esm/components/step-indicator/StepIndicatorTriggerButton.js +4 -4
  147. package/esm/components/tag/Tag.js +17 -27
  148. package/esm/components/tag/Tag.tsx +15 -13
  149. package/esm/components/tag/TagGroup.js +9 -22
  150. package/esm/components/tag/TagGroup.tsx +6 -10
  151. package/esm/components/timeline/Timeline.js +23 -27
  152. package/esm/components/timeline/Timeline.tsx +24 -20
  153. package/esm/components/timeline/TimelineItem.js +15 -25
  154. package/esm/components/timeline/TimelineItem.tsx +8 -10
  155. package/esm/dnb-ui-components.min.mjs +3 -3
  156. package/esm/dnb-ui-lib.min.mjs +3 -3
  157. package/esm/dnb-ui-web-components.min.mjs +4 -4
  158. package/esm/elements/P.d.ts +2 -1
  159. package/esm/shared/AnimateHeight.js +19 -13
  160. package/esm/shared/helpers.js +15 -4
  161. package/esm/shared/hooks/index.js +1 -0
  162. package/esm/shared/hooks/index.ts +1 -0
  163. package/esm/shared/hooks/usePropsWithContext.js +47 -0
  164. package/esm/shared/hooks/usePropsWithContext.ts +45 -0
  165. package/esm/shared/interfaces.tsx +0 -2
  166. package/esm/style/dnb-ui-components.css +4 -1
  167. package/esm/style/dnb-ui-components.min.css +1 -1
  168. package/esm/style/dnb-ui-elements.css +1 -3
  169. package/esm/style/dnb-ui-elements.min.css +1 -1
  170. package/esm/style/dnb-ui-tags.css +2 -6
  171. package/esm/style/dnb-ui-tags.min.css +2 -2
  172. package/esm/style/elements/code.scss +1 -3
  173. package/esm/style/stylis.d.ts +38 -0
  174. package/esm/style/themes/theme-open-banking/dnb-theme-open-banking.css +1 -3
  175. package/esm/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
  176. package/esm/style/themes/theme-ui/dnb-theme-ui.css +1 -3
  177. package/esm/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
  178. package/package.json +1 -1
  179. package/shared/AnimateHeight.js +19 -13
  180. package/shared/helpers.js +15 -4
  181. package/shared/hooks/index.js +1 -0
  182. package/shared/hooks/index.ts +1 -0
  183. package/shared/hooks/usePropsWithContext.js +47 -0
  184. package/shared/hooks/usePropsWithContext.ts +45 -0
  185. package/shared/interfaces.tsx +0 -2
  186. package/style/dnb-ui-components.css +4 -1
  187. package/style/dnb-ui-components.min.css +1 -1
  188. package/style/dnb-ui-elements.css +1 -3
  189. package/style/dnb-ui-elements.min.css +1 -1
  190. package/style/dnb-ui-tags.css +2 -6
  191. package/style/dnb-ui-tags.min.css +2 -2
  192. package/style/elements/code.scss +1 -3
  193. package/style/stylis.d.ts +38 -0
  194. package/style/themes/theme-open-banking/dnb-theme-open-banking.css +1 -3
  195. package/style/themes/theme-open-banking/dnb-theme-open-banking.min.css +1 -1
  196. package/style/themes/theme-ui/dnb-theme-ui.css +1 -3
  197. package/style/themes/theme-ui/dnb-theme-ui.min.css +1 -1
  198. package/umd/dnb-ui-components.min.js +3 -3
  199. package/umd/dnb-ui-lib.min.js +4 -4
  200. 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 { extendPropsWithContext } from '../../shared/component-helper';
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
- function Timeline(localProps) {
17
+ const Timeline = localProps => {
25
18
  const context = React.useContext(Context);
26
19
 
27
- const _extendPropsWithConte = extendPropsWithContext(_objectSpread(_objectSpread({}, defaultProps), localProps), defaultProps, context === null || context === void 0 ? void 0 : context.Timeline),
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: childrenItems
33
- } = _extendPropsWithConte,
34
- props = _objectWithoutProperties(_extendPropsWithConte, _excluded);
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: timelineItem.name,
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))), childrenItems);
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, SkeletonTypes } from '../../shared/interfaces'
10
- import { extendPropsWithContext } from '../../shared/component-helper'
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?: SkeletonTypes
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?: TimelineItemProps[]
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
- function Timeline(localProps: TimelineProps & ISpacingProps) {
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: childrenItems,
59
+ children: childrenProp,
59
60
  ...props
60
- } = extendPropsWithContext(
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: TimelineItemProps) => (
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
- {childrenItems}
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 { extendPropsWithContext } from '../../shared/component-helper';
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
- export default function TimelineItem(localProps) {
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 _extendPropsWithConte = extendPropsWithContext(_objectSpread(_objectSpread({}, defaultProps), localProps), defaultProps, context === null || context === void 0 ? void 0 : context.TimelineItem),
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
- } = _extendPropsWithConte,
56
- props = _objectWithoutProperties(_extendPropsWithConte, _excluded);
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 { SkeletonTypes } from '../../shared/interfaces'
17
- import { extendPropsWithContext } from '../../shared/component-helper'
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?: SkeletonTypes
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
- export default function TimelineItem(localProps: TimelineItemProps) {
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
- } = extendPropsWithContext(
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
@@ -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;
@@ -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 extends React.HTMLProps<HTMLElement> {
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
- try {
146
- if (window.location.href.includes('data-visual-test')) {
147
- animate = false;
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
- try {
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
  }
@@ -317,8 +317,15 @@ export async function copyToClipboard(string) {
317
317
 
318
318
  return success;
319
319
  }
320
- export const warn = (...e) => {
320
+ export const warn = (...params) => {
321
321
  if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && typeof console !== 'undefined' && typeof console.log === 'function') {
322
- console.log('Eufemia:', ...e);
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
@@ -10,5 +10,3 @@ export interface ISpacingElementProps {
10
10
  }
11
11
 
12
12
  export type SpaceTypes = string | boolean | number
13
-
14
- export type SkeletonTypes = string | boolean
@@ -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 {