@equinor/eds-core-react 0.40.0 → 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.
Files changed (60) hide show
  1. package/dist/eds-core-react.cjs +72 -78
  2. package/dist/esm/components/Autocomplete/Autocomplete.js +7 -7
  3. package/dist/esm/components/Autocomplete/Autocomplete.tokens.js +1 -1
  4. package/dist/esm/components/Autocomplete/Option.js +1 -1
  5. package/dist/esm/components/Button/tokens/contained.js +1 -1
  6. package/dist/esm/components/Button/tokens/contained_icon.js +1 -1
  7. package/dist/esm/components/Button/tokens/ghost.js +1 -1
  8. package/dist/esm/components/Button/tokens/icon.js +1 -1
  9. package/dist/esm/components/Button/tokens/outlined.js +1 -1
  10. package/dist/esm/components/Datepicker/DateRangePicker.js +1 -0
  11. package/dist/esm/components/Input/Input.tokens.js +1 -1
  12. package/dist/esm/components/InputWrapper/InputWrapper.tokens.js +1 -1
  13. package/dist/esm/components/Menu/Menu.js +29 -27
  14. package/dist/esm/components/Menu/MenuSection.js +1 -0
  15. package/dist/esm/components/Snackbar/Snackbar.js +26 -13
  16. package/dist/esm/components/Table/DataCell/DataCell.tokens.js +1 -1
  17. package/dist/esm/components/Tabs/TabList.js +1 -1
  18. package/dist/esm/components/Tooltip/Tooltip.js +13 -13
  19. package/dist/esm/node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_isPlaceholder.js +5 -0
  20. package/dist/types/components/Autocomplete/Autocomplete.d.ts +1 -89
  21. package/dist/types/components/Banner/BannerMessage.d.ts +0 -1
  22. package/dist/types/components/Card/Card.d.ts +1 -1
  23. package/dist/types/components/Chip/Chip.d.ts +1 -1
  24. package/dist/types/components/Chip/Icon.d.ts +20 -3
  25. package/dist/types/components/Datepicker/DatePicker.d.ts +3 -4
  26. package/dist/types/components/Datepicker/DateRangePicker.d.ts +7 -8
  27. package/dist/types/components/Datepicker/calendars/CalendarWrapper.d.ts +0 -1
  28. package/dist/types/components/Datepicker/fields/DateFieldSegments.d.ts +0 -1
  29. package/dist/types/components/Datepicker/fields/DateRangeField.d.ts +0 -1
  30. package/dist/types/components/Datepicker/fields/FieldWrapper.d.ts +1 -1
  31. package/dist/types/components/Dialog/DialogActions.d.ts +0 -1
  32. package/dist/types/components/Dialog/DialogTitle.d.ts +0 -1
  33. package/dist/types/components/Divider/Divider.d.ts +3 -3
  34. package/dist/types/components/Icon/Icon.d.ts +48 -3
  35. package/dist/types/components/List/List.d.ts +1 -1
  36. package/dist/types/components/List/ListItem.d.ts +0 -1
  37. package/dist/types/components/Paper/Paper.d.ts +0 -1
  38. package/dist/types/components/Progress/Linear/LinearProgress.d.ts +1 -1
  39. package/dist/types/components/SideBar/SideBarButton/index.d.ts +0 -1
  40. package/dist/types/components/SideSheet/SideSheet.d.ts +1 -1
  41. package/dist/types/components/Snackbar/Snackbar.d.ts +1 -1
  42. package/dist/types/components/Switch/Switch.d.ts +1 -1
  43. package/dist/types/components/Switch/Switch.styles.d.ts +0 -1
  44. package/dist/types/components/Table/HeaderCell/HeaderCell.d.ts +1 -1
  45. package/dist/types/components/Table/Inner.context.d.ts +0 -1
  46. package/dist/types/components/Table/Row/Row.d.ts +0 -1
  47. package/dist/types/components/Tabs/Tabs.context.d.ts +0 -1
  48. package/package.json +42 -42
  49. package/dist/esm/node_modules/.pnpm/ramda@0.30.0/node_modules/ramda/es/internal/_isPlaceholder.js +0 -7
  50. package/dist/esm/node_modules/.pnpm/ramda@0.30.0/node_modules/ramda/es/internal/_placeholder.js +0 -5
  51. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.0 → ramda@0.30.1}/node_modules/ramda/es/internal/_curry1.js +0 -0
  52. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.0 → ramda@0.30.1}/node_modules/ramda/es/internal/_curry2.js +0 -0
  53. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.0 → ramda@0.30.1}/node_modules/ramda/es/internal/_curry3.js +0 -0
  54. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.0 → ramda@0.30.1}/node_modules/ramda/es/internal/_has.js +0 -0
  55. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.0 → ramda@0.30.1}/node_modules/ramda/es/internal/_isObject.js +0 -0
  56. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.0 → ramda@0.30.1}/node_modules/ramda/es/mergeDeepRight.js +0 -0
  57. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.0 → ramda@0.30.1}/node_modules/ramda/es/mergeDeepWithKey.js +0 -0
  58. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.0 → ramda@0.30.1}/node_modules/ramda/es/mergeWith.js +0 -0
  59. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.0 → ramda@0.30.1}/node_modules/ramda/es/mergeWithKey.js +0 -0
  60. /package/dist/esm/node_modules/.pnpm/{ramda@0.30.0 → ramda@0.30.1}/node_modules/ramda/es/pickBy.js +0 -0
