@equinor/eds-core-react 0.18.0-envis.2 → 0.19.0-dev.20220405

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 (193) hide show
  1. package/dist/eds-core-react.cjs.js +2276 -1930
  2. package/dist/esm/components/Accordion/Accordion.js +9 -9
  3. package/dist/esm/components/Accordion/Accordion.tokens.js +6 -1
  4. package/dist/esm/components/Accordion/AccordionHeader.js +61 -49
  5. package/dist/esm/components/Accordion/AccordionHeaderTitle.js +12 -10
  6. package/dist/esm/components/Accordion/AccordionItem.js +11 -10
  7. package/dist/esm/components/Accordion/AccordionPanel.js +22 -18
  8. package/dist/esm/components/Avatar/Avatar.js +21 -14
  9. package/dist/esm/components/Banner/Banner.js +12 -11
  10. package/dist/esm/components/Banner/BannerActions.js +11 -9
  11. package/dist/esm/components/Banner/BannerIcon.js +12 -10
  12. package/dist/esm/components/Banner/BannerMessage.js +5 -4
  13. package/dist/esm/components/Breadcrumbs/Breadcrumb.js +16 -12
  14. package/dist/esm/components/Breadcrumbs/Breadcrumbs.js +7 -6
  15. package/dist/esm/components/Button/Button.js +16 -17
  16. package/dist/esm/components/Button/InnerFullWidth.js +4 -3
  17. package/dist/esm/components/Button/tokens/button.js +1 -1
  18. package/dist/esm/components/Button/tokens/contained.js +5 -5
  19. package/dist/esm/components/Button/tokens/ghost.js +4 -4
  20. package/dist/esm/components/Button/tokens/icon.js +11 -6
  21. package/dist/esm/components/Button/tokens/outlined.js +5 -5
  22. package/dist/esm/components/Card/Card.js +19 -12
  23. package/dist/esm/components/Card/CardActions.js +13 -9
  24. package/dist/esm/components/Card/CardContent.js +5 -4
  25. package/dist/esm/components/Card/CardHeader.js +5 -4
  26. package/dist/esm/components/Card/CardHeaderTitle.js +5 -4
  27. package/dist/esm/components/Card/CardMedia.js +12 -8
  28. package/dist/esm/components/Checkbox/Checkbox.js +15 -11
  29. package/dist/esm/components/Checkbox/Checkbox.tokens.js +9 -4
  30. package/dist/esm/components/Checkbox/Input.js +72 -46
  31. package/dist/esm/components/Chip/Chip.js +46 -30
  32. package/dist/esm/components/Chip/Chip.tokens.js +7 -2
  33. package/dist/esm/components/Chip/Icon.js +12 -7
  34. package/dist/esm/components/Dialog/Dialog.js +44 -20
  35. package/dist/esm/components/Dialog/Dialog.tokens.js +4 -12
  36. package/dist/esm/components/Dialog/DialogActions.js +27 -0
  37. package/dist/esm/components/Dialog/DialogContent.js +44 -0
  38. package/dist/esm/components/Dialog/DialogHeader.js +37 -0
  39. package/dist/esm/components/Dialog/DialogTitle.js +31 -0
  40. package/dist/esm/components/Dialog/index.js +11 -7
  41. package/dist/esm/components/Divider/Divider.js +6 -5
  42. package/dist/esm/components/EdsProvider/eds.context.js +5 -4
  43. package/dist/esm/components/Icon/Icon.js +77 -46
  44. package/dist/esm/components/Input/Input.js +12 -12
  45. package/dist/esm/components/Input/Input.tokens.js +4 -4
  46. package/dist/esm/components/Label/Label.js +7 -4
  47. package/dist/esm/components/List/List.js +13 -9
  48. package/dist/esm/components/List/ListItem.js +5 -4
  49. package/dist/esm/components/Menu/Menu.context.js +16 -4
  50. package/dist/esm/components/Menu/Menu.js +71 -30
  51. package/dist/esm/components/Menu/MenuItem.js +38 -25
  52. package/dist/esm/components/Menu/MenuList.js +18 -11
  53. package/dist/esm/components/Menu/MenuSection.js +1 -1
  54. package/dist/esm/components/Pagination/Pagination.js +16 -12
  55. package/dist/esm/components/Pagination/PaginationItem.js +7 -6
  56. package/dist/esm/components/Paper/Paper.js +11 -7
  57. package/dist/esm/components/Popover/Popover.js +43 -50
  58. package/dist/esm/components/Popover/Popover.tokens.js +2 -12
  59. package/dist/esm/components/Popover/PopoverActions.js +28 -0
  60. package/dist/esm/components/Popover/PopoverContent.js +12 -6
  61. package/dist/esm/components/Popover/PopoverHeader.js +36 -0
  62. package/dist/esm/components/Popover/PopoverTitle.js +13 -24
  63. package/dist/esm/components/Popover/index.js +6 -0
  64. package/dist/esm/components/Progress/Circular/CircularProgress.js +14 -10
  65. package/dist/esm/components/Progress/Dots/DotProgress.js +12 -8
  66. package/dist/esm/components/Progress/Linear/LinearProgress.js +6 -5
  67. package/dist/esm/components/Progress/Star/StarProgress.js +14 -10
  68. package/dist/esm/components/Radio/Radio.js +84 -52
  69. package/dist/esm/components/Radio/Radio.tokens.js +9 -4
  70. package/dist/esm/components/Scrim/Scrim.js +16 -20
  71. package/dist/esm/components/Search/Search.js +28 -28
  72. package/dist/esm/components/Select/MultiSelect/MultiSelect.js +27 -22
  73. package/dist/esm/components/Select/NativeSelect/NativeSelect.js +19 -17
  74. package/dist/esm/components/Select/Select.tokens.js +2 -2
  75. package/dist/esm/components/Select/SingleSelect/SingleSelect.js +29 -23
  76. package/dist/esm/components/Select/commonStyles.js +14 -13
  77. package/dist/esm/components/SideSheet/SideSheet.js +16 -13
  78. package/dist/esm/components/Slider/MinMax.js +5 -4
  79. package/dist/esm/components/Slider/Output.js +13 -9
  80. package/dist/esm/components/Slider/Slider.js +81 -38
  81. package/dist/esm/components/Slider/Slider.tokens.js +7 -2
  82. package/dist/esm/components/Slider/SliderInput.js +14 -14
  83. package/dist/esm/components/Snackbar/Snackbar.js +17 -21
  84. package/dist/esm/components/Snackbar/SnackbarAction.js +9 -7
  85. package/dist/esm/components/Switch/Switch.js +21 -15
  86. package/dist/esm/components/Switch/Switch.styles.js +24 -17
  87. package/dist/esm/components/Switch/Switch.tokens.js +6 -1
  88. package/dist/esm/components/Switch/SwitchDefault.js +39 -29
  89. package/dist/esm/components/Switch/SwitchSmall.js +38 -28
  90. package/dist/esm/components/Table/Body.js +5 -4
  91. package/dist/esm/components/Table/Caption.js +8 -5
  92. package/dist/esm/components/Table/Cell.js +9 -6
  93. package/dist/esm/components/Table/DataCell/DataCell.js +12 -12
  94. package/dist/esm/components/Table/DataCell/DataCell.tokens.js +2 -2
  95. package/dist/esm/components/Table/Head/Head.js +7 -6
  96. package/dist/esm/components/Table/HeaderCell/HeaderCell.js +7 -8
  97. package/dist/esm/components/Table/Row/Row.js +7 -5
  98. package/dist/esm/components/Table/Table.js +5 -4
  99. package/dist/esm/components/TableOfContents/LinkItem.js +10 -10
  100. package/dist/esm/components/TableOfContents/TableOfContents.js +17 -15
  101. package/dist/esm/components/Tabs/Tab.js +21 -19
  102. package/dist/esm/components/Tabs/TabList.js +27 -11
  103. package/dist/esm/components/Tabs/TabPanel.js +8 -7
  104. package/dist/esm/components/Tabs/TabPanels.js +5 -4
  105. package/dist/esm/components/Tabs/Tabs.context.js +1 -0
  106. package/dist/esm/components/Tabs/Tabs.js +45 -15
  107. package/dist/esm/components/Tabs/Tabs.tokens.js +8 -2
  108. package/dist/esm/components/TextField/Field.js +49 -38
  109. package/dist/esm/components/TextField/HelperText/HelperText.js +28 -19
  110. package/dist/esm/components/TextField/Icon/Icon.js +20 -18
  111. package/dist/esm/components/TextField/TextField.context.js +4 -3
  112. package/dist/esm/components/TextField/TextField.js +19 -19
  113. package/dist/esm/components/Textarea/Textarea.js +16 -16
  114. package/dist/esm/components/Tooltip/Tooltip.js +23 -24
  115. package/dist/esm/components/TopBar/Actions.js +5 -4
  116. package/dist/esm/components/TopBar/CustomContent.js +5 -4
  117. package/dist/esm/components/TopBar/Header.js +5 -4
  118. package/dist/esm/components/TopBar/TopBar.js +11 -11
  119. package/dist/esm/components/Typography/Typography.js +49 -28
  120. package/dist/esm/components/Typography/Typography.tokens.js +7 -2
  121. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_curry1.js +1 -1
  122. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_curry2.js +1 -1
  123. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_curry3.js +1 -1
  124. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_has.js +1 -1
  125. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_isObject.js +1 -1
  126. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_isPlaceholder.js +1 -1
  127. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/mergeDeepRight.js +2 -1
  128. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/mergeDeepWithKey.js +1 -1
  129. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/mergeWithKey.js +1 -1
  130. package/dist/types/components/Accordion/AccordionHeader.d.ts +2 -2
  131. package/dist/types/components/Checkbox/Checkbox.d.ts +1 -1
  132. package/dist/types/components/Checkbox/Input.d.ts +1 -1
  133. package/dist/types/components/Dialog/Dialog.d.ts +18 -2
  134. package/dist/types/components/Dialog/DialogActions.d.ts +3 -0
  135. package/dist/types/components/Dialog/{CustomContent.d.ts → DialogContent.d.ts} +2 -2
  136. package/dist/types/components/Dialog/DialogHeader.d.ts +3 -0
  137. package/dist/types/components/Dialog/DialogTitle.d.ts +3 -0
  138. package/dist/types/components/Dialog/index.d.ts +10 -7
  139. package/dist/types/components/Icon/Icon.d.ts +2 -2
  140. package/dist/types/components/Menu/Menu.context.d.ts +3 -0
  141. package/dist/types/components/Menu/Menu.d.ts +1 -6
  142. package/dist/types/components/Menu/MenuList.d.ts +0 -2
  143. package/dist/types/components/Popover/Popover.d.ts +1 -1
  144. package/dist/types/components/Popover/PopoverActions.d.ts +3 -0
  145. package/dist/types/components/Popover/PopoverHeader.d.ts +3 -0
  146. package/dist/types/components/Popover/index.d.ts +5 -1
  147. package/dist/types/components/Progress/Circular/CircularProgress.d.ts +1 -1
  148. package/dist/types/components/Progress/Dots/DotProgress.d.ts +1 -1
  149. package/dist/types/components/Progress/Star/StarProgress.d.ts +1 -1
  150. package/dist/types/components/Switch/Switch.d.ts +1 -1
  151. package/dist/types/components/Switch/Switch.styles.d.ts +2 -1
  152. package/dist/types/components/Tabs/TabList.d.ts +4 -0
  153. package/dist/types/components/Tabs/Tabs.context.d.ts +1 -0
  154. package/dist/types/components/Tabs/Tabs.d.ts +4 -0
  155. package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
  156. package/package.json +37 -38
  157. package/dist/esm/components/Dialog/Actions.js +0 -26
  158. package/dist/esm/components/Dialog/CustomContent.js +0 -46
  159. package/dist/esm/components/Dialog/Title.js +0 -41
  160. package/dist/esm/hooks/useAutoResize.js +0 -39
  161. package/dist/esm/hooks/useCombinedRefs.js +0 -14
  162. package/dist/esm/hooks/useGlobalKeyPress.js +0 -34
  163. package/dist/esm/hooks/useHideBodyScroll.js +0 -20
  164. package/dist/esm/hooks/useId.js +0 -14
  165. package/dist/esm/hooks/useMountedRef.js +0 -12
  166. package/dist/esm/hooks/useOutsideClick.js +0 -18
  167. package/dist/esm/hooks/usePopper.js +0 -31
  168. package/dist/esm/hooks/useToken.js +0 -16
  169. package/dist/esm/utils/joinHandlers.js +0 -10
  170. package/dist/esm/utils/setReactInputValue.js +0 -18
  171. package/dist/esm/utils/templates/borders.js +0 -35
  172. package/dist/esm/utils/templates/common.js +0 -19
  173. package/dist/esm/utils/templates/focus.js +0 -35
  174. package/dist/esm/utils/templates/index.js +0 -52
  175. package/dist/types/components/Dialog/Actions.d.ts +0 -3
  176. package/dist/types/components/Dialog/Title.d.ts +0 -3
  177. package/dist/types/hooks/index.d.ts +0 -9
  178. package/dist/types/hooks/useAutoResize.d.ts +0 -1
  179. package/dist/types/hooks/useCombinedRefs.d.ts +0 -3
  180. package/dist/types/hooks/useGlobalKeyPress.d.ts +0 -10
  181. package/dist/types/hooks/useHideBodyScroll.d.ts +0 -1
  182. package/dist/types/hooks/useId.d.ts +0 -1
  183. package/dist/types/hooks/useMountedRef.d.ts +0 -1
  184. package/dist/types/hooks/useOutsideClick.d.ts +0 -1
  185. package/dist/types/hooks/usePopper.d.ts +0 -12
  186. package/dist/types/hooks/useToken.d.ts +0 -7
  187. package/dist/types/utils/index.d.ts +0 -4
  188. package/dist/types/utils/joinHandlers.d.ts +0 -3
  189. package/dist/types/utils/setReactInputValue.d.ts +0 -7
  190. package/dist/types/utils/templates/borders.d.ts +0 -2
  191. package/dist/types/utils/templates/common.d.ts +0 -9
  192. package/dist/types/utils/templates/focus.d.ts +0 -2
  193. package/dist/types/utils/templates/index.d.ts +0 -7
