@equinor/eds-core-react 0.17.0 → 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 (185) hide show
  1. package/README.md +1 -1
  2. package/dist/{core-react.cjs.js → eds-core-react.cjs.js} +2109 -1899
  3. package/dist/esm/components/Accordion/Accordion.js +9 -9
  4. package/dist/esm/components/Accordion/AccordionHeader.js +45 -38
  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 +17 -18
  16. package/dist/esm/components/Button/InnerFullWidth.js +5 -4
  17. package/dist/esm/components/Button/tokens/button.js +17 -10
  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 +4 -4
  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/Input.js +72 -46
  30. package/dist/esm/components/Chip/Chip.js +46 -30
  31. package/dist/esm/components/Chip/Icon.js +12 -7
  32. package/dist/esm/components/Dialog/Dialog.js +44 -20
  33. package/dist/esm/components/Dialog/Dialog.tokens.js +4 -12
  34. package/dist/esm/components/Dialog/DialogActions.js +27 -0
  35. package/dist/esm/components/Dialog/DialogContent.js +44 -0
  36. package/dist/esm/components/Dialog/DialogHeader.js +37 -0
  37. package/dist/esm/components/Dialog/DialogTitle.js +31 -0
  38. package/dist/esm/components/Dialog/index.js +11 -7
  39. package/dist/esm/components/Divider/Divider.js +6 -5
  40. package/dist/esm/components/EdsProvider/eds.context.js +5 -4
  41. package/dist/esm/components/Icon/Icon.js +77 -46
  42. package/dist/esm/components/Input/Input.js +12 -12
  43. package/dist/esm/components/Input/Input.tokens.js +4 -4
  44. package/dist/esm/components/Label/Label.js +7 -4
  45. package/dist/esm/components/List/List.js +13 -9
  46. package/dist/esm/components/List/ListItem.js +5 -4
  47. package/dist/esm/components/Menu/Menu.context.js +5 -4
  48. package/dist/esm/components/Menu/Menu.js +32 -28
  49. package/dist/esm/components/Menu/MenuItem.js +38 -25
  50. package/dist/esm/components/Menu/MenuList.js +7 -6
  51. package/dist/esm/components/Menu/MenuSection.js +1 -1
  52. package/dist/esm/components/Pagination/Pagination.js +16 -12
  53. package/dist/esm/components/Pagination/PaginationItem.js +7 -6
  54. package/dist/esm/components/Paper/Paper.js +11 -7
  55. package/dist/esm/components/Popover/Popover.js +37 -49
  56. package/dist/esm/components/Popover/Popover.tokens.js +2 -12
  57. package/dist/esm/components/Popover/PopoverActions.js +28 -0
  58. package/dist/esm/components/Popover/PopoverContent.js +12 -6
  59. package/dist/esm/components/Popover/PopoverHeader.js +36 -0
  60. package/dist/esm/components/Popover/PopoverTitle.js +13 -24
  61. package/dist/esm/components/Popover/index.js +6 -0
  62. package/dist/esm/components/Progress/Circular/CircularProgress.js +14 -10
  63. package/dist/esm/components/Progress/Dots/DotProgress.js +12 -8
  64. package/dist/esm/components/Progress/Linear/LinearProgress.js +6 -5
  65. package/dist/esm/components/Progress/Star/StarProgress.js +14 -10
  66. package/dist/esm/components/Radio/Radio.js +84 -52
  67. package/dist/esm/components/Scrim/Scrim.js +9 -9
  68. package/dist/esm/components/Search/Search.js +28 -28
  69. package/dist/esm/components/Select/MultiSelect/MultiSelect.js +27 -22
  70. package/dist/esm/components/Select/NativeSelect/NativeSelect.js +19 -17
  71. package/dist/esm/components/Select/Select.tokens.js +2 -2
  72. package/dist/esm/components/Select/SingleSelect/SingleSelect.js +29 -23
  73. package/dist/esm/components/Select/commonStyles.js +14 -13
  74. package/dist/esm/components/SideSheet/SideSheet.js +16 -13
  75. package/dist/esm/components/Slider/MinMax.js +5 -4
  76. package/dist/esm/components/Slider/Output.js +13 -9
  77. package/dist/esm/components/Slider/Slider.js +63 -35
  78. package/dist/esm/components/Slider/SliderInput.js +14 -14
  79. package/dist/esm/components/Snackbar/Snackbar.js +15 -15
  80. package/dist/esm/components/Snackbar/SnackbarAction.js +9 -7
  81. package/dist/esm/components/Switch/Switch.js +21 -15
  82. package/dist/esm/components/Switch/Switch.styles.js +24 -17
  83. package/dist/esm/components/Switch/SwitchDefault.js +39 -29
  84. package/dist/esm/components/Switch/SwitchSmall.js +38 -28
  85. package/dist/esm/components/Table/Body.js +5 -4
  86. package/dist/esm/components/Table/Caption.js +8 -5
  87. package/dist/esm/components/Table/Cell.js +9 -6
  88. package/dist/esm/components/Table/DataCell/DataCell.js +15 -14
  89. package/dist/esm/components/Table/DataCell/DataCell.tokens.js +19 -9
  90. package/dist/esm/components/Table/Head/Head.js +7 -6
  91. package/dist/esm/components/Table/HeaderCell/HeaderCell.js +7 -8
  92. package/dist/esm/components/Table/HeaderCell/HeaderCell.tokens.js +18 -8
  93. package/dist/esm/components/Table/Row/Row.js +7 -5
  94. package/dist/esm/components/Table/Table.js +5 -4
  95. package/dist/esm/components/TableOfContents/LinkItem.js +10 -10
  96. package/dist/esm/components/TableOfContents/TableOfContents.js +17 -15
  97. package/dist/esm/components/Tabs/Tab.js +20 -18
  98. package/dist/esm/components/Tabs/TabList.js +12 -8
  99. package/dist/esm/components/Tabs/TabPanel.js +8 -7
  100. package/dist/esm/components/Tabs/TabPanels.js +5 -4
  101. package/dist/esm/components/Tabs/Tabs.js +11 -11
  102. package/dist/esm/components/TextField/Field.js +49 -38
  103. package/dist/esm/components/TextField/HelperText/HelperText.js +28 -19
  104. package/dist/esm/components/TextField/Icon/Icon.js +20 -18
  105. package/dist/esm/components/TextField/TextField.context.js +4 -3
  106. package/dist/esm/components/TextField/TextField.js +19 -19
  107. package/dist/esm/components/Textarea/Textarea.js +16 -16
  108. package/dist/esm/components/Tooltip/Tooltip.js +10 -16
  109. package/dist/esm/components/TopBar/Actions.js +5 -4
  110. package/dist/esm/components/TopBar/CustomContent.js +5 -4
  111. package/dist/esm/components/TopBar/Header.js +5 -4
  112. package/dist/esm/components/TopBar/TopBar.js +10 -10
  113. package/dist/esm/components/Typography/Typography.js +49 -28
  114. package/dist/esm/index.js +1 -0
  115. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_curry1.js +1 -1
  116. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_curry2.js +1 -1
  117. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_curry3.js +1 -1
  118. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_has.js +1 -1
  119. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_isObject.js +1 -1
  120. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_isPlaceholder.js +1 -1
  121. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/mergeDeepRight.js +2 -1
  122. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/mergeDeepWithKey.js +1 -1
  123. package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/mergeWithKey.js +1 -1
  124. package/dist/types/components/Checkbox/Checkbox.d.ts +1 -1
  125. package/dist/types/components/Checkbox/Input.d.ts +1 -1
  126. package/dist/types/components/Dialog/Dialog.d.ts +18 -2
  127. package/dist/types/components/Dialog/DialogActions.d.ts +3 -0
  128. package/dist/types/components/Dialog/{CustomContent.d.ts → DialogContent.d.ts} +2 -2
  129. package/dist/types/components/Dialog/DialogHeader.d.ts +3 -0
  130. package/dist/types/components/Dialog/DialogTitle.d.ts +3 -0
  131. package/dist/types/components/Dialog/index.d.ts +10 -7
  132. package/dist/types/components/Icon/Icon.d.ts +2 -2
  133. package/dist/types/components/Menu/Menu.d.ts +1 -1
  134. package/dist/types/components/Popover/Popover.d.ts +1 -1
  135. package/dist/types/components/Popover/PopoverActions.d.ts +3 -0
  136. package/dist/types/components/Popover/PopoverHeader.d.ts +3 -0
  137. package/dist/types/components/Popover/index.d.ts +5 -1
  138. package/dist/types/components/Progress/Circular/CircularProgress.d.ts +1 -1
  139. package/dist/types/components/Progress/Dots/DotProgress.d.ts +1 -1
  140. package/dist/types/components/Progress/Star/StarProgress.d.ts +1 -1
  141. package/dist/types/components/Switch/Switch.d.ts +1 -1
  142. package/dist/types/components/Switch/Switch.styles.d.ts +2 -1
  143. package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
  144. package/dist/types/index.d.ts +1 -0
  145. package/package.json +41 -38
  146. package/dist/esm/components/Dialog/Actions.js +0 -26
  147. package/dist/esm/components/Dialog/CustomContent.js +0 -46
  148. package/dist/esm/components/Dialog/Title.js +0 -41
  149. package/dist/esm/hooks/useAutoResize.js +0 -39
  150. package/dist/esm/hooks/useCombinedRefs.js +0 -14
  151. package/dist/esm/hooks/useGlobalKeyPress.js +0 -34
  152. package/dist/esm/hooks/useHideBodyScroll.js +0 -20
  153. package/dist/esm/hooks/useId.js +0 -14
  154. package/dist/esm/hooks/useMountedRef.js +0 -12
  155. package/dist/esm/hooks/useOutsideClick.js +0 -18
  156. package/dist/esm/hooks/usePopper.js +0 -31
  157. package/dist/esm/hooks/useToken.js +0 -16
  158. package/dist/esm/utils/joinHandlers.js +0 -10
  159. package/dist/esm/utils/setReactInputValue.js +0 -18
  160. package/dist/esm/utils/templates/borders.js +0 -35
  161. package/dist/esm/utils/templates/common.js +0 -19
  162. package/dist/esm/utils/templates/focus.js +0 -35
  163. package/dist/esm/utils/templates/index.js +0 -52
  164. package/dist/types/components/Combobox/Combobox.d.ts +0 -55
  165. package/dist/types/components/Combobox/Combobox.tokens.d.ts +0 -3
  166. package/dist/types/components/Combobox/index.d.ts +0 -1
  167. package/dist/types/components/Dialog/Actions.d.ts +0 -3
  168. package/dist/types/components/Dialog/Title.d.ts +0 -3
  169. package/dist/types/hooks/index.d.ts +0 -9
  170. package/dist/types/hooks/useAutoResize.d.ts +0 -1
  171. package/dist/types/hooks/useCombinedRefs.d.ts +0 -3
  172. package/dist/types/hooks/useGlobalKeyPress.d.ts +0 -10
  173. package/dist/types/hooks/useHideBodyScroll.d.ts +0 -1
  174. package/dist/types/hooks/useId.d.ts +0 -1
  175. package/dist/types/hooks/useMountedRef.d.ts +0 -1
  176. package/dist/types/hooks/useOutsideClick.d.ts +0 -1
  177. package/dist/types/hooks/usePopper.d.ts +0 -12
  178. package/dist/types/hooks/useToken.d.ts +0 -7
  179. package/dist/types/utils/index.d.ts +0 -4
  180. package/dist/types/utils/joinHandlers.d.ts +0 -3
  181. package/dist/types/utils/setReactInputValue.d.ts +0 -7
  182. package/dist/types/utils/templates/borders.d.ts +0 -2
  183. package/dist/types/utils/templates/common.d.ts +0 -9
  184. package/dist/types/utils/templates/focus.d.ts +0 -2
  185. package/dist/types/utils/templates/index.d.ts +0 -7
