@equinor/eds-core-react 0.35.0 → 0.36.0
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 +5577 -4351
- package/dist/esm/components/Accordion/Accordion.js +21 -23
- package/dist/esm/components/Accordion/Accordion.tokens.js +65 -23
- package/dist/esm/components/Accordion/AccordionHeader.js +74 -62
- package/dist/esm/components/Accordion/AccordionHeaderActions.js +22 -20
- package/dist/esm/components/Accordion/AccordionHeaderTitle.js +22 -20
- package/dist/esm/components/Accordion/AccordionItem.js +28 -35
- package/dist/esm/components/Accordion/AccordionPanel.js +27 -26
- package/dist/esm/components/Accordion/index.js +1 -1
- package/dist/esm/components/Autocomplete/Autocomplete.js +451 -329
- package/dist/esm/components/Autocomplete/Autocomplete.tokens.js +33 -17
- package/dist/esm/components/Autocomplete/Option.js +35 -32
- package/dist/esm/components/Avatar/Avatar.js +19 -26
- package/dist/esm/components/Avatar/Avatar.tokens.js +1 -1
- package/dist/esm/components/Banner/Banner.js +26 -27
- package/dist/esm/components/Banner/Banner.tokens.js +47 -18
- package/dist/esm/components/Banner/BannerActions.js +18 -19
- package/dist/esm/components/Banner/BannerIcon.js +26 -25
- package/dist/esm/components/Banner/BannerMessage.js +13 -14
- package/dist/esm/components/Banner/index.js +1 -1
- package/dist/esm/components/Breadcrumbs/Breadcrumb.js +30 -32
- package/dist/esm/components/Breadcrumbs/Breadcrumbs.js +46 -53
- package/dist/esm/components/Breadcrumbs/Breadcrumbs.tokens.js +20 -5
- package/dist/esm/components/Breadcrumbs/index.js +1 -1
- package/dist/esm/components/Button/Button.js +46 -46
- package/dist/esm/components/Button/ButtonGroup/ButtonGroup.js +22 -22
- package/dist/esm/components/Button/ButtonGroup/ButtonGroup.tokens.js +8 -2
- package/dist/esm/components/Button/InnerFullWidth.js +8 -10
- package/dist/esm/components/Button/ToggleButton/ToggleButton.js +23 -33
- package/dist/esm/components/Button/index.js +1 -1
- package/dist/esm/components/Button/tokens/button.js +62 -31
- package/dist/esm/components/Button/tokens/contained.js +38 -14
- package/dist/esm/components/Button/tokens/contained_icon.js +13 -10
- package/dist/esm/components/Button/tokens/ghost.js +36 -13
- package/dist/esm/components/Button/tokens/icon.js +46 -20
- package/dist/esm/components/Button/tokens/index.js +1 -1
- package/dist/esm/components/Button/tokens/outlined.js +42 -15
- package/dist/esm/components/Card/Card.js +24 -27
- package/dist/esm/components/Card/Card.tokens.js +32 -11
- package/dist/esm/components/Card/CardActions.js +22 -23
- package/dist/esm/components/Card/CardContent.js +12 -12
- package/dist/esm/components/Card/CardHeader.js +15 -13
- package/dist/esm/components/Card/CardHeaderTitle.js +12 -12
- package/dist/esm/components/Card/CardMedia.js +20 -20
- package/dist/esm/components/Card/index.js +1 -1
- package/dist/esm/components/Checkbox/Checkbox.js +20 -21
- package/dist/esm/components/Checkbox/Checkbox.tokens.js +41 -16
- package/dist/esm/components/Checkbox/Input.js +75 -84
- package/dist/esm/components/Chip/Chip.js +61 -64
- package/dist/esm/components/Chip/Chip.tokens.js +68 -26
- package/dist/esm/components/Chip/Icon.js +13 -11
- package/dist/esm/components/Dialog/Dialog.js +34 -35
- package/dist/esm/components/Dialog/Dialog.tokens.js +32 -10
- package/dist/esm/components/Dialog/DialogActions.js +13 -14
- package/dist/esm/components/Dialog/DialogContent.js +19 -20
- package/dist/esm/components/Dialog/DialogHeader.js +16 -15
- package/dist/esm/components/Dialog/DialogTitle.js +13 -14
- package/dist/esm/components/Dialog/index.js +1 -1
- package/dist/esm/components/Divider/Divider.js +24 -25
- package/dist/esm/components/Divider/Divider.tokens.js +24 -10
- package/dist/esm/components/EdsProvider/eds.context.js +18 -26
- package/dist/esm/components/Icon/Icon.js +75 -78
- package/dist/esm/components/Icon/index.js +1 -1
- package/dist/esm/components/Icon/library.js +9 -8
- package/dist/esm/components/Input/Input.js +93 -92
- package/dist/esm/components/Input/Input.tokens.js +56 -40
- package/dist/esm/components/InputWrapper/HelperText/HelperText.js +24 -28
- package/dist/esm/components/InputWrapper/HelperText/HelperText.token.js +11 -7
- package/dist/esm/components/InputWrapper/InputWrapper.js +34 -35
- package/dist/esm/components/InputWrapper/InputWrapper.tokens.js +56 -40
- package/dist/esm/components/Label/Label.js +16 -20
- package/dist/esm/components/Label/Label.tokens.js +11 -7
- package/dist/esm/components/List/List.js +17 -19
- package/dist/esm/components/List/List.tokens.js +6 -2
- package/dist/esm/components/List/ListItem.js +7 -8
- package/dist/esm/components/List/index.js +1 -1
- package/dist/esm/components/Menu/Menu.context.js +35 -42
- package/dist/esm/components/Menu/Menu.js +111 -108
- package/dist/esm/components/Menu/Menu.tokens.js +57 -24
- package/dist/esm/components/Menu/MenuItem.js +59 -61
- package/dist/esm/components/Menu/MenuList.js +52 -55
- 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 +70 -75
- package/dist/esm/components/Pagination/Pagination.tokens.js +18 -5
- package/dist/esm/components/Pagination/PaginationItem.js +18 -19
- package/dist/esm/components/Pagination/paginationControl.js +18 -22
- package/dist/esm/components/Paper/Paper.js +15 -18
- package/dist/esm/components/Paper/Paper.tokens.js +12 -4
- package/dist/esm/components/Popover/Popover.js +98 -87
- package/dist/esm/components/Popover/Popover.tokens.js +37 -11
- package/dist/esm/components/Popover/PopoverActions.js +15 -14
- package/dist/esm/components/Popover/PopoverContent.js +15 -14
- package/dist/esm/components/Popover/PopoverHeader.js +16 -15
- package/dist/esm/components/Popover/PopoverTitle.js +15 -14
- package/dist/esm/components/Popover/index.js +1 -1
- package/dist/esm/components/Progress/Circular/CircularProgress.js +33 -42
- package/dist/esm/components/Progress/Circular/CircularProgress.tokens.js +24 -8
- package/dist/esm/components/Progress/Dots/DotProgress.js +20 -23
- package/dist/esm/components/Progress/Dots/DotProgress.tokens.js +20 -8
- package/dist/esm/components/Progress/Linear/LinearProgress.js +25 -31
- package/dist/esm/components/Progress/Linear/LinearProgress.tokens.js +13 -4
- package/dist/esm/components/Progress/Star/StarProgress.js +23 -27
- package/dist/esm/components/Progress/Star/StarProgress.tokens.js +10 -2
- package/dist/esm/components/Progress/index.js +1 -1
- package/dist/esm/components/Radio/Radio.js +71 -83
- package/dist/esm/components/Radio/Radio.tokens.js +41 -16
- package/dist/esm/components/Scrim/Scrim.js +20 -23
- package/dist/esm/components/Scrim/Scrim.tokens.js +11 -3
- package/dist/esm/components/Search/Search.js +24 -31
- package/dist/esm/components/Select/NativeSelect.js +45 -44
- package/dist/esm/components/Select/NativeSelect.tokens.js +15 -10
- package/dist/esm/components/SideBar/SideBar.context.js +27 -33
- package/dist/esm/components/SideBar/SideBar.js +42 -40
- package/dist/esm/components/SideBar/SideBar.tokens.js +49 -20
- package/dist/esm/components/SideBar/SideBarAccordion/index.js +98 -90
- package/dist/esm/components/SideBar/SideBarAccordionItem/index.js +46 -33
- package/dist/esm/components/SideBar/SideBarButton/index.js +61 -45
- package/dist/esm/components/SideBar/SideBarContent.js +13 -13
- package/dist/esm/components/SideBar/SideBarFooter.js +13 -13
- package/dist/esm/components/SideBar/SideBarToggle.js +40 -26
- package/dist/esm/components/SideBar/SidebarLink/index.js +87 -48
- package/dist/esm/components/SideBar/index.js +1 -1
- package/dist/esm/components/SideSheet/SideSheet.js +27 -27
- package/dist/esm/components/SideSheet/SideSheet.tokens.js +29 -12
- package/dist/esm/components/Slider/MinMax.js +10 -6
- package/dist/esm/components/Slider/Output.js +15 -18
- package/dist/esm/components/Slider/Slider.js +157 -188
- package/dist/esm/components/Slider/Slider.tokens.js +67 -19
- package/dist/esm/components/Slider/SliderInput.js +37 -34
- package/dist/esm/components/Snackbar/Snackbar.js +39 -45
- package/dist/esm/components/Snackbar/Snackbar.tokens.js +45 -17
- package/dist/esm/components/Snackbar/SnackbarAction.js +15 -14
- package/dist/esm/components/Snackbar/index.js +1 -1
- package/dist/esm/components/Switch/Switch.js +37 -42
- package/dist/esm/components/Switch/Switch.styles.js +17 -20
- package/dist/esm/components/Switch/Switch.tokens.js +66 -21
- package/dist/esm/components/Switch/SwitchDefault.js +38 -36
- package/dist/esm/components/Switch/SwitchSmall.js +38 -33
- package/dist/esm/components/Table/Body.js +8 -9
- package/dist/esm/components/Table/Caption.js +12 -14
- package/dist/esm/components/Table/Cell.js +15 -14
- package/dist/esm/components/Table/DataCell/DataCell.js +27 -26
- package/dist/esm/components/Table/DataCell/DataCell.tokens.js +79 -38
- package/dist/esm/components/Table/Head/Head.js +10 -11
- package/dist/esm/components/Table/Head/Head.tokens.js +15 -4
- package/dist/esm/components/Table/HeaderCell/HeaderCell.js +37 -33
- package/dist/esm/components/Table/HeaderCell/HeaderCell.tokens.js +65 -28
- package/dist/esm/components/Table/Inner.context.js +2 -2
- package/dist/esm/components/Table/Row/Row.js +12 -16
- package/dist/esm/components/Table/Row/Row.tokens.js +13 -4
- package/dist/esm/components/Table/Table.js +8 -9
- package/dist/esm/components/Table/index.js +1 -1
- package/dist/esm/components/TableOfContents/LinkItem.js +11 -11
- package/dist/esm/components/TableOfContents/TableOfContents.js +25 -26
- package/dist/esm/components/TableOfContents/TableOfContents.tokens.js +46 -21
- package/dist/esm/components/TableOfContents/index.js +1 -1
- package/dist/esm/components/Tabs/Tab.js +30 -29
- package/dist/esm/components/Tabs/TabList.js +50 -62
- package/dist/esm/components/Tabs/TabPanel.js +19 -18
- package/dist/esm/components/Tabs/TabPanels.js +16 -17
- package/dist/esm/components/Tabs/Tabs.context.js +3 -5
- package/dist/esm/components/Tabs/Tabs.js +37 -53
- package/dist/esm/components/Tabs/Tabs.tokens.js +56 -21
- package/dist/esm/components/Tabs/index.js +1 -1
- package/dist/esm/components/TextField/TextField.js +64 -59
- package/dist/esm/components/Textarea/Textarea.js +38 -38
- package/dist/esm/components/Tooltip/Tooltip.js +79 -81
- package/dist/esm/components/Tooltip/Tooltip.tokens.js +33 -13
- package/dist/esm/components/TopBar/Actions.js +9 -11
- package/dist/esm/components/TopBar/CustomContent.js +9 -11
- package/dist/esm/components/TopBar/Header.js +9 -11
- package/dist/esm/components/TopBar/TopBar.js +24 -25
- package/dist/esm/components/TopBar/TopBar.tokens.js +10 -4
- package/dist/esm/components/TopBar/index.js +1 -1
- package/dist/esm/components/Typography/Typography.js +42 -57
- package/dist/esm/components/Typography/Typography.tokens.js +50 -23
- package/dist/esm/node_modules/.pnpm/ramda@0.29.1/node_modules/ramda/es/internal/_isPlaceholder.js +1 -3
- package/dist/types/components/Accordion/Accordion.types.d.ts +1 -1
- package/dist/types/components/Autocomplete/Autocomplete.d.ts +13 -0
- package/dist/types/components/Autocomplete/Option.d.ts +1 -0
- package/dist/types/components/Slider/Slider.d.ts +11 -3
- package/package.json +5 -6
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
1
|
import { forwardRef, useMemo } from 'react';
|
|
4
2
|
import styled, { css } from 'styled-components';
|
|
5
3
|
import { breadcrumbs } from './Breadcrumbs.tokens.js';
|
|
@@ -7,42 +5,42 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
7
5
|
import { Typography } from '../Typography/Typography.js';
|
|
8
6
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
typography
|
|
13
|
-
|
|
8
|
+
const {
|
|
9
|
+
states,
|
|
10
|
+
typography
|
|
11
|
+
} = breadcrumbs;
|
|
12
|
+
const StyledTypography = styled(Typography).withConfig({
|
|
14
13
|
displayName: "Breadcrumb__StyledTypography",
|
|
15
14
|
componentId: "sc-10nvwte-0"
|
|
16
|
-
})(["@media (hover:hover) and (pointer:fine){&:hover{text-decoration:underline;color:", ";cursor:pointer;}}white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;line-height:1;text-decoration:none;color:", ";width:100%;", ""], states.hover.typography.color, typography.color,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var crumb = /*#__PURE__*/jsx(StyledTypography, _objectSpread(_objectSpread({
|
|
15
|
+
})(["@media (hover:hover) and (pointer:fine){&:hover{text-decoration:underline;color:", ";cursor:pointer;}}white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;line-height:1;text-decoration:none;color:", ";width:100%;", ""], states.hover.typography.color, typography.color, ({
|
|
16
|
+
$maxWidth
|
|
17
|
+
}) => css({
|
|
18
|
+
maxWidth: $maxWidth
|
|
19
|
+
}));
|
|
20
|
+
const Breadcrumb = /*#__PURE__*/forwardRef(function Breadcrumb({
|
|
21
|
+
children,
|
|
22
|
+
maxWidth,
|
|
23
|
+
forceTooltip,
|
|
24
|
+
href,
|
|
25
|
+
as,
|
|
26
|
+
...other
|
|
27
|
+
}, ref) {
|
|
28
|
+
const props = {
|
|
29
|
+
...other,
|
|
30
|
+
href,
|
|
31
|
+
ref
|
|
32
|
+
};
|
|
33
|
+
const showTooltip = maxWidth > 0 || forceTooltip;
|
|
34
|
+
const isHrefDefined = href !== undefined;
|
|
35
|
+
const forwardedAs = useMemo(() => as ? as : isHrefDefined ? 'a' : 'span', [as, isHrefDefined]);
|
|
36
|
+
const crumb = /*#__PURE__*/jsx(StyledTypography, {
|
|
39
37
|
link: isHrefDefined,
|
|
40
38
|
forwardedAs: forwardedAs,
|
|
41
39
|
variant: "body_short",
|
|
42
|
-
$maxWidth: maxWidth
|
|
43
|
-
|
|
40
|
+
$maxWidth: maxWidth,
|
|
41
|
+
...props,
|
|
44
42
|
children: children
|
|
45
|
-
})
|
|
43
|
+
});
|
|
46
44
|
return showTooltip ? /*#__PURE__*/jsx(Tooltip, {
|
|
47
45
|
title: children,
|
|
48
46
|
placement: "top",
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
3
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
1
|
import { forwardRef, useState, Children, Fragment } from 'react';
|
|
5
2
|
import styled from 'styled-components';
|
|
6
3
|
import { breadcrumbs } from './Breadcrumbs.tokens.js';
|
|
@@ -8,49 +5,47 @@ import { spacingsTemplate } from '@equinor/eds-utils';
|
|
|
8
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
9
6
|
import { Typography } from '../Typography/Typography.js';
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
typography
|
|
14
|
-
states
|
|
15
|
-
|
|
8
|
+
const {
|
|
9
|
+
spacings,
|
|
10
|
+
typography,
|
|
11
|
+
states
|
|
12
|
+
} = breadcrumbs;
|
|
13
|
+
const OrderedList = styled.ol.withConfig({
|
|
16
14
|
displayName: "Breadcrumbs__OrderedList",
|
|
17
15
|
componentId: "sc-12awlbz-0"
|
|
18
|
-
})(["list-style:none;display:flex;gap:0.45em 0;align-items:center;padding:0;margin:0;flex-wrap:", ";"],
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var ListItem = styled.li.withConfig({
|
|
16
|
+
})(["list-style:none;display:flex;gap:0.45em 0;align-items:center;padding:0;margin:0;flex-wrap:", ";"], ({
|
|
17
|
+
$wrap
|
|
18
|
+
}) => $wrap ? 'wrap' : 'nowrap');
|
|
19
|
+
const ListItem = styled.li.withConfig({
|
|
23
20
|
displayName: "Breadcrumbs__ListItem",
|
|
24
21
|
componentId: "sc-12awlbz-1"
|
|
25
22
|
})(["display:block;min-width:30px;"]);
|
|
26
|
-
|
|
23
|
+
const Separator = styled(Typography).withConfig({
|
|
27
24
|
displayName: "Breadcrumbs__Separator",
|
|
28
25
|
componentId: "sc-12awlbz-2"
|
|
29
26
|
})(["color:", ";", " display:block;line-height:1;display:flex;& > svg{margin-inline:-9px;}"], typography.color, spacingsTemplate(spacings));
|
|
30
|
-
|
|
27
|
+
const Collapsed = styled(Typography).withConfig({
|
|
31
28
|
displayName: "Breadcrumbs__Collapsed",
|
|
32
29
|
componentId: "sc-12awlbz-3"
|
|
33
30
|
})(["@media (hover:hover) and (pointer:fine){&:hover{text-decoration:underline;color:", ";}}color:", ";text-decoration:none;"], states.hover.typography.color, typography.color);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
ref
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
setExpanded = _useState2[1];
|
|
49
|
-
var collapsedCrumbs = function collapsedCrumbs(allCrumbs) {
|
|
50
|
-
var handleExpandClick = function handleExpandClick(e) {
|
|
31
|
+
const Breadcrumbs = /*#__PURE__*/forwardRef(function Breadcrumbs({
|
|
32
|
+
children,
|
|
33
|
+
collapse,
|
|
34
|
+
wrap = true,
|
|
35
|
+
separator = '/',
|
|
36
|
+
...rest
|
|
37
|
+
}, ref) {
|
|
38
|
+
const props = {
|
|
39
|
+
...rest,
|
|
40
|
+
ref
|
|
41
|
+
};
|
|
42
|
+
const [expanded, setExpanded] = useState(false);
|
|
43
|
+
const collapsedCrumbs = allCrumbs => {
|
|
44
|
+
const handleExpandClick = e => {
|
|
51
45
|
setExpanded(true);
|
|
52
|
-
|
|
53
|
-
key
|
|
46
|
+
const {
|
|
47
|
+
key
|
|
48
|
+
} = e;
|
|
54
49
|
if (key === 'Enter') {
|
|
55
50
|
setExpanded(true);
|
|
56
51
|
}
|
|
@@ -81,30 +76,28 @@ var Breadcrumbs = /*#__PURE__*/forwardRef(function Breadcrumbs(_ref2, ref) {
|
|
|
81
76
|
})]
|
|
82
77
|
}, "collapsed"), allCrumbs[allCrumbs.length - 1]];
|
|
83
78
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
});
|
|
101
|
-
return /*#__PURE__*/jsx("nav", _objectSpread(_objectSpread({}, props), {}, {
|
|
79
|
+
const allCrumbs = Children.toArray(children).map((child, index) =>
|
|
80
|
+
|
|
81
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
82
|
+
jsxs(Fragment, {
|
|
83
|
+
children: [/*#__PURE__*/jsx(ListItem, {
|
|
84
|
+
children: child
|
|
85
|
+
}), index !== Children.toArray(children).length - 1 && /*#__PURE__*/jsx("li", {
|
|
86
|
+
"aria-hidden": true,
|
|
87
|
+
children: /*#__PURE__*/jsx(Separator, {
|
|
88
|
+
variant: "body_short",
|
|
89
|
+
children: separator
|
|
90
|
+
})
|
|
91
|
+
})]
|
|
92
|
+
}, `breadcrumb-${index}`));
|
|
93
|
+
return /*#__PURE__*/jsx("nav", {
|
|
94
|
+
...props,
|
|
102
95
|
"aria-label": "breadcrumbs",
|
|
103
96
|
children: /*#__PURE__*/jsx(OrderedList, {
|
|
104
97
|
$wrap: wrap,
|
|
105
98
|
children: collapse && !expanded ? collapsedCrumbs(allCrumbs) : allCrumbs
|
|
106
99
|
})
|
|
107
|
-
})
|
|
100
|
+
});
|
|
108
101
|
});
|
|
109
102
|
|
|
110
103
|
// Breadcrumbs.displayName = 'eds-breadcrumbs'
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { tokens } from '@equinor/eds-tokens';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
const {
|
|
4
|
+
colors: {
|
|
5
|
+
text: {
|
|
6
|
+
static_icons__tertiary: {
|
|
7
|
+
rgba: enabledColor
|
|
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 = {
|
|
8
23
|
spacings: {
|
|
9
24
|
left: spacingMedium,
|
|
10
25
|
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
|
+
const Breadcrumbs = Breadcrumbs$1;
|
|
5
5
|
Breadcrumbs.Breadcrumb = Breadcrumb;
|
|
6
6
|
Breadcrumbs.Breadcrumb.displayName = 'Breadcrumbs.Breadcrumb';
|
|
7
7
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
1
|
import { forwardRef } from 'react';
|
|
4
2
|
import styled, { css, ThemeProvider } from 'styled-components';
|
|
5
3
|
import { token } from './tokens/index.js';
|
|
@@ -8,8 +6,7 @@ import { InnerFullWidth } from './InnerFullWidth.js';
|
|
|
8
6
|
import { jsx } from 'react/jsx-runtime';
|
|
9
7
|
import { useEds } from '../EdsProvider/eds.context.js';
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
var getVariant = function getVariant(tokenSet, variant) {
|
|
9
|
+
const getVariant = (tokenSet, variant) => {
|
|
13
10
|
switch (variant) {
|
|
14
11
|
case 'ghost':
|
|
15
12
|
return tokenSet.ghost;
|
|
@@ -24,7 +21,7 @@ var getVariant = function getVariant(tokenSet, variant) {
|
|
|
24
21
|
return tokenSet.contained;
|
|
25
22
|
}
|
|
26
23
|
};
|
|
27
|
-
|
|
24
|
+
const getToken = (variant, color) => {
|
|
28
25
|
switch (color) {
|
|
29
26
|
case 'danger':
|
|
30
27
|
return getVariant(token.danger, variant);
|
|
@@ -35,62 +32,65 @@ var getToken = function getToken(variant, color) {
|
|
|
35
32
|
return getVariant(token.primary, variant);
|
|
36
33
|
}
|
|
37
34
|
};
|
|
38
|
-
|
|
35
|
+
const Inner = styled.span.withConfig({
|
|
39
36
|
displayName: "Button__Inner",
|
|
40
37
|
componentId: "sc-1hs0myn-0"
|
|
41
38
|
})(["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);}"]);
|
|
42
|
-
|
|
39
|
+
const ButtonBase = styled.button.withConfig({
|
|
43
40
|
displayName: "Button__ButtonBase",
|
|
44
41
|
componentId: "sc-1hs0myn-1"
|
|
45
|
-
})(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
})(({
|
|
43
|
+
theme
|
|
44
|
+
}) => {
|
|
45
|
+
const {
|
|
46
|
+
states,
|
|
47
|
+
clickbound
|
|
48
|
+
} = theme;
|
|
49
|
+
const {
|
|
50
|
+
focus,
|
|
51
|
+
hover,
|
|
52
|
+
disabled
|
|
53
|
+
} = states;
|
|
54
|
+
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,&[aria-disabled='true']{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?.offset?.top, clickbound?.offset?.left, clickbound?.width, clickbound?.height, hover.background, hover.typography?.color, bordersTemplate(hover?.border), outlineTemplate(focus.outline), outlineTemplate(focus.outline), disabled.background, bordersTemplate(disabled.border), typographyTemplate(disabled.typography), disabled.background);
|
|
54
55
|
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
density = _useEds.density;
|
|
71
|
-
var token = useToken({
|
|
72
|
-
density: density
|
|
56
|
+
const Button = /*#__PURE__*/forwardRef(function Button({
|
|
57
|
+
color = 'primary',
|
|
58
|
+
variant = 'contained',
|
|
59
|
+
children,
|
|
60
|
+
disabled = false,
|
|
61
|
+
href,
|
|
62
|
+
tabIndex = 0,
|
|
63
|
+
fullWidth = false,
|
|
64
|
+
...other
|
|
65
|
+
}, ref) {
|
|
66
|
+
const {
|
|
67
|
+
density
|
|
68
|
+
} = useEds();
|
|
69
|
+
const token = useToken({
|
|
70
|
+
density
|
|
73
71
|
}, getToken(variant, color));
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
const as = href && !disabled ? 'a' : other.as ? other.as : 'button';
|
|
73
|
+
const type = href || other.as ? undefined : 'button';
|
|
76
74
|
tabIndex = disabled ? -1 : tabIndex;
|
|
77
|
-
|
|
78
|
-
ref
|
|
79
|
-
as
|
|
80
|
-
href
|
|
81
|
-
type
|
|
82
|
-
disabled
|
|
83
|
-
tabIndex
|
|
84
|
-
|
|
75
|
+
const buttonProps = {
|
|
76
|
+
ref,
|
|
77
|
+
as,
|
|
78
|
+
href,
|
|
79
|
+
type,
|
|
80
|
+
disabled,
|
|
81
|
+
tabIndex,
|
|
82
|
+
...other
|
|
83
|
+
};
|
|
85
84
|
return /*#__PURE__*/jsx(ThemeProvider, {
|
|
86
85
|
theme: token,
|
|
87
|
-
children: /*#__PURE__*/jsx(ButtonBase,
|
|
86
|
+
children: /*#__PURE__*/jsx(ButtonBase, {
|
|
87
|
+
...buttonProps,
|
|
88
88
|
children: fullWidth ? /*#__PURE__*/jsx(InnerFullWidth, {
|
|
89
89
|
children: children
|
|
90
90
|
}) : /*#__PURE__*/jsx(Inner, {
|
|
91
91
|
children: children
|
|
92
92
|
})
|
|
93
|
-
})
|
|
93
|
+
})
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
96
|
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
1
|
import { forwardRef } from 'react';
|
|
4
2
|
import styled, { css } from 'styled-components';
|
|
5
3
|
import { group } from './ButtonGroup.tokens.js';
|
|
6
4
|
import { jsx } from 'react/jsx-runtime';
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
const {
|
|
7
|
+
border
|
|
8
|
+
} = group;
|
|
9
|
+
const radius = border.type === 'border' && border.radius;
|
|
10
|
+
const ButtonGroupBase = styled.div.withConfig({
|
|
12
11
|
displayName: "ButtonGroup__ButtonGroupBase",
|
|
13
12
|
componentId: "sc-1fn8jon-0"
|
|
14
|
-
})(["display:inline-flex;> *{border-radius:0;@media (hover:hover) and (pointer:fine){&:hover{border-radius:0;}}}", ""],
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
ref
|
|
24
|
-
$vertical: vertical
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
13
|
+
})(["display:inline-flex;> *{border-radius:0;@media (hover:hover) and (pointer:fine){&:hover{border-radius:0;}}}", ""], ({
|
|
14
|
+
$vertical
|
|
15
|
+
}) => $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));
|
|
16
|
+
const ButtonGroup = /*#__PURE__*/forwardRef(function ButtonGroup({
|
|
17
|
+
children,
|
|
18
|
+
vertical,
|
|
19
|
+
...rest
|
|
20
|
+
}, ref) {
|
|
21
|
+
const props = {
|
|
22
|
+
ref,
|
|
23
|
+
$vertical: vertical,
|
|
24
|
+
...rest
|
|
25
|
+
};
|
|
26
|
+
return /*#__PURE__*/jsx(ButtonGroupBase, {
|
|
27
|
+
role: "group",
|
|
28
|
+
...props,
|
|
29
29
|
children: children
|
|
30
|
-
})
|
|
30
|
+
});
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
export { ButtonGroup };
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { tokens } from '@equinor/eds-tokens';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const {
|
|
4
|
+
shape: {
|
|
5
|
+
corners: {
|
|
6
|
+
borderRadius
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
} = tokens;
|
|
10
|
+
const group = {
|
|
5
11
|
border: {
|
|
6
12
|
type: 'border',
|
|
7
13
|
radius: borderRadius
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
import _typeof from '@babel/runtime/helpers/typeof';
|
|
2
1
|
import { forwardRef, Children } from 'react';
|
|
3
2
|
import styled from 'styled-components';
|
|
4
3
|
import { jsx } from 'react/jsx-runtime';
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
const FullWidthCenterContent = styled.span.withConfig({
|
|
7
6
|
displayName: "InnerFullWidth__FullWidthCenterContent",
|
|
8
7
|
componentId: "sc-qeawkb-0"
|
|
9
8
|
})(["text-align:center;flex:1;"]);
|
|
10
|
-
|
|
9
|
+
const FullWidthInner = styled.span.withConfig({
|
|
11
10
|
displayName: "InnerFullWidth__FullWidthInner",
|
|
12
11
|
componentId: "sc-qeawkb-1"
|
|
13
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;}"]);
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const InnerFullWidth = /*#__PURE__*/forwardRef(function InnerFullWidth({
|
|
14
|
+
children
|
|
15
|
+
}, ref) {
|
|
16
16
|
// We need everything in elements for proper flexing 💪
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}) : child;
|
|
21
|
-
});
|
|
17
|
+
const updatedChildren = Children.map(children, child => typeof child !== 'object' ? /*#__PURE__*/jsx(FullWidthCenterContent, {
|
|
18
|
+
children: child
|
|
19
|
+
}) : child);
|
|
22
20
|
return /*#__PURE__*/jsx(FullWidthInner, {
|
|
23
21
|
ref: ref,
|
|
24
22
|
children: updatedChildren
|
|
@@ -1,43 +1,33 @@
|
|
|
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';
|
|
5
1
|
import { forwardRef, useState, useEffect, Children, isValidElement, cloneElement } from 'react';
|
|
6
2
|
import { Button } from '../Button.js';
|
|
7
3
|
import { jsx } from 'react/jsx-runtime';
|
|
8
4
|
import { Tooltip } from '../../Tooltip/Tooltip.js';
|
|
9
5
|
import { ButtonGroup } from '../ButtonGroup/ButtonGroup.js';
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
pickedIndexes = _useState2[0],
|
|
21
|
-
setPickedIndexes = _useState2[1];
|
|
22
|
-
useEffect(function () {
|
|
7
|
+
const ToggleButton = /*#__PURE__*/forwardRef(function ToggleButton({
|
|
8
|
+
children,
|
|
9
|
+
multiple,
|
|
10
|
+
selectedIndexes,
|
|
11
|
+
onChange,
|
|
12
|
+
...props
|
|
13
|
+
}, ref) {
|
|
14
|
+
const [pickedIndexes, setPickedIndexes] = useState(selectedIndexes || []);
|
|
15
|
+
useEffect(() => {
|
|
23
16
|
if (Array.isArray(selectedIndexes)) {
|
|
24
17
|
setPickedIndexes(selectedIndexes);
|
|
25
18
|
}
|
|
26
19
|
}, [selectedIndexes]);
|
|
27
20
|
function updateProps(child, isSelected, index) {
|
|
28
|
-
|
|
21
|
+
const childElement = child;
|
|
29
22
|
if ( /*#__PURE__*/isValidElement(child) && child.type === Button) {
|
|
30
|
-
|
|
23
|
+
const buttonProps = {
|
|
31
24
|
'aria-pressed': isSelected ? true : undefined,
|
|
32
25
|
variant: isSelected ? 'contained' : 'outlined',
|
|
33
|
-
onClick:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var updatedSelection = [index];
|
|
26
|
+
onClick: e => {
|
|
27
|
+
childElement.props?.onClick?.(e);
|
|
28
|
+
let updatedSelection = [index];
|
|
37
29
|
if (multiple) {
|
|
38
|
-
updatedSelection = pickedIndexes.includes(index) ? pickedIndexes.filter(
|
|
39
|
-
return i !== index;
|
|
40
|
-
}) : [].concat(_toConsumableArray(pickedIndexes), [index]);
|
|
30
|
+
updatedSelection = pickedIndexes.includes(index) ? pickedIndexes.filter(i => i !== index) : [...pickedIndexes, index];
|
|
41
31
|
}
|
|
42
32
|
setPickedIndexes(updatedSelection);
|
|
43
33
|
if (onChange) {
|
|
@@ -48,11 +38,11 @@ var ToggleButton = /*#__PURE__*/forwardRef(function ToggleButton(_ref, ref) {
|
|
|
48
38
|
return /*#__PURE__*/cloneElement(child, buttonProps);
|
|
49
39
|
}
|
|
50
40
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
const updatedChildren = Children.map(children, (child, index) => {
|
|
42
|
+
const isSelected = pickedIndexes.includes(index);
|
|
43
|
+
const childElement = child;
|
|
54
44
|
if ( /*#__PURE__*/isValidElement(child) && child.type === Tooltip) {
|
|
55
|
-
|
|
45
|
+
const updatedGrandChildren = Children.map(childElement.props.children, grandChild => {
|
|
56
46
|
return updateProps(grandChild, isSelected, index);
|
|
57
47
|
});
|
|
58
48
|
return /*#__PURE__*/cloneElement(childElement, null, updatedGrandChildren[0]);
|
|
@@ -60,11 +50,11 @@ var ToggleButton = /*#__PURE__*/forwardRef(function ToggleButton(_ref, ref) {
|
|
|
60
50
|
return updateProps(childElement, isSelected, index);
|
|
61
51
|
}
|
|
62
52
|
});
|
|
63
|
-
return /*#__PURE__*/jsx(ButtonGroup,
|
|
64
|
-
ref: ref
|
|
65
|
-
|
|
53
|
+
return /*#__PURE__*/jsx(ButtonGroup, {
|
|
54
|
+
ref: ref,
|
|
55
|
+
...props,
|
|
66
56
|
children: updatedChildren
|
|
67
|
-
})
|
|
57
|
+
});
|
|
68
58
|
});
|
|
69
59
|
|
|
70
60
|
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
|
+
const Button = Button$1;
|
|
6
6
|
Button.Group = ButtonGroup;
|
|
7
7
|
Button.Toggle = ToggleButton;
|
|
8
8
|
Button.Group.displayName = 'Button.Group';
|