@dnb/eufemia 10.0.0-beta.5 → 10.0.0-beta.6

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 (69) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/cjs/components/accordion/Accordion.d.ts +1 -1
  3. package/cjs/components/accordion/AccordionHeader.d.ts +1 -1
  4. package/cjs/components/autocomplete/Autocomplete.d.ts +2 -2
  5. package/cjs/components/dialog/parts/DialogHeader.d.ts +2 -1
  6. package/cjs/components/dropdown/Dropdown.d.ts +1 -1
  7. package/cjs/components/help-button/HelpButton.d.ts +1 -1
  8. package/cjs/components/input/Input.d.ts +1 -1
  9. package/cjs/components/input-masked/InputMasked.d.ts +1 -1
  10. package/cjs/components/modal/ModalContent.d.ts +1 -0
  11. package/cjs/components/modal/ModalContent.js +10 -2
  12. package/cjs/components/modal/parts/CloseButton.d.ts +1 -1
  13. package/cjs/components/modal/types.d.ts +3 -3
  14. package/cjs/components/pagination/Pagination.d.ts +33 -33
  15. package/cjs/components/tooltip/TooltipPortal.js +20 -6
  16. package/cjs/elements/div/Div.d.ts +2 -0
  17. package/cjs/fragments/drawer-list/DrawerList.js +5 -1
  18. package/cjs/shared/Eufemia.js +1 -1
  19. package/cjs/shared/Theme.d.ts +9 -1
  20. package/cjs/shared/Theme.js +55 -30
  21. package/components/accordion/Accordion.d.ts +1 -1
  22. package/components/accordion/AccordionHeader.d.ts +1 -1
  23. package/components/autocomplete/Autocomplete.d.ts +2 -2
  24. package/components/dialog/parts/DialogHeader.d.ts +2 -1
  25. package/components/dropdown/Dropdown.d.ts +1 -1
  26. package/components/help-button/HelpButton.d.ts +1 -1
  27. package/components/input/Input.d.ts +1 -1
  28. package/components/input-masked/InputMasked.d.ts +1 -1
  29. package/components/modal/ModalContent.d.ts +1 -0
  30. package/components/modal/ModalContent.js +8 -2
  31. package/components/modal/parts/CloseButton.d.ts +1 -1
  32. package/components/modal/types.d.ts +3 -3
  33. package/components/pagination/Pagination.d.ts +33 -33
  34. package/components/tooltip/TooltipPortal.js +18 -6
  35. package/elements/div/Div.d.ts +2 -0
  36. package/es/components/accordion/Accordion.d.ts +1 -1
  37. package/es/components/accordion/AccordionHeader.d.ts +1 -1
  38. package/es/components/autocomplete/Autocomplete.d.ts +2 -2
  39. package/es/components/dialog/parts/DialogHeader.d.ts +2 -1
  40. package/es/components/dropdown/Dropdown.d.ts +1 -1
  41. package/es/components/help-button/HelpButton.d.ts +1 -1
  42. package/es/components/input/Input.d.ts +1 -1
  43. package/es/components/input-masked/InputMasked.d.ts +1 -1
  44. package/es/components/modal/ModalContent.d.ts +1 -0
  45. package/es/components/modal/ModalContent.js +8 -2
  46. package/es/components/modal/parts/CloseButton.d.ts +1 -1
  47. package/es/components/modal/types.d.ts +3 -3
  48. package/es/components/pagination/Pagination.d.ts +33 -33
  49. package/es/components/tooltip/TooltipPortal.js +17 -5
  50. package/es/elements/div/Div.d.ts +2 -0
  51. package/es/fragments/drawer-list/DrawerList.js +4 -1
  52. package/es/shared/Eufemia.js +1 -1
  53. package/es/shared/Theme.d.ts +9 -1
  54. package/es/shared/Theme.js +52 -31
  55. package/esm/dnb-ui-basis.min.mjs +1 -1
  56. package/esm/dnb-ui-components.min.mjs +1 -1
  57. package/esm/dnb-ui-elements.min.mjs +1 -1
  58. package/esm/dnb-ui-extensions.min.mjs +1 -1
  59. package/esm/dnb-ui-lib.min.mjs +1 -1
  60. package/fragments/drawer-list/DrawerList.js +4 -1
  61. package/package.json +1 -1
  62. package/shared/Eufemia.js +1 -1
  63. package/shared/Theme.d.ts +9 -1
  64. package/shared/Theme.js +52 -31
  65. package/umd/dnb-ui-basis.min.js +1 -1
  66. package/umd/dnb-ui-components.min.js +1 -1
  67. package/umd/dnb-ui-elements.min.js +1 -1
  68. package/umd/dnb-ui-extensions.min.js +1 -1
  69. package/umd/dnb-ui-lib.min.js +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
