@equinor/eds-core-react 0.42.6-dev-11212024 → 0.43.0-dev-01062025

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 (31) hide show
  1. package/dist/eds-core-react.cjs +32 -47
  2. package/dist/esm/components/Accordion/AccordionHeader.js +2 -2
  3. package/dist/esm/components/Accordion/index.js +1 -0
  4. package/dist/esm/components/Banner/index.js +1 -0
  5. package/dist/esm/components/Breadcrumbs/index.js +1 -0
  6. package/dist/esm/components/Button/ToggleButton/ToggleButton.js +2 -2
  7. package/dist/esm/components/Button/index.js +1 -0
  8. package/dist/esm/components/Card/index.js +1 -0
  9. package/dist/esm/components/Dialog/index.js +1 -0
  10. package/dist/esm/components/EdsProvider/eds.context.js +3 -1
  11. package/dist/esm/components/Icon/Icon.js +6 -19
  12. package/dist/esm/components/Icon/library.js +1 -6
  13. package/dist/esm/components/Label/Label.js +10 -14
  14. package/dist/esm/components/List/index.js +1 -0
  15. package/dist/esm/components/Menu/MenuList.js +2 -2
  16. package/dist/esm/components/Menu/index.js +1 -0
  17. package/dist/esm/components/Popover/index.js +1 -0
  18. package/dist/esm/components/SideBar/index.js +1 -0
  19. package/dist/esm/components/Snackbar/index.js +1 -0
  20. package/dist/esm/components/Table/index.js +1 -0
  21. package/dist/esm/components/TableOfContents/index.js +1 -0
  22. package/dist/esm/components/Tabs/index.js +1 -0
  23. package/dist/esm/components/Tooltip/Tooltip.js +7 -1
  24. package/dist/esm/components/TopBar/index.js +1 -0
  25. package/dist/esm/index.js +1 -0
  26. package/dist/types/components/EdsProvider/eds.context.d.ts +2 -0
  27. package/dist/types/components/Icon/Icon.d.ts +1 -1
  28. package/dist/types/components/Icon/Icon.types.d.ts +1 -5
  29. package/dist/types/components/Icon/library.d.ts +2 -2
  30. package/dist/types/components/Tooltip/Tooltip.d.ts +8 -0
  31. package/package.json +35 -34
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var react = require('react');
@@ -912,7 +913,8 @@ const initalState$2 = {
912
913
  const EdsContext = /*#__PURE__*/react.createContext(initalState$2);
913
914
  const EdsProvider = ({
914
915
  children,
915
- density
916
+ density,
917
+ rootElement
916
918
  }) => {
917
919
  const [state, setState] = react.useState({
918
920
  ...initalState$2,
@@ -929,6 +931,7 @@ const EdsProvider = ({
929
931
  }, [density, state.density]);
930
932
  const value = {
931
933
  density: state.density,
934
+ rootElement,
932
935
  setDensity
933
936
  };
934
937
  return /*#__PURE__*/jsxRuntime.jsx(EdsContext.Provider, {
@@ -1148,11 +1151,15 @@ const Tooltip$2 = /*#__PURE__*/react.forwardRef(function Tooltip({
1148
1151
  children,
1149
1152
  style,
1150
1153
  enterDelay = 100,
1154
+ portalContainer,
1151
1155
  ...rest
1152
1156
  }, ref) {
1153
1157
  const arrowRef = react.useRef(null);
1154
1158
  const [open, setOpen] = react.useState(false);
1155
1159
  const shouldOpen = title !== '' && typeof document !== 'undefined';
1160
+ const {
1161
+ rootElement
1162
+ } = useEds();
1156
1163
  const {
1157
1164
  x,
1158
1165
  y,
@@ -1240,6 +1247,7 @@ const Tooltip$2 = /*#__PURE__*/react.forwardRef(function Tooltip({
1240
1247
  ...rest,
1241
1248
  ...getFloatingProps({
1242
1249
  ref: tooltipRef,
1250
+ className: `eds-tooltip ${rest.className ?? ''}`,
1243
1251
  style: {
1244
1252
  ...style,
1245
1253
  position: strategy,
@@ -1258,7 +1266,7 @@ const Tooltip$2 = /*#__PURE__*/react.forwardRef(function Tooltip({
1258
1266
  })]
1259
1267
  });
1260
1268
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1261
- children: [shouldOpen && open && /*#__PURE__*/reactDom.createPortal(TooltipEl, document.body), updatedChildren]
1269
+ children: [shouldOpen && open && /*#__PURE__*/reactDom.createPortal(TooltipEl, portalContainer ?? rootElement ?? document.body), updatedChildren]
1262
1270
  });
1263
1271
  });
1264
1272
 
@@ -1277,7 +1285,7 @@ const ToggleButton = /*#__PURE__*/react.forwardRef(function ToggleButton({
1277
1285
  }, [selectedIndexes]);
1278
1286
  function updateProps(child, isSelected, index) {
1279
1287
  const childElement = child;
1280
- if ( /*#__PURE__*/react.isValidElement(child)) {
1288
+ if (/*#__PURE__*/react.isValidElement(child)) {
1281
1289
  const buttonProps = {
1282
1290
  'aria-pressed': isSelected ? true : undefined,
1283
1291
  variant: isSelected ? 'contained' : 'outlined',
@@ -1299,7 +1307,7 @@ const ToggleButton = /*#__PURE__*/react.forwardRef(function ToggleButton({
1299
1307
  const updatedChildren = react.Children.map(children, (child, index) => {
1300
1308
  const isSelected = pickedIndexes.includes(index);
1301
1309
  const childElement = child;
1302
- if ( /*#__PURE__*/react.isValidElement(child) && child.type === Tooltip$2) {
1310
+ if (/*#__PURE__*/react.isValidElement(child) && child.type === Tooltip$2) {
1303
1311
  const updatedGrandChildren = react.Children.map(childElement.props.children, grandChild => {
1304
1312
  return updateProps(grandChild, isSelected, index);
1305
1313
  });
@@ -2283,20 +2291,16 @@ const Label$3 = /*#__PURE__*/react.forwardRef(function Label(props, ref) {
2283
2291
  disabled = false,
2284
2292
  ...other
2285
2293
  } = props;
2286
- return (
2287
- /*#__PURE__*/
2288
- /* @TODO: Other props spread has to be at the end for downshift to create the for attribute */
2289
- jsxRuntime.jsxs(LabelBase, {
2290
- ref: ref,
2291
- $disabledText: disabled,
2292
- ...other,
2293
- children: [/*#__PURE__*/jsxRuntime.jsx(Text$3, {
2294
- children: label
2295
- }), meta && /*#__PURE__*/jsxRuntime.jsx(Text$3, {
2296
- children: meta
2297
- })]
2298
- })
2299
- );
2294
+ return /*#__PURE__*/ /* @TODO: Other props spread has to be at the end for downshift to create the for attribute */jsxRuntime.jsxs(LabelBase, {
2295
+ ref: ref,
2296
+ $disabledText: disabled,
2297
+ ...other,
2298
+ children: [/*#__PURE__*/jsxRuntime.jsx(Text$3, {
2299
+ children: label
2300
+ }), meta && /*#__PURE__*/jsxRuntime.jsx(Text$3, {
2301
+ children: meta
2302
+ })]
2303
+ });
2300
2304
  });
2301
2305
 
2302
2306
  // Label.displayName = 'eds-text-field-label'
@@ -3086,7 +3090,6 @@ const TextField = /*#__PURE__*/react.forwardRef(function TextField({
3086
3090
  });
3087
3091
 
3088
3092
  let _icons = {};
3089
- let count = 0;
3090
3093
  /** Add icons to library to be used for rendering using name.
3091
3094
  This needs to be done lonly once */
3092
3095
  const add = icons => {
@@ -3096,11 +3099,7 @@ const add = icons => {
3096
3099
  };
3097
3100
  };
3098
3101
  const get = name => {
3099
- count += 1;
3100
- return {
3101
- icon: _icons[name],
3102
- count
3103
- };
3102
+ return _icons[name];
3104
3103
  };
3105
3104
 
3106
3105
  const StyledSvg = styled__default.default.svg.attrs(({
@@ -3131,24 +3130,14 @@ const StyledPath$2 = styled__default.default.path.attrs(({
3131
3130
  displayName: "Icon__StyledPath",
3132
3131
  componentId: "sc-6evbi1-1"
3133
3132
  })([""]);
3134
- const customIcon = icon => ({
3135
- icon,
3136
- count: Math.floor(Math.random() * 1000)
3137
- });
3138
3133
  const findIcon = (name, data, size) => {
3139
3134
  // eslint-disable-next-line prefer-const
3140
- let {
3141
- icon,
3142
- count
3143
- } = data ? customIcon(data) : get(name);
3135
+ const icon = data ?? get(name);
3144
3136
  if (size < 24) {
3145
3137
  // fallback to normal icon if small is not made yet
3146
- icon = icon.sizes?.small || icon;
3138
+ return icon.sizes?.small || icon;
3147
3139
  }
3148
- return {
3149
- icon,
3150
- count
3151
- };
3140
+ return icon;
3152
3141
  };
3153
3142
  const Icon$2 = /*#__PURE__*/react.forwardRef(function Icon({
3154
3143
  size,
@@ -3160,10 +3149,7 @@ const Icon$2 = /*#__PURE__*/react.forwardRef(function Icon({
3160
3149
  ...rest
3161
3150
  }, ref) {
3162
3151
  // eslint-disable-next-line prefer-const
3163
- const {
3164
- icon,
3165
- count
3166
- } = findIcon(name, data, size);
3152
+ const icon = findIcon(name, data, size);
3167
3153
  if (typeof icon === 'undefined') {
3168
3154
  throw Error(`Icon "${name}" not found. Have you added it using Icon.add() or using data props?`);
3169
3155
  }
@@ -3184,9 +3170,8 @@ const Icon$2 = /*#__PURE__*/react.forwardRef(function Icon({
3184
3170
  };
3185
3171
 
3186
3172
  // Accessibility
3187
- let titleId = '';
3173
+ const titleId = edsUtils.useId(null, `${icon.prefix}-${icon.name}`);
3188
3174
  if (title) {
3189
- titleId = `${icon.prefix}-${icon.name}-${count}`;
3190
3175
  svgProps = {
3191
3176
  ...svgProps,
3192
3177
  title,
@@ -3659,7 +3644,7 @@ const AccordionHeader$1 = /*#__PURE__*/react.forwardRef(function AccordionHeader
3659
3644
  children: child
3660
3645
  });
3661
3646
  }
3662
- if ( /*#__PURE__*/react.isValidElement(child) && child.type === AccordionHeaderTitle) {
3647
+ if (/*#__PURE__*/react.isValidElement(child) && child.type === AccordionHeaderTitle) {
3663
3648
  return /*#__PURE__*/react.cloneElement(child, {
3664
3649
  isExpanded,
3665
3650
  disabled
@@ -3671,7 +3656,7 @@ const AccordionHeader$1 = /*#__PURE__*/react.forwardRef(function AccordionHeader
3671
3656
  return child;
3672
3657
  });
3673
3658
  const headerActions = react.Children.map(children, child => {
3674
- if ( /*#__PURE__*/react.isValidElement(child) && child.type === AccordionHeaderActions) {
3659
+ if (/*#__PURE__*/react.isValidElement(child) && child.type === AccordionHeaderActions) {
3675
3660
  return /*#__PURE__*/react.cloneElement(child, {
3676
3661
  isExpanded,
3677
3662
  disabled
@@ -7834,11 +7819,11 @@ const List = styled__default.default.div.withConfig({
7834
7819
  componentId: "sc-104rzof-0"
7835
7820
  })(["position:relative;list-style:none;display:flex;flex-direction:column;margin:0;", " li:first-child{z-index:3;}"], edsUtils.spacingsTemplate(menu.spacings));
7836
7821
  function isIndexable(item) {
7837
- if ( /*#__PURE__*/react.isValidElement(item) && !item.props.disabled && item.type === MenuItem$1) return true;
7822
+ if (/*#__PURE__*/react.isValidElement(item) && !item.props.disabled && item.type === MenuItem$1) return true;
7838
7823
  return false;
7839
7824
  }
7840
7825
  function closeMenuOnClick(item) {
7841
- if ( /*#__PURE__*/react.isValidElement(item) && item.type === MenuItem$1 && item.props.closeMenuOnClick !== false) return true;
7826
+ if (/*#__PURE__*/react.isValidElement(item) && item.type === MenuItem$1 && item.props.closeMenuOnClick !== false) return true;
7842
7827
  return false;
7843
7828
  }
7844
7829
  const MenuList = /*#__PURE__*/react.forwardRef(function MenuList({
@@ -123,7 +123,7 @@ const AccordionHeader = /*#__PURE__*/forwardRef(function AccordionHeader({
123
123
  children: child
124
124
  });
125
125
  }
126
- if ( /*#__PURE__*/isValidElement(child) && child.type === AccordionHeaderTitle) {
126
+ if (/*#__PURE__*/isValidElement(child) && child.type === AccordionHeaderTitle) {
127
127
  return /*#__PURE__*/cloneElement(child, {
128
128
  isExpanded,
129
129
  disabled
@@ -135,7 +135,7 @@ const AccordionHeader = /*#__PURE__*/forwardRef(function AccordionHeader({
135
135
  return child;
136
136
  });
137
137
  const headerActions = Children.map(children, child => {
138
- if ( /*#__PURE__*/isValidElement(child) && child.type === AccordionHeaderActions) {
138
+ if (/*#__PURE__*/isValidElement(child) && child.type === AccordionHeaderActions) {
139
139
  return /*#__PURE__*/cloneElement(child, {
140
140
  isExpanded,
141
141
  disabled
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { Accordion as Accordion$1 } from './Accordion.js';
2
3
  import { AccordionItem } from './AccordionItem.js';
3
4
  import { AccordionHeader } from './AccordionHeader.js';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { Banner as Banner$1 } from './Banner.js';
2
3
  import { BannerIcon } from './BannerIcon.js';
3
4
  import { BannerMessage } from './BannerMessage.js';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { Breadcrumbs as Breadcrumbs$1 } from './Breadcrumbs.js';
2
3
  import { Breadcrumb } from './Breadcrumb.js';
3
4
 
@@ -18,7 +18,7 @@ const ToggleButton = /*#__PURE__*/forwardRef(function ToggleButton({
18
18
  }, [selectedIndexes]);
19
19
  function updateProps(child, isSelected, index) {
20
20
  const childElement = child;
21
- if ( /*#__PURE__*/isValidElement(child)) {
21
+ if (/*#__PURE__*/isValidElement(child)) {
22
22
  const buttonProps = {
23
23
  'aria-pressed': isSelected ? true : undefined,
24
24
  variant: isSelected ? 'contained' : 'outlined',
@@ -40,7 +40,7 @@ const ToggleButton = /*#__PURE__*/forwardRef(function ToggleButton({
40
40
  const updatedChildren = Children.map(children, (child, index) => {
41
41
  const isSelected = pickedIndexes.includes(index);
42
42
  const childElement = child;
43
- if ( /*#__PURE__*/isValidElement(child) && child.type === Tooltip) {
43
+ if (/*#__PURE__*/isValidElement(child) && child.type === Tooltip) {
44
44
  const updatedGrandChildren = Children.map(childElement.props.children, grandChild => {
45
45
  return updateProps(grandChild, isSelected, index);
46
46
  });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { Button as Button$1 } from './Button.js';
2
3
  import { ButtonGroup } from './ButtonGroup/ButtonGroup.js';
3
4
  import { ToggleButton } from './ToggleButton/ToggleButton.js';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { Card as Card$1 } from './Card.js';
2
3
  import { CardActions } from './CardActions.js';
3
4
  import { CardContent } from './CardContent.js';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { Dialog as Dialog$1 } from './Dialog.js';
2
3
  import { DialogActions } from './DialogActions.js';
3
4
  import { DialogTitle } from './DialogTitle.js';
@@ -8,7 +8,8 @@ const initalState = {
8
8
  const EdsContext = /*#__PURE__*/createContext(initalState);
9
9
  const EdsProvider = ({
10
10
  children,
11
- density
11
+ density,
12
+ rootElement
12
13
  }) => {
13
14
  const [state, setState] = useState({
14
15
  ...initalState,
@@ -25,6 +26,7 @@ const EdsProvider = ({
25
26
  }, [density, state.density]);
26
27
  const value = {
27
28
  density: state.density,
29
+ rootElement,
28
30
  setDensity
29
31
  };
30
32
  return /*#__PURE__*/jsx(EdsContext.Provider, {
@@ -1,3 +1,4 @@
1
+ import { useId } from '@equinor/eds-utils';
1
2
  import { forwardRef } from 'react';
2
3
  import styled from 'styled-components';
3
4
  import { get } from './library.js';
@@ -31,24 +32,14 @@ const StyledPath = styled.path.attrs(({
31
32
  displayName: "Icon__StyledPath",
32
33
  componentId: "sc-6evbi1-1"
33
34
  })([""]);
34
- const customIcon = icon => ({
35
- icon,
36
- count: Math.floor(Math.random() * 1000)
37
- });
38
35
  const findIcon = (name, data, size) => {
39
36
  // eslint-disable-next-line prefer-const
40
- let {
41
- icon,
42
- count
43
- } = data ? customIcon(data) : get(name);
37
+ const icon = data ?? get(name);
44
38
  if (size < 24) {
45
39
  // fallback to normal icon if small is not made yet
46
- icon = icon.sizes?.small || icon;
40
+ return icon.sizes?.small || icon;
47
41
  }
48
- return {
49
- icon,
50
- count
51
- };
42
+ return icon;
52
43
  };
53
44
  const Icon = /*#__PURE__*/forwardRef(function Icon({
54
45
  size,
@@ -60,10 +51,7 @@ const Icon = /*#__PURE__*/forwardRef(function Icon({
60
51
  ...rest
61
52
  }, ref) {
62
53
  // eslint-disable-next-line prefer-const
63
- const {
64
- icon,
65
- count
66
- } = findIcon(name, data, size);
54
+ const icon = findIcon(name, data, size);
67
55
  if (typeof icon === 'undefined') {
68
56
  throw Error(`Icon "${name}" not found. Have you added it using Icon.add() or using data props?`);
69
57
  }
@@ -84,9 +72,8 @@ const Icon = /*#__PURE__*/forwardRef(function Icon({
84
72
  };
85
73
 
86
74
  // Accessibility
87
- let titleId = '';
75
+ const titleId = useId(null, `${icon.prefix}-${icon.name}`);
88
76
  if (title) {
89
- titleId = `${icon.prefix}-${icon.name}-${count}`;
90
77
  svgProps = {
91
78
  ...svgProps,
92
79
  title,
@@ -1,5 +1,4 @@
1
1
  let _icons = {};
2
- let count = 0;
3
2
  /** Add icons to library to be used for rendering using name.
4
3
  This needs to be done lonly once */
5
4
  const add = icons => {
@@ -9,11 +8,7 @@ const add = icons => {
9
8
  };
10
9
  };
11
10
  const get = name => {
12
- count += 1;
13
- return {
14
- icon: _icons[name],
15
- count
16
- };
11
+ return _icons[name];
17
12
  };
18
13
 
19
14
  export { add, get };
@@ -21,20 +21,16 @@ const Label = /*#__PURE__*/forwardRef(function Label(props, ref) {
21
21
  disabled = false,
22
22
  ...other
23
23
  } = props;
24
- return (
25
- /*#__PURE__*/
26
- /* @TODO: Other props spread has to be at the end for downshift to create the for attribute */
27
- jsxs(LabelBase, {
28
- ref: ref,
29
- $disabledText: disabled,
30
- ...other,
31
- children: [/*#__PURE__*/jsx(Text, {
32
- children: label
33
- }), meta && /*#__PURE__*/jsx(Text, {
34
- children: meta
35
- })]
36
- })
37
- );
24
+ return /*#__PURE__*/ /* @TODO: Other props spread has to be at the end for downshift to create the for attribute */jsxs(LabelBase, {
25
+ ref: ref,
26
+ $disabledText: disabled,
27
+ ...other,
28
+ children: [/*#__PURE__*/jsx(Text, {
29
+ children: label
30
+ }), meta && /*#__PURE__*/jsx(Text, {
31
+ children: meta
32
+ })]
33
+ });
38
34
  });
39
35
 
40
36
  // Label.displayName = 'eds-text-field-label'
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { List as List$1 } from './List.js';
2
3
  import { ListItem } from './ListItem.js';
3
4
 
@@ -12,11 +12,11 @@ const List = styled.div.withConfig({
12
12
  componentId: "sc-104rzof-0"
13
13
  })(["position:relative;list-style:none;display:flex;flex-direction:column;margin:0;", " li:first-child{z-index:3;}"], spacingsTemplate(menu.spacings));
14
14
  function isIndexable(item) {
15
- if ( /*#__PURE__*/isValidElement(item) && !item.props.disabled && item.type === MenuItem) return true;
15
+ if (/*#__PURE__*/isValidElement(item) && !item.props.disabled && item.type === MenuItem) return true;
16
16
  return false;
17
17
  }
18
18
  function closeMenuOnClick(item) {
19
- if ( /*#__PURE__*/isValidElement(item) && item.type === MenuItem && item.props.closeMenuOnClick !== false) return true;
19
+ if (/*#__PURE__*/isValidElement(item) && item.type === MenuItem && item.props.closeMenuOnClick !== false) return true;
20
20
  return false;
21
21
  }
22
22
  const MenuList = /*#__PURE__*/forwardRef(function MenuList({
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { Menu as Menu$1 } from './Menu.js';
2
3
  import { MenuItem } from './MenuItem.js';
3
4
  import { MenuSection } from './MenuSection.js';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { Popover as Popover$1 } from './Popover.js';
2
3
  import { PopoverTitle } from './PopoverTitle.js';
3
4
  import { PopoverContent } from './PopoverContent.js';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { SideBar as SideBar$1 } from './SideBar.js';
2
3
  import { SidebarLink } from './SidebarLink/index.js';
3
4
  import { SideBarContent } from './SideBarContent.js';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { SnackbarAction } from './SnackbarAction.js';
2
3
  import { Snackbar as Snackbar$1 } from './Snackbar.js';
3
4
 
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { Table as Table$1 } from './Table.js';
2
3
  import { Body } from './Body.js';
3
4
  import { Cell } from './Cell.js';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { TableOfContents as TableOfContents$1 } from './TableOfContents.js';
2
3
  import { LinkItem } from './LinkItem.js';
3
4
 
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { Tabs as Tabs$1 } from './Tabs.js';
2
3
  import { TabList } from './TabList.js';
3
4
  import { Tab } from './Tab.js';
@@ -5,6 +5,7 @@ import { typographyTemplate, spacingsTemplate, bordersTemplate, mergeRefs } from
5
5
  import { tooltip } from './Tooltip.tokens.js';
6
6
  import { useFloating, offset, flip, shift, arrow, autoUpdate, useInteractions, useHover, useFocus, useRole, useDismiss } from '@floating-ui/react';
7
7
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
8
+ import { useEds } from '../EdsProvider/eds.context.js';
8
9
 
9
10
  const StyledTooltip = styled('div').withConfig({
10
11
  shouldForwardProp: () => true //workaround to avoid warning until popover gets added to react types
@@ -26,11 +27,15 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip({
26
27
  children,
27
28
  style,
28
29
  enterDelay = 100,
30
+ portalContainer,
29
31
  ...rest
30
32
  }, ref) {
31
33
  const arrowRef = useRef(null);
32
34
  const [open, setOpen] = useState(false);
33
35
  const shouldOpen = title !== '' && typeof document !== 'undefined';
36
+ const {
37
+ rootElement
38
+ } = useEds();
34
39
  const {
35
40
  x,
36
41
  y,
@@ -118,6 +123,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip({
118
123
  ...rest,
119
124
  ...getFloatingProps({
120
125
  ref: tooltipRef,
126
+ className: `eds-tooltip ${rest.className ?? ''}`,
121
127
  style: {
122
128
  ...style,
123
129
  position: strategy,
@@ -136,7 +142,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip({
136
142
  })]
137
143
  });
138
144
  return /*#__PURE__*/jsxs(Fragment, {
139
- children: [shouldOpen && open && /*#__PURE__*/createPortal(TooltipEl, document.body), updatedChildren]
145
+ children: [shouldOpen && open && /*#__PURE__*/createPortal(TooltipEl, portalContainer ?? rootElement ?? document.body), updatedChildren]
140
146
  });
141
147
  });
142
148
 
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { TopBar as TopBar$1 } from './TopBar.js';
2
3
  import { Actions } from './Actions.js';
3
4
  import { Header } from './Header.js';
package/dist/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  export { Button } from './components/Button/index.js';
2
3
  export { Table } from './components/Table/index.js';
3
4
  export { Icon } from './components/Icon/index.js';
@@ -2,6 +2,7 @@ import { ReactNode } from 'react';
2
2
  export type Density = 'compact' | 'comfortable';
3
3
  type State = {
4
4
  density: Density;
5
+ rootElement?: HTMLElement | null;
5
6
  };
6
7
  type UseEdsProps<T> = {
7
8
  /** Use this to update the `density` from nested components in `EdsProvider` */
@@ -9,6 +10,7 @@ type UseEdsProps<T> = {
9
10
  } & T;
10
11
  export type EdsProviderProps = {
11
12
  density?: Density;
13
+ rootElement?: HTMLElement | null;
12
14
  children: ReactNode;
13
15
  };
14
16
  export declare const EdsProvider: React.FC<EdsProviderProps>;
@@ -1,5 +1,5 @@
1
- import { Ref, SVGProps } from 'react';
2
1
  import type { IconData } from '@equinor/eds-icons';
2
+ import { Ref, SVGProps } from 'react';
3
3
  import type { Name } from './Icon.types';
4
4
  export type IconProps = ({
5
5
  /** Title for icon when used semantically */
@@ -1,10 +1,6 @@
1
- import type { IconData, IconName } from '@equinor/eds-icons';
1
+ import type { IconName } from '@equinor/eds-icons';
2
2
  import { Icon } from './Icon';
3
3
  import { add } from './library';
4
- export type IconBasket = {
5
- icon?: IconData;
6
- count: number;
7
- };
8
4
  export type Name = IconName;
9
5
  export type IconType = typeof Icon & {
10
6
  add: typeof add;
@@ -1,8 +1,8 @@
1
1
  import type { IconData } from '@equinor/eds-icons';
2
- import type { IconBasket, Name } from './Icon.types';
2
+ import type { Name } from './Icon.types';
3
3
  type IconRecord = Record<Name, IconData>;
4
4
  /** Add icons to library to be used for rendering using name.
5
5
  This needs to be done lonly once */
6
6
  export declare const add: (icons: IconRecord) => void;
7
- export declare const get: (name: Name) => IconBasket;
7
+ export declare const get: (name: Name) => IconData | undefined;
8
8
  export {};
@@ -9,6 +9,10 @@ export type TooltipProps = {
9
9
  children: React.ReactElement & React.RefAttributes<HTMLElement>;
10
10
  /** Delay in ms, default 100 */
11
11
  enterDelay?: number;
12
+ /** Portal container
13
+ * @default document.body
14
+ * */
15
+ portalContainer?: HTMLElement;
12
16
  } & HTMLAttributes<HTMLDivElement>;
13
17
  export declare const Tooltip: import("react").ForwardRefExoticComponent<{
14
18
  /** Tooltip placement relative to anchor */
@@ -19,4 +23,8 @@ export declare const Tooltip: import("react").ForwardRefExoticComponent<{
19
23
  children: React.ReactElement & React.RefAttributes<HTMLElement>;
20
24
  /** Delay in ms, default 100 */
21
25
  enterDelay?: number;
26
+ /** Portal container
27
+ * @default document.body
28
+ * */
29
+ portalContainer?: HTMLElement;
22
30
  } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/eds-core-react",
3
- "version": "0.42.6-dev-11212024",
3
+ "version": "0.43.0-dev-01062025",
4
4
  "description": "The React implementation of the Equinor Design System",
5
5
  "sideEffects": [
6
6
  "**/*.css"
@@ -33,23 +33,23 @@
33
33
  ],
34
34
  "devDependencies": {
35
35
  "@rollup/plugin-babel": "^6.0.4",
36
- "@rollup/plugin-commonjs": "^27.0.0",
37
- "@rollup/plugin-node-resolve": "^15.3.0",
38
- "@storybook/addon-a11y": "^8.3.4",
39
- "@storybook/addon-actions": "^8.3.4",
40
- "@storybook/addon-docs": "^8.3.4",
41
- "@storybook/addon-essentials": "^8.3.4",
42
- "@storybook/addon-links": "^8.3.4",
43
- "@storybook/blocks": "^8.3.4",
44
- "@storybook/preview-api": "^8.3.4",
45
- "@storybook/react": "^8.3.4",
46
- "@storybook/react-vite": "^8.3.4",
36
+ "@rollup/plugin-commonjs": "^28.0.2",
37
+ "@rollup/plugin-node-resolve": "^16.0.0",
38
+ "@storybook/addon-a11y": "^8.4.7",
39
+ "@storybook/addon-actions": "^8.4.7",
40
+ "@storybook/addon-docs": "^8.4.7",
41
+ "@storybook/addon-essentials": "^8.4.7",
42
+ "@storybook/addon-links": "^8.4.7",
43
+ "@storybook/blocks": "^8.4.7",
44
+ "@storybook/preview-api": "^8.4.7",
45
+ "@storybook/react": "^8.4.7",
46
+ "@storybook/react-vite": "^8.4.7",
47
47
  "@testing-library/dom": "^10.4.0",
48
- "@testing-library/jest-dom": "^6.4.8",
49
- "@testing-library/react": "16.0.0",
48
+ "@testing-library/jest-dom": "^6.6.3",
49
+ "@testing-library/react": "16.1.0",
50
50
  "@testing-library/user-event": "14.5.2",
51
- "@types/jest": "^29.5.12",
52
- "@types/ramda": "^0.30.1",
51
+ "@types/jest": "^29.5.14",
52
+ "@types/ramda": "^0.30.2",
53
53
  "@types/react": "^18.3.3",
54
54
  "@types/react-dom": "^18.3.0",
55
55
  "babel-plugin-styled-components": "^2.1.4",
@@ -57,19 +57,20 @@
57
57
  "jest-environment-jsdom": "^29.7.0",
58
58
  "jest-styled-components": "^7.2.0",
59
59
  "js-file-download": "^0.4.12",
60
- "postcss": "^8.4.41",
60
+ "postcss": "^8.4.49",
61
61
  "ramda": "^0.30.1",
62
62
  "react": "^18.3.1",
63
63
  "react-dom": "^18.3.1",
64
- "react-hook-form": "^7.52.2",
64
+ "react-hook-form": "^7.54.2",
65
65
  "react-router-dom": "^6.26.0",
66
- "rollup": "^4.22.5",
66
+ "rollup": "^4.29.1",
67
67
  "rollup-plugin-delete": "^2.1.0",
68
68
  "rollup-plugin-postcss": "^4.0.2",
69
- "storybook": "^8.3.4",
70
- "styled-components": "6.1.12",
71
- "tsc-watch": "^6.2.0",
72
- "typescript": "^5.5.4"
69
+ "rollup-preserve-directives": "^1.1.3",
70
+ "storybook": "^8.4.7",
71
+ "styled-components": "6.1.13",
72
+ "tsc-watch": "^6.2.1",
73
+ "typescript": "^5.7.2"
73
74
  },
74
75
  "peerDependencies": {
75
76
  "react": ">=16.8",
@@ -77,19 +78,19 @@
77
78
  "styled-components": ">=5.1"
78
79
  },
79
80
  "dependencies": {
80
- "@babel/runtime": "^7.25.0",
81
- "@floating-ui/react": "^0.26.22",
82
- "@internationalized/date": "^3.5.5",
83
- "@react-aria/utils": "^3.25.1",
84
- "@react-stately/calendar": "^3.5.3",
85
- "@react-stately/datepicker": "^3.10.1",
86
- "@react-types/shared": "^3.24.1",
87
- "@tanstack/react-virtual": "3.10.8",
81
+ "@babel/runtime": "^7.26.0",
82
+ "@floating-ui/react": "^0.27.2",
83
+ "@internationalized/date": "^3.6.0",
84
+ "@react-aria/utils": "^3.26.0",
85
+ "@react-stately/calendar": "^3.6.0",
86
+ "@react-stately/datepicker": "^3.11.0",
87
+ "@react-types/shared": "^3.26.0",
88
+ "@tanstack/react-virtual": "3.11.2",
88
89
  "downshift": "9.0.8",
89
- "react-aria": "^3.34.1",
90
- "@equinor/eds-tokens": "0.9.2",
90
+ "react-aria": "^3.36.0",
91
91
  "@equinor/eds-icons": "^0.21.0",
92
- "@equinor/eds-utils": "0.8.5"
92
+ "@equinor/eds-utils": "0.8.5",
93
+ "@equinor/eds-tokens": "0.9.2"
93
94
  },
94
95
  "scripts": {
95
96
  "build": "rollup -c --bundleConfigAsCjs && tsc -p tsconfig.build.json",