@@ -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: {
@@ -172,12 +152,8 @@ const button = {
172
152
  }
173
153
  };
174
154
 
175
- var _placeholder = {
176
- '@@functional/placeholder': true
177
- };
178
-
179
155
  function _isPlaceholder(a) {
180
- return a === _placeholder;
156
+ return a != null && typeof a === 'object' && a['@@functional/placeholder'] === true;
181
157
  }
182
158
 
183
159
  /**
@@ -1151,10 +1127,12 @@ const tooltip = {
1151
1127
  }
1152
1128
  };
1153
1129
 
1154
- const StyledTooltip = styled__default.default.div.withConfig({
1130
+ const StyledTooltip = styled__default.default('div').withConfig({
1131
+ shouldForwardProp: () => true //workaround to avoid warning until popover gets added to react types
1132
+ }).withConfig({
1155
1133
  displayName: "Tooltip__StyledTooltip",
1156
1134
  componentId: "sc-m2im2p-0"
1157
- })(["", " ", " ", " background:", ";z-index:1500;white-space:nowrap;&::before{content:'; Has tooltip: ';clip-path:inset(50%);height:1px;width:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;}"], edsUtils.typographyTemplate(tooltip.typography), edsUtils.spacingsTemplate(tooltip.spacings), edsUtils.bordersTemplate(tooltip.border), tooltip.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);
1158
1136
  const ArrowWrapper$1 = styled__default.default.div.withConfig({
1159
1137
  displayName: "Tooltip__ArrowWrapper",
1160
1138
  componentId: "sc-m2im2p-1"
@@ -1249,10 +1227,13 @@ const Tooltip$2 = /*#__PURE__*/react.forwardRef(function Tooltip({
1249
1227
  ...children.props
1250
1228
  })
1251
1229
  });
1252
-
1253
- //temporary fix for tooltip inside dialog. Should be replaced by popover api when it is ready
1254
- const inDialog = edsUtils.useIsInDialog(refs.domReference.current);
1230
+ edsUtils.useIsomorphicLayoutEffect(() => {
1231
+ if (shouldOpen && open) {
1232
+ refs.floating.current?.showPopover();
1233
+ }
1234
+ }, [open, shouldOpen, refs.floating]);
1255
1235
  const TooltipEl = /*#__PURE__*/jsxRuntime.jsxs(StyledTooltip, {
1236
+ popover: "manual",
1256
1237
  ...rest,
1257
1238
  ...getFloatingProps({
1258
1239
  ref: tooltipRef,
@@ -1274,12 +1255,7 @@ const Tooltip$2 = /*#__PURE__*/react.forwardRef(function Tooltip({
1274
1255
  })]
1275
1256
  });
1276
1257
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1277
- children: [inDialog ? /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
1278
- children: shouldOpen && open && TooltipEl
1279
- }) : /*#__PURE__*/jsxRuntime.jsx(react$1.FloatingPortal, {
1280
- id: "eds-tooltip-container",
1281
- children: shouldOpen && open && TooltipEl
1282
- }), updatedChildren]
1258
+ children: [shouldOpen && open && TooltipEl, updatedChildren]
1283
1259
  });
