@equinor/eds-core-react 0.32.4 → 0.33.1
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 +362 -367
- package/dist/esm/components/Accordion/AccordionHeader.js +13 -24
- package/dist/esm/components/Accordion/AccordionHeaderActions.js +3 -3
- package/dist/esm/components/Accordion/AccordionHeaderTitle.js +5 -5
- package/dist/esm/components/Accordion/AccordionPanel.js +3 -3
- package/dist/esm/components/Autocomplete/Autocomplete.js +5 -6
- package/dist/esm/components/Autocomplete/Option.js +14 -15
- package/dist/esm/components/Avatar/Avatar.js +6 -7
- package/dist/esm/components/Banner/Banner.js +3 -3
- package/dist/esm/components/Banner/BannerActions.js +3 -3
- package/dist/esm/components/Banner/BannerIcon.js +3 -3
- package/dist/esm/components/Breadcrumbs/Breadcrumb.js +1 -1
- package/dist/esm/components/Breadcrumbs/Breadcrumbs.js +4 -4
- package/dist/esm/components/Button/Button.js +1 -1
- package/dist/esm/components/Button/ButtonGroup/ButtonGroup.js +3 -3
- package/dist/esm/components/Button/ToggleButton/ToggleButton.js +1 -1
- package/dist/esm/components/Card/Card.js +3 -3
- package/dist/esm/components/Card/CardActions.js +4 -4
- package/dist/esm/components/Card/CardMedia.js +3 -3
- package/dist/esm/components/Checkbox/Checkbox.js +3 -3
- package/dist/esm/components/Checkbox/Input.js +9 -9
- package/dist/esm/components/Chip/Chip.js +24 -23
- package/dist/esm/components/Chip/Icon.js +4 -4
- package/dist/esm/components/Dialog/Dialog.js +5 -6
- package/dist/esm/components/Dialog/DialogContent.js +3 -3
- package/dist/esm/components/Divider/Divider.js +9 -9
- package/dist/esm/components/Icon/Icon.js +20 -21
- package/dist/esm/components/Input/Input.js +21 -21
- package/dist/esm/components/InputWrapper/InputWrapper.js +2 -0
- package/dist/esm/components/Label/Label.js +3 -3
- package/dist/esm/components/Pagination/Pagination.js +5 -5
- package/dist/esm/components/Pagination/PaginationItem.js +4 -4
- package/dist/esm/components/Paper/Paper.js +2 -1
- package/dist/esm/components/Progress/Circular/CircularProgress.js +3 -3
- package/dist/esm/components/Progress/Star/StarProgress.js +5 -5
- package/dist/esm/components/Radio/Radio.js +12 -12
- package/dist/esm/components/Search/Search.js +4 -2
- package/dist/esm/components/SideBar/SideBar.context.js +1 -1
- package/dist/esm/components/SideBar/SideBarToggle.js +1 -0
- package/dist/esm/components/Slider/Slider.js +18 -16
- package/dist/esm/components/Snackbar/Snackbar.js +7 -7
- package/dist/esm/components/Switch/Switch.js +6 -6
- package/dist/esm/components/Switch/Switch.styles.js +1 -1
- package/dist/esm/components/Switch/SwitchDefault.js +6 -6
- package/dist/esm/components/Switch/SwitchSmall.js +3 -3
- package/dist/esm/components/Table/Caption.js +12 -8
- package/dist/esm/components/Table/HeaderCell/HeaderCell.js +9 -5
- package/dist/esm/components/Table/Row/Row.js +12 -16
- package/dist/esm/components/TableOfContents/TableOfContents.js +3 -4
- package/dist/esm/components/Tabs/Tab.js +7 -4
- package/dist/esm/components/Tabs/TabList.js +20 -19
- package/dist/esm/components/Tabs/TabPanels.js +7 -5
- package/dist/esm/components/TextField/TextField.js +2 -2
- package/dist/esm/components/Textarea/Textarea.js +1 -5
- package/dist/esm/components/TopBar/TopBar.js +3 -3
- package/dist/esm/components/Typography/Typography.js +11 -6
- package/dist/types/components/Autocomplete/Option.d.ts +3 -11
- package/dist/types/components/Button/Button.d.ts +1 -1
- package/dist/types/components/Chip/Icon.d.ts +8 -3
- package/dist/types/components/Icon/Icon.d.ts +1 -1
- package/dist/types/components/Icon/Icon.types.d.ts +1 -1
- package/dist/types/components/Pagination/PaginationItem.d.ts +1 -1
- package/dist/types/components/Paper/Paper.d.ts +2 -2
- 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/Slider/Slider.d.ts +4 -4
- package/dist/types/components/Switch/Switch.styles.d.ts +812 -5
- package/dist/types/components/Tabs/Tab.d.ts +4 -1
- package/dist/types/components/Tabs/TabPanels.d.ts +6 -2
- package/dist/types/components/Tabs/Tabs.context.d.ts +1 -1
- package/dist/types/components/Tabs/Tabs.d.ts +4 -4
- package/package.json +19 -19
|
@@ -22,7 +22,7 @@ var SideBarProvider = function SideBarProvider(_ref) {
|
|
|
22
22
|
isOpen: open
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
|
-
onToggle === null || onToggle === void 0
|
|
25
|
+
onToggle === null || onToggle === void 0 || onToggle(open);
|
|
26
26
|
}, [onToggle]);
|
|
27
27
|
var setOnToggle = function setOnToggle(onToggle) {
|
|
28
28
|
setState(function (prevState) {
|
|
@@ -42,6 +42,7 @@ var SideBarToggle = /*#__PURE__*/forwardRef(function SideBarToggle(_ref2, ref) {
|
|
|
42
42
|
onClick: function onClick() {
|
|
43
43
|
return setIsOpen(!isOpen);
|
|
44
44
|
},
|
|
45
|
+
"aria-label": isOpen ? 'Collapse' : 'Expand',
|
|
45
46
|
children: /*#__PURE__*/jsx(Icon, {
|
|
46
47
|
size: 24,
|
|
47
48
|
data: isOpen ? collapse : expand,
|
|
@@ -24,17 +24,17 @@ var wrapperGrid = css(["display:grid;grid-template-rows:max-content 24px;grid-te
|
|
|
24
24
|
var RangeWrapper = styled.div.attrs(function (_ref) {
|
|
25
25
|
var $min = _ref.$min,
|
|
26
26
|
$max = _ref.$max,
|
|
27
|
-
valA = _ref
|
|
28
|
-
valB = _ref
|
|
29
|
-
disabled = _ref
|
|
27
|
+
$valA = _ref.$valA,
|
|
28
|
+
$valB = _ref.$valB,
|
|
29
|
+
$disabled = _ref.$disabled,
|
|
30
30
|
style = _ref.style;
|
|
31
31
|
return {
|
|
32
32
|
style: _objectSpread({
|
|
33
|
-
'--a': valA,
|
|
34
|
-
'--b': valB,
|
|
33
|
+
'--a': $valA,
|
|
34
|
+
'--b': $valB,
|
|
35
35
|
'--min': $min,
|
|
36
36
|
'--max': $max,
|
|
37
|
-
'--background': disabled ? track.entities.indicator.states.disabled.background : track.entities.indicator.background
|
|
37
|
+
'--background': $disabled ? track.entities.indicator.states.disabled.background : track.entities.indicator.background
|
|
38
38
|
}, style)
|
|
39
39
|
};
|
|
40
40
|
}).withConfig({
|
|
@@ -91,8 +91,9 @@ var Slider = /*#__PURE__*/forwardRef(function Slider(_ref3, ref) {
|
|
|
91
91
|
ariaLabelledby = _ref3.ariaLabelledby,
|
|
92
92
|
ariaLabelledbyNative = _ref3['aria-labelledby'],
|
|
93
93
|
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
94
|
-
var
|
|
95
|
-
var
|
|
94
|
+
var isNumber = !Array.isArray(value);
|
|
95
|
+
var isRangeSlider = !isNumber && value.length === 2;
|
|
96
|
+
var parsedValue = isNumber ? [value] : value;
|
|
96
97
|
var _useState = useState(parsedValue),
|
|
97
98
|
_useState2 = _slicedToArray(_useState, 2),
|
|
98
99
|
initalValue = _useState2[0],
|
|
@@ -112,9 +113,10 @@ var Slider = /*#__PURE__*/forwardRef(function Slider(_ref3, ref) {
|
|
|
112
113
|
setSliderValue(value);
|
|
113
114
|
}
|
|
114
115
|
} else {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
var numberValue = Number(value);
|
|
117
|
+
if (numberValue !== initalValue[0]) {
|
|
118
|
+
setInitalValue([numberValue]);
|
|
119
|
+
setSliderValue([numberValue]);
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
122
|
}, [value, initalValue, isRangeSlider]);
|
|
@@ -130,12 +132,12 @@ var Slider = /*#__PURE__*/forwardRef(function Slider(_ref3, ref) {
|
|
|
130
132
|
if (valueArrIdx === 0 && _newValue[0] >= _newValue[1]) {
|
|
131
133
|
var _maxRange$current;
|
|
132
134
|
_newValue[0] = _newValue[1];
|
|
133
|
-
(_maxRange$current = maxRange.current) === null || _maxRange$current === void 0
|
|
135
|
+
(_maxRange$current = maxRange.current) === null || _maxRange$current === void 0 || _maxRange$current.focus();
|
|
134
136
|
}
|
|
135
137
|
if (valueArrIdx === 1 && _newValue[1] <= _newValue[0]) {
|
|
136
138
|
var _minRange$current;
|
|
137
139
|
_newValue[1] = _newValue[0];
|
|
138
|
-
(_minRange$current = minRange.current) === null || _minRange$current === void 0
|
|
140
|
+
(_minRange$current = minRange.current) === null || _minRange$current === void 0 || _minRange$current.focus();
|
|
139
141
|
}
|
|
140
142
|
setSliderValue(_newValue);
|
|
141
143
|
if (onChange) {
|
|
@@ -220,11 +222,11 @@ var Slider = /*#__PURE__*/forwardRef(function Slider(_ref3, ref) {
|
|
|
220
222
|
ref: ref,
|
|
221
223
|
role: "group",
|
|
222
224
|
"aria-labelledby": getAriaLabelledby(),
|
|
223
|
-
valA: sliderValue[0],
|
|
224
|
-
valB: sliderValue[1],
|
|
225
|
+
$valA: sliderValue[0],
|
|
226
|
+
$valB: sliderValue[1],
|
|
225
227
|
$max: max,
|
|
226
228
|
$min: min,
|
|
227
|
-
disabled: disabled,
|
|
229
|
+
$disabled: disabled,
|
|
228
230
|
onMouseMove: findClosestRange,
|
|
229
231
|
onMouseDown: handleDragging,
|
|
230
232
|
onMouseUp: handleDragging,
|
|
@@ -16,13 +16,13 @@ var StyledSnackbar = styled(Paper).withConfig({
|
|
|
16
16
|
componentId: "sc-ac6no8-0"
|
|
17
17
|
})(function (_ref) {
|
|
18
18
|
var theme = _ref.theme,
|
|
19
|
-
placement = _ref
|
|
19
|
+
$placement = _ref.$placement;
|
|
20
20
|
return css(["position:fixed;background-color:", ";", " ", " ", " min-height:", ";box-sizing:border-box;z-index:1400;", " a,button{color:", ";}"], theme.background, spacingsTemplate(theme.spacings), bordersTemplate(theme.border), typographyTemplate(theme.typography), theme.minHeight, {
|
|
21
|
-
top: placement.includes('top') ? theme.spacings.top : placement === 'left' || placement === 'right' ? '50%' : undefined,
|
|
22
|
-
bottom: placement.includes('bottom') ? theme.spacings.bottom : undefined,
|
|
23
|
-
right: placement.includes('right') ? theme.spacings.right : undefined,
|
|
24
|
-
left: placement.includes('left') ? theme.spacings.left : placement === 'top' || placement === 'bottom' ? '50%' : undefined,
|
|
25
|
-
transform: placement === 'left' || placement === 'right' ? 'translateY(-50%)' : placement === 'top' || placement === 'bottom' ? 'translateX(-50%)' : undefined
|
|
21
|
+
top: $placement.includes('top') ? theme.spacings.top : $placement === 'left' || $placement === 'right' ? '50%' : undefined,
|
|
22
|
+
bottom: $placement.includes('bottom') ? theme.spacings.bottom : undefined,
|
|
23
|
+
right: $placement.includes('right') ? theme.spacings.right : undefined,
|
|
24
|
+
left: $placement.includes('left') ? theme.spacings.left : $placement === 'top' || $placement === 'bottom' ? '50%' : undefined,
|
|
25
|
+
transform: $placement === 'left' || $placement === 'right' ? 'translateY(-50%)' : $placement === 'top' || $placement === 'bottom' ? 'translateX(-50%)' : undefined
|
|
26
26
|
}, theme.entities.button.typography.color);
|
|
27
27
|
});
|
|
28
28
|
var Snackbar = /*#__PURE__*/forwardRef(function Snackbar(_ref2, ref) {
|
|
@@ -54,7 +54,7 @@ var Snackbar = /*#__PURE__*/forwardRef(function Snackbar(_ref2, ref) {
|
|
|
54
54
|
}, [open, autoHideDuration, setVisible, onClose]);
|
|
55
55
|
var props = _objectSpread({
|
|
56
56
|
ref: ref,
|
|
57
|
-
placement: placement
|
|
57
|
+
$placement: placement
|
|
58
58
|
}, rest);
|
|
59
59
|
var _useEds = useEds(),
|
|
60
60
|
density = _useEds.density;
|
|
@@ -14,11 +14,11 @@ var StyledLabel = styled.label.withConfig({
|
|
|
14
14
|
displayName: "Switch__StyledLabel",
|
|
15
15
|
componentId: "sc-sdaahx-0"
|
|
16
16
|
})(["cursor:", ";border:none;background-color:transparent;vertical-align:middle;display:inline-flex;align-items:center;position:relative;gap:", ";"], function (_ref) {
|
|
17
|
-
var isDisabled = _ref
|
|
18
|
-
return isDisabled ? 'not-allowed' : 'pointer';
|
|
17
|
+
var $isDisabled = _ref.$isDisabled;
|
|
18
|
+
return $isDisabled ? 'not-allowed' : 'pointer';
|
|
19
19
|
}, function (_ref2) {
|
|
20
|
-
var size = _ref2
|
|
21
|
-
return size === 'small' ? '12px' : '8px';
|
|
20
|
+
var $size = _ref2.$size;
|
|
21
|
+
return $size === 'small' ? '12px' : '8px';
|
|
22
22
|
});
|
|
23
23
|
var Label = styled.span.withConfig({
|
|
24
24
|
displayName: "Switch__Label",
|
|
@@ -45,8 +45,8 @@ var Switch = /*#__PURE__*/forwardRef(function Switch(_ref4, ref) {
|
|
|
45
45
|
return /*#__PURE__*/jsx(ThemeProvider, {
|
|
46
46
|
theme: token,
|
|
47
47
|
children: label ? /*#__PURE__*/jsxs(StyledLabel, {
|
|
48
|
-
size: size,
|
|
49
|
-
isDisabled: disabled,
|
|
48
|
+
$size: size,
|
|
49
|
+
$isDisabled: disabled,
|
|
50
50
|
className: className,
|
|
51
51
|
style: style,
|
|
52
52
|
children: [size === 'small' ? /*#__PURE__*/jsx(SwitchSmall, _objectSpread(_objectSpread({
|
|
@@ -27,6 +27,6 @@ var BaseInput = styled.input.attrs(function (_ref2) {
|
|
|
27
27
|
var GridWrapper = styled.span.withConfig({
|
|
28
28
|
displayName: "Switchstyles__GridWrapper",
|
|
29
29
|
componentId: "sc-x39lde-2"
|
|
30
|
-
})(["display:inline-grid;vertical-align:middle;grid:[input] 1fr / [input] 1fr;place-items:center;"]);
|
|
30
|
+
})(["display:inline-grid;vertical-align:middle;grid:[input] 1fr / [input] 1fr;place-items:center;isolation:isolate;"]);
|
|
31
31
|
|
|
32
32
|
export { BaseInput, BaseInputWrapper, GridWrapper };
|
|
@@ -19,11 +19,11 @@ var Track = styled.span.withConfig({
|
|
|
19
19
|
displayName: "SwitchDefault__Track",
|
|
20
20
|
componentId: "sc-16ym5pn-1"
|
|
21
21
|
})(function (_ref2) {
|
|
22
|
-
var isDisabled = _ref2
|
|
22
|
+
var $isDisabled = _ref2.$isDisabled,
|
|
23
23
|
_ref2$theme = _ref2.theme,
|
|
24
24
|
states = _ref2$theme.states,
|
|
25
25
|
track = _ref2$theme.entities.track;
|
|
26
|
-
return css(["", " border:none;width:", ";height:", ";background-color:", ";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);transition:background 0.36s;", ""], bordersTemplate(track.border), track.width, track.height, track.background, isDisabled && {
|
|
26
|
+
return css(["", " border:none;width:", ";height:", ";background-color:", ";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);transition:background 0.36s;", ""], bordersTemplate(track.border), track.width, track.height, track.background, $isDisabled && {
|
|
27
27
|
backgroundColor: states.disabled.background
|
|
28
28
|
});
|
|
29
29
|
});
|
|
@@ -31,11 +31,11 @@ var Handle = styled.span.withConfig({
|
|
|
31
31
|
displayName: "SwitchDefault__Handle",
|
|
32
32
|
componentId: "sc-16ym5pn-2"
|
|
33
33
|
})(function (_ref3) {
|
|
34
|
-
var isDisabled = _ref3
|
|
34
|
+
var $isDisabled = _ref3.$isDisabled,
|
|
35
35
|
_ref3$theme = _ref3.theme,
|
|
36
36
|
states = _ref3$theme.states,
|
|
37
37
|
handle = _ref3$theme.entities.handle;
|
|
38
|
-
return css(["background-color:", ";", " box-shadow:", ";width:", ";height:", ";border-radius:50%;display:inline-block;position:absolute;top:50%;transform:translate(0,-50%);left:4px;transition:transform 0.36s cubic-bezier(0.78,0.14,0.15,0.86);"], handle.background, isDisabled && {
|
|
38
|
+
return css(["background-color:", ";", " box-shadow:", ";width:", ";height:", ";border-radius:50%;display:inline-block;position:absolute;top:50%;transform:translate(0,-50%);left:4px;transition:transform 0.36s cubic-bezier(0.78,0.14,0.15,0.86);"], handle.background, $isDisabled && {
|
|
39
39
|
backgroundColor: states.disabled.background
|
|
40
40
|
}, handle.boxShadow, handle.width, handle.height);
|
|
41
41
|
});
|
|
@@ -52,9 +52,9 @@ var SwitchDefault = /*#__PURE__*/forwardRef(function SwitchDefault(_ref4, ref) {
|
|
|
52
52
|
disabled: disabled
|
|
53
53
|
})), /*#__PURE__*/jsxs(BaseInputWrapper, {
|
|
54
54
|
children: [/*#__PURE__*/jsx(Track, {
|
|
55
|
-
isDisabled: disabled
|
|
55
|
+
$isDisabled: disabled
|
|
56
56
|
}), /*#__PURE__*/jsx(Handle, {
|
|
57
|
-
isDisabled: disabled
|
|
57
|
+
$isDisabled: disabled
|
|
58
58
|
})]
|
|
59
59
|
})]
|
|
60
60
|
});
|
|
@@ -23,11 +23,11 @@ var Track = styled.span.withConfig({
|
|
|
23
23
|
displayName: "SwitchSmall__Track",
|
|
24
24
|
componentId: "sc-1a99mis-1"
|
|
25
25
|
})(function (_ref2) {
|
|
26
|
-
var isDisabled = _ref2
|
|
26
|
+
var $isDisabled = _ref2.$isDisabled,
|
|
27
27
|
_ref2$theme = _ref2.theme,
|
|
28
28
|
states = _ref2$theme.states,
|
|
29
29
|
track = _ref2$theme.entities.track;
|
|
30
|
-
return css(["width:", ";height:", ";border-radius:10px;border:none;background-color:", ";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);"], track.width, track.height, isDisabled ? states.disabled.background : track.states.disabled.background);
|
|
30
|
+
return css(["width:", ";height:", ";border-radius:10px;border:none;background-color:", ";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);"], track.width, track.height, $isDisabled ? states.disabled.background : track.states.disabled.background);
|
|
31
31
|
});
|
|
32
32
|
var Handle = styled.span.withConfig({
|
|
33
33
|
displayName: "SwitchSmall__Handle",
|
|
@@ -49,7 +49,7 @@ var SwitchSmall = /*#__PURE__*/forwardRef(function SwitchSmall(_ref4, ref) {
|
|
|
49
49
|
disabled: disabled
|
|
50
50
|
})), /*#__PURE__*/jsxs(BaseInputWrapper, {
|
|
51
51
|
children: [/*#__PURE__*/jsx(Track, {
|
|
52
|
-
isDisabled: disabled
|
|
52
|
+
$isDisabled: disabled
|
|
53
53
|
}), /*#__PURE__*/jsx(Handle, {})]
|
|
54
54
|
})]
|
|
55
55
|
});
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
2
3
|
import { forwardRef } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
+
import styled, { css } from 'styled-components';
|
|
4
5
|
import { jsx } from 'react/jsx-runtime';
|
|
5
6
|
|
|
7
|
+
var _excluded = ["captionSide"];
|
|
6
8
|
var StyledCaption = styled.caption.withConfig({
|
|
7
9
|
displayName: "Caption__StyledCaption",
|
|
8
10
|
componentId: "sc-rtfr07-0"
|
|
9
11
|
})(function (_ref) {
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
captionSide: captionSide
|
|
14
|
-
};
|
|
12
|
+
var $captionSide = _ref.$captionSide;
|
|
13
|
+
return css(["caption-side:", ";"], $captionSide);
|
|
15
14
|
});
|
|
16
|
-
var Caption = /*#__PURE__*/forwardRef(function Caption(
|
|
17
|
-
|
|
15
|
+
var Caption = /*#__PURE__*/forwardRef(function Caption(_ref2, ref) {
|
|
16
|
+
var _ref2$captionSide = _ref2.captionSide,
|
|
17
|
+
captionSide = _ref2$captionSide === void 0 ? 'top' : _ref2$captionSide,
|
|
18
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
19
|
+
return /*#__PURE__*/jsx(StyledCaption, _objectSpread(_objectSpread({
|
|
20
|
+
$captionSide: captionSide
|
|
21
|
+
}, props), {}, {
|
|
18
22
|
ref: ref
|
|
19
23
|
}));
|
|
20
24
|
});
|
|
@@ -7,13 +7,13 @@ import { token } from './HeaderCell.tokens.js';
|
|
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
|
8
8
|
import { useEds } from '../../EdsProvider/eds.context.js';
|
|
9
9
|
|
|
10
|
-
var _excluded = ["children", "sort"];
|
|
10
|
+
var _excluded = ["children", "sort", "sticky"];
|
|
11
11
|
var StyledTableCell = styled.th.withConfig({
|
|
12
12
|
displayName: "HeaderCell__StyledTableCell",
|
|
13
13
|
componentId: "sc-18w2o3a-0"
|
|
14
14
|
})(function (props) {
|
|
15
15
|
var theme = props.theme,
|
|
16
|
-
sticky = props
|
|
16
|
+
$sticky = props.$sticky;
|
|
17
17
|
var background = theme.background,
|
|
18
18
|
height = theme.height,
|
|
19
19
|
typography = theme.typography,
|
|
@@ -28,7 +28,7 @@ var StyledTableCell = styled.th.withConfig({
|
|
|
28
28
|
if (ariaSort && ariaSort !== 'none') {
|
|
29
29
|
sortStylingActive = css(["", ";background:", ";color:", ";"], activeToken.border.type === 'bordergroup' ? css(["border-color:", ";"], activeToken.border.bottom.color) : '', activeToken.background, activeToken.typography.color);
|
|
30
30
|
}
|
|
31
|
-
return css(["min-height:", ";height:", ";background:", ";box-sizing:border-box;", " ", " ", " ", " ", " ", ""], height, height, background, spacingsTemplate(spacings), typographyTemplate(typography), bordersTemplate(theme.border), sortStylingHover, sortStylingActive, sticky ? css(["position:sticky;top:0;z-index:1;"]) : '');
|
|
31
|
+
return css(["min-height:", ";height:", ";background:", ";box-sizing:border-box;", " ", " ", " ", " ", " ", ""], height, height, background, spacingsTemplate(spacings), typographyTemplate(typography), bordersTemplate(theme.border), sortStylingHover, sortStylingActive, $sticky ? css(["position:sticky;top:0;z-index:1;"]) : '');
|
|
32
32
|
});
|
|
33
33
|
var CellInner = styled.div.withConfig({
|
|
34
34
|
displayName: "HeaderCell__CellInner",
|
|
@@ -37,18 +37,22 @@ var CellInner = styled.div.withConfig({
|
|
|
37
37
|
var TableHeaderCell = /*#__PURE__*/forwardRef(function TableHeaderCell(_ref, ref) {
|
|
38
38
|
var children = _ref.children,
|
|
39
39
|
sort = _ref.sort,
|
|
40
|
+
sticky = _ref.sticky,
|
|
40
41
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
41
42
|
var _useEds = useEds(),
|
|
42
43
|
density = _useEds.density;
|
|
43
44
|
var token$1 = useToken({
|
|
44
45
|
density: density
|
|
45
46
|
}, token);
|
|
47
|
+
var props = _objectSpread({
|
|
48
|
+
ref: ref,
|
|
49
|
+
$sticky: sticky
|
|
50
|
+
}, rest);
|
|
46
51
|
return /*#__PURE__*/jsx(ThemeProvider, {
|
|
47
52
|
theme: token$1,
|
|
48
53
|
children: /*#__PURE__*/jsx(StyledTableCell, _objectSpread(_objectSpread({
|
|
49
54
|
"aria-sort": sort
|
|
50
|
-
},
|
|
51
|
-
ref: ref,
|
|
55
|
+
}, props), {}, {
|
|
52
56
|
children: /*#__PURE__*/jsx(CellInner, {
|
|
53
57
|
children: children
|
|
54
58
|
})
|
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
-
import
|
|
3
|
-
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
3
|
import { forwardRef } from 'react';
|
|
5
4
|
import styled from 'styled-components';
|
|
6
5
|
import { token } from './Row.tokens.js';
|
|
7
6
|
import { jsx } from 'react/jsx-runtime';
|
|
8
7
|
|
|
8
|
+
var _excluded = ["children", "active"];
|
|
9
|
+
var _token$states$hover;
|
|
9
10
|
var StyledRow = styled.tr.withConfig({
|
|
10
11
|
displayName: "Row__StyledRow",
|
|
11
12
|
componentId: "sc-12c5lns-0"
|
|
12
|
-
})(function (_ref) {
|
|
13
|
-
var _token$states$active
|
|
14
|
-
var active = _ref
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
'@media (hover: hover) and (pointer: fine)': {
|
|
18
|
-
':hover': {
|
|
19
|
-
background: (_token$states$hover = token.states.hover) === null || _token$states$hover === void 0 ? void 0 : _token$states$hover.background
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
});
|
|
13
|
+
})(["background:", ";@media (hover:hover) and (pointer:fine){&:hover{background:", ";}}"], function (_ref) {
|
|
14
|
+
var _token$states$active;
|
|
15
|
+
var $active = _ref.$active;
|
|
16
|
+
return $active ? (_token$states$active = token.states.active) === null || _token$states$active === void 0 ? void 0 : _token$states$active.background : null;
|
|
17
|
+
}, (_token$states$hover = token.states.hover) === null || _token$states$hover === void 0 ? void 0 : _token$states$hover.background);
|
|
24
18
|
var Row = /*#__PURE__*/forwardRef(function Row(_ref2, ref) {
|
|
25
|
-
var
|
|
26
|
-
|
|
19
|
+
var children = _ref2.children,
|
|
20
|
+
active = _ref2.active,
|
|
21
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
27
22
|
return /*#__PURE__*/jsx(StyledRow, _objectSpread(_objectSpread({}, props), {}, {
|
|
23
|
+
$active: active,
|
|
28
24
|
ref: ref,
|
|
29
25
|
children: children
|
|
30
26
|
}));
|
|
@@ -15,8 +15,8 @@ var StyledTableOfContents = styled.nav.withConfig({
|
|
|
15
15
|
componentId: "sc-q23s6y-0"
|
|
16
16
|
})(function (_ref) {
|
|
17
17
|
var theme = _ref.theme,
|
|
18
|
-
sticky = _ref
|
|
19
|
-
return css(["margin-top:", ";margin-bottom:", ";", ""], theme.spacings.top, theme.spacings.bottom, sticky && css(["position:fixed;top:", ";right:", ";"], theme.entities.sticky.spacings.top, theme.entities.sticky.spacings.right));
|
|
18
|
+
$sticky = _ref.$sticky;
|
|
19
|
+
return css(["margin-top:", ";margin-bottom:", ";", ""], theme.spacings.top, theme.spacings.bottom, $sticky && css(["position:fixed;top:", ";right:", ";"], theme.entities.sticky.spacings.top, theme.entities.sticky.spacings.right));
|
|
20
20
|
});
|
|
21
21
|
var TocList = styled(List).withConfig({
|
|
22
22
|
displayName: "TableOfContents__TocList",
|
|
@@ -45,8 +45,7 @@ var TableOfContents = /*#__PURE__*/forwardRef(function TableOfContents(_ref3, re
|
|
|
45
45
|
theme: token,
|
|
46
46
|
children: /*#__PURE__*/jsxs(StyledTableOfContents, _objectSpread(_objectSpread({
|
|
47
47
|
ref: ref,
|
|
48
|
-
|
|
49
|
-
sticky: sticky
|
|
48
|
+
$sticky: sticky
|
|
50
49
|
}, rest), {}, {
|
|
51
50
|
children: [/*#__PURE__*/jsx(TocLabel, {
|
|
52
51
|
variant: "overline",
|
|
@@ -5,18 +5,19 @@ import styled, { css } from 'styled-components';
|
|
|
5
5
|
import { spacingsTemplate, typographyTemplate, outlineTemplate, bordersTemplate } from '@equinor/eds-utils';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
|
-
var _excluded = ["active"];
|
|
8
|
+
var _excluded = ["active", "value"];
|
|
9
9
|
var StyledTab = styled.button.attrs(function (_ref) {
|
|
10
10
|
var _ref$$active = _ref.$active,
|
|
11
11
|
$active = _ref$$active === void 0 ? false : _ref$$active,
|
|
12
12
|
_ref$disabled = _ref.disabled,
|
|
13
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled
|
|
13
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
14
|
+
$value = _ref.$value;
|
|
14
15
|
return {
|
|
15
16
|
type: 'button',
|
|
16
17
|
role: 'tab',
|
|
17
18
|
'aria-selected': $active,
|
|
18
19
|
'aria-disabled': disabled,
|
|
19
|
-
tabIndex: $active ?
|
|
20
|
+
tabIndex: $value ? 0 : $active ? 0 : -1
|
|
20
21
|
};
|
|
21
22
|
}).withConfig({
|
|
22
23
|
displayName: "Tab__StyledTab",
|
|
@@ -30,10 +31,12 @@ var StyledTab = styled.button.attrs(function (_ref) {
|
|
|
30
31
|
});
|
|
31
32
|
var Tab = /*#__PURE__*/forwardRef(function Tab(_ref3, ref) {
|
|
32
33
|
var active = _ref3.active,
|
|
34
|
+
value = _ref3.value,
|
|
33
35
|
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
34
36
|
return /*#__PURE__*/jsx(StyledTab, _objectSpread({
|
|
35
37
|
ref: ref,
|
|
36
|
-
$active: active
|
|
38
|
+
$active: active,
|
|
39
|
+
$value: value
|
|
37
40
|
}, rest));
|
|
38
41
|
});
|
|
39
42
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
2
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
|
-
import { forwardRef, useContext, useRef, useState, useCallback,
|
|
4
|
+
import { forwardRef, useContext, useRef, useState, useCallback, Children, cloneElement } from 'react';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import { mergeRefs } from '@equinor/eds-utils';
|
|
7
7
|
import { TabsContext } from './Tabs.context.js';
|
|
@@ -20,11 +20,11 @@ var StyledTabList = styled.div.attrs(function () {
|
|
|
20
20
|
displayName: "TabList__StyledTabList",
|
|
21
21
|
componentId: "sc-1g1p5i1-0"
|
|
22
22
|
})(["display:grid;grid-auto-flow:column;grid-auto-columns:", ";overflow-x:", ";scroll-snap-type:x mandatory;overscroll-behavior-x:contain;@media (prefers-reduced-motion:no-preference){scroll-behavior:smooth;}@media (hover:none){overflow-x:scroll;-webkit-overflow-scrolling:touch;scrollbar-width:0;& ::-webkit-scrollbar{width:0;height:0;}}"], function (_ref) {
|
|
23
|
-
var variant = _ref
|
|
24
|
-
return variants[variant];
|
|
23
|
+
var $variant = _ref.$variant;
|
|
24
|
+
return variants[$variant];
|
|
25
25
|
}, function (_ref2) {
|
|
26
|
-
var scrollable = _ref2
|
|
27
|
-
return scrollable ? 'auto' : 'hidden';
|
|
26
|
+
var $scrollable = _ref2.$scrollable;
|
|
27
|
+
return $scrollable ? 'auto' : 'hidden';
|
|
28
28
|
});
|
|
29
29
|
var TabList = /*#__PURE__*/forwardRef(function TabsList(_ref3, ref) {
|
|
30
30
|
var _ref3$children = _ref3.children,
|
|
@@ -39,7 +39,7 @@ var TabList = /*#__PURE__*/forwardRef(function TabsList(_ref3, ref) {
|
|
|
39
39
|
_useContext$scrollabl = _useContext.scrollable,
|
|
40
40
|
scrollable = _useContext$scrollabl === void 0 ? false : _useContext$scrollabl,
|
|
41
41
|
tabsFocused = _useContext.tabsFocused;
|
|
42
|
-
var currentTab = useRef(
|
|
42
|
+
var currentTab = useRef();
|
|
43
43
|
var _useState = useState(false),
|
|
44
44
|
_useState2 = _slicedToArray(_useState, 2),
|
|
45
45
|
arrowNavigating = _useState2[0],
|
|
@@ -50,18 +50,19 @@ var TabList = /*#__PURE__*/forwardRef(function TabsList(_ref3, ref) {
|
|
|
50
50
|
node.focus();
|
|
51
51
|
}
|
|
52
52
|
}, [arrowNavigating, tabsFocused]);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var tabRef =
|
|
53
|
+
var Tabs = Children.map(children, function (child, $index) {
|
|
54
|
+
var childProps = child.props;
|
|
55
|
+
var controlledActive = childProps.value;
|
|
56
|
+
var isActive = controlledActive ? controlledActive === activeTab : $index === activeTab;
|
|
57
|
+
var tabRef = isActive ? mergeRefs(child.ref, selectedTabRef) : child.ref;
|
|
58
|
+
if (isActive) currentTab.current = $index;
|
|
58
59
|
return /*#__PURE__*/cloneElement(child, {
|
|
59
|
-
id: "".concat(tabsId, "-tab-").concat(index + 1),
|
|
60
|
-
'aria-controls': "".concat(tabsId, "-panel-").concat(index + 1),
|
|
61
|
-
active:
|
|
62
|
-
index: index,
|
|
60
|
+
id: "".concat(tabsId, "-tab-").concat($index + 1),
|
|
61
|
+
'aria-controls': "".concat(tabsId, "-panel-").concat($index + 1),
|
|
62
|
+
active: isActive,
|
|
63
|
+
$index: $index,
|
|
63
64
|
onClick: function onClick() {
|
|
64
|
-
return handleChange(index);
|
|
65
|
+
return handleChange($index);
|
|
65
66
|
},
|
|
66
67
|
ref: tabRef
|
|
67
68
|
});
|
|
@@ -71,7 +72,7 @@ var TabList = /*#__PURE__*/forwardRef(function TabsList(_ref3, ref) {
|
|
|
71
72
|
return !childProps.disabled;
|
|
72
73
|
}).map(function (child) {
|
|
73
74
|
var childProps = child.props;
|
|
74
|
-
return childProps
|
|
75
|
+
return childProps.$index;
|
|
75
76
|
});
|
|
76
77
|
var firstFocusableChild = focusableChildren[0];
|
|
77
78
|
var lastFocusableChild = focusableChildren[focusableChildren.length - 1];
|
|
@@ -96,8 +97,8 @@ var TabList = /*#__PURE__*/forwardRef(function TabsList(_ref3, ref) {
|
|
|
96
97
|
onKeyDown: handleKeyPress,
|
|
97
98
|
ref: ref
|
|
98
99
|
}, props), {}, {
|
|
99
|
-
variant: variant,
|
|
100
|
-
scrollable: scrollable,
|
|
100
|
+
$variant: variant,
|
|
101
|
+
$scrollable: scrollable,
|
|
101
102
|
children: Tabs
|
|
102
103
|
}));
|
|
103
104
|
});
|
|
@@ -4,18 +4,20 @@ import { forwardRef, useContext, Children, cloneElement } from 'react';
|
|
|
4
4
|
import { TabsContext } from './Tabs.context.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
|
-
var _excluded = ["children"];
|
|
7
|
+
var _excluded = ["children", "conditionalRender"];
|
|
8
8
|
var TabPanels = /*#__PURE__*/forwardRef(function TabPanels(_ref, ref) {
|
|
9
9
|
var children = _ref.children,
|
|
10
|
+
conditionalRender = _ref.conditionalRender,
|
|
10
11
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
11
12
|
var _useContext = useContext(TabsContext),
|
|
12
13
|
activeTab = _useContext.activeTab,
|
|
13
14
|
tabsId = _useContext.tabsId;
|
|
14
|
-
var Panels = Children.map(children, function (child, index) {
|
|
15
|
-
if (activeTab !== index) return null;
|
|
15
|
+
var Panels = Children.map(children, function (child, $index) {
|
|
16
|
+
if (conditionalRender && activeTab !== $index) return null;
|
|
16
17
|
return /*#__PURE__*/cloneElement(child, {
|
|
17
|
-
id: "".concat(tabsId, "-panel-").concat(index + 1),
|
|
18
|
-
'aria-labelledby': "".concat(tabsId, "-tab-").concat(index + 1)
|
|
18
|
+
id: "".concat(tabsId, "-panel-").concat($index + 1),
|
|
19
|
+
'aria-labelledby': "".concat(tabsId, "-tab-").concat($index + 1),
|
|
20
|
+
hidden: activeTab !== $index
|
|
19
21
|
});
|
|
20
22
|
});
|
|
21
23
|
return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
|
|
@@ -10,7 +10,7 @@ import { Input } from '../Input/Input.js';
|
|
|
10
10
|
var _excluded = ["id", "label", "meta", "unit", "helperText", "placeholder", "disabled", "multiline", "className", "variant", "inputIcon", "helperIcon", "style", "rowsMax", "textareaRef", "inputRef"];
|
|
11
11
|
/** Proxy component for working around typescript and element type switching */
|
|
12
12
|
var Field = /*#__PURE__*/forwardRef(function Field(props, ref) {
|
|
13
|
-
return props
|
|
13
|
+
return props.$multiline ? /*#__PURE__*/jsx(Textarea, _objectSpread({
|
|
14
14
|
ref: ref
|
|
15
15
|
}, props)) : /*#__PURE__*/jsx(Input, _objectSpread({
|
|
16
16
|
ref: ref
|
|
@@ -49,7 +49,7 @@ var TextField = /*#__PURE__*/forwardRef(function TextField(_ref, ref) {
|
|
|
49
49
|
}),
|
|
50
50
|
rowsMax: rowsMax,
|
|
51
51
|
ref: inputRef || textareaRef,
|
|
52
|
-
multiline: multiline
|
|
52
|
+
$multiline: multiline
|
|
53
53
|
}, other);
|
|
54
54
|
var helperProps = {
|
|
55
55
|
id: null,
|
|
@@ -2,7 +2,6 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
2
2
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
4
|
import { forwardRef, useState, useCallback } from 'react';
|
|
5
|
-
import * as Input_tokens from '../Input/Input.tokens.js';
|
|
6
5
|
import { input as input$1 } from '../Input/Input.tokens.js';
|
|
7
6
|
import { useAutoResize, mergeRefs } from '@equinor/eds-utils';
|
|
8
7
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -19,7 +18,6 @@ var Textarea = /*#__PURE__*/forwardRef(function Textarea(_ref, ref) {
|
|
|
19
18
|
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
20
19
|
rowsMax = _ref.rowsMax,
|
|
21
20
|
other = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
-
var inputVariant = Input_tokens[variant] ? Input_tokens[variant] : input$1;
|
|
23
21
|
var _useState = useState(null),
|
|
24
22
|
_useState2 = _slicedToArray(_useState, 2),
|
|
25
23
|
textareaEl = _useState2[0],
|
|
@@ -44,9 +42,7 @@ var Textarea = /*#__PURE__*/forwardRef(function Textarea(_ref, ref) {
|
|
|
44
42
|
ref: combinedRef,
|
|
45
43
|
type: type,
|
|
46
44
|
disabled: disabled,
|
|
47
|
-
variant: variant
|
|
48
|
-
token: inputVariant,
|
|
49
|
-
density: density
|
|
45
|
+
variant: variant
|
|
50
46
|
}, other);
|
|
51
47
|
var adornmentsToTop = {
|
|
52
48
|
style: {
|
|
@@ -14,8 +14,8 @@ var StyledTopBar = styled(Paper).withConfig({
|
|
|
14
14
|
componentId: "sc-1yj236q-0"
|
|
15
15
|
})(function (_ref) {
|
|
16
16
|
var theme = _ref.theme,
|
|
17
|
-
sticky = _ref
|
|
18
|
-
return css(["height:", ";background:", ";box-sizing:border-box;display:grid;grid-column-gap:", ";grid-template-columns:auto 1fr auto;grid-template-areas:'left center right';align-items:center;", " ", ";", " ", ""], theme.height, theme.background, theme.spacings.left, bordersTemplate(theme.border), spacingsTemplate(theme.spacings), typographyTemplate(theme.typography), sticky && css(["position:sticky;top:0;z-index:1100;"]));
|
|
17
|
+
$sticky = _ref.$sticky;
|
|
18
|
+
return css(["height:", ";background:", ";box-sizing:border-box;display:grid;grid-column-gap:", ";grid-template-columns:auto 1fr auto;grid-template-areas:'left center right';align-items:center;", " ", ";", " ", ""], theme.height, theme.background, theme.spacings.left, bordersTemplate(theme.border), spacingsTemplate(theme.spacings), typographyTemplate(theme.typography), $sticky && css(["position:sticky;top:0;z-index:1100;"]));
|
|
19
19
|
});
|
|
20
20
|
var TopBar = /*#__PURE__*/forwardRef(function TopBar(_ref2, ref) {
|
|
21
21
|
var children = _ref2.children,
|
|
@@ -37,7 +37,7 @@ var TopBar = /*#__PURE__*/forwardRef(function TopBar(_ref2, ref) {
|
|
|
37
37
|
children: /*#__PURE__*/jsx(StyledTopBar, _objectSpread(_objectSpread({
|
|
38
38
|
forwardedAs: 'header',
|
|
39
39
|
elevation: elevation,
|
|
40
|
-
sticky: sticky
|
|
40
|
+
$sticky: sticky
|
|
41
41
|
}, rest), {}, {
|
|
42
42
|
children: children
|
|
43
43
|
}))
|