@equinor/eds-core-react 0.42.1 → 0.42.3
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 +17 -12
- package/dist/esm/components/Datepicker/calendars/CalendarCell.js +6 -2
- package/dist/esm/components/Menu/MenuItem.js +1 -0
- package/dist/esm/components/SideBar/SideBar.context.js +6 -2
- package/dist/esm/components/SideBar/SideBar.js +1 -6
- package/dist/esm/components/Tooltip/Tooltip.js +3 -2
- package/dist/types/components/SideBar/SideBar.context.d.ts +2 -1
- package/package.json +1 -2
package/dist/eds-core-react.cjs
CHANGED
|
@@ -5,6 +5,7 @@ var styled = require('styled-components');
|
|
|
5
5
|
var edsTokens = require('@equinor/eds-tokens');
|
|
6
6
|
var edsUtils = require('@equinor/eds-utils');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var reactDom = require('react-dom');
|
|
8
9
|
var react$1 = require('@floating-ui/react');
|
|
9
10
|
var edsIcons = require('@equinor/eds-icons');
|
|
10
11
|
var downshift = require('downshift');
|
|
@@ -1151,7 +1152,7 @@ const Tooltip$2 = /*#__PURE__*/react.forwardRef(function Tooltip({
|
|
|
1151
1152
|
}, ref) {
|
|
1152
1153
|
const arrowRef = react.useRef(null);
|
|
1153
1154
|
const [open, setOpen] = react.useState(false);
|
|
1154
|
-
const shouldOpen = title !== '';
|
|
1155
|
+
const shouldOpen = title !== '' && typeof document !== 'undefined';
|
|
1155
1156
|
const {
|
|
1156
1157
|
x,
|
|
1157
1158
|
y,
|
|
@@ -1255,7 +1256,7 @@ const Tooltip$2 = /*#__PURE__*/react.forwardRef(function Tooltip({
|
|
|
1255
1256
|
})]
|
|
1256
1257
|
});
|
|
1257
1258
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1258
|
-
children: [shouldOpen && open && TooltipEl, updatedChildren]
|
|
1259
|
+
children: [shouldOpen && open && /*#__PURE__*/reactDom.createPortal(TooltipEl, document.body), updatedChildren]
|
|
1259
1260
|
});
|
|
1260
1261
|
});
|
|
1261
1262
|
|
|
@@ -7772,6 +7773,7 @@ const MenuItem$1 = /*#__PURE__*/react.forwardRef(function MenuItem({
|
|
|
7772
7773
|
return /*#__PURE__*/jsxRuntime.jsx(Item, {
|
|
7773
7774
|
...props,
|
|
7774
7775
|
$active: active,
|
|
7776
|
+
type: "button",
|
|
7775
7777
|
ref: edsUtils.mergeRefs(ref, el => {
|
|
7776
7778
|
if (isFocused) {
|
|
7777
7779
|
requestAnimationFrame(() => {
|
|
@@ -10436,9 +10438,13 @@ const initalState = {
|
|
|
10436
10438
|
};
|
|
10437
10439
|
const SideBarContext = /*#__PURE__*/react.createContext(initalState);
|
|
10438
10440
|
const SideBarProvider = ({
|
|
10439
|
-
children
|
|
10441
|
+
children,
|
|
10442
|
+
isOpen: isOpenProp = false
|
|
10440
10443
|
}) => {
|
|
10441
|
-
const [state, setState] = react.useState(
|
|
10444
|
+
const [state, setState] = react.useState({
|
|
10445
|
+
onToggle: null,
|
|
10446
|
+
isOpen: isOpenProp
|
|
10447
|
+
});
|
|
10442
10448
|
const {
|
|
10443
10449
|
isOpen,
|
|
10444
10450
|
onToggle
|
|
@@ -10471,13 +10477,11 @@ const useSideBar = () => react.useContext(SideBarContext);
|
|
|
10471
10477
|
|
|
10472
10478
|
const SideBarContainer = /*#__PURE__*/react.forwardRef(function SideBarContainer({
|
|
10473
10479
|
onToggle: onToggleCallback,
|
|
10474
|
-
open = false,
|
|
10475
10480
|
children,
|
|
10476
10481
|
...rest
|
|
10477
10482
|
}, ref) {
|
|
10478
10483
|
const {
|
|
10479
10484
|
isOpen,
|
|
10480
|
-
setIsOpen,
|
|
10481
10485
|
onToggle,
|
|
10482
10486
|
setOnToggle
|
|
10483
10487
|
} = useSideBar();
|
|
@@ -10486,10 +10490,6 @@ const SideBarContainer = /*#__PURE__*/react.forwardRef(function SideBarContainer
|
|
|
10486
10490
|
setOnToggle(onToggleCallback);
|
|
10487
10491
|
}
|
|
10488
10492
|
}, [onToggle, onToggleCallback, setOnToggle]);
|
|
10489
|
-
react.useEffect(() => {
|
|
10490
|
-
setIsOpen(open);
|
|
10491
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10492
|
-
}, [open]);
|
|
10493
10493
|
return /*#__PURE__*/jsxRuntime.jsx(GridContainer, {
|
|
10494
10494
|
...rest,
|
|
10495
10495
|
open: isOpen,
|
|
@@ -10527,6 +10527,7 @@ const SideBar$1 = /*#__PURE__*/react.forwardRef(({
|
|
|
10527
10527
|
return /*#__PURE__*/jsxRuntime.jsx(styled.ThemeProvider, {
|
|
10528
10528
|
theme: token,
|
|
10529
10529
|
children: /*#__PURE__*/jsxRuntime.jsx(SideBarProvider, {
|
|
10530
|
+
isOpen: open,
|
|
10530
10531
|
children: /*#__PURE__*/jsxRuntime.jsx(SideBarContainer, {
|
|
10531
10532
|
...props,
|
|
10532
10533
|
ref: ref
|
|
@@ -11169,7 +11170,9 @@ SideBar.AccordionItem.displayName = 'SideBar.AccordionItem';
|
|
|
11169
11170
|
const StyledCell = styled__default.default(Typography).withConfig({
|
|
11170
11171
|
displayName: "CalendarCell__StyledCell",
|
|
11171
11172
|
componentId: "sc-y5ycmg-0"
|
|
11172
|
-
})(["display:flex;justify-content:center;align-items:center;cursor:pointer;&:hover{background-color:", ";}
|
|
11173
|
+
})(["display:flex;justify-content:center;align-items:center;cursor:pointer;&:hover{background-color:", ";}", " ", " ", " ", " ", " ", " ", ""], edsTokens.tokens.colors.interactive.table__cell__fill_hover.rgba, ({
|
|
11174
|
+
$focused
|
|
11175
|
+
}) => $focused && `outline: 2px dashed rgba(0, 112, 121, 1);`, ({
|
|
11173
11176
|
$selected
|
|
11174
11177
|
}) => $selected && `background-color: ${edsTokens.tokens.colors.interactive.primary__selected_highlight.rgba};`, ({
|
|
11175
11178
|
$hidden
|
|
@@ -11248,7 +11251,8 @@ function CalendarCell({
|
|
|
11248
11251
|
isOutsideVisibleRange,
|
|
11249
11252
|
isDisabled,
|
|
11250
11253
|
isUnavailable,
|
|
11251
|
-
formattedDate
|
|
11254
|
+
formattedDate,
|
|
11255
|
+
isFocused
|
|
11252
11256
|
} = reactAria.useCalendarCell({
|
|
11253
11257
|
date
|
|
11254
11258
|
}, state, ref);
|
|
@@ -11296,6 +11300,7 @@ function CalendarCell({
|
|
|
11296
11300
|
$highlight: isHighlight,
|
|
11297
11301
|
$disabled: isDisabled || isUnavailable,
|
|
11298
11302
|
$density: density,
|
|
11303
|
+
$focused: isFocused,
|
|
11299
11304
|
children: formattedDate
|
|
11300
11305
|
})
|
|
11301
11306
|
});
|
|
@@ -9,7 +9,9 @@ import { useEds } from '../../EdsProvider/eds.context.js';
|
|
|
9
9
|
const StyledCell = styled(Typography).withConfig({
|
|
10
10
|
displayName: "CalendarCell__StyledCell",
|
|
11
11
|
componentId: "sc-y5ycmg-0"
|
|
12
|
-
})(["display:flex;justify-content:center;align-items:center;cursor:pointer;&:hover{background-color:", ";}
|
|
12
|
+
})(["display:flex;justify-content:center;align-items:center;cursor:pointer;&:hover{background-color:", ";}", " ", " ", " ", " ", " ", " ", ""], tokens.colors.interactive.table__cell__fill_hover.rgba, ({
|
|
13
|
+
$focused
|
|
14
|
+
}) => $focused && `outline: 2px dashed rgba(0, 112, 121, 1);`, ({
|
|
13
15
|
$selected
|
|
14
16
|
}) => $selected && `background-color: ${tokens.colors.interactive.primary__selected_highlight.rgba};`, ({
|
|
15
17
|
$hidden
|
|
@@ -88,7 +90,8 @@ function CalendarCell({
|
|
|
88
90
|
isOutsideVisibleRange,
|
|
89
91
|
isDisabled,
|
|
90
92
|
isUnavailable,
|
|
91
|
-
formattedDate
|
|
93
|
+
formattedDate,
|
|
94
|
+
isFocused
|
|
92
95
|
} = useCalendarCell({
|
|
93
96
|
date
|
|
94
97
|
}, state, ref);
|
|
@@ -136,6 +139,7 @@ function CalendarCell({
|
|
|
136
139
|
$highlight: isHighlight,
|
|
137
140
|
$disabled: isDisabled || isUnavailable,
|
|
138
141
|
$density: density,
|
|
142
|
+
$focused: isFocused,
|
|
139
143
|
children: formattedDate
|
|
140
144
|
})
|
|
141
145
|
});
|
|
@@ -7,9 +7,13 @@ const initalState = {
|
|
|
7
7
|
};
|
|
8
8
|
const SideBarContext = /*#__PURE__*/createContext(initalState);
|
|
9
9
|
const SideBarProvider = ({
|
|
10
|
-
children
|
|
10
|
+
children,
|
|
11
|
+
isOpen: isOpenProp = false
|
|
11
12
|
}) => {
|
|
12
|
-
const [state, setState] = useState(
|
|
13
|
+
const [state, setState] = useState({
|
|
14
|
+
onToggle: null,
|
|
15
|
+
isOpen: isOpenProp
|
|
16
|
+
});
|
|
13
17
|
const {
|
|
14
18
|
isOpen,
|
|
15
19
|
onToggle
|
|
@@ -8,13 +8,11 @@ import { useEds } from '../EdsProvider/eds.context.js';
|
|
|
8
8
|
|
|
9
9
|
const SideBarContainer = /*#__PURE__*/forwardRef(function SideBarContainer({
|
|
10
10
|
onToggle: onToggleCallback,
|
|
11
|
-
open = false,
|
|
12
11
|
children,
|
|
13
12
|
...rest
|
|
14
13
|
}, ref) {
|
|
15
14
|
const {
|
|
16
15
|
isOpen,
|
|
17
|
-
setIsOpen,
|
|
18
16
|
onToggle,
|
|
19
17
|
setOnToggle
|
|
20
18
|
} = useSideBar();
|
|
@@ -23,10 +21,6 @@ const SideBarContainer = /*#__PURE__*/forwardRef(function SideBarContainer({
|
|
|
23
21
|
setOnToggle(onToggleCallback);
|
|
24
22
|
}
|
|
25
23
|
}, [onToggle, onToggleCallback, setOnToggle]);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
setIsOpen(open);
|
|
28
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
|
-
}, [open]);
|
|
30
24
|
return /*#__PURE__*/jsx(GridContainer, {
|
|
31
25
|
...rest,
|
|
32
26
|
open: isOpen,
|
|
@@ -64,6 +58,7 @@ const SideBar = /*#__PURE__*/forwardRef(({
|
|
|
64
58
|
return /*#__PURE__*/jsx(ThemeProvider, {
|
|
65
59
|
theme: token,
|
|
66
60
|
children: /*#__PURE__*/jsx(SideBarProvider, {
|
|
61
|
+
isOpen: open,
|
|
67
62
|
children: /*#__PURE__*/jsx(SideBarContainer, {
|
|
68
63
|
...props,
|
|
69
64
|
ref: ref
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { forwardRef, useRef, useState, useMemo, useEffect, cloneElement } from 'react';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
2
3
|
import styled from 'styled-components';
|
|
3
4
|
import { typographyTemplate, spacingsTemplate, bordersTemplate, mergeRefs, useIsomorphicLayoutEffect } from '@equinor/eds-utils';
|
|
4
5
|
import { tooltip } from './Tooltip.tokens.js';
|
|
@@ -29,7 +30,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip({
|
|
|
29
30
|
}, ref) {
|
|
30
31
|
const arrowRef = useRef(null);
|
|
31
32
|
const [open, setOpen] = useState(false);
|
|
32
|
-
const shouldOpen = title !== '';
|
|
33
|
+
const shouldOpen = title !== '' && typeof document !== 'undefined';
|
|
33
34
|
const {
|
|
34
35
|
x,
|
|
35
36
|
y,
|
|
@@ -133,7 +134,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip({
|
|
|
133
134
|
})]
|
|
134
135
|
});
|
|
135
136
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
136
|
-
children: [shouldOpen && open && TooltipEl, updatedChildren]
|
|
137
|
+
children: [shouldOpen && open && /*#__PURE__*/createPortal(TooltipEl, document.body), updatedChildren]
|
|
137
138
|
});
|
|
138
139
|
});
|
|
139
140
|
|
|
@@ -9,7 +9,8 @@ type UseSidebarProps<T> = T & {
|
|
|
9
9
|
};
|
|
10
10
|
type ProviderProps = {
|
|
11
11
|
children: ReactNode;
|
|
12
|
+
isOpen: boolean;
|
|
12
13
|
};
|
|
13
|
-
export declare const SideBarProvider: ({ children }: ProviderProps) => JSX.Element;
|
|
14
|
+
export declare const SideBarProvider: ({ children, isOpen: isOpenProp, }: ProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export declare const useSideBar: () => UseSidebarProps<State>;
|
|
15
16
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/eds-core-react",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.3",
|
|
4
4
|
"description": "The React implementation of the Equinor Design System",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css"
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
"@types/ramda": "^0.30.1",
|
|
53
53
|
"@types/react": "^18.3.3",
|
|
54
54
|
"@types/react-dom": "^18.3.0",
|
|
55
|
-
"babel-loader": "^9.1.3",
|
|
56
55
|
"babel-plugin-styled-components": "^2.1.4",
|
|
57
56
|
"jest": "^29.7.0",
|
|
58
57
|
"jest-environment-jsdom": "^29.7.0",
|