1284
1260
  });
1285
1261
 
@@ -3913,7 +3889,7 @@ const StyledTabList = styled__default.default.div.attrs(() => ({
3913
3889
  })).withConfig({
3914
3890
  displayName: "TabList__StyledTabList",
3915
3891
  componentId: "sc-1g1p5i1-0"
3916
- })(["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:0;& ::-webkit-scrollbar{width:0;height:0;}}"], ({
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;}}"], ({
3917
3893
  $variant
3918
3894
  }) => variants$1[$variant], ({
3919
3895
  $scrollable
@@ -6171,20 +6147,30 @@ const snackbar = {
6171
6147
  }
6172
6148
  };
6173
6149
 
6174
- const StyledSnackbar = styled__default.default(Paper).withConfig({
6175
- displayName: "Snackbar__StyledSnackbar",
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",
6176
6154
  componentId: "sc-ac6no8-0"
6177
6155
  })(({
6178
6156
  theme,
6179
6157
  $placement
6180
6158
  }) => {
6181
- return styled.css(["position:fixed;background-color:", ";", " ", " ", " min-height:", ";box-sizing:border-box;z-index:1400;", " a,button{color:", ";}"], theme.background, edsUtils.spacingsTemplate(theme.spacings), edsUtils.bordersTemplate(theme.border), edsUtils.typographyTemplate(theme.typography), theme.minHeight, {
6159
+ return styled.css(["inset:unset;border:0;overflow:visible;position:fixed;padding:0;background-color:transparent;", " &::backdrop{background-color:transparent;}"], {
6182
6160
  top: $placement.includes('top') ? theme.spacings.top : $placement === 'left' || $placement === 'right' ? '50%' : undefined,
6183
6161
  bottom: $placement.includes('bottom') ? theme.spacings.bottom : undefined,
6184
6162
  right: $placement.includes('right') ? theme.spacings.right : undefined,
6185
6163
  left: $placement.includes('left') ? theme.spacings.left : $placement === 'top' || $placement === 'bottom' ? '50%' : undefined,
6186
6164
  transform: $placement === 'left' || $placement === 'right' ? 'translateY(-50%)' : $placement === 'top' || $placement === 'bottom' ? 'translateX(-50%)' : undefined
6187
- }, theme.entities.button.typography.color);
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);
6188
6174
  });
6189
6175
  const Snackbar$1 = /*#__PURE__*/react.forwardRef(function Snackbar({
6190
6176
  open = false,
@@ -6207,10 +6193,9 @@ const Snackbar$1 = /*#__PURE__*/react.forwardRef(function Snackbar({
6207
6193
  }, autoHideDuration);
6208
6194
  }
6209
6195
  return () => clearTimeout(timer.current);
6210
- }, [open, autoHideDuration, setVisible, onClose]);
6196
+ }, [open, setVisible, autoHideDuration, onClose]);
6211
6197
  const props = {
6212
6198
  ref,
6213
- $placement: placement,
6214
6199
  ...rest
6215
6200
  };
6216
6201
  const {
@@ -6221,12 +6206,17 @@ const Snackbar$1 = /*#__PURE__*/react.forwardRef(function Snackbar({
6221
6206
  }, snackbar);
6222
6207
  return /*#__PURE__*/jsxRuntime.jsx(styled.ThemeProvider, {
6223
6208
  theme: token,
6224
- children: visible && /*#__PURE__*/ReactDom__namespace.createPortal( /*#__PURE__*/jsxRuntime.jsx(StyledSnackbar, {
6225
- role: "alert",
6226
- elevation: "overlay",
6227
- ...props,
6228
- children: children
6229
- }), document.body)
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
+ })
6230
6220
  });
6231
6221
  });
6232
6222
 
@@ -7708,6 +7698,7 @@ const MenuSection = /*#__PURE__*/react.memo(function MenuSection(props) {
7708
7698
  variant: "small"
7709
7699
  })
