@equinor/eds-core-react 0.16.1-dev.12072021 → 0.18.0-dev.20220210

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 (198) hide show
  1. package/README.md +1 -1
  2. package/dist/{core-react.cjs.js → eds-core-react.cjs.js} +2731 -2290
  3. package/dist/esm/components/Accordion/Accordion.js +24 -11
  4. package/dist/esm/components/Accordion/Accordion.tokens.js +3 -0
  5. package/dist/esm/components/Accordion/AccordionHeader.js +65 -51
  6. package/dist/esm/components/Accordion/AccordionHeaderTitle.js +15 -13
  7. package/dist/esm/components/Accordion/AccordionItem.js +11 -10
  8. package/dist/esm/components/Accordion/AccordionPanel.js +32 -24
  9. package/dist/esm/components/Avatar/Avatar.js +21 -14
  10. package/dist/esm/components/Banner/Banner.js +36 -24
  11. package/dist/esm/components/Banner/Banner.tokens.js +9 -0
  12. package/dist/esm/components/Banner/BannerActions.js +16 -17
  13. package/dist/esm/components/Banner/BannerIcon.js +15 -11
  14. package/dist/esm/components/Banner/BannerMessage.js +5 -4
  15. package/dist/esm/components/Breadcrumbs/Breadcrumb.js +16 -12
  16. package/dist/esm/components/Breadcrumbs/Breadcrumbs.js +7 -6
  17. package/dist/esm/components/Button/Button.js +17 -18
  18. package/dist/esm/components/Button/InnerFullWidth.js +5 -4
  19. package/dist/esm/components/Button/tokens/button.js +17 -10
  20. package/dist/esm/components/Button/tokens/contained.js +5 -5
  21. package/dist/esm/components/Button/tokens/ghost.js +4 -4
  22. package/dist/esm/components/Button/tokens/icon.js +4 -4
  23. package/dist/esm/components/Button/tokens/outlined.js +5 -5
  24. package/dist/esm/components/Card/Card.js +19 -12
  25. package/dist/esm/components/Card/CardActions.js +13 -9
  26. package/dist/esm/components/Card/CardContent.js +5 -4
  27. package/dist/esm/components/Card/CardHeader.js +5 -4
  28. package/dist/esm/components/Card/CardHeaderTitle.js +5 -4
  29. package/dist/esm/components/Card/CardMedia.js +12 -8
  30. package/dist/esm/components/Checkbox/Checkbox.js +15 -11
  31. package/dist/esm/components/Checkbox/Input.js +72 -46
  32. package/dist/esm/components/Chip/Chip.js +46 -30
  33. package/dist/esm/components/Chip/Icon.js +12 -7
  34. package/dist/esm/components/Dialog/Dialog.js +55 -16
  35. package/dist/esm/components/Dialog/Dialog.tokens.js +7 -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 +5 -4
  50. package/dist/esm/components/Menu/Menu.js +39 -30
  51. package/dist/esm/components/Menu/MenuItem.js +38 -25
  52. package/dist/esm/components/Menu/MenuList.js +7 -6
  53. package/dist/esm/components/Menu/MenuSection.js +3 -3
  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 +77 -58
  58. package/dist/esm/components/Popover/Popover.tokens.js +5 -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 +15 -19
  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/Scrim/Scrim.js +20 -15
  70. package/dist/esm/components/Search/Search.js +81 -58
  71. package/dist/esm/components/Search/Search.tokens.js +8 -4
  72. package/dist/esm/components/Select/MultiSelect/MultiSelect.js +35 -24
  73. package/dist/esm/components/Select/NativeSelect/NativeSelect.js +19 -17
  74. package/dist/esm/components/Select/Select.tokens.js +5 -2
  75. package/dist/esm/components/Select/SingleSelect/SingleSelect.js +29 -23
  76. package/dist/esm/components/Select/commonStyles.js +15 -14
  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 +63 -35
  81. package/dist/esm/components/Slider/SliderInput.js +14 -14
  82. package/dist/esm/components/Snackbar/Snackbar.js +36 -25
  83. package/dist/esm/components/Snackbar/Snackbar.tokens.js +3 -0
  84. package/dist/esm/components/Snackbar/SnackbarAction.js +12 -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/SwitchDefault.js +39 -29
  88. package/dist/esm/components/Switch/SwitchSmall.js +38 -28
  89. package/dist/esm/components/Table/Body.js +5 -4
  90. package/dist/esm/components/Table/Caption.js +8 -5
  91. package/dist/esm/components/Table/Cell.js +9 -6
  92. package/dist/esm/components/Table/DataCell/DataCell.js +15 -14
  93. package/dist/esm/components/Table/DataCell/DataCell.tokens.js +19 -9
  94. package/dist/esm/components/Table/Head/Head.js +7 -6
  95. package/dist/esm/components/Table/HeaderCell/HeaderCell.js +8 -9
  96. package/dist/esm/components/Table/HeaderCell/HeaderCell.tokens.js +18 -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 +13 -10
  100. package/dist/esm/components/TableOfContents/TableOfContents.js +44 -24
  101. package/dist/esm/components/TableOfContents/TableOfContents.tokens.js +3 -0
  102. package/dist/esm/components/Tabs/Tab.js +27 -30
  103. package/dist/esm/components/Tabs/TabList.js +12 -8
  104. package/dist/esm/components/Tabs/TabPanel.js +16 -12
  105. package/dist/esm/components/Tabs/TabPanels.js +5 -4
  106. package/dist/esm/components/Tabs/Tabs.js +37 -24
  107. package/dist/esm/components/Tabs/Tabs.tokens.js +3 -0
  108. package/dist/esm/components/TextField/Field.js +51 -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 +22 -18
  113. package/dist/esm/components/Textarea/Textarea.js +16 -16
  114. package/dist/esm/components/Tooltip/Tooltip.js +10 -16
  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 +27 -19
  119. package/dist/esm/components/TopBar/TopBar.tokens.js +5 -2
  120. package/dist/esm/components/Typography/Typography.js +49 -28
  121. package/dist/esm/index.js +1 -0
  122. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_curry1.js +1 -1
  123. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_curry2.js +1 -1
  124. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_curry3.js +1 -1
  125. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_has.js +1 -1
  126. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_isObject.js +1 -1
  127. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_isPlaceholder.js +1 -1
  128. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/mergeDeepRight.js +2 -1
  129. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/mergeDeepWithKey.js +1 -1
  130. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/mergeWithKey.js +1 -1
  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/Group/Group.d.ts +3 -0
  140. package/dist/types/components/Group/Group.tokens.d.ts +4 -0
  141. package/dist/types/components/Group/index.d.ts +1 -0
  142. package/dist/types/components/Icon/Icon.d.ts +2 -2
  143. package/dist/types/components/Menu/Menu.d.ts +1 -1
  144. package/dist/types/components/Menu/MenuSection.d.ts +1 -2
  145. package/dist/types/components/Popover/Popover.d.ts +1 -1
  146. package/dist/types/components/Popover/PopoverActions.d.ts +3 -0
  147. package/dist/types/components/Popover/PopoverHeader.d.ts +3 -0
  148. package/dist/types/components/Popover/index.d.ts +5 -1
  149. package/dist/types/components/Progress/Circular/CircularProgress.d.ts +1 -1
  150. package/dist/types/components/Progress/Dots/DotProgress.d.ts +1 -1
  151. package/dist/types/components/Progress/Star/StarProgress.d.ts +1 -1
  152. package/dist/types/components/Scrim/Scrim.d.ts +7 -3
  153. package/dist/types/components/Switch/Switch.d.ts +1 -1
  154. package/dist/types/components/Switch/Switch.styles.d.ts +2 -1
  155. package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
  156. package/dist/types/components/TopBar/TopBar.tokens.d.ts +1 -1
  157. package/dist/types/index.d.ts +1 -0
  158. package/package.json +47 -39
  159. package/dist/esm/components/Dialog/Actions.js +0 -24
  160. package/dist/esm/components/Dialog/CustomContent.js +0 -40
  161. package/dist/esm/components/Dialog/Title.js +0 -35
  162. package/dist/esm/hooks/useAutoResize.js +0 -39
  163. package/dist/esm/hooks/useCombinedRefs.js +0 -14
  164. package/dist/esm/hooks/useGlobalKeyPress.js +0 -34
  165. package/dist/esm/hooks/useHideBodyScroll.js +0 -12
  166. package/dist/esm/hooks/useId.js +0 -14
  167. package/dist/esm/hooks/useMountedRef.js +0 -12
  168. package/dist/esm/hooks/useOutsideClick.js +0 -18
  169. package/dist/esm/hooks/usePopper.js +0 -31
  170. package/dist/esm/hooks/useToken.js +0 -16
  171. package/dist/esm/utils/joinHandlers.js +0 -10
  172. package/dist/esm/utils/setReactInputValue.js +0 -18
  173. package/dist/esm/utils/templates/borders.js +0 -35
  174. package/dist/esm/utils/templates/common.js +0 -19
  175. package/dist/esm/utils/templates/focus.js +0 -35
  176. package/dist/esm/utils/templates/index.js +0 -52
  177. package/dist/types/components/Combobox/Combobox.d.ts +0 -55
  178. package/dist/types/components/Combobox/Combobox.tokens.d.ts +0 -3
  179. package/dist/types/components/Combobox/index.d.ts +0 -1
  180. package/dist/types/components/Dialog/Actions.d.ts +0 -3
  181. package/dist/types/components/Dialog/Title.d.ts +0 -3
  182. package/dist/types/hooks/index.d.ts +0 -9
  183. package/dist/types/hooks/useAutoResize.d.ts +0 -1
  184. package/dist/types/hooks/useCombinedRefs.d.ts +0 -3
  185. package/dist/types/hooks/useGlobalKeyPress.d.ts +0 -10
  186. package/dist/types/hooks/useHideBodyScroll.d.ts +0 -1
  187. package/dist/types/hooks/useId.d.ts +0 -1
  188. package/dist/types/hooks/useMountedRef.d.ts +0 -1
  189. package/dist/types/hooks/useOutsideClick.d.ts +0 -1
  190. package/dist/types/hooks/usePopper.d.ts +0 -12
  191. package/dist/types/hooks/useToken.d.ts +0 -7
  192. package/dist/types/utils/index.d.ts +0 -4
  193. package/dist/types/utils/joinHandlers.d.ts +0 -3
  194. package/dist/types/utils/setReactInputValue.d.ts +0 -7
  195. package/dist/types/utils/templates/borders.d.ts +0 -2
  196. package/dist/types/utils/templates/common.d.ts +0 -9
  197. package/dist/types/utils/templates/focus.d.ts +0 -2
  198. package/dist/types/utils/templates/index.d.ts +0 -7
