@equinor/eds-core-react 0.16.1 → 0.17.0-dev.20220209
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} +2731 -2290
- package/dist/esm/components/Accordion/Accordion.js +24 -11
- package/dist/esm/components/Accordion/Accordion.tokens.js +3 -0
- package/dist/esm/components/Accordion/AccordionHeader.js +65 -51
- package/dist/esm/components/Accordion/AccordionHeaderTitle.js +15 -13
- package/dist/esm/components/Accordion/AccordionItem.js +11 -10
- package/dist/esm/components/Accordion/AccordionPanel.js +32 -24
- package/dist/esm/components/Avatar/Avatar.js +21 -14
- package/dist/esm/components/Banner/Banner.js +36 -24
- package/dist/esm/components/Banner/Banner.tokens.js +9 -0
- package/dist/esm/components/Banner/BannerActions.js +16 -17
- package/dist/esm/components/Banner/BannerIcon.js +15 -11
- package/dist/esm/components/Banner/BannerMessage.js +5 -4
- package/dist/esm/components/Breadcrumbs/Breadcrumb.js +16 -12
- package/dist/esm/components/Breadcrumbs/Breadcrumbs.js +7 -6
- package/dist/esm/components/Button/Button.js +17 -18
- package/dist/esm/components/Button/InnerFullWidth.js +5 -4
- package/dist/esm/components/Button/tokens/button.js +17 -10
- package/dist/esm/components/Button/tokens/contained.js +5 -5
- package/dist/esm/components/Button/tokens/ghost.js +4 -4
- package/dist/esm/components/Button/tokens/icon.js +4 -4
- package/dist/esm/components/Button/tokens/outlined.js +5 -5
- package/dist/esm/components/Card/Card.js +19 -12
- package/dist/esm/components/Card/CardActions.js +13 -9
- package/dist/esm/components/Card/CardContent.js +5 -4
- package/dist/esm/components/Card/CardHeader.js +5 -4
- package/dist/esm/components/Card/CardHeaderTitle.js +5 -4
- package/dist/esm/components/Card/CardMedia.js +12 -8
- package/dist/esm/components/Checkbox/Checkbox.js +15 -11
- package/dist/esm/components/Checkbox/Input.js +72 -46
- package/dist/esm/components/Chip/Chip.js +46 -30
- package/dist/esm/components/Chip/Icon.js +12 -7
- package/dist/esm/components/Dialog/Dialog.js +55 -16
- package/dist/esm/components/Dialog/Dialog.tokens.js +7 -12
- package/dist/esm/components/Dialog/DialogActions.js +27 -0
- package/dist/esm/components/Dialog/DialogContent.js +44 -0
- package/dist/esm/components/Dialog/DialogHeader.js +37 -0
- package/dist/esm/components/Dialog/DialogTitle.js +31 -0
- package/dist/esm/components/Dialog/index.js +11 -7
- package/dist/esm/components/Divider/Divider.js +6 -5
- package/dist/esm/components/EdsProvider/eds.context.js +5 -4
- package/dist/esm/components/Icon/Icon.js +77 -46
- package/dist/esm/components/Input/Input.js +12 -12
- package/dist/esm/components/Input/Input.tokens.js +4 -4
- package/dist/esm/components/Label/Label.js +7 -4
- package/dist/esm/components/List/List.js +13 -9
- package/dist/esm/components/List/ListItem.js +5 -4
- package/dist/esm/components/Menu/Menu.context.js +5 -4
- package/dist/esm/components/Menu/Menu.js +39 -30
- package/dist/esm/components/Menu/MenuItem.js +38 -25
- package/dist/esm/components/Menu/MenuList.js +7 -6
- package/dist/esm/components/Menu/MenuSection.js +3 -3
- package/dist/esm/components/Pagination/Pagination.js +16 -12
- package/dist/esm/components/Pagination/PaginationItem.js +7 -6
- package/dist/esm/components/Paper/Paper.js +11 -7
- package/dist/esm/components/Popover/Popover.js +77 -58
- package/dist/esm/components/Popover/Popover.tokens.js +5 -12
- package/dist/esm/components/Popover/PopoverActions.js +28 -0
- package/dist/esm/components/Popover/PopoverContent.js +12 -6
- package/dist/esm/components/Popover/PopoverHeader.js +36 -0
- package/dist/esm/components/Popover/PopoverTitle.js +15 -19
- package/dist/esm/components/Popover/index.js +6 -0
- package/dist/esm/components/Progress/Circular/CircularProgress.js +14 -10
- package/dist/esm/components/Progress/Dots/DotProgress.js +12 -8
- package/dist/esm/components/Progress/Linear/LinearProgress.js +6 -5
- package/dist/esm/components/Progress/Star/StarProgress.js +14 -10
- package/dist/esm/components/Radio/Radio.js +84 -52
- package/dist/esm/components/Scrim/Scrim.js +20 -15
- package/dist/esm/components/Search/Search.js +81 -58
- package/dist/esm/components/Search/Search.tokens.js +8 -4
- package/dist/esm/components/Select/MultiSelect/MultiSelect.js +35 -24
- package/dist/esm/components/Select/NativeSelect/NativeSelect.js +19 -17
- package/dist/esm/components/Select/Select.tokens.js +5 -2
- package/dist/esm/components/Select/SingleSelect/SingleSelect.js +29 -23
- package/dist/esm/components/Select/commonStyles.js +15 -14
- package/dist/esm/components/SideSheet/SideSheet.js +16 -13
- package/dist/esm/components/Slider/MinMax.js +5 -4
- package/dist/esm/components/Slider/Output.js +13 -9
- package/dist/esm/components/Slider/Slider.js +63 -35
- package/dist/esm/components/Slider/SliderInput.js +14 -14
- package/dist/esm/components/Snackbar/Snackbar.js +36 -25
- package/dist/esm/components/Snackbar/Snackbar.tokens.js +3 -0
- package/dist/esm/components/Snackbar/SnackbarAction.js +12 -7
- package/dist/esm/components/Switch/Switch.js +21 -15
- package/dist/esm/components/Switch/Switch.styles.js +24 -17
- package/dist/esm/components/Switch/SwitchDefault.js +39 -29
- package/dist/esm/components/Switch/SwitchSmall.js +38 -28
- package/dist/esm/components/Table/Body.js +5 -4
- package/dist/esm/components/Table/Caption.js +8 -5
- package/dist/esm/components/Table/Cell.js +9 -6
- package/dist/esm/components/Table/DataCell/DataCell.js +15 -14
- package/dist/esm/components/Table/DataCell/DataCell.tokens.js +19 -9
- package/dist/esm/components/Table/Head/Head.js +7 -6
- package/dist/esm/components/Table/HeaderCell/HeaderCell.js +8 -9
- package/dist/esm/components/Table/HeaderCell/HeaderCell.tokens.js +18 -8
- package/dist/esm/components/Table/Row/Row.js +7 -5
- package/dist/esm/components/Table/Table.js +5 -4
- package/dist/esm/components/TableOfContents/LinkItem.js +13 -10
- package/dist/esm/components/TableOfContents/TableOfContents.js +44 -24
- package/dist/esm/components/TableOfContents/TableOfContents.tokens.js +3 -0
- package/dist/esm/components/Tabs/Tab.js +27 -30
- package/dist/esm/components/Tabs/TabList.js +12 -8
- package/dist/esm/components/Tabs/TabPanel.js +16 -12
- package/dist/esm/components/Tabs/TabPanels.js +5 -4
- package/dist/esm/components/Tabs/Tabs.js +37 -24
- package/dist/esm/components/Tabs/Tabs.tokens.js +3 -0
- package/dist/esm/components/TextField/Field.js +51 -38
- package/dist/esm/components/TextField/HelperText/HelperText.js +28 -19
- package/dist/esm/components/TextField/Icon/Icon.js +20 -18
- package/dist/esm/components/TextField/TextField.context.js +4 -3
- package/dist/esm/components/TextField/TextField.js +22 -18
- package/dist/esm/components/Textarea/Textarea.js +16 -16
- package/dist/esm/components/Tooltip/Tooltip.js +10 -16
- package/dist/esm/components/TopBar/Actions.js +5 -4
- package/dist/esm/components/TopBar/CustomContent.js +5 -4
- package/dist/esm/components/TopBar/Header.js +5 -4
- package/dist/esm/components/TopBar/TopBar.js +27 -19
- package/dist/esm/components/TopBar/TopBar.tokens.js +5 -2
- package/dist/esm/components/Typography/Typography.js +49 -28
- package/dist/esm/index.js +1 -0
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_curry1.js +1 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_curry2.js +1 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_curry3.js +1 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_has.js +1 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_isObject.js +1 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/internal/_isPlaceholder.js +1 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/mergeDeepRight.js +2 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/mergeDeepWithKey.js +1 -1
- package/dist/esm/node_modules/.pnpm/{ramda@0.27.1 → ramda@0.27.2}/node_modules/ramda/src/mergeWithKey.js +1 -1
- package/dist/types/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/types/components/Checkbox/Input.d.ts +1 -1
- package/dist/types/components/Dialog/Dialog.d.ts +18 -2
- package/dist/types/components/Dialog/DialogActions.d.ts +3 -0
- package/dist/types/components/Dialog/{CustomContent.d.ts → DialogContent.d.ts} +2 -2
- package/dist/types/components/Dialog/DialogHeader.d.ts +3 -0
- package/dist/types/components/Dialog/DialogTitle.d.ts +3 -0
- package/dist/types/components/Dialog/index.d.ts +10 -7
- 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/Icon/Icon.d.ts +2 -2
- package/dist/types/components/Menu/Menu.d.ts +1 -1
- package/dist/types/components/Menu/MenuSection.d.ts +1 -2
- package/dist/types/components/Popover/Popover.d.ts +1 -1
- package/dist/types/components/Popover/PopoverActions.d.ts +3 -0
- package/dist/types/components/Popover/PopoverHeader.d.ts +3 -0
- package/dist/types/components/Popover/index.d.ts +5 -1
- package/dist/types/components/Progress/Circular/CircularProgress.d.ts +1 -1
- package/dist/types/components/Progress/Dots/DotProgress.d.ts +1 -1
- package/dist/types/components/Progress/Star/StarProgress.d.ts +1 -1
- package/dist/types/components/Scrim/Scrim.d.ts +7 -3
- package/dist/types/components/Switch/Switch.d.ts +1 -1
- package/dist/types/components/Switch/Switch.styles.d.ts +2 -1
- package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/types/components/TopBar/TopBar.tokens.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +47 -39
- package/dist/esm/components/Dialog/Actions.js +0 -24
- package/dist/esm/components/Dialog/CustomContent.js +0 -40
- package/dist/esm/components/Dialog/Title.js +0 -35
- package/dist/esm/hooks/useAutoResize.js +0 -39
- package/dist/esm/hooks/useCombinedRefs.js +0 -14
- package/dist/esm/hooks/useGlobalKeyPress.js +0 -34
- package/dist/esm/hooks/useHideBodyScroll.js +0 -12
- package/dist/esm/hooks/useId.js +0 -14
- package/dist/esm/hooks/useMountedRef.js +0 -12
- package/dist/esm/hooks/useOutsideClick.js +0 -18
- package/dist/esm/hooks/usePopper.js +0 -31
- package/dist/esm/hooks/useToken.js +0 -16
- package/dist/esm/utils/joinHandlers.js +0 -10
- package/dist/esm/utils/setReactInputValue.js +0 -18
- package/dist/esm/utils/templates/borders.js +0 -35
- package/dist/esm/utils/templates/common.js +0 -19
- package/dist/esm/utils/templates/focus.js +0 -35
- package/dist/esm/utils/templates/index.js +0 -52
- 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
- package/dist/types/components/Dialog/Actions.d.ts +0 -3
- package/dist/types/components/Dialog/Title.d.ts +0 -3
- package/dist/types/hooks/index.d.ts +0 -9
- package/dist/types/hooks/useAutoResize.d.ts +0 -1
- package/dist/types/hooks/useCombinedRefs.d.ts +0 -3
- package/dist/types/hooks/useGlobalKeyPress.d.ts +0 -10
- package/dist/types/hooks/useHideBodyScroll.d.ts +0 -1
- package/dist/types/hooks/useId.d.ts +0 -1
- package/dist/types/hooks/useMountedRef.d.ts +0 -1
- package/dist/types/hooks/useOutsideClick.d.ts +0 -1
- package/dist/types/hooks/usePopper.d.ts +0 -12
- package/dist/types/hooks/useToken.d.ts +0 -7
- package/dist/types/utils/index.d.ts +0 -4
- package/dist/types/utils/joinHandlers.d.ts +0 -3
- package/dist/types/utils/setReactInputValue.d.ts +0 -7
- package/dist/types/utils/templates/borders.d.ts +0 -2
- package/dist/types/utils/templates/common.d.ts +0 -9
- package/dist/types/utils/templates/focus.d.ts +0 -2
- package/dist/types/utils/templates/index.d.ts +0 -7
|
@@ -2,67 +2,93 @@ import { forwardRef } from 'react';
|
|
|
2
2
|
import styled, { ThemeProvider } from 'styled-components';
|
|
3
3
|
import { checkbox_indeterminate, checkbox as checkbox$1, checkbox_outline } from '@equinor/eds-icons';
|
|
4
4
|
import { checkbox } from './Checkbox.tokens.js';
|
|
5
|
+
import { outlineTemplate, spacingsTemplate, useToken } from '@equinor/eds-utils';
|
|
5
6
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
-
import { outlineTemplate } from '../../utils/templates/focus.js';
|
|
7
|
-
import { spacingsTemplate } from '../../utils/templates/index.js';
|
|
8
7
|
import { useEds } from '../EdsProvider/eds.context.js';
|
|
9
|
-
import { useToken } from '../../hooks/useToken.js';
|
|
10
8
|
|
|
11
9
|
/* eslint camelcase: "off" */
|
|
12
|
-
const StyledPath = styled.path.attrs(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
const StyledPath = styled.path.attrs(_ref => {
|
|
11
|
+
let {
|
|
12
|
+
icon
|
|
13
|
+
} = _ref;
|
|
14
|
+
return {
|
|
15
|
+
fillRule: 'evenodd',
|
|
16
|
+
clipRule: 'evenodd',
|
|
17
|
+
d: icon.svgPathData
|
|
18
|
+
};
|
|
19
|
+
}).withConfig({
|
|
19
20
|
displayName: "Input__StyledPath",
|
|
20
21
|
componentId: "sc-rqj7qf-0"
|
|
21
22
|
})([""]);
|
|
22
|
-
const Input = styled.input.attrs(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const Input = styled.input.attrs(_ref2 => {
|
|
24
|
+
let {
|
|
25
|
+
type = 'checkbox'
|
|
26
|
+
} = _ref2;
|
|
27
|
+
return {
|
|
28
|
+
type
|
|
29
|
+
};
|
|
30
|
+
}).withConfig({
|
|
27
31
|
displayName: "Input",
|
|
28
32
|
componentId: "sc-rqj7qf-1"
|
|
29
|
-
})(["--scale:", ";appearance:none;width:100%;height:100%;margin:0;grid-area:input;transform:scale(var(--scale));cursor:", ";&:focus{outline:none;}&[data-focus-visible-added]:focus + svg{", "}&:focus-visible + svg{", "}&:not(:checked) ~ svg path[name='checked']{display:none;}&:not(:checked) ~ svg path[name='not-checked']{display:inline;}&:checked ~ svg path[name='not-checked']{display:none;}&:checked ~ svg path[name='checked']{display:inline;}"],
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
33
|
+
})(["--scale:", ";appearance:none;width:100%;height:100%;margin:0;grid-area:input;transform:scale(var(--scale));cursor:", ";&:focus{outline:none;}&[data-focus-visible-added]:focus + svg{", "}&:focus-visible + svg{", "}&:not(:checked) ~ svg path[name='checked']{display:none;}&:not(:checked) ~ svg path[name='not-checked']{display:inline;}&:checked ~ svg path[name='not-checked']{display:none;}&:checked ~ svg path[name='checked']{display:inline;}"], _ref3 => {
|
|
34
|
+
let {
|
|
35
|
+
theme,
|
|
36
|
+
iconSize
|
|
37
|
+
} = _ref3;
|
|
38
|
+
return parseFloat(theme.clickbound.height) / iconSize;
|
|
39
|
+
}, _ref4 => {
|
|
40
|
+
let {
|
|
41
|
+
disabled
|
|
42
|
+
} = _ref4;
|
|
43
|
+
return disabled ? 'not-allowed' : 'pointer';
|
|
44
|
+
}, _ref5 => {
|
|
45
|
+
let {
|
|
46
|
+
theme
|
|
47
|
+
} = _ref5;
|
|
48
|
+
return outlineTemplate(theme.states.focus.outline);
|
|
49
|
+
}, _ref6 => {
|
|
50
|
+
let {
|
|
51
|
+
theme
|
|
52
|
+
} = _ref6;
|
|
53
|
+
return outlineTemplate(theme.states.focus.outline);
|
|
54
|
+
});
|
|
55
|
+
const Svg = styled.svg.attrs(_ref7 => {
|
|
56
|
+
let {
|
|
57
|
+
height,
|
|
58
|
+
width,
|
|
59
|
+
fill
|
|
60
|
+
} = _ref7;
|
|
61
|
+
return {
|
|
62
|
+
name: null,
|
|
63
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
|
64
|
+
height,
|
|
65
|
+
width,
|
|
66
|
+
fill
|
|
67
|
+
};
|
|
68
|
+
}).withConfig({
|
|
50
69
|
displayName: "Input__Svg",
|
|
51
70
|
componentId: "sc-rqj7qf-2"
|
|
52
71
|
})(["grid-area:input;pointer-events:none;"]);
|
|
53
72
|
const InputWrapper = styled.span.withConfig({
|
|
54
73
|
displayName: "Input__InputWrapper",
|
|
55
74
|
componentId: "sc-rqj7qf-3"
|
|
56
|
-
})(["display:inline-grid;grid:[input] 1fr / [input] 1fr;border-radius:50%;", " @media (hover:hover) and (pointer:fine){&:hover{background-color:", ";}}"],
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
})(["display:inline-grid;grid:[input] 1fr / [input] 1fr;border-radius:50%;", " @media (hover:hover) and (pointer:fine){&:hover{background-color:", ";}}"], _ref8 => {
|
|
76
|
+
let {
|
|
77
|
+
theme
|
|
78
|
+
} = _ref8;
|
|
79
|
+
return spacingsTemplate(theme.spacings);
|
|
80
|
+
}, _ref9 => {
|
|
81
|
+
let {
|
|
82
|
+
disabled
|
|
83
|
+
} = _ref9;
|
|
84
|
+
return disabled ? 'transparent' : checkbox.states.hover.background;
|
|
85
|
+
});
|
|
86
|
+
const CheckboxInput = /*#__PURE__*/forwardRef(function CheckboxInput(_ref10, ref) {
|
|
87
|
+
let {
|
|
88
|
+
disabled = false,
|
|
89
|
+
indeterminate,
|
|
90
|
+
...rest
|
|
91
|
+
} = _ref10;
|
|
66
92
|
const {
|
|
67
93
|
density
|
|
68
94
|
} = useEds();
|
|
@@ -2,10 +2,8 @@ import { forwardRef, Children, cloneElement } from 'react';
|
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import { Icon } from './Icon.js';
|
|
4
4
|
import * as Chip_tokens from './Chip.tokens.js';
|
|
5
|
+
import { outlineTemplate, bordersTemplate, spacingsTemplate, typographyTemplate } from '@equinor/eds-utils';
|
|
5
6
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
-
import { outlineTemplate } from '../../utils/templates/focus.js';
|
|
7
|
-
import { bordersTemplate } from '../../utils/templates/borders.js';
|
|
8
|
-
import { spacingsTemplate, typographyTemplate } from '../../utils/templates/index.js';
|
|
9
7
|
|
|
10
8
|
const {
|
|
11
9
|
enabled,
|
|
@@ -19,20 +17,28 @@ const {
|
|
|
19
17
|
border,
|
|
20
18
|
states
|
|
21
19
|
} = enabled;
|
|
22
|
-
const StyledChips = styled.div.attrs(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
const StyledChips = styled.div.attrs(_ref => {
|
|
21
|
+
let {
|
|
22
|
+
clickable,
|
|
23
|
+
deletable
|
|
24
|
+
} = _ref;
|
|
25
|
+
return {
|
|
26
|
+
tabIndex: clickable || deletable ? 0 : null,
|
|
27
|
+
role: clickable ? 'button' : null
|
|
28
|
+
};
|
|
29
|
+
}).withConfig({
|
|
29
30
|
displayName: "Chip__StyledChips",
|
|
30
31
|
componentId: "sc-wzsllq-0"
|
|
31
|
-
})(["background:", ";height:", ";width:fit-content;display:grid;grid-gap:8px;grid-auto-flow:column;grid-auto-columns:max-content;align-items:center;z-index:10;svg{fill:", ";}@media (hover:hover) and (pointer:fine){&:hover{color:", ";svg{fill:", ";}}}&:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}", " ", " ", " ", " ", " ", " ", " ", ""], background, height, typography.color, states.hover.typography.color, states.hover.typography.color, outlineTemplate(states.focus.outline), outlineTemplate(states.focus.outline), bordersTemplate(border), spacingsTemplate(spacings), typographyTemplate(typography),
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
})(["background:", ";height:", ";width:fit-content;display:grid;grid-gap:8px;grid-auto-flow:column;grid-auto-columns:max-content;align-items:center;z-index:10;svg{fill:", ";}@media (hover:hover) and (pointer:fine){&:hover{color:", ";svg{fill:", ";}}}&:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}", " ", " ", " ", " ", " ", " ", " ", ""], background, height, typography.color, states.hover.typography.color, states.hover.typography.color, outlineTemplate(states.focus.outline), outlineTemplate(states.focus.outline), bordersTemplate(border), spacingsTemplate(spacings), typographyTemplate(typography), _ref2 => {
|
|
33
|
+
let {
|
|
34
|
+
clickable
|
|
35
|
+
} = _ref2;
|
|
36
|
+
return clickable && css(["@media (hover:hover) and (pointer:fine){&:hover{cursor:pointer;}}"]);
|
|
37
|
+
}, _ref3 => {
|
|
38
|
+
let {
|
|
39
|
+
variant
|
|
40
|
+
} = _ref3;
|
|
41
|
+
|
|
36
42
|
switch (variant) {
|
|
37
43
|
case 'active':
|
|
38
44
|
return css(["background:", ";"], states.active.background);
|
|
@@ -43,21 +49,31 @@ const StyledChips = styled.div.attrs(({
|
|
|
43
49
|
default:
|
|
44
50
|
return '';
|
|
45
51
|
}
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
}, _ref4 => {
|
|
53
|
+
let {
|
|
54
|
+
disabled
|
|
55
|
+
} = _ref4;
|
|
56
|
+
return disabled && css(["cursor:not-allowed;background:", ";color:", ";svg{fill:", ";}@media (hover:hover) and (pointer:fine){&:hover{color:", ";cursor:not-allowed;svg{fill:", ";}}}"], background, states.disabled.typography.color, states.disabled.typography.color, states.disabled.typography.color, states.disabled.typography.color);
|
|
57
|
+
}, _ref5 => {
|
|
58
|
+
let {
|
|
59
|
+
deletable
|
|
60
|
+
} = _ref5;
|
|
61
|
+
return deletable && css(["padding-right:4px;"]);
|
|
62
|
+
}, _ref6 => {
|
|
63
|
+
let {
|
|
64
|
+
onlyChild
|
|
65
|
+
} = _ref6;
|
|
66
|
+
return onlyChild ? css(["padding-left:8px;"]) : '';
|
|
67
|
+
});
|
|
68
|
+
const Chip = /*#__PURE__*/forwardRef(function Chip(_ref7, ref) {
|
|
69
|
+
let {
|
|
70
|
+
children,
|
|
71
|
+
onDelete,
|
|
72
|
+
disabled = false,
|
|
73
|
+
onClick,
|
|
74
|
+
variant = 'default',
|
|
75
|
+
...other
|
|
76
|
+
} = _ref7;
|
|
61
77
|
const handleDelete = disabled ? undefined : onDelete;
|
|
62
78
|
const handleClick = disabled ? undefined : onClick;
|
|
63
79
|
const deletable = handleDelete !== undefined;
|
|
@@ -2,7 +2,7 @@ import styled, { css } from 'styled-components';
|
|
|
2
2
|
import { close } from '@equinor/eds-icons';
|
|
3
3
|
import { Icon as Icon$1 } from '../Icon/index.js';
|
|
4
4
|
import * as Chip_tokens from './Chip.tokens.js';
|
|
5
|
-
import { bordersTemplate } from '
|
|
5
|
+
import { bordersTemplate } from '@equinor/eds-utils';
|
|
6
6
|
|
|
7
7
|
Icon$1.add({
|
|
8
8
|
close
|
|
@@ -14,9 +14,11 @@ const {
|
|
|
14
14
|
const Icon = styled(Icon$1).withConfig({
|
|
15
15
|
displayName: "Icon",
|
|
16
16
|
componentId: "sc-50ffvg-0"
|
|
17
|
-
})(["cursor:pointer;padding:1px;", " z-index:11;&:hover{", ";}", ""], bordersTemplate(enabled.entities.icon.border),
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
})(["cursor:pointer;padding:1px;", " z-index:11;&:hover{", ";}", ""], bordersTemplate(enabled.entities.icon.border), _ref => {
|
|
18
|
+
let {
|
|
19
|
+
variant
|
|
20
|
+
} = _ref;
|
|
21
|
+
|
|
20
22
|
switch (variant) {
|
|
21
23
|
case 'error':
|
|
22
24
|
return css(["background:", ";svg{fill:", ";}"], error.entities.icon.background, error.entities.icon.typography.color);
|
|
@@ -24,8 +26,11 @@ const Icon = styled(Icon$1).withConfig({
|
|
|
24
26
|
default:
|
|
25
27
|
return css(["background:", ";svg{fill:", ";}"], enabled.entities.icon.states.hover.background, enabled.states.hover.typography.color);
|
|
26
28
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
}, _ref2 => {
|
|
30
|
+
let {
|
|
31
|
+
disabled
|
|
32
|
+
} = _ref2;
|
|
33
|
+
return disabled && css(["cursor:not-allowed;&:hover{background:transparent;}"]);
|
|
34
|
+
});
|
|
30
35
|
|
|
31
36
|
export { Icon };
|
|
@@ -1,30 +1,69 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import styled, { css, ThemeProvider } from 'styled-components';
|
|
4
|
+
import { typographyTemplate, bordersTemplate, useToken } from '@equinor/eds-utils';
|
|
3
5
|
import { dialog } from './Dialog.tokens.js';
|
|
4
|
-
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
5
7
|
import { Paper } from '../Paper/Paper.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
+
import { Scrim } from '../Scrim/Scrim.js';
|
|
9
|
+
import { useEds } from '../EdsProvider/eds.context.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
|
-
})(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
})(_ref => {
|
|
21
|
+
let {
|
|
22
|
+
theme
|
|
23
|
+
} = _ref;
|
|
24
|
+
return css(["width:", ";background:", ";display:grid;grid-auto-columns:auto;", " ", " grid-gap:", ";"], theme.width, theme.background, typographyTemplate(theme.typography), bordersTemplate(theme.border), theme.spacings.bottom);
|
|
25
|
+
});
|
|
26
|
+
const Dialog = /*#__PURE__*/forwardRef(function Dialog(_ref2, ref) {
|
|
27
|
+
let {
|
|
28
|
+
children,
|
|
29
|
+
open,
|
|
30
|
+
onClose,
|
|
31
|
+
isDismissable = false,
|
|
32
|
+
...props
|
|
33
|
+
} = _ref2;
|
|
34
|
+
const rest = { ...props,
|
|
35
|
+
open,
|
|
36
|
+
ref
|
|
37
|
+
};
|
|
38
|
+
const {
|
|
39
|
+
density
|
|
40
|
+
} = useEds();
|
|
41
|
+
const token = useToken({
|
|
42
|
+
density
|
|
43
|
+
}, dialog);
|
|
44
|
+
|
|
45
|
+
const handleDismiss = () => {
|
|
46
|
+
onClose && onClose();
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
if (!open) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
54
|
+
children: /*#__PURE__*/createPortal( /*#__PURE__*/jsx(ThemeProvider, {
|
|
55
|
+
theme: token,
|
|
56
|
+
children: /*#__PURE__*/jsx(Scrim, {
|
|
57
|
+
open: true,
|
|
58
|
+
isDismissable: isDismissable,
|
|
59
|
+
onClose: handleDismiss,
|
|
60
|
+
children: /*#__PURE__*/jsx(StyledDialog, {
|
|
61
|
+
elevation: "above_scrim",
|
|
62
|
+
...rest,
|
|
63
|
+
children: children
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
}), document.body)
|
|
28
67
|
});
|
|
29
68
|
}); // Dialog.displayName = 'EdsDialog'
|
|
30
69
|
|
|
@@ -36,22 +36,17 @@ const dialog = {
|
|
|
36
36
|
radius: borderRadius
|
|
37
37
|
},
|
|
38
38
|
spacings: {
|
|
39
|
-
|
|
39
|
+
bottom: spacingMedium
|
|
40
40
|
},
|
|
41
41
|
entities: {
|
|
42
42
|
children: {
|
|
43
43
|
spacings: {
|
|
44
|
-
top:
|
|
45
|
-
bottom:
|
|
44
|
+
top: spacingMedium,
|
|
45
|
+
bottom: spacingMedium,
|
|
46
46
|
left: spacingMedium,
|
|
47
47
|
right: spacingMedium
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
-
divider: {
|
|
51
|
-
spacings: {
|
|
52
|
-
bottom: spacingMedium
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
50
|
title: {
|
|
56
51
|
minHeight: '24px',
|
|
57
52
|
typography: accordion_header
|
|
@@ -59,14 +54,14 @@ const dialog = {
|
|
|
59
54
|
content: {
|
|
60
55
|
minHeight: '80px',
|
|
61
56
|
height: '104px',
|
|
62
|
-
typography: body_long
|
|
63
|
-
spacings: {
|
|
64
|
-
bottom: spacingMedium
|
|
65
|
-
}
|
|
57
|
+
typography: body_long
|
|
66
58
|
},
|
|
67
59
|
actions: {
|
|
68
60
|
minHeight: '48px'
|
|
69
61
|
}
|
|
62
|
+
},
|
|
63
|
+
modes: {
|
|
64
|
+
compact: {}
|
|
70
65
|
}
|
|
71
66
|
};
|
|
72
67
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
const StyledDialogActions = styled.div.withConfig({
|
|
6
|
+
displayName: "DialogActions__StyledDialogActions",
|
|
7
|
+
componentId: "sc-16ydtxd-0"
|
|
8
|
+
})(_ref => {
|
|
9
|
+
let {
|
|
10
|
+
theme,
|
|
11
|
+
children
|
|
12
|
+
} = _ref;
|
|
13
|
+
return css(["align-self:end;justify-self:start;padding:0 ", " 0 ", ";&:first-child{padding-top:", ";}&:last-child{padding-bottom:", ";}", ""], theme.entities.children.spacings.right, theme.entities.children.spacings.left, theme.entities.children.spacings.top, theme.entities.children.spacings.bottom, !children && css(["min-height:initial;height:'8px';"]));
|
|
14
|
+
});
|
|
15
|
+
const DialogActions = /*#__PURE__*/forwardRef(function DialogActions(_ref2, ref) {
|
|
16
|
+
let {
|
|
17
|
+
children,
|
|
18
|
+
...props
|
|
19
|
+
} = _ref2;
|
|
20
|
+
return /*#__PURE__*/jsx(StyledDialogActions, {
|
|
21
|
+
ref: ref,
|
|
22
|
+
...props,
|
|
23
|
+
children: children
|
|
24
|
+
});
|
|
25
|
+
}); // Actions.displayName = 'EdsDialogActions'
|
|
26
|
+
|
|
27
|
+
export { DialogActions };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { typographyTemplate } from '@equinor/eds-utils';
|
|
4
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
5
|
+
import { Divider } from '../Divider/Divider.js';
|
|
6
|
+
|
|
7
|
+
const StyledDialogContent = styled.div.withConfig({
|
|
8
|
+
displayName: "DialogContent__StyledDialogContent",
|
|
9
|
+
componentId: "sc-1tze18k-0"
|
|
10
|
+
})(_ref => {
|
|
11
|
+
let {
|
|
12
|
+
theme,
|
|
13
|
+
scrollable
|
|
14
|
+
} = _ref;
|
|
15
|
+
return css(["", " min-height:", ";align-self:stretch;justify-self:stretch;padding:0 ", " 0 ", ";&:first-child{padding-top:", ";}&:last-child{padding-bottom:", ";}", ""], typographyTemplate(theme.entities.content.typography), theme.entities.content.minHeight, theme.entities.children.spacings.right, theme.entities.children.spacings.left, theme.entities.children.spacings.top, theme.entities.children.spacings.bottom, scrollable && css(["min-height:initial;height:", ";overflow-y:auto;"], theme.entities.content.height));
|
|
16
|
+
});
|
|
17
|
+
const StyledDivider = styled(Divider).withConfig({
|
|
18
|
+
displayName: "DialogContent__StyledDivider",
|
|
19
|
+
componentId: "sc-1tze18k-1"
|
|
20
|
+
})(["width:100%;margin-bottom:0;"]);
|
|
21
|
+
const DialogContent = /*#__PURE__*/forwardRef(function DialogContent(_ref2, ref) {
|
|
22
|
+
let {
|
|
23
|
+
children,
|
|
24
|
+
scrollable = false,
|
|
25
|
+
...rest
|
|
26
|
+
} = _ref2;
|
|
27
|
+
const props = {
|
|
28
|
+
scrollable,
|
|
29
|
+
ref,
|
|
30
|
+
...rest
|
|
31
|
+
};
|
|
32
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
33
|
+
children: [/*#__PURE__*/jsx(StyledDialogContent, {
|
|
34
|
+
id: "eds-dialog-customcontent",
|
|
35
|
+
...props,
|
|
36
|
+
children: children
|
|
37
|
+
}), children && scrollable && /*#__PURE__*/jsx(StyledDivider, {
|
|
38
|
+
color: "medium",
|
|
39
|
+
variant: "small"
|
|
40
|
+
})]
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export { DialogContent };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { Divider } from '../Divider/Divider.js';
|
|
5
|
+
|
|
6
|
+
const StyledDialogHeader = styled.div.withConfig({
|
|
7
|
+
displayName: "DialogHeader__StyledDialogHeader",
|
|
8
|
+
componentId: "sc-mbwcos-0"
|
|
9
|
+
})(_ref => {
|
|
10
|
+
let {
|
|
11
|
+
theme
|
|
12
|
+
} = _ref;
|
|
13
|
+
return css(["display:flex;justify-content:space-betweene;algin-items:center;padding:", " ", " 0 ", ";"], theme.entities.children.spacings.top, theme.entities.children.spacings.right, theme.entities.children.spacings.left);
|
|
14
|
+
});
|
|
15
|
+
const StyledDivider = styled(Divider).withConfig({
|
|
16
|
+
displayName: "DialogHeader__StyledDivider",
|
|
17
|
+
componentId: "sc-mbwcos-1"
|
|
18
|
+
})(["margin-bottom:0;"]);
|
|
19
|
+
const DialogHeader = /*#__PURE__*/forwardRef(function DialogHeader(_ref2, ref) {
|
|
20
|
+
let {
|
|
21
|
+
children,
|
|
22
|
+
...rest
|
|
23
|
+
} = _ref2;
|
|
24
|
+
const props = { ...rest,
|
|
25
|
+
ref
|
|
26
|
+
};
|
|
27
|
+
return /*#__PURE__*/jsxs("div", { ...props,
|
|
28
|
+
children: [/*#__PURE__*/jsx(StyledDialogHeader, {
|
|
29
|
+
children: children
|
|
30
|
+
}), /*#__PURE__*/jsx(StyledDivider, {
|
|
31
|
+
variant: "small",
|
|
32
|
+
color: "medium"
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export { DialogHeader };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { typographyTemplate } from '@equinor/eds-utils';
|
|
4
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
const StyledDialogTitle = styled.div.withConfig({
|
|
7
|
+
displayName: "DialogTitle__StyledDialogTitle",
|
|
8
|
+
componentId: "sc-1t3jljt-0"
|
|
9
|
+
})(_ref => {
|
|
10
|
+
let {
|
|
11
|
+
theme,
|
|
12
|
+
children
|
|
13
|
+
} = _ref;
|
|
14
|
+
return css(["", " min-height:", ";align-self:end;justify-self:start;margin-right:", ";", ""], typographyTemplate(theme.entities.title.typography), theme.entities.title.minHeight, theme.entities.children.spacings.right, !children && css(["min-height:initial;height:'8px';"]));
|
|
15
|
+
});
|
|
16
|
+
const DialogTitle = /*#__PURE__*/forwardRef(function DialogTitle(_ref2, ref) {
|
|
17
|
+
let {
|
|
18
|
+
children,
|
|
19
|
+
...rest
|
|
20
|
+
} = _ref2;
|
|
21
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
22
|
+
children: /*#__PURE__*/jsx(StyledDialogTitle, {
|
|
23
|
+
id: "eds-dialog-title",
|
|
24
|
+
ref: ref,
|
|
25
|
+
...rest,
|
|
26
|
+
children: children
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export { DialogTitle };
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { Dialog as Dialog$1 } from './Dialog.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { DialogActions } from './DialogActions.js';
|
|
3
|
+
import { DialogTitle } from './DialogTitle.js';
|
|
4
|
+
import { DialogContent } from './DialogContent.js';
|
|
5
|
+
import { DialogHeader } from './DialogHeader.js';
|
|
5
6
|
|
|
6
7
|
const Dialog = Dialog$1;
|
|
7
|
-
Dialog.Actions =
|
|
8
|
-
Dialog.Title =
|
|
9
|
-
Dialog.CustomContent =
|
|
8
|
+
Dialog.Actions = DialogActions;
|
|
9
|
+
Dialog.Title = DialogTitle;
|
|
10
|
+
Dialog.CustomContent = DialogContent;
|
|
11
|
+
Dialog.Content = DialogContent;
|
|
12
|
+
Dialog.Header = DialogHeader;
|
|
10
13
|
Dialog.Actions.displayName = 'Dialog.Actions';
|
|
11
14
|
Dialog.Title.displayName = 'Dialog.Title';
|
|
12
|
-
Dialog.
|
|
15
|
+
Dialog.Content.displayName = 'Dialog.Content';
|
|
16
|
+
Dialog.Header.displayName = 'Dialog.Header';
|
|
13
17
|
|
|
14
18
|
export { Dialog };
|
|
@@ -11,11 +11,12 @@ const StyledDivider = styled.hr.withConfig({
|
|
|
11
11
|
displayName: "Divider__StyledDivider",
|
|
12
12
|
componentId: "sc-1d8osde-0"
|
|
13
13
|
})(["border:none;background-color:", ";margin-top:", ";margin-bottom:", ";height:", ";"], props => props.backgroundColor, props => props.marginTop, props => props.marginBottom, props => props.dividerHeight);
|
|
14
|
-
const Divider = /*#__PURE__*/forwardRef(function Divider({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const Divider = /*#__PURE__*/forwardRef(function Divider(_ref, ref) {
|
|
15
|
+
let {
|
|
16
|
+
color = 'medium',
|
|
17
|
+
variant = 'medium',
|
|
18
|
+
...rest
|
|
19
|
+
} = _ref;
|
|
19
20
|
const colorValue = color === 'medium' ? 'mediumColor' : color;
|
|
20
21
|
const props = {
|
|
21
22
|
backgroundColor: divider[colorValue].background,
|
|
@@ -5,10 +5,11 @@ const initalState = {
|
|
|
5
5
|
density: 'comfortable'
|
|
6
6
|
};
|
|
7
7
|
const EdsContext = /*#__PURE__*/createContext(initalState);
|
|
8
|
-
const EdsProvider =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const EdsProvider = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
children,
|
|
11
|
+
density = 'comfortable'
|
|
12
|
+
} = _ref;
|
|
12
13
|
const [state, setState] = useState({ ...initalState,
|
|
13
14
|
density
|
|
14
15
|
});
|