@equinor/eds-core-react 0.16.1-dev.12072021 → 0.18.0-envis.2
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/README.md +1 -1
- package/dist/{core-react.cjs.js → eds-core-react.cjs.js} +1059 -799
- package/dist/esm/components/Accordion/Accordion.js +16 -3
- package/dist/esm/components/Accordion/Accordion.tokens.js +3 -0
- package/dist/esm/components/Accordion/AccordionHeader.js +24 -17
- package/dist/esm/components/Accordion/AccordionHeaderTitle.js +5 -5
- package/dist/esm/components/Accordion/AccordionPanel.js +13 -9
- package/dist/esm/components/Banner/Banner.js +28 -17
- package/dist/esm/components/Banner/Banner.tokens.js +9 -0
- package/dist/esm/components/Banner/BannerActions.js +8 -11
- package/dist/esm/components/Banner/BannerIcon.js +6 -4
- package/dist/esm/components/Button/Button.js +1 -1
- package/dist/esm/components/Button/InnerFullWidth.js +1 -1
- package/dist/esm/components/Button/tokens/button.js +17 -10
- package/dist/esm/components/Dialog/Actions.js +5 -3
- package/dist/esm/components/Dialog/CustomContent.js +10 -4
- package/dist/esm/components/Dialog/Dialog.js +24 -9
- package/dist/esm/components/Dialog/Dialog.tokens.js +3 -0
- package/dist/esm/components/Dialog/Title.js +10 -4
- package/dist/esm/components/Menu/Menu.js +7 -2
- package/dist/esm/components/Menu/MenuSection.js +2 -2
- package/dist/esm/components/Popover/Popover.js +68 -37
- package/dist/esm/components/Popover/Popover.tokens.js +3 -0
- package/dist/esm/components/Popover/PopoverTitle.js +11 -4
- package/dist/esm/components/Scrim/Scrim.js +12 -7
- package/dist/esm/components/Search/Search.js +65 -42
- package/dist/esm/components/Search/Search.tokens.js +8 -4
- package/dist/esm/components/Select/MultiSelect/MultiSelect.js +8 -2
- package/dist/esm/components/Select/Select.tokens.js +3 -0
- package/dist/esm/components/Select/commonStyles.js +1 -1
- package/dist/esm/components/Snackbar/Snackbar.js +25 -14
- package/dist/esm/components/Snackbar/Snackbar.tokens.js +3 -0
- package/dist/esm/components/Snackbar/SnackbarAction.js +6 -3
- package/dist/esm/components/Table/DataCell/DataCell.js +3 -2
- package/dist/esm/components/Table/DataCell/DataCell.tokens.js +17 -7
- package/dist/esm/components/Table/HeaderCell/HeaderCell.js +1 -1
- package/dist/esm/components/Table/HeaderCell/HeaderCell.tokens.js +18 -8
- package/dist/esm/components/TableOfContents/LinkItem.js +6 -3
- package/dist/esm/components/TableOfContents/TableOfContents.js +34 -16
- package/dist/esm/components/TableOfContents/TableOfContents.tokens.js +3 -0
- package/dist/esm/components/Tabs/Tab.js +11 -16
- package/dist/esm/components/Tabs/TabPanel.js +11 -8
- package/dist/esm/components/Tabs/Tabs.js +26 -13
- package/dist/esm/components/Tabs/Tabs.tokens.js +3 -0
- package/dist/esm/components/TextField/Field.js +2 -0
- package/dist/esm/components/TextField/TextField.js +4 -0
- package/dist/esm/components/TopBar/TopBar.js +21 -13
- package/dist/esm/components/TopBar/TopBar.tokens.js +5 -2
- package/dist/esm/hooks/useHideBodyScroll.js +13 -5
- package/dist/esm/index.js +1 -0
- package/dist/types/components/Group/Group.d.ts +3 -0
- package/dist/types/components/Group/Group.tokens.d.ts +4 -0
- package/dist/types/components/Group/index.d.ts +1 -0
- package/dist/types/components/Menu/MenuSection.d.ts +1 -2
- package/dist/types/components/Scrim/Scrim.d.ts +7 -3
- package/dist/types/components/TopBar/TopBar.tokens.d.ts +1 -1
- package/dist/types/hooks/useHideBodyScroll.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +12 -7
- package/dist/types/components/Combobox/Combobox.d.ts +0 -55
- package/dist/types/components/Combobox/Combobox.tokens.d.ts +0 -3
- package/dist/types/components/Combobox/index.d.ts +0 -1
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { forwardRef, Children, cloneElement } from 'react';
|
|
2
|
+
import { ThemeProvider } from 'styled-components';
|
|
3
|
+
import { accordion } from './Accordion.tokens.js';
|
|
2
4
|
import { jsx } from 'react/jsx-runtime';
|
|
3
5
|
import { useId } from '../../hooks/useId.js';
|
|
6
|
+
import { useEds } from '../EdsProvider/eds.context.js';
|
|
7
|
+
import { useToken } from '../../hooks/useToken.js';
|
|
4
8
|
|
|
5
9
|
const Accordion = /*#__PURE__*/forwardRef(function Accordion({
|
|
6
10
|
headerLevel = 'h2',
|
|
@@ -10,6 +14,12 @@ const Accordion = /*#__PURE__*/forwardRef(function Accordion({
|
|
|
10
14
|
...props
|
|
11
15
|
}, ref) {
|
|
12
16
|
const accordionId = useId(id, 'accordion');
|
|
17
|
+
const {
|
|
18
|
+
density
|
|
19
|
+
} = useEds();
|
|
20
|
+
const token = useToken({
|
|
21
|
+
density
|
|
22
|
+
}, accordion);
|
|
13
23
|
const AccordionItems = Children.map(children, (child, index) => {
|
|
14
24
|
if (!child) return null;
|
|
15
25
|
return /*#__PURE__*/cloneElement(child, {
|
|
@@ -19,9 +29,12 @@ const Accordion = /*#__PURE__*/forwardRef(function Accordion({
|
|
|
19
29
|
chevronPosition
|
|
20
30
|
});
|
|
21
31
|
});
|
|
22
|
-
return /*#__PURE__*/jsx(
|
|
23
|
-
|
|
24
|
-
children:
|
|
32
|
+
return /*#__PURE__*/jsx(ThemeProvider, {
|
|
33
|
+
theme: token,
|
|
34
|
+
children: /*#__PURE__*/jsx("div", { ...props,
|
|
35
|
+
ref: ref,
|
|
36
|
+
children: AccordionItems
|
|
37
|
+
})
|
|
25
38
|
});
|
|
26
39
|
}); // Accordion.displayName = 'Accordion'
|
|
27
40
|
|
|
@@ -11,9 +11,7 @@ import { outlineTemplate } from '../../utils/templates/focus.js';
|
|
|
11
11
|
|
|
12
12
|
const {
|
|
13
13
|
entities: {
|
|
14
|
-
|
|
15
|
-
chevron: chevronToken,
|
|
16
|
-
icon: iconToken
|
|
14
|
+
chevron: chevronToken
|
|
17
15
|
}
|
|
18
16
|
} = accordion;
|
|
19
17
|
const StyledAccordionHeader = styled.div.attrs(({
|
|
@@ -30,22 +28,31 @@ const StyledAccordionHeader = styled.div.attrs(({
|
|
|
30
28
|
})).withConfig({
|
|
31
29
|
displayName: "AccordionHeader__StyledAccordionHeader",
|
|
32
30
|
componentId: "sc-cu2e95-0"
|
|
33
|
-
})(
|
|
31
|
+
})(({
|
|
32
|
+
theme,
|
|
33
|
+
disabled,
|
|
34
34
|
parentIndex
|
|
35
|
-
}) =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
}) => {
|
|
36
|
+
const {
|
|
37
|
+
entities: {
|
|
38
|
+
header,
|
|
39
|
+
icon: iconToken
|
|
40
|
+
},
|
|
41
|
+
border
|
|
42
|
+
} = theme;
|
|
43
|
+
return css(["", " ", " ", " &[data-focus-visible-added]:focus{", "}&:focus-visible{", "}border-top:", ";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({
|
|
44
|
+
color: header.states.disabled.typography.color,
|
|
45
|
+
cursor: 'not-allowed'
|
|
46
|
+
}) : css({
|
|
47
|
+
color: header.typography.color,
|
|
48
|
+
cursor: 'pointer',
|
|
49
|
+
'@media (hover: hover) and (pointer: fine)': {
|
|
50
|
+
':hover': {
|
|
51
|
+
background: header.states.hover.background
|
|
52
|
+
}
|
|
46
53
|
}
|
|
47
|
-
}
|
|
48
|
-
})
|
|
54
|
+
}), iconToken.typography.color);
|
|
55
|
+
});
|
|
49
56
|
const StyledIcon = styled(Icon).withConfig({
|
|
50
57
|
displayName: "AccordionHeader__StyledIcon",
|
|
51
58
|
componentId: "sc-cu2e95-1"
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { accordion } from './Accordion.tokens.js';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
4
3
|
import { jsx } from 'react/jsx-runtime';
|
|
5
4
|
|
|
6
5
|
const StyledAccordionHeaderTitle = styled.span.withConfig({
|
|
7
6
|
displayName: "AccordionHeaderTitle__StyledAccordionHeaderTitle",
|
|
8
7
|
componentId: "sc-g27uve-0"
|
|
9
|
-
})(
|
|
8
|
+
})(({
|
|
9
|
+
theme,
|
|
10
10
|
isExpanded,
|
|
11
11
|
disabled
|
|
12
12
|
}) => {
|
|
13
|
-
var
|
|
13
|
+
var _theme$entities$heade;
|
|
14
14
|
|
|
15
|
-
return isExpanded && !disabled ? (
|
|
15
|
+
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
16
|
});
|
|
17
17
|
const AccordionHeaderTitle = /*#__PURE__*/forwardRef(function AccordionHeaderTitle({
|
|
18
18
|
isExpanded,
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { accordion } from './Accordion.tokens.js';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
4
3
|
import { jsx } from 'react/jsx-runtime';
|
|
5
4
|
import { bordersTemplate } from '../../utils/templates/borders.js';
|
|
6
5
|
import { spacingsTemplate } from '../../utils/templates/index.js';
|
|
7
6
|
|
|
8
|
-
const {
|
|
9
|
-
entities: {
|
|
10
|
-
header,
|
|
11
|
-
panel
|
|
12
|
-
}
|
|
13
|
-
} = accordion;
|
|
14
7
|
const StyledAccordionPanel = styled.div.attrs(({
|
|
15
8
|
headerId
|
|
16
9
|
}) => ({
|
|
@@ -19,7 +12,18 @@ const StyledAccordionPanel = styled.div.attrs(({
|
|
|
19
12
|
})).withConfig({
|
|
20
13
|
displayName: "AccordionPanel__StyledAccordionPanel",
|
|
21
14
|
componentId: "sc-suplv4-0"
|
|
22
|
-
})(
|
|
15
|
+
})(({
|
|
16
|
+
theme
|
|
17
|
+
}) => {
|
|
18
|
+
const {
|
|
19
|
+
entities: {
|
|
20
|
+
header,
|
|
21
|
+
panel
|
|
22
|
+
},
|
|
23
|
+
border
|
|
24
|
+
} = theme;
|
|
25
|
+
return css(["", " ", " background:", ";min-height:96px;box-sizing:border-box;"], bordersTemplate(border), spacingsTemplate(panel.spacings), header.background);
|
|
26
|
+
});
|
|
23
27
|
const AccordionPanel = /*#__PURE__*/forwardRef(function AccordionPanel({
|
|
24
28
|
id,
|
|
25
29
|
headerId,
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { forwardRef, Children, isValidElement } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import
|
|
2
|
+
import styled, { css, ThemeProvider } from 'styled-components';
|
|
3
|
+
import { enabled } from './Banner.tokens.js';
|
|
4
4
|
import { BannerIcon } from './BannerIcon.js';
|
|
5
|
-
import {
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
6
|
import { spacingsTemplate } from '../../utils/templates/index.js';
|
|
7
7
|
import { Divider } from '../Divider/Divider.js';
|
|
8
|
+
import { useEds } from '../EdsProvider/eds.context.js';
|
|
9
|
+
import { useToken } from '../../hooks/useToken.js';
|
|
8
10
|
|
|
9
11
|
const StyledBanner = styled.div.withConfig({
|
|
10
12
|
displayName: "Banner__StyledBanner",
|
|
11
13
|
componentId: "sc-1ju451i-0"
|
|
12
14
|
})([""]);
|
|
13
|
-
const {
|
|
14
|
-
enabled
|
|
15
|
-
} = Banner_tokens;
|
|
16
15
|
const Content = styled.div.withConfig({
|
|
17
16
|
displayName: "Banner__Content",
|
|
18
17
|
componentId: "sc-1ju451i-1"
|
|
19
|
-
})(
|
|
18
|
+
})(({
|
|
19
|
+
theme,
|
|
20
20
|
hasIcon
|
|
21
|
-
}) =>
|
|
21
|
+
}) => {
|
|
22
|
+
return css(["", " display:grid;grid-template-columns:", ";align-items:center;background-color:", ";"], spacingsTemplate(theme.spacings), hasIcon ? 'min-content 1fr auto' : '1fr auto', theme.background);
|
|
23
|
+
});
|
|
22
24
|
const NonMarginDivider = styled(Divider).withConfig({
|
|
23
25
|
displayName: "Banner__NonMarginDivider",
|
|
24
26
|
componentId: "sc-1ju451i-2"
|
|
@@ -36,15 +38,24 @@ const Banner = /*#__PURE__*/forwardRef(function Banner({
|
|
|
36
38
|
ref,
|
|
37
39
|
...rest
|
|
38
40
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
const {
|
|
42
|
+
density
|
|
43
|
+
} = useEds();
|
|
44
|
+
const token = useToken({
|
|
45
|
+
density
|
|
46
|
+
}, enabled);
|
|
47
|
+
return /*#__PURE__*/jsx(ThemeProvider, {
|
|
48
|
+
theme: token,
|
|
49
|
+
children: /*#__PURE__*/jsxs(StyledBanner, { ...props,
|
|
50
|
+
className: className,
|
|
51
|
+
role: "alert",
|
|
52
|
+
children: [/*#__PURE__*/jsx(Content, {
|
|
53
|
+
hasIcon: hasIcon,
|
|
54
|
+
children: children
|
|
55
|
+
}), /*#__PURE__*/jsx(NonMarginDivider, {
|
|
56
|
+
color: "light"
|
|
57
|
+
})]
|
|
58
|
+
})
|
|
48
59
|
});
|
|
49
60
|
});
|
|
50
61
|
|
|
@@ -60,6 +60,9 @@ const enabled = {
|
|
|
60
60
|
radius: borderRadius
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
},
|
|
64
|
+
modes: {
|
|
65
|
+
compact: {}
|
|
63
66
|
}
|
|
64
67
|
};
|
|
65
68
|
const info = {
|
|
@@ -70,6 +73,9 @@ const info = {
|
|
|
70
73
|
color: infoColor
|
|
71
74
|
}
|
|
72
75
|
}
|
|
76
|
+
},
|
|
77
|
+
modes: {
|
|
78
|
+
compact: {}
|
|
73
79
|
}
|
|
74
80
|
};
|
|
75
81
|
const warning = {
|
|
@@ -80,6 +86,9 @@ const warning = {
|
|
|
80
86
|
color: warningColor
|
|
81
87
|
}
|
|
82
88
|
}
|
|
89
|
+
},
|
|
90
|
+
modes: {
|
|
91
|
+
compact: {}
|
|
83
92
|
}
|
|
84
93
|
};
|
|
85
94
|
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import * as Banner_tokens from './Banner.tokens.js';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
4
3
|
import { jsx } from 'react/jsx-runtime';
|
|
5
4
|
|
|
6
|
-
const {
|
|
7
|
-
enabled
|
|
8
|
-
} = Banner_tokens;
|
|
9
5
|
const StyledBannerActions = styled.div.withConfig({
|
|
10
6
|
displayName: "BannerActions__StyledBannerActions",
|
|
11
7
|
componentId: "sc-1o38ds2-0"
|
|
12
|
-
})(
|
|
8
|
+
})(({
|
|
9
|
+
theme,
|
|
13
10
|
placement
|
|
14
|
-
}) =>
|
|
15
|
-
placement
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
}) => {
|
|
12
|
+
return css(["display:flex;margin-left:", ";grid-gap:8px;grid-column:", ";", ""], theme.spacings.left, placement === 'bottom' ? '1/-1' : 'auto', placement === 'bottom' && {
|
|
13
|
+
marginTop: theme.spacings.top,
|
|
14
|
+
marginLeft: '0'
|
|
15
|
+
});
|
|
19
16
|
});
|
|
20
17
|
const BannerActions = /*#__PURE__*/forwardRef(function BannerActions({
|
|
21
18
|
children,
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { forwardRef, Children, isValidElement, cloneElement } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
3
|
import * as Banner_tokens from './Banner.tokens.js';
|
|
4
4
|
import { Icon } from '../Icon/index.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
import { bordersTemplate } from '../../utils/templates/borders.js';
|
|
7
7
|
|
|
8
8
|
const {
|
|
9
|
-
enabled,
|
|
10
9
|
info,
|
|
11
10
|
warning
|
|
12
11
|
} = Banner_tokens;
|
|
13
12
|
const StyledBannerIcon = styled.span.withConfig({
|
|
14
13
|
displayName: "BannerIcon__StyledBannerIcon",
|
|
15
14
|
componentId: "sc-7ow3zc-0"
|
|
16
|
-
})(
|
|
15
|
+
})(({
|
|
16
|
+
theme,
|
|
17
17
|
variant
|
|
18
|
-
}) =>
|
|
18
|
+
}) => {
|
|
19
|
+
return css(["display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;", ";background-color:", ";width:", ";height:", ";margin-right:", ";"], bordersTemplate(theme.entities.icon.border), variant === 'warning' ? warning.entities.icon.background : info.entities.icon.background, theme.entities.icon.width, theme.entities.icon.height, theme.spacings.right);
|
|
20
|
+
});
|
|
19
21
|
const BannerIcon = /*#__PURE__*/forwardRef(function BannerIcon({
|
|
20
22
|
children,
|
|
21
23
|
variant = 'info',
|
|
@@ -43,7 +43,7 @@ const getToken = (variant, color) => {
|
|
|
43
43
|
const Inner = styled.span.withConfig({
|
|
44
44
|
displayName: "Button__Inner",
|
|
45
45
|
componentId: "sc-1hs0myn-0"
|
|
46
|
-
})(["display:grid;grid-gap:8px;grid-auto-flow:column;align-items:center;height:100%;justify-content:center;"]);
|
|
46
|
+
})(["display:grid;grid-gap:var(--eds_button__gap,8px);grid-auto-flow:column;align-items:center;height:100%;justify-content:center;& >:is(svg,img){margin-top:var(--eds_button__icon__margin_y,0);margin-bottom:var(--eds_button__icon__margin_y,0);}"]);
|
|
47
47
|
const ButtonBase = styled.button.withConfig({
|
|
48
48
|
displayName: "Button__ButtonBase",
|
|
49
49
|
componentId: "sc-1hs0myn-1"
|
|
@@ -9,7 +9,7 @@ const FullWidthCenterContent = styled.span.withConfig({
|
|
|
9
9
|
const FullWidthInner = styled.span.withConfig({
|
|
10
10
|
displayName: "InnerFullWidth__FullWidthInner",
|
|
11
11
|
componentId: "sc-qeawkb-1"
|
|
12
|
-
})(["height:100%;display:flex;align-items:center
|
|
12
|
+
})(["height:100%;display:flex;align-items:center;>:is(svg,img){margin-top:var(--eds_button__margin_y,inherit);margin-bottom:var(--eds_button__margin_y,inherit);}>:is(svg,img):first-child{margin-right:var(--eds_button__fullwidth__icon__margin_x,8px);}>:is(svg,img):last-child{margin-left:var(--eds_button__fullwidth__icon__margin_x,8px);}>:is(svg,img):only-child{margin-left:auto;margin-right:auto;}> span:first-child{margin-left:var(--eds_button__fullwidth__margin_x,32px);}> span:last-child{margin-right:var(--eds_button__fullwidth__margin_x,32px);}> span:only-child{margin-right:0;margin-left:0;}"]);
|
|
13
13
|
const InnerFullWidth = /*#__PURE__*/forwardRef(function InnerFullWidth({
|
|
14
14
|
children
|
|
15
15
|
}, ref) {
|
|
@@ -47,20 +47,23 @@ const {
|
|
|
47
47
|
} = tokens;
|
|
48
48
|
const button = {
|
|
49
49
|
background: 'transparent',
|
|
50
|
-
height: buttonHeight,
|
|
50
|
+
height: "var(--eds_button__height, ".concat(buttonHeight, ")"),
|
|
51
51
|
typography: { ...buttonTypography,
|
|
52
|
-
textAlign: 'center'
|
|
52
|
+
textAlign: 'center',
|
|
53
|
+
fontSize: "var(--eds_button__font_size, ".concat(buttonTypography.fontSize, ")")
|
|
53
54
|
},
|
|
54
55
|
border: {
|
|
55
56
|
type: 'border',
|
|
56
|
-
width:
|
|
57
|
+
width: "var(--eds_button__border_width, 1px)",
|
|
57
58
|
color: 'transparent',
|
|
58
|
-
radius: buttonBorderRadius,
|
|
59
|
+
radius: "var(--eds_button__radius, ".concat(buttonBorderRadius, ")"),
|
|
59
60
|
style: 'solid'
|
|
60
61
|
},
|
|
61
62
|
spacings: {
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
top: 'var(--eds_button__padding_y, 0)',
|
|
64
|
+
bottom: 'var(--eds_button__padding_y, 0)',
|
|
65
|
+
left: "var(--eds_button__padding_x, ".concat(medium, ")"),
|
|
66
|
+
right: "var(--eds_button__padding_x, ".concat(medium, ")")
|
|
64
67
|
},
|
|
65
68
|
clickbound: {
|
|
66
69
|
height: clicboundHeight,
|
|
@@ -72,8 +75,8 @@ const button = {
|
|
|
72
75
|
},
|
|
73
76
|
entities: {
|
|
74
77
|
icon: {
|
|
75
|
-
height: '24px',
|
|
76
|
-
width: '24px'
|
|
78
|
+
height: 'var(--eds_button__icon__size, 24px)',
|
|
79
|
+
width: 'var(--eds_button__icon__size, 24px)'
|
|
77
80
|
}
|
|
78
81
|
},
|
|
79
82
|
states: {
|
|
@@ -82,7 +85,7 @@ const button = {
|
|
|
82
85
|
type: 'border',
|
|
83
86
|
width: '1px',
|
|
84
87
|
color: 'transparent',
|
|
85
|
-
radius: buttonBorderRadius,
|
|
88
|
+
radius: "var(--eds_button__radius, ".concat(buttonBorderRadius, ")"),
|
|
86
89
|
style: 'solid'
|
|
87
90
|
}
|
|
88
91
|
},
|
|
@@ -111,7 +114,11 @@ const button = {
|
|
|
111
114
|
},
|
|
112
115
|
modes: {
|
|
113
116
|
compact: {
|
|
114
|
-
height: compactButtonHeight,
|
|
117
|
+
height: "var(--eds_button__height_compact, ".concat(compactButtonHeight, ")"),
|
|
118
|
+
spacings: {
|
|
119
|
+
top: 'var(--eds_button__padding_y_compact, 0)',
|
|
120
|
+
bottom: 'var(--eds_button__padding_y_compact, 0)'
|
|
121
|
+
},
|
|
115
122
|
clickbound: {
|
|
116
123
|
height: compactClickboundHeight,
|
|
117
124
|
width: '100%',
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
|
-
import { dialog } from './Dialog.tokens.js';
|
|
4
3
|
import { jsx } from 'react/jsx-runtime';
|
|
5
4
|
import { spacingsTemplate } from '../../utils/templates/index.js';
|
|
6
5
|
|
|
7
6
|
const StyledActions = styled.div.withConfig({
|
|
8
7
|
displayName: "Actions__StyledActions",
|
|
9
8
|
componentId: "sc-1qfwg1m-0"
|
|
10
|
-
})(
|
|
9
|
+
})(({
|
|
10
|
+
theme,
|
|
11
11
|
children
|
|
12
|
-
}) =>
|
|
12
|
+
}) => {
|
|
13
|
+
return css(["min-height:", ";", " align-self:end;justify-self:start;", ""], theme.entities.actions.minHeight, spacingsTemplate(theme.entities.children.spacings), !children && css(["min-height:initial;height:'8px';"]));
|
|
14
|
+
});
|
|
13
15
|
const Actions = /*#__PURE__*/forwardRef(function Actions({
|
|
14
16
|
children,
|
|
15
17
|
...props
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
|
-
import { dialog } from './Dialog.tokens.js';
|
|
4
3
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
5
4
|
import { typographyTemplate, spacingsTemplate } from '../../utils/templates/index.js';
|
|
6
5
|
import { Divider } from '../Divider/Divider.js';
|
|
@@ -8,13 +7,20 @@ import { Divider } from '../Divider/Divider.js';
|
|
|
8
7
|
const StyledCustomContent = styled.div.withConfig({
|
|
9
8
|
displayName: "CustomContent__StyledCustomContent",
|
|
10
9
|
componentId: "sc-17fsw6x-0"
|
|
11
|
-
})(
|
|
10
|
+
})(({
|
|
11
|
+
theme,
|
|
12
12
|
scrollable
|
|
13
|
-
}) =>
|
|
13
|
+
}) => {
|
|
14
|
+
return css(["", " min-height:", ";margin-bottom:", ";align-self:stretch;justify-self:stretch;", " ", ""], typographyTemplate(theme.entities.content.typography), theme.entities.content.minHeight, theme.entities.content.spacings.bottom, spacingsTemplate(theme.entities.children.spacings), scrollable && css(["min-height:initial;height:", ";overflow-y:auto;"], theme.entities.content.height));
|
|
15
|
+
});
|
|
14
16
|
const StyledDivider = styled(Divider).withConfig({
|
|
15
17
|
displayName: "CustomContent__StyledDivider",
|
|
16
18
|
componentId: "sc-17fsw6x-1"
|
|
17
|
-
})(
|
|
19
|
+
})(({
|
|
20
|
+
theme
|
|
21
|
+
}) => {
|
|
22
|
+
return css(["width:100%;margin-bottom:", ";"], theme.entities.divider.spacings.bottom);
|
|
23
|
+
});
|
|
18
24
|
const CustomContent = /*#__PURE__*/forwardRef(function CustomContent({
|
|
19
25
|
children,
|
|
20
26
|
scrollable = false,
|
|
@@ -1,30 +1,45 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
2
|
+
import styled, { css, ThemeProvider } from 'styled-components';
|
|
3
3
|
import { dialog } from './Dialog.tokens.js';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
import { Paper } from '../Paper/Paper.js';
|
|
6
6
|
import { typographyTemplate, spacingsTemplate } from '../../utils/templates/index.js';
|
|
7
7
|
import { bordersTemplate } from '../../utils/templates/borders.js';
|
|
8
|
+
import { useEds } from '../EdsProvider/eds.context.js';
|
|
9
|
+
import { useToken } from '../../hooks/useToken.js';
|
|
8
10
|
|
|
9
|
-
const StyledDialog = styled(Paper).attrs(
|
|
11
|
+
const StyledDialog = styled(Paper).attrs({
|
|
10
12
|
tabIndex: 0,
|
|
11
13
|
role: 'dialog',
|
|
12
14
|
'aria-labelledby': 'eds-dialog-title',
|
|
13
15
|
'aria-describedby': 'eds-dialog-customcontent',
|
|
14
16
|
'aria-modal': true
|
|
15
|
-
})
|
|
17
|
+
}).withConfig({
|
|
16
18
|
displayName: "Dialog__StyledDialog",
|
|
17
19
|
componentId: "sc-1mewo3f-0"
|
|
18
|
-
})(
|
|
20
|
+
})(({
|
|
21
|
+
theme
|
|
22
|
+
}) => {
|
|
23
|
+
return css(["width:", ";background:", ";display:grid;", " ", " ", ""], theme.width, theme.background, typographyTemplate(theme.typography), spacingsTemplate(theme.spacings), bordersTemplate(theme.border));
|
|
24
|
+
});
|
|
19
25
|
const Dialog = /*#__PURE__*/forwardRef(function Dialog({
|
|
20
26
|
children,
|
|
21
27
|
...props
|
|
22
28
|
}, ref) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
const {
|
|
30
|
+
density
|
|
31
|
+
} = useEds();
|
|
32
|
+
const token = useToken({
|
|
33
|
+
density
|
|
34
|
+
}, dialog);
|
|
35
|
+
return /*#__PURE__*/jsx(ThemeProvider, {
|
|
36
|
+
theme: token,
|
|
37
|
+
children: /*#__PURE__*/jsx(StyledDialog, {
|
|
38
|
+
elevation: "above_scrim",
|
|
39
|
+
...props,
|
|
40
|
+
ref: ref,
|
|
41
|
+
children: children
|
|
42
|
+
})
|
|
28
43
|
});
|
|
29
44
|
}); // Dialog.displayName = 'EdsDialog'
|
|
30
45
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
|
-
import { dialog } from './Dialog.tokens.js';
|
|
4
3
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
5
4
|
import { Divider } from '../Divider/Divider.js';
|
|
6
5
|
import { typographyTemplate, spacingsTemplate } from '../../utils/templates/index.js';
|
|
@@ -8,13 +7,20 @@ import { typographyTemplate, spacingsTemplate } from '../../utils/templates/inde
|
|
|
8
7
|
const StyledTitle = styled.div.withConfig({
|
|
9
8
|
displayName: "Title__StyledTitle",
|
|
10
9
|
componentId: "sc-i4qfl5-0"
|
|
11
|
-
})(
|
|
10
|
+
})(({
|
|
11
|
+
theme,
|
|
12
12
|
children
|
|
13
|
-
}) =>
|
|
13
|
+
}) => {
|
|
14
|
+
return css(["", " min-height:", ";align-self:end;justify-self:start;", ";", ""], typographyTemplate(theme.entities.title.typography), theme.entities.title.minHeight, spacingsTemplate(theme.entities.children.spacings), !children && css(["min-height:initial;height:'8px';"]));
|
|
15
|
+
});
|
|
14
16
|
const StyledDivider = styled(Divider).withConfig({
|
|
15
17
|
displayName: "Title__StyledDivider",
|
|
16
18
|
componentId: "sc-i4qfl5-1"
|
|
17
|
-
})(
|
|
19
|
+
})(({
|
|
20
|
+
theme
|
|
21
|
+
}) => {
|
|
22
|
+
return css(["width:100%;margin-bottom:", ";"], theme.entities.divider.spacings.bottom);
|
|
23
|
+
});
|
|
18
24
|
const Title = /*#__PURE__*/forwardRef(function Title({
|
|
19
25
|
children,
|
|
20
26
|
...rest
|
|
@@ -41,7 +41,7 @@ const MenuContainer = /*#__PURE__*/forwardRef(function MenuContainer({
|
|
|
41
41
|
if (onClose === null && onCloseCallback) {
|
|
42
42
|
setOnClose(onCloseCallback);
|
|
43
43
|
}
|
|
44
|
-
});
|
|
44
|
+
}, [onClose, onCloseCallback, setOnClose]);
|
|
45
45
|
useOutsideClick(containerEl, e => {
|
|
46
46
|
if (open && onClose !== null && !anchorEl.contains(e.target)) {
|
|
47
47
|
onClose();
|
|
@@ -72,6 +72,7 @@ const Menu = /*#__PURE__*/forwardRef(function Menu({
|
|
|
72
72
|
...rest
|
|
73
73
|
}, ref) {
|
|
74
74
|
const [containerEl, setContainerEl] = useState(null);
|
|
75
|
+
const [storedAnchorEl, setStoredAnchorEl] = useState(null);
|
|
75
76
|
const isMounted = useIsMounted();
|
|
76
77
|
const {
|
|
77
78
|
density
|
|
@@ -79,10 +80,14 @@ const Menu = /*#__PURE__*/forwardRef(function Menu({
|
|
|
79
80
|
const token = useToken({
|
|
80
81
|
density
|
|
81
82
|
}, menu);
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
open ? setStoredAnchorEl(anchorEl) : setStoredAnchorEl(null);
|
|
85
|
+
return () => setStoredAnchorEl(null);
|
|
86
|
+
}, [anchorEl, open]);
|
|
82
87
|
const {
|
|
83
88
|
styles,
|
|
84
89
|
attributes
|
|
85
|
-
} = usePopper(
|
|
90
|
+
} = usePopper(storedAnchorEl, containerEl, null, placement, 4);
|
|
86
91
|
const props = {
|
|
87
92
|
open,
|
|
88
93
|
style: { ...styles.popper,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { memo } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { menu } from './Menu.tokens.js';
|
|
4
4
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
@@ -12,7 +12,7 @@ const Header = styled.div.attrs(() => ({
|
|
|
12
12
|
displayName: "MenuSection__Header",
|
|
13
13
|
componentId: "sc-gfcbvg-0"
|
|
14
14
|
})(["", " &:focus{outline:none;}"], spacingsTemplate(menu.entities.title.spacings));
|
|
15
|
-
const MenuSection = /*#__PURE__*/
|
|
15
|
+
const MenuSection = /*#__PURE__*/memo(function MenuSection(props) {
|
|
16
16
|
const {
|
|
17
17
|
children,
|
|
18
18
|
title,
|