@equinor/eds-core-react 0.23.0 → 0.24.0-dev.20221006
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 +4139 -5171
- package/dist/esm/components/Accordion/Accordion.js +26 -21
- package/dist/esm/components/Accordion/Accordion.tokens.js +23 -62
- package/dist/esm/components/Accordion/AccordionHeader.js +55 -74
- package/dist/esm/components/Accordion/AccordionHeaderActions.js +19 -23
- package/dist/esm/components/Accordion/AccordionHeaderTitle.js +19 -23
- package/dist/esm/components/Accordion/AccordionItem.js +32 -25
- package/dist/esm/components/Accordion/AccordionPanel.js +22 -27
- package/dist/esm/components/Accordion/index.js +1 -1
- package/dist/esm/components/Autocomplete/Autocomplete.js +279 -272
- package/dist/esm/components/Autocomplete/Autocomplete.tokens.js +18 -27
- package/dist/esm/components/Autocomplete/Option.js +27 -25
- package/dist/esm/components/Avatar/Avatar.js +23 -22
- package/dist/esm/components/Avatar/Avatar.tokens.js +1 -1
- package/dist/esm/components/Banner/Banner.js +31 -27
- package/dist/esm/components/Banner/Banner.tokens.js +19 -47
- package/dist/esm/components/Banner/BannerActions.js +21 -20
- package/dist/esm/components/Banner/BannerIcon.js +28 -28
- package/dist/esm/components/Banner/BannerMessage.js +16 -14
- package/dist/esm/components/Banner/index.js +1 -1
- package/dist/esm/components/Breadcrumbs/Breadcrumb.js +29 -28
- package/dist/esm/components/Breadcrumbs/Breadcrumbs.js +47 -40
- package/dist/esm/components/Breadcrumbs/Breadcrumbs.tokens.js +5 -20
- package/dist/esm/components/Breadcrumbs/index.js +1 -1
- package/dist/esm/components/Button/Button.js +49 -46
- package/dist/esm/components/Button/ButtonGroup/ButtonGroup.js +22 -24
- package/dist/esm/components/Button/ButtonGroup/ButtonGroup.tokens.js +2 -8
- package/dist/esm/components/Button/InnerFullWidth.js +10 -9
- package/dist/esm/components/Button/ToggleButton/ToggleButton.js +31 -21
- package/dist/esm/components/Button/index.js +1 -1
- package/dist/esm/components/Button/tokens/button.js +31 -60
- package/dist/esm/components/Button/tokens/contained.js +14 -38
- package/dist/esm/components/Button/tokens/contained_icon.js +10 -13
- package/dist/esm/components/Button/tokens/ghost.js +13 -36
- package/dist/esm/components/Button/tokens/icon.js +20 -46
- package/dist/esm/components/Button/tokens/index.js +1 -1
- package/dist/esm/components/Button/tokens/outlined.js +15 -42
- package/dist/esm/components/Card/Card.js +28 -26
- package/dist/esm/components/Card/Card.tokens.js +11 -32
- package/dist/esm/components/Card/CardActions.js +24 -23
- package/dist/esm/components/Card/CardContent.js +13 -13
- package/dist/esm/components/Card/CardHeader.js +15 -14
- package/dist/esm/components/Card/CardHeaderTitle.js +14 -11
- package/dist/esm/components/Card/CardMedia.js +21 -21
- package/dist/esm/components/Card/index.js +1 -1
- package/dist/esm/components/Checkbox/Checkbox.js +20 -20
- package/dist/esm/components/Checkbox/Checkbox.tokens.js +14 -39
- package/dist/esm/components/Checkbox/Input.js +63 -78
- package/dist/esm/components/Chip/Chip.js +60 -70
- package/dist/esm/components/Chip/Chip.tokens.js +27 -68
- package/dist/esm/components/Chip/Icon.js +9 -15
- package/dist/esm/components/Dialog/Dialog.js +36 -31
- package/dist/esm/components/Dialog/Dialog.tokens.js +8 -29
- package/dist/esm/components/Dialog/DialogActions.js +15 -15
- package/dist/esm/components/Dialog/DialogContent.js +23 -22
- package/dist/esm/components/Dialog/DialogHeader.js +17 -16
- package/dist/esm/components/Dialog/DialogTitle.js +15 -15
- package/dist/esm/components/Dialog/index.js +1 -1
- package/dist/esm/components/Divider/Divider.js +28 -25
- package/dist/esm/components/Divider/Divider.tokens.js +10 -24
- package/dist/esm/components/EdsProvider/eds.context.js +26 -16
- package/dist/esm/components/Icon/Icon.js +63 -67
- package/dist/esm/components/Icon/index.js +1 -1
- package/dist/esm/components/Icon/library.js +8 -8
- package/dist/esm/components/Input/Input.js +37 -40
- package/dist/esm/components/Input/Input.tokens.js +32 -43
- package/dist/esm/components/Label/Label.js +19 -17
- package/dist/esm/components/Label/Label.tokens.js +7 -10
- package/dist/esm/components/List/List.js +18 -19
- package/dist/esm/components/List/List.tokens.js +2 -6
- package/dist/esm/components/List/ListItem.js +9 -7
- package/dist/esm/components/List/index.js +1 -1
- package/dist/esm/components/Menu/Menu.context.js +45 -34
- package/dist/esm/components/Menu/Menu.js +92 -90
- package/dist/esm/components/Menu/Menu.tokens.js +24 -54
- package/dist/esm/components/Menu/MenuItem.js +50 -58
- package/dist/esm/components/Menu/MenuList.js +54 -50
- package/dist/esm/components/Menu/MenuSection.js +9 -9
- package/dist/esm/components/Menu/index.js +1 -1
- package/dist/esm/components/Pagination/Pagination.js +75 -71
- package/dist/esm/components/Pagination/Pagination.tokens.js +5 -18
- package/dist/esm/components/Pagination/PaginationItem.js +21 -19
- package/dist/esm/components/Pagination/paginationControl.js +22 -18
- package/dist/esm/components/Paper/Paper.js +15 -14
- package/dist/esm/components/Paper/Paper.tokens.js +4 -12
- package/dist/esm/components/Popover/Popover.js +85 -88
- package/dist/esm/components/Popover/Popover.tokens.js +8 -27
- package/dist/esm/components/Popover/PopoverActions.js +16 -16
- package/dist/esm/components/Popover/PopoverContent.js +16 -15
- package/dist/esm/components/Popover/PopoverHeader.js +17 -16
- package/dist/esm/components/Popover/PopoverTitle.js +16 -15
- package/dist/esm/components/Popover/index.js +1 -1
- package/dist/esm/components/Progress/Circular/CircularProgress.js +46 -34
- package/dist/esm/components/Progress/Circular/CircularProgress.tokens.js +8 -24
- package/dist/esm/components/Progress/Dots/DotProgress.js +23 -20
- package/dist/esm/components/Progress/Dots/DotProgress.tokens.js +8 -20
- package/dist/esm/components/Progress/Linear/LinearProgress.js +34 -24
- package/dist/esm/components/Progress/Linear/LinearProgress.tokens.js +4 -13
- package/dist/esm/components/Progress/Star/StarProgress.js +29 -25
- package/dist/esm/components/Progress/Star/StarProgress.tokens.js +2 -10
- package/dist/esm/components/Progress/index.js +1 -1
- package/dist/esm/components/Radio/Radio.js +57 -76
- package/dist/esm/components/Radio/Radio.tokens.js +14 -39
- package/dist/esm/components/Scrim/Scrim.js +24 -21
- package/dist/esm/components/Scrim/Scrim.tokens.js +3 -11
- package/dist/esm/components/Search/Search.js +130 -117
- package/dist/esm/components/Search/Search.tokens.js +12 -36
- package/dist/esm/components/Select/MultiSelect/MultiSelect.js +115 -105
- package/dist/esm/components/Select/NativeSelect/NativeSelect.js +45 -43
- package/dist/esm/components/Select/NativeSelect/NativeSelect.tokens.js +10 -14
- package/dist/esm/components/Select/Select.tokens.js +18 -27
- package/dist/esm/components/Select/SingleSelect/SingleSelect.js +86 -79
- package/dist/esm/components/Select/commonStyles.js +14 -26
- package/dist/esm/components/SideSheet/SideSheet.js +29 -27
- package/dist/esm/components/SideSheet/SideSheet.tokens.js +12 -28
- package/dist/esm/components/Slider/MinMax.js +6 -11
- package/dist/esm/components/Slider/Output.js +10 -17
- package/dist/esm/components/Slider/Slider.js +126 -116
- package/dist/esm/components/Slider/Slider.tokens.js +19 -51
- package/dist/esm/components/Slider/SliderInput.js +35 -37
- package/dist/esm/components/Snackbar/Snackbar.js +45 -34
- package/dist/esm/components/Snackbar/Snackbar.tokens.js +17 -44
- package/dist/esm/components/Snackbar/SnackbarAction.js +16 -15
- package/dist/esm/components/Snackbar/index.js +1 -1
- package/dist/esm/components/Switch/Switch.js +37 -38
- package/dist/esm/components/Switch/Switch.styles.js +14 -20
- package/dist/esm/components/Switch/Switch.tokens.js +25 -70
- package/dist/esm/components/Switch/SwitchDefault.js +27 -37
- package/dist/esm/components/Switch/SwitchSmall.js +28 -41
- package/dist/esm/components/Table/Body.js +10 -8
- package/dist/esm/components/Table/Caption.js +9 -9
- package/dist/esm/components/Table/Cell.js +14 -16
- package/dist/esm/components/Table/DataCell/DataCell.js +27 -28
- package/dist/esm/components/Table/DataCell/DataCell.tokens.js +38 -73
- package/dist/esm/components/Table/Head/Head.js +12 -10
- package/dist/esm/components/Table/Head/Head.tokens.js +4 -15
- package/dist/esm/components/Table/HeaderCell/HeaderCell.js +30 -32
- package/dist/esm/components/Table/HeaderCell/HeaderCell.tokens.js +28 -62
- package/dist/esm/components/Table/Inner.context.js +2 -2
- package/dist/esm/components/Table/Row/Row.js +11 -13
- package/dist/esm/components/Table/Row/Row.tokens.js +4 -13
- package/dist/esm/components/Table/Table.js +10 -8
- package/dist/esm/components/Table/index.js +1 -1
- package/dist/esm/components/TableOfContents/LinkItem.js +12 -12
- package/dist/esm/components/TableOfContents/TableOfContents.js +28 -28
- package/dist/esm/components/TableOfContents/TableOfContents.tokens.js +21 -43
- package/dist/esm/components/TableOfContents/index.js +1 -1
- package/dist/esm/components/Tabs/Tab.js +15 -21
- package/dist/esm/components/Tabs/TabList.js +61 -52
- package/dist/esm/components/Tabs/TabPanel.js +18 -20
- package/dist/esm/components/Tabs/TabPanels.js +22 -18
- package/dist/esm/components/Tabs/Tabs.context.js +5 -3
- package/dist/esm/components/Tabs/Tabs.js +60 -39
- package/dist/esm/components/Tabs/Tabs.tokens.js +21 -55
- package/dist/esm/components/Tabs/index.js +1 -1
- package/dist/esm/components/TextField/Field.js +78 -85
- package/dist/esm/components/TextField/HelperText/HelperText.js +37 -40
- package/dist/esm/components/TextField/HelperText/HelperText.token.js +5 -9
- package/dist/esm/components/TextField/Icon/Icon.js +41 -40
- package/dist/esm/components/TextField/Icon/Icon.tokens.js +4 -8
- package/dist/esm/components/TextField/TextField.context.js +29 -19
- package/dist/esm/components/TextField/TextField.js +59 -57
- package/dist/esm/components/TextField/TextField.tokens.js +12 -16
- package/dist/esm/components/Textarea/Textarea.js +56 -58
- package/dist/esm/components/Tooltip/Tooltip.js +76 -64
- package/dist/esm/components/Tooltip/Tooltip.tokens.js +13 -32
- package/dist/esm/components/TopBar/Actions.js +12 -10
- package/dist/esm/components/TopBar/CustomContent.js +12 -10
- package/dist/esm/components/TopBar/Header.js +12 -10
- package/dist/esm/components/TopBar/TopBar.js +29 -25
- package/dist/esm/components/TopBar/TopBar.tokens.js +4 -10
- package/dist/esm/components/TopBar/index.js +1 -1
- package/dist/esm/components/Typography/Typography.js +44 -50
- package/dist/esm/components/Typography/Typography.tokens.js +25 -49
- package/dist/esm/node_modules/.pnpm/ramda@0.28.0/node_modules/ramda/es/internal/_isPlaceholder.js +3 -1
- package/dist/types/components/Autocomplete/Autocomplete.d.ts +4 -0
- package/package.json +4 -10
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
1
4
|
import { forwardRef, useState, Children, Fragment } from 'react';
|
|
2
5
|
import styled from 'styled-components';
|
|
3
6
|
import { breadcrumbs } from './Breadcrumbs.tokens.js';
|
|
@@ -5,44 +8,45 @@ import { spacingsTemplate } from '@equinor/eds-utils';
|
|
|
5
8
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
9
|
import { Typography } from '../Typography/Typography.js';
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const OrderedList = styled.ol.withConfig({
|
|
11
|
+
var _excluded = ["children", "collapse"];
|
|
12
|
+
var spacings = breadcrumbs.spacings,
|
|
13
|
+
typography = breadcrumbs.typography,
|
|
14
|
+
states = breadcrumbs.states;
|
|
15
|
+
var OrderedList = styled.ol.withConfig({
|
|
14
16
|
displayName: "Breadcrumbs__OrderedList",
|
|
15
17
|
componentId: "sc-12awlbz-0"
|
|
16
18
|
})(["list-style:none;display:flex;padding:0;margin:0;flex-wrap:wrap;"]);
|
|
17
|
-
|
|
19
|
+
var ListItem = styled.li.withConfig({
|
|
18
20
|
displayName: "Breadcrumbs__ListItem",
|
|
19
21
|
componentId: "sc-12awlbz-1"
|
|
20
22
|
})(["display:inline-block;"]);
|
|
21
|
-
|
|
23
|
+
var Separator = styled(Typography).withConfig({
|
|
22
24
|
displayName: "Breadcrumbs__Separator",
|
|
23
25
|
componentId: "sc-12awlbz-2"
|
|
24
26
|
})(["color:", ";", ""], typography.color, spacingsTemplate(spacings));
|
|
25
|
-
|
|
27
|
+
var Collapsed = styled(Typography).withConfig({
|
|
26
28
|
displayName: "Breadcrumbs__Collapsed",
|
|
27
29
|
componentId: "sc-12awlbz-3"
|
|
28
30
|
})(["@media (hover:hover) and (pointer:fine){&:hover{text-decoration:underline;color:", ";}}color:", ";text-decoration:none;"], states.hover.typography.color, typography.color);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
const [expanded, setExpanded] = useState(false);
|
|
31
|
+
var Breadcrumbs = /*#__PURE__*/forwardRef(function Breadcrumbs(_ref, ref) {
|
|
32
|
+
var children = _ref.children,
|
|
33
|
+
collapse = _ref.collapse,
|
|
34
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
35
|
+
|
|
36
|
+
var props = _objectSpread(_objectSpread({}, rest), {}, {
|
|
37
|
+
ref: ref
|
|
38
|
+
});
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
var _useState = useState(false),
|
|
41
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
42
|
+
expanded = _useState2[0],
|
|
43
|
+
setExpanded = _useState2[1];
|
|
44
|
+
|
|
45
|
+
var collapsedCrumbs = function collapsedCrumbs(allCrumbs) {
|
|
46
|
+
var handleExpandClick = function handleExpandClick(e) {
|
|
42
47
|
setExpanded(true);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} = e;
|
|
48
|
+
var _ref2 = e,
|
|
49
|
+
key = _ref2.key;
|
|
46
50
|
|
|
47
51
|
if (key === 'Enter') {
|
|
48
52
|
setExpanded(true);
|
|
@@ -74,26 +78,29 @@ const Breadcrumbs = /*#__PURE__*/forwardRef(function Breadcrumbs(_ref, ref) {
|
|
|
74
78
|
}, "collapsed"), allCrumbs[allCrumbs.length - 1]];
|
|
75
79
|
};
|
|
76
80
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
81
|
+
var allCrumbs = Children.toArray(children).map(function (child, index) {
|
|
82
|
+
return (
|
|
83
|
+
/*#__PURE__*/
|
|
84
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
85
|
+
jsxs(Fragment, {
|
|
86
|
+
children: [/*#__PURE__*/jsx(ListItem, {
|
|
87
|
+
children: child
|
|
88
|
+
}), index !== Children.toArray(children).length - 1 && /*#__PURE__*/jsx("li", {
|
|
89
|
+
"aria-hidden": true,
|
|
90
|
+
children: /*#__PURE__*/jsx(Separator, {
|
|
91
|
+
variant: "body_short",
|
|
92
|
+
children: "/"
|
|
93
|
+
})
|
|
94
|
+
})]
|
|
95
|
+
}, "breadcrumb-".concat(index))
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
return /*#__PURE__*/jsx("nav", _objectSpread(_objectSpread({}, props), {}, {
|
|
92
99
|
"aria-label": "breadcrumbs",
|
|
93
100
|
children: /*#__PURE__*/jsx(OrderedList, {
|
|
94
101
|
children: collapse && !expanded ? collapsedCrumbs(allCrumbs) : allCrumbs
|
|
95
102
|
})
|
|
96
|
-
});
|
|
103
|
+
}));
|
|
97
104
|
}); // Breadcrumbs.displayName = 'eds-breadcrumbs'
|
|
98
105
|
|
|
99
106
|
export { Breadcrumbs };
|
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
import { tokens } from '@equinor/eds-tokens';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
interactive: {
|
|
11
|
-
primary__resting: {
|
|
12
|
-
rgba: hoverColor
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
spacings: {
|
|
17
|
-
comfortable: {
|
|
18
|
-
medium: spacingMedium
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
} = tokens;
|
|
22
|
-
const breadcrumbs = {
|
|
3
|
+
var _tokens$colors = tokens.colors,
|
|
4
|
+
enabledColor = _tokens$colors.text.static_icons__tertiary.rgba,
|
|
5
|
+
hoverColor = _tokens$colors.interactive.primary__resting.rgba,
|
|
6
|
+
spacingMedium = tokens.spacings.comfortable.medium;
|
|
7
|
+
var breadcrumbs = {
|
|
23
8
|
spacings: {
|
|
24
9
|
left: spacingMedium,
|
|
25
10
|
right: spacingMedium
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Breadcrumbs as Breadcrumbs$1 } from './Breadcrumbs.js';
|
|
2
2
|
import { Breadcrumb } from './Breadcrumb.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
var Breadcrumbs = Breadcrumbs$1;
|
|
5
5
|
Breadcrumbs.Breadcrumb = Breadcrumb;
|
|
6
6
|
Breadcrumbs.Breadcrumb.displayName = 'Breadcrumbs.Breadcrumb';
|
|
7
7
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
1
3
|
import { forwardRef } from 'react';
|
|
2
4
|
import styled, { css, ThemeProvider } from 'styled-components';
|
|
3
5
|
import { token } from './tokens/index.js';
|
|
@@ -6,7 +8,9 @@ import { InnerFullWidth } from './InnerFullWidth.js';
|
|
|
6
8
|
import { jsx } from 'react/jsx-runtime';
|
|
7
9
|
import { useEds } from '../EdsProvider/eds.context.js';
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
var _excluded = ["color", "variant", "children", "disabled", "href", "tabIndex", "fullWidth"];
|
|
12
|
+
|
|
13
|
+
var getVariant = function getVariant(tokenSet, variant) {
|
|
10
14
|
switch (variant) {
|
|
11
15
|
case 'ghost':
|
|
12
16
|
return tokenSet.ghost;
|
|
@@ -26,7 +30,7 @@ const getVariant = (tokenSet, variant) => {
|
|
|
26
30
|
}
|
|
27
31
|
};
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
var getToken = function getToken(variant, color) {
|
|
30
34
|
switch (color) {
|
|
31
35
|
case 'danger':
|
|
32
36
|
return getVariant(token.danger, variant);
|
|
@@ -40,68 +44,67 @@ const getToken = (variant, color) => {
|
|
|
40
44
|
}
|
|
41
45
|
};
|
|
42
46
|
|
|
43
|
-
|
|
47
|
+
var Inner = styled.span.withConfig({
|
|
44
48
|
displayName: "Button__Inner",
|
|
45
49
|
componentId: "sc-1hs0myn-0"
|
|
46
50
|
})(["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
|
-
|
|
51
|
+
var ButtonBase = styled.button.withConfig({
|
|
48
52
|
displayName: "Button__ButtonBase",
|
|
49
53
|
componentId: "sc-1hs0myn-1"
|
|
50
|
-
})(_ref
|
|
54
|
+
})(function (_ref) {
|
|
51
55
|
var _clickbound$offset, _clickbound$offset2, _hover$typography;
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
} = theme;
|
|
60
|
-
const {
|
|
61
|
-
focus,
|
|
62
|
-
hover,
|
|
63
|
-
disabled
|
|
64
|
-
} = states;
|
|
57
|
+
var theme = _ref.theme;
|
|
58
|
+
var states = theme.states,
|
|
59
|
+
clickbound = theme.clickbound;
|
|
60
|
+
var focus = states.focus,
|
|
61
|
+
hover = states.hover,
|
|
62
|
+
disabled = states.disabled;
|
|
65
63
|
return css(["box-sizing:border-box;margin:0;padding:0;text-decoration:none;position:relative;cursor:pointer;display:inline-block;background:", ";height:", ";width:", ";svg{justify-self:center;}", " ", " ", " &::before{position:absolute;top:0;left:0;width:auto;min-height:auto;content:'';}&::after{position:absolute;top:-", ";left:-", ";width:", ";height:", ";content:'';}@media (hover:hover) and (pointer:fine){&:hover{background:", ";color:", ";", ";}}&:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}&::-moz-focus-inner{border:0;}&:disabled{cursor:not-allowed;background:", ";", ";", ";@media (hover:hover) and (pointer:fine){&:hover{background:", ";}}}"], theme.background, theme.height, theme.width, spacingsTemplate(theme.spacings), bordersTemplate(theme.border), typographyTemplate(theme.typography), clickbound === null || clickbound === void 0 ? void 0 : (_clickbound$offset = clickbound.offset) === null || _clickbound$offset === void 0 ? void 0 : _clickbound$offset.top, clickbound === null || clickbound === void 0 ? void 0 : (_clickbound$offset2 = clickbound.offset) === null || _clickbound$offset2 === void 0 ? void 0 : _clickbound$offset2.left, clickbound === null || clickbound === void 0 ? void 0 : clickbound.width, clickbound === null || clickbound === void 0 ? void 0 : clickbound.height, hover.background, (_hover$typography = hover.typography) === null || _hover$typography === void 0 ? void 0 : _hover$typography.color, bordersTemplate(hover === null || hover === void 0 ? void 0 : hover.border), outlineTemplate(focus.outline), outlineTemplate(focus.outline), disabled.background, bordersTemplate(disabled.border), typographyTemplate(disabled.typography), disabled.background);
|
|
66
64
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
65
|
+
var Button = /*#__PURE__*/forwardRef(function Button(_ref2, ref) {
|
|
66
|
+
var _ref2$color = _ref2.color,
|
|
67
|
+
color = _ref2$color === void 0 ? 'primary' : _ref2$color,
|
|
68
|
+
_ref2$variant = _ref2.variant,
|
|
69
|
+
variant = _ref2$variant === void 0 ? 'contained' : _ref2$variant,
|
|
70
|
+
children = _ref2.children,
|
|
71
|
+
_ref2$disabled = _ref2.disabled,
|
|
72
|
+
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
73
|
+
href = _ref2.href,
|
|
74
|
+
_ref2$tabIndex = _ref2.tabIndex,
|
|
75
|
+
tabIndex = _ref2$tabIndex === void 0 ? 0 : _ref2$tabIndex,
|
|
76
|
+
_ref2$fullWidth = _ref2.fullWidth,
|
|
77
|
+
fullWidth = _ref2$fullWidth === void 0 ? false : _ref2$fullWidth,
|
|
78
|
+
other = _objectWithoutProperties(_ref2, _excluded);
|
|
79
|
+
|
|
80
|
+
var _useEds = useEds(),
|
|
81
|
+
density = _useEds.density;
|
|
82
|
+
|
|
83
|
+
var token = useToken({
|
|
84
|
+
density: density
|
|
83
85
|
}, getToken(variant, color));
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
var as = href && !disabled ? 'a' : other.as ? other.as : 'button';
|
|
87
|
+
var type = href || other.as ? undefined : 'button';
|
|
86
88
|
tabIndex = disabled ? -1 : tabIndex;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
};
|
|
89
|
+
|
|
90
|
+
var buttonProps = _objectSpread({
|
|
91
|
+
ref: ref,
|
|
92
|
+
as: as,
|
|
93
|
+
href: href,
|
|
94
|
+
type: type,
|
|
95
|
+
disabled: disabled,
|
|
96
|
+
tabIndex: tabIndex
|
|
97
|
+
}, other);
|
|
98
|
+
|
|
96
99
|
return /*#__PURE__*/jsx(ThemeProvider, {
|
|
97
100
|
theme: token,
|
|
98
|
-
children: /*#__PURE__*/jsx(ButtonBase, {
|
|
101
|
+
children: /*#__PURE__*/jsx(ButtonBase, _objectSpread(_objectSpread({}, buttonProps), {}, {
|
|
99
102
|
children: fullWidth ? /*#__PURE__*/jsx(InnerFullWidth, {
|
|
100
103
|
children: children
|
|
101
104
|
}) : /*#__PURE__*/jsx(Inner, {
|
|
102
105
|
children: children
|
|
103
106
|
})
|
|
104
|
-
})
|
|
107
|
+
}))
|
|
105
108
|
});
|
|
106
109
|
});
|
|
107
110
|
|
|
@@ -1,37 +1,35 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
1
3
|
import { forwardRef } from 'react';
|
|
2
4
|
import styled, { css } from 'styled-components';
|
|
3
5
|
import { group } from './ButtonGroup.tokens.js';
|
|
4
6
|
import { jsx } from 'react/jsx-runtime';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const ButtonGroupBase = styled.div.withConfig({
|
|
8
|
+
var _excluded = ["children", "vertical"];
|
|
9
|
+
var border = group.border;
|
|
10
|
+
var radius = border.type === 'border' && border.radius;
|
|
11
|
+
var ButtonGroupBase = styled.div.withConfig({
|
|
11
12
|
displayName: "ButtonGroup__ButtonGroupBase",
|
|
12
13
|
componentId: "sc-1fn8jon-0"
|
|
13
|
-
})(["display:inline-flex;> *{border-radius:0;@media (hover:hover) and (pointer:fine){&:hover{border-radius:0;}}}", ""], _ref
|
|
14
|
-
|
|
15
|
-
vertical
|
|
16
|
-
} = _ref;
|
|
14
|
+
})(["display:inline-flex;> *{border-radius:0;@media (hover:hover) and (pointer:fine){&:hover{border-radius:0;}}}", ""], function (_ref) {
|
|
15
|
+
var vertical = _ref.vertical;
|
|
17
16
|
return vertical ? css(["flex-direction:column;> :first-child{border-top-left-radius:", ";border-top-right-radius:", ";}> :last-child{border-bottom-left-radius:", ";border-bottom-right-radius:", ";}> :not(:last-child){border-bottom:none;}"], radius, radius, radius, radius) : css(["> :first-child{border-top-left-radius:", ";border-bottom-left-radius:", ";}> :last-child{border-top-right-radius:", ";border-bottom-right-radius:", ";}> :not(:last-child){border-right:none;}"], radius, radius, radius, radius);
|
|
18
17
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
...props,
|
|
18
|
+
var ButtonGroup = /*#__PURE__*/forwardRef(function ButtonGroup(_ref2, ref) {
|
|
19
|
+
var children = _ref2.children,
|
|
20
|
+
vertical = _ref2.vertical,
|
|
21
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
22
|
+
|
|
23
|
+
var props = _objectSpread({
|
|
24
|
+
ref: ref,
|
|
25
|
+
vertical: vertical
|
|
26
|
+
}, rest);
|
|
27
|
+
|
|
28
|
+
return /*#__PURE__*/jsx(ButtonGroupBase, _objectSpread(_objectSpread({
|
|
29
|
+
role: "group"
|
|
30
|
+
}, props), {}, {
|
|
33
31
|
children: children
|
|
34
|
-
});
|
|
32
|
+
}));
|
|
35
33
|
});
|
|
36
34
|
|
|
37
35
|
export { ButtonGroup };
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { tokens } from '@equinor/eds-tokens';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
corners: {
|
|
6
|
-
borderRadius
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
} = tokens;
|
|
10
|
-
const group = {
|
|
3
|
+
var borderRadius = tokens.shape.corners.borderRadius;
|
|
4
|
+
var group = {
|
|
11
5
|
border: {
|
|
12
6
|
type: 'border',
|
|
13
7
|
radius: borderRadius
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
+
import _typeof from '@babel/runtime/helpers/typeof';
|
|
1
2
|
import { forwardRef, Children } from 'react';
|
|
2
3
|
import styled from 'styled-components';
|
|
3
4
|
import { jsx } from 'react/jsx-runtime';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
var FullWidthCenterContent = styled.span.withConfig({
|
|
6
7
|
displayName: "InnerFullWidth__FullWidthCenterContent",
|
|
7
8
|
componentId: "sc-qeawkb-0"
|
|
8
9
|
})(["text-align:center;flex:1;"]);
|
|
9
|
-
|
|
10
|
+
var FullWidthInner = styled.span.withConfig({
|
|
10
11
|
displayName: "InnerFullWidth__FullWidthInner",
|
|
11
12
|
componentId: "sc-qeawkb-1"
|
|
12
13
|
})(["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
|
-
|
|
14
|
-
|
|
15
|
-
children
|
|
16
|
-
} = _ref;
|
|
14
|
+
var InnerFullWidth = /*#__PURE__*/forwardRef(function InnerFullWidth(_ref, ref) {
|
|
15
|
+
var children = _ref.children;
|
|
17
16
|
// We need everything in elements for proper flexing 💪
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
var updatedChildren = Children.map(children, function (child) {
|
|
18
|
+
return _typeof(child) !== 'object' ? /*#__PURE__*/jsx(FullWidthCenterContent, {
|
|
19
|
+
children: child
|
|
20
|
+
}) : child;
|
|
21
|
+
});
|
|
21
22
|
return /*#__PURE__*/jsx(FullWidthInner, {
|
|
22
23
|
ref: ref,
|
|
23
24
|
children: updatedChildren
|
|
@@ -1,38 +1,48 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
1
5
|
import { forwardRef, useState, useEffect, Children, isValidElement, cloneElement } from 'react';
|
|
2
6
|
import { Button } from '../Button.js';
|
|
3
7
|
import { jsx } from 'react/jsx-runtime';
|
|
4
8
|
import { ButtonGroup } from '../ButtonGroup/ButtonGroup.js';
|
|
5
9
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
var _excluded = ["children", "multiple", "selectedIndexes", "onChange"];
|
|
11
|
+
var ToggleButton = /*#__PURE__*/forwardRef(function ToggleButton(_ref, ref) {
|
|
12
|
+
var children = _ref.children,
|
|
13
|
+
multiple = _ref.multiple,
|
|
14
|
+
selectedIndexes = _ref.selectedIndexes,
|
|
15
|
+
onChange = _ref.onChange,
|
|
16
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
|
|
18
|
+
var _useState = useState(selectedIndexes || []),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
pickedIndexes = _useState2[0],
|
|
21
|
+
setPickedIndexes = _useState2[1];
|
|
22
|
+
|
|
23
|
+
useEffect(function () {
|
|
16
24
|
if (Array.isArray(selectedIndexes)) {
|
|
17
25
|
setPickedIndexes(selectedIndexes);
|
|
18
26
|
}
|
|
19
27
|
}, [selectedIndexes]);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
var updatedChildren = Children.map(children, function (child, index) {
|
|
29
|
+
var isSelected = pickedIndexes.includes(index);
|
|
30
|
+
var childElement = child;
|
|
23
31
|
|
|
24
32
|
if ( /*#__PURE__*/isValidElement(child) && child.type === Button) {
|
|
25
|
-
|
|
33
|
+
var buttonProps = {
|
|
26
34
|
'aria-pressed': isSelected ? true : undefined,
|
|
27
35
|
variant: isSelected ? 'contained' : 'outlined',
|
|
28
|
-
onClick: e
|
|
36
|
+
onClick: function onClick(e) {
|
|
29
37
|
var _childElement$props, _childElement$props$o;
|
|
30
38
|
|
|
31
39
|
(_childElement$props = childElement.props) === null || _childElement$props === void 0 ? void 0 : (_childElement$props$o = _childElement$props.onClick) === null || _childElement$props$o === void 0 ? void 0 : _childElement$props$o.call(_childElement$props, e);
|
|
32
|
-
|
|
40
|
+
var updatedSelection = [index];
|
|
33
41
|
|
|
34
42
|
if (multiple) {
|
|
35
|
-
updatedSelection = pickedIndexes.includes(index) ? pickedIndexes.filter(
|
|
43
|
+
updatedSelection = pickedIndexes.includes(index) ? pickedIndexes.filter(function (i) {
|
|
44
|
+
return i !== index;
|
|
45
|
+
}) : [].concat(_toConsumableArray(pickedIndexes), [index]);
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
setPickedIndexes(updatedSelection);
|
|
@@ -45,11 +55,11 @@ const ToggleButton = /*#__PURE__*/forwardRef(function ToggleButton(_ref, ref) {
|
|
|
45
55
|
return /*#__PURE__*/cloneElement(child, buttonProps);
|
|
46
56
|
}
|
|
47
57
|
});
|
|
48
|
-
return /*#__PURE__*/jsx(ButtonGroup, {
|
|
49
|
-
ref: ref
|
|
50
|
-
|
|
58
|
+
return /*#__PURE__*/jsx(ButtonGroup, _objectSpread(_objectSpread({
|
|
59
|
+
ref: ref
|
|
60
|
+
}, props), {}, {
|
|
51
61
|
children: updatedChildren
|
|
52
|
-
});
|
|
62
|
+
}));
|
|
53
63
|
});
|
|
54
64
|
|
|
55
65
|
export { ToggleButton };
|
|
@@ -2,7 +2,7 @@ import { Button as Button$1 } from './Button.js';
|
|
|
2
2
|
import { ButtonGroup } from './ButtonGroup/ButtonGroup.js';
|
|
3
3
|
import { ToggleButton } from './ToggleButton/ToggleButton.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
var Button = Button$1;
|
|
6
6
|
Button.Group = ButtonGroup;
|
|
7
7
|
Button.Toggle = ToggleButton;
|
|
8
8
|
Button.Group.displayName = 'Button.Group';
|
|
@@ -1,75 +1,46 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
1
2
|
import { tokens } from '@equinor/eds-tokens';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
spacings: {
|
|
23
|
-
comfortable: {
|
|
24
|
-
medium
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
shape: {
|
|
28
|
-
button: {
|
|
29
|
-
minHeight: buttonHeight,
|
|
30
|
-
borderRadius: buttonBorderRadius
|
|
31
|
-
},
|
|
32
|
-
_modes: {
|
|
33
|
-
compact: {
|
|
34
|
-
button: {
|
|
35
|
-
minHeight: compactButtonHeight
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
interactions: {
|
|
41
|
-
focused: outline
|
|
42
|
-
},
|
|
43
|
-
clickbounds: {
|
|
44
|
-
default__base: clicboundHeight,
|
|
45
|
-
compact__standard: compactClickboundHeight
|
|
46
|
-
}
|
|
47
|
-
} = tokens;
|
|
48
|
-
const button = {
|
|
4
|
+
var buttonTypography = tokens.typography.navigation.button,
|
|
5
|
+
_tokens$colors$intera = tokens.colors.interactive,
|
|
6
|
+
disabledTextColor = _tokens$colors$intera.disabled__text.rgba,
|
|
7
|
+
disabledBorderColor = _tokens$colors$intera.disabled__border.rgba,
|
|
8
|
+
disabledColor = _tokens$colors$intera.disabled__fill.rgba,
|
|
9
|
+
medium = tokens.spacings.comfortable.medium,
|
|
10
|
+
_tokens$shape = tokens.shape,
|
|
11
|
+
_tokens$shape$button = _tokens$shape.button,
|
|
12
|
+
buttonHeight = _tokens$shape$button.minHeight,
|
|
13
|
+
buttonBorderRadius = _tokens$shape$button.borderRadius,
|
|
14
|
+
compactButtonHeight = _tokens$shape._modes.compact.button.minHeight,
|
|
15
|
+
outline = tokens.interactions.focused,
|
|
16
|
+
_tokens$clickbounds = tokens.clickbounds,
|
|
17
|
+
clicboundHeight = _tokens$clickbounds.default__base,
|
|
18
|
+
compactClickboundHeight = _tokens$clickbounds.compact__standard;
|
|
19
|
+
var button = {
|
|
49
20
|
background: 'transparent',
|
|
50
|
-
height:
|
|
51
|
-
typography: {
|
|
21
|
+
height: "var(--eds_button__height, ".concat(buttonHeight, ")"),
|
|
22
|
+
typography: _objectSpread(_objectSpread({}, buttonTypography), {}, {
|
|
52
23
|
textAlign: 'center',
|
|
53
|
-
fontSize:
|
|
54
|
-
},
|
|
24
|
+
fontSize: "var(--eds_button__font_size, ".concat(buttonTypography.fontSize, ")")
|
|
25
|
+
}),
|
|
55
26
|
border: {
|
|
56
27
|
type: 'border',
|
|
57
|
-
width:
|
|
28
|
+
width: "var(--eds_button__border_width, 1px)",
|
|
58
29
|
color: 'transparent',
|
|
59
|
-
radius:
|
|
30
|
+
radius: "var(--eds_button__radius, ".concat(buttonBorderRadius, ")"),
|
|
60
31
|
style: 'solid'
|
|
61
32
|
},
|
|
62
33
|
spacings: {
|
|
63
34
|
top: 'var(--eds_button__padding_y, 0)',
|
|
64
35
|
bottom: 'var(--eds_button__padding_y, 0)',
|
|
65
|
-
left:
|
|
66
|
-
right:
|
|
36
|
+
left: "var(--eds_button__padding_x, ".concat(medium, ")"),
|
|
37
|
+
right: "var(--eds_button__padding_x, ".concat(medium, ")")
|
|
67
38
|
},
|
|
68
39
|
clickbound: {
|
|
69
40
|
height: clicboundHeight,
|
|
70
41
|
width: '100%',
|
|
71
42
|
offset: {
|
|
72
|
-
top:
|
|
43
|
+
top: "".concat((parseInt(clicboundHeight) - parseInt(buttonHeight)) / 2 + 1, "px"),
|
|
73
44
|
left: '0'
|
|
74
45
|
}
|
|
75
46
|
},
|
|
@@ -85,7 +56,7 @@ const button = {
|
|
|
85
56
|
type: 'border',
|
|
86
57
|
width: '1px',
|
|
87
58
|
color: 'transparent',
|
|
88
|
-
radius:
|
|
59
|
+
radius: "var(--eds_button__radius, ".concat(buttonBorderRadius, ")"),
|
|
89
60
|
style: 'solid'
|
|
90
61
|
}
|
|
91
62
|
},
|
|
@@ -106,15 +77,15 @@ const button = {
|
|
|
106
77
|
color: disabledBorderColor,
|
|
107
78
|
style: 'solid'
|
|
108
79
|
},
|
|
109
|
-
typography: {
|
|
80
|
+
typography: _objectSpread(_objectSpread({}, buttonTypography), {}, {
|
|
110
81
|
color: disabledTextColor,
|
|
111
82
|
textAlign: 'center'
|
|
112
|
-
}
|
|
83
|
+
})
|
|
113
84
|
}
|
|
114
85
|
},
|
|
115
86
|
modes: {
|
|
116
87
|
compact: {
|
|
117
|
-
height:
|
|
88
|
+
height: "var(--eds_button__height_compact, ".concat(compactButtonHeight, ")"),
|
|
118
89
|
spacings: {
|
|
119
90
|
top: 'var(--eds_button__padding_y_compact, 0)',
|
|
120
91
|
bottom: 'var(--eds_button__padding_y_compact, 0)'
|
|
@@ -123,7 +94,7 @@ const button = {
|
|
|
123
94
|
height: compactClickboundHeight,
|
|
124
95
|
width: '100%',
|
|
125
96
|
offset: {
|
|
126
|
-
top:
|
|
97
|
+
top: "".concat((parseInt(compactClickboundHeight) - parseInt(compactButtonHeight)) / 2 + 1, "px"),
|
|
127
98
|
left: '0'
|
|
128
99
|
}
|
|
129
100
|
}
|