@equinor/eds-core-react 0.21.0 → 0.23.0-dev.20221003

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 (83) hide show
  1. package/dist/eds-core-react.cjs.js +233 -174
  2. package/dist/esm/components/Accordion/Accordion.js +1 -1
  3. package/dist/esm/components/Accordion/AccordionHeader.js +1 -1
  4. package/dist/esm/components/Accordion/AccordionItem.js +2 -2
  5. package/dist/esm/components/Autocomplete/Autocomplete.js +10 -9
  6. package/dist/esm/components/Autocomplete/Option.js +1 -1
  7. package/dist/esm/components/Banner/Banner.js +3 -3
  8. package/dist/esm/components/Banner/BannerMessage.js +1 -1
  9. package/dist/esm/components/Breadcrumbs/Breadcrumb.js +2 -2
  10. package/dist/esm/components/Breadcrumbs/Breadcrumbs.js +2 -2
  11. package/dist/esm/components/Button/Button.js +1 -1
  12. package/dist/esm/components/Button/ToggleButton/ToggleButton.js +55 -0
  13. package/dist/esm/components/Button/index.js +3 -0
  14. package/dist/esm/components/Button/tokens/button.js +10 -10
  15. package/dist/esm/components/Button/tokens/contained.js +1 -1
  16. package/dist/esm/components/Button/tokens/contained_icon.js +3 -3
  17. package/dist/esm/components/Button/tokens/ghost.js +1 -1
  18. package/dist/esm/components/Button/tokens/icon.js +4 -4
  19. package/dist/esm/components/Button/tokens/outlined.js +2 -2
  20. package/dist/esm/components/Card/Card.js +1 -1
  21. package/dist/esm/components/Card/CardActions.js +1 -1
  22. package/dist/esm/components/Checkbox/Input.js +3 -3
  23. package/dist/esm/components/Dialog/Dialog.js +29 -22
  24. package/dist/esm/components/Dialog/DialogContent.js +1 -1
  25. package/dist/esm/components/Dialog/DialogHeader.js +1 -1
  26. package/dist/esm/components/Divider/Divider.js +15 -7
  27. package/dist/esm/components/Divider/Divider.tokens.js +5 -16
  28. package/dist/esm/components/EdsProvider/eds.context.js +5 -3
  29. package/dist/esm/components/Icon/Icon.js +7 -7
  30. package/dist/esm/components/Input/Input.js +1 -1
  31. package/dist/esm/components/Menu/Menu.context.js +1 -1
  32. package/dist/esm/components/Menu/Menu.js +6 -6
  33. package/dist/esm/components/Menu/MenuSection.js +1 -1
  34. package/dist/esm/components/Pagination/Pagination.js +12 -7
  35. package/dist/esm/components/Popover/Popover.js +10 -10
  36. package/dist/esm/components/Popover/PopoverActions.js +1 -1
  37. package/dist/esm/components/Popover/PopoverContent.js +1 -1
  38. package/dist/esm/components/Popover/PopoverHeader.js +1 -1
  39. package/dist/esm/components/Progress/Circular/CircularProgress.js +2 -2
  40. package/dist/esm/components/Progress/Linear/LinearProgress.js +2 -2
  41. package/dist/esm/components/Radio/Radio.js +2 -2
  42. package/dist/esm/components/Scrim/Scrim.js +6 -11
  43. package/dist/esm/components/Scrim/Scrim.tokens.js +0 -2
  44. package/dist/esm/components/Search/Search.js +2 -2
  45. package/dist/esm/components/Select/MultiSelect/MultiSelect.js +4 -4
  46. package/dist/esm/components/Select/NativeSelect/NativeSelect.js +2 -2
  47. package/dist/esm/components/Select/SingleSelect/SingleSelect.js +3 -3
  48. package/dist/esm/components/Select/commonStyles.js +1 -1
  49. package/dist/esm/components/SideSheet/SideSheet.js +1 -1
  50. package/dist/esm/components/Slider/Slider.js +4 -4
  51. package/dist/esm/components/Snackbar/Snackbar.js +1 -1
  52. package/dist/esm/components/Switch/Switch.js +1 -1
  53. package/dist/esm/components/Switch/Switch.tokens.js +4 -4
  54. package/dist/esm/components/Table/Cell.js +2 -2
  55. package/dist/esm/components/Table/DataCell/DataCell.js +1 -1
  56. package/dist/esm/components/Table/DataCell/DataCell.tokens.js +5 -5
  57. package/dist/esm/components/Table/HeaderCell/HeaderCell.js +1 -1
  58. package/dist/esm/components/Table/HeaderCell/HeaderCell.tokens.js +5 -5
  59. package/dist/esm/components/Table/index.js +1 -1
  60. package/dist/esm/components/TableOfContents/TableOfContents.js +2 -2
  61. package/dist/esm/components/Tabs/TabList.js +2 -2
  62. package/dist/esm/components/Tabs/TabPanels.js +2 -2
  63. package/dist/esm/components/Tabs/Tabs.js +1 -1
  64. package/dist/esm/components/Tabs/Tabs.tokens.js +1 -1
  65. package/dist/esm/components/TextField/Field.js +5 -5
  66. package/dist/esm/components/TextField/HelperText/HelperText.js +2 -2
  67. package/dist/esm/components/TextField/TextField.context.js +1 -1
  68. package/dist/esm/components/TextField/TextField.js +3 -3
  69. package/dist/esm/components/Textarea/Textarea.js +3 -3
  70. package/dist/esm/components/Tooltip/Tooltip.js +4 -4
  71. package/dist/esm/components/TopBar/TopBar.js +7 -4
  72. package/dist/esm/components/Typography/Typography.js +3 -3
  73. package/dist/esm/index.js +14 -14
  74. package/dist/esm/node_modules/.pnpm/ramda@0.28.0/node_modules/ramda/es/mergeDeepRight.js +3 -1
  75. package/dist/types/components/Button/ToggleButton/ToggleButton.d.ts +18 -0
  76. package/dist/types/components/Button/ToggleButton/index.d.ts +1 -0
  77. package/dist/types/components/Button/index.d.ts +3 -1
  78. package/dist/types/components/Divider/Divider.d.ts +4 -0
  79. package/dist/types/components/Divider/Divider.tokens.d.ts +0 -1
  80. package/dist/types/components/EdsProvider/eds.context.d.ts +1 -0
  81. package/dist/types/components/Select/commonStyles.d.ts +5 -0
  82. package/dist/types/components/TopBar/TopBar.d.ts +4 -0
  83. package/package.json +41 -43
