@equinor/eds-core-react 0.23.0 → 0.24.0-dev.20221006

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 (177) hide show
  1. package/dist/eds-core-react.cjs.js +4139 -5171
  2. package/dist/esm/components/Accordion/Accordion.js +26 -21
  3. package/dist/esm/components/Accordion/Accordion.tokens.js +23 -62
  4. package/dist/esm/components/Accordion/AccordionHeader.js +55 -74
  5. package/dist/esm/components/Accordion/AccordionHeaderActions.js +19 -23
  6. package/dist/esm/components/Accordion/AccordionHeaderTitle.js +19 -23
  7. package/dist/esm/components/Accordion/AccordionItem.js +32 -25
  8. package/dist/esm/components/Accordion/AccordionPanel.js +22 -27
  9. package/dist/esm/components/Accordion/index.js +1 -1
  10. package/dist/esm/components/Autocomplete/Autocomplete.js +279 -272
  11. package/dist/esm/components/Autocomplete/Autocomplete.tokens.js +18 -27
  12. package/dist/esm/components/Autocomplete/Option.js +27 -25
  13. package/dist/esm/components/Avatar/Avatar.js +23 -22
  14. package/dist/esm/components/Avatar/Avatar.tokens.js +1 -1
  15. package/dist/esm/components/Banner/Banner.js +31 -27
  16. package/dist/esm/components/Banner/Banner.tokens.js +19 -47
  17. package/dist/esm/components/Banner/BannerActions.js +21 -20
  18. package/dist/esm/components/Banner/BannerIcon.js +28 -28
  19. package/dist/esm/components/Banner/BannerMessage.js +16 -14
  20. package/dist/esm/components/Banner/index.js +1 -1
  21. package/dist/esm/components/Breadcrumbs/Breadcrumb.js +29 -28
  22. package/dist/esm/components/Breadcrumbs/Breadcrumbs.js +47 -40
  23. package/dist/esm/components/Breadcrumbs/Breadcrumbs.tokens.js +5 -20
  24. package/dist/esm/components/Breadcrumbs/index.js +1 -1
  25. package/dist/esm/components/Button/Button.js +49 -46
  26. package/dist/esm/components/Button/ButtonGroup/ButtonGroup.js +22 -24
  27. package/dist/esm/components/Button/ButtonGroup/ButtonGroup.tokens.js +2 -8
  28. package/dist/esm/components/Button/InnerFullWidth.js +10 -9
  29. package/dist/esm/components/Button/ToggleButton/ToggleButton.js +31 -21
  30. package/dist/esm/components/Button/index.js +1 -1
  31. package/dist/esm/components/Button/tokens/button.js +31 -60
  32. package/dist/esm/components/Button/tokens/contained.js +14 -38
  33. package/dist/esm/components/Button/tokens/contained_icon.js +10 -13
  34. package/dist/esm/components/Button/tokens/ghost.js +13 -36
  35. package/dist/esm/components/Button/tokens/icon.js +20 -46
  36. package/dist/esm/components/Button/tokens/index.js +1 -1
  37. package/dist/esm/components/Button/tokens/outlined.js +15 -42
  38. package/dist/esm/components/Card/Card.js +28 -26
  39. package/dist/esm/components/Card/Card.tokens.js +11 -32
  40. package/dist/esm/components/Card/CardActions.js +24 -23
  41. package/dist/esm/components/Card/CardContent.js +13 -13
  42. package/dist/esm/components/Card/CardHeader.js +15 -14
  43. package/dist/esm/components/Card/CardHeaderTitle.js +14 -11
  44. package/dist/esm/components/Card/CardMedia.js +21 -21
  45. package/dist/esm/components/Card/index.js +1 -1
  46. package/dist/esm/components/Checkbox/Checkbox.js +20 -20
  47. package/dist/esm/components/Checkbox/Checkbox.tokens.js +14 -39
  48. package/dist/esm/components/Checkbox/Input.js +63 -78
  49. package/dist/esm/components/Chip/Chip.js +60 -70
  50. package/dist/esm/components/Chip/Chip.tokens.js +27 -68
  51. package/dist/esm/components/Chip/Icon.js +9 -15
  52. package/dist/esm/components/Dialog/Dialog.js +36 -31
  53. package/dist/esm/components/Dialog/Dialog.tokens.js +8 -29
  54. package/dist/esm/components/Dialog/DialogActions.js +15 -15
  55. package/dist/esm/components/Dialog/DialogContent.js +23 -22
  56. package/dist/esm/components/Dialog/DialogHeader.js +17 -16
  57. package/dist/esm/components/Dialog/DialogTitle.js +15 -15
  58. package/dist/esm/components/Dialog/index.js +1 -1
  59. package/dist/esm/components/Divider/Divider.js +28 -25
  60. package/dist/esm/components/Divider/Divider.tokens.js +10 -24
  61. package/dist/esm/components/EdsProvider/eds.context.js +26 -16
  62. package/dist/esm/components/Icon/Icon.js +63 -67
  63. package/dist/esm/components/Icon/index.js +1 -1
  64. package/dist/esm/components/Icon/library.js +8 -8
  65. package/dist/esm/components/Input/Input.js +37 -40
  66. package/dist/esm/components/Input/Input.tokens.js +32 -43
  67. package/dist/esm/components/Label/Label.js +19 -17
  68. package/dist/esm/components/Label/Label.tokens.js +7 -10
  69. package/dist/esm/components/List/List.js +18 -19
  70. package/dist/esm/components/List/List.tokens.js +2 -6
  71. package/dist/esm/components/List/ListItem.js +9 -7
  72. package/dist/esm/components/List/index.js +1 -1
  73. package/dist/esm/components/Menu/Menu.context.js +45 -34
  74. package/dist/esm/components/Menu/Menu.js +92 -90
  75. package/dist/esm/components/Menu/Menu.tokens.js +24 -54
  76. package/dist/esm/components/Menu/MenuItem.js +50 -58
  77. package/dist/esm/components/Menu/MenuList.js +54 -50
  78. package/dist/esm/components/Menu/MenuSection.js +9 -9
  79. package/dist/esm/components/Menu/index.js +1 -1
  80. package/dist/esm/components/Pagination/Pagination.js +75 -71
  81. package/dist/esm/components/Pagination/Pagination.tokens.js +5 -18
  82. package/dist/esm/components/Pagination/PaginationItem.js +21 -19
  83. package/dist/esm/components/Pagination/paginationControl.js +22 -18
  84. package/dist/esm/components/Paper/Paper.js +15 -14
  85. package/dist/esm/components/Paper/Paper.tokens.js +4 -12
  86. package/dist/esm/components/Popover/Popover.js +85 -88
  87. package/dist/esm/components/Popover/Popover.tokens.js +8 -27
  88. package/dist/esm/components/Popover/PopoverActions.js +16 -16
  89. package/dist/esm/components/Popover/PopoverContent.js +16 -15
  90. package/dist/esm/components/Popover/PopoverHeader.js +17 -16
  91. package/dist/esm/components/Popover/PopoverTitle.js +16 -15
  92. package/dist/esm/components/Popover/index.js +1 -1
  93. package/dist/esm/components/Progress/Circular/CircularProgress.js +46 -34
  94. package/dist/esm/components/Progress/Circular/CircularProgress.tokens.js +8 -24
  95. package/dist/esm/components/Progress/Dots/DotProgress.js +23 -20
  96. package/dist/esm/components/Progress/Dots/DotProgress.tokens.js +8 -20
  97. package/dist/esm/components/Progress/Linear/LinearProgress.js +34 -24
  98. package/dist/esm/components/Progress/Linear/LinearProgress.tokens.js +4 -13
  99. package/dist/esm/components/Progress/Star/StarProgress.js +29 -25
  100. package/dist/esm/components/Progress/Star/StarProgress.tokens.js +2 -10
  101. package/dist/esm/components/Progress/index.js +1 -1
  102. package/dist/esm/components/Radio/Radio.js +57 -76
  103. package/dist/esm/components/Radio/Radio.tokens.js +14 -39
  104. package/dist/esm/components/Scrim/Scrim.js +24 -21
  105. package/dist/esm/components/Scrim/Scrim.tokens.js +3 -11
  106. package/dist/esm/components/Search/Search.js +130 -117
  107. package/dist/esm/components/Search/Search.tokens.js +12 -36
  108. package/dist/esm/components/Select/MultiSelect/MultiSelect.js +115 -105
  109. package/dist/esm/components/Select/NativeSelect/NativeSelect.js +45 -43
  110. package/dist/esm/components/Select/NativeSelect/NativeSelect.tokens.js +10 -14
  111. package/dist/esm/components/Select/Select.tokens.js +18 -27
  112. package/dist/esm/components/Select/SingleSelect/SingleSelect.js +86 -79
  113. package/dist/esm/components/Select/commonStyles.js +14 -26
  114. package/dist/esm/components/SideSheet/SideSheet.js +29 -27
  115. package/dist/esm/components/SideSheet/SideSheet.tokens.js +12 -28
  116. package/dist/esm/components/Slider/MinMax.js +6 -11
  117. package/dist/esm/components/Slider/Output.js +10 -17
  118. package/dist/esm/components/Slider/Slider.js +126 -116
  119. package/dist/esm/components/Slider/Slider.tokens.js +19 -51
  120. package/dist/esm/components/Slider/SliderInput.js +35 -37
  121. package/dist/esm/components/Snackbar/Snackbar.js +45 -34
  122. package/dist/esm/components/Snackbar/Snackbar.tokens.js +17 -44
  123. package/dist/esm/components/Snackbar/SnackbarAction.js +16 -15
  124. package/dist/esm/components/Snackbar/index.js +1 -1
  125. package/dist/esm/components/Switch/Switch.js +37 -38
  126. package/dist/esm/components/Switch/Switch.styles.js +14 -20
  127. package/dist/esm/components/Switch/Switch.tokens.js +25 -70
  128. package/dist/esm/components/Switch/SwitchDefault.js +27 -37
  129. package/dist/esm/components/Switch/SwitchSmall.js +28 -41
  130. package/dist/esm/components/Table/Body.js +10 -8
  131. package/dist/esm/components/Table/Caption.js +9 -9
  132. package/dist/esm/components/Table/Cell.js +14 -16
  133. package/dist/esm/components/Table/DataCell/DataCell.js +27 -28
  134. package/dist/esm/components/Table/DataCell/DataCell.tokens.js +38 -73
  135. package/dist/esm/components/Table/Head/Head.js +12 -10
  136. package/dist/esm/components/Table/Head/Head.tokens.js +4 -15
  137. package/dist/esm/components/Table/HeaderCell/HeaderCell.js +30 -32
  138. package/dist/esm/components/Table/HeaderCell/HeaderCell.tokens.js +28 -62
  139. package/dist/esm/components/Table/Inner.context.js +2 -2
  140. package/dist/esm/components/Table/Row/Row.js +11 -13
  141. package/dist/esm/components/Table/Row/Row.tokens.js +4 -13
  142. package/dist/esm/components/Table/Table.js +10 -8
  143. package/dist/esm/components/Table/index.js +1 -1
  144. package/dist/esm/components/TableOfContents/LinkItem.js +12 -12
  145. package/dist/esm/components/TableOfContents/TableOfContents.js +28 -28
  146. package/dist/esm/components/TableOfContents/TableOfContents.tokens.js +21 -43
  147. package/dist/esm/components/TableOfContents/index.js +1 -1
  148. package/dist/esm/components/Tabs/Tab.js +15 -21
  149. package/dist/esm/components/Tabs/TabList.js +61 -52
  150. package/dist/esm/components/Tabs/TabPanel.js +18 -20
  151. package/dist/esm/components/Tabs/TabPanels.js +22 -18
  152. package/dist/esm/components/Tabs/Tabs.context.js +5 -3
  153. package/dist/esm/components/Tabs/Tabs.js +60 -39
  154. package/dist/esm/components/Tabs/Tabs.tokens.js +21 -55
  155. package/dist/esm/components/Tabs/index.js +1 -1
  156. package/dist/esm/components/TextField/Field.js +78 -85
  157. package/dist/esm/components/TextField/HelperText/HelperText.js +37 -40
  158. package/dist/esm/components/TextField/HelperText/HelperText.token.js +5 -9
  159. package/dist/esm/components/TextField/Icon/Icon.js +41 -40
  160. package/dist/esm/components/TextField/Icon/Icon.tokens.js +4 -8
  161. package/dist/esm/components/TextField/TextField.context.js +29 -19
  162. package/dist/esm/components/TextField/TextField.js +59 -57
  163. package/dist/esm/components/TextField/TextField.tokens.js +12 -16
  164. package/dist/esm/components/Textarea/Textarea.js +56 -58
  165. package/dist/esm/components/Tooltip/Tooltip.js +76 -64
  166. package/dist/esm/components/Tooltip/Tooltip.tokens.js +13 -32
  167. package/dist/esm/components/TopBar/Actions.js +12 -10
  168. package/dist/esm/components/TopBar/CustomContent.js +12 -10
  169. package/dist/esm/components/TopBar/Header.js +12 -10
  170. package/dist/esm/components/TopBar/TopBar.js +29 -25
  171. package/dist/esm/components/TopBar/TopBar.tokens.js +4 -10
  172. package/dist/esm/components/TopBar/index.js +1 -1
  173. package/dist/esm/components/Typography/Typography.js +44 -50
  174. package/dist/esm/components/Typography/Typography.tokens.js +25 -49
  175. package/dist/esm/node_modules/.pnpm/ramda@0.28.0/node_modules/ramda/es/internal/_isPlaceholder.js +3 -1
  176. package/dist/types/components/Autocomplete/Autocomplete.d.ts +4 -0
  177. package/package.json +4 -10
