@equinor/eds-core-react 0.40.1 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eds-core-react.cjs +70 -72
- package/dist/esm/components/Autocomplete/Autocomplete.js +4 -4
- package/dist/esm/components/Autocomplete/Option.js +1 -1
- package/dist/esm/components/Datepicker/DateRangePicker.js +1 -0
- package/dist/esm/components/Menu/Menu.js +29 -27
- package/dist/esm/components/Menu/MenuSection.js +1 -0
- package/dist/esm/components/Snackbar/Snackbar.js +26 -13
- package/dist/esm/components/Tabs/TabList.js +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +13 -13
- package/package.json +31 -31
package/dist/eds-core-react.cjs
CHANGED
|
@@ -7,7 +7,6 @@ var edsUtils = require('@equinor/eds-utils');
|
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var react$1 = require('@floating-ui/react');
|
|
9
9
|
var edsIcons = require('@equinor/eds-icons');
|
|
10
|
-
var ReactDom = require('react-dom');
|
|
11
10
|
var downshift = require('downshift');
|
|
12
11
|
var reactVirtual = require('@tanstack/react-virtual');
|
|
13
12
|
var reactAria = require('react-aria');
|
|
@@ -18,26 +17,7 @@ var utils = require('@react-aria/utils');
|
|
|
18
17
|
|
|
19
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
19
|
|
|
21
|
-
function _interopNamespace(e) {
|
|
22
|
-
if (e && e.__esModule) return e;
|
|
23
|
-
var n = Object.create(null);
|
|
24
|
-
if (e) {
|
|
25
|
-
Object.keys(e).forEach(function (k) {
|
|
26
|
-
if (k !== 'default') {
|
|
27
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
28
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
get: function () { return e[k]; }
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
n.default = e;
|
|
36
|
-
return Object.freeze(n);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
20
|
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
40
|
-
var ReactDom__namespace = /*#__PURE__*/_interopNamespace(ReactDom);
|
|
41
21
|
|
|
42
22
|
const {
|
|
43
23
|
typography: {
|
|
@@ -1147,10 +1127,12 @@ const tooltip = {
|
|
|
1147
1127
|
}
|
|
1148
1128
|
};
|
|
1149
1129
|
|
|
1150
|
-
const StyledTooltip = styled__default.default
|
|
1130
|
+
const StyledTooltip = styled__default.default('div').withConfig({
|
|
1131
|
+
shouldForwardProp: () => true //workaround to avoid warning until popover gets added to react types
|
|
1132
|
+
}).withConfig({
|
|
1151
1133
|
displayName: "Tooltip__StyledTooltip",
|
|
1152
1134
|
componentId: "sc-m2im2p-0"
|
|
1153
|
-
})(["", " ", " ", " background:", ";
|
|
1135
|
+
})(["inset:unset;border:0;overflow:visible;", " ", " ", " background:", ";white-space:nowrap;&::before{content:'; Has tooltip: ';clip-path:inset(50%);height:1px;width:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;}&::backdrop{background-color:transparent;}"], edsUtils.typographyTemplate(tooltip.typography), edsUtils.spacingsTemplate(tooltip.spacings), edsUtils.bordersTemplate(tooltip.border), tooltip.background);
|
|
1154
1136
|
const ArrowWrapper$1 = styled__default.default.div.withConfig({
|
|
1155
1137
|
displayName: "Tooltip__ArrowWrapper",
|
|
1156
1138
|
componentId: "sc-m2im2p-1"
|
|
@@ -1245,10 +1227,13 @@ const Tooltip$2 = /*#__PURE__*/react.forwardRef(function Tooltip({
|
|
|
1245
1227
|
...children.props
|
|
1246
1228
|
})
|
|
1247
1229
|
});
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1230
|
+
edsUtils.useIsomorphicLayoutEffect(() => {
|
|
1231
|
+
if (shouldOpen && open) {
|
|
1232
|
+
refs.floating.current?.showPopover();
|
|
1233
|
+
}
|
|
1234
|
+
}, [open, shouldOpen, refs.floating]);
|
|
1251
1235
|
const TooltipEl = /*#__PURE__*/jsxRuntime.jsxs(StyledTooltip, {
|
|
1236
|
+
popover: "manual",
|
|
1252
1237
|
...rest,
|
|
1253
1238
|
...getFloatingProps({
|
|
1254
1239
|
ref: tooltipRef,
|
|
@@ -1270,12 +1255,7 @@ const Tooltip$2 = /*#__PURE__*/react.forwardRef(function Tooltip({
|
|
|
1270
1255
|
})]
|
|
1271
1256
|
});
|
|
1272
1257
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1273
|
-
children: [
|
|
1274
|
-
children: shouldOpen && open && TooltipEl
|
|
1275
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(react$1.FloatingPortal, {
|
|
1276
|
-
id: "eds-tooltip-container",
|
|
1277
|
-
children: shouldOpen && open && TooltipEl
|
|
1278
|
-
}), updatedChildren]
|
|
1258
|
+
children: [shouldOpen && open && TooltipEl, updatedChildren]
|
|
1279
1259
|
});
|
|
1280
1260
|
});
|
|
1281
1261
|
|
|
@@ -3909,7 +3889,7 @@ const StyledTabList = styled__default.default.div.attrs(() => ({
|
|
|
3909
3889
|
})).withConfig({
|
|
3910
3890
|
displayName: "TabList__StyledTabList",
|
|
3911
3891
|
componentId: "sc-1g1p5i1-0"
|
|
3912
|
-
})(["display:grid;grid-auto-flow:column;grid-auto-columns:", ";overflow-x:", ";scroll-snap-type:x mandatory;overscroll-behavior-x:contain;@media (prefers-reduced-motion:no-preference){scroll-behavior:smooth;}@media (hover:none){overflow-x:scroll;-webkit-overflow-scrolling:touch;scrollbar-width:
|
|
3892
|
+
})(["display:grid;grid-auto-flow:column;grid-auto-columns:", ";overflow-x:", ";scroll-snap-type:x mandatory;overscroll-behavior-x:contain;@media (prefers-reduced-motion:no-preference){scroll-behavior:smooth;}@media (hover:none){overflow-x:scroll;-webkit-overflow-scrolling:touch;scrollbar-width:none;& ::-webkit-scrollbar{width:0;height:0;}}"], ({
|
|
3913
3893
|
$variant
|
|
3914
3894
|
}) => variants$1[$variant], ({
|
|
3915
3895
|
$scrollable
|
|
@@ -6167,20 +6147,30 @@ const snackbar = {
|
|
|
6167
6147
|
}
|
|
6168
6148
|
};
|
|
6169
6149
|
|
|
6170
|
-
const
|
|
6171
|
-
|
|
6150
|
+
const PopoverDiv = styled__default.default('div').withConfig({
|
|
6151
|
+
shouldForwardProp: () => true //workaround to avoid warning until popover gets added to react types
|
|
6152
|
+
,
|
|
6153
|
+
displayName: "Snackbar__PopoverDiv",
|
|
6172
6154
|
componentId: "sc-ac6no8-0"
|
|
6173
6155
|
})(({
|
|
6174
6156
|
theme,
|
|
6175
6157
|
$placement
|
|
6176
6158
|
}) => {
|
|
6177
|
-
return styled.css(["
|
|
6159
|
+
return styled.css(["inset:unset;border:0;overflow:visible;position:fixed;padding:0;background-color:transparent;", " &::backdrop{background-color:transparent;}"], {
|
|
6178
6160
|
top: $placement.includes('top') ? theme.spacings.top : $placement === 'left' || $placement === 'right' ? '50%' : undefined,
|
|
6179
6161
|
bottom: $placement.includes('bottom') ? theme.spacings.bottom : undefined,
|
|
6180
6162
|
right: $placement.includes('right') ? theme.spacings.right : undefined,
|
|
6181
6163
|
left: $placement.includes('left') ? theme.spacings.left : $placement === 'top' || $placement === 'bottom' ? '50%' : undefined,
|
|
6182
6164
|
transform: $placement === 'left' || $placement === 'right' ? 'translateY(-50%)' : $placement === 'top' || $placement === 'bottom' ? 'translateX(-50%)' : undefined
|
|
6183
|
-
}
|
|
6165
|
+
});
|
|
6166
|
+
});
|
|
6167
|
+
const StyledSnackbar = styled__default.default(Paper).withConfig({
|
|
6168
|
+
displayName: "Snackbar__StyledSnackbar",
|
|
6169
|
+
componentId: "sc-ac6no8-1"
|
|
6170
|
+
})(({
|
|
6171
|
+
theme
|
|
6172
|
+
}) => {
|
|
6173
|
+
return styled.css(["background-color:", ";", " ", " ", " min-height:", ";box-sizing:border-box;a,button{color:", ";}"], theme.background, edsUtils.spacingsTemplate(theme.spacings), edsUtils.bordersTemplate(theme.border), edsUtils.typographyTemplate(theme.typography), theme.minHeight, theme.entities.button.typography.color);
|
|
6184
6174
|
});
|
|
6185
6175
|
const Snackbar$1 = /*#__PURE__*/react.forwardRef(function Snackbar({
|
|
6186
6176
|
open = false,
|
|
@@ -6203,10 +6193,9 @@ const Snackbar$1 = /*#__PURE__*/react.forwardRef(function Snackbar({
|
|
|
6203
6193
|
}, autoHideDuration);
|
|
6204
6194
|
}
|
|
6205
6195
|
return () => clearTimeout(timer.current);
|
|
6206
|
-
}, [open,
|
|
6196
|
+
}, [open, setVisible, autoHideDuration, onClose]);
|
|
6207
6197
|
const props = {
|
|
6208
6198
|
ref,
|
|
6209
|
-
$placement: placement,
|
|
6210
6199
|
...rest
|
|
6211
6200
|
};
|
|
6212
6201
|
const {
|
|
@@ -6217,12 +6206,17 @@ const Snackbar$1 = /*#__PURE__*/react.forwardRef(function Snackbar({
|
|
|
6217
6206
|
}, snackbar);
|
|
6218
6207
|
return /*#__PURE__*/jsxRuntime.jsx(styled.ThemeProvider, {
|
|
6219
6208
|
theme: token,
|
|
6220
|
-
children: visible && /*#__PURE__*/
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
children:
|
|
6225
|
-
|
|
6209
|
+
children: visible && /*#__PURE__*/jsxRuntime.jsx(PopoverDiv, {
|
|
6210
|
+
popover: "manual",
|
|
6211
|
+
$placement: placement,
|
|
6212
|
+
ref: el => el?.showPopover(),
|
|
6213
|
+
children: /*#__PURE__*/jsxRuntime.jsx(StyledSnackbar, {
|
|
6214
|
+
role: "alert",
|
|
6215
|
+
elevation: "overlay",
|
|
6216
|
+
...props,
|
|
6217
|
+
children: children
|
|
6218
|
+
})
|
|
6219
|
+
})
|
|
6226
6220
|
});
|
|
6227
6221
|
});
|
|
6228
6222
|
|
|
@@ -7704,6 +7698,7 @@ const MenuSection = /*#__PURE__*/react.memo(function MenuSection(props) {
|
|
|
7704
7698
|
variant: "small"
|
|
7705
7699
|
})
|
|
7706
7700
|
}), title && /*#__PURE__*/jsxRuntime.jsx(Header, {
|
|
7701
|
+
role: "group",
|
|
7707
7702
|
children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
7708
7703
|
group: "navigation",
|
|
7709
7704
|
variant: "label",
|
|
@@ -7814,11 +7809,13 @@ const {
|
|
|
7814
7809
|
const MenuPaper = styled__default.default(Paper).withConfig({
|
|
7815
7810
|
displayName: "Menu__MenuPaper",
|
|
7816
7811
|
componentId: "sc-1vlnqcj-0"
|
|
7817
|
-
})(["
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7812
|
+
})(["width:100%;min-width:fit-content;", ";"], edsUtils.bordersTemplate(border$1));
|
|
7813
|
+
const StyledPopover$1 = styled__default.default('div').withConfig({
|
|
7814
|
+
shouldForwardProp: () => true //workaround to avoid warning until popover gets added to react types
|
|
7815
|
+
}).withConfig({
|
|
7816
|
+
displayName: "Menu__StyledPopover",
|
|
7817
|
+
componentId: "sc-1vlnqcj-1"
|
|
7818
|
+
})(["inset:unset;border:0;padding:0;margin:0;overflow:visible;background-color:transparent;&::backdrop{background-color:transparent;}"]);
|
|
7822
7819
|
const MenuContainer = /*#__PURE__*/react.forwardRef(function MenuContainer({
|
|
7823
7820
|
children,
|
|
7824
7821
|
anchorEl,
|
|
@@ -7947,13 +7944,19 @@ const Menu$1 = /*#__PURE__*/react.forwardRef(function Menu({
|
|
|
7947
7944
|
return react$1.autoUpdate(refs.reference.current, refs.floating.current, update);
|
|
7948
7945
|
}
|
|
7949
7946
|
}, [refs.reference, refs.floating, update, open]);
|
|
7947
|
+
edsUtils.useIsomorphicLayoutEffect(() => {
|
|
7948
|
+
if (open) {
|
|
7949
|
+
refs.floating.current?.showPopover();
|
|
7950
|
+
} else {
|
|
7951
|
+
refs.floating.current?.hidePopover();
|
|
7952
|
+
}
|
|
7953
|
+
}, [open, refs.floating]);
|
|
7950
7954
|
const {
|
|
7951
7955
|
getFloatingProps
|
|
7952
7956
|
} = react$1.useInteractions([react$1.useDismiss(context, {
|
|
7953
7957
|
escapeKey: false
|
|
7954
7958
|
})]);
|
|
7955
7959
|
const props = {
|
|
7956
|
-
open,
|
|
7957
7960
|
className
|
|
7958
7961
|
};
|
|
7959
7962
|
const menuProps = {
|
|
@@ -7962,14 +7965,10 @@ const Menu$1 = /*#__PURE__*/react.forwardRef(function Menu({
|
|
|
7962
7965
|
anchorEl,
|
|
7963
7966
|
open
|
|
7964
7967
|
};
|
|
7965
|
-
|
|
7966
|
-
//temporary fix when inside dialog. Should be replaced by popover api when it is ready
|
|
7967
|
-
const inDialog = edsUtils.useIsInDialog(anchorEl);
|
|
7968
|
-
const menuElement = /*#__PURE__*/jsxRuntime.jsx(styled.ThemeProvider, {
|
|
7968
|
+
return /*#__PURE__*/jsxRuntime.jsx(styled.ThemeProvider, {
|
|
7969
7969
|
theme: token,
|
|
7970
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
7971
|
-
|
|
7972
|
-
...props,
|
|
7970
|
+
children: /*#__PURE__*/jsxRuntime.jsx(StyledPopover$1, {
|
|
7971
|
+
popover: "manual",
|
|
7973
7972
|
...getFloatingProps({
|
|
7974
7973
|
ref: popoverRef,
|
|
7975
7974
|
style: {
|
|
@@ -7979,20 +7978,18 @@ const Menu$1 = /*#__PURE__*/react.forwardRef(function Menu({
|
|
|
7979
7978
|
left: x || 0
|
|
7980
7979
|
}
|
|
7981
7980
|
}),
|
|
7982
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7981
|
+
children: /*#__PURE__*/jsxRuntime.jsx(MenuPaper, {
|
|
7982
|
+
elevation: "raised",
|
|
7983
|
+
...props,
|
|
7984
|
+
children: /*#__PURE__*/jsxRuntime.jsx(MenuProvider, {
|
|
7985
|
+
children: /*#__PURE__*/jsxRuntime.jsx(MenuContainer, {
|
|
7986
|
+
...menuProps,
|
|
7987
|
+
ref: ref
|
|
7988
|
+
})
|
|
7986
7989
|
})
|
|
7987
7990
|
})
|
|
7988
7991
|
})
|
|
7989
7992
|
});
|
|
7990
|
-
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
7991
|
-
children: inDialog ? menuElement : /*#__PURE__*/jsxRuntime.jsx(react$1.FloatingPortal, {
|
|
7992
|
-
id: "eds-menu-container",
|
|
7993
|
-
children: menuElement
|
|
7994
|
-
})
|
|
7995
|
-
});
|
|
7996
7993
|
});
|
|
7997
7994
|
|
|
7998
7995
|
const Menu = Menu$1;
|
|
@@ -9357,7 +9354,7 @@ const StyledListItem = styled__default.default.li.withConfig({
|
|
|
9357
9354
|
$isdisabled
|
|
9358
9355
|
}) => {
|
|
9359
9356
|
const backgroundColor = $highlighted === 'true' ? theme.states.hover.background : $active === 'true' ? theme.states.active.background : theme.background;
|
|
9360
|
-
return styled.css(["display:flex;grid-area:1 / -1;align-items:center;align-self:start;margin:0;list-style:none;background-color:", ";user-select:none;overflow:hidden;touch-action:manipulation;cursor:", ";", " ", " ", ""], backgroundColor, $highlighted === 'true' ? 'pointer' : 'default', edsUtils.typographyTemplate(theme.typography), edsUtils.spacingsTemplate(theme.spacings), $isdisabled === 'true' ? styled.css(["color:", ";"], theme.states.disabled.typography.color) : '');
|
|
9357
|
+
return styled.css(["display:flex;grid-area:1 / -1;align-items:center;align-self:start;margin:0;list-style:none;background-color:", ";user-select:none;overflow:hidden;touch-action:manipulation;z-index:3;cursor:", ";", " ", " ", ""], backgroundColor, $highlighted === 'true' ? 'pointer' : 'default', edsUtils.typographyTemplate(theme.typography), edsUtils.spacingsTemplate(theme.spacings), $isdisabled === 'true' ? styled.css(["color:", ";"], theme.states.disabled.typography.color) : '');
|
|
9361
9358
|
});
|
|
9362
9359
|
const Label = styled__default.default.span.withConfig({
|
|
9363
9360
|
displayName: "Option__Label",
|
|
@@ -9461,7 +9458,7 @@ const findIndex = ({
|
|
|
9461
9458
|
availableItems
|
|
9462
9459
|
}) => {
|
|
9463
9460
|
const nextItem = availableItems[index];
|
|
9464
|
-
if (optionDisabled(nextItem)) {
|
|
9461
|
+
if (optionDisabled(nextItem) && index >= 0 && index < availableItems.length) {
|
|
9465
9462
|
const nextIndex = calc(index);
|
|
9466
9463
|
return findIndex({
|
|
9467
9464
|
calc,
|
|
@@ -9696,7 +9693,7 @@ function AutocompleteInner(props, ref) {
|
|
|
9696
9693
|
try {
|
|
9697
9694
|
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
9698
9695
|
return item?.toString();
|
|
9699
|
-
} catch
|
|
9696
|
+
} catch {
|
|
9700
9697
|
throw new Error('Unable to find label, make sure your are using options as documented');
|
|
9701
9698
|
}
|
|
9702
9699
|
}, [optionLabel]);
|
|
@@ -9997,9 +9994,9 @@ function AutocompleteInner(props, ref) {
|
|
|
9997
9994
|
// MARK: popover toggle
|
|
9998
9995
|
edsUtils.useIsomorphicLayoutEffect(() => {
|
|
9999
9996
|
if (isOpen) {
|
|
10000
|
-
refs.floating.current
|
|
9997
|
+
refs.floating.current?.showPopover();
|
|
10001
9998
|
} else {
|
|
10002
|
-
refs.floating.current
|
|
9999
|
+
refs.floating.current?.hidePopover();
|
|
10003
10000
|
}
|
|
10004
10001
|
}, [isOpen, refs.floating]);
|
|
10005
10002
|
const clear = () => {
|
|
@@ -12199,6 +12196,7 @@ const DateRangePicker = /*#__PURE__*/react.forwardRef(({
|
|
|
12199
12196
|
timezone: timezone,
|
|
12200
12197
|
formatOptions: formatOptions,
|
|
12201
12198
|
children: /*#__PURE__*/jsxRuntime.jsx(FieldWrapper, {
|
|
12199
|
+
...props,
|
|
12202
12200
|
isOpen: isOpen,
|
|
12203
12201
|
color: state.isInvalid ? 'warning' : props.variant,
|
|
12204
12202
|
helperProps: helperProps ?? props.helperProps,
|
|
@@ -69,7 +69,7 @@ const findIndex = ({
|
|
|
69
69
|
availableItems
|
|
70
70
|
}) => {
|
|
71
71
|
const nextItem = availableItems[index];
|
|
72
|
-
if (optionDisabled(nextItem)) {
|
|
72
|
+
if (optionDisabled(nextItem) && index >= 0 && index < availableItems.length) {
|
|
73
73
|
const nextIndex = calc(index);
|
|
74
74
|
return findIndex({
|
|
75
75
|
calc,
|
|
@@ -304,7 +304,7 @@ function AutocompleteInner(props, ref) {
|
|
|
304
304
|
try {
|
|
305
305
|
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
306
306
|
return item?.toString();
|
|
307
|
-
} catch
|
|
307
|
+
} catch {
|
|
308
308
|
throw new Error('Unable to find label, make sure your are using options as documented');
|
|
309
309
|
}
|
|
310
310
|
}, [optionLabel]);
|
|
@@ -605,9 +605,9 @@ function AutocompleteInner(props, ref) {
|
|
|
605
605
|
// MARK: popover toggle
|
|
606
606
|
useIsomorphicLayoutEffect(() => {
|
|
607
607
|
if (isOpen) {
|
|
608
|
-
refs.floating.current
|
|
608
|
+
refs.floating.current?.showPopover();
|
|
609
609
|
} else {
|
|
610
|
-
refs.floating.current
|
|
610
|
+
refs.floating.current?.hidePopover();
|
|
611
611
|
}
|
|
612
612
|
}, [isOpen, refs.floating]);
|
|
613
613
|
const clear = () => {
|
|
@@ -14,7 +14,7 @@ const StyledListItem = styled.li.withConfig({
|
|
|
14
14
|
$isdisabled
|
|
15
15
|
}) => {
|
|
16
16
|
const backgroundColor = $highlighted === 'true' ? theme.states.hover.background : $active === 'true' ? theme.states.active.background : theme.background;
|
|
17
|
-
return css(["display:flex;grid-area:1 / -1;align-items:center;align-self:start;margin:0;list-style:none;background-color:", ";user-select:none;overflow:hidden;touch-action:manipulation;cursor:", ";", " ", " ", ""], backgroundColor, $highlighted === 'true' ? 'pointer' : 'default', typographyTemplate(theme.typography), spacingsTemplate(theme.spacings), $isdisabled === 'true' ? css(["color:", ";"], theme.states.disabled.typography.color) : '');
|
|
17
|
+
return css(["display:flex;grid-area:1 / -1;align-items:center;align-self:start;margin:0;list-style:none;background-color:", ";user-select:none;overflow:hidden;touch-action:manipulation;z-index:3;cursor:", ";", " ", " ", ""], backgroundColor, $highlighted === 'true' ? 'pointer' : 'default', typographyTemplate(theme.typography), spacingsTemplate(theme.spacings), $isdisabled === 'true' ? css(["color:", ";"], theme.states.disabled.typography.color) : '');
|
|
18
18
|
});
|
|
19
19
|
const Label = styled.span.withConfig({
|
|
20
20
|
displayName: "Option__Label",
|
|
@@ -122,6 +122,7 @@ const DateRangePicker = /*#__PURE__*/forwardRef(({
|
|
|
122
122
|
timezone: timezone,
|
|
123
123
|
formatOptions: formatOptions,
|
|
124
124
|
children: /*#__PURE__*/jsx(FieldWrapper, {
|
|
125
|
+
...props,
|
|
125
126
|
isOpen: isOpen,
|
|
126
127
|
color: state.isInvalid ? 'warning' : props.variant,
|
|
127
128
|
helperProps: helperProps ?? props.helperProps,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { forwardRef, useMemo, useEffect } from 'react';
|
|
2
|
-
import styled, {
|
|
2
|
+
import styled, { ThemeProvider } from 'styled-components';
|
|
3
3
|
import { MenuProvider, useMenu } from './Menu.context.js';
|
|
4
4
|
import { MenuList } from './MenuList.js';
|
|
5
|
-
import { bordersTemplate, useToken, mergeRefs, useIsomorphicLayoutEffect,
|
|
5
|
+
import { bordersTemplate, useToken, mergeRefs, useIsomorphicLayoutEffect, useGlobalKeyPress } from '@equinor/eds-utils';
|
|
6
6
|
import { menu } from './Menu.tokens.js';
|
|
7
|
-
import { offset, flip, shift, size, useFloating, autoUpdate, useInteractions, useDismiss
|
|
8
|
-
import { jsx
|
|
7
|
+
import { offset, flip, shift, size, useFloating, autoUpdate, useInteractions, useDismiss } from '@floating-ui/react';
|
|
8
|
+
import { jsx } from 'react/jsx-runtime';
|
|
9
9
|
import { Paper } from '../Paper/Paper.js';
|
|
10
10
|
import { useEds } from '../EdsProvider/eds.context.js';
|
|
11
11
|
|
|
@@ -15,11 +15,13 @@ const {
|
|
|
15
15
|
const MenuPaper = styled(Paper).withConfig({
|
|
16
16
|
displayName: "Menu__MenuPaper",
|
|
17
17
|
componentId: "sc-1vlnqcj-0"
|
|
18
|
-
})(["
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
})(["width:100%;min-width:fit-content;", ";"], bordersTemplate(border));
|
|
19
|
+
const StyledPopover = styled('div').withConfig({
|
|
20
|
+
shouldForwardProp: () => true //workaround to avoid warning until popover gets added to react types
|
|
21
|
+
}).withConfig({
|
|
22
|
+
displayName: "Menu__StyledPopover",
|
|
23
|
+
componentId: "sc-1vlnqcj-1"
|
|
24
|
+
})(["inset:unset;border:0;padding:0;margin:0;overflow:visible;background-color:transparent;&::backdrop{background-color:transparent;}"]);
|
|
23
25
|
const MenuContainer = /*#__PURE__*/forwardRef(function MenuContainer({
|
|
24
26
|
children,
|
|
25
27
|
anchorEl,
|
|
@@ -148,13 +150,19 @@ const Menu = /*#__PURE__*/forwardRef(function Menu({
|
|
|
148
150
|
return autoUpdate(refs.reference.current, refs.floating.current, update);
|
|
149
151
|
}
|
|
150
152
|
}, [refs.reference, refs.floating, update, open]);
|
|
153
|
+
useIsomorphicLayoutEffect(() => {
|
|
154
|
+
if (open) {
|
|
155
|
+
refs.floating.current?.showPopover();
|
|
156
|
+
} else {
|
|
157
|
+
refs.floating.current?.hidePopover();
|
|
158
|
+
}
|
|
159
|
+
}, [open, refs.floating]);
|
|
151
160
|
const {
|
|
152
161
|
getFloatingProps
|
|
153
162
|
} = useInteractions([useDismiss(context, {
|
|
154
163
|
escapeKey: false
|
|
155
164
|
})]);
|
|
156
165
|
const props = {
|
|
157
|
-
open,
|
|
158
166
|
className
|
|
159
167
|
};
|
|
160
168
|
const menuProps = {
|
|
@@ -163,14 +171,10 @@ const Menu = /*#__PURE__*/forwardRef(function Menu({
|
|
|
163
171
|
anchorEl,
|
|
164
172
|
open
|
|
165
173
|
};
|
|
166
|
-
|
|
167
|
-
//temporary fix when inside dialog. Should be replaced by popover api when it is ready
|
|
168
|
-
const inDialog = useIsInDialog(anchorEl);
|
|
169
|
-
const menuElement = /*#__PURE__*/jsx(ThemeProvider, {
|
|
174
|
+
return /*#__PURE__*/jsx(ThemeProvider, {
|
|
170
175
|
theme: token,
|
|
171
|
-
children: /*#__PURE__*/jsx(
|
|
172
|
-
|
|
173
|
-
...props,
|
|
176
|
+
children: /*#__PURE__*/jsx(StyledPopover, {
|
|
177
|
+
popover: "manual",
|
|
174
178
|
...getFloatingProps({
|
|
175
179
|
ref: popoverRef,
|
|
176
180
|
style: {
|
|
@@ -180,20 +184,18 @@ const Menu = /*#__PURE__*/forwardRef(function Menu({
|
|
|
180
184
|
left: x || 0
|
|
181
185
|
}
|
|
182
186
|
}),
|
|
183
|
-
children: /*#__PURE__*/jsx(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
+
children: /*#__PURE__*/jsx(MenuPaper, {
|
|
188
|
+
elevation: "raised",
|
|
189
|
+
...props,
|
|
190
|
+
children: /*#__PURE__*/jsx(MenuProvider, {
|
|
191
|
+
children: /*#__PURE__*/jsx(MenuContainer, {
|
|
192
|
+
...menuProps,
|
|
193
|
+
ref: ref
|
|
194
|
+
})
|
|
187
195
|
})
|
|
188
196
|
})
|
|
189
197
|
})
|
|
190
198
|
});
|
|
191
|
-
return /*#__PURE__*/jsx(Fragment, {
|
|
192
|
-
children: inDialog ? menuElement : /*#__PURE__*/jsx(FloatingPortal, {
|
|
193
|
-
id: "eds-menu-container",
|
|
194
|
-
children: menuElement
|
|
195
|
-
})
|
|
196
|
-
});
|
|
197
199
|
});
|
|
198
200
|
|
|
199
201
|
export { Menu };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { forwardRef, useState, useRef, useEffect } from 'react';
|
|
2
|
-
import * as ReactDom from 'react-dom';
|
|
3
2
|
import styled, { css, ThemeProvider } from 'styled-components';
|
|
4
3
|
import { snackbar } from './Snackbar.tokens.js';
|
|
5
4
|
import { spacingsTemplate, bordersTemplate, typographyTemplate, useToken } from '@equinor/eds-utils';
|
|
@@ -7,20 +6,30 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
7
6
|
import { Paper } from '../Paper/Paper.js';
|
|
8
7
|
import { useEds } from '../EdsProvider/eds.context.js';
|
|
9
8
|
|
|
10
|
-
const
|
|
11
|
-
|
|
9
|
+
const PopoverDiv = styled('div').withConfig({
|
|
10
|
+
shouldForwardProp: () => true //workaround to avoid warning until popover gets added to react types
|
|
11
|
+
,
|
|
12
|
+
displayName: "Snackbar__PopoverDiv",
|
|
12
13
|
componentId: "sc-ac6no8-0"
|
|
13
14
|
})(({
|
|
14
15
|
theme,
|
|
15
16
|
$placement
|
|
16
17
|
}) => {
|
|
17
|
-
return css(["
|
|
18
|
+
return css(["inset:unset;border:0;overflow:visible;position:fixed;padding:0;background-color:transparent;", " &::backdrop{background-color:transparent;}"], {
|
|
18
19
|
top: $placement.includes('top') ? theme.spacings.top : $placement === 'left' || $placement === 'right' ? '50%' : undefined,
|
|
19
20
|
bottom: $placement.includes('bottom') ? theme.spacings.bottom : undefined,
|
|
20
21
|
right: $placement.includes('right') ? theme.spacings.right : undefined,
|
|
21
22
|
left: $placement.includes('left') ? theme.spacings.left : $placement === 'top' || $placement === 'bottom' ? '50%' : undefined,
|
|
22
23
|
transform: $placement === 'left' || $placement === 'right' ? 'translateY(-50%)' : $placement === 'top' || $placement === 'bottom' ? 'translateX(-50%)' : undefined
|
|
23
|
-
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
const StyledSnackbar = styled(Paper).withConfig({
|
|
27
|
+
displayName: "Snackbar__StyledSnackbar",
|
|
28
|
+
componentId: "sc-ac6no8-1"
|
|
29
|
+
})(({
|
|
30
|
+
theme
|
|
31
|
+
}) => {
|
|
32
|
+
return css(["background-color:", ";", " ", " ", " min-height:", ";box-sizing:border-box;a,button{color:", ";}"], theme.background, spacingsTemplate(theme.spacings), bordersTemplate(theme.border), typographyTemplate(theme.typography), theme.minHeight, theme.entities.button.typography.color);
|
|
24
33
|
});
|
|
25
34
|
const Snackbar = /*#__PURE__*/forwardRef(function Snackbar({
|
|
26
35
|
open = false,
|
|
@@ -43,10 +52,9 @@ const Snackbar = /*#__PURE__*/forwardRef(function Snackbar({
|
|
|
43
52
|
}, autoHideDuration);
|
|
44
53
|
}
|
|
45
54
|
return () => clearTimeout(timer.current);
|
|
46
|
-
}, [open,
|
|
55
|
+
}, [open, setVisible, autoHideDuration, onClose]);
|
|
47
56
|
const props = {
|
|
48
57
|
ref,
|
|
49
|
-
$placement: placement,
|
|
50
58
|
...rest
|
|
51
59
|
};
|
|
52
60
|
const {
|
|
@@ -57,12 +65,17 @@ const Snackbar = /*#__PURE__*/forwardRef(function Snackbar({
|
|
|
57
65
|
}, snackbar);
|
|
58
66
|
return /*#__PURE__*/jsx(ThemeProvider, {
|
|
59
67
|
theme: token,
|
|
60
|
-
children: visible && /*#__PURE__*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
children:
|
|
65
|
-
|
|
68
|
+
children: visible && /*#__PURE__*/jsx(PopoverDiv, {
|
|
69
|
+
popover: "manual",
|
|
70
|
+
$placement: placement,
|
|
71
|
+
ref: el => el?.showPopover(),
|
|
72
|
+
children: /*#__PURE__*/jsx(StyledSnackbar, {
|
|
73
|
+
role: "alert",
|
|
74
|
+
elevation: "overlay",
|
|
75
|
+
...props,
|
|
76
|
+
children: children
|
|
77
|
+
})
|
|
78
|
+
})
|
|
66
79
|
});
|
|
67
80
|
});
|
|
68
81
|
|
|
@@ -13,7 +13,7 @@ const StyledTabList = styled.div.attrs(() => ({
|
|
|
13
13
|
})).withConfig({
|
|
14
14
|
displayName: "TabList__StyledTabList",
|
|
15
15
|
componentId: "sc-1g1p5i1-0"
|
|
16
|
-
})(["display:grid;grid-auto-flow:column;grid-auto-columns:", ";overflow-x:", ";scroll-snap-type:x mandatory;overscroll-behavior-x:contain;@media (prefers-reduced-motion:no-preference){scroll-behavior:smooth;}@media (hover:none){overflow-x:scroll;-webkit-overflow-scrolling:touch;scrollbar-width:
|
|
16
|
+
})(["display:grid;grid-auto-flow:column;grid-auto-columns:", ";overflow-x:", ";scroll-snap-type:x mandatory;overscroll-behavior-x:contain;@media (prefers-reduced-motion:no-preference){scroll-behavior:smooth;}@media (hover:none){overflow-x:scroll;-webkit-overflow-scrolling:touch;scrollbar-width:none;& ::-webkit-scrollbar{width:0;height:0;}}"], ({
|
|
17
17
|
$variant
|
|
18
18
|
}) => variants[$variant], ({
|
|
19
19
|
$scrollable
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { forwardRef, useRef, useState, useMemo, useEffect, cloneElement } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { typographyTemplate, spacingsTemplate, bordersTemplate, mergeRefs,
|
|
3
|
+
import { typographyTemplate, spacingsTemplate, bordersTemplate, mergeRefs, useIsomorphicLayoutEffect } from '@equinor/eds-utils';
|
|
4
4
|
import { tooltip } from './Tooltip.tokens.js';
|
|
5
|
-
import { useFloating, offset, flip, shift, arrow, autoUpdate, useInteractions, useHover, useFocus, useRole, useDismiss
|
|
5
|
+
import { useFloating, offset, flip, shift, arrow, autoUpdate, useInteractions, useHover, useFocus, useRole, useDismiss } from '@floating-ui/react';
|
|
6
6
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
|
-
const StyledTooltip = styled
|
|
8
|
+
const StyledTooltip = styled('div').withConfig({
|
|
9
|
+
shouldForwardProp: () => true //workaround to avoid warning until popover gets added to react types
|
|
10
|
+
}).withConfig({
|
|
9
11
|
displayName: "Tooltip__StyledTooltip",
|
|
10
12
|
componentId: "sc-m2im2p-0"
|
|
11
|
-
})(["", " ", " ", " background:", ";
|
|
13
|
+
})(["inset:unset;border:0;overflow:visible;", " ", " ", " background:", ";white-space:nowrap;&::before{content:'; Has tooltip: ';clip-path:inset(50%);height:1px;width:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;}&::backdrop{background-color:transparent;}"], typographyTemplate(tooltip.typography), spacingsTemplate(tooltip.spacings), bordersTemplate(tooltip.border), tooltip.background);
|
|
12
14
|
const ArrowWrapper = styled.div.withConfig({
|
|
13
15
|
displayName: "Tooltip__ArrowWrapper",
|
|
14
16
|
componentId: "sc-m2im2p-1"
|
|
@@ -103,10 +105,13 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip({
|
|
|
103
105
|
...children.props
|
|
104
106
|
})
|
|
105
107
|
});
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
useIsomorphicLayoutEffect(() => {
|
|
109
|
+
if (shouldOpen && open) {
|
|
110
|
+
refs.floating.current?.showPopover();
|
|
111
|
+
}
|
|
112
|
+
}, [open, shouldOpen, refs.floating]);
|
|
109
113
|
const TooltipEl = /*#__PURE__*/jsxs(StyledTooltip, {
|
|
114
|
+
popover: "manual",
|
|
110
115
|
...rest,
|
|
111
116
|
...getFloatingProps({
|
|
112
117
|
ref: tooltipRef,
|
|
@@ -128,12 +133,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip({
|
|
|
128
133
|
})]
|
|
129
134
|
});
|
|
130
135
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
131
|
-
children: [
|
|
132
|
-
children: shouldOpen && open && TooltipEl
|
|
133
|
-
}) : /*#__PURE__*/jsx(FloatingPortal, {
|
|
134
|
-
id: "eds-tooltip-container",
|
|
135
|
-
children: shouldOpen && open && TooltipEl
|
|
136
|
-
}), updatedChildren]
|
|
136
|
+
children: [shouldOpen && open && TooltipEl, updatedChildren]
|
|
137
137
|
});
|
|
138
138
|
});
|
|
139
139
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/eds-core-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "The React implementation of the Equinor Design System",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css"
|
|
@@ -35,17 +35,17 @@
|
|
|
35
35
|
"@rollup/plugin-babel": "^6.0.4",
|
|
36
36
|
"@rollup/plugin-commonjs": "^26.0.1",
|
|
37
37
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
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.
|
|
47
|
-
"@testing-library/dom": "^10.
|
|
48
|
-
"@testing-library/jest-dom": "^6.4.
|
|
38
|
+
"@storybook/addon-a11y": "^8.2.8",
|
|
39
|
+
"@storybook/addon-actions": "^8.2.8",
|
|
40
|
+
"@storybook/addon-docs": "^8.2.8",
|
|
41
|
+
"@storybook/addon-essentials": "^8.2.8",
|
|
42
|
+
"@storybook/addon-links": "^8.2.8",
|
|
43
|
+
"@storybook/blocks": "^8.2.8",
|
|
44
|
+
"@storybook/preview-api": "^8.2.8",
|
|
45
|
+
"@storybook/react": "^8.2.8",
|
|
46
|
+
"@storybook/react-vite": "^8.2.8",
|
|
47
|
+
"@testing-library/dom": "^10.4.0",
|
|
48
|
+
"@testing-library/jest-dom": "^6.4.8",
|
|
49
49
|
"@testing-library/react": "16.0.0",
|
|
50
50
|
"@testing-library/user-event": "14.5.2",
|
|
51
51
|
"@types/jest": "^29.5.12",
|
|
@@ -58,19 +58,19 @@
|
|
|
58
58
|
"jest-environment-jsdom": "^29.7.0",
|
|
59
59
|
"jest-styled-components": "^7.2.0",
|
|
60
60
|
"js-file-download": "^0.4.12",
|
|
61
|
-
"postcss": "^8.4.
|
|
61
|
+
"postcss": "^8.4.41",
|
|
62
62
|
"ramda": "^0.30.1",
|
|
63
63
|
"react": "^18.3.1",
|
|
64
64
|
"react-dom": "^18.3.1",
|
|
65
|
-
"react-hook-form": "^7.52.
|
|
66
|
-
"react-router-dom": "^6.
|
|
67
|
-
"rollup": "^4.
|
|
65
|
+
"react-hook-form": "^7.52.2",
|
|
66
|
+
"react-router-dom": "^6.26.0",
|
|
67
|
+
"rollup": "^4.20.0",
|
|
68
68
|
"rollup-plugin-delete": "^2.0.0",
|
|
69
69
|
"rollup-plugin-postcss": "^4.0.2",
|
|
70
|
-
"storybook": "^8.
|
|
71
|
-
"styled-components": "6.1.
|
|
70
|
+
"storybook": "^8.2.8",
|
|
71
|
+
"styled-components": "6.1.12",
|
|
72
72
|
"tsc-watch": "^6.2.0",
|
|
73
|
-
"typescript": "^5.5.
|
|
73
|
+
"typescript": "^5.5.4"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"react": ">=16.8",
|
|
@@ -78,19 +78,19 @@
|
|
|
78
78
|
"styled-components": ">=5.1"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@babel/runtime": "^7.
|
|
82
|
-
"@floating-ui/react": "^0.26.
|
|
83
|
-
"@internationalized/date": "^3.5.
|
|
84
|
-
"@react-aria/utils": "^3.
|
|
85
|
-
"@react-stately/calendar": "^3.5.
|
|
86
|
-
"@react-stately/datepicker": "^3.
|
|
87
|
-
"@react-types/shared": "^3.
|
|
88
|
-
"@tanstack/react-virtual": "3.8.
|
|
89
|
-
"downshift": "9.0.
|
|
90
|
-
"react-aria": "^3.
|
|
91
|
-
"@equinor/eds-
|
|
81
|
+
"@babel/runtime": "^7.25.0",
|
|
82
|
+
"@floating-ui/react": "^0.26.22",
|
|
83
|
+
"@internationalized/date": "^3.5.5",
|
|
84
|
+
"@react-aria/utils": "^3.25.1",
|
|
85
|
+
"@react-stately/calendar": "^3.5.3",
|
|
86
|
+
"@react-stately/datepicker": "^3.10.1",
|
|
87
|
+
"@react-types/shared": "^3.24.1",
|
|
88
|
+
"@tanstack/react-virtual": "3.8.4",
|
|
89
|
+
"downshift": "9.0.7",
|
|
90
|
+
"react-aria": "^3.34.1",
|
|
91
|
+
"@equinor/eds-tokens": "0.9.2",
|
|
92
92
|
"@equinor/eds-utils": "0.8.5",
|
|
93
|
-
"@equinor/eds-
|
|
93
|
+
"@equinor/eds-icons": "^0.21.0"
|
|
94
94
|
},
|
|
95
95
|
"scripts": {
|
|
96
96
|
"build": "rollup -c --bundleConfigAsCjs && tsc -p tsconfig.build.json",
|