@equinor/eds-core-react 0.24.0 → 0.26.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.js +1820 -1633
- package/dist/esm/components/Autocomplete/Autocomplete.js +64 -70
- package/dist/esm/components/Autocomplete/Autocomplete.tokens.js +1 -0
- package/dist/esm/components/Button/Button.js +1 -1
- package/dist/esm/components/Input/Input.js +129 -32
- package/dist/esm/components/Input/Input.tokens.js +84 -56
- package/dist/esm/components/InputWrapper/HelperText/HelperText.js +49 -0
- package/dist/esm/components/InputWrapper/HelperText/HelperText.token.js +28 -0
- package/dist/esm/components/InputWrapper/InputWrapper.js +68 -0
- package/dist/esm/components/InputWrapper/InputWrapper.tokens.js +164 -0
- package/dist/esm/components/Menu/Menu.js +2 -2
- package/dist/esm/components/Pagination/Pagination.js +3 -3
- package/dist/esm/components/Popover/Popover.js +71 -56
- package/dist/esm/components/Popover/Popover.tokens.js +17 -2
- package/dist/esm/components/Search/Search.js +60 -187
- package/dist/esm/components/SideBar/SideBar.context.js +53 -0
- package/dist/esm/components/SideBar/SideBar.js +79 -0
- package/dist/esm/components/SideBar/SideBar.tokens.js +110 -0
- package/dist/esm/components/SideBar/SideBarButton/index.js +86 -0
- package/dist/esm/components/SideBar/SideBarContent.js +27 -0
- package/dist/esm/components/SideBar/SideBarFooter.js +27 -0
- package/dist/esm/components/SideBar/SideBarToggle.js +57 -0
- package/dist/esm/components/SideBar/SidebarLink/index.js +106 -0
- package/dist/esm/components/SideBar/index.js +20 -0
- package/dist/esm/components/TextField/TextField.js +52 -46
- package/dist/esm/components/Textarea/Textarea.js +26 -43
- package/dist/esm/components/Tooltip/Tooltip.js +38 -37
- package/dist/esm/components/TopBar/Header.js +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/types/components/Input/Input.d.ts +22 -15
- package/dist/types/components/InputWrapper/HelperText/HelperText.d.ts +18 -0
- package/dist/types/components/{TextField → InputWrapper}/HelperText/HelperText.token.d.ts +0 -5
- package/dist/types/components/InputWrapper/HelperText/index.d.ts +1 -0
- package/dist/types/components/InputWrapper/InputWrapper.d.ts +41 -0
- package/dist/types/components/InputWrapper/InputWrapper.tokens.d.ts +12 -0
- package/dist/types/components/InputWrapper/index.d.ts +2 -0
- package/dist/types/components/Popover/Popover.d.ts +10 -0
- package/dist/types/components/Search/Search.d.ts +2 -2
- package/dist/types/components/Select/commonStyles.d.ts +1 -7
- package/dist/types/components/SideBar/SideBar.context.d.ts +15 -0
- package/dist/types/components/SideBar/SideBar.d.ts +5 -0
- package/dist/types/components/SideBar/SideBar.tokens.d.ts +2 -0
- package/dist/types/components/SideBar/SideBarButton/index.d.ts +8 -0
- package/dist/types/components/SideBar/SideBarContent.d.ts +4 -0
- package/dist/types/components/SideBar/SideBarFooter.d.ts +4 -0
- package/dist/types/components/SideBar/SideBarToggle.d.ts +4 -0
- package/dist/types/components/SideBar/SidebarLink/index.d.ts +18 -0
- package/dist/types/components/SideBar/index.d.ts +17 -0
- package/dist/types/components/TextField/TextField.d.ts +15 -21
- package/dist/types/components/Textarea/Textarea.d.ts +3 -3
- package/dist/types/components/types.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +3 -3
- package/dist/esm/components/Search/Search.tokens.js +0 -83
- package/dist/esm/components/TextField/Field.js +0 -151
- package/dist/esm/components/TextField/HelperText/HelperText.js +0 -89
- package/dist/esm/components/TextField/HelperText/HelperText.token.js +0 -45
- package/dist/esm/components/TextField/Icon/Icon.js +0 -65
- package/dist/esm/components/TextField/Icon/Icon.tokens.js +0 -42
- package/dist/esm/components/TextField/TextField.context.js +0 -48
- package/dist/esm/components/TextField/TextField.tokens.js +0 -120
- package/dist/types/components/Search/Search.tokens.d.ts +0 -4
- package/dist/types/components/TextField/Field.d.ts +0 -34
- package/dist/types/components/TextField/HelperText/HelperText.d.ts +0 -14
- package/dist/types/components/TextField/HelperText/index.d.ts +0 -1
- package/dist/types/components/TextField/Icon/Icon.d.ts +0 -13
- package/dist/types/components/TextField/Icon/Icon.tokens.d.ts +0 -14
- package/dist/types/components/TextField/Icon/index.d.ts +0 -1
- package/dist/types/components/TextField/TextField.context.d.ts +0 -17
- package/dist/types/components/TextField/TextField.tokens.d.ts +0 -10
- package/dist/types/components/TextField/types.d.ts +0 -6
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { useSideBar } from './SideBar.context.js';
|
|
5
|
+
import { sidebar } from './SideBar.tokens.js';
|
|
6
|
+
import { collapse, expand } from '@equinor/eds-icons';
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { jsx } from 'react/jsx-runtime';
|
|
9
|
+
import { Button } from '../Button/index.js';
|
|
10
|
+
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
11
|
+
import { Icon } from '../Icon/index.js';
|
|
12
|
+
|
|
13
|
+
var iconColor = sidebar.entities.toggleOpen.typography.color;
|
|
14
|
+
var ToggleContainer = styled.div.withConfig({
|
|
15
|
+
displayName: "SideBarToggle__ToggleContainer",
|
|
16
|
+
componentId: "sc-1w5e44y-0"
|
|
17
|
+
})(function (_ref) {
|
|
18
|
+
var theme = _ref.theme;
|
|
19
|
+
var minWidth = theme.minWidth,
|
|
20
|
+
_theme$entities$toggl = theme.entities.toggleOpen.spacings,
|
|
21
|
+
top = _theme$entities$toggl.top,
|
|
22
|
+
bottom = _theme$entities$toggl.bottom;
|
|
23
|
+
return css(["width:", ";display:grid;place-items:center;margin-block-start:", ";margin-block-end:", ";"], minWidth, top, bottom);
|
|
24
|
+
});
|
|
25
|
+
var SideBarToggle = /*#__PURE__*/forwardRef(function SideBarToggle(_ref2, ref) {
|
|
26
|
+
var rest = _extends({}, _ref2);
|
|
27
|
+
|
|
28
|
+
var props = _objectSpread(_objectSpread({}, rest), {}, {
|
|
29
|
+
ref: ref
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
var _useSideBar = useSideBar(),
|
|
33
|
+
isOpen = _useSideBar.isOpen,
|
|
34
|
+
setIsOpen = _useSideBar.setIsOpen;
|
|
35
|
+
|
|
36
|
+
return /*#__PURE__*/jsx(ToggleContainer, _objectSpread(_objectSpread({
|
|
37
|
+
open: isOpen
|
|
38
|
+
}, props), {}, {
|
|
39
|
+
children: /*#__PURE__*/jsx(Tooltip, {
|
|
40
|
+
title: isOpen ? 'Collapse' : 'Expand',
|
|
41
|
+
placement: "right",
|
|
42
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
43
|
+
variant: "ghost_icon",
|
|
44
|
+
onClick: function onClick() {
|
|
45
|
+
return setIsOpen(!isOpen);
|
|
46
|
+
},
|
|
47
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
48
|
+
size: 24,
|
|
49
|
+
data: isOpen ? collapse : expand,
|
|
50
|
+
color: iconColor
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
}));
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export { SideBarToggle };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { sidebar } from '../SideBar.tokens.js';
|
|
5
|
+
import { bordersTemplate, outlineTemplate } from '@equinor/eds-utils';
|
|
6
|
+
import styled, { css } from 'styled-components';
|
|
7
|
+
import { useSideBar } from '../SideBar.context.js';
|
|
8
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
9
|
+
import { Icon } from '../../Icon/index.js';
|
|
10
|
+
import { Typography } from '../../Typography/Typography.js';
|
|
11
|
+
import { Tooltip as Tooltip$1 } from '../../Tooltip/Tooltip.js';
|
|
12
|
+
|
|
13
|
+
var _excluded = ["icon", "label", "active", "onClick", "as"];
|
|
14
|
+
var _tokens$entities$side = sidebar.entities.sidebarItem,
|
|
15
|
+
itemTextColor = _tokens$entities$side.typography.color,
|
|
16
|
+
iconActive = _tokens$entities$side.states.active.typography.color;
|
|
17
|
+
var Container = styled.a.withConfig({
|
|
18
|
+
displayName: "SidebarLink__Container",
|
|
19
|
+
componentId: "sc-gbehcj-0"
|
|
20
|
+
})(function (_ref) {
|
|
21
|
+
var theme = _ref.theme,
|
|
22
|
+
$active = _ref.$active;
|
|
23
|
+
var minWidth = theme.minWidth,
|
|
24
|
+
_theme$entities$sideb = theme.entities.sidebarItem,
|
|
25
|
+
minHeight = _theme$entities$sideb.minHeight,
|
|
26
|
+
border = _theme$entities$sideb.border,
|
|
27
|
+
_theme$entities$sideb2 = _theme$entities$sideb.states,
|
|
28
|
+
menuActiveBackground = _theme$entities$sideb2.active.background,
|
|
29
|
+
menuHoverBackground = _theme$entities$sideb2.hover.background,
|
|
30
|
+
focus = _theme$entities$sideb2.focus,
|
|
31
|
+
_theme$entities$sideb3 = _theme$entities$sideb2.disabled,
|
|
32
|
+
menuDisabledBackground = _theme$entities$sideb3.background,
|
|
33
|
+
menuDisabledText = _theme$entities$sideb3.typography.color;
|
|
34
|
+
return css(["background-color:", ";display:grid;grid-template-columns:", " 1fr;place-items:center;", " text-decoration:none;min-height:", ";&:hover{cursor:pointer;background-color:", ";}&:disabled{background-color:", ";color:", ";}&:focus-visible{", ";}"], $active ? menuActiveBackground : 'none', minWidth, bordersTemplate(border), minHeight, $active ? menuActiveBackground : menuHoverBackground, menuDisabledBackground, menuDisabledText, outlineTemplate(focus.outline));
|
|
35
|
+
});
|
|
36
|
+
var ItemText = styled(Typography).withConfig({
|
|
37
|
+
displayName: "SidebarLink__ItemText",
|
|
38
|
+
componentId: "sc-gbehcj-1"
|
|
39
|
+
})(function (_ref2) {
|
|
40
|
+
var theme = _ref2.theme,
|
|
41
|
+
$active = _ref2.$active;
|
|
42
|
+
var _theme$entities$sideb4 = theme.entities.sidebarItem,
|
|
43
|
+
itemTextColor = _theme$entities$sideb4.typography.color,
|
|
44
|
+
itemActiveTextColor = _theme$entities$sideb4.states.active.typography.color;
|
|
45
|
+
return css(["justify-self:start;color:", ";&::first-letter{text-transform:capitalize;}"], $active ? itemActiveTextColor : itemTextColor);
|
|
46
|
+
});
|
|
47
|
+
var Tooltip = styled(Tooltip$1).withConfig({
|
|
48
|
+
displayName: "SidebarLink__Tooltip",
|
|
49
|
+
componentId: "sc-gbehcj-2"
|
|
50
|
+
})(["text-transform:capitalize;"]);
|
|
51
|
+
var SidebarLink = /*#__PURE__*/forwardRef(function SidebarLink(_ref3, ref) {
|
|
52
|
+
var icon = _ref3.icon,
|
|
53
|
+
label = _ref3.label,
|
|
54
|
+
active = _ref3.active,
|
|
55
|
+
onClick = _ref3.onClick,
|
|
56
|
+
_ref3$as = _ref3.as,
|
|
57
|
+
as = _ref3$as === void 0 ? 'a' : _ref3$as,
|
|
58
|
+
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
59
|
+
|
|
60
|
+
var _useSideBar = useSideBar(),
|
|
61
|
+
isOpen = _useSideBar.isOpen;
|
|
62
|
+
|
|
63
|
+
var getIconColor = function getIconColor() {
|
|
64
|
+
return active ? iconActive : itemTextColor;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
if (isOpen) {
|
|
68
|
+
return /*#__PURE__*/jsxs(Container, _objectSpread(_objectSpread({
|
|
69
|
+
as: as,
|
|
70
|
+
tabIndex: 0,
|
|
71
|
+
$active: active,
|
|
72
|
+
onClick: onClick,
|
|
73
|
+
ref: ref
|
|
74
|
+
}, rest), {}, {
|
|
75
|
+
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
76
|
+
data: icon,
|
|
77
|
+
color: getIconColor()
|
|
78
|
+
}), /*#__PURE__*/jsx(ItemText, {
|
|
79
|
+
variant: "cell_text",
|
|
80
|
+
group: "table",
|
|
81
|
+
$active: active,
|
|
82
|
+
children: label
|
|
83
|
+
})]
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return /*#__PURE__*/jsx(Tooltip, {
|
|
88
|
+
title: label,
|
|
89
|
+
placement: "right",
|
|
90
|
+
children: /*#__PURE__*/jsx(Container, _objectSpread(_objectSpread({
|
|
91
|
+
tabIndex: 0,
|
|
92
|
+
as: as,
|
|
93
|
+
$active: active,
|
|
94
|
+
onClick: onClick,
|
|
95
|
+
ref: ref
|
|
96
|
+
}, rest), {}, {
|
|
97
|
+
children: icon && /*#__PURE__*/jsx(Icon, {
|
|
98
|
+
data: icon,
|
|
99
|
+
color: getIconColor()
|
|
100
|
+
})
|
|
101
|
+
}))
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
SidebarLink.displayName = 'SidebarLink';
|
|
105
|
+
|
|
106
|
+
export { SidebarLink };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SideBar as SideBar$1 } from './SideBar.js';
|
|
2
|
+
import { SidebarLink } from './SidebarLink/index.js';
|
|
3
|
+
import { SideBarContent } from './SideBarContent.js';
|
|
4
|
+
import { SideBarFooter } from './SideBarFooter.js';
|
|
5
|
+
import { SideBarToggle } from './SideBarToggle.js';
|
|
6
|
+
import { SideBarButton } from './SideBarButton/index.js';
|
|
7
|
+
|
|
8
|
+
var SideBar = SideBar$1;
|
|
9
|
+
SideBar.Link = SidebarLink;
|
|
10
|
+
SideBar.Content = SideBarContent;
|
|
11
|
+
SideBar.Footer = SideBarFooter;
|
|
12
|
+
SideBar.Toggle = SideBarToggle;
|
|
13
|
+
SideBar.Button = SideBarButton;
|
|
14
|
+
SideBar.Link.displayName = 'SideBar.Link';
|
|
15
|
+
SideBar.Content.displayName = 'SideBar.Content';
|
|
16
|
+
SideBar.Footer.displayName = 'SideBar.Footer';
|
|
17
|
+
SideBar.Toggle.displayName = 'SideBar.Toggle';
|
|
18
|
+
SideBar.Button.displayName = 'SideBar.Button';
|
|
19
|
+
|
|
20
|
+
export { SideBar };
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
1
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
2
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import { HelperText as TextfieldHelperText } from './HelperText/HelperText.js';
|
|
12
|
-
import { useEds } from '../EdsProvider/eds.context.js';
|
|
4
|
+
import { useId } from '@equinor/eds-utils';
|
|
5
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
6
|
+
import { InputWrapper } from '../InputWrapper/InputWrapper.js';
|
|
7
|
+
import { Textarea } from '../Textarea/Textarea.js';
|
|
8
|
+
import { Input } from '../Input/Input.js';
|
|
9
|
+
|
|
10
|
+
var _excluded = ["id", "label", "meta", "unit", "helperText", "placeholder", "disabled", "multiline", "className", "variant", "inputIcon", "helperIcon", "style", "rowsMax", "textareaRef", "inputRef"];
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})(
|
|
12
|
+
/** Proxy component for working around typescript and element type switching */
|
|
13
|
+
var Field = /*#__PURE__*/forwardRef(function Field(props, ref) {
|
|
14
|
+
return props.multiline ? /*#__PURE__*/jsx(Textarea, _objectSpread({
|
|
15
|
+
ref: ref
|
|
16
|
+
}, props)) : /*#__PURE__*/jsx(Input, _objectSpread({
|
|
17
|
+
ref: ref
|
|
18
|
+
}, props));
|
|
19
|
+
});
|
|
19
20
|
var TextField = /*#__PURE__*/forwardRef(function TextField(_ref, ref) {
|
|
20
21
|
var id = _ref.id,
|
|
21
22
|
label = _ref.label,
|
|
@@ -24,43 +25,49 @@ var TextField = /*#__PURE__*/forwardRef(function TextField(_ref, ref) {
|
|
|
24
25
|
helperText = _ref.helperText,
|
|
25
26
|
placeholder = _ref.placeholder,
|
|
26
27
|
disabled = _ref.disabled,
|
|
27
|
-
multiline = _ref.multiline,
|
|
28
|
+
_ref$multiline = _ref.multiline,
|
|
29
|
+
multiline = _ref$multiline === void 0 ? false : _ref$multiline,
|
|
28
30
|
className = _ref.className,
|
|
29
|
-
|
|
30
|
-
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
31
|
-
inputRef = _ref.inputRef,
|
|
31
|
+
variant = _ref.variant,
|
|
32
32
|
inputIcon = _ref.inputIcon,
|
|
33
33
|
helperIcon = _ref.helperIcon,
|
|
34
|
-
rowsMax = _ref.rowsMax,
|
|
35
34
|
style = _ref.style,
|
|
35
|
+
rowsMax = _ref.rowsMax,
|
|
36
|
+
textareaRef = _ref.textareaRef,
|
|
37
|
+
inputRef = _ref.inputRef,
|
|
36
38
|
other = _objectWithoutProperties(_ref, _excluded);
|
|
37
39
|
|
|
38
40
|
var helperTextId = useId(null, 'helpertext');
|
|
39
41
|
|
|
40
|
-
var
|
|
41
|
-
'aria-
|
|
42
|
-
multiline: multiline,
|
|
42
|
+
var fieldProps = _objectSpread({
|
|
43
|
+
'aria-invalid': variant === 'error' || undefined,
|
|
43
44
|
disabled: disabled,
|
|
44
45
|
placeholder: placeholder,
|
|
45
46
|
id: id,
|
|
46
47
|
variant: variant,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
rightAdornments: /*#__PURE__*/jsxs(Fragment, {
|
|
49
|
+
children: [inputIcon, /*#__PURE__*/jsx("span", {
|
|
50
|
+
children: unit
|
|
51
|
+
})]
|
|
52
|
+
}),
|
|
53
|
+
rowsMax: rowsMax,
|
|
54
|
+
ref: inputRef || textareaRef,
|
|
55
|
+
multiline: multiline
|
|
51
56
|
}, other);
|
|
52
57
|
|
|
53
58
|
var helperProps = {
|
|
54
|
-
id:
|
|
55
|
-
|
|
56
|
-
helperText: helperText,
|
|
59
|
+
id: null,
|
|
60
|
+
text: helperText,
|
|
57
61
|
icon: helperIcon,
|
|
58
62
|
disabled: disabled
|
|
59
63
|
};
|
|
60
64
|
var containerProps = {
|
|
61
65
|
ref: ref,
|
|
62
66
|
className: className,
|
|
63
|
-
style:
|
|
67
|
+
style: _objectSpread({
|
|
68
|
+
width: '100%'
|
|
69
|
+
}, style),
|
|
70
|
+
color: variant
|
|
64
71
|
};
|
|
65
72
|
var labelProps = {
|
|
66
73
|
htmlFor: id,
|
|
@@ -68,23 +75,22 @@ var TextField = /*#__PURE__*/forwardRef(function TextField(_ref, ref) {
|
|
|
68
75
|
meta: meta,
|
|
69
76
|
disabled: disabled
|
|
70
77
|
};
|
|
71
|
-
var showLabel = label || meta;
|
|
72
|
-
var showHelperText = helperText;
|
|
73
78
|
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
if (helperText) {
|
|
80
|
+
fieldProps = _objectSpread({
|
|
81
|
+
'aria-describedby': helperTextId
|
|
82
|
+
}, fieldProps);
|
|
83
|
+
helperProps = _objectSpread(_objectSpread({}, helperProps), {}, {
|
|
84
|
+
id: helperTextId
|
|
85
|
+
});
|
|
86
|
+
}
|
|
76
87
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
children: /*#__PURE__*/jsxs(TextFieldProvider, {
|
|
84
|
-
children: [showLabel && /*#__PURE__*/jsx(Label, _objectSpread({}, labelProps)), /*#__PURE__*/jsx(Field, _objectSpread({}, inputProps)), showHelperText && /*#__PURE__*/jsx(TextfieldHelperText, _objectSpread({}, helperProps))]
|
|
85
|
-
})
|
|
86
|
-
}))
|
|
87
|
-
});
|
|
88
|
+
return /*#__PURE__*/jsx(InputWrapper, _objectSpread(_objectSpread({
|
|
89
|
+
helperProps: helperProps,
|
|
90
|
+
labelProps: labelProps
|
|
91
|
+
}, containerProps), {}, {
|
|
92
|
+
children: /*#__PURE__*/jsx(Field, _objectSpread({}, fieldProps))
|
|
93
|
+
}));
|
|
88
94
|
});
|
|
89
95
|
|
|
90
96
|
export { TextField };
|
|
@@ -1,55 +1,26 @@
|
|
|
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, useState,
|
|
5
|
-
import styled, { css } from 'styled-components';
|
|
4
|
+
import { forwardRef, useState, useCallback } from 'react';
|
|
6
5
|
import * as Input_tokens from '../Input/Input.tokens.js';
|
|
7
6
|
import { input as input$1 } from '../Input/Input.tokens.js';
|
|
8
|
-
import {
|
|
7
|
+
import { useAutoResize, mergeRefs } from '@equinor/eds-utils';
|
|
9
8
|
import { jsx } from 'react/jsx-runtime';
|
|
9
|
+
import { Input } from '../Input/Input.js';
|
|
10
10
|
import { useEds } from '../EdsProvider/eds.context.js';
|
|
11
11
|
|
|
12
12
|
var _excluded = ["variant", "disabled", "type", "rowsMax"];
|
|
13
13
|
var input = input$1;
|
|
14
|
-
|
|
15
|
-
var Variation = function Variation(_ref) {
|
|
14
|
+
var Textarea = /*#__PURE__*/forwardRef(function Textarea(_ref, ref) {
|
|
16
15
|
var variant = _ref.variant,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var _token$states = token.states,
|
|
25
|
-
focusOutline = _token$states.focus.outline,
|
|
26
|
-
activeOutline = _token$states.active.outline,
|
|
27
|
-
boxShadow = token.boxShadow;
|
|
28
|
-
var spacings = input.spacings;
|
|
29
|
-
|
|
30
|
-
if (density === 'compact') {
|
|
31
|
-
spacings = input.modes.compact.spacings;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return css(["border:none;", " ", " box-shadow:", ";&:active,&:focus{outline-offset:0;box-shadow:none;", "}&:disabled{cursor:not-allowed;box-shadow:none;outline:none;&:focus,&:active{outline:none;}}"], spacingsTemplate(spacings), outlineTemplate(activeOutline), boxShadow, outlineTemplate(focusOutline));
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
var StyledTextarea = styled.textarea.withConfig({
|
|
38
|
-
displayName: "Textarea__StyledTextarea",
|
|
39
|
-
componentId: "sc-2yjdcc-0"
|
|
40
|
-
})(["width:100%;box-sizing:border-box;margin:0;border:none;appearance:none;background:", ";height:auto;", " ", " &::placeholder{color:", ";}&:disabled{color:", ";}&[readOnly]{box-shadow:", ";background:", ";}"], input.background, typographyTemplate(input.typography), Variation, input.entities.placeholder.typography.color, input.states.disabled.typography.color, input.states.readOnly.boxShadow, input.states.readOnly.background);
|
|
41
|
-
var Textarea = /*#__PURE__*/forwardRef(function Textarea(_ref2, ref) {
|
|
42
|
-
var _ref2$variant = _ref2.variant,
|
|
43
|
-
variant = _ref2$variant === void 0 ? 'default' : _ref2$variant,
|
|
44
|
-
_ref2$disabled = _ref2.disabled,
|
|
45
|
-
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
46
|
-
_ref2$type = _ref2.type,
|
|
47
|
-
type = _ref2$type === void 0 ? 'text' : _ref2$type,
|
|
48
|
-
rowsMax = _ref2.rowsMax,
|
|
49
|
-
other = _objectWithoutProperties(_ref2, _excluded);
|
|
16
|
+
_ref$disabled = _ref.disabled,
|
|
17
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
18
|
+
_ref$type = _ref.type,
|
|
19
|
+
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
20
|
+
rowsMax = _ref.rowsMax,
|
|
21
|
+
other = _objectWithoutProperties(_ref, _excluded);
|
|
50
22
|
|
|
51
|
-
var
|
|
52
|
-
var inputVariant = Input_tokens[actualVariant];
|
|
23
|
+
var inputVariant = Input_tokens[variant] ? Input_tokens[variant] : input$1;
|
|
53
24
|
|
|
54
25
|
var _useState = useState(null),
|
|
55
26
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -72,9 +43,9 @@ var Textarea = /*#__PURE__*/forwardRef(function Textarea(_ref2, ref) {
|
|
|
72
43
|
var padding = parseInt(top) + parseInt(bottom);
|
|
73
44
|
var maxHeight = parseFloat(lineHeight) * fontSize * rowsMax + padding;
|
|
74
45
|
useAutoResize(textareaEl, rowsMax ? maxHeight : null);
|
|
75
|
-
var combinedRef =
|
|
46
|
+
var combinedRef = useCallback(function () {
|
|
76
47
|
return mergeRefs(ref, setTextareaEl);
|
|
77
|
-
}, [setTextareaEl, ref]);
|
|
48
|
+
}, [setTextareaEl, ref])();
|
|
78
49
|
|
|
79
50
|
var inputProps = _objectSpread({
|
|
80
51
|
ref: combinedRef,
|
|
@@ -85,7 +56,19 @@ var Textarea = /*#__PURE__*/forwardRef(function Textarea(_ref2, ref) {
|
|
|
85
56
|
density: density
|
|
86
57
|
}, other);
|
|
87
58
|
|
|
88
|
-
|
|
59
|
+
var adornmentsToTop = {
|
|
60
|
+
style: {
|
|
61
|
+
alignItems: 'flex-start'
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
return /*#__PURE__*/jsx(Input, _objectSpread({
|
|
65
|
+
as: "textarea",
|
|
66
|
+
rightAdornmentsProps: adornmentsToTop,
|
|
67
|
+
leftAdornmentsProps: adornmentsToTop,
|
|
68
|
+
style: {
|
|
69
|
+
height: 'auto'
|
|
70
|
+
}
|
|
71
|
+
}, inputProps));
|
|
89
72
|
});
|
|
90
73
|
|
|
91
74
|
export { Textarea };
|
|
@@ -2,7 +2,7 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
3
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
|
-
import { forwardRef, useRef, useState, useMemo, cloneElement } from 'react';
|
|
5
|
+
import { forwardRef, useRef, useState, useMemo, useEffect, cloneElement } from 'react';
|
|
6
6
|
import styled from 'styled-components';
|
|
7
7
|
import { typographyTemplate, spacingsTemplate, bordersTemplate, mergeRefs } from '@equinor/eds-utils';
|
|
8
8
|
import { tooltip } from './Tooltip.tokens.js';
|
|
@@ -13,7 +13,7 @@ var _excluded = ["title", "placement", "children", "style", "enterDelay"];
|
|
|
13
13
|
var StyledTooltip = styled.div.withConfig({
|
|
14
14
|
displayName: "Tooltip__StyledTooltip",
|
|
15
15
|
componentId: "sc-m2im2p-0"
|
|
16
|
-
})(["", " ", " ", " background:", ";z-index:1500;white-space:nowrap;"], typographyTemplate(tooltip.typography), spacingsTemplate(tooltip.spacings), bordersTemplate(tooltip.border), tooltip.background);
|
|
16
|
+
})(["", " ", " ", " background:", ";z-index:1500;white-space:nowrap;&::before{content:'; Has tooltip: ';clip-path:inset(50%);height:1px;width:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;}"], typographyTemplate(tooltip.typography), spacingsTemplate(tooltip.spacings), bordersTemplate(tooltip.border), tooltip.background);
|
|
17
17
|
var ArrowWrapper = styled.div.withConfig({
|
|
18
18
|
displayName: "Tooltip__ArrowWrapper",
|
|
19
19
|
componentId: "sc-m2im2p-1"
|
|
@@ -81,43 +81,44 @@ var Tooltip = /*#__PURE__*/forwardRef(function Tooltip(_ref, ref) {
|
|
|
81
81
|
getReferenceProps = _useInteractions.getReferenceProps,
|
|
82
82
|
getFloatingProps = _useInteractions.getFloatingProps;
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (arrowRef.current) {
|
|
111
|
-
var _Object$assign;
|
|
84
|
+
useEffect(function () {
|
|
85
|
+
var staticSide = {
|
|
86
|
+
top: 'bottom',
|
|
87
|
+
right: 'left',
|
|
88
|
+
bottom: 'top',
|
|
89
|
+
left: 'right'
|
|
90
|
+
}[finalPlacement.split('-')[0]];
|
|
91
|
+
var arrowTransform = 'none';
|
|
92
|
+
|
|
93
|
+
switch (staticSide) {
|
|
94
|
+
case 'right':
|
|
95
|
+
arrowTransform = 'rotateY(180deg)';
|
|
96
|
+
break;
|
|
97
|
+
|
|
98
|
+
case 'left':
|
|
99
|
+
arrowTransform = 'none';
|
|
100
|
+
break;
|
|
101
|
+
|
|
102
|
+
case 'top':
|
|
103
|
+
arrowTransform = 'rotate(90deg)';
|
|
104
|
+
break;
|
|
105
|
+
|
|
106
|
+
case 'bottom':
|
|
107
|
+
arrowTransform = 'rotate(-90deg)';
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
112
110
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
top: arrowY != null ? "".concat(arrowY, "px") : '',
|
|
116
|
-
right: '',
|
|
117
|
-
bottom: ''
|
|
118
|
-
}, _defineProperty(_Object$assign, staticSide, '-6px'), _defineProperty(_Object$assign, "transform", arrowTransform), _Object$assign));
|
|
119
|
-
}
|
|
111
|
+
if (arrowRef.current) {
|
|
112
|
+
var _Object$assign;
|
|
120
113
|
|
|
114
|
+
Object.assign(arrowRef.current.style, (_Object$assign = {
|
|
115
|
+
left: arrowX != null ? "".concat(arrowX, "px") : '',
|
|
116
|
+
top: arrowY != null ? "".concat(arrowY, "px") : '',
|
|
117
|
+
right: '',
|
|
118
|
+
bottom: ''
|
|
119
|
+
}, _defineProperty(_Object$assign, staticSide, '-6px'), _defineProperty(_Object$assign, "transform", arrowTransform), _Object$assign));
|
|
120
|
+
}
|
|
121
|
+
});
|
|
121
122
|
var updatedChildren = /*#__PURE__*/cloneElement(children, _objectSpread({}, getReferenceProps(_objectSpread({
|
|
122
123
|
ref: anchorRef
|
|
123
124
|
}, children.props))));
|
|
@@ -8,7 +8,7 @@ var _excluded = ["children"];
|
|
|
8
8
|
var StyledHeader = styled.div.withConfig({
|
|
9
9
|
displayName: "Header__StyledHeader",
|
|
10
10
|
componentId: "sc-1fpllve-0"
|
|
11
|
-
})(["grid-area:left;display:grid;grid-template-columns:auto auto;grid-gap:
|
|
11
|
+
})(["grid-area:left;display:grid;grid-template-columns:auto auto;grid-gap:12px;align-items:center;"]);
|
|
12
12
|
var Header = /*#__PURE__*/forwardRef(function Header(_ref, ref) {
|
|
13
13
|
var children = _ref.children,
|
|
14
14
|
props = _objectWithoutProperties(_ref, _excluded);
|
package/dist/esm/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export { Banner } from './components/Banner/index.js';
|
|
|
14
14
|
export { Progress } from './components/Progress/index.js';
|
|
15
15
|
export { Breadcrumbs } from './components/Breadcrumbs/index.js';
|
|
16
16
|
export { Menu } from './components/Menu/index.js';
|
|
17
|
+
export { SideBar } from './components/SideBar/index.js';
|
|
17
18
|
export { Typography } from './components/Typography/Typography.js';
|
|
18
19
|
export { Divider } from './components/Divider/Divider.js';
|
|
19
20
|
export { TextField } from './components/TextField/TextField.js';
|
|
@@ -40,3 +41,5 @@ export { Switch } from './components/Switch/Switch.js';
|
|
|
40
41
|
export { EdsProvider, useEds } from './components/EdsProvider/eds.context.js';
|
|
41
42
|
export { Paper } from './components/Paper/Paper.js';
|
|
42
43
|
export { Autocomplete } from './components/Autocomplete/Autocomplete.js';
|
|
44
|
+
export { InputWrapper } from './components/InputWrapper/InputWrapper.js';
|
|
45
|
+
export { useSideBar } from './components/SideBar/SideBar.context.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { ReactNode, CSSProperties, ElementType, ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { OverridableComponent } from '@equinor/eds-utils';
|
|
3
|
+
import type { Variants } from '../types';
|
|
3
4
|
export declare type InputProps = {
|
|
4
5
|
/** Placeholder */
|
|
5
6
|
placeholder?: string;
|
|
@@ -11,16 +12,22 @@ export declare type InputProps = {
|
|
|
11
12
|
type?: string;
|
|
12
13
|
/** Read Only */
|
|
13
14
|
readOnly?: boolean;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
/** Left adornments */
|
|
16
|
+
leftAdornments?: ReactNode;
|
|
17
|
+
/** Right adornments */
|
|
18
|
+
rightAdornments?: ReactNode;
|
|
19
|
+
/** Left adornments props */
|
|
20
|
+
leftAdornmentsProps?: ComponentPropsWithoutRef<'div'>;
|
|
21
|
+
/** Right adornments props */
|
|
22
|
+
rightAdornmentsProps?: ComponentPropsWithoutRef<'div'>;
|
|
23
|
+
/** Manually specify left adornments width. The width will be the dom element width if not defined */
|
|
24
|
+
leftAdornmentsWidth?: number;
|
|
25
|
+
/** Manually specify right adornments width. The width will be the dom element width if not defined */
|
|
26
|
+
rightAdornmentsWidth?: number;
|
|
27
|
+
/** Cast the input to another element */
|
|
28
|
+
as?: ElementType;
|
|
29
|
+
/** */
|
|
30
|
+
className?: string;
|
|
31
|
+
style?: CSSProperties;
|
|
32
|
+
};
|
|
33
|
+
export declare const Input: OverridableComponent<InputProps, HTMLInputElement>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
export declare type HelperTextProps = {
|
|
3
|
+
/** Helper text */
|
|
4
|
+
text?: string;
|
|
5
|
+
/** Icon */
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
/** Color */
|
|
8
|
+
color?: string;
|
|
9
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
10
|
+
declare const TextfieldHelperText: import("react").ForwardRefExoticComponent<{
|
|
11
|
+
/** Helper text */
|
|
12
|
+
text?: string;
|
|
13
|
+
/** Icon */
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
/** Color */
|
|
16
|
+
color?: string;
|
|
17
|
+
} & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export { TextfieldHelperText as HelperText };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Spacing, Typography } from '@equinor/eds-tokens';
|
|
2
|
-
import { ColorStateProps } from '../types';
|
|
3
2
|
export declare type HelperTextProps = {
|
|
4
3
|
background: string;
|
|
5
4
|
typography: Typography;
|
|
@@ -7,9 +6,5 @@ export declare type HelperTextProps = {
|
|
|
7
6
|
comfortable: Spacing;
|
|
8
7
|
compact: Spacing;
|
|
9
8
|
};
|
|
10
|
-
default: ColorStateProps;
|
|
11
|
-
error: ColorStateProps;
|
|
12
|
-
warning: ColorStateProps;
|
|
13
|
-
success: ColorStateProps;
|
|
14
9
|
};
|
|
15
10
|
export declare const helperText: HelperTextProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './HelperText';
|