@@ -1,53 +1,23 @@
1
+ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
1
2
  import { tokens } from '@equinor/eds-tokens';
2
3
 
3
- const {
4
- colors: {
5
- ui: {
6
- background__default: {
7
- rgba: background
8
- }
9
- },
10
- interactive: {
11
- primary__selected_highlight: {
12
- rgba: activeBackground
13
- },
14
- primary__resting: {
15
- rgba: activeTextColor
16
- },
17
- focus: {
18
- rgba: focusColor
19
- },
20
- disabled__fill: {
21
- rgba: disabledIconColor
22
- },
23
- disabled__text: {
24
- rgba: disabledTextColor
25
- },
26
- table__header__fill_hover: {
27
- rgba: hoverBackground
28
- }
29
- },
30
- text: {
31
- static_icons__default: {
32
- rgba: textColor
33
- }
34
- }
35
- },
36
- spacings: {
37
- comfortable: {
38
- medium,
39
- large,
40
- small
41
- }
42
- },
43
- typography: {
44
- navigation: {
45
- menu_title: typography
46
- }
47
- }
48
- } = tokens;
49
- const menu = {
50
- background,
4
+ var _tokens$colors = tokens.colors,
5
+ background = _tokens$colors.ui.background__default.rgba,
6
+ _tokens$colors$intera = _tokens$colors.interactive,
7
+ activeBackground = _tokens$colors$intera.primary__selected_highlight.rgba,
8
+ activeTextColor = _tokens$colors$intera.primary__resting.rgba,
9
+ focusColor = _tokens$colors$intera.focus.rgba,
10
+ disabledIconColor = _tokens$colors$intera.disabled__fill.rgba,
11
+ disabledTextColor = _tokens$colors$intera.disabled__text.rgba,
12
+ hoverBackground = _tokens$colors$intera.table__header__fill_hover.rgba,
13
+ textColor = _tokens$colors.text.static_icons__default.rgba,
14
+ _tokens$spacings$comf = tokens.spacings.comfortable,
15
+ medium = _tokens$spacings$comf.medium,
16
+ large = _tokens$spacings$comf.large,
17
+ small = _tokens$spacings$comf.small,
18
+ typography = tokens.typography.navigation.menu_title;
19
+ var menu = {
20
+ background: background,
51
21
  spacings: {
52
22
  top: small,
53
23
  bottom: small,
@@ -58,9 +28,9 @@ const menu = {
58
28
  type: 'border',
59
29
  radius: '4px'
60
30
  },
61
- typography: { ...typography,
31
+ typography: _objectSpread(_objectSpread({}, typography), {}, {
62
32
  color: textColor
63
- },
33
+ }),
64
34
  entities: {
65
35
  icon: {
66
36
  states: {
@@ -80,9 +50,9 @@ const menu = {
80
50
  },
81
51
  states: {
82
52
  active: {
83
- typography: { ...typography,
53
+ typography: _objectSpread(_objectSpread({}, typography), {}, {
84
54
  color: activeTextColor
85
- },
55
+ }),
86
56
  background: activeBackground
87
57
  },
88
58
  focus: {
@@ -98,9 +68,9 @@ const menu = {
98
68
  background: hoverBackground
99
69
  },
100
70
  disabled: {
101
- typography: { ...typography,
71
+ typography: _objectSpread(_objectSpread({}, typography), {}, {
102
72
  color: disabledTextColor
103
- }
73
+ })
104
74
  }
105
75
  }
106
76
  },
@@ -1,3 +1,5 @@
1
+ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
1
3
  import { forwardRef } from 'react';
2
4
  import styled, { css } from 'styled-components';
3
5
  import { menu } from './Menu.tokens.js';
@@ -5,24 +7,17 @@ import { typographyTemplate, spacingsTemplate, outlineTemplate, mergeRefs } from
5
7
  import { useMenu } from './Menu.context.js';
6
8
  import { jsx } from 'react/jsx-runtime';
7
9
 
8
- const {
9
- typography,
10
- entities: {
11
- item: {
12
- states: {
13
- active: activeToken,
14
- focus,
15
- hover,
16
- disabled: disabledToken
17
- }
18
- },
19
- icon
20
- }
21
- } = menu;
22
- const Item = styled.button.attrs(_ref => {
23
- let {
24
- isFocused
25
- } = _ref;
10
+ var _excluded = ["children", "disabled", "index", "onClick"];
11
+ var typography = menu.typography,
12
+ _tokens$entities = menu.entities,
13
+ _tokens$entities$item = _tokens$entities.item.states,
14
+ activeToken = _tokens$entities$item.active,
15
+ focus = _tokens$entities$item.focus,
16
+ hover = _tokens$entities$item.hover,
17
+ disabledToken = _tokens$entities$item.disabled,
18
+ icon = _tokens$entities.icon;
19
+ var Item = styled.button.attrs(function (_ref) {
20
+ var isFocused = _ref.isFocused;
26
21
  return {
27
22
  role: 'menuitem',
28
23
  tabIndex: isFocused ? -1 : 0
@@ -30,63 +25,60 @@ const Item = styled.button.attrs(_ref => {
30
25
  }).withConfig({
31
26
  displayName: "MenuItem__Item",
32
27
  componentId: "sc-1g9fpbe-0"
33
- })(["border:0;background-color:transparent;width:auto;position:relative;z-index:2;", " ", " ", " ", ""], typographyTemplate(typography), _ref2 => {
34
- let {
35
- theme
36
- } = _ref2;
28
+ })(["border:0;background-color:transparent;width:auto;position:relative;z-index:2;", " ", " ", " ", ""], typographyTemplate(typography), function (_ref2) {
29
+ var theme = _ref2.theme;
37
30
  return spacingsTemplate(theme.entities.item.spacings);
38
- }, _ref3 => {
39
- let {
40
- active
41
- } = _ref3;
31
+ }, function (_ref3) {
32
+ var active = _ref3.active;
42
33
  return active && css(["background:", ";*{color:", ";}"], activeToken.background, activeToken.typography.color);
43
- }, _ref4 => {
44
- let {
45
- disabled
46
- } = _ref4;
34
+ }, function (_ref4) {
35
+ var disabled = _ref4.disabled;
47
36
  return disabled ? css(["*{color:", ";}svg{fill:", ";}&:focus{outline:none;}@media (hover:hover) and (pointer:fine){&:hover{cursor:not-allowed;}}"], disabledToken.typography.color, icon.states.disabled.typography.color) : css(["@media (hover:hover) and (pointer:fine){&:hover{z-index:1;cursor:pointer;background:", ";}}&:focus{z-index:3;", "}"], hover.background, outlineTemplate(focus.outline));
48
37
  });
49
- const Content = styled.div.withConfig({
38
+ var Content = styled.div.withConfig({
50
39
  displayName: "MenuItem__Content",
51
40
  componentId: "sc-1g9fpbe-1"
52
41
  })(["width:auto;display:grid;grid-gap:16px;grid-auto-flow:column;grid-auto-columns:max-content auto max-content;align-items:center;"]);
53
- const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(_ref5, ref) {
54
- let {
55
- children,
56
- disabled,
57
- index = 0,
58
- onClick,
59
- ...rest
60
- } = _ref5;
61
- const {
62
- focusedIndex,
63
- setFocusedIndex,
64
- onClose
65
- } = useMenu();
42
+ var MenuItem = /*#__PURE__*/forwardRef(function MenuItem(_ref5, ref) {
43
+ var children = _ref5.children,
44
+ disabled = _ref5.disabled,
45
+ _ref5$index = _ref5.index,
46
+ index = _ref5$index === void 0 ? 0 : _ref5$index,
47
+ _onClick = _ref5.onClick,
48
+ rest = _objectWithoutProperties(_ref5, _excluded);
49
+
50
+ var _useMenu = useMenu(),
51
+ focusedIndex = _useMenu.focusedIndex,
52
+ setFocusedIndex = _useMenu.setFocusedIndex,
53
+ onClose = _useMenu.onClose;
66
54
 
67
- const toggleFocus = index_ => {
55
+ var toggleFocus = function toggleFocus(index_) {
68
56
  if (focusedIndex !== index_) {
69
57
  setFocusedIndex(index_);
70
58
  }
71
59
  };
72
60
 
73
- const isFocused = index === focusedIndex;
74
- const props = { ...rest,
75
- disabled,
76
- isFocused
77
- };
78
- return /*#__PURE__*/jsx(Item, { ...props,
79
- ref: mergeRefs(ref, el => {
61
+ var isFocused = index === focusedIndex;
62
+
63
+ var props = _objectSpread(_objectSpread({}, rest), {}, {
64
+ disabled: disabled,
65
+ isFocused: isFocused
66
+ });
67
+
68
+ return /*#__PURE__*/jsx(Item, _objectSpread(_objectSpread({}, props), {}, {
69
+ ref: mergeRefs(ref, function (el) {
80
70
  if (isFocused) {
81
- requestAnimationFrame(() => {
71
+ requestAnimationFrame(function () {
82
72
  if (el !== null) el.focus();
83
73
  });
84
74
  }
85
75
  }),
86
- onFocus: () => toggleFocus(index),
87
- onClick: e => {
88
- if (onClick) {
89
- onClick(e);
76
+ onFocus: function onFocus() {
77
+ return toggleFocus(index);
78
+ },
79
+ onClick: function onClick(e) {
80
+ if (_onClick) {
81
+ _onClick(e);
90
82
 
91
83
  if (onClose !== null) {
92
84
  onClose(e);
@@ -96,7 +88,7 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(_ref5, ref) {
96
88
  children: /*#__PURE__*/jsx(Content, {
97
89
  children: children
98
90
  })
99
- });
91
+ }));
100
92
  });
101
93
  MenuItem.displayName = 'MenuItem';
102
94
 
@@ -1,3 +1,5 @@
1
+ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
1
3
  import { forwardRef, useMemo, Children, cloneElement, useEffect, isValidElement } from 'react';
2
4
  import styled from 'styled-components';
3
5
  import { useMenu } from './Menu.context.js';
@@ -7,7 +9,8 @@ import { menu } from './Menu.tokens.js';
7
9
  import { spacingsTemplate } from '@equinor/eds-utils';
8
10
  import { jsx } from 'react/jsx-runtime';
9
11
 
10
- const List = styled.div.withConfig({
12
+ var _excluded = ["children"];
13
+ var List = styled.div.withConfig({
11
14
  displayName: "MenuList__List",
12
15
  componentId: "sc-104rzof-0"
13
16
  })(["position:relative;list-style:none;display:flex;flex-direction:column;margin:0;", " li:first-child{z-index:3;}"], spacingsTemplate(menu.spacings));
@@ -17,45 +20,48 @@ function isIndexable(item) {
17
20
  return false;
18
21
  }
19
22
 
20
- const MenuList = /*#__PURE__*/forwardRef(function MenuList(_ref, ref) {
21
- let {
22
- children,
23
- ...rest
24
- } = _ref;
25
- const {
26
- focusedIndex,
27
- setFocusedIndex,
28
- initialFocus
29
- } = useMenu();
30
- let index = -1;
31
- const focusableIndexs = useMemo(() => [], []);
32
- const updatedChildren = useMemo(() => Children.map(children, child => {
33
- if (!child) return child;
23
+ var MenuList = /*#__PURE__*/forwardRef(function MenuList(_ref, ref) {
24
+ var children = _ref.children,
25
+ rest = _objectWithoutProperties(_ref, _excluded);
34
26
 
35
- if (child.type === MenuSection) {
36
- index++;
37
- const menuSectionIndex = index;
38
- const updatedGrandChildren = Children.map(child.props.children, grandChild => {
27
+ var _useMenu = useMenu(),
28
+ focusedIndex = _useMenu.focusedIndex,
29
+ setFocusedIndex = _useMenu.setFocusedIndex,
30
+ initialFocus = _useMenu.initialFocus;
31
+
32
+ var index = -1;
33
+ var focusableIndexs = useMemo(function () {
34
+ return [];
35
+ }, []);
36
+ var updatedChildren = useMemo(function () {
37
+ return Children.map(children, function (child) {
38
+ if (!child) return child;
39
+
40
+ if (child.type === MenuSection) {
39
41
  index++;
40
- if (isIndexable(grandChild)) focusableIndexs.push(index);
41
- return /*#__PURE__*/cloneElement(grandChild, {
42
- index
42
+ var menuSectionIndex = index;
43
+ var updatedGrandChildren = Children.map(child.props.children, function (grandChild) {
44
+ index++;
45
+ if (isIndexable(grandChild)) focusableIndexs.push(index);
46
+ return /*#__PURE__*/cloneElement(grandChild, {
47
+ index: index
48
+ });
43
49
  });
44
- });
45
- return /*#__PURE__*/cloneElement(child, {
46
- index: menuSectionIndex
47
- }, updatedGrandChildren);
48
- } else {
49
- index++;
50
- if (isIndexable(child)) focusableIndexs.push(index);
51
- return /*#__PURE__*/cloneElement(child, {
52
- index
53
- });
54
- }
55
- }), [children, focusableIndexs, index]);
56
- const firstFocusIndex = focusableIndexs[0];
57
- const lastFocusIndex = focusableIndexs[focusableIndexs.length - 1];
58
- useEffect(() => {
50
+ return /*#__PURE__*/cloneElement(child, {
51
+ index: menuSectionIndex
52
+ }, updatedGrandChildren);
53
+ } else {
54
+ index++;
55
+ if (isIndexable(child)) focusableIndexs.push(index);
56
+ return /*#__PURE__*/cloneElement(child, {
57
+ index: index
58
+ });
59
+ }
60
+ });
61
+ }, [children, focusableIndexs, index]);
62
+ var firstFocusIndex = focusableIndexs[0];
63
+ var lastFocusIndex = focusableIndexs[focusableIndexs.length - 1];
64
+ useEffect(function () {
59
65
  if (initialFocus === 'first') {
60
66
  setFocusedIndex(firstFocusIndex);
61
67
  }
@@ -66,18 +72,16 @@ const MenuList = /*#__PURE__*/forwardRef(function MenuList(_ref, ref) {
66
72
 
67
73
  }, [initialFocus, firstFocusIndex, lastFocusIndex]);
68
74
 
69
- const handleMenuItemChange = (direction, fallbackIndex) => {
70
- const i = direction === 'down' ? 1 : -1;
71
- const currentFocus = focusableIndexs.indexOf(focusedIndex);
72
- const nextMenuItem = focusableIndexs[currentFocus + i];
73
- const nextFocusedIndex = typeof nextMenuItem === 'undefined' ? fallbackIndex : nextMenuItem;
75
+ var handleMenuItemChange = function handleMenuItemChange(direction, fallbackIndex) {
76
+ var i = direction === 'down' ? 1 : -1;
77
+ var currentFocus = focusableIndexs.indexOf(focusedIndex);
78
+ var nextMenuItem = focusableIndexs[currentFocus + i];
79
+ var nextFocusedIndex = typeof nextMenuItem === 'undefined' ? fallbackIndex : nextMenuItem;
74
80
  setFocusedIndex(nextFocusedIndex);
75
81
  };
76
82
 
77
- const handleKeyPress = event => {
78
- const {
79
- key
80
- } = event;
83
+ var handleKeyPress = function handleKeyPress(event) {
84
+ var key = event.key;
81
85
  event.stopPropagation();
82
86
 
83
87
  if (key === 'ArrowDown') {
@@ -91,13 +95,13 @@ const MenuList = /*#__PURE__*/forwardRef(function MenuList(_ref, ref) {
91
95
  }
92
96
  };
93
97
 
94
- return /*#__PURE__*/jsx(List, {
98
+ return /*#__PURE__*/jsx(List, _objectSpread(_objectSpread({
95
99
  onKeyDown: handleKeyPress,
96
- role: "menu",
97
- ...rest,
100
+ role: "menu"
101
+ }, rest), {}, {
98
102
  ref: ref,
99
103
  children: updatedChildren
100
- });
104
+ }));
101
105
  }); // MenuList.displayName = 'EdsMenuList'
102
106
 
103
107
  export { MenuList };
@@ -6,18 +6,18 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
6
6
  import { Divider } from '../Divider/Divider.js';
7
7
  import { Typography } from '../Typography/Typography.js';
8
8
 
9
- const Header = styled.div.attrs(() => ({
10
- tabIndex: 0
11
- })).withConfig({
9
+ var Header = styled.div.attrs(function () {
10
+ return {
11
+ tabIndex: 0
12
+ };
13
+ }).withConfig({
12
14
  displayName: "MenuSection__Header",
13
15
  componentId: "sc-gfcbvg-0"
14
16
  })(["", " &:focus{outline:none;}"], spacingsTemplate(menu.entities.title.spacings));
15
- const MenuSection = /*#__PURE__*/memo(function MenuSection(props) {
16
- const {
17
- children,
18
- title,
19
- index
20
- } = props;
17
+ var MenuSection = /*#__PURE__*/memo(function MenuSection(props) {
18
+ var children = props.children,
19
+ title = props.title,
20
+ index = props.index;
21
21
  return /*#__PURE__*/jsxs(Fragment, {
22
22
  children: [index !== 0 && /*#__PURE__*/jsx("div", {
23
23
  children: /*#__PURE__*/jsx(Divider, {
@@ -2,7 +2,7 @@ import { Menu as Menu$1 } from './Menu.js';
2
2
  import { MenuItem } from './MenuItem.js';
3
3
  import { MenuSection } from './MenuSection.js';
4
4
 
5
- const Menu = Menu$1;
5
+ var Menu = Menu$1;
6
6
  Menu.Item = MenuItem;
7
7
  Menu.Section = MenuSection;
8
8
  Menu.Item.displayName = 'Menu.Item';
@@ -1,3 +1,6 @@
1
+ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
1
4
  import { forwardRef, useState, useLayoutEffect } from 'react';
2
5
  import styled from 'styled-components';
3
6
  import { useIsMounted } from '@equinor/eds-utils';
@@ -10,65 +13,69 @@ import { PaginationControl } from './paginationControl.js';
10
13
  import { jsx, jsxs } from 'react/jsx-runtime';
11
14
  import { Typography } from '../Typography/Typography.js';
12
15
 
13
- const icons = {
14
- chevron_left,
15
- chevron_right,
16
- more_horizontal
16
+ var _excluded = ["totalItems", "defaultPage", "withItemIndicator", "itemsPerPage", "onChange"];
17
+ var icons = {
18
+ chevron_left: chevron_left,
19
+ chevron_right: chevron_right,
20
+ more_horizontal: more_horizontal
17
21
  };
18
22
  Icon.add(icons);
19
- const Navigation = styled.nav.withConfig({
23
+ var Navigation = styled.nav.withConfig({
20
24
  displayName: "Pagination__Navigation",
21
25
  componentId: "sc-13cpp3o-0"
22
- })(["display:flex;justify-content:space-between;align-items:center;flex-wrap:nowrap;margin-left:", ";"], _ref => {
23
- let {
24
- withItemIndicator
25
- } = _ref;
26
+ })(["display:flex;justify-content:space-between;align-items:center;flex-wrap:nowrap;margin-left:", ";"], function (_ref) {
27
+ var withItemIndicator = _ref.withItemIndicator;
26
28
  return withItemIndicator ? pagination.spacings.left : 0;
27
29
  });
28
- const OrderedList = styled.ol.withConfig({
30
+ var OrderedList = styled.ol.withConfig({
29
31
  displayName: "Pagination__OrderedList",
30
32
  componentId: "sc-13cpp3o-1"
31
33
  })(["list-style:none;margin:0;padding:0;display:grid;grid-gap:", ";grid-auto-flow:column;"], pagination.spacings.left);
32
- const ListItem = styled.li.withConfig({
34
+ var ListItem = styled.li.withConfig({
33
35
  displayName: "Pagination__ListItem",
34
36
  componentId: "sc-13cpp3o-2"
35
37
  })(["display:inline-grid;"]);
36
- const StyledIcon = styled(Icon).withConfig({
38
+ var StyledIcon = styled(Icon).withConfig({
37
39
  displayName: "Pagination__StyledIcon",
38
40
  componentId: "sc-13cpp3o-3"
39
41
  })(["align-self:center;justify-self:center;fill:", ";"], pagination.entities.icon.typography.color);
40
- const FlexContainer = styled.div.withConfig({
42
+ var FlexContainer = styled.div.withConfig({
41
43
  displayName: "Pagination__FlexContainer",
42
44
  componentId: "sc-13cpp3o-4"
43
45
  })(["display:flex;justify-content:space-between;flex-wrap:nowrap;align-items:center;"]);
44
- const Text = styled(Typography).withConfig({
46
+ var Text = styled(Typography).withConfig({
45
47
  displayName: "Pagination__Text",
46
48
  componentId: "sc-13cpp3o-5"
47
49
  })(["white-space:nowrap;"]);
48
50
 
49
51
  function getAriaLabel(page, selected) {
50
- return `${selected === page ? 'Current page, ' : 'Go to '}page ${page}`;
52
+ return "".concat(selected === page ? 'Current page, ' : 'Go to ', "page ").concat(page);
51
53
  }
52
54
 
53
- const Pagination = /*#__PURE__*/forwardRef(function Pagination(_ref2, ref) {
54
- let {
55
- totalItems,
56
- defaultPage = 1,
57
- withItemIndicator,
58
- itemsPerPage = 10,
59
- onChange,
60
- ...rest
61
- } = _ref2;
62
- const pages = Math.ceil(totalItems / itemsPerPage); // Total page numbers
55
+ var Pagination = /*#__PURE__*/forwardRef(function Pagination(_ref2, ref) {
56
+ var totalItems = _ref2.totalItems,
57
+ _ref2$defaultPage = _ref2.defaultPage,
58
+ defaultPage = _ref2$defaultPage === void 0 ? 1 : _ref2$defaultPage,
59
+ withItemIndicator = _ref2.withItemIndicator,
60
+ _ref2$itemsPerPage = _ref2.itemsPerPage,
61
+ itemsPerPage = _ref2$itemsPerPage === void 0 ? 10 : _ref2$itemsPerPage,
62
+ onChange = _ref2.onChange,
63
+ rest = _objectWithoutProperties(_ref2, _excluded);
63
64
 
64
- const columns = pages < 5 ? pages + 2 : 7; // Total pages to display on the control + 2: < and >
65
+ var pages = Math.ceil(totalItems / itemsPerPage); // Total page numbers
65
66
 
66
- const [activePage, setActivePage] = useState(defaultPage);
67
- const currentItemFirst = activePage === 1 ? 1 : activePage * itemsPerPage - itemsPerPage + 1; // First number of range of items at current page
67
+ var columns = pages < 5 ? pages + 2 : 7; // Total pages to display on the control + 2: < and >
68
68
 
69
- const currentItemLast = activePage === pages ? totalItems : activePage * itemsPerPage; // Last number of range of items at current page
69
+ var _useState = useState(defaultPage),
70
+ _useState2 = _slicedToArray(_useState, 2),
71
+ activePage = _useState2[0],
72
+ setActivePage = _useState2[1];
70
73
 
71
- const onPageChange = (event, page) => {
74
+ var currentItemFirst = activePage === 1 ? 1 : activePage * itemsPerPage - itemsPerPage + 1; // First number of range of items at current page
75
+
76
+ var currentItemLast = activePage === pages ? totalItems : activePage * itemsPerPage; // Last number of range of items at current page
77
+
78
+ var onPageChange = function onPageChange(event, page) {
72
79
  page && setActivePage(page);
73
80
 
74
81
  if (event && onChange) {
@@ -79,32 +86,32 @@ const Pagination = /*#__PURE__*/forwardRef(function Pagination(_ref2, ref) {
79
86
  }
80
87
  };
81
88
 
82
- const isMounted = useIsMounted();
83
- const items = PaginationControl(pages, activePage);
84
- useLayoutEffect(() => {
89
+ var isMounted = useIsMounted();
90
+ var items = PaginationControl(pages, activePage);
91
+ useLayoutEffect(function () {
85
92
  if (isMounted) {
86
93
  setActivePage(1);
87
94
  onChange === null || onChange === void 0 ? void 0 : onChange(null, 1);
88
95
  } // eslint-disable-next-line react-hooks/exhaustive-deps
89
96
 
90
97
  }, [itemsPerPage]);
91
- const props = {
92
- ref,
93
- withItemIndicator,
94
- ...rest
95
- };
96
98
 
97
- const pagination = /*#__PURE__*/jsx(Navigation, {
98
- "aria-label": "pagination",
99
- ...props,
99
+ var props = _objectSpread({
100
+ ref: ref,
101
+ withItemIndicator: withItemIndicator
102
+ }, rest);
103
+
104
+ var pagination = /*#__PURE__*/jsx(Navigation, _objectSpread(_objectSpread({
105
+ "aria-label": "pagination"
106
+ }, props), {}, {
100
107
  children: /*#__PURE__*/jsxs(OrderedList, {
101
108
  style: {
102
- gridTemplateColumns: `repeat(${columns}, 48px)`
109
+ gridTemplateColumns: "repeat(".concat(columns, ", 48px)")
103
110
  },
104
111
  children: [/*#__PURE__*/jsx(ListItem, {
105
112
  children: /*#__PURE__*/jsx(Button, {
106
113
  variant: "ghost_icon",
107
- onClick: activePage > 1 ? event => {
114
+ onClick: activePage > 1 ? function (event) {
108
115
  onPageChange(event, activePage - 1);
109
116
  } : undefined,
110
117
  disabled: activePage === 1,
@@ -113,29 +120,31 @@ const Pagination = /*#__PURE__*/forwardRef(function Pagination(_ref2, ref) {
113
120
  name: "chevron_left"
114
121
  })
115
122
  })
116
- }, "previous"), items.length > 0 ? items.map((page, index) => page !== 'ELLIPSIS' ?
117
- /*#__PURE__*/
118
- // eslint-disable-next-line react/no-array-index-key
119
- jsx(ListItem, {
120
- children: /*#__PURE__*/jsx(PaginationItem, {
121
- "aria-label": getAriaLabel(page, activePage),
122
- "aria-current": activePage,
123
- page: page,
124
- selected: page === activePage,
125
- onClick: event => {
126
- onPageChange(event, page);
127
- }
128
- })
129
- }, `list-item ${index}`) : /*#__PURE__*/jsx(ListItem // eslint-disable-next-line react/no-array-index-key
130
- , {
131
- children: /*#__PURE__*/jsx(StyledIcon, {
132
- name: "more_horizontal",
133
- "aria-label": "Ellipsis of pages"
134
- })
135
- }, `ellipsis-${index}`)) : undefined, /*#__PURE__*/jsx(ListItem, {
123
+ }, "previous"), items.length > 0 ? items.map(function (page, index) {
124
+ return page !== 'ELLIPSIS' ?
125
+ /*#__PURE__*/
126
+ // eslint-disable-next-line react/no-array-index-key
127
+ jsx(ListItem, {
128
+ children: /*#__PURE__*/jsx(PaginationItem, {
129
+ "aria-label": getAriaLabel(page, activePage),
130
+ "aria-current": activePage,
131
+ page: page,
132
+ selected: page === activePage,
133
+ onClick: function onClick(event) {
134
+ onPageChange(event, page);
135
+ }
136
+ })
137
+ }, "list-item ".concat(index)) : /*#__PURE__*/jsx(ListItem // eslint-disable-next-line react/no-array-index-key
138
+ , {
139
+ children: /*#__PURE__*/jsx(StyledIcon, {
140
+ name: "more_horizontal",
141
+ "aria-label": "Ellipsis of pages"
142
+ })
143
+ }, "ellipsis-".concat(index));
144
+ }) : undefined, /*#__PURE__*/jsx(ListItem, {
136
145
  children: /*#__PURE__*/jsx(Button, {
137
146
  variant: "ghost_icon",
138
- onClick: activePage < pages ? event => {
147
+ onClick: activePage < pages ? function (event) {
139
148
  onPageChange(event, activePage + 1);
140
149
  } : undefined,
141
150
  "aria-label": "Go to next page",
@@ -146,16 +155,11 @@ const Pagination = /*#__PURE__*/forwardRef(function Pagination(_ref2, ref) {
146
155
  })
147
156
  }, "next")]
148
157
  })
149
- });
158
+ }));
150
159
 
151
160
  return withItemIndicator ? /*#__PURE__*/jsxs(FlexContainer, {
152
161
  children: [/*#__PURE__*/jsx(Text, {
153
- children: currentItemFirst !== currentItemLast ? `${currentItemFirst}
154
- ${' - '}
155
- ${currentItemLast}
156
- ${' of '}
157
- ${totalItems}
158
- ${' items'}` : `${currentItemFirst} ${' of '} ${totalItems} ${' items'}`
162
+ children: currentItemFirst !== currentItemLast ? "".concat(currentItemFirst, "\n ", ' - ', "\n ").concat(currentItemLast, "\n ", ' of ', "\n ").concat(totalItems, "\n ", ' items') : "".concat(currentItemFirst, " ", ' of ', " ").concat(totalItems, " ", ' items')
159
163
  }), pagination]
160
164
  }) : pagination;
161
165
  });