@equinor/eds-core-react 0.20.1 → 0.20.3

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.
@@ -3,9 +3,10 @@ import styled, { css } from 'styled-components';
3
3
  import { chevron_up, chevron_down } from '@equinor/eds-icons';
4
4
  import { Icon } from '../Icon/index.js';
5
5
  import { AccordionHeaderTitle } from './AccordionHeaderTitle.js';
6
+ import { AccordionHeaderActions } from './AccordionHeaderActions.js';
6
7
  import { accordion } from './Accordion.tokens.js';
7
- import { typographyTemplate, bordersTemplate, spacingsTemplate, outlineTemplate } from '@equinor/eds-utils';
8
- import { jsx } from 'react/jsx-runtime';
8
+ import { bordersTemplate, typographyTemplate, spacingsTemplate, outlineTemplate } from '@equinor/eds-utils';
9
+ import { jsx, jsxs } from 'react/jsx-runtime';
9
10
 
10
11
  const {
11
12
  entities: {
@@ -15,13 +16,37 @@ const {
15
16
  const StyledAccordionHeader = styled.div.withConfig({
16
17
  displayName: "AccordionHeader__StyledAccordionHeader",
17
18
  componentId: "sc-cu2e95-0"
18
- })(["margin:0;padding:0;"]);
19
- const StyledAccordionHeaderButton = styled.button.attrs(_ref => {
19
+ })(_ref => {
20
+ let {
21
+ theme,
22
+ disabled,
23
+ parentIndex
24
+ } = _ref;
25
+ const {
26
+ entities: {
27
+ header
28
+ },
29
+ border
30
+ } = theme;
31
+ return css(["margin:0;padding:0;height:", ";box-sizing:border-box;display:flex;flex-wrap:nowrap;justify-content:space-between;background-color:", ";", " border-top:", ";", ""], header.height, header.background, bordersTemplate(border), parentIndex === 0 ? null : 'none', disabled ? css({
32
+ color: header.states.disabled.typography.color,
33
+ cursor: 'not-allowed'
34
+ }) : css({
35
+ color: header.typography.color,
36
+ cursor: 'pointer',
37
+ '@media (hover: hover) and (pointer: fine)': {
38
+ ':hover': {
39
+ background: header.states.hover.background
40
+ }
41
+ }
42
+ }));
43
+ });
44
+ const StyledAccordionHeaderButton = styled.button.attrs(_ref2 => {
20
45
  let {
21
46
  panelId,
22
47
  isExpanded,
23
48
  disabled
24
- } = _ref;
49
+ } = _ref2;
25
50
  return {
26
51
  'aria-expanded': isExpanded,
27
52
  'aria-controls': panelId,
@@ -32,46 +57,39 @@ const StyledAccordionHeaderButton = styled.button.attrs(_ref => {
32
57
  }).withConfig({
33
58
  displayName: "AccordionHeader__StyledAccordionHeaderButton",
34
59
  componentId: "sc-cu2e95-1"
35
- })(_ref2 => {
60
+ })(_ref3 => {
36
61
  let {
37
62
  theme,
38
- disabled,
39
- parentIndex
40
- } = _ref2;
63
+ disabled
64
+ } = _ref3;
41
65
  const {
42
66
  entities: {
43
67
  header,
44
68
  icon: iconToken
45
- },
46
- border
69
+ }
47
70
  } = theme;
48
- return css(["", " ", " ", " &[data-focus-visible-added]:focus{", "}&:focus-visible{", "}border-top:", ";width:100%;background:", ";height:", ";margin:0;display:flex;align-items:center;box-sizing:border-box;", " > svg{color:", ";}"], typographyTemplate(header.typography), bordersTemplate(border), spacingsTemplate(header.spacings), outlineTemplate(header.states.focus.outline), outlineTemplate(header.states.focus.outline), parentIndex === 0 ? null : 'none', header.background, header.height, disabled ? css({
71
+ return css(["", " ", " &[data-focus-visible-added]:focus{", "}&:focus-visible{", "}border:0;background-color:transparent;margin:0;display:flex;align-items:center;flex-grow:1;", " > svg{color:", ";}"], typographyTemplate(header.typography), spacingsTemplate(header.spacings), outlineTemplate(header.states.focus.outline), outlineTemplate(header.states.focus.outline), disabled ? css({
49
72
  color: header.states.disabled.typography.color,
50
73
  cursor: 'not-allowed'
51
74
  }) : css({
52
75
  color: header.typography.color,
53
- cursor: 'pointer',
54
- '@media (hover: hover) and (pointer: fine)': {
55
- ':hover': {
56
- background: header.states.hover.background
57
- }
58
- }
76
+ cursor: 'pointer'
59
77
  }), iconToken.typography.color);
60
78
  });
61
79
  const StyledIcon = styled(Icon).withConfig({
62
80
  displayName: "AccordionHeader__StyledIcon",
63
81
  componentId: "sc-cu2e95-2"
64
- })(_ref3 => {
82
+ })(_ref4 => {
65
83
  let {
66
84
  chevronPosition
67
- } = _ref3;
85
+ } = _ref4;
68
86
  return chevronPosition === 'left' ? {
69
87
  marginRight: '32px'
70
88
  } : {
71
89
  marginLeft: '16px'
72
90
  };
73
91
  });
74
- const AccordionHeader = /*#__PURE__*/forwardRef(function AccordionHeader(_ref4, ref) {
92
+ const AccordionHeader = /*#__PURE__*/forwardRef(function AccordionHeader(_ref5, ref) {
75
93
  let {
76
94
  parentIndex,
77
95
  headerLevel,
@@ -83,7 +101,7 @@ const AccordionHeader = /*#__PURE__*/forwardRef(function AccordionHeader(_ref4,
83
101
  toggleExpanded,
84
102
  disabled,
85
103
  ...props
86
- } = _ref4;
104
+ } = _ref5;
87
105
 
88
106
  const handleClick = () => {
89
107
  if (!disabled) {
@@ -134,14 +152,27 @@ const AccordionHeader = /*#__PURE__*/forwardRef(function AccordionHeader(_ref4,
134
152
  });
135
153
  }
136
154
 
155
+ if (child.type === AccordionHeaderActions) {
156
+ return;
157
+ }
158
+
137
159
  return child;
138
160
  });
161
+ const headerActions = Children.map(children, child => {
162
+ if ( /*#__PURE__*/isValidElement(child) && child.type === AccordionHeaderActions) {
163
+ return /*#__PURE__*/cloneElement(child, {
164
+ isExpanded,
165
+ disabled
166
+ });
167
+ }
168
+ });
139
169
  const newChildren = [chevron, headerChildren];
140
- return /*#__PURE__*/jsx(StyledAccordionHeader, {
170
+ return /*#__PURE__*/jsxs(StyledAccordionHeader, {
171
+ disabled: disabled,
172
+ parentIndex: parentIndex,
141
173
  as: headerLevel,
142
- children: /*#__PURE__*/jsx(StyledAccordionHeaderButton, {
174
+ children: [/*#__PURE__*/jsx(StyledAccordionHeaderButton, {
143
175
  isExpanded: isExpanded,
144
- parentIndex: parentIndex,
145
176
  disabled: disabled,
146
177
  panelId: panelId,
147
178
  onClick: handleClick,
@@ -149,8 +180,8 @@ const AccordionHeader = /*#__PURE__*/forwardRef(function AccordionHeader(_ref4,
149
180
  ref: ref,
150
181
  ...props,
151
182
  children: chevronPosition === 'left' ? newChildren : newChildren.reverse()
152
- })
183
+ }), headerActions && headerActions]
153
184
  });
154
- }); // AccordionHeader.displayName = 'EdsAccordionHeader'
185
+ });
155
186
 
156
187
  export { AccordionHeader };
@@ -0,0 +1,43 @@
1
+ import { forwardRef } from 'react';
2
+ import styled, { css } from 'styled-components';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ const StyledAccordionHeaderActions = styled.span.withConfig({
6
+ displayName: "AccordionHeaderActions__StyledAccordionHeaderActions",
7
+ componentId: "sc-klu9el-0"
8
+ })(_ref => {
9
+ var _header$states$active;
10
+
11
+ let {
12
+ theme,
13
+ isExpanded,
14
+ disabled
15
+ } = _ref;
16
+ const {
17
+ entities: {
18
+ header
19
+ }
20
+ } = theme;
21
+ return css(["display:flex;align-items:center;justify-content:flex-end;padding-right:", ";", " color:", ";"], header.spacings.right, disabled ? css({
22
+ color: header.states.disabled.typography.color,
23
+ cursor: 'not-allowed'
24
+ }) : css({
25
+ color: header.typography.color,
26
+ cursor: 'pointer'
27
+ }), isExpanded && !disabled ? (_header$states$active = header.states.active.typography) === null || _header$states$active === void 0 ? void 0 : _header$states$active.color : 'inherit');
28
+ });
29
+ const AccordionHeaderActions = /*#__PURE__*/forwardRef(function AccordionHeaderActions(_ref2, ref) {
30
+ let {
31
+ isExpanded,
32
+ disabled,
33
+ children
34
+ } = _ref2;
35
+ return /*#__PURE__*/jsx(StyledAccordionHeaderActions, {
36
+ ref: ref,
37
+ isExpanded: isExpanded,
38
+ disabled: disabled,
39
+ children: children
40
+ });
41
+ });
42
+
43
+ export { AccordionHeaderActions };
@@ -6,14 +6,19 @@ const StyledAccordionHeaderTitle = styled.span.withConfig({
6
6
  displayName: "AccordionHeaderTitle__StyledAccordionHeaderTitle",
7
7
  componentId: "sc-g27uve-0"
8
8
  })(_ref => {
9
- var _theme$entities$heade;
9
+ var _header$states$active;
10
10
 
11
11
  let {
12
12
  theme,
13
13
  isExpanded,
14
14
  disabled
15
15
  } = _ref;
16
- return css(["flex:1;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;text-align:left;font-family:Equinor;color:", ";"], isExpanded && !disabled ? (_theme$entities$heade = theme.entities.header.states.active.typography) === null || _theme$entities$heade === void 0 ? void 0 : _theme$entities$heade.color : 'inherit');
16
+ const {
17
+ entities: {
18
+ header
19
+ }
20
+ } = theme;
21
+ return css(["display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;flex-grow:1;overflow:hidden;text-align:left;color:", ";"], isExpanded && !disabled ? (_header$states$active = header.states.active.typography) === null || _header$states$active === void 0 ? void 0 : _header$states$active.color : 'inherit');
17
22
  });
18
23
  const AccordionHeaderTitle = /*#__PURE__*/forwardRef(function AccordionHeaderTitle(_ref2, ref) {
19
24
  let {
@@ -2,16 +2,19 @@ import { Accordion as Accordion$1 } from './Accordion.js';
2
2
  import { AccordionItem } from './AccordionItem.js';
3
3
  import { AccordionHeader } from './AccordionHeader.js';
4
4
  import { AccordionHeaderTitle } from './AccordionHeaderTitle.js';
5
+ import { AccordionHeaderActions } from './AccordionHeaderActions.js';
5
6
  import { AccordionPanel } from './AccordionPanel.js';
6
7
 
7
8
  const Accordion = Accordion$1;
8
9
  Accordion.Item = AccordionItem;
9
10
  Accordion.Header = AccordionHeader;
10
11
  Accordion.HeaderTitle = AccordionHeaderTitle;
12
+ Accordion.HeaderActions = AccordionHeaderActions;
11
13
  Accordion.Panel = AccordionPanel;
12
14
  Accordion.Item.displayName = 'Accordion.Item';
13
15
  Accordion.Header.displayName = 'Accordion.Header';
14
16
  Accordion.HeaderTitle.displayName = 'Accordion.HeaderTitle';
17
+ Accordion.HeaderActions.displayName = 'Accordion.HeaderActions';
15
18
  Accordion.Panel.displayName = 'Accordion.Panel';
16
19
 
17
20
  export { Accordion };
@@ -1,4 +1,4 @@
1
- import { forwardRef, useRef, useState, useMemo, useCallback, useEffect } from 'react';
1
+ import { forwardRef, useRef, useState, useEffect, useMemo, useCallback } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
  import { useMultipleSelection, useCombobox } from 'downshift';
4
4
  import styled, { css, ThemeProvider } from 'styled-components';
@@ -38,7 +38,7 @@ const StyledList = styled(List).withConfig({
38
38
  let {
39
39
  theme
40
40
  } = _ref2;
41
- return css(["background-color:", ";box-shadow:", ";", " overflow-y:auto;max-height:300px;padding:0;position:absolute;right:0;left:0;z-index:50;"], theme.background, theme.boxShadow, bordersTemplate(theme.border));
41
+ return css(["background-color:", ";box-shadow:", ";", " overflow-y:auto;max-height:300px;padding:0;position:absolute;right:0;left:0;z-index:1400;"], theme.background, theme.boxShadow, bordersTemplate(theme.border));
42
42
  });
43
43
  const StyledButton = styled(Button).withConfig({
44
44
  displayName: "Autocomplete__StyledButton",
@@ -149,7 +149,19 @@ function AutocompleteInner(props, ref) {
149
149
  const [containerEl, setContainerEl] = useState();
150
150
  const isMounted = useIsMounted();
151
151
  const isControlled = Boolean(selectedOptions);
152
- const [availableItems, setAvailableItems] = useState(options);
152
+ const [inputOptions, setInputOptions] = useState(options);
153
+ useEffect(() => {
154
+ const availableHash = JSON.stringify(inputOptions);
155
+ const optionsHash = JSON.stringify(options);
156
+
157
+ if (availableHash !== optionsHash) {
158
+ setInputOptions(options);
159
+ }
160
+ }, [options, inputOptions]);
161
+ useEffect(() => {
162
+ setAvailableItems(inputOptions);
163
+ }, [inputOptions]);
164
+ const [availableItems, setAvailableItems] = useState(inputOptions);
153
165
  const disabledItems = useMemo(() => options.filter(optionDisabled), [options, optionDisabled]);
154
166
  const {
155
167
  density
@@ -159,18 +171,28 @@ function AutocompleteInner(props, ref) {
159
171
  }, multiple ? multiSelect : selectTokens);
160
172
  let placeholderText = placeholder;
161
173
  let multipleSelectionProps = {
162
- initialSelectedItems: multiple ? initialSelectedOptions : initialSelectedOptions[0] ? [initialSelectedOptions[0]] : [],
163
- onSelectedItemsChange: changes => {
164
- if (onOptionsChange) {
165
- onOptionsChange(changes);
166
- }
167
- }
174
+ initialSelectedItems: multiple ? initialSelectedOptions : initialSelectedOptions[0] ? [initialSelectedOptions[0]] : []
168
175
  };
169
176
 
170
- if (isControlled) {
177
+ if (multiple) {
171
178
  multipleSelectionProps = { ...multipleSelectionProps,
172
- selectedItems: selectedOptions
179
+ onSelectedItemsChange: changes => {
180
+ if (onOptionsChange) {
181
+ const {
182
+ selectedItems
183
+ } = changes;
184
+ onOptionsChange({
185
+ selectedItems
186
+ });
187
+ }
188
+ }
173
189
  };
190
+
191
+ if (isControlled) {
192
+ multipleSelectionProps = { ...multipleSelectionProps,
193
+ selectedItems: selectedOptions
194
+ };
195
+ }
174
196
  }
175
197
 
176
198
  const {
@@ -224,9 +246,11 @@ function AutocompleteInner(props, ref) {
224
246
  let {
225
247
  selectedItem
226
248
  } = _ref8;
227
-
228
249
  // Show all options when single select is reopened with a selected item
229
- if (availableItems.length === 1 && selectedItem === availableItems[0]) {
250
+ const availableHash = JSON.stringify(availableItems[0]);
251
+ const selectedsHash = JSON.stringify(selectedItem);
252
+
253
+ if (availableItems.length === 1 && selectedsHash === availableHash) {
230
254
  setAvailableItems(options);
231
255
  }
232
256
  },
@@ -289,7 +313,17 @@ function AutocompleteInner(props, ref) {
289
313
 
290
314
  if (isControlled && !multiple) {
291
315
  comboBoxProps = { ...comboBoxProps,
292
- selectedItem: selectedOptions[0]
316
+ selectedItem: selectedOptions[0] || null,
317
+ onSelectedItemChange: changes => {
318
+ if (onOptionsChange) {
319
+ const {
320
+ selectedItem
321
+ } = changes;
322
+ onOptionsChange({
323
+ selectedItems: selectedItem ? [selectedItem] : []
324
+ });
325
+ }
326
+ }
293
327
  };
294
328
  }
295
329
 
@@ -361,8 +395,10 @@ function AutocompleteInner(props, ref) {
361
395
  reset: resetCombobox
362
396
  } = useCombobox(comboBoxProps);
363
397
  useEffect(() => {
364
- if (anchorRef.current) {
398
+ if (anchorRef.current && isOpen) {
365
399
  setAnchorEl(anchorRef.current);
400
+ } else {
401
+ setAnchorEl(null);
366
402
  }
367
403
 
368
404
  if (isControlled) {
@@ -373,7 +409,16 @@ function AutocompleteInner(props, ref) {
373
409
  setAnchorEl(null);
374
410
  setContainerEl(null);
375
411
  };
376
- }, [anchorRef, isControlled, isOpen, selectedOptions, setSelectedItems]);
412
+ }, [anchorRef, isControlled, isOpen, selectedOptions, setSelectedItems]); //"Turn on" popper on load to position menu correctly and then turn it off
413
+
414
+ useEffect(() => {
415
+ if (anchorRef.current) {
416
+ setAnchorEl(anchorRef.current);
417
+ setTimeout(() => {
418
+ setAnchorEl(null);
419
+ }, 1);
420
+ }
421
+ }, []);
377
422
  const {
378
423
  styles,
379
424
  attributes
@@ -1,19 +1,16 @@
1
1
  import { forwardRef, Children, isValidElement } from 'react';
2
2
  import styled, { css, ThemeProvider } from 'styled-components';
3
3
  import { spacingsTemplate, useToken } from '@equinor/eds-utils';
4
+ import { Paper } from '../Paper/Paper.js';
4
5
  import { enabled } from './Banner.tokens.js';
5
6
  import { Divider } from '../Divider/Divider.js';
6
7
  import { BannerIcon } from './BannerIcon.js';
7
8
  import { useEds } from '../EdsProvider/eds.context.js';
8
9
  import { jsx, jsxs } from 'react/jsx-runtime';
9
10
 
10
- const StyledBanner = styled.div.withConfig({
11
- displayName: "Banner__StyledBanner",
12
- componentId: "sc-1ju451i-0"
13
- })([""]);
14
11
  const Content = styled.div.withConfig({
15
12
  displayName: "Banner__Content",
16
- componentId: "sc-1ju451i-1"
13
+ componentId: "sc-1ju451i-0"
17
14
  })(_ref => {
18
15
  let {
19
16
  theme,
@@ -23,12 +20,13 @@ const Content = styled.div.withConfig({
23
20
  });
24
21
  const NonMarginDivider = styled(Divider).withConfig({
25
22
  displayName: "Banner__NonMarginDivider",
26
- componentId: "sc-1ju451i-2"
23
+ componentId: "sc-1ju451i-1"
27
24
  })(["margin:0;height:2px;"]);
28
25
  const Banner = /*#__PURE__*/forwardRef(function Banner(_ref2, ref) {
29
26
  let {
30
27
  children,
31
28
  className,
29
+ elevation = 'none',
32
30
  ...rest
33
31
  } = _ref2;
34
32
  const childrenWhereBannerIcon = Children.map(children, child => {
@@ -47,8 +45,9 @@ const Banner = /*#__PURE__*/forwardRef(function Banner(_ref2, ref) {
47
45
  }, enabled);
48
46
  return /*#__PURE__*/jsx(ThemeProvider, {
49
47
  theme: token,
50
- children: /*#__PURE__*/jsxs(StyledBanner, { ...props,
48
+ children: /*#__PURE__*/jsxs(Paper, { ...props,
51
49
  className: className,
50
+ elevation: elevation,
52
51
  role: "alert",
53
52
  children: [/*#__PURE__*/jsx(Content, {
54
53
  hasIcon: hasIcon,
@@ -1,5 +1,6 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled from 'styled-components';
3
+ import { Paper } from '../Paper/Paper.js';
3
4
  import * as Card_tokens from './Card.tokens.js';
4
5
  import { bordersTemplate } from '@equinor/eds-utils';
5
6
  import { jsx } from 'react/jsx-runtime';
@@ -7,7 +8,7 @@ import { jsx } from 'react/jsx-runtime';
7
8
  const {
8
9
  primary
9
10
  } = Card_tokens;
10
- const StyledCard = styled.div.withConfig({
11
+ const StyledCard = styled(Paper).withConfig({
11
12
  displayName: "Card__StyledCard",
12
13
  componentId: "sc-bjucjn-0"
13
14
  })(["width:100%;position:relative;background-color:", ";box-sizing:border-box;display:flex;flex-direction:column;grid-gap:16px;cursor:", ";", ";"], _ref => {
@@ -25,6 +26,7 @@ const Card = /*#__PURE__*/forwardRef(function Card(_ref3, ref) {
25
26
  let {
26
27
  children,
27
28
  variant = 'default',
29
+ elevation = 'none',
28
30
  onClick,
29
31
  ...rest
30
32
  } = _ref3;
@@ -37,7 +39,9 @@ const Card = /*#__PURE__*/forwardRef(function Card(_ref3, ref) {
37
39
  cursor,
38
40
  ...rest
39
41
  };
40
- return /*#__PURE__*/jsx(StyledCard, { ...props,
42
+ return /*#__PURE__*/jsx(StyledCard, {
43
+ elevation: elevation,
44
+ ...props,
41
45
  onClick: onClick,
42
46
  children: children
43
47
  });
@@ -6,7 +6,7 @@ import { jsx } from 'react/jsx-runtime';
6
6
  const StyledPaper = styled.div.withConfig({
7
7
  displayName: "Paper__StyledPaper",
8
8
  componentId: "sc-6ncnv9-0"
9
- })(["min-width:", ";max-width:", ";background:", ";box-shadow:", ";"], paper.minWidth, paper.maxWidth, paper.background, _ref => {
9
+ })(["background:", ";box-shadow:", ";"], paper.background, _ref => {
10
10
  let {
11
11
  elevation
12
12
  } = _ref;
@@ -11,8 +11,6 @@ const {
11
11
  }
12
12
  } = tokens;
13
13
  const paper = {
14
- maxWidth: 'calc(100% - 32px)',
15
- minWidth: '96px',
16
14
  background
17
15
  };
18
16
 
@@ -1,6 +1,6 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
- import { spacingsTemplate, outlineTemplate, bordersTemplate } from '@equinor/eds-utils';
3
+ import { spacingsTemplate, typographyTemplate, outlineTemplate, bordersTemplate } from '@equinor/eds-utils';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
 
6
6
  const StyledTab = styled.button.attrs(_ref => {
@@ -29,7 +29,7 @@ const StyledTab = styled.button.attrs(_ref => {
29
29
  tab
30
30
  }
31
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;scroll-snap-align:end;scroll-snap-stop:always;&:focus{outline:none;}&[data-focus],&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}&::-moz-focus-inner{border:0;}@media (hover:hover) and (pointer:fine){&[data-hover],&:hover{color:", ";", "}}", " ", ""], tab.height, spacingsTemplate(tab.spacings), active ? tab.states.active.typography.color : tab.typography.color, tab.background, outlineTemplate(tab.states.focus.outline), outlineTemplate(tab.states.focus.outline), active ? tab.states.active.states.hover.typography.color : tab.typography.color, disabled ? css(["background:", ";cursor:not-allowed;"], tab.states.disabled.background) : css(["background:", ";cursor:pointer;"], tab.states.hover.background), disabled ? bordersTemplate(tab.states.disabled.border) : bordersTemplate(tab.border), active && bordersTemplate(tab.states.active.border));
32
+ return css(["appearance:none;box-sizing:border-box;border:none;outline:none;height:", ";", " ", " color:", ";background-color:", ";position:relative;white-space:nowrap;text-overflow:ellipsis;overflow-x:hidden;scroll-snap-align:end;scroll-snap-stop:always;&:focus{outline:none;}&[data-focus],&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}&::-moz-focus-inner{border:0;}@media (hover:hover) and (pointer:fine){&[data-hover],&:hover{color:", ";", "}}", " ", ""], tab.height, spacingsTemplate(tab.spacings), typographyTemplate(tab.typography), 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
33
  });
34
34
  const Tab = /*#__PURE__*/forwardRef(function Tab(props, ref) {
35
35
  return /*#__PURE__*/jsx(StyledTab, {
@@ -1,6 +1,6 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
- import { spacingsTemplate, outlineTemplate } from '@equinor/eds-utils';
3
+ import { spacingsTemplate, typographyTemplate, outlineTemplate } from '@equinor/eds-utils';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
 
6
6
  const StyledTabPanel = styled.div.attrs(() => ({
@@ -18,7 +18,7 @@ const StyledTabPanel = styled.div.attrs(() => ({
18
18
  panel
19
19
  }
20
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));
21
+ return css(["", " ", " &:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}"], spacingsTemplate(panel.spacings), typographyTemplate(panel.typography), outlineTemplate(panel.states.focus.outline), outlineTemplate(panel.states.focus.outline));
22
22
  });
23
23
  const TabPanel = /*#__PURE__*/forwardRef(function TabPanel(_ref2, ref) {
24
24
  let { ...props
@@ -39,6 +39,12 @@ const {
39
39
  focused: {
40
40
  width: focusOutlineWidth
41
41
  }
42
+ },
43
+ typography: {
44
+ navigation: {
45
+ menu_tabs,
46
+ menu_title
47
+ }
42
48
  }
43
49
  } = tokens;
44
50
  const token = {
@@ -57,6 +63,8 @@ const token = {
57
63
  color: focusOutlineColor
58
64
  }
59
65
  }
66
+ },
67
+ typography: { ...menu_title
60
68
  }
61
69
  },
62
70
  tab: {
@@ -74,7 +82,8 @@ const token = {
74
82
  },
75
83
  typography: {
76
84
  color: defaultColor,
77
- textAlign: 'center'
85
+ textAlign: 'center',
86
+ ...menu_tabs
78
87
  },
79
88
  border: {
80
89
  type: 'bordergroup',
@@ -1,11 +1,12 @@
1
1
  import { forwardRef } from 'react';
2
2
  import styled, { css, ThemeProvider } from 'styled-components';
3
3
  import { bordersTemplate, spacingsTemplate, typographyTemplate, useToken } from '@equinor/eds-utils';
4
+ import { Paper } from '../Paper/Paper.js';
4
5
  import { topbar } from './TopBar.tokens.js';
5
6
  import { useEds } from '../EdsProvider/eds.context.js';
6
7
  import { jsx } from 'react/jsx-runtime';
7
8
 
8
- const StyledTopBar = styled.header.withConfig({
9
+ const StyledTopBar = styled(Paper).withConfig({
9
10
  displayName: "TopBar__StyledTopBar",
10
11
  componentId: "sc-1yj236q-0"
11
12
  })(_ref => {
@@ -17,6 +18,7 @@ const StyledTopBar = styled.header.withConfig({
17
18
  const TopBar = /*#__PURE__*/forwardRef(function TopBar(_ref2, ref) {
18
19
  let {
19
20
  children,
21
+ elevation = 'none',
20
22
  ...props
21
23
  } = _ref2;
22
24
  const {
@@ -25,10 +27,15 @@ const TopBar = /*#__PURE__*/forwardRef(function TopBar(_ref2, ref) {
25
27
  const token = useToken({
26
28
  density
27
29
  }, topbar);
30
+ const rest = { ...props,
31
+ ref
32
+ };
28
33
  return /*#__PURE__*/jsx(ThemeProvider, {
29
34
  theme: token,
30
- children: /*#__PURE__*/jsx(StyledTopBar, { ...props,
31
- ref: ref,
35
+ children: /*#__PURE__*/jsx(StyledTopBar, {
36
+ forwardedAs: 'header',
37
+ elevation: elevation,
38
+ ...rest,
32
39
  children: children
33
40
  })
34
41
  });
@@ -0,0 +1,14 @@
1
+ import { HTMLAttributes } from 'react';
2
+ export declare type AccordionHeaderActionsProps = {
3
+ /** Is AccordionItem expanded */
4
+ isExpanded?: boolean;
5
+ /** Accordion item is disabled */
6
+ disabled?: boolean;
7
+ } & HTMLAttributes<HTMLSpanElement>;
8
+ declare const AccordionHeaderActions: import("react").ForwardRefExoticComponent<{
9
+ /** Is AccordionItem expanded */
10
+ isExpanded?: boolean;
11
+ /** Accordion item is disabled */
12
+ disabled?: boolean;
13
+ } & HTMLAttributes<HTMLSpanElement> & import("react").RefAttributes<HTMLSpanElement>>;
14
+ export { AccordionHeaderActions };
@@ -2,14 +2,16 @@ import { Accordion as BaseAccordion } from './Accordion';
2
2
  import { AccordionItem, AccordionItemProps } from './AccordionItem';
3
3
  import { AccordionHeader, AccordionHeaderProps } from './AccordionHeader';
4
4
  import { AccordionHeaderTitle, AccordionHeaderTitleProps } from './AccordionHeaderTitle';
5
+ import { AccordionHeaderActions, AccordionHeaderActionsProps } from './AccordionHeaderActions';
5
6
  import { AccordionPanel, AccordionPanelProps } from './AccordionPanel';
6
7
  import type { AccordionProps } from './Accordion.types';
7
8
  declare type AccordionCompoundProps = typeof BaseAccordion & {
8
9
  Item: typeof AccordionItem;
9
10
  Header: typeof AccordionHeader;
10
11
  HeaderTitle: typeof AccordionHeaderTitle;
12
+ HeaderActions: typeof AccordionHeaderActions;
11
13
  Panel: typeof AccordionPanel;
12
14
  };
13
15
  declare const Accordion: AccordionCompoundProps;
14
16
  export { Accordion };
15
- export type { AccordionProps, AccordionPanelProps, AccordionHeaderProps, AccordionHeaderTitleProps, AccordionItemProps, };
17
+ export type { AccordionProps, AccordionPanelProps, AccordionHeaderProps, AccordionHeaderTitleProps, AccordionHeaderActionsProps, AccordionItemProps, };
@@ -1,6 +1,7 @@
1
1
  import { HTMLAttributes } from 'react';
2
- import { UseMultipleSelectionProps } from 'downshift';
3
- export declare type AutocompleteChanges<T> = UseMultipleSelectionProps<T>;
2
+ export declare type AutocompleteChanges<T> = {
3
+ selectedItems: T[];
4
+ };
4
5
  export declare type AutocompleteProps<T> = {
5
6
  /** List of options to choose from */
6
7
  options: T[];
@@ -1,7 +1,12 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
+ import type { Elevations } from '@equinor/eds-tokens';
3
+ declare type AvailableElevations = keyof Pick<Elevations, 'none' | 'raised' | 'overlay'>;
2
4
  export declare type BannerProps = {
5
+ elevation?: AvailableElevations;
3
6
  children: ReactNode;
4
7
  } & HTMLAttributes<HTMLDivElement>;
5
8
  export declare const Banner: import("react").ForwardRefExoticComponent<{
9
+ elevation?: AvailableElevations;
6
10
  children: ReactNode;
7
11
  } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
12
+ export {};