@@ -2,8 +2,8 @@ import { forwardRef, Children, cloneElement } from 'react';
2
2
  import { ThemeProvider } from 'styled-components';
3
3
  import { accordion } from './Accordion.tokens.js';
4
4
  import { useId, useToken } from '@equinor/eds-utils';
5
- import { useEds } from '../EdsProvider/eds.context.js';
6
5
  import { jsx } from 'react/jsx-runtime';
6
+ import { useEds } from '../EdsProvider/eds.context.js';
7
7
 
8
8
  const Accordion = /*#__PURE__*/forwardRef(function Accordion(_ref, ref) {
9
9
  let {
@@ -136,7 +136,7 @@ const AccordionHeader = /*#__PURE__*/forwardRef(function AccordionHeader(_ref5,
136
136
  size: 24,
137
137
  chevronPosition: chevronPosition,
138
138
  color: disabled ? chevronToken.states.disabled.background : chevronToken.background
139
- }, "".concat(id, "-icon"));
139
+ }, `${id}-icon`);
140
140
 
141
141
  const headerChildren = Children.map(children, child => {
142
142
  if (typeof child === 'string') {
@@ -19,8 +19,8 @@ const AccordionItem = /*#__PURE__*/forwardRef(function AccordionItem(_ref, ref)
19
19
  };
20
20
 
21
21
  const Children$1 = Children.map(children, (child, childIndex) => {
22
- const headerId = "".concat(accordionId, "-header-").concat(index + 1);
23
- const panelId = "".concat(accordionId, "-panel-").concat(index + 1);
22
+ const headerId = `${accordionId}-header-${index + 1}`;
23
+ const panelId = `${accordionId}-panel-${index + 1}`;
24
24
  return childIndex === 0 ? /*#__PURE__*/cloneElement(child, {
25
25
  isExpanded: expanded,
26
26
  toggleExpanded,
@@ -3,16 +3,16 @@ import { useMultipleSelection, useCombobox } from 'downshift';
3
3
  import styled, { css, ThemeProvider } from 'styled-components';
4
4
  import { Button } from '../Button/index.js';
5
5
  import { List } from '../List/index.js';
6
- import { useEds } from '../EdsProvider/eds.context.js';
7
- import { Label } from '../Label/Label.js';
8
6
  import { Icon } from '../Icon/index.js';
9
- import { Input } from '../Input/Input.js';
10
7
  import { close, arrow_drop_up, arrow_drop_down } from '@equinor/eds-icons';
11
8
  import { multiSelect, selectTokens } from './Autocomplete.tokens.js';
12
9
  import { bordersTemplate, useToken } from '@equinor/eds-utils';
13
10
  import { AutocompleteOption } from './Option.js';
14
11
  import { useFloating, offset, flip, shift, size, useInteractions, autoUpdate, FloatingPortal } from '@floating-ui/react-dom-interactions';
15
12
  import { jsx, jsxs } from 'react/jsx-runtime';
13
+ import { Input } from '../Input/Input.js';
14
+ import { useEds } from '../EdsProvider/eds.context.js';
15
+ import { Label } from '../Label/Label.js';
16
16
 
17
17
  const Container = styled.div.withConfig({
18
18
  displayName: "Autocomplete__Container",
@@ -332,7 +332,7 @@ function AutocompleteInner(props, ref) {
332
332
  }
333
333
 
334
334
  if (multiple) {
335
- placeholderText = typeof placeholderText !== 'undefined' ? placeholderText : "".concat(selectedItems.length, "/").concat(options.length - disabledItems.length, " selected");
335
+ placeholderText = typeof placeholderText !== 'undefined' ? placeholderText : `${selectedItems.length}/${options.length - disabledItems.length} selected`;
336
336
  comboBoxProps = { ...comboBoxProps,
337
337
  selectedItem: null,
338
338
  stateReducer: (state, actionAndChanges) => {
@@ -429,10 +429,10 @@ function AutocompleteInner(props, ref) {
429
429
  availableHeight,
430
430
  elements
431
431
  } = _ref10;
432
- const anchorWidth = "".concat(rects.reference.width, "px");
432
+ const anchorWidth = `${rects.reference.width}px`;
433
433
  Object.assign(elements.floating.style, {
434
- width: "".concat(autoWidth ? anchorWidth : 'auto'),
435
- maxHeight: "".concat(availableHeight, "px")
434
+ width: `${autoWidth ? anchorWidth : 'auto'}`,
435
+ maxHeight: `${availableHeight}px`
436
436
  });
437
437
  },
438
438
 
@@ -463,8 +463,9 @@ function AutocompleteInner(props, ref) {
463
463
  ref: floating,
464
464
  style: {
465
465
  position: strategy,
466
- top: y !== null && y !== void 0 ? y : 0,
467
- left: x !== null && x !== void 0 ? x : 0
466
+ top: y || 0,
467
+ left: x || 0,
468
+ zIndex: 1400
468
469
  }
469
470
  }),
470
471
  children: /*#__PURE__*/jsx(StyledList, { ...getMenuProps({
@@ -1,9 +1,9 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
  import { List } from '../List/index.js';
4
- import { Checkbox } from '../Checkbox/Checkbox.js';
5
4
  import { typographyTemplate, spacingsTemplate } from '@equinor/eds-utils';
6
5
  import { jsxs, jsx } from 'react/jsx-runtime';
6
+ import { Checkbox } from '../Checkbox/Checkbox.js';
7
7
 
8
8
  const StyledListItem = styled(List.Item).withConfig({
9
9
  displayName: "Option__StyledListItem",
@@ -1,12 +1,12 @@
1
1
  import { forwardRef, Children, isValidElement } from 'react';
2
2
  import styled, { css, ThemeProvider } from 'styled-components';
3
3
  import { spacingsTemplate, useToken } from '@equinor/eds-utils';
4
- import { Paper } from '../Paper/Paper.js';
5
4
  import { enabled } from './Banner.tokens.js';
6
- import { Divider } from '../Divider/Divider.js';
7
5
  import { BannerIcon } from './BannerIcon.js';
8
- import { useEds } from '../EdsProvider/eds.context.js';
9
6
  import { jsx, jsxs } from 'react/jsx-runtime';
7
+ import { Divider } from '../Divider/Divider.js';
8
+ import { useEds } from '../EdsProvider/eds.context.js';
9
+ import { Paper } from '../Paper/Paper.js';
10
10
 
11
11
  const Content = styled.div.withConfig({
12
12
  displayName: "Banner__Content",
@@ -1,7 +1,7 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled from 'styled-components';
3
- import { Typography } from '../Typography/Typography.js';
4
3
  import { jsx } from 'react/jsx-runtime';
4
+ import { Typography } from '../Typography/Typography.js';
5
5
 
6
6
  const StyledBannerMessage = styled(Typography).withConfig({
7
7
  displayName: "BannerMessage__StyledBannerMessage",
@@ -1,9 +1,9 @@
1
1
  import { forwardRef, useMemo } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
- import { Typography } from '../Typography/Typography.js';
4
- import { Tooltip } from '../Tooltip/Tooltip.js';
5
3
  import { breadcrumbs } from './Breadcrumbs.tokens.js';
6
4
  import { jsx } from 'react/jsx-runtime';
5
+ import { Tooltip } from '../Tooltip/Tooltip.js';
6
+ import { Typography } from '../Typography/Typography.js';
7
7
 
8
8
  const {
9
9
  states,
@@ -1,9 +1,9 @@
1
1
  import { forwardRef, useState, Children, Fragment } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { breadcrumbs } from './Breadcrumbs.tokens.js';
4
- import { Typography } from '../Typography/Typography.js';
5
4
  import { spacingsTemplate } from '@equinor/eds-utils';
6
5
  import { jsxs, jsx } from 'react/jsx-runtime';
6
+ import { Typography } from '../Typography/Typography.js';
7
7
 
8
8
  const {
9
9
  spacings,
@@ -87,7 +87,7 @@ const Breadcrumbs = /*#__PURE__*/forwardRef(function Breadcrumbs(_ref, ref) {
87
87
  children: "/"
88
88
  })
89
89
  })]
90
- }, "breadcrumb-".concat(index)));
90
+ }, `breadcrumb-${index}`));
91
91
  return /*#__PURE__*/jsx("nav", { ...props,
92
92
  "aria-label": "breadcrumbs",
93
93
  children: /*#__PURE__*/jsx(OrderedList, {
@@ -3,8 +3,8 @@ import styled, { css, ThemeProvider } from 'styled-components';
3
3
  import { token } from './tokens/index.js';
4
4
  import { spacingsTemplate, bordersTemplate, typographyTemplate, outlineTemplate, useToken } from '@equinor/eds-utils';
5
5
  import { InnerFullWidth } from './InnerFullWidth.js';
6
- import { useEds } from '../EdsProvider/eds.context.js';
7
6
  import { jsx } from 'react/jsx-runtime';
7
+ import { useEds } from '../EdsProvider/eds.context.js';
8
8
 
9
9
  const getVariant = (tokenSet, variant) => {
10
10
  switch (variant) {
@@ -0,0 +1,55 @@
1
+ import { forwardRef, useState, useEffect, Children, isValidElement, cloneElement } from 'react';
2
+ import { Button } from '../Button.js';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import { ButtonGroup } from '../ButtonGroup/ButtonGroup.js';
5
+
6
+ const ToggleButton = /*#__PURE__*/forwardRef(function ToggleButton(_ref, ref) {
7
+ let {
8
+ children,
9
+ multiple,
10
+ selectedIndexes,
11
+ onChange,
12
+ ...props
13
+ } = _ref;
14
+ const [pickedIndexes, setPickedIndexes] = useState(selectedIndexes || []);
15
+ useEffect(() => {
16
+ if (Array.isArray(selectedIndexes)) {
17
+ setPickedIndexes(selectedIndexes);
18
+ }
19
+ }, [selectedIndexes]);
20
+ const updatedChildren = Children.map(children, (child, index) => {
21
+ const isSelected = pickedIndexes.includes(index);
22
+ const childElement = child;
23
+
24
+ if ( /*#__PURE__*/isValidElement(child) && child.type === Button) {
25
+ const buttonProps = {
26
+ 'aria-pressed': isSelected ? true : undefined,
27
+ variant: isSelected ? 'contained' : 'outlined',
28
+ onClick: e => {
29
+ var _childElement$props, _childElement$props$o;
30
+
31
+ (_childElement$props = childElement.props) === null || _childElement$props === void 0 ? void 0 : (_childElement$props$o = _childElement$props.onClick) === null || _childElement$props$o === void 0 ? void 0 : _childElement$props$o.call(_childElement$props, e);
32
+ let updatedSelection = [index];
33
+
34
+ if (multiple) {
35
+ updatedSelection = pickedIndexes.includes(index) ? pickedIndexes.filter(i => i !== index) : [...pickedIndexes, index];
36
+ }
37
+
38
+ setPickedIndexes(updatedSelection);
39
+
40
+ if (onChange) {
41
+ onChange(updatedSelection);
42
+ }
43
+ }
44
+ };
45
+ return /*#__PURE__*/cloneElement(child, buttonProps);
46
+ }
47
+ });
48
+ return /*#__PURE__*/jsx(ButtonGroup, {
49
+ ref: ref,
50
+ ...props,
51
+ children: updatedChildren
52
+ });
53
+ });
54
+
55
+ export { ToggleButton };
@@ -1,8 +1,11 @@
1
1
  import { Button as Button$1 } from './Button.js';
2
2
  import { ButtonGroup } from './ButtonGroup/ButtonGroup.js';
3
+ import { ToggleButton } from './ToggleButton/ToggleButton.js';
3
4
 
4
5
  const Button = Button$1;
5
6
  Button.Group = ButtonGroup;
7
+ Button.Toggle = ToggleButton;
6
8
  Button.Group.displayName = 'Button.Group';
9
+ Button.Toggle.displayName = 'Button.Toggle';
7
10
 
8
11
  export { Button };
@@ -47,29 +47,29 @@ const {
47
47
  } = tokens;
48
48
  const button = {
49
49
  background: 'transparent',
50
- height: "var(--eds_button__height, ".concat(buttonHeight, ")"),
50
+ height: `var(--eds_button__height, ${buttonHeight})`,
51
51
  typography: { ...buttonTypography,
52
52
  textAlign: 'center',
53
- fontSize: "var(--eds_button__font_size, ".concat(buttonTypography.fontSize, ")")
53
+ fontSize: `var(--eds_button__font_size, ${buttonTypography.fontSize})`
54
54
  },
55
55
  border: {
56
56
  type: 'border',
57
- width: "var(--eds_button__border_width, 1px)",
57
+ width: `var(--eds_button__border_width, 1px)`,
58
58
  color: 'transparent',
59
- radius: "var(--eds_button__radius, ".concat(buttonBorderRadius, ")"),
59
+ radius: `var(--eds_button__radius, ${buttonBorderRadius})`,
60
60
  style: 'solid'
61
61
  },
62
62
  spacings: {
63
63
  top: 'var(--eds_button__padding_y, 0)',
64
64
  bottom: 'var(--eds_button__padding_y, 0)',
65
- left: "var(--eds_button__padding_x, ".concat(medium, ")"),
66
- right: "var(--eds_button__padding_x, ".concat(medium, ")")
65
+ left: `var(--eds_button__padding_x, ${medium})`,
66
+ right: `var(--eds_button__padding_x, ${medium})`
67
67
  },
68
68
  clickbound: {
69
69
  height: clicboundHeight,
70
70
  width: '100%',
71
71
  offset: {
72
- top: "".concat((parseInt(clicboundHeight) - parseInt(buttonHeight)) / 2 + 1, "px"),
72
+ top: `${(parseInt(clicboundHeight) - parseInt(buttonHeight)) / 2 + 1}px`,
73
73
  left: '0'
74
74
  }
75
75
  },
@@ -85,7 +85,7 @@ const button = {
85
85
  type: 'border',
86
86
  width: '1px',
87
87
  color: 'transparent',
88
- radius: "var(--eds_button__radius, ".concat(buttonBorderRadius, ")"),
88
+ radius: `var(--eds_button__radius, ${buttonBorderRadius})`,
89
89
  style: 'solid'
90
90
  }
91
91
  },
@@ -114,7 +114,7 @@ const button = {
114
114
  },
115
115
  modes: {
116
116
  compact: {
117
- height: "var(--eds_button__height_compact, ".concat(compactButtonHeight, ")"),
117
+ height: `var(--eds_button__height_compact, ${compactButtonHeight})`,
118
118
  spacings: {
119
119
  top: 'var(--eds_button__padding_y_compact, 0)',
120
120
  bottom: 'var(--eds_button__padding_y_compact, 0)'
@@ -123,7 +123,7 @@ const button = {
123
123
  height: compactClickboundHeight,
124
124
  width: '100%',
125
125
  offset: {
126
- top: "".concat((parseInt(compactClickboundHeight) - parseInt(compactButtonHeight)) / 2 + 1, "px"),
126
+ top: `${(parseInt(compactClickboundHeight) - parseInt(compactButtonHeight)) / 2 + 1}px`,
127
127
  left: '0'
128
128
  }
129
129
  }
@@ -46,7 +46,7 @@ const primary = mergeDeepRight(button, {
46
46
  style: 'solid',
47
47
  width: '1px',
48
48
  color: primaryColor,
49
- radius: "var(--eds_button__radius, ".concat(buttonBorderRadius, ")")
49
+ radius: `var(--eds_button__radius, ${buttonBorderRadius})`
50
50
  },
51
51
  states: {
52
52
  hover: {
@@ -1,6 +1,6 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
- import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.28.0/node_modules/ramda/es/mergeDeepRight.js';
3
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.28.0/node_modules/ramda/es/mergeDeepRight.js';
4
4
 
5
5
  const {
6
6
  clickbounds: {
@@ -24,7 +24,7 @@ const contained_icon = {
24
24
  width: clicboundHeight,
25
25
  offset: {
26
26
  top: '0',
27
- left: "".concat((parseInt(clicboundHeight) - parseInt('40px')) / 2, "px")
27
+ left: `${(parseInt(clicboundHeight) - parseInt('40px')) / 2}px`
28
28
  }
29
29
  },
30
30
  states: {
@@ -43,7 +43,7 @@ const contained_icon = {
43
43
  width: compactClickboundHeight,
44
44
  offset: {
45
45
  top: '0',
46
- left: "".concat((parseInt(compactClickboundHeight) - parseInt(shape._modes.compact.icon_button.minWidth)) / 2, "px")
46
+ left: `${(parseInt(compactClickboundHeight) - parseInt(shape._modes.compact.icon_button.minWidth)) / 2}px`
47
47
  }
48
48
  }
49
49
  }
@@ -1,6 +1,6 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
- import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.28.0/node_modules/ramda/es/mergeDeepRight.js';
3
2
  import { button } from './button.js';
3
+ import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.28.0/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
- import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.28.0/node_modules/ramda/es/mergeDeepRight.js';
3
2
  import { button } from './button.js';
3
+ import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.28.0/node_modules/ramda/es/mergeDeepRight.js';
4
4
 
5
5
  const {
6
6
  colors: {
@@ -61,7 +61,7 @@ const primary = mergeDeepRight(button, {
61
61
  width: clicboundHeight,
62
62
  offset: {
63
63
  top: '0',
64
- left: "".concat((parseInt(clicboundHeight) - parseInt(shape.icon_button.minWidth)) / 2, "px")
64
+ left: `${(parseInt(clicboundHeight) - parseInt(shape.icon_button.minWidth)) / 2}px`
65
65
  }
66
66
  },
67
67
  states: {
@@ -80,7 +80,7 @@ const primary = mergeDeepRight(button, {
80
80
  },
81
81
  focus: {
82
82
  outline: {
83
- offset: "-".concat(parseInt(focusOutlineWidth), "px")
83
+ offset: `-${parseInt(focusOutlineWidth)}px`
84
84
  }
85
85
  }
86
86
  },
@@ -92,7 +92,7 @@ const primary = mergeDeepRight(button, {
92
92
  width: compactClickboundHeight,
93
93
  offset: {
94
94
  top: '0',
95
- left: "".concat((parseInt(compactClickboundHeight) - parseInt(shape._modes.compact.icon_button.minWidth)) / 2, "px")
95
+ left: `${(parseInt(compactClickboundHeight) - parseInt(shape._modes.compact.icon_button.minWidth)) / 2}px`
96
96
  }
97
97
  }
98
98
  }
@@ -1,6 +1,6 @@
1
1
  import { tokens } from '@equinor/eds-tokens';
2
- import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.28.0/node_modules/ramda/es/mergeDeepRight.js';
3
2
  import { button } from './button.js';
3
+ import mergeDeepRight from '../../../node_modules/.pnpm/ramda@0.28.0/node_modules/ramda/es/mergeDeepRight.js';
4
4
 
5
5
  const {
6
6
  colors: {
@@ -49,7 +49,7 @@ const primary = mergeDeepRight(button, {
49
49
  style: 'solid',
50
50
  width: '1px',
51
51
  color: primaryColor,
52
- radius: "var(--eds_button__radius, ".concat(buttonBorderRadius, ")")
52
+ radius: `var(--eds_button__radius, ${buttonBorderRadius})`
53
53
  },
54
54
  states: {
55
55
  hover: {
@@ -1,9 +1,9 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled from 'styled-components';
3
- import { Paper } from '../Paper/Paper.js';
4
3
  import * as Card_tokens from './Card.tokens.js';
5
4
  import { bordersTemplate } from '@equinor/eds-utils';
6
5
  import { jsx } from 'react/jsx-runtime';
6
+ import { Paper } from '../Paper/Paper.js';
7
7
 
8
8
  const {
9
9
  primary
@@ -1,8 +1,8 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled from 'styled-components';
3
- import { Typography } from '../Typography/Typography.js';
4
3
  import { primary } from './Card.tokens.js';
5
4
  import { jsxs, jsx } from 'react/jsx-runtime';
5
+ import { Typography } from '../Typography/Typography.js';
6
6
 
7
7
  const {
8
8
  spacings
@@ -3,8 +3,8 @@ import styled, { ThemeProvider } from 'styled-components';
3
3
  import { checkbox_indeterminate, checkbox as checkbox$1, checkbox_outline } from '@equinor/eds-icons';
4
4
  import { checkbox } from './Checkbox.tokens.js';
5
5
  import { outlineTemplate, spacingsTemplate, useToken } from '@equinor/eds-utils';
6
- import { useEds } from '../EdsProvider/eds.context.js';
7
6
  import { jsx, jsxs } from 'react/jsx-runtime';
7
+ import { useEds } from '../EdsProvider/eds.context.js';
8
8
 
9
9
  /* eslint camelcase: "off" */
10
10
  const StyledPath = styled.path.attrs(_ref => {
@@ -119,7 +119,7 @@ const CheckboxInput = /*#__PURE__*/forwardRef(function CheckboxInput(_ref10, ref
119
119
  }), indeterminate ? /*#__PURE__*/jsx(Svg, {
120
120
  width: iconSize,
121
121
  height: iconSize,
122
- viewBox: "0 0 ".concat(iconSize, " ").concat(iconSize),
122
+ viewBox: `0 0 ${iconSize} ${iconSize}`,
123
123
  fill: fill,
124
124
  "aria-hidden": true,
125
125
  children: /*#__PURE__*/jsx(StyledPath, {
@@ -129,7 +129,7 @@ const CheckboxInput = /*#__PURE__*/forwardRef(function CheckboxInput(_ref10, ref
129
129
  }) : /*#__PURE__*/jsxs(Svg, {
130
130
  width: iconSize,
131
131
  height: iconSize,
132
- viewBox: "0 0 ".concat(iconSize, " ").concat(iconSize),
132
+ viewBox: `0 0 ${iconSize} ${iconSize}`,
133
133
  fill: fill,
134
134
  "aria-hidden": true,
135
135
  children: [/*#__PURE__*/jsx(StyledPath, {
@@ -1,12 +1,12 @@
1
- import { forwardRef } from 'react';
2
- import { createPortal } from 'react-dom';
1
+ import { forwardRef, useMemo } from 'react';
3
2
  import styled, { css, ThemeProvider } from 'styled-components';
4
- import { typographyTemplate, bordersTemplate, useToken } from '@equinor/eds-utils';
5
- import { Paper } from '../Paper/Paper.js';
6
- import { Scrim } from '../Scrim/Scrim.js';
3
+ import { typographyTemplate, bordersTemplate, useToken, mergeRefs } from '@equinor/eds-utils';
7
4
  import { dialog } from './Dialog.tokens.js';
5
+ import { useFloating, FloatingPortal, FloatingFocusManager } from '@floating-ui/react-dom-interactions';
6
+ import { jsx } from 'react/jsx-runtime';
7
+ import { Scrim } from '../Scrim/Scrim.js';
8
+ import { Paper } from '../Paper/Paper.js';
8
9
  import { useEds } from '../EdsProvider/eds.context.js';
9
- import { jsx, Fragment } from 'react/jsx-runtime';
10
10
 
11
11
  const StyledDialog = styled(Paper).attrs({
12
12
  tabIndex: 0,
@@ -31,39 +31,46 @@ const Dialog = /*#__PURE__*/forwardRef(function Dialog(_ref2, ref) {
31
31
  isDismissable = false,
32
32
  ...props
33
33
  } = _ref2;
34
- const rest = { ...props,
35
- open,
36
- ref
37
- };
38
34
  const {
39
35
  density
40
36
  } = useEds();
41
37
  const token = useToken({
42
38
  density
43
39
  }, dialog);
40
+ const {
41
+ floating,
42
+ context
43
+ } = useFloating();
44
44
 
45
45
  const handleDismiss = () => {
46
46
  onClose && onClose();
47
47
  };
48
48
 
49
- if (!open) {
50
- return null;
51
- }
52
-
53
- return /*#__PURE__*/jsx(Fragment, {
54
- children: /*#__PURE__*/createPortal( /*#__PURE__*/jsx(ThemeProvider, {
49
+ const dialogRef = useMemo(() => mergeRefs(floating, ref), [floating, ref]);
50
+ const rest = { ...props,
51
+ open
52
+ };
53
+ return /*#__PURE__*/jsx(FloatingPortal, {
54
+ id: "eds-dialog-container",
55
+ children: /*#__PURE__*/jsx(ThemeProvider, {
55
56
  theme: token,
56
- children: /*#__PURE__*/jsx(Scrim, {
57
+ children: open && /*#__PURE__*/jsx(Scrim, {
57
58
  open: true,
58
59
  isDismissable: isDismissable,
59
60
  onClose: handleDismiss,
60
- children: /*#__PURE__*/jsx(StyledDialog, {
61
- elevation: "above_scrim",
62
- ...rest,
63
- children: children
61
+ children: /*#__PURE__*/jsx(FloatingFocusManager, {
62
+ context: context,
63
+ modal: true,
64
+ returnFocus: true,
65
+ children: /*#__PURE__*/jsx(StyledDialog, {
66
+ elevation: "above_scrim",
67
+ ...rest,
68
+ ref: dialogRef,
69
+ children: children
70
+ })
64
71
  })
65
72
  })
66
- }), document.body)
73
+ })
67
74
  });
68
75
  }); // Dialog.displayName = 'EdsDialog'
69
76
 
@@ -1,8 +1,8 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
- import { Divider } from '../Divider/Divider.js';
4
3
  import { typographyTemplate } from '@equinor/eds-utils';
5
4
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
5
+ import { Divider } from '../Divider/Divider.js';
6
6
 
7
7
  const StyledDialogContent = styled.div.withConfig({
8
8
  displayName: "DialogContent__StyledDialogContent",
@@ -1,7 +1,7 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
- import { Divider } from '../Divider/Divider.js';
4
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
+ import { Divider } from '../Divider/Divider.js';
5
5
 
6
6
  const StyledDialogHeader = styled.div.withConfig({
7
7
  displayName: "DialogHeader__StyledDialogHeader",
@@ -1,28 +1,36 @@
1
1
  import { forwardRef } from 'react';
2
- import styled from 'styled-components';
2
+ import styled, { css } from 'styled-components';
3
3
  import * as Divider_tokens from './Divider.tokens.js';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
 
6
6
  const {
7
- divider,
8
- baseDivider
7
+ divider
9
8
  } = Divider_tokens;
10
9
  const StyledDivider = styled.hr.withConfig({
11
10
  displayName: "Divider__StyledDivider",
12
11
  componentId: "sc-1d8osde-0"
13
- })(["border:none;background-color:", ";margin-top:", ";margin-bottom:", ";height:", ";"], props => props.backgroundColor, props => props.marginTop, props => props.marginBottom, props => props.dividerHeight);
14
- const Divider = /*#__PURE__*/forwardRef(function Divider(_ref, ref) {
12
+ })(_ref => {
13
+ let {
14
+ backgroundColor,
15
+ marginTop,
16
+ marginBottom,
17
+ dividerHeight
18
+ } = _ref;
19
+ return css(["border:none;background-color:", ";margin-top:", ";margin-bottom:calc(", " - ", "px);height:", "px;"], backgroundColor, marginTop, marginBottom, dividerHeight, dividerHeight);
20
+ });
21
+ const Divider = /*#__PURE__*/forwardRef(function Divider(_ref2, ref) {
15
22
  let {
16
23
  color = 'medium',
17
24
  variant = 'medium',
25
+ size = '1',
18
26
  ...rest
19
- } = _ref;
27
+ } = _ref2;
20
28
  const colorValue = color === 'medium' ? 'mediumColor' : color;
21
29
  const props = {
22
30
  backgroundColor: divider[colorValue].background,
23
31
  marginTop: Divider_tokens[variant].spacings.top,
24
32
  marginBottom: Divider_tokens[variant].spacings.bottom,
25
- dividerHeight: baseDivider.height,
33
+ dividerHeight: parseInt(size),
26
34
  ...rest
27
35
  };
28
36
  return /*#__PURE__*/jsx(StyledDivider, { ...props,
@@ -21,17 +21,6 @@ const {
21
21
  }
22
22
  }
23
23
  } = tokens$1;
24
- const dividerHeight = 1;
25
-
26
- const reduceByValue = subtractValue => valueWithUnit => {
27
- const valueAndUnit = valueWithUnit.split(/(\d+)/).filter(val => val.length > 0);
28
- return "".concat(parseInt(valueAndUnit[0]) - subtractValue) + valueAndUnit[1];
29
- };
30
-
31
- const reduceValueByDividerHeight = reduceByValue(dividerHeight);
32
- const baseDivider = {
33
- height: "".concat(dividerHeight, "px")
34
- };
35
24
  const divider = {
36
25
  lighter: {
37
26
  background: lighter
@@ -43,17 +32,17 @@ const divider = {
43
32
  background: mediumColor
44
33
  }
45
34
  };
46
- const small = { ...baseDivider,
35
+ const small = {
47
36
  spacings: {
48
37
  top: spacingSmall,
49
- bottom: reduceValueByDividerHeight(spacingSmall)
38
+ bottom: spacingSmall
50
39
  }
51
40
  };
52
- const medium = { ...baseDivider,
41
+ const medium = {
53
42
  spacings: {
54
43
  top: spacingMedium,
55
- bottom: reduceValueByDividerHeight(spacingMedium)
44
+ bottom: spacingMedium
56
45
  }
57
46
  };
58
47
 
59
- export { baseDivider, divider, medium, small };
48
+ export { divider, medium, small };