7710
7700
  }), title && /*#__PURE__*/jsxRuntime.jsx(Header, {
7701
+ role: "group",
7711
7702
  children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
7712
7703
  group: "navigation",
7713
7704
  variant: "label",
@@ -7818,11 +7809,13 @@ const {
7818
7809
  const MenuPaper = styled__default.default(Paper).withConfig({
7819
7810
  displayName: "Menu__MenuPaper",
7820
7811
  componentId: "sc-1vlnqcj-0"
7821
- })(["position:absolute;z-index:1400;width:fit-content;min-width:fit-content;", ";", ";"], edsUtils.bordersTemplate(border$1), ({
7822
- open
7823
- }) => styled.css({
7824
- display: open ? 'block' : 'none'
7825
- }));
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;}"]);
7826
7819
  const MenuContainer = /*#__PURE__*/react.forwardRef(function MenuContainer({
7827
7820
  children,
7828
7821
  anchorEl,
@@ -7951,13 +7944,19 @@ const Menu$1 = /*#__PURE__*/react.forwardRef(function Menu({
7951
7944
  return react$1.autoUpdate(refs.reference.current, refs.floating.current, update);
7952
7945
  }
7953
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]);
7954
7954
  const {
7955
7955
  getFloatingProps
7956
7956
  } = react$1.useInteractions([react$1.useDismiss(context, {
7957
7957
  escapeKey: false
7958
7958
  })]);
7959
7959
  const props = {
7960
- open,
7961
7960
  className
7962
7961
  };
7963
7962
  const menuProps = {
@@ -7966,14 +7965,10 @@ const Menu$1 = /*#__PURE__*/react.forwardRef(function Menu({
7966
7965
  anchorEl,
7967
7966
  open
7968
7967
  };
7969
-
7970
- //temporary fix when inside dialog. Should be replaced by popover api when it is ready
7971
- const inDialog = edsUtils.useIsInDialog(anchorEl);
7972
- const menuElement = /*#__PURE__*/jsxRuntime.jsx(styled.ThemeProvider, {
7968
+ return /*#__PURE__*/jsxRuntime.jsx(styled.ThemeProvider, {
7973
7969
  theme: token,
7974
- children: /*#__PURE__*/jsxRuntime.jsx(MenuPaper, {
7975
- elevation: "raised",
7976
- ...props,
7970
+ children: /*#__PURE__*/jsxRuntime.jsx(StyledPopover$1, {
7971
+ popover: "manual",
7977
7972
  ...getFloatingProps({
7978
7973
  ref: popoverRef,
7979
7974
  style: {
@@ -7983,20 +7978,18 @@ const Menu$1 = /*#__PURE__*/react.forwardRef(function Menu({
7983
7978
  left: x || 0
7984
7979
  }
7985
7980
  }),
7986
- children: /*#__PURE__*/jsxRuntime.jsx(MenuProvider, {
7987
- children: /*#__PURE__*/jsxRuntime.jsx(MenuContainer, {
7988
- ...menuProps,
7989
- ref: ref
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
+ })
7990
7989
  })
7991
7990
  })
7992
7991
  })
7993
7992
  });
7994
- return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
7995
- children: inDialog ? menuElement : /*#__PURE__*/jsxRuntime.jsx(react$1.FloatingPortal, {
7996
- id: "eds-menu-container",
7997
- children: menuElement
7998
- })
7999
- });
8000
7993
  });
8001
7994
 
8002
7995
  const Menu = Menu$1;
@@ -9361,7 +9354,7 @@ const StyledListItem = styled__default.default.li.withConfig({
9361
9354
  $isdisabled
9362
9355
  }) => {
9363
9356
  const backgroundColor = $highlighted === 'true' ? theme.states.hover.background : $active === 'true' ? theme.states.active.background : theme.background;
9364
- 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) : '');
9365
9358
  });
9366
9359
  const Label = styled__default.default.span.withConfig({
9367
9360
  displayName: "Option__Label",
@@ -9465,7 +9458,7 @@ const findIndex = ({
9465
9458
  availableItems
9466
9459
  }) => {
9467
9460
  const nextItem = availableItems[index];
9468
- if (optionDisabled(nextItem)) {
9461
+ if (optionDisabled(nextItem) && index >= 0 && index < availableItems.length) {
9469
9462
  const nextIndex = calc(index);
9470
9463
  return findIndex({
9471
9464
  calc,
@@ -9700,7 +9693,7 @@ function AutocompleteInner(props, ref) {
9700
9693
  try {
9701
9694
  // eslint-disable-next-line @typescript-eslint/no-base-to-string
9702
9695
  return item?.toString();
9703
- } catch (error) {
9696
+ } catch {
9704
9697
  throw new Error('Unable to find label, make sure your are using options as documented');
9705
9698
  }
9706
9699
  }, [optionLabel]);
@@ -9975,7 +9968,7 @@ function AutocompleteInner(props, ref) {
9975
9968
  } = react$1.useFloating({
9976
9969
  placement: 'bottom-start',
9977
9970
  middleware: [react$1.offset(4), react$1.flip({
9978
- boundary: document?.body
9971
+ boundary: typeof document === 'undefined' ? undefined : document?.body
9979
9972
  }), react$1.size({
9980
9973
  apply({
9981
9974
  rects,
@@ -10001,9 +9994,9 @@ function AutocompleteInner(props, ref) {
10001
9994
  // MARK: popover toggle
10002
9995
  edsUtils.useIsomorphicLayoutEffect(() => {
10003
9996
  if (isOpen) {
10004
- refs.floating.current.showPopover();
9997
+ refs.floating.current?.showPopover();
10005
9998
  } else {
10006
- refs.floating.current.hidePopover();
9999
+ refs.floating.current?.hidePopover();
10007
10000
  }
10008
10001
  }, [isOpen, refs.floating]);
10009
10002
  const clear = () => {
@@ -12203,6 +12196,7 @@ const DateRangePicker = /*#__PURE__*/react.forwardRef(({
12203
12196
  timezone: timezone,
12204
12197
  formatOptions: formatOptions,
12205
12198
  children: /*#__PURE__*/jsxRuntime.jsx(FieldWrapper, {
12199
+ ...props,
12206
12200
  isOpen: isOpen,
12207
12201
  color: state.isInvalid ? 'warning' : props.variant,
12208
12202
  helperProps: helperProps ?? props.helperProps,
@@ -12,8 +12,8 @@ import { bordersTemplate, useToken, useIsomorphicLayoutEffect } from '@equinor/e
12
12
  import { AutocompleteOption } from './Option.js';
13
13
  import { useFloating, offset, flip, size, useInteractions, autoUpdate } from '@floating-ui/react';
14
14
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
15
- import pickBy from '../../node_modules/.pnpm/ramda@0.30.0/node_modules/ramda/es/pickBy.js';
16
- import mergeWith from '../../node_modules/.pnpm/ramda@0.30.0/node_modules/ramda/es/mergeWith.js';
15
+ import pickBy from '../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/pickBy.js';
16
+ import mergeWith from '../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeWith.js';
17
17
  import { HelperText as TextfieldHelperText } from '../InputWrapper/HelperText/HelperText.js';
18
18
  import { useEds } from '../EdsProvider/eds.context.js';
19
19
  import { Label } from '../Label/Label.js';
@@ -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 (error) {
307
+ } catch {
308
308
  throw new Error('Unable to find label, make sure your are using options as documented');
309
309
  }
310
310
  }, [optionLabel]);
@@ -579,7 +579,7 @@ function AutocompleteInner(props, ref) {
579
579
  } = useFloating({
580
580
  placement: 'bottom-start',
581
581
  middleware: [offset(4), flip({
582
- boundary: document?.body
582
+ boundary: typeof document === 'undefined' ? undefined : document?.body
583
583
  }), size({
584
584
  apply({
585
585
  rects,
@@ -605,9 +605,9 @@ function AutocompleteInner(props, ref) {
605
605
  // MARK: popover toggle
606
606
  useIsomorphicLayoutEffect(() => {
607
607
  if (isOpen) {
608
- refs.floating.current.showPopover();
608
+ refs.floating.current?.showPopover();
609
609
  } else {
610
- refs.floating.current.hidePopover();
610
+ refs.floating.current?.hidePopover();
611
611
  }
612
612
  }, [isOpen, refs.floating]);
613
613
  const clear = () => {
@@ -1,5 +1,5 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
- import mergeDeepRight from '../../node_modules/.pnpm/ramda@0.30.0/node_modules/ramda/es/mergeDeepRight.js';
2
+ import mergeDeepRight from '../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
3
3
 
4
4
  const {
5
5
  typography,
@@ -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",
@@ -1,6 +1,6 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
2
  import { button } from './button.js';
3
- import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.0/node_modules/ramda/es/mergeDeepRight.js';
3
+ import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
4
4
 
5
5
  const {
6
6
  colors: {
@@ -1,6 +1,6 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
2
  import { primary as primary$1, secondary as secondary$1, danger as danger$1 } from './contained.js';
3
- import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.0/node_modules/ramda/es/mergeDeepRight.js';
3
+ import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
4
4
 
5
5
  const {
6
6
  clickbounds: {
@@ -1,6 +1,6 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
2
  import { button } from './button.js';
3
- import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.0/node_modules/ramda/es/mergeDeepRight.js';
3
+ import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
4
4
 
5
5
  const {
6
6
  colors: {
@@ -1,6 +1,6 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
2
  import { button } from './button.js';
3
- import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.0/node_modules/ramda/es/mergeDeepRight.js';
3
+ import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
4
4
 
5
5
  const {
6
6
  colors: {
@@ -1,6 +1,6 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
2
  import { button } from './button.js';
3
- import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.0/node_modules/ramda/es/mergeDeepRight.js';
3
+ import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
4
4
 
5
5
  const {
6
6
  colors: {
@@ -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,5 +1,5 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
- import mergeDeepRight from '../../node_modules/.pnpm/ramda@0.30.0/node_modules/ramda/es/mergeDeepRight.js';
2
+ import mergeDeepRight from '../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
3
3
 
4
4
  const {
5
5
  colors: {
@@ -1,5 +1,5 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
- import mergeDeepRight from '../../node_modules/.pnpm/ramda@0.30.0/node_modules/ramda/es/mergeDeepRight.js';
2
+ import mergeDeepRight from '../../node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/mergeDeepRight.js';
3
3
 
4
4
  const {
5
5
  colors: {
@@ -1,11 +1,11 @@
1
1
  import { forwardRef, useMemo, useEffect } from 'react';
2
- import styled, { css, ThemeProvider } from 'styled-components';
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, useIsInDialog, useGlobalKeyPress } from '@equinor/eds-utils';
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, FloatingPortal } from '@floating-ui/react';
8
- import { jsx, Fragment } from 'react/jsx-runtime';
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
- })(["position:absolute;z-index:1400;width:fit-content;min-width:fit-content;", ";", ";"], bordersTemplate(border), ({
19
- open
20
- }) => css({
21
- display: open ? 'block' : 'none'
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(MenuPaper, {
172
- elevation: "raised",
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(MenuProvider, {
184
- children: /*#__PURE__*/jsx(MenuContainer, {
185
- ...menuProps,
186
- ref: ref
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 };
@@ -24,6 +24,7 @@ const MenuSection = /*#__PURE__*/memo(function MenuSection(props) {
24
24
  variant: "small"
25
25
  })
26
26
  }), title && /*#__PURE__*/jsx(Header, {
27
+ role: "group",
27
28
  children: /*#__PURE__*/jsx(Typography, {
28
29
  group: "navigation",
29
30
  variant: "label",
@@ -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 StyledSnackbar = styled(Paper).withConfig({
11
- displayName: "Snackbar__StyledSnackbar",
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(["position:fixed;background-color:", ";", " ", " ", " min-height:", ";box-sizing:border-box;z-index:1400;", " a,button{color:", ";}"], theme.background, spacingsTemplate(theme.spacings), bordersTemplate(theme.border), typographyTemplate(theme.typography), theme.minHeight, {
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
- }, theme.entities.button.typography.color);
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, autoHideDuration, setVisible, onClose]);
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__*/ReactDom.createPortal( /*#__PURE__*/jsx(StyledSnackbar, {
61
- role: "alert",
62
- elevation: "overlay",
63
- ...props,
64
- children: children
65
- }), document.body)
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