3
3
  All notable changes to @dnb/eufemia will be documented in this file. See
4
4
  [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [10.0.0-beta.6](https://github.com/dnbexperience/eufemia/compare/v10.0.0-beta.5...v10.0.0-beta.6) (2023-05-10)
7
+
8
+
9
+ ### :memo: Documentation
10
+
11
+ * **Portal:** removes Modal's new status ([#2312](https://github.com/dnbexperience/eufemia/issues/2312)) ([38016b6](https://github.com/dnbexperience/eufemia/commit/38016b6b5fb9125e8f8358990849ee986642380f))
12
+ * **v10:** add docs for HelpButton's modal_props ([#2314](https://github.com/dnbexperience/eufemia/issues/2314)) ([66132f4](https://github.com/dnbexperience/eufemia/commit/66132f4a1207e860d7ebccd1c7d586d468ac777e))
13
+ * **v10:** add example for updating import of properties ([#2313](https://github.com/dnbexperience/eufemia/issues/2313)) ([c31c679](https://github.com/dnbexperience/eufemia/commit/c31c679b1c76cd98ed0cc94b6ee79b3ce7f70f6a))
14
+
15
+
16
+ ### :sparkles: Features
17
+
18
+ * release of v10.0.0-beta.6 ([61bd05c](https://github.com/dnbexperience/eufemia/commit/61bd05cb9bc43632197811e46dfd8e795ce23bc3))
19
+
6
20
  ## [10.0.0-beta.5](https://github.com/dnbexperience/eufemia/compare/v10.0.0-beta.4...v10.0.0-beta.5) (2023-05-08)
7
21
 
8
22
 
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { ButtonIconPosition } from '../button';
2
+ import type { ButtonIconPosition } from '../Button';
3
3
  import type { HeadingLevel } from '../Heading';
4
4
  import type { IconIcon, IconSize } from '../Icon';
5
5
  import type { SkeletonShow } from '../Skeleton';
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { ButtonIconPosition } from '../button';
2
+ import type { ButtonIconPosition } from '../Button';
3
3
  import type { HeadingLevel } from '../Heading';
4
4
  import type { IconSize } from '../Icon';
5
5
  import type { SkeletonShow } from '../Skeleton';
@@ -4,7 +4,7 @@ import type {
4
4
  DrawerListData,
5
5
  DrawerListOptionsRender
6
6
  } from '../../fragments/DrawerList';
7
- import type { ButtonIconPosition } from '../button';
7
+ import type { ButtonIconPosition } from '../Button';
8
8
  import type { FormLabelLabelDirection, FormLabelText } from '../FormLabel';
9
9
  import type {
10
10
  FormStatusProps,
@@ -29,7 +29,7 @@ type AutocompleteSubmitButtonIcon =
29
29
  | ((...args: any[]) => any);
30
30
  type AutocompleteInputRef =
31
31
  | ((...args: any[]) => any)
32
- | Record<string, unknown>;
32
+ | React.MutableRefObject<HTMLInputElement | undefined>;
33
33
  type AutocompleteInputIcon =
34
34
  | string
35
35
  | React.ReactNode
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ModalHeaderProps } from '../../modal/parts/ModalHeader';
3
- interface DialogHeaderProps extends ModalHeaderProps {
3
+ import type { SpacingProps } from '../../space/types';
4
+ interface DialogHeaderProps extends ModalHeaderProps, SpacingProps {
4
5
  titleClass?: string;
5
6
  }
6
7
  export default function DialogHeader({ className, titleClass, size, ref, // eslint-disable-line
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import type { FormLabelLabelDirection, FormLabelText } from '../FormLabel';
3
- import type { ButtonIconPosition, ButtonVariant } from '../button';
3
+ import type { ButtonIconPosition, ButtonVariant } from '../Button';
4
4
  import type {
5
5
  FormStatusProps,
6
6
  FormStatusState,
@@ -3,7 +3,7 @@
3
3
  *
4
4
  */
5
5
  import React from 'react';
6
- import { ButtonProps } from '../button/Button';
6
+ import type { ButtonProps } from '../button/Button';
7
7
  import { ModalProps } from '../modal/types';
8
8
  export declare type HelpButtonProps = {
9
9
  modal_content?: React.ReactNode;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { ButtonIconPosition, ButtonVariant } from '../button';
2
+ import type { ButtonIconPosition, ButtonVariant } from '../Button';
3
3
  import type {
4
4
  FormStatusProps,
5
5
  FormStatusState,
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import type { Locale } from '../../shared/Context';
3
- import type { ButtonIconPosition } from '../button';
3
+ import type { ButtonIconPosition } from '../Button';
4
4
  import type { FormLabelLabelDirection, FormLabelText } from '../FormLabel';
5
5
  import type {
6
6
  FormStatusProps,
@@ -33,6 +33,7 @@ export default class ModalContent extends React.PureComponent<ModalContentProps,
33
33
  _androidFocusTimeout: NodeJS.Timeout;
34
34
  _ii: InteractionInvalidation;
35
35
  _iiLocal: InteractionInvalidation;
36
+ static contextType: React.Context<import("../../shared/Context").ContextProps>;
36
37
  constructor(props: ModalContentProps);
37
38
  componentDidMount(): void;
38
39
  componentWillUnmount(): void;
@@ -21,6 +21,10 @@ var _helpers = require("../../shared/helpers");
21
21
 
22
22
  var _helpers2 = require("./helpers");
23
23
 
24
+ var _Theme = require("../../shared/Theme");
25
+
26
+ var _shared = require("../../shared");
27
+
24
28
  const _excluded = ["triggeredBy"],
25
29
  _excluded2 = ["hide", "title", "labelled_by", "id", "close_title", "dialog_title", "hide_close_button", "close_button_attributes", "no_animation", "no_animation_on_mobile", "fullscreen", "container_placement", "close", "content_class", "overlay_class", "content_id", "children", "dialog_role"];
26
30
 
@@ -317,6 +321,8 @@ class ModalContent extends _react.default.PureComponent {
317
321
  }
318
322
 
319
323
  render() {
324
+ var _this$context;
325
+
320
326
  const _this$props2 = this.props,
321
327
  {
322
328
  hide,
@@ -357,7 +363,7 @@ class ModalContent extends _react.default.PureComponent {
357
363
  'aria-labelledby': (0, _componentHelper.combineLabelledBy)(this.props, title ? contentId + '-title' : null, labelled_by),
358
364
  'aria-describedby': (0, _componentHelper.combineDescribedBy)(this.props, contentId + '-content'),
359
365
  'aria-label': !title && !labelled_by ? dialog_title : undefined,
360
- className: (0, _classnames.default)('dnb-modal__content', (0, _componentHelper.isTrue)(fullscreen) ? 'dnb-modal__content--fullscreen' : fullscreen === 'auto' && 'dnb-modal__content--auto-fullscreen', content_class, container_placement && `dnb-modal__content--${container_placement || 'right'}`),
366
+ className: (0, _classnames.default)('dnb-modal__content', (0, _componentHelper.isTrue)(fullscreen) ? 'dnb-modal__content--fullscreen' : fullscreen === 'auto' && 'dnb-modal__content--auto-fullscreen', (0, _Theme.getThemeClasses)((_this$context = this.context) === null || _this$context === void 0 ? void 0 : _this$context.theme), content_class, container_placement && `dnb-modal__content--${container_placement || 'right'}`),
361
367
  onMouseDown: this.onContentMouseDownHandler,
362
368
  onClick: this.onContentClickHandler
363
369
  };
@@ -394,4 +400,6 @@ class ModalContent extends _react.default.PureComponent {
394
400
 
395
401
  }
396
402
 
397
- exports.default = ModalContent;
403
+ exports.default = ModalContent;
404
+
405
+ _defineProperty(ModalContent, "contextType", _shared.Context);
@@ -3,7 +3,7 @@
3
3
  *
4
4
  */
5
5
  import React from 'react';
6
- import { ButtonProps } from '../../button';
6
+ import type { ButtonProps } from '../../button/Button';
7
7
  export declare type CloseButtonProps = {
8
8
  /**
9
9
  * The title of the close button. Defaults to <em>Close</em> or <em>Lukk</em>.
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import { CloseButtonProps } from './parts/CloseButton';
3
- import { ButtonProps } from '../button/Button';
4
- import { ModalRootProps } from './ModalRoot';
2
+ import type { CloseButtonProps } from './parts/CloseButton';
3
+ import type { ButtonProps } from '../button/Button';
4
+ import type { ModalRootProps } from './ModalRoot';
5
5
  export declare type ReactChildType = React.ReactNode | ((...args: any[]) => any);
6
6
  export declare type ModalFullscreen = 'auto' | boolean;
7
7
  export declare type ModalAlignContent = 'left' | 'center' | 'centered' | 'right';
@@ -34,170 +34,170 @@ type PaginationIndicatorElement =
34
34
  | ((...args: any[]) => any)
35
35
  | string;
36
36
  type PaginationChildren = React.ReactNode | ((...args: any[]) => any);
37
- interface PaginationProps
37
+ export interface PaginationProps
38
38
  extends React.HTMLProps<HTMLElement>,
39
39
  SpacingProps {
40
40
  /**
41
41
  * The page shown in the very beginning. If `current_page` is set, then it may not make too much sense to set this as well.
42
42
  */
43
43
  startup_page?: PaginationStartupPage;
44
+
44
45
  /**
45
46
  * The page shown at the moment the component renders. Defaults to `1`.
46
47
  */
47
-
48
48
  current_page?: PaginationCurrentPage;
49
+
49
50
  /**
50
51
  * The total pages count. Defaults to `1`.
51
52
  */
52
-
53
53
  page_count?: PaginationPageCount;
54
+
54
55
  /**
55
56
  * Defines how many `infinity` pages should be loaded / shown on the first render. Defaults to `1`.
56
57
  */
57
-
58
58
  startup_count?: PaginationStartupCount;
59
+
59
60
  /**
60
61
  * Defines how many `infinity` pages should be loaded / shown once the user scrolls down. Defaults to `1`.
61
62
  */
62
-
63
63
  parallel_load_count?: PaginationParallelLoadCount;
64
+
64
65
  /**
65
66
  * If set to `true`, the infinity marker will be placed before the content (on top off). This could potentially have negative side effects. But it depends really on the content if this would make more sense to use instead. Defaults to `false`.
66
67
  */
67
-
68
68
  place_maker_before_content?: boolean;
69
+
69
70
  /**
70
71
  * The minimum time to wait, if the infinity scroll was invoked under that time threshold. This prevents not intentional infinity scroll loop calls. Defaults to `400` milliseconds.
71
72
  */
72
-
73
73
  min_wait_time?: PaginationMinWaitTime;
74
+
74
75
  /**
75
76
  * If set to `true`, all pagination bar buttons are disabled.
76
77
  */
77
-
78
78
  disabled?: boolean;
79
+
79
80
  /**
80
81
  * If set to `true`, an overlaying skeleton with animation will be shown.
81
82
  */
82
-
83
83
  skeleton?: SkeletonShow;
84
+
84
85
  /**
85
86
  * 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`.
86
87
  */
87
-
88
88
  mode?: PaginationMode;
89
+
89
90
  /**
90
91
  * If set to `true` it will disable the automated infinity scrolling, but shows a load more button at the of the content instead.
91
92
  */
92
-
93
93
  use_load_button?: boolean;
94
94
  items?: PaginationItems;
95
+
95
96
  /**
96
97
  * If set to `true` no indicator will be shown.
97
98
  */
98
-
99
99
  hide_progress_indicator?: boolean;
100
+
100
101
  /**
101
102
  * Callback function to get the `setContent` handler from the current pagination instance. e.g. `set_content_handler={fn => (...)}`. Use this handler to insert content during infinity mode.
102
103
  */
103
-
104
104
  set_content_handler?: PaginationSetContentHandler;
105
+
105
106
  /**
106
107
  * Callback function to get the `resetContent` handler from the current pagination instance. e.g. `reset_content_handler={fn => (...)}`. Use this handler to reset all the content. You can set it to `true`, to programmatically reset the content.
107
108
  */
108
-
109
109
  reset_content_handler?: PaginationResetContentHandler;
110
+
110
111
  /**
111
112
  * Callback function to get the `resetInfinity` handler from the current pagination instance. e.g. `reset_pagination_handler={fn => (...)}`. Use this handler to reset all the internal states. You can set it to `true`, to programmatically reset the states.
112
113
  */
113
-
114
114
  reset_pagination_handler?: PaginationResetPaginationHandler;
115
+
115
116
  /**
116
117
  * Callback function to get the `endInfinity` handler from the current pagination instance. e.g. `end_infinity_handler={fn => (...)}`. Use this handler to end the infinity scrolling procedure, in case the `page_count` is unknown.
117
118
  */
118
-
119
119
  end_infinity_handler?: PaginationEndInfinityHandler;
120
+
120
121
  /**
121
122
  * By default a `<div>` is used. Set it to any element you have to use. Adds also a class: `dnb-pagination__page` shown.
122
123
  */
123
-
124
124
  page_element?: PaginationPageElement;
125
+
125
126
  /**
126
127
  * (infinity mode) is used by the <em>indicator</em>, <em>load more</em> bar as well as by the marker. Defaults to a `div`.
127
128
  */
128
-
129
129
  fallback_element?: PaginationFallbackElement;
130
+
130
131
  /**
131
132
  * (infinity mode) is used by the internal marker. Falls back to `fallback_element` if not defined.
132
133
  */
133
-
134
134
  marker_element?: PaginationMarkerElement;
135
+
135
136
  /**
136
137
  * (infinity mode) is used by the <em>indicator</em>. Falls back to `fallback_element` if not defined.
137
138
  */
138
-
139
139
  indicator_element?: PaginationIndicatorElement;
140
+
140
141
  /**
141
142
  * Define the alignment of the pagination button bar. Can be `center`, `left` or `right`. Defaults to `left`.
142
143
  */
143
-
144
144
  align?: string;
145
+
145
146
  /**
146
147
  * The title used in every button shown in the bar. Defaults to `Side %s`.
147
148
  */
148
-
149
149
  button_title?: string;
150
+
150
151
  /**
151
152
  * The title used in the previous page button. Defaults to `Forrige side`.
152
153
  */
153
-
154
154
  prev_title?: string;
155
+
155
156
  /**
156
157
  * The title used in the next page button. Defaults to `Neste side`.
157
158
  */
158
-
159
159
  next_title?: string;
160
+
160
161
  /**
161
162
  * The title used in the dots. Relevant for screen-readers. Defaults to `%s flere sider`.
162
163
  */
163
-
164
164
  more_pages?: string;
165
+
165
166
  /**
166
167
  * Shown until new content is inserted in to the page. Defaults to `Laster nytt innhold`.
167
168
  */
168
-
169
169
  is_loading_text?: string;
170
+
170
171
  /**
171
- * 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`.
172
+ * 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`.
172
173
  */
173
-
174
174
  load_button_text?: string;
175
175
  class?: string;
176
176
  className?: string;
177
+
177
178
  /**
178
179
  * The given content can be either a function or a React node, depending on your needs. A function contains several helper functions. More details down below and have a look at the examples in the demos section.
179
180
  */
180
-
181
181
  children?: PaginationChildren;
182
+
182
183
  /**
183
184
  * Will be called for every page change, regardless if the mode is `mode="infinity"` or not. Returns an object with number of useful properties and methods. See below for more details.
184
185
  */
185
-
186
186
  on_change?: (...args: any[]) => any;
187
+
187
188
  /**
188
189
  * Only on "infinity" mode. Will be called once the component is ready for interaction. Returns an object with number of useful properties and methods. See below for more details. "NB:" Will be called again as soon as we reset the content by calling `resetContent()`.
189
190
  */
190
-
191
191
  on_startup?: (...args: any[]) => any;
192
+
192
193
  /**
193
194
  * Only on "infinity" mode. Will be called on every page interaction, also on the very first interaction. Returns an object with number of useful properties and methods. See below for more details.
194
195
  */
195
-
196
196
  on_load?: (...args: any[]) => any;
197
+
197
198
  /**
198
199
  * Only on "infinity" mode. Will be called once `page_count` is reached or `endInfinity` was called.
199
200
  */
200
-
201
201
  on_end?: (...args: any[]) => any;
202
202
  }
203
203
  export default class Pagination extends React.Component<
@@ -13,6 +13,10 @@ var _componentHelper = require("../../shared/component-helper");
13
13
 
14
14
  var _TooltipContainer = _interopRequireDefault(require("./TooltipContainer"));
15
15
 
16
+ var _shared = require("../../shared");
17
+
18
+ var _Theme = require("../../shared/Theme");
19
+
16
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
21
 
18
22
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -45,12 +49,13 @@ function TooltipPortal(props) {
45
49
  const isInDOM = _react.default.useRef(false);
46
50
 
47
51
  const hasGroup = props.group;
52
+ const theme = (0, _shared.useTheme)();
48
53
 
49
54
  const makePortal = () => {
50
55
  if (!tooltipPortal[id]) {
51
56
  tooltipPortal[id] = {
52
57
  count: 0,
53
- node: hasGroup ? createGroupElement(id) : createRootElement()
58
+ node: hasGroup ? createGroupElement(theme, id) : createRootElement(theme)
54
59
  };
55
60
  }
56
61
  };
@@ -76,7 +81,7 @@ function TooltipPortal(props) {
76
81
  if (hasGroup) {
77
82
  _reactDom.default.unmountComponentAtNode(ref.node);
78
83
 
79
- createRootElement().removeChild(ref.node);
84
+ createRootElement(theme).removeChild(ref.node);
80
85
  }
81
86
 
82
87
  delete tooltipPortal[id];
@@ -169,20 +174,24 @@ function TooltipPortal(props) {
169
174
  var _default = TooltipPortal;
170
175
  exports.default = _default;
171
176
 
172
- const createGroupElement = id => {
177
+ const createGroupElement = (theme, id) => {
173
178
  try {
174
179
  const elem = document.createElement('div');
175
180
  elem.classList.add('dnb-tooltip__group');
176
181
  elem.setAttribute('id', id);
177
- createRootElement().appendChild(elem);
182
+ createRootElement(theme).appendChild(elem);
178
183
  return elem;
179
184
  } catch (e) {
180
185
  (0, _componentHelper.warn)(e);
181
186
  }
182
187
  };
183
188
 
184
- const createRootElement = function () {
185
- let className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'dnb-tooltip__portal';
189
+ const createRootElement = function (theme) {
190
+ let className = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
191
+
192
+ if (!className) {
193
+ className = 'dnb-tooltip__portal';
194
+ }
186
195
 
187
196
  try {
188
197
  const element = document.querySelector(`.${className}`);
@@ -194,6 +203,11 @@ const createRootElement = function () {
194
203
  const elem = document.createElement('div');
195
204
  elem.classList.add(className);
196
205
  elem.classList.add('dnb-core-style');
206
+
207
+ if (theme) {
208
+ elem.classList.add.call(elem.classList, ...(0, _Theme.getThemeClasses)(theme).split(' '));
209
+ }
210
+
197
211
  document.body.appendChild(elem);
198
212
  return elem;
199
213
  } catch (e) {
@@ -3,6 +3,8 @@
3
3
  *
4
4
  */
5
5
  import React from 'react';
6
+ import { SpacingProps } from '../../components/space/types';
7
+ export declare type DivProps = SpacingProps & React.HTMLAttributes<HTMLElement>;
6
8
  declare const Div: React.ForwardRefExoticComponent<import("../../components/space/types").SpacingElementProps & {
7
9
  space?: import("../../components/space/types").SpaceType | import("../../components/space/types").SpacingElementProps;
8
10
  } & React.HTMLAttributes<HTMLElement> & React.RefAttributes<unknown>>;
@@ -16,6 +16,8 @@ var _keycode = _interopRequireDefault(require("keycode"));
16
16
 
17
17
  var _componentHelper = require("../../shared/component-helper");
18
18
 
19
+ var _Theme = require("../../shared/Theme");
20
+
19
21
  var _SpacingHelper = require("../../components/space/SpacingHelper");
20
22
 
21
23
  var _DrawerListContext = _interopRequireDefault(require("./DrawerListContext"));
@@ -144,6 +146,8 @@ class DrawerListInstance extends _react.default.PureComponent {
144
146
  }
145
147
 
146
148
  render() {
149
+ var _this$context2;
150
+
147
151
  const props = (0, _componentHelper.extendPropsWithContextInClassComponent)(this.props, DrawerList.defaultProps, this.context.getTranslation(this.props).DrawerList);
148
152
 
149
153
  const {
@@ -299,7 +303,7 @@ class DrawerListInstance extends _react.default.PureComponent {
299
303
  include_owner_width: align_drawer === 'right',
300
304
  independent_width: (0, _componentHelper.isTrue)(independent_width),
301
305
  fixed_position: (0, _componentHelper.isTrue)(fixed_position),
302
- className: portal_class
306
+ className: (0, _Theme.getThemeClasses)((_this$context2 = this.context) === null || _this$context2 === void 0 ? void 0 : _this$context2.theme, portal_class)
303
307
  }, mainList) : mainList);
304
308
  }
305
309
 
@@ -9,7 +9,7 @@ function init() {
9
9
  if (typeof window !== 'undefined') {
10
10
  class Eufemia {
11
11
  get version() {
12
- return '10.0.0-beta.5';
12
+ return '10.0.0-beta.6';
13
13
  }
14
14
 
15
15
  }
@@ -13,7 +13,15 @@ export declare type ThemeProps = {
13
13
  variant?: ThemeVariants;
14
14
  size?: ThemeSizes;
15
15
  colorMapping?: ColorMapping;
16
- element?: DynamicElement;
16
+ element?: DynamicElement | false;
17
17
  };
18
18
  export declare type ThemeAllProps = ThemeProps & React.HTMLAttributes<HTMLElement>;
19
19
  export default function Theme(themeProps: ThemeAllProps): JSX.Element;
20
+ export declare function ThemeWrapper({ children, theme, element, className, ...rest }: {
21
+ [x: string]: any;
22
+ children: any;
23
+ theme: any;
24
+ element?: any;
25
+ className?: any;
26
+ }): any;
27
+ export declare function getThemeClasses(theme: ThemeProps, className?: any): any;
@@ -3,7 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.ThemeWrapper = ThemeWrapper;
6
7
  exports.default = Theme;
8
+ exports.getThemeClasses = getThemeClasses;
7
9
 
8
10
  var _react = _interopRequireDefault(require("react"));
9
11
 
@@ -13,19 +15,15 @@ var _Context = _interopRequireDefault(require("./Context"));
13
15
 
14
16
  var _Provider = _interopRequireDefault(require("./Provider"));
15
17
 
16
- const _excluded = ["children", "element"],
17
- _excluded2 = ["name", "variant", "size", "colorMapping"];
18
+ var _componentHelper = require("./component-helper");
19
+
20
+ const _excluded = ["children", "element", "name", "variant", "size", "colorMapping"],
21
+ _excluded2 = ["children", "theme", "element", "className"];
18
22
 
19
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
24
 
21
25
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
22
26
 
23
- 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; }
24
-
25
- 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; }
26
-
27
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
28
-
29
27
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
30
28
 
31
29
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -35,45 +33,72 @@ function Theme(themeProps) {
35
33
 
36
34
  const {
37
35
  children,
38
- element
36
+ element,
37
+ name,
38
+ variant,
39
+ size,
40
+ colorMapping
39
41
  } = themeProps,
40
- theme = _objectWithoutProperties(themeProps, _excluded);
41
-
42
- const currentTheme = _objectSpread(_objectSpread({}, context === null || context === void 0 ? void 0 : context.theme), theme);
42
+ restProps = _objectWithoutProperties(themeProps, _excluded);
43
43
 
44
+ const theme = (0, _componentHelper.extendPropsWithContext)({
45
+ name,
46
+ variant,
47
+ size,
48
+ colorMapping
49
+ }, null, context === null || context === void 0 ? void 0 : context.theme);
44
50
  return _react.default.createElement(_Provider.default, {
45
- theme: currentTheme
46
- }, _react.default.createElement(ThemeWrapper, {
51
+ theme: theme
52
+ }, _react.default.createElement(ThemeWrapper, _extends({
47
53
  element: element,
48
- currentTheme: currentTheme
49
- }, children));
54
+ theme: theme
55
+ }, restProps), children));
50
56
  }
51
57
 
52
58
  function ThemeWrapper(_ref) {
53
59
  let {
54
60
  children,
55
- element,
56
- currentTheme
57
- } = _ref;
58
-
59
- const {
60
- name,
61
- variant,
62
- size,
63
- colorMapping
64
- } = currentTheme,
65
- rest = _objectWithoutProperties(currentTheme, _excluded2);
61
+ theme,
62
+ element = null,
63
+ className = null
64
+ } = _ref,
65
+ rest = _objectWithoutProperties(_ref, _excluded2);
66
66
 
67
- const Wrapper = element || 'div';
67
+ const Wrapper = element === false ? _react.default.Fragment : element || 'div';
68
68
 
69
69
  const ref = _react.default.useRef(null);
70
70
 
71
+ if (Wrapper === _react.default.Fragment) {
72
+ return children;
73
+ }
74
+
71
75
  rest['ref'] = ref;
72
- const className = (0, _classnames.default)('eufemia-theme', name && `eufemia-theme__${name}` + (variant ? ` eufemia-theme__${name}--${variant}` : ""), colorMapping && `eufemia-theme__color-mapping--${colorMapping}`, size && `eufemia-theme__size--${size}`);
76
+ const classNames = getThemeClasses(theme, className);
77
+ const {
78
+ name,
79
+ variant,
80
+ size
81
+ } = theme;
73
82
  return _react.default.createElement(Wrapper, _extends({
74
83
  "data-name": name,
75
84
  "data-variant": variant,
76
85
  "data-size": size,
77
- className: className
86
+ className: classNames
78
87
  }, rest), children);
88
+ }
89
+
90
+ function getThemeClasses(theme) {
91
+ let className = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
92
+
93
+ if (!theme) {
94
+ return className;
95
+ }
96
+
97
+ const {
98
+ name,
99
+ variant,
100
+ size,
101
+ colorMapping
102
+ } = theme;
103
+ return (0, _classnames.default)(className, 'eufemia-theme', name && `eufemia-theme__${name}` + (variant ? ` eufemia-theme__${name}--${variant}` : ""), colorMapping && `eufemia-theme__color-mapping--${colorMapping}`, size && `eufemia-theme__size--${size}`);
79
104
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { ButtonIconPosition } from '../button';
2
+ import type { ButtonIconPosition } from '../Button';
3
3
  import type { HeadingLevel } from '../Heading';
4
4
  import type { IconIcon, IconSize } from '../Icon';
5
5
  import type { SkeletonShow } from '../Skeleton';
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { ButtonIconPosition } from '../button';
2
+ import type { ButtonIconPosition } from '../Button';
3
3
  import type { HeadingLevel } from '../Heading';
4
4
  import type { IconSize } from '../Icon';
5
5
  import type { SkeletonShow } from '../Skeleton';