@equinor/eds-core-react 0.24.0-dev.20221007 → 0.25.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 +1027 -1321
- package/dist/esm/components/Accordion/AccordionHeader.js +10 -5
- package/dist/esm/components/Autocomplete/Autocomplete.js +62 -67
- package/dist/esm/components/Autocomplete/Autocomplete.tokens.js +1 -0
- 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/Popover/Popover.js +69 -54
- package/dist/esm/components/Popover/Popover.tokens.js +17 -2
- package/dist/esm/components/Search/Search.js +60 -187
- 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 +37 -36
- package/dist/esm/index.js +1 -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/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 +1 -0
- package/package.json +4 -4
- 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,49 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import styled, { css } from 'styled-components';
|
|
5
|
+
import { typographyMixin } from '@equinor/eds-utils';
|
|
6
|
+
import { helperText } from './HelperText.token.js';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var _excluded = ["text", "icon", "color"];
|
|
10
|
+
var Container = styled.div.withConfig({
|
|
11
|
+
displayName: "HelperText__Container",
|
|
12
|
+
componentId: "sc-189ug61-0"
|
|
13
|
+
})(function (_ref) {
|
|
14
|
+
var color = _ref.color;
|
|
15
|
+
return css({
|
|
16
|
+
display: 'grid',
|
|
17
|
+
gap: '8px',
|
|
18
|
+
gridAutoFlow: 'column',
|
|
19
|
+
alignItems: 'start',
|
|
20
|
+
justifyContent: 'start',
|
|
21
|
+
color: color
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
var Text = styled.p.withConfig({
|
|
25
|
+
displayName: "HelperText__Text",
|
|
26
|
+
componentId: "sc-189ug61-1"
|
|
27
|
+
})(["margin:0;", ";"], typographyMixin(helperText.typography));
|
|
28
|
+
var TextfieldHelperText = /*#__PURE__*/forwardRef(function TextfieldHelperText(_ref2, ref) {
|
|
29
|
+
var text = _ref2.text,
|
|
30
|
+
icon = _ref2.icon,
|
|
31
|
+
_ref2$color = _ref2.color,
|
|
32
|
+
color = _ref2$color === void 0 ? helperText.typography.color : _ref2$color,
|
|
33
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
34
|
+
|
|
35
|
+
if (!text) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return /*#__PURE__*/jsxs(Container, _objectSpread(_objectSpread({}, _objectSpread(_objectSpread({}, rest), {}, {
|
|
40
|
+
color: color,
|
|
41
|
+
ref: ref
|
|
42
|
+
})), {}, {
|
|
43
|
+
children: [icon, /*#__PURE__*/jsx(Text, {
|
|
44
|
+
children: text
|
|
45
|
+
})]
|
|
46
|
+
}));
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export { TextfieldHelperText as HelperText };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import { tokens } from '@equinor/eds-tokens';
|
|
3
|
+
|
|
4
|
+
var colors = tokens.colors,
|
|
5
|
+
comfortable = tokens.spacings.comfortable,
|
|
6
|
+
typography = tokens.typography;
|
|
7
|
+
var helperText = {
|
|
8
|
+
background: colors.ui.background__light.hex,
|
|
9
|
+
typography: _objectSpread(_objectSpread({}, typography.input.helper), {}, {
|
|
10
|
+
color: colors.text.static_icons__tertiary.rgba
|
|
11
|
+
}),
|
|
12
|
+
spacings: {
|
|
13
|
+
comfortable: {
|
|
14
|
+
left: comfortable.small,
|
|
15
|
+
right: comfortable.small,
|
|
16
|
+
top: comfortable.small,
|
|
17
|
+
bottom: '6px'
|
|
18
|
+
},
|
|
19
|
+
compact: {
|
|
20
|
+
left: comfortable.small,
|
|
21
|
+
right: comfortable.small,
|
|
22
|
+
top: comfortable.xx_small,
|
|
23
|
+
bottom: '6px'
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { helperText };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import { forwardRef, useCallback } from 'react';
|
|
4
|
+
import styled, { ThemeProvider } from 'styled-components';
|
|
5
|
+
import { useToken } from '@equinor/eds-utils';
|
|
6
|
+
import { inputToken } from './InputWrapper.tokens.js';
|
|
7
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
+
import { HelperText as TextfieldHelperText } from './HelperText/HelperText.js';
|
|
9
|
+
import { Label as Label$1 } from '../Label/Label.js';
|
|
10
|
+
import { useEds } from '../EdsProvider/eds.context.js';
|
|
11
|
+
|
|
12
|
+
var _excluded = ["children", "color", "label", "labelProps", "helperProps", "helperIcon"];
|
|
13
|
+
var Container = styled.div.withConfig({
|
|
14
|
+
displayName: "InputWrapper__Container",
|
|
15
|
+
componentId: "sc-v6o9z1-0"
|
|
16
|
+
})([""]);
|
|
17
|
+
var HelperText = styled(TextfieldHelperText).withConfig({
|
|
18
|
+
displayName: "InputWrapper__HelperText",
|
|
19
|
+
componentId: "sc-v6o9z1-1"
|
|
20
|
+
})(["margin-top:8px;margin-left:8px;"]);
|
|
21
|
+
var Label = styled(Label$1).withConfig({
|
|
22
|
+
displayName: "InputWrapper__Label",
|
|
23
|
+
componentId: "sc-v6o9z1-2"
|
|
24
|
+
})(["margin-left:8px;margin-right:8px;"]);
|
|
25
|
+
|
|
26
|
+
/** InputWrapper is a internal skeleton component for structuring input elements */
|
|
27
|
+
var InputWrapper = /*#__PURE__*/forwardRef(function InputWrapper(_ref, ref) {
|
|
28
|
+
var children = _ref.children,
|
|
29
|
+
color = _ref.color,
|
|
30
|
+
label = _ref.label,
|
|
31
|
+
_ref$labelProps = _ref.labelProps,
|
|
32
|
+
labelProps = _ref$labelProps === void 0 ? {} : _ref$labelProps,
|
|
33
|
+
_ref$helperProps = _ref.helperProps,
|
|
34
|
+
helperProps = _ref$helperProps === void 0 ? {} : _ref$helperProps,
|
|
35
|
+
helperIcon = _ref.helperIcon,
|
|
36
|
+
other = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
|
|
38
|
+
var _useEds = useEds(),
|
|
39
|
+
density = _useEds.density;
|
|
40
|
+
|
|
41
|
+
var actualVariant = color || 'input';
|
|
42
|
+
var inputToken$1 = inputToken[actualVariant];
|
|
43
|
+
var token = useToken({
|
|
44
|
+
density: density
|
|
45
|
+
}, inputToken$1);
|
|
46
|
+
var helperTextColor = useCallback(function () {
|
|
47
|
+
var _token = token();
|
|
48
|
+
|
|
49
|
+
return other.disabled ? _token.entities.helperText.states.disabled.typography.color : _token.entities.helperText.typography.color;
|
|
50
|
+
}, [token, other.disabled])();
|
|
51
|
+
var hasHelperText = Boolean(helperProps === null || helperProps === void 0 ? void 0 : helperProps.text);
|
|
52
|
+
var hasLabel = Boolean(label || (labelProps === null || labelProps === void 0 ? void 0 : labelProps.label));
|
|
53
|
+
return /*#__PURE__*/jsx(ThemeProvider, {
|
|
54
|
+
theme: token,
|
|
55
|
+
children: /*#__PURE__*/jsxs(Container, _objectSpread(_objectSpread({}, other), {}, {
|
|
56
|
+
ref: ref,
|
|
57
|
+
children: [hasLabel && /*#__PURE__*/jsx(Label, _objectSpread({}, _objectSpread({
|
|
58
|
+
label: label
|
|
59
|
+
}, labelProps))), children, hasHelperText && /*#__PURE__*/jsx(HelperText, _objectSpread({
|
|
60
|
+
color: helperTextColor
|
|
61
|
+
}, _objectSpread({
|
|
62
|
+
icon: helperIcon
|
|
63
|
+
}, helperProps)))]
|
|
64
|
+
}))
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export { InputWrapper };
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import { tokens } from '@equinor/eds-tokens';
|
|
3
|
+
import mergeDeepRight from '../../node_modules/.pnpm/ramda@0.28.0/node_modules/ramda/es/mergeDeepRight.js';
|
|
4
|
+
|
|
5
|
+
var _tokens$colors = tokens.colors,
|
|
6
|
+
background = _tokens$colors.ui.background__light.rgba,
|
|
7
|
+
_tokens$colors$text = _tokens$colors.text,
|
|
8
|
+
static_icons__default = _tokens$colors$text.static_icons__default,
|
|
9
|
+
static_icons__tertiary = _tokens$colors$text.static_icons__tertiary,
|
|
10
|
+
_tokens$colors$intera = _tokens$colors.interactive,
|
|
11
|
+
disabled__text = _tokens$colors$intera.disabled__text,
|
|
12
|
+
primary__resting = _tokens$colors$intera.primary__resting,
|
|
13
|
+
danger__resting = _tokens$colors$intera.danger__resting,
|
|
14
|
+
danger__hover = _tokens$colors$intera.danger__hover,
|
|
15
|
+
warning__resting = _tokens$colors$intera.warning__resting,
|
|
16
|
+
warning__hover = _tokens$colors$intera.warning__hover,
|
|
17
|
+
success__resting = _tokens$colors$intera.success__resting,
|
|
18
|
+
success__hover = _tokens$colors$intera.success__hover,
|
|
19
|
+
_tokens$spacings$comf = tokens.spacings.comfortable,
|
|
20
|
+
small = _tokens$spacings$comf.small,
|
|
21
|
+
x_small = _tokens$spacings$comf.x_small,
|
|
22
|
+
typography = tokens.typography,
|
|
23
|
+
shape = tokens.shape;
|
|
24
|
+
var input = {
|
|
25
|
+
minHeight: shape.straight.minHeight,
|
|
26
|
+
background: background,
|
|
27
|
+
spacings: {
|
|
28
|
+
left: small,
|
|
29
|
+
right: small,
|
|
30
|
+
top: '6px',
|
|
31
|
+
bottom: '6px'
|
|
32
|
+
},
|
|
33
|
+
typography: _objectSpread(_objectSpread({}, typography.input.text), {}, {
|
|
34
|
+
color: static_icons__default.rgba
|
|
35
|
+
}),
|
|
36
|
+
entities: {
|
|
37
|
+
placeholder: {
|
|
38
|
+
typography: {
|
|
39
|
+
color: static_icons__tertiary.rgba
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
helperText: {
|
|
43
|
+
typography: _objectSpread(_objectSpread({}, typography.input.label), {}, {
|
|
44
|
+
color: static_icons__tertiary.rgba
|
|
45
|
+
}),
|
|
46
|
+
states: {
|
|
47
|
+
disabled: {
|
|
48
|
+
typography: {
|
|
49
|
+
color: disabled__text.rgba
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
states: {
|
|
56
|
+
disabled: {
|
|
57
|
+
typography: {
|
|
58
|
+
color: disabled__text.rgba
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
readOnly: {
|
|
62
|
+
background: 'transparent',
|
|
63
|
+
boxShadow: 'none'
|
|
64
|
+
},
|
|
65
|
+
active: {
|
|
66
|
+
outline: {
|
|
67
|
+
type: 'outline',
|
|
68
|
+
color: 'transparent',
|
|
69
|
+
width: '1px',
|
|
70
|
+
style: 'solid',
|
|
71
|
+
offset: '0px'
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
focus: {
|
|
75
|
+
outline: {
|
|
76
|
+
type: 'outline',
|
|
77
|
+
width: '2px',
|
|
78
|
+
color: primary__resting.rgba,
|
|
79
|
+
style: 'solid',
|
|
80
|
+
offset: '0px'
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
boxShadow: 'inset 0px -1px 0px 0px ' + static_icons__tertiary.rgba,
|
|
85
|
+
modes: {
|
|
86
|
+
compact: {
|
|
87
|
+
minHeight: shape._modes.compact.straight.minHeight,
|
|
88
|
+
spacings: {
|
|
89
|
+
left: x_small,
|
|
90
|
+
right: x_small,
|
|
91
|
+
top: x_small,
|
|
92
|
+
bottom: x_small
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
var error = mergeDeepRight(input, {
|
|
98
|
+
boxShadow: 'none',
|
|
99
|
+
outline: {
|
|
100
|
+
color: danger__resting.rgba
|
|
101
|
+
},
|
|
102
|
+
states: {
|
|
103
|
+
focus: {
|
|
104
|
+
outline: {
|
|
105
|
+
color: danger__hover.rgba
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
entities: {
|
|
110
|
+
helperText: {
|
|
111
|
+
typography: _objectSpread(_objectSpread({}, typography.input.label), {}, {
|
|
112
|
+
color: danger__hover.rgba
|
|
113
|
+
})
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
var warning = mergeDeepRight(input, {
|
|
118
|
+
boxShadow: 'none',
|
|
119
|
+
outline: {
|
|
120
|
+
color: warning__resting.rgba
|
|
121
|
+
},
|
|
122
|
+
states: {
|
|
123
|
+
focus: {
|
|
124
|
+
outline: {
|
|
125
|
+
color: warning__hover.rgba
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
entities: {
|
|
130
|
+
helperText: {
|
|
131
|
+
typography: _objectSpread(_objectSpread({}, typography.input.label), {}, {
|
|
132
|
+
color: warning__hover.rgba
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
var success = mergeDeepRight(input, {
|
|
138
|
+
boxShadow: 'none',
|
|
139
|
+
outline: {
|
|
140
|
+
color: success__resting.rgba
|
|
141
|
+
},
|
|
142
|
+
states: {
|
|
143
|
+
focus: {
|
|
144
|
+
outline: {
|
|
145
|
+
color: success__hover.rgba
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
entities: {
|
|
150
|
+
helperText: {
|
|
151
|
+
typography: _objectSpread(_objectSpread({}, typography.input.label), {}, {
|
|
152
|
+
color: success__hover.rgba
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
var inputToken = {
|
|
158
|
+
input: input,
|
|
159
|
+
error: error,
|
|
160
|
+
warning: warning,
|
|
161
|
+
success: success
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export { error, input, inputToken, success, warning };
|
|
@@ -3,23 +3,21 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
4
|
import { forwardRef, useRef, useLayoutEffect, useMemo, useEffect } from 'react';
|
|
5
5
|
import styled, { css, ThemeProvider } from 'styled-components';
|
|
6
|
-
import { typographyTemplate, bordersTemplate, mergeRefs, useToken } from '@equinor/eds-utils';
|
|
6
|
+
import { typographyTemplate, bordersTemplate, outlineTemplate, mergeRefs, useToken } from '@equinor/eds-utils';
|
|
7
7
|
import { popover } from './Popover.tokens.js';
|
|
8
|
-
import { useFloating, offset, flip, shift, arrow, autoUpdate, useInteractions, useDismiss } from '@floating-ui/react-dom-interactions';
|
|
9
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
+
import { useFloating, offset, flip, shift, arrow, autoUpdate, useInteractions, useDismiss, FloatingPortal, FloatingFocusManager } from '@floating-ui/react-dom-interactions';
|
|
9
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
import { Paper } from '../Paper/Paper.js';
|
|
11
11
|
import { useEds } from '../EdsProvider/eds.context.js';
|
|
12
12
|
|
|
13
|
-
var _excluded = ["children", "placement", "anchorEl", "style", "open", "onClose"];
|
|
13
|
+
var _excluded = ["children", "placement", "anchorEl", "style", "open", "onClose", "withinPortal", "trapFocus"];
|
|
14
14
|
var PopoverPaper = styled(Paper).withConfig({
|
|
15
15
|
displayName: "Popover__PopoverPaper",
|
|
16
16
|
componentId: "sc-b7p1is-0"
|
|
17
17
|
})(function (_ref) {
|
|
18
|
-
var theme = _ref.theme
|
|
19
|
-
|
|
20
|
-
return css(["", "
|
|
21
|
-
display: open ? 'block' : 'none'
|
|
22
|
-
}, typographyTemplate(theme.typography), theme.background, bordersTemplate(theme.border));
|
|
18
|
+
var theme = _ref.theme;
|
|
19
|
+
var paper = theme.entities.paper;
|
|
20
|
+
return css(["", " background:", ";", " z-index:1400;&:focus-visible{", "}"], typographyTemplate(theme.typography), theme.background, bordersTemplate(theme.border), outlineTemplate(paper.states.focus.outline));
|
|
23
21
|
});
|
|
24
22
|
var ArrowWrapper = styled.div.withConfig({
|
|
25
23
|
displayName: "Popover__ArrowWrapper",
|
|
@@ -50,6 +48,8 @@ var Popover = /*#__PURE__*/forwardRef(function Popover(_ref5, ref) {
|
|
|
50
48
|
style = _ref5.style,
|
|
51
49
|
open = _ref5.open,
|
|
52
50
|
onClose = _ref5.onClose,
|
|
51
|
+
withinPortal = _ref5.withinPortal,
|
|
52
|
+
trapFocus = _ref5.trapFocus,
|
|
53
53
|
rest = _objectWithoutProperties(_ref5, _excluded);
|
|
54
54
|
|
|
55
55
|
var arrowRef = useRef(null);
|
|
@@ -62,14 +62,13 @@ var Popover = /*#__PURE__*/forwardRef(function Popover(_ref5, ref) {
|
|
|
62
62
|
padding: 8
|
|
63
63
|
}), arrow({
|
|
64
64
|
element: arrowRef
|
|
65
|
-
})]
|
|
65
|
+
})],
|
|
66
|
+
whileElementsMounted: autoUpdate
|
|
66
67
|
}),
|
|
67
68
|
x = _useFloating.x,
|
|
68
69
|
y = _useFloating.y,
|
|
69
70
|
reference = _useFloating.reference,
|
|
70
71
|
floating = _useFloating.floating,
|
|
71
|
-
refs = _useFloating.refs,
|
|
72
|
-
update = _useFloating.update,
|
|
73
72
|
strategy = _useFloating.strategy,
|
|
74
73
|
context = _useFloating.context,
|
|
75
74
|
_useFloating$middlewa = _useFloating.middlewareData.arrow;
|
|
@@ -84,51 +83,49 @@ var Popover = /*#__PURE__*/forwardRef(function Popover(_ref5, ref) {
|
|
|
84
83
|
var popoverRef = useMemo(function () {
|
|
85
84
|
return mergeRefs(floating, ref);
|
|
86
85
|
}, [floating, ref]);
|
|
87
|
-
useEffect(function () {
|
|
88
|
-
if (refs.reference.current && refs.floating.current && open) {
|
|
89
|
-
return autoUpdate(refs.reference.current, refs.floating.current, update);
|
|
90
|
-
}
|
|
91
|
-
}, [refs.reference, refs.floating, update, open]);
|
|
92
86
|
|
|
93
87
|
var _useInteractions = useInteractions([useDismiss(context)]),
|
|
94
88
|
getFloatingProps = _useInteractions.getFloatingProps;
|
|
95
89
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
arrowTransform = '
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
90
|
+
useEffect(function () {
|
|
91
|
+
if (arrowRef.current) {
|
|
92
|
+
var _Object$assign;
|
|
93
|
+
|
|
94
|
+
var staticSide = {
|
|
95
|
+
top: 'bottom',
|
|
96
|
+
right: 'left',
|
|
97
|
+
bottom: 'top',
|
|
98
|
+
left: 'right'
|
|
99
|
+
}[finalPlacement.split('-')[0]];
|
|
100
|
+
var arrowTransform = 'none';
|
|
101
|
+
|
|
102
|
+
switch (staticSide) {
|
|
103
|
+
case 'right':
|
|
104
|
+
arrowTransform = 'rotateY(180deg)';
|
|
105
|
+
break;
|
|
106
|
+
|
|
107
|
+
case 'left':
|
|
108
|
+
arrowTransform = 'none';
|
|
109
|
+
break;
|
|
110
|
+
|
|
111
|
+
case 'top':
|
|
112
|
+
arrowTransform = 'rotate(90deg)';
|
|
113
|
+
break;
|
|
114
|
+
|
|
115
|
+
case 'bottom':
|
|
116
|
+
arrowTransform = 'rotate(-90deg)';
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
Object.assign(arrowRef.current.style, (_Object$assign = {
|
|
121
|
+
left: arrowX != null ? "".concat(arrowX, "px") : '',
|
|
122
|
+
top: arrowY != null ? "".concat(arrowY, "px") : '',
|
|
123
|
+
right: '',
|
|
124
|
+
bottom: ''
|
|
125
|
+
}, _defineProperty(_Object$assign, staticSide, '-6px'), _defineProperty(_Object$assign, "transform", arrowTransform), _Object$assign));
|
|
126
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
127
|
+
|
|
128
|
+
}, [arrowRef.current, arrowX, arrowY, finalPlacement]);
|
|
132
129
|
|
|
133
130
|
var props = _objectSpread({
|
|
134
131
|
open: open
|
|
@@ -140,7 +137,8 @@ var Popover = /*#__PURE__*/forwardRef(function Popover(_ref5, ref) {
|
|
|
140
137
|
var token = useToken({
|
|
141
138
|
density: density
|
|
142
139
|
}, popover);
|
|
143
|
-
|
|
140
|
+
|
|
141
|
+
var popover$1 = /*#__PURE__*/jsx(ThemeProvider, {
|
|
144
142
|
theme: token,
|
|
145
143
|
children: /*#__PURE__*/jsxs(PopoverPaper, _objectSpread(_objectSpread(_objectSpread({
|
|
146
144
|
elevation: "overlay"
|
|
@@ -166,6 +164,23 @@ var Popover = /*#__PURE__*/forwardRef(function Popover(_ref5, ref) {
|
|
|
166
164
|
})]
|
|
167
165
|
}))
|
|
168
166
|
});
|
|
167
|
+
|
|
168
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
169
|
+
children: withinPortal ? /*#__PURE__*/jsx(FloatingPortal, {
|
|
170
|
+
id: "eds-popover-container",
|
|
171
|
+
children: open && trapFocus ? open && /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
172
|
+
context: context,
|
|
173
|
+
modal: true,
|
|
174
|
+
children: popover$1
|
|
175
|
+
}) : open && popover$1
|
|
176
|
+
}) : /*#__PURE__*/jsx(Fragment, {
|
|
177
|
+
children: trapFocus ? open && /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
178
|
+
context: context,
|
|
179
|
+
modal: true,
|
|
180
|
+
children: popover$1
|
|
181
|
+
}) : open && popover$1
|
|
182
|
+
})
|
|
183
|
+
});
|
|
169
184
|
});
|
|
170
185
|
|
|
171
186
|
export { Popover };
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { tokens } from '@equinor/eds-tokens';
|
|
2
2
|
|
|
3
3
|
var header = tokens.typography.ui.accordion_header,
|
|
4
|
-
|
|
4
|
+
_tokens$colors = tokens.colors,
|
|
5
|
+
background = _tokens$colors.ui.background__default.rgba,
|
|
6
|
+
focusOutlineColor = _tokens$colors.interactive.focus.rgba,
|
|
5
7
|
_tokens$spacings$comf = tokens.spacings.comfortable,
|
|
6
8
|
spacingMedium = _tokens$spacings$comf.medium,
|
|
7
9
|
spacingSmall = _tokens$spacings$comf.small,
|
|
8
|
-
borderRadius = tokens.shape.corners.borderRadius
|
|
10
|
+
borderRadius = tokens.shape.corners.borderRadius,
|
|
11
|
+
focusOutlineWidth = tokens.interactions.focused.width;
|
|
9
12
|
var popover = {
|
|
10
13
|
background: background,
|
|
11
14
|
typography: header,
|
|
@@ -27,6 +30,18 @@ var popover = {
|
|
|
27
30
|
spacings: {
|
|
28
31
|
top: '12px'
|
|
29
32
|
}
|
|
33
|
+
},
|
|
34
|
+
paper: {
|
|
35
|
+
states: {
|
|
36
|
+
focus: {
|
|
37
|
+
outline: {
|
|
38
|
+
type: 'outline',
|
|
39
|
+
width: focusOutlineWidth,
|
|
40
|
+
style: 'dashed',
|
|
41
|
+
color: focusOutlineColor
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
30
45
|
}
|
|
31
46
|
},
|
|
32
47
|
spacings: {
|