@equinor/eds-core-react 0.20.3 → 0.21.0-dev.20220905

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 (69) hide show
  1. package/README.md +8 -0
  2. package/dist/eds-core-react.cjs.js +583 -313
  3. package/dist/esm/components/Accordion/Accordion.tokens.js +7 -0
  4. package/dist/esm/components/Accordion/AccordionHeader.js +4 -0
  5. package/dist/esm/components/Accordion/AccordionHeaderActions.js +3 -1
  6. package/dist/esm/components/Accordion/AccordionHeaderTitle.js +3 -1
  7. package/dist/esm/components/Accordion/AccordionPanel.js +2 -2
  8. package/dist/esm/components/Autocomplete/Autocomplete.js +93 -68
  9. package/dist/esm/components/Breadcrumbs/Breadcrumb.js +4 -2
  10. package/dist/esm/components/Button/Button.js +4 -1
  11. package/dist/esm/components/Button/ButtonGroup/ButtonGroup.js +37 -0
  12. package/dist/esm/components/Button/ButtonGroup/ButtonGroup.tokens.js +17 -0
  13. package/dist/esm/components/Button/index.js +8 -0
  14. package/dist/esm/components/Button/tokens/contained_icon.js +56 -0
  15. package/dist/esm/components/Button/tokens/index.js +7 -3
  16. package/dist/esm/components/Card/Card.js +3 -12
  17. package/dist/esm/components/Checkbox/Checkbox.js +4 -0
  18. package/dist/esm/components/Checkbox/Input.js +5 -1
  19. package/dist/esm/components/Icon/Icon.js +1 -1
  20. package/dist/esm/components/Menu/Menu.js +56 -40
  21. package/dist/esm/components/Menu/MenuItem.js +2 -2
  22. package/dist/esm/components/Pagination/Pagination.js +1 -1
  23. package/dist/esm/components/Pagination/PaginationItem.js +1 -1
  24. package/dist/esm/components/Popover/Popover.js +90 -35
  25. package/dist/esm/components/Radio/Radio.js +4 -0
  26. package/dist/esm/components/Scrim/Scrim.js +3 -3
  27. package/dist/esm/components/Search/Search.js +7 -4
  28. package/dist/esm/components/Select/NativeSelect/NativeSelect.js +3 -1
  29. package/dist/esm/components/Select/commonStyles.js +1 -1
  30. package/dist/esm/components/SideSheet/SideSheet.js +8 -6
  31. package/dist/esm/components/SideSheet/SideSheet.tokens.js +7 -0
  32. package/dist/esm/components/Switch/Switch.js +6 -0
  33. package/dist/esm/components/Switch/SwitchDefault.js +4 -0
  34. package/dist/esm/components/Switch/SwitchSmall.js +4 -0
  35. package/dist/esm/components/Tabs/TabList.js +2 -3
  36. package/dist/esm/components/Tabs/Tabs.js +3 -3
  37. package/dist/esm/components/TextField/TextField.js +2 -1
  38. package/dist/esm/components/Textarea/Textarea.js +4 -3
  39. package/dist/esm/components/Tooltip/Tooltip.js +102 -83
  40. package/dist/esm/components/TopBar/TopBar.tokens.js +2 -2
  41. package/dist/esm/index.js +1 -1
  42. package/dist/types/components/Autocomplete/Autocomplete.d.ts +4 -0
  43. package/dist/types/components/Breadcrumbs/Breadcrumb.d.ts +9 -6
  44. package/dist/types/components/Button/Button.d.ts +8 -26
  45. package/dist/types/components/Button/Button.types.d.ts +1 -0
  46. package/dist/types/components/Button/ButtonGroup/ButtonGroup.d.ts +9 -0
  47. package/dist/types/components/{Group/Group.tokens.d.ts → Button/ButtonGroup/ButtonGroup.tokens.d.ts} +0 -0
  48. package/dist/types/components/Button/ButtonGroup/index.d.ts +1 -0
  49. package/dist/types/components/Button/index.d.ts +8 -1
  50. package/dist/types/components/Button/tokens/contained_icon.d.ts +4 -0
  51. package/dist/types/components/Checkbox/Checkbox.d.ts +13 -5
  52. package/dist/types/components/Checkbox/Input.d.ts +10 -5
  53. package/dist/types/components/Icon/Icon.d.ts +1 -1
  54. package/dist/types/components/Menu/Menu.d.ts +1 -1
  55. package/dist/types/components/Popover/Popover.d.ts +1 -1
  56. package/dist/types/components/Progress/Circular/CircularProgress.d.ts +1 -1
  57. package/dist/types/components/Progress/Dots/DotProgress.d.ts +1 -1
  58. package/dist/types/components/Progress/Star/StarProgress.d.ts +1 -1
  59. package/dist/types/components/Radio/Radio.d.ts +8 -5
  60. package/dist/types/components/Select/commonStyles.d.ts +5 -9
  61. package/dist/types/components/SideSheet/SideSheet.d.ts +4 -0
  62. package/dist/types/components/Switch/Switch.d.ts +10 -5
  63. package/dist/types/components/Switch/SwitchDefault.d.ts +3 -5
  64. package/dist/types/components/Switch/SwitchSmall.d.ts +3 -5
  65. package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
  66. package/dist/types/components/Typography/Typography.d.ts +11 -3
  67. package/package.json +5 -6
  68. package/dist/types/components/Group/Group.d.ts +0 -3
  69. package/dist/types/components/Group/index.d.ts +0 -1
