@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.
- package/dist/eds-core-react.cjs +32 -47
- package/dist/esm/components/Accordion/AccordionHeader.js +2 -2
- package/dist/esm/components/Accordion/index.js +1 -0
- package/dist/esm/components/Banner/index.js +1 -0
- package/dist/esm/components/Breadcrumbs/index.js +1 -0
- package/dist/esm/components/Button/ToggleButton/ToggleButton.js +2 -2
- package/dist/esm/components/Button/index.js +1 -0
- package/dist/esm/components/Card/index.js +1 -0
- package/dist/esm/components/Dialog/index.js +1 -0
- package/dist/esm/components/EdsProvider/eds.context.js +3 -1
- package/dist/esm/components/Icon/Icon.js +6 -19
- package/dist/esm/components/Icon/library.js +1 -6
- package/dist/esm/components/Label/Label.js +10 -14
- package/dist/esm/components/List/index.js +1 -0
- package/dist/esm/components/Menu/MenuList.js +2 -2
- package/dist/esm/components/Menu/index.js +1 -0
- package/dist/esm/components/Popover/index.js +1 -0
- package/dist/esm/components/SideBar/index.js +1 -0
- package/dist/esm/components/Snackbar/index.js +1 -0
- package/dist/esm/components/Table/index.js +1 -0
- package/dist/esm/components/TableOfContents/index.js +1 -0
- package/dist/esm/components/Tabs/index.js +1 -0
- package/dist/esm/components/Tooltip/Tooltip.js +7 -1
- package/dist/esm/components/TopBar/index.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/types/components/EdsProvider/eds.context.d.ts +2 -0
- package/dist/types/components/Icon/Icon.d.ts +1 -1
- package/dist/types/components/Icon/Icon.types.d.ts +1 -5
- package/dist/types/components/Icon/library.d.ts +2 -2
- package/dist/types/components/Tooltip/Tooltip.d.ts +8 -0
- package/package.json +35 -34
package/dist/eds-core-react.cjs
CHANGED
|
@@ -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 (
|
|
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 (
|
|
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
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
children:
|
|
2294
|
-
|
|
2295
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
138
|
+
if (/*#__PURE__*/isValidElement(child) && child.type === AccordionHeaderActions) {
|
|
139
139
|
return /*#__PURE__*/cloneElement(child, {
|
|
140
140
|
isExpanded,
|
|
141
141
|
disabled
|
|
@@ -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 (
|
|
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 (
|
|
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
|
});
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
children:
|
|
32
|
-
|
|
33
|
-
|
|
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'
|
|
@@ -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 (
|
|
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 (
|
|
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({
|
|
@@ -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
|
|
package/dist/esm/index.js
CHANGED
|
@@ -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,10 +1,6 @@
|
|
|
1
|
-
import type {
|
|
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 {
|
|
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) =>
|
|
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.
|
|
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": "^
|
|
37
|
-
"@rollup/plugin-node-resolve": "^
|
|
38
|
-
"@storybook/addon-a11y": "^8.
|
|
39
|
-
"@storybook/addon-actions": "^8.
|
|
40
|
-
"@storybook/addon-docs": "^8.
|
|
41
|
-
"@storybook/addon-essentials": "^8.
|
|
42
|
-
"@storybook/addon-links": "^8.
|
|
43
|
-
"@storybook/blocks": "^8.
|
|
44
|
-
"@storybook/preview-api": "^8.
|
|
45
|
-
"@storybook/react": "^8.
|
|
46
|
-
"@storybook/react-vite": "^8.
|
|
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.
|
|
49
|
-
"@testing-library/react": "16.
|
|
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.
|
|
52
|
-
"@types/ramda": "^0.30.
|
|
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.
|
|
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.
|
|
64
|
+
"react-hook-form": "^7.54.2",
|
|
65
65
|
"react-router-dom": "^6.26.0",
|
|
66
|
-
"rollup": "^4.
|
|
66
|
+
"rollup": "^4.29.1",
|
|
67
67
|
"rollup-plugin-delete": "^2.1.0",
|
|
68
68
|
"rollup-plugin-postcss": "^4.0.2",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
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.
|
|
81
|
-
"@floating-ui/react": "^0.
|
|
82
|
-
"@internationalized/date": "^3.
|
|
83
|
-
"@react-aria/utils": "^3.
|
|
84
|
-
"@react-stately/calendar": "^3.
|
|
85
|
-
"@react-stately/datepicker": "^3.
|
|
86
|
-
"@react-types/shared": "^3.
|
|
87
|
-
"@tanstack/react-virtual": "3.
|
|
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.
|
|
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",
|