@@ -6,11 +6,12 @@ import { jsx } from 'react/jsx-runtime';
6
6
  const StyledRow = styled.tr.withConfig({
7
7
  displayName: "Row__StyledRow",
8
8
  componentId: "sc-12c5lns-0"
9
- })(({
10
- active
11
- }) => {
9
+ })(_ref => {
12
10
  var _token$states$active, _token$states$hover;
13
11
 
12
+ let {
13
+ active
14
+ } = _ref;
14
15
  return {
15
16
  background: active ? (_token$states$active = token.states.active) === null || _token$states$active === void 0 ? void 0 : _token$states$active.background : null,
16
17
  '@media (hover: hover) and (pointer: fine)': {
@@ -20,8 +21,9 @@ const StyledRow = styled.tr.withConfig({
20
21
  }
21
22
  };
22
23
  });
23
- const Row = /*#__PURE__*/forwardRef(function Row({ ...props
24
- }, ref) {
24
+ const Row = /*#__PURE__*/forwardRef(function Row(_ref2, ref) {
25
+ let { ...props
26
+ } = _ref2;
25
27
  const {
26
28
  children
27
29
  } = props;
@@ -7,10 +7,11 @@ const TableBase = styled.table.withConfig({
7
7
  displayName: "Table__TableBase",
8
8
  componentId: "sc-14kktwc-0"
9
9
  })(["border-spacing:0;background:", ";"], tableCell.background);
10
- const Table = /*#__PURE__*/forwardRef(function Table({
11
- children,
12
- ...props
13
- }, ref) {
10
+ const Table = /*#__PURE__*/forwardRef(function Table(_ref, ref) {
11
+ let {
12
+ children,
13
+ ...props
14
+ } = _ref;
14
15
  return /*#__PURE__*/jsx(TableBase, { ...props,
15
16
  ref: ref,
16
17
  children: children
@@ -1,22 +1,22 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
+ import { typographyTemplate, spacingsTemplate, outlineTemplate, bordersTemplate } from '@equinor/eds-utils';
3
4
  import { jsx } from 'react/jsx-runtime';
4
- import { typographyTemplate, spacingsTemplate } from '../../utils/templates/index.js';
5
- import { outlineTemplate } from '../../utils/templates/focus.js';
6
- import { bordersTemplate } from '../../utils/templates/borders.js';
7
5
 
8
6
  const StyledLinkItem = styled.li.withConfig({
9
7
  displayName: "LinkItem__StyledLinkItem",
10
8
  componentId: "sc-1tfuad4-0"
11
- })(({
12
- theme
13
- }) => {
9
+ })(_ref => {
10
+ let {
11
+ theme
12
+ } = _ref;
14
13
  return css(["list-style:none;margin:0;padding:0;a{text-decoration:none;", " ", " height:", ";width:", ";display:block;position:relative;svg{fill:", ";margin-right:", ";vertical-align:text-bottom;}span{max-width:", ";overflow:hidden;white-space:nowrap;text-overflow:ellipsis;vertical-align:text-bottom;display:inline-block;}&:focus{", ";}@media (hover:hover) and (pointer:fine){&:hover{", " background:", ";", " svg{fill:", ";}}}&:active{outline:none;}}"], typographyTemplate(theme.entities.links.typography), spacingsTemplate(theme.entities.links.spacings), theme.entities.links.typography.lineHeight, theme.entities.links.width, theme.entities.icon.background, theme.entities.icon.spacings.right, theme.entities.span.maxWidth, outlineTemplate(theme.states.focus.outline), typographyTemplate(theme.states.hover.typography), theme.states.hover.background, bordersTemplate(theme.states.hover.border), theme.states.hover.entities.icon.background);
15
14
  });
16
- const LinkItem = /*#__PURE__*/forwardRef(function LinkItem({
17
- children,
18
- ...props
19
- }, ref) {
15
+ const LinkItem = /*#__PURE__*/forwardRef(function LinkItem(_ref2, ref) {
16
+ let {
17
+ children,
18
+ ...props
19
+ } = _ref2;
20
20
  return /*#__PURE__*/jsx(StyledLinkItem, { ...props,
21
21
  ref: ref,
22
22
  children: children
@@ -1,20 +1,20 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { css, ThemeProvider } from 'styled-components';
3
3
  import { List } from '../List/index.js';
4
+ import { typographyTemplate, useToken } from '@equinor/eds-utils';
4
5
  import { tableOfContents } from './TableOfContents.tokens.js';
5
6
  import { jsx, jsxs } from 'react/jsx-runtime';
6
7
  import { Typography } from '../Typography/Typography.js';
7
- import { typographyTemplate } from '../../utils/templates/index.js';
8
8
  import { useEds } from '../EdsProvider/eds.context.js';
9
- import { useToken } from '../../hooks/useToken.js';
10
9
 
11
10
  const StyledTableOfContents = styled.nav.withConfig({
12
11
  displayName: "TableOfContents__StyledTableOfContents",
13
12
  componentId: "sc-q23s6y-0"
14
- })(({
15
- theme,
16
- sticky
17
- }) => {
13
+ })(_ref => {
14
+ let {
15
+ theme,
16
+ sticky
17
+ } = _ref;
18
18
  return css(["margin-top:", ";margin-bottom:", ";", ""], theme.spacings.top, theme.spacings.bottom, sticky && css(["position:fixed;top:", ";right:", ";"], theme.entities.sticky.spacings.top, theme.entities.sticky.spacings.right));
19
19
  });
20
20
  const TocList = styled(List).withConfig({
@@ -24,17 +24,19 @@ const TocList = styled(List).withConfig({
24
24
  const TocLabel = styled(Typography).withConfig({
25
25
  displayName: "TableOfContents__TocLabel",
26
26
  componentId: "sc-q23s6y-2"
27
- })(({
28
- theme
29
- }) => {
27
+ })(_ref2 => {
28
+ let {
29
+ theme
30
+ } = _ref2;
30
31
  return css(["", ""], typographyTemplate(theme.typography));
31
32
  });
32
- const TableOfContents = /*#__PURE__*/forwardRef(function TableOfContents({
33
- children,
34
- sticky = false,
35
- label = '',
36
- ...rest
37
- }, ref) {
33
+ const TableOfContents = /*#__PURE__*/forwardRef(function TableOfContents(_ref3, ref) {
34
+ let {
35
+ children,
36
+ sticky = false,
37
+ label = '',
38
+ ...rest
39
+ } = _ref3;
38
40
  const {
39
41
  density
40
42
  } = useEds();
@@ -1,33 +1,35 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
+ import { spacingsTemplate, outlineTemplate, bordersTemplate } from '@equinor/eds-utils';
3
4
  import { jsx } from 'react/jsx-runtime';
4
- import { spacingsTemplate } from '../../utils/templates/index.js';
5
- import { outlineTemplate } from '../../utils/templates/focus.js';
6
- import { bordersTemplate } from '../../utils/templates/borders.js';
7
5
 
8
- const StyledTab = styled.button.attrs(({
9
- active = false,
10
- disabled = false
11
- }) => ({
12
- type: 'button',
13
- role: 'tab',
14
- 'aria-selected': active,
15
- 'aria-disabled': disabled,
16
- tabIndex: active ? '0' : '-1'
17
- })).withConfig({
6
+ const StyledTab = styled.button.attrs(_ref => {
7
+ let {
8
+ active = false,
9
+ disabled = false
10
+ } = _ref;
11
+ return {
12
+ type: 'button',
13
+ role: 'tab',
14
+ 'aria-selected': active,
15
+ 'aria-disabled': disabled,
16
+ tabIndex: active ? '0' : '-1'
17
+ };
18
+ }).withConfig({
18
19
  displayName: "Tab__StyledTab",
19
20
  componentId: "sc-scjkct-0"
20
- })(({
21
- theme,
22
- active,
23
- disabled
24
- }) => {
21
+ })(_ref2 => {
22
+ let {
23
+ theme,
24
+ active,
25
+ disabled
26
+ } = _ref2;
25
27
  const {
26
28
  entities: {
27
29
  tab
28
30
  }
29
31
  } = theme;
30
- return css(["appearance:none;box-sizing:border-box;font-family:inherit;border:none;outline:none;font-size:1rem;height:", ";", " color:", ";background-color:", ";position:relative;white-space:nowrap;text-overflow:ellipsis;overflow-x:hidden;&:focus{outline:none;}&[data-focus],&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}&::-moz-focus-inner{border:0;}@media (hover:hover) and (pointer:fine){&[data-hover],&:hover{color:", ";", "}}", " ", ""], tab.height, spacingsTemplate(tab.spacings), active ? tab.states.active.typography.color : tab.typography.color, tab.background, outlineTemplate(tab.states.focus.outline), outlineTemplate(tab.states.focus.outline), active ? tab.states.active.states.hover.typography.color : tab.typography.color, disabled ? css(["background:", ";cursor:not-allowed;"], tab.states.disabled.background) : css(["background:", ";cursor:pointer;"], tab.states.hover.background), disabled ? bordersTemplate(tab.states.disabled.border) : bordersTemplate(tab.border), active && bordersTemplate(tab.states.active.border));
32
+ return css(["appearance:none;box-sizing:border-box;font-family:inherit;border:none;outline:none;font-size:1rem;height:", ";", " color:", ";background-color:", ";position:relative;white-space:nowrap;text-overflow:ellipsis;overflow-x:hidden;scroll-snap-align:end;scroll-snap-stop:always;&:focus{outline:none;}&[data-focus],&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}&::-moz-focus-inner{border:0;}@media (hover:hover) and (pointer:fine){&[data-hover],&:hover{color:", ";", "}}", " ", ""], tab.height, spacingsTemplate(tab.spacings), active ? tab.states.active.typography.color : tab.typography.color, tab.background, outlineTemplate(tab.states.focus.outline), outlineTemplate(tab.states.focus.outline), active ? tab.states.active.states.hover.typography.color : tab.typography.color, disabled ? css(["background:", ";cursor:not-allowed;"], tab.states.disabled.background) : css(["background:", ";cursor:pointer;"], tab.states.hover.background), disabled ? bordersTemplate(tab.states.disabled.border) : bordersTemplate(tab.border), active && bordersTemplate(tab.states.active.border));
31
33
  });
32
34
  const Tab = /*#__PURE__*/forwardRef(function Tab(props, ref) {
33
35
  return /*#__PURE__*/jsx(StyledTab, {
@@ -1,8 +1,8 @@
1
- import { forwardRef, useContext, useRef, useCallback, useEffect, Children, cloneElement } from 'react';
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
4
  import { TabsContext } from './Tabs.context.js';
4
5
  import { jsx } from 'react/jsx-runtime';
5
- import { useCombinedRefs } from '../../hooks/useCombinedRefs.js';
6
6
 
7
7
  const variants = {
8
8
  fullWidth: 'minmax(1%, 360px)',
@@ -13,26 +13,38 @@ const StyledTabList = styled.div.attrs(() => ({
13
13
  })).withConfig({
14
14
  displayName: "TabList__StyledTabList",
15
15
  componentId: "sc-1g1p5i1-0"
16
- })(["display:grid;grid-auto-flow:column;grid-auto-columns:", ";"], ({
17
- variant
18
- }) => variants[variant]);
19
- const TabList = /*#__PURE__*/forwardRef(function TabsList({
20
- children = [],
21
- ...props
22
- }, ref) {
16
+ })(["display:grid;grid-auto-flow:column;grid-auto-columns:", ";overflow-x:", ";scroll-snap-type:x mandatory;overscroll-behavior-x:contain;@media (prefers-reduced-motion:no-preference){scroll-behavior:smooth;}@media (hover:none){overflow-x:scroll;-webkit-overflow-scrolling:touch;scrollbar-width:0;&::-webkit-scrollbar{width:0;height:0;}}"], _ref => {
17
+ let {
18
+ variant
19
+ } = _ref;
20
+ return variants[variant];
21
+ }, _ref2 => {
22
+ let {
23
+ scrollable
24
+ } = _ref2;
25
+ return scrollable ? 'auto' : 'hidden';
26
+ });
27
+ const TabList = /*#__PURE__*/forwardRef(function TabsList(_ref3, ref) {
28
+ let {
29
+ children = [],
30
+ ...props
31
+ } = _ref3;
23
32
  const {
24
33
  activeTab,
25
34
  handleChange,
26
35
  tabsId,
27
36
  variant = 'minWidth',
37
+ scrollable = false,
28
38
  tabsFocused
29
39
  } = useContext(TabsContext);
30
40
  const currentTab = useRef(activeTab);
41
+ const [arrowNavigating, setArrowNavigating] = useState(false);
31
42
  const selectedTabRef = useCallback(node => {
32
- if (node !== null && tabsFocused) {
43
+ if (node !== null && tabsFocused || node !== null && arrowNavigating) {
44
+ setArrowNavigating(false);
33
45
  node.focus();
34
46
  }
35
- }, [tabsFocused]);
47
+ }, [arrowNavigating, tabsFocused]);
36
48
  useEffect(() => {
37
49
  currentTab.current = activeTab;
38
50
  }, [activeTab]);
@@ -61,6 +73,7 @@ const TabList = /*#__PURE__*/forwardRef(function TabsList({
61
73
  const handleTabsChange = (direction, fallbackTab) => {
62
74
  const i = direction === 'left' ? 1 : -1;
63
75
  const nextTab = focusableChildren[focusableChildren.indexOf(currentTab.current) - i];
76
+ setArrowNavigating(true);
64
77
  handleChange(nextTab === undefined ? fallbackTab : nextTab);
65
78
  };
66
79
 
@@ -70,10 +83,12 @@ const TabList = /*#__PURE__*/forwardRef(function TabsList({
70
83
  } = event;
71
84
 
72
85
  if (key === 'ArrowLeft') {
86
+ event.preventDefault();
73
87
  handleTabsChange('left', lastFocusableChild);
74
88
  }
75
89
 
76
90
  if (key === 'ArrowRight') {
91
+ event.preventDefault();
77
92
  handleTabsChange('right', firstFocusableChild);
78
93
  }
79
94
  };
@@ -83,6 +98,7 @@ const TabList = /*#__PURE__*/forwardRef(function TabsList({
83
98
  ref: ref,
84
99
  ...props,
85
100
  variant: variant,
101
+ scrollable: scrollable,
86
102
  children: Tabs
87
103
  });
88
104
  });
@@ -1,8 +1,7 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
+ import { spacingsTemplate, outlineTemplate } from '@equinor/eds-utils';
3
4
  import { jsx } from 'react/jsx-runtime';
4
- import { spacingsTemplate } from '../../utils/templates/index.js';
5
- import { outlineTemplate } from '../../utils/templates/focus.js';
6
5
 
7
6
  const StyledTabPanel = styled.div.attrs(() => ({
8
7
  tabIndex: 0,
@@ -10,9 +9,10 @@ const StyledTabPanel = styled.div.attrs(() => ({
10
9
  })).withConfig({
11
10
  displayName: "TabPanel__StyledTabPanel",
12
11
  componentId: "sc-e8v1d4-0"
13
- })(({
14
- theme
15
- }) => {
12
+ })(_ref => {
13
+ let {
14
+ theme
15
+ } = _ref;
16
16
  const {
17
17
  entities: {
18
18
  panel
@@ -20,8 +20,9 @@ const StyledTabPanel = styled.div.attrs(() => ({
20
20
  } = theme;
21
21
  return css(["", " &:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}"], spacingsTemplate(panel.spacings), outlineTemplate(panel.states.focus.outline), outlineTemplate(panel.states.focus.outline));
22
22
  });
23
- const TabPanel = /*#__PURE__*/forwardRef(function TabPanel({ ...props
24
- }, ref) {
23
+ const TabPanel = /*#__PURE__*/forwardRef(function TabPanel(_ref2, ref) {
24
+ let { ...props
25
+ } = _ref2;
25
26
  return /*#__PURE__*/jsx(StyledTabPanel, {
26
27
  ref: ref,
27
28
  ...props,
@@ -2,10 +2,11 @@ import { forwardRef, useContext, Children, cloneElement } from 'react';
2
2
  import { TabsContext } from './Tabs.context.js';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
5
- const TabPanels = /*#__PURE__*/forwardRef(function TabPanels({
6
- children,
7
- ...props
8
- }, ref) {
5
+ const TabPanels = /*#__PURE__*/forwardRef(function TabPanels(_ref, ref) {
6
+ let {
7
+ children,
8
+ ...props
9
+ } = _ref;
9
10
  const {
10
11
  activeTab,
11
12
  tabsId
@@ -2,6 +2,7 @@ import { createContext } from 'react';
2
2
 
3
3
  const TabsContext = /*#__PURE__*/createContext({
4
4
  variant: 'minWidth',
5
+ scrollable: false,
5
6
  handleChange: () => null,
6
7
  activeTab: 0,
7
8
  tabsId: '',
@@ -1,26 +1,36 @@
1
- import { forwardRef, useState } from 'react';
1
+ import { forwardRef, useRef, 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
5
  import { ThemeProvider } from 'styled-components';
5
6
  import { jsx } from 'react/jsx-runtime';
6
- import { useId } from '../../hooks/useId.js';
7
7
  import { useEds } from '../EdsProvider/eds.context.js';
8
- import { useToken } from '../../hooks/useToken.js';
9
8
 
10
- const Tabs = /*#__PURE__*/forwardRef(function Tabs({
11
- activeTab = 0,
12
- onChange,
13
- onBlur,
14
- onFocus,
15
- variant = 'minWidth',
16
- id,
17
- ...props
18
- }, ref) {
9
+ const Tabs = /*#__PURE__*/forwardRef(function Tabs(_ref, ref) {
10
+ let {
11
+ activeTab = 0,
12
+ onChange,
13
+ onBlur,
14
+ onFocus,
15
+ variant = 'minWidth',
16
+ scrollable,
17
+ id,
18
+ ...props
19
+ } = _ref;
19
20
  const tabsId = useId(id, 'tabs');
21
+ const tabsRef = useRef(null);
22
+ const combinedTabsRef = useCombinedRefs(tabsRef, ref);
20
23
  const [tabsFocused, setTabsFocused] = useState(false);
24
+ const [listenerAttached, setListenerAttached] = useState(false);
21
25
  let blurTimer;
22
26
 
23
27
  const handleBlur = e => {
28
+ setListenerAttached(false);
29
+
30
+ if (tabsRef.current) {
31
+ tabsRef.current.removeEventListener('keyup', checkIfTabWasPressed);
32
+ }
33
+
24
34
  blurTimer = setTimeout(() => {
25
35
  if (tabsFocused) {
26
36
  setTabsFocused(false);
@@ -35,14 +45,33 @@ const Tabs = /*#__PURE__*/forwardRef(function Tabs({
35
45
  }
36
46
 
37
47
  clearTimeout(blurTimer);
48
+ if (tabsFocused) return;
38
49
 
39
- if (!tabsFocused) {
40
- setTabsFocused(true);
50
+ if (!listenerAttached) {
51
+ if (tabsRef.current) {
52
+ setListenerAttached(true);
53
+ tabsRef.current.addEventListener('keyup', checkIfTabWasPressed, {
54
+ once: true,
55
+ capture: true
56
+ });
57
+ }
41
58
  }
42
59
 
43
60
  onFocus && onFocus(e);
61
+ }; //Only force focus on active Tab if Tabs was navigated to with keyboard
62
+
63
+
64
+ const checkIfTabWasPressed = event => {
65
+ setListenerAttached(false);
66
+ if (event.key === 'Tab') setTabsFocused(true);
44
67
  };
45
68
 
69
+ useEffect(() => {
70
+ const tabs = tabsRef.current;
71
+ return () => {
72
+ if (tabs) tabs.removeEventListener('keyup', checkIfTabWasPressed);
73
+ }; // eslint-disable-next-line react-hooks/exhaustive-deps
74
+ }, []);
46
75
  const {
47
76
  density
48
77
  } = useEds();
@@ -57,10 +86,11 @@ const Tabs = /*#__PURE__*/forwardRef(function Tabs({
57
86
  handleChange: onChange,
58
87
  tabsId,
59
88
  variant,
89
+ scrollable,
60
90
  tabsFocused
61
91
  },
62
92
  children: /*#__PURE__*/jsx("div", {
63
- ref: ref,
93
+ ref: combinedTabsRef,
64
94
  ...props,
65
95
  onBlur: handleBlur,
66
96
  onFocus: handleFocus
@@ -34,6 +34,11 @@ const {
34
34
  comfortable: {
35
35
  medium: spacingMedium
36
36
  }
37
+ },
38
+ interactions: {
39
+ focused: {
40
+ width: focusOutlineWidth
41
+ }
37
42
  }
38
43
  } = tokens;
39
44
  const token = {
@@ -47,7 +52,7 @@ const token = {
47
52
  focus: {
48
53
  outline: {
49
54
  type: 'outline',
50
- width: '1px',
55
+ width: focusOutlineWidth,
51
56
  style: 'dashed',
52
57
  color: focusOutlineColor
53
58
  }
@@ -94,7 +99,8 @@ const token = {
94
99
  focus: {
95
100
  outline: {
96
101
  type: 'outline',
97
- width: '1px',
102
+ width: focusOutlineWidth,
103
+ offset: "-".concat(parseInt(focusOutlineWidth), "px"),
98
104
  style: 'dashed',
99
105
  color: focusOutlineColor
100
106
  }
@@ -1,26 +1,27 @@
1
1
  import { forwardRef } from 'react';
2
2
  import { useTextField } from './TextField.context.js';
3
3
  import styled, { css } from 'styled-components';
4
+ import { typographyTemplate, outlineTemplate } from '@equinor/eds-utils';
4
5
  import * as TextField_tokens from './TextField.tokens.js';
5
6
  import { jsxs, jsx } from 'react/jsx-runtime';
6
7
  import { Input } from '../Input/Input.js';
7
8
  import { Textarea } from '../Textarea/Textarea.js';
8
9
  import { Icon as InputIcon } from './Icon/Icon.js';
9
- import { typographyTemplate } from '../../utils/templates/index.js';
10
10
  import { useEds } from '../EdsProvider/eds.context.js';
11
- import { outlineTemplate } from '../../utils/templates/focus.js';
12
11
 
13
12
  const {
14
13
  textfield
15
14
  } = TextField_tokens;
16
15
 
17
- const Variation = ({
18
- variant,
19
- isFocused,
20
- token
21
- }) => {
16
+ const Variation = _ref => {
22
17
  var _token$border, _token$border2, _token$border3, _token$border4;
23
18
 
19
+ let {
20
+ variant,
21
+ isFocused,
22
+ token
23
+ } = _ref;
24
+
24
25
  if (!variant) {
25
26
  return "";
26
27
  }
@@ -39,45 +40,55 @@ const StrippedTextarea = styled(Textarea).withConfig({
39
40
  const InputWrapper = styled.div.withConfig({
40
41
  displayName: "Field__InputWrapper",
41
42
  componentId: "sc-455b88-2"
42
- })(({
43
- inputIcon,
44
- unit,
45
- isDisabled,
46
- isReadOnly,
47
- multiline,
48
- variant
49
- }) => css(["", " ", " ", " ", " ", ""], Variation, (inputIcon || unit) && css(["display:flex;align-items:center;background:", ";padding-right:", ";"], textfield.background, textfield.spacings.right), isReadOnly && css(["box-shadow:", ";background:", ";"], textfield.states.readOnly.boxShadow, textfield.states.readOnly.background), isDisabled && css(["box-shadow:none;cursor:not-allowed;outline:none;"]), multiline && variant === 'default' && !inputIcon && !unit && css(["box-shadow:none;"])));
43
+ })(_ref2 => {
44
+ let {
45
+ inputIcon,
46
+ unit,
47
+ isDisabled,
48
+ isReadOnly,
49
+ multiline,
50
+ variant
51
+ } = _ref2;
52
+ return css(["", " ", " ", " ", " ", ""], Variation, (inputIcon || unit) && css(["display:flex;align-items:center;background:", ";padding-right:", ";"], textfield.background, textfield.spacings.right), isReadOnly && css(["box-shadow:", ";background:", ";"], textfield.states.readOnly.boxShadow, textfield.states.readOnly.background), isDisabled && css(["box-shadow:none;cursor:not-allowed;outline:none;"]), multiline && variant === 'default' && !inputIcon && !unit && css(["box-shadow:none;"]));
53
+ });
50
54
  const Unit = styled.span.withConfig({
51
55
  displayName: "Field__Unit",
52
56
  componentId: "sc-455b88-3"
53
- })(["", ";display:inline-block;margin-top:3px;", ""], typographyTemplate(textfield.entities.unit.typography), ({
54
- isDisabled
55
- }) => isDisabled && {
56
- color: textfield.entities.unit.states.disabled.typography.color
57
+ })(["", ";display:inline-block;margin-top:3px;", ""], typographyTemplate(textfield.entities.unit.typography), _ref3 => {
58
+ let {
59
+ isDisabled
60
+ } = _ref3;
61
+ return isDisabled && {
62
+ color: textfield.entities.unit.states.disabled.typography.color
63
+ };
57
64
  });
58
65
  const Adornments = styled.div.withConfig({
59
66
  displayName: "Field__Adornments",
60
67
  componentId: "sc-455b88-4"
61
- })(["display:flex;align-items:center;justify-content:center;height:100%;margin-left:", ";& div:nth-child(2){margin-left:", ";}", ""], textfield.spacings.left, textfield.spacings.left, ({
62
- multiline,
63
- theme
64
- }) => multiline && {
65
- marginTop: theme.spacings.top,
66
- alignSelf: 'start'
68
+ })(["display:flex;align-items:center;justify-content:center;height:100%;margin-left:", ";& div:nth-child(2){margin-left:", ";}", ""], textfield.spacings.left, textfield.spacings.left, _ref4 => {
69
+ let {
70
+ multiline,
71
+ theme
72
+ } = _ref4;
73
+ return multiline && {
74
+ marginTop: theme.spacings.top,
75
+ alignSelf: 'start'
76
+ };
67
77
  });
68
- const Field = /*#__PURE__*/forwardRef(function Field({
69
- multiline,
70
- variant,
71
- disabled,
72
- readOnly,
73
- type,
74
- unit,
75
- inputIcon,
76
- rowsMax,
77
- onBlur,
78
- onFocus,
79
- ...other
80
- }, ref) {
78
+ const Field = /*#__PURE__*/forwardRef(function Field(_ref5, ref) {
79
+ let {
80
+ multiline,
81
+ variant,
82
+ disabled,
83
+ readOnly,
84
+ type,
85
+ unit,
86
+ inputIcon,
87
+ rowsMax,
88
+ onBlur,
89
+ onFocus,
90
+ ...other
91
+ } = _ref5;
81
92
  const {
82
93
  handleFocus,
83
94
  handleBlur,
@@ -1,16 +1,18 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
+ import { typographyTemplate } from '@equinor/eds-utils';
3
4
  import { helperText } from './HelperText.token.js';
4
5
  import { useTextField } from '../TextField.context.js';
5
6
  import { jsxs, jsx } from 'react/jsx-runtime';
6
7
  import { Icon as InputIcon } from '../Icon/Icon.js';
7
- import { typographyTemplate } from '../../../utils/templates/index.js';
8
8
 
9
- const Variation = ({
10
- variant,
11
- isFocused,
12
- isDisabled
13
- }) => {
9
+ const Variation = _ref => {
10
+ let {
11
+ variant,
12
+ isFocused,
13
+ isDisabled
14
+ } = _ref;
15
+
14
16
  if (!variant) {
15
17
  return "";
16
18
  }
@@ -35,22 +37,29 @@ const Variation = ({
35
37
  const Container = styled.div.withConfig({
36
38
  displayName: "HelperText__Container",
37
39
  componentId: "sc-1kfkyxg-0"
38
- })(["display:flex;align-items:flex-start;margin-top:", ";"], ({
39
- spacings
40
- }) => spacings.top);
40
+ })(["display:flex;align-items:flex-start;margin-top:", ";"], _ref2 => {
41
+ let {
42
+ spacings
43
+ } = _ref2;
44
+ return spacings.top;
45
+ });
41
46
  const Text = styled.p.withConfig({
42
47
  displayName: "HelperText__Text",
43
48
  componentId: "sc-1kfkyxg-1"
44
- })(["", " margin:0 0 0 ", ";", ""], typographyTemplate(helperText.typography), ({
45
- spacings
46
- }) => spacings.left, Variation);
47
- const TextfieldHelperText = /*#__PURE__*/forwardRef(function TextfieldHelperText({
48
- helperText: helperText$1,
49
- icon,
50
- variant = 'default',
51
- disabled: isDisabled,
52
- ...rest
53
- }, ref) {
49
+ })(["", " margin:0 0 0 ", ";", ""], typographyTemplate(helperText.typography), _ref3 => {
50
+ let {
51
+ spacings
52
+ } = _ref3;
53
+ return spacings.left;
54
+ }, Variation);
55
+ const TextfieldHelperText = /*#__PURE__*/forwardRef(function TextfieldHelperText(_ref4, ref) {
56
+ let {
57
+ helperText: helperText$1,
58
+ icon,
59
+ variant = 'default',
60
+ disabled: isDisabled,
61
+ ...rest
62
+ } = _ref4;
54
63
  const helperVariant = helperText[variant];
55
64
  const spacings = helperText.spacings.comfortable;
56
65
  const {