@@ -1,12 +1,12 @@
1
- import { forwardRef, useState, useEffect } from 'react';
2
- import * as ReactDom from 'react-dom';
1
+ import { forwardRef, useLayoutEffect, useMemo, useEffect } from 'react';
3
2
  import styled, { css, ThemeProvider } from 'styled-components';
4
3
  import { MenuProvider, useMenu } from './Menu.context.js';
5
4
  import { Paper } from '../Paper/Paper.js';
6
5
  import { MenuList } from './MenuList.js';
7
- import { bordersTemplate, useIsMounted, useToken, usePopper, useOutsideClick, useGlobalKeyPress } from '@equinor/eds-utils';
6
+ import { bordersTemplate, useToken, mergeRefs, useGlobalKeyPress } from '@equinor/eds-utils';
8
7
  import { menu } from './Menu.tokens.js';
9
8
  import { useEds } from '../EdsProvider/eds.context.js';
9
+ import { useFloating, offset, flip, shift, autoUpdate, useInteractions, useDismiss, FloatingPortal } from '@floating-ui/react-dom-interactions';
10
10
  import { jsx, Fragment } from 'react/jsx-runtime';
11
11
 
12
12
  const {
@@ -29,7 +29,6 @@ const MenuContainer = /*#__PURE__*/forwardRef(function MenuContainer(_ref2, ref)
29
29
  anchorEl,
30
30
  onClose: onCloseCallback,
31
31
  open,
32
- containerEl,
33
32
  ...rest
34
33
  } = _ref2;
35
34
  const {
@@ -73,11 +72,6 @@ const MenuContainer = /*#__PURE__*/forwardRef(function MenuContainer(_ref2, ref)
73
72
  if (anchorEl) anchorEl.removeEventListener('keydown', openWithKey);
74
73
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
75
74
  }, [anchorEl]);
76
- useOutsideClick(containerEl, e => {
77
- if (open && onClose !== null && !anchorEl.contains(e.target)) {
78
- onClose();
79
- }
80
- });
81
75
  useGlobalKeyPress('Escape', () => {
82
76
  if (open && onClose !== null) {
83
77
  onClose();
@@ -102,60 +96,82 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref3, ref) {
102
96
  let {
103
97
  anchorEl,
104
98
  open,
105
- placement = 'auto',
99
+ placement = 'bottom',
100
+ onClose,
106
101
  style,
107
102
  className,
108
103
  ...rest
109
104
  } = _ref3;
110
- const [containerEl, setContainerEl] = useState(null);
111
- const [storedAnchorEl, setStoredAnchorEl] = useState(null);
112
- const isMounted = useIsMounted();
113
105
  const {
114
106
  density
115
107
  } = useEds();
116
108
  const token = useToken({
117
109
  density
118
110
  }, menu);
119
- useEffect(() => {
120
- open ? setStoredAnchorEl(anchorEl) : setStoredAnchorEl(null);
121
- return () => setStoredAnchorEl(null);
122
- }, [anchorEl, open]);
123
111
  const {
124
- styles,
125
- attributes
126
- } = usePopper({
127
- anchorEl: storedAnchorEl,
128
- popperEl: containerEl,
112
+ x,
113
+ y,
114
+ reference,
115
+ floating,
116
+ refs,
117
+ update,
118
+ strategy,
119
+ context
120
+ } = useFloating({
129
121
  placement,
130
- offset: 4
122
+ open,
123
+ onOpenChange: onClose,
124
+ middleware: [offset(4), flip(), shift({
125
+ padding: 8
126
+ })]
131
127
  });
128
+ useLayoutEffect(() => {
129
+ reference(anchorEl);
130
+ }, [anchorEl, reference]);
131
+ const popoverRef = useMemo(() => mergeRefs(floating, ref), [floating, ref]);
132
+ useEffect(() => {
133
+ if (refs.reference.current && refs.floating.current && open) {
134
+ return autoUpdate(refs.reference.current, refs.floating.current, update);
135
+ }
136
+ }, [refs.reference, refs.floating, update, open]);
137
+ const {
138
+ getFloatingProps
139
+ } = useInteractions([useDismiss(context, {
140
+ escapeKey: false
141
+ })]);
132
142
  const props = {
133
143
  open,
134
- style: { ...styles.popper,
135
- ...style
136
- },
137
- className,
138
- ...attributes.popper
144
+ className
139
145
  };
140
146
  const menuProps = { ...rest,
147
+ onClose,
141
148
  anchorEl,
142
- open,
143
- containerEl
149
+ open
144
150
  };
145
151
  return /*#__PURE__*/jsx(Fragment, {
146
- children: isMounted && /*#__PURE__*/ReactDom.createPortal( /*#__PURE__*/jsx(ThemeProvider, {
147
- theme: token,
148
- children: /*#__PURE__*/jsx(MenuPaper, {
149
- elevation: "raised",
150
- ref: setContainerEl,
151
- ...props,
152
- children: /*#__PURE__*/jsx(MenuProvider, {
153
- children: /*#__PURE__*/jsx(MenuContainer, { ...menuProps,
154
- ref: ref
152
+ children: /*#__PURE__*/jsx(FloatingPortal, {
153
+ id: "eds-menu-container",
154
+ children: /*#__PURE__*/jsx(ThemeProvider, {
155
+ theme: token,
156
+ children: /*#__PURE__*/jsx(MenuPaper, {
157
+ elevation: "raised",
158
+ ...props,
159
+ ...getFloatingProps({
160
+ ref: popoverRef,
161
+ style: { ...style,
162
+ position: strategy,
163
+ top: y !== null && y !== void 0 ? y : 0,
164
+ left: x !== null && x !== void 0 ? x : 0
165
+ }
166
+ }),
167
+ children: /*#__PURE__*/jsx(MenuProvider, {
168
+ children: /*#__PURE__*/jsx(MenuContainer, { ...menuProps,
169
+ ref: ref
170
+ })
155
171
  })
156
172
  })
157
173
  })
158
- }), document.body)
174
+ })
159
175
  });
160
176
  });
161
177
 
@@ -1,7 +1,7 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
  import { menu } from './Menu.tokens.js';
4
- import { typographyTemplate, spacingsTemplate, outlineTemplate, useCombinedRefs } from '@equinor/eds-utils';
4
+ import { typographyTemplate, spacingsTemplate, outlineTemplate, mergeRefs } from '@equinor/eds-utils';
5
5
  import { useMenu } from './Menu.context.js';
6
6
  import { jsx } from 'react/jsx-runtime';
7
7
 
@@ -76,7 +76,7 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(_ref5, ref) {
76
76
  isFocused
77
77
  };
78
78
  return /*#__PURE__*/jsx(Item, { ...props,
79
- ref: useCombinedRefs(ref, el => {
79
+ ref: mergeRefs(ref, el => {
80
80
  if (isFocused) {
81
81
  requestAnimationFrame(() => {
82
82
  if (el !== null) el.focus();
@@ -1,7 +1,7 @@
1
1
  import { forwardRef, useState, useLayoutEffect } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { useIsMounted } from '@equinor/eds-utils';
4
- import { Button } from '../Button/Button.js';
4
+ import { Button } from '../Button/index.js';
5
5
  import { Icon } from '../Icon/index.js';
6
6
  import { Typography } from '../Typography/Typography.js';
7
7
  import { PaginationItem } from './PaginationItem.js';
@@ -1,5 +1,5 @@
1
1
  import { forwardRef } from 'react';
2
- import { Button } from '../Button/Button.js';
2
+ import { Button } from '../Button/index.js';
3
3
  import { pagination } from './Pagination.tokens.js';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
 
@@ -1,9 +1,10 @@
1
- import { forwardRef, useState, useEffect } from 'react';
1
+ import { forwardRef, useRef, useLayoutEffect, useMemo, useEffect } from 'react';
2
2
  import styled, { css, ThemeProvider } from 'styled-components';
3
3
  import { Paper } from '../Paper/Paper.js';
4
- import { typographyTemplate, bordersTemplate, useCombinedRefs, useOutsideClick, useGlobalKeyPress, usePopper, useToken } from '@equinor/eds-utils';
4
+ import { typographyTemplate, bordersTemplate, mergeRefs, useToken } from '@equinor/eds-utils';
5
5
  import { popover } from './Popover.tokens.js';
6
6
  import { useEds } from '../EdsProvider/eds.context.js';
7
+ import { useFloating, offset, flip, shift, arrow, autoUpdate, useInteractions, useDismiss } from '@floating-ui/react-dom-interactions';
7
8
  import { jsx, jsxs } from 'react/jsx-runtime';
8
9
 
9
10
  const PopoverPaper = styled(Paper).withConfig({
@@ -14,9 +15,9 @@ const PopoverPaper = styled(Paper).withConfig({
14
15
  theme,
15
16
  open
16
17
  } = _ref;
17
- return css(["", " ", " display:grid;grid-auto-columns:auto;align-items:center;align-content:start;background:", ";width:max-content;max-height:", ";max-width:", ";", " z-index:1400;.arrow{z-index:-1;width:", ";height:", ";}&[data-popper-placement^='top'] > .arrow{bottom:", ";.arrowSvg{transform:rotate(-90deg);}}&[data-popper-placement^='bottom'] > .arrow{top:", ";.arrowSvg{transform:rotate(90deg);}}&[data-popper-placement^='left'] > .arrow{right:", ";.arrowSvg{transform:rotate(-180deg);}}&[data-popper-placement^='right'] > .arrow{left:", ";}"], {
18
+ return css(["", " ", " display:grid;grid-auto-columns:auto;align-items:center;align-content:start;background:", ";width:max-content;max-height:", ";max-width:", ";", " z-index:1400;overflow:auto;"], {
18
19
  visibility: open ? null : 'hidden'
19
- }, typographyTemplate(theme.typography), theme.background, theme.maxHeight, theme.maxWidth, bordersTemplate(theme.border), theme.entities.arrow.width, theme.entities.arrow.height, theme.entities.arrow.spacings.bottom, theme.entities.arrow.spacings.top, theme.entities.arrow.spacings.right, theme.entities.arrow.spacings.left);
20
+ }, typographyTemplate(theme.typography), theme.background, theme.maxHeight, theme.maxWidth, bordersTemplate(theme.border));
20
21
  });
21
22
  const ArrowWrapper = styled.div.withConfig({
22
23
  displayName: "Popover__ArrowWrapper",
@@ -25,7 +26,7 @@ const ArrowWrapper = styled.div.withConfig({
25
26
  let {
26
27
  theme
27
28
  } = _ref2;
28
- return css(["&,&::before{position:absolute;width:", ";height:", ";z-index:-1;}&::before{content:'';}"], theme.entities.arrow.width, theme.entities.arrow.height);
29
+ return css(["position:absolute;width:", ";height:", ";z-index:-1;"], theme.entities.arrow.width, theme.entities.arrow.height);
29
30
  });
30
31
  const InnerWrapper = styled.div.withConfig({
31
32
  displayName: "Popover__InnerWrapper",
@@ -50,41 +51,90 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(_ref5, ref) {
50
51
  children,
51
52
  placement = 'bottom',
52
53
  anchorEl,
54
+ style,
53
55
  open,
54
56
  onClose,
55
57
  ...rest
56
58
  } = _ref5;
57
- const [popperEl, setPopperEl] = useState(null);
58
- const [storedAnchorEl, setStoredAnchorEl] = useState(null);
59
- const [arrowRef, setArrowRef] = useState(null);
60
- const popoverRef = useCombinedRefs(ref, setPopperEl);
61
- useOutsideClick(popperEl, e => {
62
- if (open && onClose && anchorEl && !anchorEl.contains(e.target)) {
63
- onClose();
64
- }
65
- });
66
- useGlobalKeyPress('Escape', () => {
67
- if (onClose && open) {
68
- onClose();
69
- }
59
+ const arrowRef = useRef(null);
60
+ const {
61
+ x,
62
+ y,
63
+ reference,
64
+ floating,
65
+ refs,
66
+ update,
67
+ strategy,
68
+ context,
69
+ middlewareData: {
70
+ arrow: {
71
+ x: arrowX,
72
+ y: arrowY
73
+ } = {}
74
+ },
75
+ placement: finalPlacement
76
+ } = useFloating({
77
+ placement,
78
+ open,
79
+ onOpenChange: onClose,
80
+ middleware: [offset(14), flip(), shift({
81
+ padding: 8
82
+ }), arrow({
83
+ element: arrowRef
84
+ })]
70
85
  });
86
+ useLayoutEffect(() => {
87
+ reference(anchorEl);
88
+ }, [anchorEl, reference]);
89
+ const popoverRef = useMemo(() => mergeRefs(floating, ref), [floating, ref]);
71
90
  useEffect(() => {
72
- open ? setStoredAnchorEl(anchorEl) : setStoredAnchorEl(null);
73
- return () => setStoredAnchorEl(null);
74
- }, [anchorEl, open]);
91
+ if (refs.reference.current && refs.floating.current && open) {
92
+ return autoUpdate(refs.reference.current, refs.floating.current, update);
93
+ }
94
+ }, [refs.reference, refs.floating, update, open]);
75
95
  const {
76
- styles,
77
- attributes
78
- } = usePopper({
79
- anchorEl: storedAnchorEl,
80
- popperEl,
81
- arrowRef,
82
- placement
83
- });
96
+ getFloatingProps
97
+ } = useInteractions([useDismiss(context)]);
98
+ const staticSide = {
99
+ top: 'bottom',
100
+ right: 'left',
101
+ bottom: 'top',
102
+ left: 'right'
103
+ }[finalPlacement.split('-')[0]];
104
+ let arrowTransform = 'none';
105
+
106
+ switch (staticSide) {
107
+ case 'right':
108
+ arrowTransform = 'rotateY(180deg)';
109
+ break;
110
+
111
+ case 'left':
112
+ arrowTransform = 'none';
113
+ break;
114
+
115
+ case 'top':
116
+ arrowTransform = 'rotate(90deg)';
117
+ break;
118
+
119
+ case 'bottom':
120
+ arrowTransform = 'rotate(-90deg)';
121
+ break;
122
+ }
123
+
124
+ if (arrowRef.current) {
125
+ Object.assign(arrowRef.current.style, {
126
+ left: arrowX != null ? "".concat(arrowX, "px") : '',
127
+ top: arrowY != null ? "".concat(arrowY, "px") : '',
128
+ right: '',
129
+ bottom: '',
130
+ [staticSide]: '-6px',
131
+ transform: arrowTransform
132
+ });
133
+ }
134
+
84
135
  const props = {
85
136
  open,
86
- ...rest,
87
- ...attributes.popper
137
+ ...rest
88
138
  };
89
139
  const {
90
140
  density
@@ -95,13 +145,18 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(_ref5, ref) {
95
145
  return /*#__PURE__*/jsx(ThemeProvider, {
96
146
  theme: token,
97
147
  children: /*#__PURE__*/jsxs(PopoverPaper, {
98
- ref: popoverRef,
99
148
  elevation: "overlay",
100
- style: styles.popper,
101
149
  ...props,
150
+ ...getFloatingProps({
151
+ ref: popoverRef,
152
+ style: { ...style,
153
+ position: strategy,
154
+ top: y !== null && y !== void 0 ? y : 0,
155
+ left: x !== null && x !== void 0 ? x : 0
156
+ }
157
+ }),
102
158
  children: [/*#__PURE__*/jsx(ArrowWrapper, {
103
- ref: setArrowRef,
104
- style: styles.arrow,
159
+ ref: arrowRef,
105
160
  className: "arrow",
106
161
  children: /*#__PURE__*/jsx(PopoverArrow, {
107
162
  className: "arrowSvg",
@@ -106,6 +106,7 @@ const Radio = /*#__PURE__*/forwardRef(function Radio(_ref12, ref) {
106
106
  label,
107
107
  disabled = false,
108
108
  className,
109
+ style,
109
110
  ...rest
110
111
  } = _ref12;
111
112
  const {
@@ -137,6 +138,7 @@ const Radio = /*#__PURE__*/forwardRef(function Radio(_ref12, ref) {
137
138
  children: label ? /*#__PURE__*/jsxs(StyledLabel, {
138
139
  disabled: disabled,
139
140
  className: className,
141
+ style: style,
140
142
  children: [/*#__PURE__*/jsxs(InputWrapper, {
141
143
  disabled: disabled,
142
144
  children: [/*#__PURE__*/jsx(Input, { ...rest,
@@ -149,6 +151,8 @@ const Radio = /*#__PURE__*/forwardRef(function Radio(_ref12, ref) {
149
151
  })]
150
152
  }) : /*#__PURE__*/jsxs(InputWrapper, {
151
153
  disabled: disabled,
154
+ className: className,
155
+ style: style,
152
156
  children: [/*#__PURE__*/jsx(Input, { ...rest,
153
157
  ref: ref,
154
158
  disabled: disabled,
@@ -1,7 +1,7 @@
1
- import { forwardRef, useRef } from 'react';
1
+ import { forwardRef, useRef, useMemo } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { scrim } from './Scrim.tokens.js';
4
- import { useCombinedRefs, useHideBodyScroll, useGlobalKeyPress } from '@equinor/eds-utils';
4
+ import { mergeRefs, useHideBodyScroll, useGlobalKeyPress } from '@equinor/eds-utils';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
7
7
  const {
@@ -26,7 +26,7 @@ const Scrim = /*#__PURE__*/forwardRef(function Scrim(_ref, ref) {
26
26
  ...rest
27
27
  } = _ref;
28
28
  const scrimRef = useRef(null);
29
- const combinedScrimRef = useCombinedRefs(scrimRef, ref);
29
+ const combinedScrimRef = useMemo(() => mergeRefs(scrimRef, ref), [scrimRef, ref]);
30
30
  const props = { ...rest,
31
31
  open,
32
32
  isDismissable
@@ -1,12 +1,12 @@
1
- import { forwardRef, useRef, useState, useEffect } from 'react';
1
+ import { forwardRef, useRef, useState, useEffect, useMemo } from 'react';
2
2
  import styled, { css, ThemeProvider } from 'styled-components';
3
3
  import { search as search$1, close } from '@equinor/eds-icons';
4
4
  import { search } from './Search.tokens.js';
5
5
  import { useEds } from '../EdsProvider/eds.context.js';
6
- import { Button } from '../Button/Button.js';
6
+ import { Button } from '../Button/index.js';
7
7
  import { Icon } from '../Icon/index.js';
8
8
  import { Input } from '../Input/Input.js';
9
- import { bordersTemplate, spacingsTemplate, typographyTemplate, useToken, useCombinedRefs, setReactInputValue } from '@equinor/eds-utils';
9
+ import { bordersTemplate, spacingsTemplate, typographyTemplate, useToken, mergeRefs, setReactInputValue } from '@equinor/eds-utils';
10
10
  import { jsx, jsxs } from 'react/jsx-runtime';
11
11
 
12
12
  const Container = styled.span.withConfig({
@@ -63,6 +63,7 @@ const Search = /*#__PURE__*/forwardRef(function Search(_ref4, ref) {
63
63
  defaultValue = '',
64
64
  value,
65
65
  className = '',
66
+ style,
66
67
  disabled = false,
67
68
  onBlur,
68
69
  onFocus,
@@ -138,14 +139,16 @@ const Search = /*#__PURE__*/forwardRef(function Search(_ref4, ref) {
138
139
  const containerProps = {
139
140
  isFocused,
140
141
  className,
142
+ style,
141
143
  disabled,
142
144
  role: 'search',
143
145
  'aria-label': rest['aria-label'],
144
146
  onClick: handleOnClick
145
147
  };
148
+ const combinedRef = useMemo(() => mergeRefs(inputRef, ref), [inputRef, ref]);
146
149
  const inputProps = applyControllingProps({ ...rest,
147
150
  disabled,
148
- ref: useCombinedRefs(inputRef, ref),
151
+ ref: combinedRef,
149
152
  type: 'search',
150
153
  role: 'searchbox',
151
154
  'aria-label': 'search input',
@@ -24,6 +24,7 @@ const NativeSelect = /*#__PURE__*/forwardRef(function NativeSelect(_ref2, ref) {
24
24
  label,
25
25
  children,
26
26
  className,
27
+ style,
27
28
  selectRef,
28
29
  id,
29
30
  meta,
@@ -39,7 +40,8 @@ const NativeSelect = /*#__PURE__*/forwardRef(function NativeSelect(_ref2, ref) {
39
40
  }, nativeselect);
40
41
  const containerProps = {
41
42
  ref,
42
- className
43
+ className,
44
+ style
43
45
  };
44
46
  const selectProps = {
45
47
  ref: selectRef,
@@ -1,6 +1,6 @@
1
1
  import { Input } from '../Input/Input.js';
2
2
  import { List } from '../List/index.js';
3
- import { Button } from '../Button/Button.js';
3
+ import { Button } from '../Button/index.js';
4
4
  import styled, { css } from 'styled-components';
5
5
  import { select } from './Select.tokens.js';
6
6
  import { bordersTemplate, typographyTemplate } from '@equinor/eds-utils';
@@ -1,9 +1,9 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { clear } from '@equinor/eds-icons';
4
- import { bordersTemplate, spacingsTemplate } from '@equinor/eds-utils';
4
+ import { bordersTemplate, spacingsTemplate, typographyTemplate } from '@equinor/eds-utils';
5
5
  import { Typography } from '../Typography/Typography.js';
6
- import { Button } from '../Button/Button.js';
6
+ import { Button } from '../Button/index.js';
7
7
  import { Icon } from '../Icon/index.js';
8
8
  import { comfortable, variants } from './SideSheet.tokens.js';
9
9
  import { jsxs, jsx } from 'react/jsx-runtime';
@@ -11,17 +11,18 @@ import { jsxs, jsx } from 'react/jsx-runtime';
11
11
  const {
12
12
  background,
13
13
  spacings,
14
- border
14
+ border,
15
+ typography
15
16
  } = comfortable;
16
17
  const StyledSideSheet = styled.div.withConfig({
17
18
  displayName: "SideSheet__StyledSideSheet",
18
19
  componentId: "sc-wkzlnn-0"
19
- })(["height:100%;position:absolute;z-index:1200;top:0;right:0;box-sizing:border-box;background:", ";width:", ";", " ", ";"], background, _ref => {
20
+ })(["height:100%;position:absolute;z-index:1200;top:0;right:0;box-sizing:border-box;background:", ";width:", ";", " ", ";", ""], background, _ref => {
20
21
  let {
21
22
  width
22
23
  } = _ref;
23
24
  return width;
24
- }, bordersTemplate(border), spacingsTemplate(spacings));
25
+ }, bordersTemplate(border), spacingsTemplate(spacings), typographyTemplate(typography));
25
26
  const Header = styled.div.withConfig({
26
27
  displayName: "SideSheet__Header",
27
28
  componentId: "sc-wkzlnn-1"
@@ -29,6 +30,7 @@ const Header = styled.div.withConfig({
29
30
  const SideSheet = /*#__PURE__*/forwardRef(function SideSheet(_ref2, ref) {
30
31
  let {
31
32
  variant = 'medium',
33
+ width,
32
34
  title = '',
33
35
  children,
34
36
  open = true,
@@ -37,7 +39,7 @@ const SideSheet = /*#__PURE__*/forwardRef(function SideSheet(_ref2, ref) {
37
39
  } = _ref2;
38
40
  const props = { ...rest,
39
41
  ref,
40
- width: variants[variant]
42
+ width: width || variants[variant]
41
43
  }; // Controller must set open={false} when pressing the close button
42
44
 
43
45
  return open && /*#__PURE__*/jsxs(StyledSideSheet, { ...props,
@@ -16,6 +16,11 @@ const {
16
16
  xx_small: spacingXXS,
17
17
  medium: spacingMedium
18
18
  }
19
+ },
20
+ typography: {
21
+ paragraph: {
22
+ body_short
23
+ }
19
24
  }
20
25
  } = tokens;
21
26
  const comfortable = {
@@ -33,6 +38,8 @@ const comfortable = {
33
38
  width: spacingXXS,
34
39
  style: 'solid'
35
40
  }
41
+ },
42
+ typography: { ...body_short
36
43
  }
37
44
  };
38
45
  const variants = {
@@ -31,6 +31,7 @@ const Switch = /*#__PURE__*/forwardRef(function Switch(_ref3, ref) {
31
31
  disabled,
32
32
  label,
33
33
  className,
34
+ style,
34
35
  ...rest
35
36
  } = _ref3;
36
37
  const {
@@ -46,6 +47,7 @@ const Switch = /*#__PURE__*/forwardRef(function Switch(_ref3, ref) {
46
47
  children: label ? /*#__PURE__*/jsxs(StyledLabel, {
47
48
  isDisabled: disabled,
48
49
  className: className,
50
+ style: style,
49
51
  children: [size === 'small' ? /*#__PURE__*/jsx(SwitchSmall, {
50
52
  disabled: disabled,
51
53
  ...rest,
@@ -59,10 +61,14 @@ const Switch = /*#__PURE__*/forwardRef(function Switch(_ref3, ref) {
59
61
  })]
60
62
  }) : size === 'small' ? /*#__PURE__*/jsx(SwitchSmall, {
61
63
  disabled: disabled,
64
+ className: className,
65
+ style: style,
62
66
  ...rest,
63
67
  ref: ref
64
68
  }) : /*#__PURE__*/jsx(SwitchDefault, {
65
69
  disabled: disabled,
70
+ className: className,
71
+ style: style,
66
72
  ...rest,
67
73
  ref: ref
68
74
  })
@@ -51,9 +51,13 @@ const Handle = styled.span.withConfig({
51
51
  const SwitchDefault = /*#__PURE__*/forwardRef(function SwitchDefault(_ref4, ref) {
52
52
  let {
53
53
  disabled,
54
+ className,
55
+ style,
54
56
  ...rest
55
57
  } = _ref4;
56
58
  return /*#__PURE__*/jsxs(GridWrapper, {
59
+ className: className,
60
+ style: style,
57
61
  children: [/*#__PURE__*/jsx(Input, { ...rest,
58
62
  ref: ref,
59
63
  disabled: disabled
@@ -51,9 +51,13 @@ const Handle = styled.span.withConfig({
51
51
  const SwitchSmall = /*#__PURE__*/forwardRef(function SwitchSmall(_ref4, ref) {
52
52
  let {
53
53
  disabled,
54
+ className,
55
+ style,
54
56
  ...rest
55
57
  } = _ref4;
56
58
  return /*#__PURE__*/jsxs(GridWrapper, {
59
+ className: className,
60
+ style: style,
57
61
  children: [/*#__PURE__*/jsx(Input, { ...rest,
58
62
  ref: ref,
59
63
  disabled: disabled
@@ -1,6 +1,6 @@
1
1
  import { forwardRef, useContext, useRef, useState, useCallback, useEffect, Children, cloneElement } from 'react';
2
2
  import styled from 'styled-components';
3
- import { useCombinedRefs } from '@equinor/eds-utils';
3
+ import { mergeRefs } from '@equinor/eds-utils';
4
4
  import { TabsContext } from './Tabs.context.js';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
@@ -49,8 +49,7 @@ const TabList = /*#__PURE__*/forwardRef(function TabsList(_ref3, ref) {
49
49
  currentTab.current = activeTab;
50
50
  }, [activeTab]);
51
51
  const Tabs = Children.map(children, (child, index) => {
52
- const tabRef = index === activeTab ? // eslint-disable-next-line react-hooks/rules-of-hooks
53
- useCombinedRefs(child.ref, selectedTabRef) : child.ref;
52
+ const tabRef = index === activeTab ? mergeRefs(child.ref, selectedTabRef) : child.ref;
54
53
  return /*#__PURE__*/cloneElement(child, {
55
54
  id: "".concat(tabsId, "-tab-").concat(index + 1),
56
55
  'aria-controls': "".concat(tabsId, "-panel-").concat(index + 1),
@@ -1,7 +1,7 @@
1
- import { forwardRef, useRef, useState, useEffect } from 'react';
1
+ import { forwardRef, useRef, useMemo, useState, useEffect } from 'react';
2
2
  import { TabsProvider } from './Tabs.context.js';
3
3
  import { token } from './Tabs.tokens.js';
4
- import { useId, useCombinedRefs, useToken } from '@equinor/eds-utils';
4
+ import { useId, mergeRefs, useToken } from '@equinor/eds-utils';
5
5
  import { ThemeProvider } from 'styled-components';
6
6
  import { useEds } from '../EdsProvider/eds.context.js';
7
7
  import { jsx } from 'react/jsx-runtime';
@@ -19,7 +19,7 @@ const Tabs = /*#__PURE__*/forwardRef(function Tabs(_ref, ref) {
19
19
  } = _ref;
20
20
  const tabsId = useId(id, 'tabs');
21
21
  const tabsRef = useRef(null);
22
- const combinedTabsRef = useCombinedRefs(tabsRef, ref);
22
+ const combinedTabsRef = useMemo(() => mergeRefs(tabsRef, ref), [tabsRef, ref]);
23
23
  const [tabsFocused, setTabsFocused] = useState(false);
24
24
  const [listenerAttached, setListenerAttached] = useState(false);
25
25
  let blurTimer;
@@ -29,6 +29,7 @@ const TextField = /*#__PURE__*/forwardRef(function TextField(_ref, ref) {
29
29
  inputIcon,
30
30
  helperIcon,
31
31
  rowsMax,
32
+ style,
32
33
  ...other
33
34
  } = _ref;
34
35
  const helperTextId = useId(null, 'helpertext');
@@ -55,7 +56,7 @@ const TextField = /*#__PURE__*/forwardRef(function TextField(_ref, ref) {
55
56
  const containerProps = {
56
57
  ref,
57
58
  className,
58
- style: other.style
59
+ style
59
60
  };
60
61
  const labelProps = {
61
62
  htmlFor: id,