@@ -1,39 +1,36 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
- import { token } from './Tabs.tokens.js';
3
+ import { spacingsTemplate, outlineTemplate, bordersTemplate } from '@equinor/eds-utils';
4
4
  import { jsx } from 'react/jsx-runtime';
5
- import { spacingsTemplate } from '../../utils/templates/index.js';
6
- import { outlineTemplate } from '../../utils/templates/focus.js';
7
- import { bordersTemplate } from '../../utils/templates/borders.js';
8
5
 
9
- const {
10
- entities: {
11
- tab
12
- }
13
- } = token;
14
- const StyledTab = styled.button.attrs(({
15
- active = false,
16
- disabled = false
17
- }) => ({
18
- type: 'button',
19
- role: 'tab',
20
- 'aria-selected': active,
21
- 'aria-disabled': disabled,
22
- tabIndex: active ? '0' : '-1'
23
- })).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({
24
19
  displayName: "Tab__StyledTab",
25
20
  componentId: "sc-scjkct-0"
26
- })(["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), ({
27
- active
28
- }) => active ? tab.states.active.typography.color : tab.typography.color, tab.background, outlineTemplate(tab.states.focus.outline), outlineTemplate(tab.states.focus.outline), ({
29
- active
30
- }) => active ? tab.states.active.states.hover.typography.color : tab.typography.color, ({
31
- disabled
32
- }) => disabled ? css(["background:", ";cursor:not-allowed;"], tab.states.disabled.background) : css(["background:", ";cursor:pointer;"], tab.states.hover.background), ({
33
- disabled
34
- }) => disabled ? bordersTemplate(tab.states.disabled.border) : bordersTemplate(tab.border), ({
35
- active
36
- }) => active && bordersTemplate(tab.states.active.border));
21
+ })(_ref2 => {
22
+ let {
23
+ theme,
24
+ active,
25
+ disabled
26
+ } = _ref2;
27
+ const {
28
+ entities: {
29
+ tab
30
+ }
31
+ } = theme;
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;&: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));
33
+ });
37
34
  const Tab = /*#__PURE__*/forwardRef(function Tab(props, ref) {
38
35
  return /*#__PURE__*/jsx(StyledTab, {
39
36
  ref: ref,
@@ -1,8 +1,8 @@
1
1
  import { forwardRef, useContext, useRef, 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,13 +13,17 @@ 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:", ";"], _ref => {
17
+ let {
18
+ variant
19
+ } = _ref;
20
+ return variants[variant];
21
+ });
22
+ const TabList = /*#__PURE__*/forwardRef(function TabsList(_ref2, ref) {
23
+ let {
24
+ children = [],
25
+ ...props
26
+ } = _ref2;
23
27
  const {
24
28
  activeTab,
25
29
  handleChange,
@@ -1,24 +1,28 @@
1
1
  import { forwardRef } from 'react';
2
- import styled from 'styled-components';
3
- import { token } from './Tabs.tokens.js';
2
+ import styled, { css } from 'styled-components';
3
+ import { spacingsTemplate, outlineTemplate } from '@equinor/eds-utils';
4
4
  import { jsx } from 'react/jsx-runtime';
5
- import { spacingsTemplate } from '../../utils/templates/index.js';
6
- import { outlineTemplate } from '../../utils/templates/focus.js';
7
5
 
8
- const {
9
- entities: {
10
- panel
11
- }
12
- } = token;
13
6
  const StyledTabPanel = styled.div.attrs(() => ({
14
7
  tabIndex: 0,
15
8
  role: 'tabpanel'
16
9
  })).withConfig({
17
10
  displayName: "TabPanel__StyledTabPanel",
18
11
  componentId: "sc-e8v1d4-0"
19
- })(["", " &:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}"], spacingsTemplate(panel.spacings), outlineTemplate(panel.states.focus.outline), outlineTemplate(panel.states.focus.outline));
20
- const TabPanel = /*#__PURE__*/forwardRef(function TabPanel({ ...props
21
- }, ref) {
12
+ })(_ref => {
13
+ let {
14
+ theme
15
+ } = _ref;
16
+ const {
17
+ entities: {
18
+ panel
19
+ }
20
+ } = theme;
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
+ });
23
+ const TabPanel = /*#__PURE__*/forwardRef(function TabPanel(_ref2, ref) {
24
+ let { ...props
25
+ } = _ref2;
22
26
  return /*#__PURE__*/jsx(StyledTabPanel, {
23
27
  ref: ref,
24
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
@@ -1,17 +1,21 @@
1
1
  import { forwardRef, useState } from 'react';
2
2
  import { TabsProvider } from './Tabs.context.js';
3
+ import { token } from './Tabs.tokens.js';
4
+ import { useId, useToken } from '@equinor/eds-utils';
5
+ import { ThemeProvider } from 'styled-components';
3
6
  import { jsx } from 'react/jsx-runtime';
4
- import { useId } from '../../hooks/useId.js';
5
-
6
- const Tabs = /*#__PURE__*/forwardRef(function Tabs({
7
- activeTab = 0,
8
- onChange,
9
- onBlur,
10
- onFocus,
11
- variant = 'minWidth',
12
- id,
13
- ...props
14
- }, ref) {
7
+ import { useEds } from '../EdsProvider/eds.context.js';
8
+
9
+ const Tabs = /*#__PURE__*/forwardRef(function Tabs(_ref, ref) {
10
+ let {
11
+ activeTab = 0,
12
+ onChange,
13
+ onBlur,
14
+ onFocus,
15
+ variant = 'minWidth',
16
+ id,
17
+ ...props
18
+ } = _ref;
15
19
  const tabsId = useId(id, 'tabs');
16
20
  const [tabsFocused, setTabsFocused] = useState(false);
17
21
  let blurTimer;
@@ -39,19 +43,28 @@ const Tabs = /*#__PURE__*/forwardRef(function Tabs({
39
43
  onFocus && onFocus(e);
40
44
  };
41
45
 
42
- return /*#__PURE__*/jsx(TabsProvider, {
43
- value: {
44
- activeTab,
45
- handleChange: onChange,
46
- tabsId,
47
- variant,
48
- tabsFocused
49
- },
50
- children: /*#__PURE__*/jsx("div", {
51
- ref: ref,
52
- ...props,
53
- onBlur: handleBlur,
54
- onFocus: handleFocus
46
+ const {
47
+ density
48
+ } = useEds();
49
+ const token$1 = useToken({
50
+ density
51
+ }, token);
52
+ return /*#__PURE__*/jsx(ThemeProvider, {
53
+ theme: token$1,
54
+ children: /*#__PURE__*/jsx(TabsProvider, {
55
+ value: {
56
+ activeTab,
57
+ handleChange: onChange,
58
+ tabsId,
59
+ variant,
60
+ tabsFocused
61
+ },
62
+ children: /*#__PURE__*/jsx("div", {
63
+ ref: ref,
64
+ ...props,
65
+ onBlur: handleBlur,
66
+ onFocus: handleFocus
67
+ })
55
68
  })
56
69
  });
57
70
  });
@@ -121,6 +121,9 @@ const token = {
121
121
  }
122
122
  }
123
123
  }
124
+ },
125
+ modes: {
126
+ compact: {}
124
127
  }
125
128
  };
126
129
 
@@ -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,
@@ -89,6 +100,7 @@ const Field = /*#__PURE__*/forwardRef(function Field({
89
100
  const iconSize = density === 'compact' ? 16 : 24;
90
101
  const actualVariant = variant === 'default' ? 'textfield' : variant;
91
102
  const inputVariant = TextField_tokens[actualVariant];
103
+ const isError = actualVariant === 'error';
92
104
 
93
105
  const focusHandler = e => {
94
106
  handleFocus();
@@ -112,6 +124,7 @@ const Field = /*#__PURE__*/forwardRef(function Field({
112
124
  };
113
125
  const inputProps = {
114
126
  ref: ref,
127
+ 'aria-invalid': isError,
115
128
  type,
116
129
  disabled,
117
130
  readOnly,
@@ -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 {
@@ -7,12 +7,13 @@ import { jsx } from 'react/jsx-runtime';
7
7
  const StyledIcon = styled.div.withConfig({
8
8
  displayName: "Icon__StyledIcon",
9
9
  componentId: "sc-jr0rqa-0"
10
- })(({
11
- colors,
12
- isDisabled,
13
- isFocused,
14
- size
15
- }) => {
10
+ })(_ref => {
11
+ let {
12
+ colors,
13
+ isDisabled,
14
+ isFocused,
15
+ size
16
+ } = _ref;
16
17
  const {
17
18
  focusColor,
18
19
  color,
@@ -30,18 +31,19 @@ const StyledIcon = styled.div.withConfig({
30
31
 
31
32
  return css(["&,svg{fill:", ";width:", "px;height:", "px;}"], fill, size, size);
32
33
  });
33
- const InputIcon = /*#__PURE__*/forwardRef(function InputIcon({
34
- size = 24,
35
- variant = 'default',
36
- isDisabled = false,
37
- colors = {
38
- color: input[variant].color,
39
- disabledColor: input[variant].disabledColor,
40
- focusColor: input[variant].focusColor
41
- },
42
- children,
43
- ...other
44
- }, ref) {
34
+ const InputIcon = /*#__PURE__*/forwardRef(function InputIcon(_ref2, ref) {
35
+ let {
36
+ size = 24,
37
+ variant = 'default',
38
+ isDisabled = false,
39
+ colors = {
40
+ color: input[variant].color,
41
+ disabledColor: input[variant].disabledColor,
42
+ focusColor: input[variant].focusColor
43
+ },
44
+ children,
45
+ ...other
46
+ } = _ref2;
45
47
  const {
46
48
  isFocused
47
49
  } = useTextField();
@@ -5,9 +5,10 @@ const initalState = {
5
5
  isFocused: false
6
6
  };
7
7
  const TextFieldContext = /*#__PURE__*/createContext(initalState);
8
- const TextFieldProvider = ({
9
- children
10
- }) => {
8
+ const TextFieldProvider = _ref => {
9
+ let {
10
+ children
11
+ } = _ref;
11
12
  const [state, setState] = useState(initalState);
12
13
 
13
14
  const handleFocus = () => {
@@ -3,34 +3,37 @@ import styled, { ThemeProvider } from 'styled-components';
3
3
  import { Field } from './Field.js';
4
4
  import { TextFieldProvider } from './TextField.context.js';
5
5
  import { textfield } from './TextField.tokens.js';
6
+ import { useId, useToken } from '@equinor/eds-utils';
6
7
  import { jsx, jsxs } from 'react/jsx-runtime';
7
8
  import { Label } from '../Label/Label.js';
8
9
  import { HelperText as TextfieldHelperText } from './HelperText/HelperText.js';
9
10
  import { useEds } from '../EdsProvider/eds.context.js';
10
- import { useToken } from '../../hooks/useToken.js';
11
11
 
12
12
  const Container = styled.div.withConfig({
13
13
  displayName: "TextField__Container",
14
14
  componentId: "sc-o1nc07-0"
15
15
  })(["min-width:100px;width:100%;"]);
16
- const TextField = /*#__PURE__*/forwardRef(function TextField({
17
- id,
18
- label,
19
- meta,
20
- unit,
21
- helperText,
22
- placeholder,
23
- disabled,
24
- multiline,
25
- className,
26
- variant = 'default',
27
- inputRef,
28
- inputIcon,
29
- helperIcon,
30
- rowsMax,
31
- ...other
32
- }, ref) {
16
+ const TextField = /*#__PURE__*/forwardRef(function TextField(_ref, ref) {
17
+ let {
18
+ id,
19
+ label,
20
+ meta,
21
+ unit,
22
+ helperText,
23
+ placeholder,
24
+ disabled,
25
+ multiline,
26
+ className,
27
+ variant = 'default',
28
+ inputRef,
29
+ inputIcon,
30
+ helperIcon,
31
+ rowsMax,
32
+ ...other
33
+ } = _ref;
34
+ const helperTextId = useId(null, 'helpertext');
33
35
  const inputProps = {
36
+ 'aria-describedby': helperTextId,
34
37
  multiline,
35
38
  disabled,
36
39
  placeholder,
@@ -43,6 +46,7 @@ const TextField = /*#__PURE__*/forwardRef(function TextField({
43
46
  ...other
44
47
  };
45
48
  const helperProps = {
49
+ id: helperTextId,
46
50
  variant,
47
51
  helperText,
48
52
  icon: helperIcon,
@@ -2,22 +2,21 @@ import { forwardRef, useState } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
  import * as Input_tokens from '../Input/Input.tokens.js';
4
4
  import { input as input$1 } from '../Input/Input.tokens.js';
5
+ import { typographyTemplate, useAutoResize, useCombinedRefs, spacingsTemplate, outlineTemplate } from '@equinor/eds-utils';
5
6
  import { jsx } from 'react/jsx-runtime';
6
- import { useAutoResize } from '../../hooks/useAutoResize.js';
7
- import { useCombinedRefs } from '../../hooks/useCombinedRefs.js';
8
- import { typographyTemplate, spacingsTemplate } from '../../utils/templates/index.js';
9
7
  import { useEds } from '../EdsProvider/eds.context.js';
10
- import { outlineTemplate } from '../../utils/templates/focus.js';
11
8
 
12
9
  const {
13
10
  input
14
11
  } = Input_tokens;
15
12
 
16
- const Variation = ({
17
- variant,
18
- token,
19
- density
20
- }) => {
13
+ const Variation = _ref => {
14
+ let {
15
+ variant,
16
+ token,
17
+ density
18
+ } = _ref;
19
+
21
20
  if (!variant) {
22
21
  return "";
23
22
  }
@@ -46,13 +45,14 @@ const StyledTextarea = styled.textarea.withConfig({
46
45
  displayName: "Textarea__StyledTextarea",
47
46
  componentId: "sc-2yjdcc-0"
48
47
  })(["width:100%;box-sizing:border-box;margin:0;border:none;appearance:none;background:", ";height:auto;", " ", " &::placeholder{color:", ";}&:disabled{color:", ";}&[readOnly]{box-shadow:", ";background:", ";}"], input.background, typographyTemplate(input.typography), Variation, input.entities.placeholder.typography.color, input.states.disabled.typography.color, input.states.readOnly.boxShadow, input.states.readOnly.background);
49
- const Textarea = /*#__PURE__*/forwardRef(function Textarea({
50
- variant = 'default',
51
- disabled = false,
52
- type = 'text',
53
- rowsMax,
54
- ...other
55
- }, ref) {
48
+ const Textarea = /*#__PURE__*/forwardRef(function Textarea(_ref2, ref) {
49
+ let {
50
+ variant = 'default',
51
+ disabled = false,
52
+ type = 'text',
53
+ rowsMax,
54
+ ...other
55
+ } = _ref2;
56
56
  const actualVariant = variant === 'default' ? 'input' : variant;
57
57
  const inputVariant = Input_tokens[actualVariant];
58
58
  const [textareaEl, setTextareaEl] = useState(null);