@equinor/eds-core-react 0.21.0 → 0.23.0-dev.20221003
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.
- package/dist/eds-core-react.cjs.js +233 -174
- package/dist/esm/components/Accordion/Accordion.js +1 -1
- package/dist/esm/components/Accordion/AccordionHeader.js +1 -1
- package/dist/esm/components/Accordion/AccordionItem.js +2 -2
- package/dist/esm/components/Autocomplete/Autocomplete.js +10 -9
- package/dist/esm/components/Autocomplete/Option.js +1 -1
- package/dist/esm/components/Banner/Banner.js +3 -3
- package/dist/esm/components/Banner/BannerMessage.js +1 -1
- package/dist/esm/components/Breadcrumbs/Breadcrumb.js +2 -2
- package/dist/esm/components/Breadcrumbs/Breadcrumbs.js +2 -2
- package/dist/esm/components/Button/Button.js +1 -1
- package/dist/esm/components/Button/ToggleButton/ToggleButton.js +55 -0
- package/dist/esm/components/Button/index.js +3 -0
- package/dist/esm/components/Button/tokens/button.js +10 -10
- package/dist/esm/components/Button/tokens/contained.js +1 -1
- package/dist/esm/components/Button/tokens/contained_icon.js +3 -3
- package/dist/esm/components/Button/tokens/ghost.js +1 -1
- package/dist/esm/components/Button/tokens/icon.js +4 -4
- package/dist/esm/components/Button/tokens/outlined.js +2 -2
- package/dist/esm/components/Card/Card.js +1 -1
- package/dist/esm/components/Card/CardActions.js +1 -1
- package/dist/esm/components/Checkbox/Input.js +3 -3
- package/dist/esm/components/Dialog/Dialog.js +29 -22
- package/dist/esm/components/Dialog/DialogContent.js +1 -1
- package/dist/esm/components/Dialog/DialogHeader.js +1 -1
- package/dist/esm/components/Divider/Divider.js +15 -7
- package/dist/esm/components/Divider/Divider.tokens.js +5 -16
- package/dist/esm/components/EdsProvider/eds.context.js +5 -3
- package/dist/esm/components/Icon/Icon.js +7 -7
- package/dist/esm/components/Input/Input.js +1 -1
- package/dist/esm/components/Menu/Menu.context.js +1 -1
- package/dist/esm/components/Menu/Menu.js +6 -6
- package/dist/esm/components/Menu/MenuSection.js +1 -1
- package/dist/esm/components/Pagination/Pagination.js +12 -7
- package/dist/esm/components/Popover/Popover.js +10 -10
- package/dist/esm/components/Popover/PopoverActions.js +1 -1
- package/dist/esm/components/Popover/PopoverContent.js +1 -1
- package/dist/esm/components/Popover/PopoverHeader.js +1 -1
- package/dist/esm/components/Progress/Circular/CircularProgress.js +2 -2
- package/dist/esm/components/Progress/Linear/LinearProgress.js +2 -2
- package/dist/esm/components/Radio/Radio.js +2 -2
- package/dist/esm/components/Scrim/Scrim.js +6 -11
- package/dist/esm/components/Scrim/Scrim.tokens.js +0 -2
- package/dist/esm/components/Search/Search.js +2 -2
- package/dist/esm/components/Select/MultiSelect/MultiSelect.js +4 -4
- package/dist/esm/components/Select/NativeSelect/NativeSelect.js +2 -2
- package/dist/esm/components/Select/SingleSelect/SingleSelect.js +3 -3
- package/dist/esm/components/Select/commonStyles.js +1 -1
- package/dist/esm/components/SideSheet/SideSheet.js +1 -1
- package/dist/esm/components/Slider/Slider.js +4 -4
- package/dist/esm/components/Snackbar/Snackbar.js +1 -1
- package/dist/esm/components/Switch/Switch.js +1 -1
- package/dist/esm/components/Switch/Switch.tokens.js +4 -4
- package/dist/esm/components/Table/Cell.js +2 -2
- package/dist/esm/components/Table/DataCell/DataCell.js +1 -1
- package/dist/esm/components/Table/DataCell/DataCell.tokens.js +5 -5
- package/dist/esm/components/Table/HeaderCell/HeaderCell.js +1 -1
- package/dist/esm/components/Table/HeaderCell/HeaderCell.tokens.js +5 -5
- package/dist/esm/components/Table/index.js +1 -1
- package/dist/esm/components/TableOfContents/TableOfContents.js +2 -2
- package/dist/esm/components/Tabs/TabList.js +2 -2
- package/dist/esm/components/Tabs/TabPanels.js +2 -2
- package/dist/esm/components/Tabs/Tabs.js +1 -1
- package/dist/esm/components/Tabs/Tabs.tokens.js +1 -1
- package/dist/esm/components/TextField/Field.js +5 -5
- package/dist/esm/components/TextField/HelperText/HelperText.js +2 -2
- package/dist/esm/components/TextField/TextField.context.js +1 -1
- package/dist/esm/components/TextField/TextField.js +3 -3
- package/dist/esm/components/Textarea/Textarea.js +3 -3
- package/dist/esm/components/Tooltip/Tooltip.js +4 -4
- package/dist/esm/components/TopBar/TopBar.js +7 -4
- package/dist/esm/components/Typography/Typography.js +3 -3
- package/dist/esm/index.js +14 -14
- package/dist/esm/node_modules/.pnpm/ramda@0.28.0/node_modules/ramda/es/mergeDeepRight.js +3 -1
- package/dist/types/components/Button/ToggleButton/ToggleButton.d.ts +18 -0
- package/dist/types/components/Button/ToggleButton/index.d.ts +1 -0
- package/dist/types/components/Button/index.d.ts +3 -1
- package/dist/types/components/Divider/Divider.d.ts +4 -0
- package/dist/types/components/Divider/Divider.tokens.d.ts +0 -1
- package/dist/types/components/EdsProvider/eds.context.d.ts +1 -0
- package/dist/types/components/Select/commonStyles.d.ts +5 -0
- package/dist/types/components/TopBar/TopBar.d.ts +4 -0
- package/package.json +41 -43
|
@@ -2,16 +2,17 @@ import { useState, useEffect, useContext, createContext } from 'react';
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
const initalState = {
|
|
5
|
+
/** Density for all components inside `EdsProvider` */
|
|
5
6
|
density: 'comfortable'
|
|
6
7
|
};
|
|
7
8
|
const EdsContext = /*#__PURE__*/createContext(initalState);
|
|
8
9
|
const EdsProvider = _ref => {
|
|
9
10
|
let {
|
|
10
11
|
children,
|
|
11
|
-
density
|
|
12
|
+
density
|
|
12
13
|
} = _ref;
|
|
13
14
|
const [state, setState] = useState({ ...initalState,
|
|
14
|
-
density
|
|
15
|
+
density: density || 'comfortable'
|
|
15
16
|
});
|
|
16
17
|
|
|
17
18
|
const setDensity = density => setState(prevState => ({ ...prevState,
|
|
@@ -24,7 +25,8 @@ const EdsProvider = _ref => {
|
|
|
24
25
|
}
|
|
25
26
|
}, [density, state.density]);
|
|
26
27
|
const value = {
|
|
27
|
-
density: state.density
|
|
28
|
+
density: state.density,
|
|
29
|
+
setDensity
|
|
28
30
|
};
|
|
29
31
|
return /*#__PURE__*/jsx(EdsContext.Provider, {
|
|
30
32
|
value: value,
|
|
@@ -7,7 +7,7 @@ const transform = _ref => {
|
|
|
7
7
|
let {
|
|
8
8
|
rotation
|
|
9
9
|
} = _ref;
|
|
10
|
-
return rotation ?
|
|
10
|
+
return rotation ? `transform: rotate(${rotation}deg)` : '';
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
const StyledSvg = styled.svg.attrs(_ref2 => {
|
|
@@ -19,8 +19,8 @@ const StyledSvg = styled.svg.attrs(_ref2 => {
|
|
|
19
19
|
return {
|
|
20
20
|
name: null,
|
|
21
21
|
xmlns: 'http://www.w3.org/2000/svg',
|
|
22
|
-
height:
|
|
23
|
-
width:
|
|
22
|
+
height: `${height}px`,
|
|
23
|
+
width: `${width}px`,
|
|
24
24
|
fill
|
|
25
25
|
};
|
|
26
26
|
}).withConfig({
|
|
@@ -36,7 +36,7 @@ const StyledPath = styled.path.attrs(_ref3 => {
|
|
|
36
36
|
size: null,
|
|
37
37
|
fillRule: 'evenodd',
|
|
38
38
|
clipRule: 'evenodd',
|
|
39
|
-
transform: size / height !== 1 ?
|
|
39
|
+
transform: size / height !== 1 ? `scale(${size / height})` : null
|
|
40
40
|
};
|
|
41
41
|
}).withConfig({
|
|
42
42
|
displayName: "Icon__StyledPath",
|
|
@@ -85,7 +85,7 @@ const Icon = /*#__PURE__*/forwardRef(function Icon(_ref4, ref) {
|
|
|
85
85
|
} = findIcon(name, data, size);
|
|
86
86
|
|
|
87
87
|
if (typeof icon === 'undefined') {
|
|
88
|
-
throw Error(
|
|
88
|
+
throw Error(`Icon "${name}" not found. Have you added it using Icon.add() or using data props?`);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
const height = size ? size : parseInt(icon.width);
|
|
@@ -94,7 +94,7 @@ const Icon = /*#__PURE__*/forwardRef(function Icon(_ref4, ref) {
|
|
|
94
94
|
height,
|
|
95
95
|
width,
|
|
96
96
|
fill: color,
|
|
97
|
-
viewBox:
|
|
97
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
98
98
|
rotation,
|
|
99
99
|
name,
|
|
100
100
|
'aria-hidden': true
|
|
@@ -108,7 +108,7 @@ const Icon = /*#__PURE__*/forwardRef(function Icon(_ref4, ref) {
|
|
|
108
108
|
let titleId = '';
|
|
109
109
|
|
|
110
110
|
if (title) {
|
|
111
|
-
titleId =
|
|
111
|
+
titleId = `${icon.prefix}-${icon.name}-${count}`;
|
|
112
112
|
svgProps = { ...svgProps,
|
|
113
113
|
title,
|
|
114
114
|
role: 'img',
|
|
@@ -2,8 +2,8 @@ import { forwardRef } from 'react';
|
|
|
2
2
|
import styled, { css, ThemeProvider } from 'styled-components';
|
|
3
3
|
import { inputToken } from './Input.tokens.js';
|
|
4
4
|
import { outlineTemplate, typographyTemplate, spacingsTemplate, useToken } from '@equinor/eds-utils';
|
|
5
|
-
import { useEds } from '../EdsProvider/eds.context.js';
|
|
6
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
import { useEds } from '../EdsProvider/eds.context.js';
|
|
7
7
|
|
|
8
8
|
const StyledInput = styled.input.withConfig({
|
|
9
9
|
displayName: "Input__StyledInput",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { forwardRef, useLayoutEffect, useMemo, useEffect } from 'react';
|
|
2
2
|
import styled, { css, ThemeProvider } from 'styled-components';
|
|
3
3
|
import { MenuProvider, useMenu } from './Menu.context.js';
|
|
4
|
-
import { Paper } from '../Paper/Paper.js';
|
|
5
4
|
import { MenuList } from './MenuList.js';
|
|
6
5
|
import { bordersTemplate, useToken, mergeRefs, useGlobalKeyPress } from '@equinor/eds-utils';
|
|
7
6
|
import { menu } from './Menu.tokens.js';
|
|
8
|
-
import { useEds } from '../EdsProvider/eds.context.js';
|
|
9
7
|
import { useFloating, offset, flip, shift, autoUpdate, useInteractions, useDismiss, FloatingPortal } from '@floating-ui/react-dom-interactions';
|
|
10
8
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
9
|
+
import { Paper } from '../Paper/Paper.js';
|
|
10
|
+
import { useEds } from '../EdsProvider/eds.context.js';
|
|
11
11
|
|
|
12
12
|
const {
|
|
13
13
|
border
|
|
@@ -15,12 +15,12 @@ const {
|
|
|
15
15
|
const MenuPaper = styled(Paper).withConfig({
|
|
16
16
|
displayName: "Menu__MenuPaper",
|
|
17
17
|
componentId: "sc-1vlnqcj-0"
|
|
18
|
-
})(["position:absolute;z-index:1400;width:fit-content;min-width:fit-content;", ";", ""], bordersTemplate(border), _ref => {
|
|
18
|
+
})(["position:absolute;z-index:1400;width:fit-content;min-width:fit-content;", ";", ";"], bordersTemplate(border), _ref => {
|
|
19
19
|
let {
|
|
20
20
|
open
|
|
21
21
|
} = _ref;
|
|
22
22
|
return css({
|
|
23
|
-
|
|
23
|
+
display: open ? 'block' : 'none'
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
26
|
const MenuContainer = /*#__PURE__*/forwardRef(function MenuContainer(_ref2, ref) {
|
|
@@ -160,8 +160,8 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref3, ref) {
|
|
|
160
160
|
ref: popoverRef,
|
|
161
161
|
style: { ...style,
|
|
162
162
|
position: strategy,
|
|
163
|
-
top: y
|
|
164
|
-
left: x
|
|
163
|
+
top: y || 0,
|
|
164
|
+
left: x || 0
|
|
165
165
|
}
|
|
166
166
|
}),
|
|
167
167
|
children: /*#__PURE__*/jsx(MenuProvider, {
|
|
@@ -2,9 +2,9 @@ import { memo } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { menu } from './Menu.tokens.js';
|
|
4
4
|
import { spacingsTemplate } from '@equinor/eds-utils';
|
|
5
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
5
6
|
import { Divider } from '../Divider/Divider.js';
|
|
6
7
|
import { Typography } from '../Typography/Typography.js';
|
|
7
|
-
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
8
8
|
|
|
9
9
|
const Header = styled.div.attrs(() => ({
|
|
10
10
|
tabIndex: 0
|
|
@@ -3,12 +3,12 @@ import styled from 'styled-components';
|
|
|
3
3
|
import { useIsMounted } from '@equinor/eds-utils';
|
|
4
4
|
import { Button } from '../Button/index.js';
|
|
5
5
|
import { Icon } from '../Icon/index.js';
|
|
6
|
-
import { Typography } from '../Typography/Typography.js';
|
|
7
6
|
import { PaginationItem } from './PaginationItem.js';
|
|
8
7
|
import { pagination } from './Pagination.tokens.js';
|
|
9
8
|
import { chevron_left, chevron_right, more_horizontal } from '@equinor/eds-icons';
|
|
10
9
|
import { PaginationControl } from './paginationControl.js';
|
|
11
10
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
11
|
+
import { Typography } from '../Typography/Typography.js';
|
|
12
12
|
|
|
13
13
|
const icons = {
|
|
14
14
|
chevron_left,
|
|
@@ -47,7 +47,7 @@ const Text = styled(Typography).withConfig({
|
|
|
47
47
|
})(["white-space:nowrap;"]);
|
|
48
48
|
|
|
49
49
|
function getAriaLabel(page, selected) {
|
|
50
|
-
return
|
|
50
|
+
return `${selected === page ? 'Current page, ' : 'Go to '}page ${page}`;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
const Pagination = /*#__PURE__*/forwardRef(function Pagination(_ref2, ref) {
|
|
@@ -99,7 +99,7 @@ const Pagination = /*#__PURE__*/forwardRef(function Pagination(_ref2, ref) {
|
|
|
99
99
|
...props,
|
|
100
100
|
children: /*#__PURE__*/jsxs(OrderedList, {
|
|
101
101
|
style: {
|
|
102
|
-
gridTemplateColumns:
|
|
102
|
+
gridTemplateColumns: `repeat(${columns}, 48px)`
|
|
103
103
|
},
|
|
104
104
|
children: [/*#__PURE__*/jsx(ListItem, {
|
|
105
105
|
children: /*#__PURE__*/jsx(Button, {
|
|
@@ -117,7 +117,7 @@ const Pagination = /*#__PURE__*/forwardRef(function Pagination(_ref2, ref) {
|
|
|
117
117
|
/*#__PURE__*/
|
|
118
118
|
// eslint-disable-next-line react/no-array-index-key
|
|
119
119
|
jsx(ListItem, {
|
|
120
|
-
children: /*#__PURE__*/jsx(PaginationItem, {
|
|
120
|
+
children: /*#__PURE__*/jsx(PaginationItem, {
|
|
121
121
|
"aria-label": getAriaLabel(page, activePage),
|
|
122
122
|
"aria-current": activePage,
|
|
123
123
|
page: page,
|
|
@@ -126,13 +126,13 @@ const Pagination = /*#__PURE__*/forwardRef(function Pagination(_ref2, ref) {
|
|
|
126
126
|
onPageChange(event, page);
|
|
127
127
|
}
|
|
128
128
|
})
|
|
129
|
-
},
|
|
129
|
+
}, `list-item ${index}`) : /*#__PURE__*/jsx(ListItem // eslint-disable-next-line react/no-array-index-key
|
|
130
130
|
, {
|
|
131
131
|
children: /*#__PURE__*/jsx(StyledIcon, {
|
|
132
132
|
name: "more_horizontal",
|
|
133
133
|
"aria-label": "Ellipsis of pages"
|
|
134
134
|
})
|
|
135
|
-
},
|
|
135
|
+
}, `ellipsis-${index}`)) : undefined, /*#__PURE__*/jsx(ListItem, {
|
|
136
136
|
children: /*#__PURE__*/jsx(Button, {
|
|
137
137
|
variant: "ghost_icon",
|
|
138
138
|
onClick: activePage < pages ? event => {
|
|
@@ -150,7 +150,12 @@ const Pagination = /*#__PURE__*/forwardRef(function Pagination(_ref2, ref) {
|
|
|
150
150
|
|
|
151
151
|
return withItemIndicator ? /*#__PURE__*/jsxs(FlexContainer, {
|
|
152
152
|
children: [/*#__PURE__*/jsx(Text, {
|
|
153
|
-
children: currentItemFirst !== currentItemLast ?
|
|
153
|
+
children: currentItemFirst !== currentItemLast ? `${currentItemFirst}
|
|
154
|
+
${' - '}
|
|
155
|
+
${currentItemLast}
|
|
156
|
+
${' of '}
|
|
157
|
+
${totalItems}
|
|
158
|
+
${' items'}` : `${currentItemFirst} ${' of '} ${totalItems} ${' items'}`
|
|
154
159
|
}), pagination]
|
|
155
160
|
}) : pagination;
|
|
156
161
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { forwardRef, useRef, useLayoutEffect, useMemo, useEffect } from 'react';
|
|
2
2
|
import styled, { css, ThemeProvider } from 'styled-components';
|
|
3
|
-
import { Paper } from '../Paper/Paper.js';
|
|
4
3
|
import { typographyTemplate, bordersTemplate, mergeRefs, useToken } from '@equinor/eds-utils';
|
|
5
4
|
import { popover } from './Popover.tokens.js';
|
|
6
|
-
import { useEds } from '../EdsProvider/eds.context.js';
|
|
7
5
|
import { useFloating, offset, flip, shift, arrow, autoUpdate, useInteractions, useDismiss } from '@floating-ui/react-dom-interactions';
|
|
8
6
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
+
import { Paper } from '../Paper/Paper.js';
|
|
8
|
+
import { useEds } from '../EdsProvider/eds.context.js';
|
|
9
9
|
|
|
10
10
|
const PopoverPaper = styled(Paper).withConfig({
|
|
11
11
|
displayName: "Popover__PopoverPaper",
|
|
@@ -15,9 +15,9 @@ const PopoverPaper = styled(Paper).withConfig({
|
|
|
15
15
|
theme,
|
|
16
16
|
open
|
|
17
17
|
} = _ref;
|
|
18
|
-
return css(["", " ", "
|
|
19
|
-
|
|
20
|
-
}, typographyTemplate(theme.typography), theme.background,
|
|
18
|
+
return css(["", " ", " background:", ";", " z-index:1400;"], {
|
|
19
|
+
display: open ? 'block' : 'none'
|
|
20
|
+
}, typographyTemplate(theme.typography), theme.background, bordersTemplate(theme.border));
|
|
21
21
|
});
|
|
22
22
|
const ArrowWrapper = styled.div.withConfig({
|
|
23
23
|
displayName: "Popover__ArrowWrapper",
|
|
@@ -35,7 +35,7 @@ const InnerWrapper = styled.div.withConfig({
|
|
|
35
35
|
let {
|
|
36
36
|
theme
|
|
37
37
|
} = _ref3;
|
|
38
|
-
return css(["display:grid;grid-gap:", ";"], theme.spacings.bottom);
|
|
38
|
+
return css(["display:grid;grid-gap:", ";max-height:", ";width:max-content;max-width:", ";overflow:auto;"], theme.spacings.bottom, theme.maxHeight, theme.maxWidth);
|
|
39
39
|
});
|
|
40
40
|
const PopoverArrow = styled.svg.withConfig({
|
|
41
41
|
displayName: "Popover__PopoverArrow",
|
|
@@ -123,8 +123,8 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(_ref5, ref) {
|
|
|
123
123
|
|
|
124
124
|
if (arrowRef.current) {
|
|
125
125
|
Object.assign(arrowRef.current.style, {
|
|
126
|
-
left: arrowX != null ?
|
|
127
|
-
top: arrowY != null ?
|
|
126
|
+
left: arrowX != null ? `${arrowX}px` : '',
|
|
127
|
+
top: arrowY != null ? `${arrowY}px` : '',
|
|
128
128
|
right: '',
|
|
129
129
|
bottom: '',
|
|
130
130
|
[staticSide]: '-6px',
|
|
@@ -151,8 +151,8 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(_ref5, ref) {
|
|
|
151
151
|
ref: popoverRef,
|
|
152
152
|
style: { ...style,
|
|
153
153
|
position: strategy,
|
|
154
|
-
top: y
|
|
155
|
-
left: x
|
|
154
|
+
top: y || 0,
|
|
155
|
+
left: x || 0
|
|
156
156
|
}
|
|
157
157
|
}),
|
|
158
158
|
children: [/*#__PURE__*/jsx(ArrowWrapper, {
|
|
@@ -9,7 +9,7 @@ const StyledPopoverActions = styled.div.withConfig({
|
|
|
9
9
|
let {
|
|
10
10
|
theme
|
|
11
11
|
} = _ref;
|
|
12
|
-
return css(["display:grid;grid-gap:8px;grid-auto-flow:column;align-items:center;padding:0 ", " 0 ", ";:
|
|
12
|
+
return css(["display:grid;grid-gap:8px;grid-auto-flow:column;align-items:center;padding:0 ", " 0 ", ";:first-child{padding-top:", ";}:last-child{padding-bottom:", ";}"], theme.spacings.right, theme.spacings.left, theme.spacings.top, theme.spacings.bottom);
|
|
13
13
|
});
|
|
14
14
|
const PopoverActions = /*#__PURE__*/forwardRef(function PopoverActions(_ref2, ref) {
|
|
15
15
|
let {
|
|
@@ -9,7 +9,7 @@ const ContentWrapper = styled.div.withConfig({
|
|
|
9
9
|
let {
|
|
10
10
|
theme
|
|
11
11
|
} = _ref;
|
|
12
|
-
return css(["
|
|
12
|
+
return css(["padding:0 ", " 0 ", ";:first-child{padding-top:", ";}:last-child{padding-bottom:", ";}"], theme.spacings.right, theme.spacings.left, theme.spacings.top, theme.spacings.bottom);
|
|
13
13
|
});
|
|
14
14
|
const PopoverContent = /*#__PURE__*/forwardRef(function PopoverContent(_ref2, ref) {
|
|
15
15
|
let {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
|
-
import { Divider } from '../Divider/Divider.js';
|
|
4
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { Divider } from '../Divider/Divider.js';
|
|
5
5
|
|
|
6
6
|
const StyledPopoverHeader = styled.div.withConfig({
|
|
7
7
|
displayName: "PopoverHeader__StyledPopoverHeader",
|
|
@@ -62,7 +62,7 @@ const CircularProgress = /*#__PURE__*/forwardRef(function CircularProgress(_ref2
|
|
|
62
62
|
|
|
63
63
|
if (variant === 'determinate') {
|
|
64
64
|
trackStyle.stroke = circumference.toFixed(3);
|
|
65
|
-
trackStyle.strokeDashoffset =
|
|
65
|
+
trackStyle.strokeDashoffset = `${((100 - progress) / 100 * circumference).toFixed(3)}px`;
|
|
66
66
|
props['aria-valuenow'] = progress;
|
|
67
67
|
|
|
68
68
|
if (value !== undefined) {
|
|
@@ -87,7 +87,7 @@ const CircularProgress = /*#__PURE__*/forwardRef(function CircularProgress(_ref2
|
|
|
87
87
|
}, [progress, variant]);
|
|
88
88
|
|
|
89
89
|
const getProgressFormatted = () => {
|
|
90
|
-
return
|
|
90
|
+
return `Loading ${srProgress}%`;
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
@@ -38,7 +38,7 @@ const LinearProgress = /*#__PURE__*/forwardRef(function LinearProgress(_ref, ref
|
|
|
38
38
|
props['aria-valuemin'] = 0;
|
|
39
39
|
props['aria-valuemax'] = 100;
|
|
40
40
|
const transform = value - 100;
|
|
41
|
-
barStyle =
|
|
41
|
+
barStyle = `translateX(${transform}%)`;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -60,7 +60,7 @@ const LinearProgress = /*#__PURE__*/forwardRef(function LinearProgress(_ref, ref
|
|
|
60
60
|
}, [value, variant]);
|
|
61
61
|
|
|
62
62
|
const getProgressFormatted = () => {
|
|
63
|
-
return
|
|
63
|
+
return `Loading ${srProgress}%`;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
@@ -3,8 +3,8 @@ import styled, { ThemeProvider } from 'styled-components';
|
|
|
3
3
|
import { radio_button_selected, radio_button_unselected } from '@equinor/eds-icons';
|
|
4
4
|
import { comfortable } from './Radio.tokens.js';
|
|
5
5
|
import { outlineTemplate, typographyTemplate, spacingsTemplate, useToken } from '@equinor/eds-utils';
|
|
6
|
-
import { useEds } from '../EdsProvider/eds.context.js';
|
|
7
6
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
+
import { useEds } from '../EdsProvider/eds.context.js';
|
|
8
8
|
|
|
9
9
|
/* eslint camelcase: "off" */
|
|
10
10
|
const Input = styled.input.attrs(_ref => {
|
|
@@ -121,7 +121,7 @@ const Radio = /*#__PURE__*/forwardRef(function Radio(_ref12, ref) {
|
|
|
121
121
|
return /*#__PURE__*/jsxs(Svg, {
|
|
122
122
|
width: iconSize,
|
|
123
123
|
height: iconSize,
|
|
124
|
-
viewBox:
|
|
124
|
+
viewBox: `0 0 ${iconSize} ${iconSize}`,
|
|
125
125
|
fill: fill,
|
|
126
126
|
"aria-hidden": true,
|
|
127
127
|
children: [/*#__PURE__*/jsx(StyledPath, {
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { forwardRef, useRef, useMemo } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { scrim } from './Scrim.tokens.js';
|
|
4
|
-
import { mergeRefs,
|
|
4
|
+
import { mergeRefs, useGlobalKeyPress } from '@equinor/eds-utils';
|
|
5
|
+
import { FloatingOverlay } from '@floating-ui/react-dom-interactions';
|
|
5
6
|
import { jsx } from 'react/jsx-runtime';
|
|
6
7
|
|
|
7
8
|
const {
|
|
8
|
-
height,
|
|
9
|
-
width,
|
|
10
9
|
background
|
|
11
10
|
} = scrim;
|
|
12
|
-
const StyledScrim = styled.
|
|
11
|
+
const StyledScrim = styled(FloatingOverlay).withConfig({
|
|
13
12
|
displayName: "Scrim__StyledScrim",
|
|
14
13
|
componentId: "sc-1fr7uvy-0"
|
|
15
|
-
})(["
|
|
14
|
+
})(["background:", ";z-index:1300;align-items:center;justify-content:center;display:flex;"], background);
|
|
16
15
|
const ScrimContent = styled.div.withConfig({
|
|
17
16
|
displayName: "Scrim__ScrimContent",
|
|
18
17
|
componentId: "sc-1fr7uvy-1"
|
|
@@ -27,11 +26,6 @@ const Scrim = /*#__PURE__*/forwardRef(function Scrim(_ref, ref) {
|
|
|
27
26
|
} = _ref;
|
|
28
27
|
const scrimRef = useRef(null);
|
|
29
28
|
const combinedScrimRef = useMemo(() => mergeRefs(scrimRef, ref), [scrimRef, ref]);
|
|
30
|
-
const props = { ...rest,
|
|
31
|
-
open,
|
|
32
|
-
isDismissable
|
|
33
|
-
};
|
|
34
|
-
useHideBodyScroll(open);
|
|
35
29
|
useGlobalKeyPress('Escape', () => {
|
|
36
30
|
if (isDismissable && onClose && open) {
|
|
37
31
|
onClose();
|
|
@@ -51,9 +45,10 @@ const Scrim = /*#__PURE__*/forwardRef(function Scrim(_ref, ref) {
|
|
|
51
45
|
}
|
|
52
46
|
|
|
53
47
|
return /*#__PURE__*/jsx(StyledScrim, {
|
|
48
|
+
lockScroll: true,
|
|
54
49
|
onClick: handleMouseClose,
|
|
55
50
|
ref: combinedScrimRef,
|
|
56
|
-
...
|
|
51
|
+
...rest,
|
|
57
52
|
children: /*#__PURE__*/jsx(ScrimContent, {
|
|
58
53
|
children: children
|
|
59
54
|
})
|
|
@@ -2,12 +2,12 @@ import { forwardRef, useRef, useState, useEffect, useMemo } from 'react';
|
|
|
2
2
|
import styled, { css, ThemeProvider } from 'styled-components';
|
|
3
3
|
import { search as search$1, close } from '@equinor/eds-icons';
|
|
4
4
|
import { search } from './Search.tokens.js';
|
|
5
|
-
import { useEds } from '../EdsProvider/eds.context.js';
|
|
6
5
|
import { Button } from '../Button/index.js';
|
|
7
6
|
import { Icon } from '../Icon/index.js';
|
|
8
|
-
import { Input } from '../Input/Input.js';
|
|
9
7
|
import { bordersTemplate, spacingsTemplate, typographyTemplate, useToken, mergeRefs, setReactInputValue } from '@equinor/eds-utils';
|
|
10
8
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
|
+
import { Input } from '../Input/Input.js';
|
|
10
|
+
import { useEds } from '../EdsProvider/eds.context.js';
|
|
11
11
|
|
|
12
12
|
const Container = styled.span.withConfig({
|
|
13
13
|
displayName: "Search__Container",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { forwardRef, useState } from 'react';
|
|
2
2
|
import { useMultipleSelection, useCombobox } from 'downshift';
|
|
3
|
-
import { Label } from '../../Label/Label.js';
|
|
4
3
|
import { Icon } from '../../Icon/index.js';
|
|
5
4
|
import { CheckboxInput } from '../../Checkbox/Input.js';
|
|
6
5
|
import { close, arrow_drop_up, arrow_drop_down } from '@equinor/eds-icons';
|
|
@@ -8,8 +7,9 @@ import styled, { ThemeProvider } from 'styled-components';
|
|
|
8
7
|
import { multiSelect } from '../Select.tokens.js';
|
|
9
8
|
import { StyledListItem, Container, StyledInputWrapper, PaddedInput, StyledButton, StyledList } from '../commonStyles.js';
|
|
10
9
|
import { spacingsTemplate, useToken } from '@equinor/eds-utils';
|
|
11
|
-
import { useEds } from '../../EdsProvider/eds.context.js';
|
|
12
10
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
11
|
+
import { useEds } from '../../EdsProvider/eds.context.js';
|
|
12
|
+
import { Label } from '../../Label/Label.js';
|
|
13
13
|
|
|
14
14
|
const PaddedStyledListItem = styled(StyledListItem).withConfig({
|
|
15
15
|
displayName: "MultiSelect__PaddedStyledListItem",
|
|
@@ -134,7 +134,7 @@ const MultiSelect = /*#__PURE__*/forwardRef(function MultiSelect(_ref2, ref) {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
|
-
const placeholderText = items.length > 0 ?
|
|
137
|
+
const placeholderText = items.length > 0 ? `${selectedItems.length}/${items.length} selected` : '';
|
|
138
138
|
|
|
139
139
|
const openSelect = () => {
|
|
140
140
|
if (!isOpen && !(disabled || readOnly)) {
|
|
@@ -207,7 +207,7 @@ const MultiSelect = /*#__PURE__*/forwardRef(function MultiSelect(_ref2, ref) {
|
|
|
207
207
|
}), /*#__PURE__*/jsx("span", {
|
|
208
208
|
children: item
|
|
209
209
|
})]
|
|
210
|
-
},
|
|
210
|
+
}, `${item}`))
|
|
211
211
|
})]
|
|
212
212
|
})
|
|
213
213
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import styled, { css, ThemeProvider } from 'styled-components';
|
|
3
|
-
import { Label } from '../../Label/Label.js';
|
|
4
3
|
import { nativeselect } from './NativeSelect.tokens.js';
|
|
5
4
|
import { typographyTemplate, spacingsTemplate, outlineTemplate, useToken } from '@equinor/eds-utils';
|
|
6
|
-
import { useEds } from '../../EdsProvider/eds.context.js';
|
|
7
5
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
import { useEds } from '../../EdsProvider/eds.context.js';
|
|
7
|
+
import { Label } from '../../Label/Label.js';
|
|
8
8
|
|
|
9
9
|
const Container = styled.div.withConfig({
|
|
10
10
|
displayName: "NativeSelect__Container",
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { forwardRef, useState, useEffect } from 'react';
|
|
2
2
|
import { useCombobox } from 'downshift';
|
|
3
3
|
import styled, { ThemeProvider } from 'styled-components';
|
|
4
|
-
import { Label } from '../../Label/Label.js';
|
|
5
4
|
import { Icon } from '../../Icon/index.js';
|
|
6
5
|
import { close, arrow_drop_up, arrow_drop_down } from '@equinor/eds-icons';
|
|
7
6
|
import { spacingsTemplate, useToken } from '@equinor/eds-utils';
|
|
8
7
|
import { select } from '../Select.tokens.js';
|
|
9
8
|
import { StyledListItem, Container, StyledInputWrapper, PaddedInput, StyledButton, StyledList } from '../commonStyles.js';
|
|
10
|
-
import { useEds } from '../../EdsProvider/eds.context.js';
|
|
11
9
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
|
+
import { useEds } from '../../EdsProvider/eds.context.js';
|
|
11
|
+
import { Label } from '../../Label/Label.js';
|
|
12
12
|
|
|
13
13
|
const PaddedStyledListItem = styled(StyledListItem).withConfig({
|
|
14
14
|
displayName: "SingleSelect__PaddedStyledListItem",
|
|
@@ -144,7 +144,7 @@ const SingleSelect = /*#__PURE__*/forwardRef(function SingleSelect(_ref2, ref) {
|
|
|
144
144
|
disabled: disabled
|
|
145
145
|
}),
|
|
146
146
|
children: item
|
|
147
|
-
},
|
|
147
|
+
}, `${item}`))
|
|
148
148
|
})]
|
|
149
149
|
})
|
|
150
150
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Input } from '../Input/Input.js';
|
|
2
1
|
import { List } from '../List/index.js';
|
|
3
2
|
import { Button } from '../Button/index.js';
|
|
4
3
|
import styled, { css } from 'styled-components';
|
|
5
4
|
import { select } from './Select.tokens.js';
|
|
6
5
|
import { bordersTemplate, typographyTemplate } from '@equinor/eds-utils';
|
|
6
|
+
import { Input } from '../Input/Input.js';
|
|
7
7
|
|
|
8
8
|
const {
|
|
9
9
|
entities: {
|
|
@@ -2,11 +2,11 @@ import { forwardRef } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { clear } from '@equinor/eds-icons';
|
|
4
4
|
import { bordersTemplate, spacingsTemplate, typographyTemplate } from '@equinor/eds-utils';
|
|
5
|
-
import { Typography } from '../Typography/Typography.js';
|
|
6
5
|
import { Button } from '../Button/index.js';
|
|
7
6
|
import { Icon } from '../Icon/index.js';
|
|
8
7
|
import { comfortable, variants } from './SideSheet.tokens.js';
|
|
9
8
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
9
|
+
import { Typography } from '../Typography/Typography.js';
|
|
10
10
|
|
|
11
11
|
const {
|
|
12
12
|
background,
|
|
@@ -16,7 +16,7 @@ const {
|
|
|
16
16
|
} = slider;
|
|
17
17
|
const fakeTrackBg = css(["background-image:url(\"data:image/svg+xml,<svg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'><rect x='0' y='11' fill='", "' width='100%' height='4' rx='2' /></svg>\");background-size:cover;background-repeat:no-repeat;"], track.background);
|
|
18
18
|
const fakeTrackBgHover = css({
|
|
19
|
-
backgroundImage:
|
|
19
|
+
backgroundImage: `url("data:image/svg+xml,<svg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'><rect x='0' y='11' fill='${track.states.hover.background}' width='100%' height='4' rx='2' /></svg>")`
|
|
20
20
|
});
|
|
21
21
|
const trackFill = css(["grid-column:1 / span 2;grid-row:2;height:", ";margin-bottom:", ";align-self:end;content:'';"], track.height, track.spacings.bottom);
|
|
22
22
|
const wrapperGrid = css(["display:grid;grid-template-rows:max-content 24px;grid-template-columns:1fr 1fr;width:100%;position:relative;"]);
|
|
@@ -193,9 +193,9 @@ const Slider = /*#__PURE__*/forwardRef(function Slider(_ref10, ref) {
|
|
|
193
193
|
|
|
194
194
|
if (rest['id']) {
|
|
195
195
|
const overrideId = rest['id'];
|
|
196
|
-
inputIdA =
|
|
197
|
-
inputIdB =
|
|
198
|
-
inputId =
|
|
196
|
+
inputIdA = `${overrideId}-thumb-a`;
|
|
197
|
+
inputIdB = `${overrideId}-thumb-b`;
|
|
198
|
+
inputId = `${overrideId}-thumb`;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
const getAriaLabelledby = useCallback(() => {
|
|
@@ -3,9 +3,9 @@ import * as ReactDom from 'react-dom';
|
|
|
3
3
|
import styled, { css, ThemeProvider } from 'styled-components';
|
|
4
4
|
import { snackbar } from './Snackbar.tokens.js';
|
|
5
5
|
import { spacingsTemplate, bordersTemplate, typographyTemplate, useToken } from '@equinor/eds-utils';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
7
|
import { Paper } from '../Paper/Paper.js';
|
|
7
8
|
import { useEds } from '../EdsProvider/eds.context.js';
|
|
8
|
-
import { jsx } from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
10
|
const StyledSnackbar = styled(Paper).withConfig({
|
|
11
11
|
displayName: "Snackbar__StyledSnackbar",
|
|
@@ -4,8 +4,8 @@ import { SwitchSmall } from './SwitchSmall.js';
|
|
|
4
4
|
import { SwitchDefault } from './SwitchDefault.js';
|
|
5
5
|
import { comfortable } from './Switch.tokens.js';
|
|
6
6
|
import { typographyTemplate, useToken } from '@equinor/eds-utils';
|
|
7
|
-
import { useEds } from '../EdsProvider/eds.context.js';
|
|
8
7
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
+
import { useEds } from '../EdsProvider/eds.context.js';
|
|
9
9
|
|
|
10
10
|
const StyledLabel = styled.label.withConfig({
|
|
11
11
|
displayName: "Switch__StyledLabel",
|
|
@@ -72,8 +72,8 @@ const comfortable = {
|
|
|
72
72
|
height: clickbounds.default__base,
|
|
73
73
|
width: clickbounds.default__base,
|
|
74
74
|
offset: {
|
|
75
|
-
top:
|
|
76
|
-
left:
|
|
75
|
+
top: `${(parseInt(clickbounds.default__base) - parseInt(circle.minHeight)) / 2}px`,
|
|
76
|
+
left: `${(parseInt(clickbounds.default__base) - parseInt(circle.minWidth)) / 2}px`
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
entities: {
|
|
@@ -122,8 +122,8 @@ const comfortable = {
|
|
|
122
122
|
height: clickbounds.compact__standard,
|
|
123
123
|
width: clickbounds.compact__standard,
|
|
124
124
|
offset: {
|
|
125
|
-
top:
|
|
126
|
-
left:
|
|
125
|
+
top: `${(parseInt(clickbounds.compact__standard) - parseInt(compactIconButton.minHeight)) / 2}px`,
|
|
126
|
+
left: `${(parseInt(clickbounds.compact__standard) - parseInt(compactIconButton.minWidth)) / 2}px`
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
129
|
entities: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import { TableDataCell } from './DataCell/DataCell.js';
|
|
3
|
-
import { TableHeaderCell } from './HeaderCell/HeaderCell.js';
|
|
4
2
|
import { InnerContext } from './Inner.context.js';
|
|
5
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { TableDataCell } from './DataCell/DataCell.js';
|
|
5
|
+
import { TableHeaderCell } from './HeaderCell/HeaderCell.js';
|
|
6
6
|
|
|
7
7
|
const Cell = /*#__PURE__*/forwardRef(function Cell(_ref, ref) {
|
|
8
8
|
let { ...rest
|