@@ -3,32 +3,35 @@ import { useCombobox } from 'downshift';
3
3
  import styled, { ThemeProvider } from 'styled-components';
4
4
  import { Icon } from '../../Icon/index.js';
5
5
  import { close, arrow_drop_up, arrow_drop_down } from '@equinor/eds-icons';
6
+ import { spacingsTemplate, useToken } from '@equinor/eds-utils';
6
7
  import { select } from '../Select.tokens.js';
7
8
  import { StyledListItem, Container, StyledInputWrapper, PaddedInput, StyledButton, StyledList } from '../commonStyles.js';
8
9
  import { jsx, jsxs } from 'react/jsx-runtime';
9
- import { spacingsTemplate } from '../../../utils/templates/index.js';
10
10
  import { useEds } from '../../EdsProvider/eds.context.js';
11
- import { useToken } from '../../../hooks/useToken.js';
12
11
  import { Label } from '../../Label/Label.js';
13
12
 
14
13
  const PaddedStyledListItem = styled(StyledListItem).withConfig({
15
14
  displayName: "SingleSelect__PaddedStyledListItem",
16
15
  componentId: "sc-rh1yw2-0"
17
- })(["", ""], ({
18
- theme
19
- }) => spacingsTemplate(theme.spacings));
20
- const SingleSelect = /*#__PURE__*/forwardRef(function SingleSelect({
21
- items = [],
22
- label,
23
- meta,
24
- className,
25
- disabled = false,
26
- readOnly = false,
27
- initialSelectedItem,
28
- selectedOption,
29
- handleSelectedItemChange,
30
- ...other
31
- }, ref) {
16
+ })(["", ""], _ref => {
17
+ let {
18
+ theme
19
+ } = _ref;
20
+ return spacingsTemplate(theme.spacings);
21
+ });
22
+ const SingleSelect = /*#__PURE__*/forwardRef(function SingleSelect(_ref2, ref) {
23
+ let {
24
+ items = [],
25
+ label,
26
+ meta,
27
+ className,
28
+ disabled = false,
29
+ readOnly = false,
30
+ initialSelectedItem,
31
+ selectedOption,
32
+ handleSelectedItemChange,
33
+ ...other
34
+ } = _ref2;
32
35
  const [inputItems, setInputItems] = useState(items);
33
36
  const isControlled = selectedOption !== undefined ? true : false;
34
37
  const {
@@ -43,14 +46,17 @@ const SingleSelect = /*#__PURE__*/forwardRef(function SingleSelect({
43
46
  let comboboxProps = {
44
47
  items: inputItems,
45
48
  onSelectedItemChange: handleSelectedItemChange,
46
- onInputValueChange: ({
47
- inputValue
48
- }) => {
49
+ onInputValueChange: _ref3 => {
50
+ let {
51
+ inputValue
52
+ } = _ref3;
49
53
  setInputItems(items.filter(item => item.toLowerCase().includes(inputValue.toLowerCase())));
50
54
  },
51
- onIsOpenChange: ({
52
- selectedItem
53
- }) => {
55
+ onIsOpenChange: _ref4 => {
56
+ let {
57
+ selectedItem
58
+ } = _ref4;
59
+
54
60
  if (inputItems.length === 1 && selectedItem === inputItems[0]) {
55
61
  setInputItems(items);
56
62
  }
@@ -1,9 +1,8 @@
1
1
  import { List } from '../List/index.js';
2
2
  import styled, { css } from 'styled-components';
3
3
  import { select } from './Select.tokens.js';
4
+ import { bordersTemplate, typographyTemplate } from '@equinor/eds-utils';
4
5
  import { Input } from '../Input/Input.js';
5
- import { bordersTemplate } from '../../utils/templates/borders.js';
6
- import { typographyTemplate } from '../../utils/templates/index.js';
7
6
  import { Button } from '../Button/Button.js';
8
7
 
9
8
  const {
@@ -26,24 +25,26 @@ const StyledList = styled(List).withConfig({
26
25
  const StyledListItem = styled(List.Item).withConfig({
27
26
  displayName: "commonStyles__StyledListItem",
28
27
  componentId: "sc-v98ajk-3"
29
- })(({
30
- theme,
31
- highlighted,
32
- active
33
- }) => {
28
+ })(_ref => {
29
+ let {
30
+ theme,
31
+ highlighted,
32
+ active
33
+ } = _ref;
34
34
  const backgroundColor = highlighted === 'true' ? theme.states.hover.background : active === 'true' ? theme.states.active.background : theme.background;
35
35
  return css(["margin:0;list-style:none;background-color:", ";", ";cursor:", ";"], backgroundColor, typographyTemplate(theme.typography), highlighted === 'true' ? 'pointer' : 'default');
36
36
  });
37
37
  const StyledButton = styled(Button).withConfig({
38
38
  displayName: "commonStyles__StyledButton",
39
39
  componentId: "sc-v98ajk-4"
40
- })(({
41
- theme: {
42
- entities: {
43
- button
40
+ })(_ref2 => {
41
+ let {
42
+ theme: {
43
+ entities: {
44
+ button
45
+ }
44
46
  }
45
- }
46
- }) => {
47
+ } = _ref2;
47
48
  return css(["position:absolute;right:", ";height:", ";width:", ";top:", ";color:", ";"], button.spacings.right, button.height, button.height, button.spacings.top, button.typography.color);
48
49
  });
49
50
  const StyledInputWrapper = styled.div.withConfig({
@@ -1,12 +1,11 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { clear } from '@equinor/eds-icons';
4
+ import { bordersTemplate, spacingsTemplate } from '@equinor/eds-utils';
4
5
  import { Icon } from '../Icon/index.js';
5
6
  import { comfortable, variants } from './SideSheet.tokens.js';
6
7
  import { jsxs, jsx } from 'react/jsx-runtime';
7
8
  import { Button } from '../Button/Button.js';
8
- import { bordersTemplate } from '../../utils/templates/borders.js';
9
- import { spacingsTemplate } from '../../utils/templates/index.js';
10
9
  import { Typography } from '../Typography/Typography.js';
11
10
 
12
11
  const {
@@ -17,21 +16,25 @@ const {
17
16
  const StyledSideSheet = styled.div.withConfig({
18
17
  displayName: "SideSheet__StyledSideSheet",
19
18
  componentId: "sc-wkzlnn-0"
20
- })(["height:100%;position:absolute;z-index:200;top:0;right:0;box-sizing:border-box;background:", ";width:", ";", " ", ";"], background, ({
21
- width
22
- }) => width, bordersTemplate(border), spacingsTemplate(spacings));
19
+ })(["height:100%;position:absolute;z-index:200;top:0;right:0;box-sizing:border-box;background:", ";width:", ";", " ", ";"], background, _ref => {
20
+ let {
21
+ width
22
+ } = _ref;
23
+ return width;
24
+ }, bordersTemplate(border), spacingsTemplate(spacings));
23
25
  const Header = styled.div.withConfig({
24
26
  displayName: "SideSheet__Header",
25
27
  componentId: "sc-wkzlnn-1"
26
28
  })(["display:flex;flex-wrap:nowrap;justify-content:space-between;align-items:center;padding-bottom:24px;padding-right:10px;"]);
27
- const SideSheet = /*#__PURE__*/forwardRef(function SideSheet({
28
- variant = 'medium',
29
- title = '',
30
- children,
31
- open = true,
32
- onClose,
33
- ...rest
34
- }, ref) {
29
+ const SideSheet = /*#__PURE__*/forwardRef(function SideSheet(_ref2, ref) {
30
+ let {
31
+ variant = 'medium',
32
+ title = '',
33
+ children,
34
+ open = true,
35
+ onClose,
36
+ ...rest
37
+ } = _ref2;
35
38
  const props = { ...rest,
36
39
  ref,
37
40
  width: variants[variant]
@@ -1,8 +1,8 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled from 'styled-components';
3
+ import { typographyTemplate } from '@equinor/eds-utils';
3
4
  import { slider } from './Slider.tokens.js';
4
5
  import { jsx } from 'react/jsx-runtime';
5
- import { typographyTemplate } from '../../utils/templates/index.js';
6
6
 
7
7
  const {
8
8
  entities: {
@@ -14,9 +14,10 @@ const StyledMinMax = styled.span.withConfig({
14
14
  displayName: "MinMax__StyledMinMax",
15
15
  componentId: "sc-lxmlid-0"
16
16
  })(["grid-row:2;", " position:absolute;left:2px;top:", ";pointer-events:none;text-align:left;transform:translate(calc(-1 * calc((100% - 8px) / 2)));&:last-child{left:auto;right:2px;transform:translate(calc((100% - 8px) / 2));}"], typographyTemplate(output.typography), track.spacings.top);
17
- const MinMax = /*#__PURE__*/forwardRef(function MinMax({
18
- children
19
- }, ref) {
17
+ const MinMax = /*#__PURE__*/forwardRef(function MinMax(_ref, ref) {
18
+ let {
19
+ children
20
+ } = _ref;
20
21
  return /*#__PURE__*/jsx(StyledMinMax, {
21
22
  ref: ref,
22
23
  children: children
@@ -1,8 +1,8 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled from 'styled-components';
3
+ import { typographyTemplate } from '@equinor/eds-utils';
3
4
  import { slider } from './Slider.tokens.js';
4
5
  import { jsx } from 'react/jsx-runtime';
5
- import { typographyTemplate } from '../../utils/templates/index.js';
6
6
 
7
7
  const {
8
8
  entities: {
@@ -13,14 +13,18 @@ const {
13
13
  const StyledOutput = styled.output.withConfig({
14
14
  displayName: "Output__StyledOutput",
15
15
  componentId: "sc-1dy945x-0"
16
- })(["--val:", ";--realWidth:calc(100% - 12px);width:fit-content;position:relative;z-index:1;", " background:", ";padding:0 5px;top:", ";pointer-events:none;margin-left:calc((var(--val) - var(--min)) / var(--dif) * var(--realWidth));transform:translate(calc(-1 * calc(var(--realWidth) / 2)));grid-row:2;grid-column:1 / -1;"], ({
17
- value
18
- }) => value, typographyTemplate(output.typography), slider.background, track.spacings.top);
19
- const Output = /*#__PURE__*/forwardRef(function Output({
20
- children,
21
- value,
22
- htmlFor
23
- }, ref) {
16
+ })(["--val:", ";--realWidth:calc(100% - 12px);width:fit-content;position:relative;z-index:1;", " background:", ";padding:0 5px;top:", ";pointer-events:none;margin-left:calc((var(--val) - var(--min)) / var(--dif) * var(--realWidth));transform:translate(calc(-1 * calc(var(--realWidth) / 2)));grid-row:2;grid-column:1 / -1;"], _ref => {
17
+ let {
18
+ value
19
+ } = _ref;
20
+ return value;
21
+ }, typographyTemplate(output.typography), slider.background, track.spacings.top);
22
+ const Output = /*#__PURE__*/forwardRef(function Output(_ref2, ref) {
23
+ let {
24
+ children,
25
+ value,
26
+ htmlFor
27
+ } = _ref2;
24
28
  return /*#__PURE__*/jsx(StyledOutput, {
25
29
  ref: ref,
26
30
  value: value,
@@ -4,8 +4,8 @@ import { slider } from './Slider.tokens.js';
4
4
  import { MinMax } from './MinMax.js';
5
5
  import { Output } from './Output.js';
6
6
  import { SliderInput } from './SliderInput.js';
7
+ import { bordersTemplate } from '@equinor/eds-utils';
7
8
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
8
- import { bordersTemplate } from '../../utils/templates/borders.js';
9
9
 
10
10
  const {
11
11
  entities: {
@@ -23,29 +23,56 @@ const wrapperGrid = css(["display:grid;grid-template-rows:max-content 24px;grid-
23
23
  const RangeWrapper = styled.div.withConfig({
24
24
  displayName: "Slider__RangeWrapper",
25
25
  componentId: "sc-n1grrg-0"
26
- })(["--a:", ";--b:", ";--min:", ";--max:", ";--dif:calc(var(--max) - var(--min));--realWidth:calc(100% - 12px);", " ", " &::before,&::after{", " background:", ";}&::before{margin-left:calc( calc(", " / 2) + (var(--a) - var(--min)) / var(--dif) * var(--realWidth) );width:calc((var(--b) - var(--a)) / var(--dif) * var(--realWidth));}&::after{margin-left:calc( calc(", " / 2) + (var(--b) - var(--min)) / var(--dif) * var(--realWidth) );width:calc((var(--a) - var(--b)) / var(--dif) * var(--realWidth));}@media (hover:hover) and (pointer:fine){&:hover:not([disabled]){", " &::before,&::after{background:", ";}}}"], ({
27
- valA
28
- }) => valA, ({
29
- valB
30
- }) => valB, ({
31
- min
32
- }) => min, ({
33
- max
34
- }) => max, wrapperGrid, fakeTrackBg, trackFill, ({
35
- disabled
36
- }) => disabled ? track.entities.indicator.states.disabled.background : track.entities.indicator.background, handle.width, handle.width, fakeTrackBgHover, track.entities.indicator.states.hover.background);
26
+ })(["--a:", ";--b:", ";--min:", ";--max:", ";--dif:calc(var(--max) - var(--min));--realWidth:calc(100% - 12px);", " ", " &::before,&::after{", " background:", ";}&::before{margin-left:calc( calc(", " / 2) + (var(--a) - var(--min)) / var(--dif) * var(--realWidth) );width:calc((var(--b) - var(--a)) / var(--dif) * var(--realWidth));}&::after{margin-left:calc( calc(", " / 2) + (var(--b) - var(--min)) / var(--dif) * var(--realWidth) );width:calc((var(--a) - var(--b)) / var(--dif) * var(--realWidth));}@media (hover:hover) and (pointer:fine){&:hover:not([disabled]){", " &::before,&::after{background:", ";}}}"], _ref => {
27
+ let {
28
+ valA
29
+ } = _ref;
30
+ return valA;
31
+ }, _ref2 => {
32
+ let {
33
+ valB
34
+ } = _ref2;
35
+ return valB;
36
+ }, _ref3 => {
37
+ let {
38
+ min
39
+ } = _ref3;
40
+ return min;
41
+ }, _ref4 => {
42
+ let {
43
+ max
44
+ } = _ref4;
45
+ return max;
46
+ }, wrapperGrid, fakeTrackBg, trackFill, _ref5 => {
47
+ let {
48
+ disabled
49
+ } = _ref5;
50
+ return disabled ? track.entities.indicator.states.disabled.background : track.entities.indicator.background;
51
+ }, handle.width, handle.width, fakeTrackBgHover, track.entities.indicator.states.hover.background);
37
52
  const Wrapper = styled.div.withConfig({
38
53
  displayName: "Slider__Wrapper",
39
54
  componentId: "sc-n1grrg-1"
40
- })(["--min:", ";--max:", ";--dif:calc(var(--max) - var(--min));--value:", ";--realWidth:calc(100% - 12px);", " ", " &::after{", " background:", "}&::after{margin-right:calc( (var(--max) - var(--value)) / var(--dif) * var(--realWidth) );margin-left:3px;}@media (hover:hover) and (pointer:fine){&:hover:not([disabled]){", " &::after{background:", ";}}}"], ({
41
- min
42
- }) => min, ({
43
- max
44
- }) => max, ({
45
- value
46
- }) => value, wrapperGrid, fakeTrackBg, trackFill, ({
47
- disabled
48
- }) => disabled ? track.entities.indicator.states.disabled.background : track.entities.indicator.background, fakeTrackBgHover, track.entities.indicator.states.hover.background);
55
+ })(["--min:", ";--max:", ";--dif:calc(var(--max) - var(--min));--value:", ";--realWidth:calc(100% - 12px);", " ", " &::after{", " background:", "}&::after{margin-right:calc( (var(--max) - var(--value)) / var(--dif) * var(--realWidth) );margin-left:3px;}@media (hover:hover) and (pointer:fine){&:hover:not([disabled]){", " &::after{background:", ";}}}"], _ref6 => {
56
+ let {
57
+ min
58
+ } = _ref6;
59
+ return min;
60
+ }, _ref7 => {
61
+ let {
62
+ max
63
+ } = _ref7;
64
+ return max;
65
+ }, _ref8 => {
66
+ let {
67
+ value
68
+ } = _ref8;
69
+ return value;
70
+ }, wrapperGrid, fakeTrackBg, trackFill, _ref9 => {
71
+ let {
72
+ disabled
73
+ } = _ref9;
74
+ return disabled ? track.entities.indicator.states.disabled.background : track.entities.indicator.background;
75
+ }, fakeTrackBgHover, track.entities.indicator.states.hover.background);
49
76
  const WrapperGroupLabel = styled.div.withConfig({
50
77
  displayName: "Slider__WrapperGroupLabel",
51
78
  componentId: "sc-n1grrg-2"
@@ -58,20 +85,21 @@ const SrOnlyLabel = styled.label.withConfig({
58
85
  displayName: "Slider__SrOnlyLabel",
59
86
  componentId: "sc-n1grrg-4"
60
87
  })(["position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0;"]);
61
- const Slider = /*#__PURE__*/forwardRef(function Slider({
62
- min = 0,
63
- max = 100,
64
- value = [40, 60],
65
- outputFunction,
66
- onChange,
67
- onChangeCommitted,
68
- minMaxDots = true,
69
- minMaxValues = true,
70
- step = 1,
71
- disabled,
72
- ariaLabelledby,
73
- ...rest
74
- }, ref) {
88
+ const Slider = /*#__PURE__*/forwardRef(function Slider(_ref10, ref) {
89
+ let {
90
+ min = 0,
91
+ max = 100,
92
+ value = [40, 60],
93
+ outputFunction,
94
+ onChange,
95
+ onChangeCommitted,
96
+ minMaxDots = true,
97
+ minMaxValues = true,
98
+ step = 1,
99
+ disabled,
100
+ ariaLabelledby,
101
+ ...rest
102
+ } = _ref10;
75
103
  const isRangeSlider = Array.isArray(value);
76
104
  const [sliderValue, setSliderValue] = useState(isRangeSlider ? value : [value]);
77
105
  const minRange = useRef(null);
@@ -1,9 +1,8 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
  import { slider } from './Slider.tokens.js';
4
+ import { bordersTemplate, outlineTemplate } from '@equinor/eds-utils';
4
5
  import { jsx } from 'react/jsx-runtime';
5
- import { bordersTemplate } from '../../utils/templates/borders.js';
6
- import { outlineTemplate } from '../../utils/templates/focus.js';
7
6
 
8
7
  const {
9
8
  entities: {
@@ -24,18 +23,19 @@ const StyledSliderInput = styled.input.attrs(() => ({
24
23
  displayName: "SliderInput__StyledSliderInput",
25
24
  componentId: "sc-17orw4f-0"
26
25
  })(["&::-webkit-slider-runnable-track,&::-webkit-slider-thumb,&{-webkit-appearance:none;}::-moz-focus-outer{border:0;}width:100%;background:transparent;background:none;grid-column:1 / -1;grid-row:2;font:inherit;margin:0;z-index:2;outline:none;&[data-focus-visible-added]:focus{z-index:2;&::-webkit-slider-thumb{", ";}&::-moz-range-thumb{", ";}}&:focus-visible{z-index:2;&::-webkit-slider-thumb{", ";}&::-moz-range-thumb{", ";}}&:hover,&:active{&::-webkit-slider-thumb{", "}&::-moz-range-thumb{", "}}&:disabled{&::-webkit-slider-thumb{", "}&::-moz-range-thumb{", "}}&:disabled:hover,&:disabled:active{&::-webkit-slider-thumb{", "}&::-moz-range-thumb{", "}&::-webkit-slider-runnable-track{cursor:not-allowed;}&::-moz-range-track{cursor:not-allowed;}}&:before,&:after{}&:after{right:0;}&::-webkit-slider-thumb{", " margin-top:6px;}&::-moz-range-thumb{", " height:8px;width:8px;}&::-webkit-slider-runnable-track{", "}&::-moz-range-track{", "}"], outlineTemplate(handle.states.focus.outline), outlineTemplate(handle.states.focus.outline), outlineTemplate(handle.states.focus.outline), outlineTemplate(handle.states.focus.outline), thumbHover, thumbHover, thumbDisabled, thumbDisabled, thumbHoverAndDisabled, thumbHoverAndDisabled, thumb, thumb, track, track);
27
- const SliderInput = /*#__PURE__*/forwardRef(function SliderInput({
28
- value,
29
- min,
30
- max,
31
- id,
32
- step,
33
- onChange,
34
- onMouseUp,
35
- onKeyUp,
36
- disabled,
37
- ...restProps
38
- }, ref) {
26
+ const SliderInput = /*#__PURE__*/forwardRef(function SliderInput(_ref, ref) {
27
+ let {
28
+ value,
29
+ min,
30
+ max,
31
+ id,
32
+ step,
33
+ onChange,
34
+ onMouseUp,
35
+ onKeyUp,
36
+ disabled,
37
+ ...restProps
38
+ } = _ref;
39
39
  return /*#__PURE__*/jsx(StyledSliderInput, { ...restProps,
40
40
  value: value,
41
41
  ref: ref,
@@ -2,20 +2,19 @@ import { forwardRef, useState, useRef, useEffect } from 'react';
2
2
  import * as ReactDom from 'react-dom';
3
3
  import styled, { css, ThemeProvider } from 'styled-components';
4
4
  import { snackbar } from './Snackbar.tokens.js';
5
+ import { spacingsTemplate, bordersTemplate, typographyTemplate, useToken } from '@equinor/eds-utils';
5
6
  import { jsx } from 'react/jsx-runtime';
6
7
  import { Paper } from '../Paper/Paper.js';
7
- import { spacingsTemplate, typographyTemplate } from '../../utils/templates/index.js';
8
- import { bordersTemplate } from '../../utils/templates/borders.js';
9
8
  import { useEds } from '../EdsProvider/eds.context.js';
10
- import { useToken } from '../../hooks/useToken.js';
11
9
 
12
10
  const StyledSnackbar = styled(Paper).withConfig({
13
11
  displayName: "Snackbar__StyledSnackbar",
14
12
  componentId: "sc-ac6no8-0"
15
- })(({
16
- theme,
17
- placement
18
- }) => {
13
+ })(_ref => {
14
+ let {
15
+ theme,
16
+ placement
17
+ } = _ref;
19
18
  return css(["position:fixed;background-color:", ";", " ", " ", " min-height:", ";box-sizing:border-box;z-index:300;", " a,button{color:", ";}"], theme.background, spacingsTemplate(theme.spacings), bordersTemplate(theme.border), typographyTemplate(theme.typography), theme.minHeight, {
20
19
  top: placement.includes('top') ? theme.spacings.top : placement === 'left' || placement === 'right' ? '50%' : undefined,
21
20
  bottom: placement.includes('bottom') ? theme.spacings.bottom : undefined,
@@ -24,14 +23,15 @@ const StyledSnackbar = styled(Paper).withConfig({
24
23
  transform: placement === 'left' || placement === 'right' ? 'translateY(-50%)' : placement === 'top' || placement === 'bottom' ? 'translateX(-50%)' : undefined
25
24
  }, theme.entities.button.typography.color);
26
25
  });
27
- const Snackbar = /*#__PURE__*/forwardRef(function Snackbar({
28
- open = false,
29
- autoHideDuration = 7000,
30
- onClose,
31
- placement = 'bottom',
32
- children,
33
- ...rest
34
- }, ref) {
26
+ const Snackbar = /*#__PURE__*/forwardRef(function Snackbar(_ref2, ref) {
27
+ let {
28
+ open = false,
29
+ autoHideDuration = 7000,
30
+ onClose,
31
+ placement = 'bottom',
32
+ children,
33
+ ...rest
34
+ } = _ref2;
35
35
  const [visible, setVisible] = useState(open);
36
36
  const timer = useRef();
37
37
  const {
@@ -5,15 +5,17 @@ import { jsx } from 'react/jsx-runtime';
5
5
  const StyledSnackbarAction = styled.div.withConfig({
6
6
  displayName: "SnackbarAction__StyledSnackbarAction",
7
7
  componentId: "sc-1v5mjvd-0"
8
- })(({
9
- theme
10
- }) => {
8
+ })(_ref => {
9
+ let {
10
+ theme
11
+ } = _ref;
11
12
  return css(["display:inline-flex;margin-left:", ";margin-top:", ";margin-bottom:", ";"], theme.entities.actions.spacings.left, theme.entities.actions.spacings.top, theme.entities.actions.spacings.bottom);
12
13
  });
13
- const SnackbarAction = /*#__PURE__*/forwardRef(function SnackbarAction({
14
- children,
15
- ...rest
16
- }, ref) {
14
+ const SnackbarAction = /*#__PURE__*/forwardRef(function SnackbarAction(_ref2, ref) {
15
+ let {
16
+ children,
17
+ ...rest
18
+ } = _ref2;
17
19
  const props = { ...rest,
18
20
  ref
19
21
  };
@@ -3,30 +3,36 @@ import styled, { css, ThemeProvider } from 'styled-components';
3
3
  import { SwitchSmall } from './SwitchSmall.js';
4
4
  import { SwitchDefault } from './SwitchDefault.js';
5
5
  import { comfortable } from './Switch.tokens.js';
6
+ import { typographyTemplate, useToken } from '@equinor/eds-utils';
6
7
  import { jsx, jsxs } from 'react/jsx-runtime';
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 StyledLabel = styled.label.withConfig({
12
11
  displayName: "Switch__StyledLabel",
13
12
  componentId: "sc-sdaahx-0"
14
- })(["cursor:", ";border:none;background-color:transparent;vertical-align:middle;display:inline-flex;align-items:center;position:relative;"], ({
15
- isDisabled
16
- }) => isDisabled ? 'not-allowed' : 'pointer');
13
+ })(["cursor:", ";border:none;background-color:transparent;vertical-align:middle;display:inline-flex;align-items:center;position:relative;"], _ref => {
14
+ let {
15
+ isDisabled
16
+ } = _ref;
17
+ return isDisabled ? 'not-allowed' : 'pointer';
18
+ });
17
19
  const Label = styled.span.withConfig({
18
20
  displayName: "Switch__Label",
19
21
  componentId: "sc-sdaahx-1"
20
- })(({
21
- theme
22
- }) => css(["", " margin-left:", ";"], typographyTemplate(theme.typography), theme.entities.label.spacings.left));
23
- const Switch = /*#__PURE__*/forwardRef(function Switch({
24
- size = 'default',
25
- disabled,
26
- label,
27
- className,
28
- ...rest
29
- }, ref) {
22
+ })(_ref2 => {
23
+ let {
24
+ theme
25
+ } = _ref2;
26
+ return css(["", " margin-left:", ";"], typographyTemplate(theme.typography), theme.entities.label.spacings.left);
27
+ });
28
+ const Switch = /*#__PURE__*/forwardRef(function Switch(_ref3, ref) {
29
+ let {
30
+ size = 'default',
31
+ disabled,
32
+ label,
33
+ className,
34
+ ...rest
35
+ } = _ref3;
30
36
  const {
31
37
  density
32
38
  } = useEds(); // TODO Temporary workaround untill we can deprecate "size" property (controlled by EdsProvider in the future)
@@ -1,31 +1,38 @@
1
1
  import styled, { css } from 'styled-components';
2
- import { outlineTemplate } from '../../utils/templates/focus.js';
2
+ import { outlineTemplate } from '@equinor/eds-utils';
3
3
 
4
4
  const BaseInputWrapper = styled.span.withConfig({
5
5
  displayName: "Switchstyles__BaseInputWrapper",
6
6
  componentId: "sc-x39lde-0"
7
- })(({
8
- theme: {
9
- clickbound,
10
- width,
11
- height
12
- }
13
- }) => {
7
+ })(_ref => {
14
8
  var _clickbound$offset, _clickbound$offset2;
15
9
 
10
+ let {
11
+ theme: {
12
+ clickbound,
13
+ width,
14
+ height
15
+ }
16
+ } = _ref;
16
17
  return css(["width:", ";height:", ";border-radius:50%;position:relative;grid-area:input;pointer-events:none;&::before{position:absolute;top:0;left:0;width:auto;min-height:auto;content:'';}&::after{position:absolute;top:-", ";left:-", ";width:", ";height:", ";content:'';}"], width, height, clickbound === null || clickbound === void 0 ? void 0 : (_clickbound$offset = clickbound.offset) === null || _clickbound$offset === void 0 ? void 0 : _clickbound$offset.top, clickbound === null || clickbound === void 0 ? void 0 : (_clickbound$offset2 = clickbound.offset) === null || _clickbound$offset2 === void 0 ? void 0 : _clickbound$offset2.left, clickbound === null || clickbound === void 0 ? void 0 : clickbound.width, clickbound === null || clickbound === void 0 ? void 0 : clickbound.height);
17
18
  });
18
- const BaseInput = styled.input.attrs(({
19
- type = 'checkbox'
20
- }) => ({
21
- type
22
- })).withConfig({
19
+ const BaseInput = styled.input.attrs(_ref2 => {
20
+ let {
21
+ type = 'checkbox'
22
+ } = _ref2;
23
+ return {
24
+ type
25
+ };
26
+ }).withConfig({
23
27
  displayName: "Switchstyles__BaseInput",
24
28
  componentId: "sc-x39lde-1"
25
- })(({
26
- disabled,
27
- theme
28
- }) => css(["appearance:none;width:100%;height:100%;grid-area:input;margin:0;cursor:", ";&:focus{outline:none;}&[data-focus-visible-added]:focus + span{", "}&:focus-visible + span{", "}"], disabled ? 'not-allowed' : 'pointer', outlineTemplate(theme.states.focus.outline), outlineTemplate(theme.states.focus.outline)));
29
+ })(_ref3 => {
30
+ let {
31
+ disabled,
32
+ theme
33
+ } = _ref3;
34
+ return css(["appearance:none;width:100%;height:100%;grid-area:input;margin:0;cursor:", ";&:focus{outline:none;}&[data-focus-visible-added]:focus + span{", "}&:focus-visible + span{", "}"], disabled ? 'not-allowed' : 'pointer', outlineTemplate(theme.states.focus.outline), outlineTemplate(theme.states.focus.outline));
35
+ });
29
36
  const GridWrapper = styled.span.withConfig({
30
37
  displayName: "Switchstyles__GridWrapper",
31
38
  componentId: "sc-x39lde-2"