@instructure/ui-view 8.33.1 → 8.33.2

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/es/View/styles.js CHANGED
@@ -21,41 +21,39 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  import { DIRECTION } from '@instructure/ui-i18n';
25
26
  import { getShorthandPropValue, mirrorShorthandEdges, mirrorShorthandCorners } from '@instructure/emotion';
26
27
  import { pickProps } from '@instructure/ui-react-utils';
27
28
  import { logError as error } from '@instructure/console';
28
-
29
29
  const getBorderStyle = _ref => {
30
30
  let borderRadius = _ref.borderRadius,
31
- borderWidth = _ref.borderWidth,
32
- dir = _ref.dir,
33
- theme = _ref.theme;
31
+ borderWidth = _ref.borderWidth,
32
+ dir = _ref.dir,
33
+ theme = _ref.theme;
34
34
  const isRtlDirection = dir === DIRECTION.rtl;
35
35
  return {
36
36
  borderRadius: getShorthandPropValue('View', theme, isRtlDirection ? mirrorShorthandCorners(borderRadius) : borderRadius, 'borderRadius'),
37
37
  borderWidth: getShorthandPropValue('View', theme, isRtlDirection ? mirrorShorthandEdges(borderWidth) : borderWidth, 'borderWidth')
38
38
  };
39
39
  };
40
-
41
40
  const getSpacingStyle = _ref2 => {
42
41
  let margin = _ref2.margin,
43
- padding = _ref2.padding,
44
- dir = _ref2.dir,
45
- theme = _ref2.theme;
42
+ padding = _ref2.padding,
43
+ dir = _ref2.dir,
44
+ theme = _ref2.theme;
46
45
  const isRtlDirection = dir === DIRECTION.rtl;
47
46
  return {
48
47
  margin: getShorthandPropValue('View', theme, isRtlDirection ? mirrorShorthandEdges(margin) : margin, 'margin'),
49
48
  padding: getShorthandPropValue('View', theme, isRtlDirection ? mirrorShorthandEdges(padding) : padding, 'padding')
50
49
  };
51
50
  };
52
-
53
51
  const getOffsetStyle = _ref3 => {
54
52
  let insetBlockStart = _ref3.insetBlockStart,
55
- insetBlockEnd = _ref3.insetBlockEnd,
56
- insetInlineStart = _ref3.insetInlineStart,
57
- insetInlineEnd = _ref3.insetInlineEnd,
58
- dir = _ref3.dir;
53
+ insetBlockEnd = _ref3.insetBlockEnd,
54
+ insetInlineStart = _ref3.insetInlineStart,
55
+ insetInlineEnd = _ref3.insetInlineEnd,
56
+ dir = _ref3.dir;
59
57
  const isRtlDirection = dir === DIRECTION.rtl;
60
58
  const blockStart = {
61
59
  top: insetBlockStart,
@@ -69,80 +67,71 @@ const getOffsetStyle = _ref3 => {
69
67
  left: isRtlDirection ? insetInlineEnd : insetInlineStart,
70
68
  right: isRtlDirection ? insetInlineStart : insetInlineEnd
71
69
  };
72
- return { ...blockStart,
70
+ return {
71
+ ...blockStart,
73
72
  ...blockEnd,
74
73
  ...horizontalOffsets
75
74
  };
76
75
  };
77
-
78
76
  const getStyleProps = _ref4 => {
79
77
  let cursor = _ref4.cursor,
80
- style = _ref4.style;
81
- const whitelisted = pickProps(style || {}, {}, [// Position/calculateElementPosition:
82
- 'top', 'left', 'position', 'display', 'transform', 'overflow', 'minWidth', 'minHeight', // Img:
83
- 'filter', // Flex.Item:
84
- 'flexBasis', // Avatar:
85
- 'backgroundImage', // Popover:
78
+ style = _ref4.style;
79
+ const whitelisted = pickProps(style || {}, {}, [
80
+ // Position/calculateElementPosition:
81
+ 'top', 'left', 'position', 'display', 'transform', 'overflow', 'minWidth', 'minHeight',
82
+ // Img:
83
+ 'filter',
84
+ // Flex.Item:
85
+ 'flexBasis',
86
+ // Avatar:
87
+ 'backgroundImage',
88
+ // Popover:
86
89
  'pointerEvents']);
87
-
88
90
  if (cursor) {
89
91
  whitelisted.cursor = cursor;
90
92
  }
91
-
92
93
  return whitelisted;
93
94
  };
94
-
95
95
  const verifyUniformValues = (initialValue, input) => {
96
96
  if (typeof input !== 'string') {
97
97
  return false;
98
98
  }
99
-
100
99
  return input.trim().split(' ').every(value => initialValue === value);
101
100
  };
102
-
103
101
  const getFocusRingRadius = borderRadius => {
104
102
  const baseRadiusStyle = 'focusRing--radius';
105
103
  const initialValue = (borderRadius || '').trim().split(' ')[0];
106
-
107
104
  if (verifyUniformValues(initialValue, borderRadius)) {
108
105
  const capitalize = str => `${str.charAt(0).toUpperCase()}${str.slice(1)}`;
109
-
110
106
  if (['small', 'medium', 'large'].includes(initialValue)) return `${baseRadiusStyle}${capitalize(initialValue)}`;
111
107
  if (['circle', 'pill'].includes(initialValue)) return `${baseRadiusStyle}Inherit`;
112
108
  }
113
-
114
109
  return `${baseRadiusStyle}None`;
115
110
  };
116
-
117
111
  const getFocusOutline = props => {
118
112
  const position = props.position,
119
- display = props.display,
120
- focusPosition = props.focusPosition,
121
- shouldDisplayFocusOutline = props.withFocusOutline;
122
-
113
+ display = props.display,
114
+ focusPosition = props.focusPosition,
115
+ shouldDisplayFocusOutline = props.withFocusOutline;
123
116
  if (typeof shouldDisplayFocusOutline === 'undefined') {
124
117
  return shouldDisplayFocusOutline;
125
118
  }
126
-
127
119
  if (shouldDisplayFocusOutline) {
128
120
  error(display === 'inline' || position === 'relative', '[View] the focus outline will only show if the `position` prop is `relative`.');
129
121
  error(display !== 'inline' || focusPosition === 'inset', '[View] when display is set to `inline` the focus outline will only show if `focusPosition` is set to `inset`.');
130
122
  }
131
-
132
123
  return shouldDisplayFocusOutline;
133
124
  };
134
-
135
125
  const withBorder = props => {
136
126
  const borderWidth = props.borderWidth;
137
127
  return borderWidth && borderWidth !== '0' && borderWidth !== 'none';
138
128
  };
139
-
140
129
  const getFocusStyles = (props, componentTheme) => {
141
130
  const focusColor = props.focusColor,
142
- focusPosition = props.focusPosition,
143
- position = props.position,
144
- shouldAnimateFocus = props.shouldAnimateFocus,
145
- borderRadius = props.borderRadius;
131
+ focusPosition = props.focusPosition,
132
+ position = props.position,
133
+ shouldAnimateFocus = props.shouldAnimateFocus,
134
+ borderRadius = props.borderRadius;
146
135
  const focusOutline = getFocusOutline(props);
147
136
  const shouldUseBrowserFocus = typeof focusOutline === 'undefined';
148
137
  const focusPositionVariants = {
@@ -165,7 +154,6 @@ const getFocusStyles = (props, componentTheme) => {
165
154
  success: componentTheme.focusColorSuccess,
166
155
  danger: componentTheme.focusColorDanger
167
156
  };
168
-
169
157
  if (position === 'relative') {
170
158
  const focusRingRadius = getFocusRingRadius(borderRadius);
171
159
  const focusRingVariants = {
@@ -219,7 +207,8 @@ const getFocusStyles = (props, componentTheme) => {
219
207
  },
220
208
  '&:focus': {
221
209
  outline: 'none',
222
- '&::before': { ...(shouldUseBrowserFocus ? {
210
+ '&::before': {
211
+ ...(shouldUseBrowserFocus ? {
223
212
  opacity: 1,
224
213
  transform: 'scale(1)'
225
214
  } : {})
@@ -227,7 +216,6 @@ const getFocusStyles = (props, componentTheme) => {
227
216
  }
228
217
  };
229
218
  }
230
-
231
219
  return {
232
220
  '&::before': {
233
221
  borderStyle: 'none'
@@ -238,13 +226,15 @@ const getFocusStyles = (props, componentTheme) => {
238
226
  outlineWidth: componentTheme.focusOutlineWidth,
239
227
  outlineStyle: componentTheme.focusOutlineStyle
240
228
  } : {}),
241
- '&:focus': { ...(shouldUseBrowserFocus ? {
229
+ '&:focus': {
230
+ ...(shouldUseBrowserFocus ? {
242
231
  outlineWidth: componentTheme.focusOutlineWidth,
243
232
  outlineStyle: componentTheme.focusOutlineStyle
244
233
  } : {})
245
234
  }
246
235
  };
247
236
  };
237
+
248
238
  /**
249
239
  * ---
250
240
  * private: true
@@ -255,35 +245,33 @@ const getFocusStyles = (props, componentTheme) => {
255
245
  * @param {Object} extraArgs
256
246
  * @return {Object} The final style object, which will be used in the component
257
247
  */
258
-
259
-
260
248
  const generateStyle = (componentTheme, props) => {
261
249
  const borderRadius = props.borderRadius,
262
- borderWidth = props.borderWidth,
263
- margin = props.margin,
264
- padding = props.padding,
265
- position = props.position,
266
- display = props.display,
267
- focusPosition = props.focusPosition,
268
- textAlign = props.textAlign,
269
- borderColor = props.borderColor,
270
- background = props.background,
271
- stacking = props.stacking,
272
- shadow = props.shadow,
273
- overflowY = props.overflowY,
274
- overflowX = props.overflowX,
275
- insetBlockEnd = props.insetBlockEnd,
276
- insetBlockStart = props.insetBlockStart,
277
- insetInlineEnd = props.insetInlineEnd,
278
- insetInlineStart = props.insetInlineStart,
279
- width = props.width,
280
- height = props.height,
281
- minWidth = props.minWidth,
282
- minHeight = props.minHeight,
283
- maxWidth = props.maxWidth,
284
- maxHeight = props.maxHeight,
285
- withVisualDebug = props.withVisualDebug,
286
- dir = props.dir;
250
+ borderWidth = props.borderWidth,
251
+ margin = props.margin,
252
+ padding = props.padding,
253
+ position = props.position,
254
+ display = props.display,
255
+ focusPosition = props.focusPosition,
256
+ textAlign = props.textAlign,
257
+ borderColor = props.borderColor,
258
+ background = props.background,
259
+ stacking = props.stacking,
260
+ shadow = props.shadow,
261
+ overflowY = props.overflowY,
262
+ overflowX = props.overflowX,
263
+ insetBlockEnd = props.insetBlockEnd,
264
+ insetBlockStart = props.insetBlockStart,
265
+ insetInlineEnd = props.insetInlineEnd,
266
+ insetInlineStart = props.insetInlineStart,
267
+ width = props.width,
268
+ height = props.height,
269
+ minWidth = props.minWidth,
270
+ minHeight = props.minHeight,
271
+ maxWidth = props.maxWidth,
272
+ maxHeight = props.maxHeight,
273
+ withVisualDebug = props.withVisualDebug,
274
+ dir = props.dir;
287
275
  const borderStyle = getBorderStyle({
288
276
  theme: componentTheme,
289
277
  borderRadius,
@@ -466,7 +454,8 @@ const generateStyle = (componentTheme, props) => {
466
454
  inlineStyles: {
467
455
  //every '&' symbol will add another class to the rule, so it will be stronger
468
456
  //making an accidental override less likely
469
- '&&&&&&&&&&': { ...spacingStyle,
457
+ '&&&&&&&&&&': {
458
+ ...spacingStyle,
470
459
  ...borderStyle,
471
460
  ...offsetStyle,
472
461
  width,
@@ -480,5 +469,4 @@ const generateStyle = (componentTheme, props) => {
480
469
  }
481
470
  };
482
471
  };
483
-
484
472
  export default generateStyle;
package/es/View/theme.js CHANGED
@@ -23,8 +23,8 @@
23
23
  */
24
24
 
25
25
  /* Global variables (colors, typography, spacing, etc.) are defined in lib/themes */
26
- import { makeThemeVars } from '@instructure/emotion';
27
26
 
27
+ import { makeThemeVars } from '@instructure/emotion';
28
28
  /**
29
29
  * Generates the theme object for the component from the theme and provided additional information
30
30
  * @param {Object} theme The actual theme object.
@@ -32,13 +32,13 @@ import { makeThemeVars } from '@instructure/emotion';
32
32
  */
33
33
  const generateComponentTheme = theme => {
34
34
  const colors = theme.colors,
35
- typography = theme.typography,
36
- borders = theme.borders,
37
- breakpoints = theme.breakpoints,
38
- spacing = theme.spacing,
39
- shadows = theme.shadows,
40
- stacking = theme.stacking,
41
- themeName = theme.key;
35
+ typography = theme.typography,
36
+ borders = theme.borders,
37
+ breakpoints = theme.breakpoints,
38
+ spacing = theme.spacing,
39
+ shadows = theme.shadows,
40
+ stacking = theme.stacking,
41
+ themeName = theme.key;
42
42
  const themeSpecificStyle = {
43
43
  canvas: {
44
44
  color: theme['ic-brand-font-color-dark'],
@@ -78,6 +78,7 @@ const generateComponentTheme = theme => {
78
78
  focusOutlineOffset: '0.3125rem',
79
79
  focusOutlineInset: '0rem',
80
80
  // do not use unitless zero (for CSS calc())
81
+
81
82
  focusColorInfo: colors === null || colors === void 0 ? void 0 : colors.borderInfo,
82
83
  focusColorDanger: colors === null || colors === void 0 ? void 0 : colors.borderDanger,
83
84
  focusColorSuccess: colors === null || colors === void 0 ? void 0 : colors.borderSuccess,
@@ -92,9 +93,9 @@ const generateComponentTheme = theme => {
92
93
  ...makeThemeVars('stacking', stacking),
93
94
  ...makeThemeVars('border', borders)
94
95
  };
95
- return { ...componentVariables,
96
+ return {
97
+ ...componentVariables,
96
98
  ...themeSpecificStyle[themeName]
97
99
  };
98
100
  };
99
-
100
101
  export default generateComponentTheme;
package/es/index.js CHANGED
@@ -21,5 +21,6 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+
24
25
  export { ContextView } from './ContextView';
25
26
  export { View } from './View';
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _react = _interopRequireDefault(require("react"));
11
-
12
9
  var _span;
13
-
14
10
  var _default = {
15
11
  sectionProp: 'background',
16
12
  propValues: {
@@ -1,28 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = exports.ContextView = void 0;
9
-
10
8
  var _react = require("react");
11
-
12
9
  var _emotion = require("@instructure/emotion");
13
-
14
10
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
15
-
16
11
  var _View = require("../View");
17
-
18
12
  var _styles = _interopRequireDefault(require("./styles"));
19
-
20
13
  var _theme = _interopRequireDefault(require("./theme"));
21
-
22
14
  var _props = require("./props");
23
-
24
15
  var _dec, _class, _class2;
25
-
26
16
  /**
27
17
  ---
28
18
  category: components
@@ -33,48 +23,41 @@ let ContextView = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
33
23
  constructor() {
34
24
  super(...arguments);
35
25
  this.ref = null;
36
-
37
26
  this.handleRef = el => {
38
27
  const elementRef = this.props.elementRef;
39
28
  this.ref = el;
40
-
41
29
  if (typeof elementRef === 'function') {
42
30
  elementRef(el);
43
31
  }
44
32
  };
45
33
  }
46
-
47
34
  componentDidMount() {
48
35
  var _this$props$makeStyle, _this$props;
49
-
50
36
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
51
37
  }
52
-
53
38
  componentDidUpdate() {
54
39
  var _this$props$makeStyle2, _this$props2;
55
-
56
40
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
57
41
  }
58
-
59
42
  render() {
60
43
  const _this$props3 = this.props,
61
- as = _this$props3.as,
62
- background = _this$props3.background,
63
- children = _this$props3.children,
64
- debug = _this$props3.debug,
65
- height = _this$props3.height,
66
- width = _this$props3.width,
67
- maxHeight = _this$props3.maxHeight,
68
- maxWidth = _this$props3.maxWidth,
69
- minHeight = _this$props3.minHeight,
70
- minWidth = _this$props3.minWidth,
71
- margin = _this$props3.margin,
72
- padding = _this$props3.padding,
73
- shadow = _this$props3.shadow,
74
- stacking = _this$props3.stacking,
75
- style = _this$props3.style,
76
- textAlign = _this$props3.textAlign,
77
- styles = _this$props3.styles;
44
+ as = _this$props3.as,
45
+ background = _this$props3.background,
46
+ children = _this$props3.children,
47
+ debug = _this$props3.debug,
48
+ height = _this$props3.height,
49
+ width = _this$props3.width,
50
+ maxHeight = _this$props3.maxHeight,
51
+ maxWidth = _this$props3.maxWidth,
52
+ minHeight = _this$props3.minHeight,
53
+ minWidth = _this$props3.minWidth,
54
+ margin = _this$props3.margin,
55
+ padding = _this$props3.padding,
56
+ shadow = _this$props3.shadow,
57
+ stacking = _this$props3.stacking,
58
+ style = _this$props3.style,
59
+ textAlign = _this$props3.textAlign,
60
+ styles = _this$props3.styles;
78
61
  return (0, _emotion.jsx)(_View.View, Object.assign({}, (0, _omitProps.omitProps)(this.props, ContextView.allowedProps), {
79
62
  css: styles === null || styles === void 0 ? void 0 : styles.contextView,
80
63
  style: style,
@@ -106,7 +89,6 @@ let ContextView = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
106
89
  css: styles === null || styles === void 0 ? void 0 : styles.contextView__arrow
107
90
  }), children));
108
91
  }
109
-
110
92
  }, _class2.displayName = "ContextView", _class2.componentId = 'ContextView', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
111
93
  as: 'span',
112
94
  elementRef: () => {},
@@ -1,18 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.propTypes = exports.allowedProps = void 0;
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _emotion = require("@instructure/emotion");
13
-
14
10
  var _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes.js");
15
-
16
11
  /*
17
12
  * The MIT License (MIT)
18
13
  *
@@ -36,24 +31,22 @@ var _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes
36
31
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
32
  * SOFTWARE.
38
33
  */
34
+
39
35
  const propTypes = {
40
36
  /**
41
37
  * The element to render as the component root
42
38
  */
43
39
  as: _propTypes.default.elementType,
44
-
45
40
  /**
46
41
  * provides a reference to the underlying html root element
47
42
  */
48
43
  elementRef: _propTypes.default.func,
49
-
50
44
  /**
51
45
  * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
52
46
  * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
53
47
  * familiar CSS-like shorthand. For example: `margin="small auto large"`.
54
48
  */
55
49
  margin: _emotion.ThemeablePropTypes.spacing,
56
-
57
50
  /**
58
51
  * Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
59
52
  * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
@@ -66,38 +59,31 @@ const propTypes = {
66
59
  maxWidth: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
67
60
  minHeight: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
68
61
  minWidth: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
69
-
70
62
  /**
71
63
  * The children to render inside the `<ContextView />`
72
64
  */
73
65
  children: _propTypes.default.node,
74
-
75
66
  /**
76
67
  * Designates the text alignment within the `<ContextView />`
77
68
  */
78
69
  textAlign: _propTypes.default.oneOf(['start', 'center', 'end']),
79
-
80
70
  /**
81
71
  * Controls the shadow depth for the `<ContextView />`
82
72
  */
83
73
  shadow: _emotion.ThemeablePropTypes.shadow,
84
-
85
74
  /**
86
75
  * Controls the z-index depth for the `<ContextView />`
87
76
  */
88
77
  stacking: _emotion.ThemeablePropTypes.stacking,
89
-
90
78
  /**
91
79
  * Designates the background style of the `<ContextView />`
92
80
  */
93
81
  background: _propTypes.default.oneOf(['default', 'inverse']),
94
-
95
82
  /**
96
83
  * Specifies how the arrow for `<ContextView />` will be rendered.
97
84
  * Ex. `placement="top"` will render with an arrow pointing down.
98
85
  */
99
86
  placement: _PositionPropTypes.PositionPropTypes.placement,
100
-
101
87
  /**
102
88
  * Activate an outline around the component to make building your
103
89
  * layout easier
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _mirrorPlacement = require("@instructure/ui-position/lib/mirrorPlacement.js");
9
-
10
8
  /*
11
9
  * The MIT License (MIT)
12
10
  *
@@ -30,11 +28,11 @@ var _mirrorPlacement = require("@instructure/ui-position/lib/mirrorPlacement.js"
30
28
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
29
  * SOFTWARE.
32
30
  */
31
+
33
32
  const endPlacements = ['end center', 'end top', 'end bottom', 'center end', 'end'];
34
33
  const startPlacements = ['start center', 'start top', 'start bottom', 'center start', 'start'];
35
34
  const bottomPlacements = ['bottom', 'bottom end', 'bottom start', 'bottom center'];
36
35
  const topPlacements = ['top', 'top start', 'top end', 'top center'];
37
-
38
36
  const getPlacementStyle = (placement, theme) => {
39
37
  if (endPlacements.includes(placement)) {
40
38
  return {
@@ -42,78 +40,65 @@ const getPlacementStyle = (placement, theme) => {
42
40
  paddingInlineEnd: '0'
43
41
  };
44
42
  }
45
-
46
43
  if (startPlacements.includes(placement)) {
47
44
  return {
48
45
  paddingInlineEnd: theme === null || theme === void 0 ? void 0 : theme.arrowSize,
49
46
  paddingInlineStart: '0'
50
47
  };
51
48
  }
52
-
53
49
  if (bottomPlacements.includes(placement)) {
54
50
  return {
55
51
  paddingTop: theme === null || theme === void 0 ? void 0 : theme.arrowSize
56
52
  };
57
53
  }
58
-
59
54
  if (topPlacements.includes(placement)) {
60
55
  return {
61
56
  paddingBottom: theme === null || theme === void 0 ? void 0 : theme.arrowSize
62
57
  };
63
58
  }
64
-
65
59
  return {
66
60
  position: 'absolute',
67
61
  left: '-999em'
68
62
  };
69
63
  };
70
-
71
64
  const getArrowCorrections = (placement, theme) => {
72
65
  const center = ['top', 'bottom', 'top center', 'bottom center'];
73
66
  const start = ['top start', 'bottom start'];
74
67
  const end = ['top end', 'bottom end'];
75
68
  const top = ['start top', 'end top'];
76
69
  const bottom = ['start bottom', 'end bottom'];
77
-
78
70
  if (center.includes(placement)) {
79
71
  return {
80
72
  insetInlineStart: '50%'
81
73
  };
82
74
  }
83
-
84
75
  if (start.includes(placement)) {
85
76
  return {
86
77
  insetInlineStart: `calc((${theme === null || theme === void 0 ? void 0 : theme.arrowSize} + ${theme === null || theme === void 0 ? void 0 : theme.arrowBorderWidth}) * 2)`,
87
78
  insetInlineEnd: 'auto'
88
79
  };
89
80
  }
90
-
91
81
  if (end.includes(placement)) {
92
82
  return {
93
83
  insetInlineStart: `calc(100% - (${theme === null || theme === void 0 ? void 0 : theme.arrowSize} + ${theme === null || theme === void 0 ? void 0 : theme.arrowBorderWidth}) * 2)`,
94
84
  insetInlineEnd: 'auto'
95
85
  };
96
86
  }
97
-
98
87
  if (top.includes(placement)) {
99
88
  return {
100
89
  top: `calc((${theme === null || theme === void 0 ? void 0 : theme.arrowSize} + ${theme === null || theme === void 0 ? void 0 : theme.arrowBorderWidth}) * 2)`
101
90
  };
102
91
  }
103
-
104
92
  if (bottom.includes(placement)) {
105
93
  return {
106
94
  top: `calc(100% - (${theme === null || theme === void 0 ? void 0 : theme.arrowSize} + ${theme === null || theme === void 0 ? void 0 : theme.arrowBorderWidth}) * 2)`
107
95
  };
108
96
  }
109
-
110
97
  return {};
111
98
  };
112
-
113
99
  const getArrowPlacementVariant = (placement, background, theme) => {
114
100
  const transformedPlacement = (0, _mirrorPlacement.mirrorPlacement)(placement, ' ');
115
101
  const isInversed = background === 'inverse';
116
-
117
102
  if (endPlacements.includes(transformedPlacement)) {
118
103
  return {
119
104
  main: {
@@ -141,7 +126,6 @@ const getArrowPlacementVariant = (placement, background, theme) => {
141
126
  }
142
127
  };
143
128
  }
144
-
145
129
  if (startPlacements.includes(transformedPlacement)) {
146
130
  return {
147
131
  main: {
@@ -169,7 +153,6 @@ const getArrowPlacementVariant = (placement, background, theme) => {
169
153
  }
170
154
  };
171
155
  }
172
-
173
156
  if (bottomPlacements.includes(transformedPlacement)) {
174
157
  return {
175
158
  main: {
@@ -193,7 +176,6 @@ const getArrowPlacementVariant = (placement, background, theme) => {
193
176
  }
194
177
  };
195
178
  }
196
-
197
179
  return {
198
180
  main: {
199
181
  bottom: '100%',
@@ -216,6 +198,7 @@ const getArrowPlacementVariant = (placement, background, theme) => {
216
198
  }
217
199
  };
218
200
  };
201
+
219
202
  /**
220
203
  * ---
221
204
  * private: true
@@ -226,11 +209,9 @@ const getArrowPlacementVariant = (placement, background, theme) => {
226
209
  * @param {Object} state the state of the component, the style is applied to
227
210
  * @return {Object} The final style object, which will be used in the component
228
211
  */
229
-
230
-
231
212
  const generateStyle = (componentTheme, props) => {
232
213
  const placement = props.placement,
233
- background = props.background;
214
+ background = props.background;
234
215
  const arrowBaseStyles = {
235
216
  content: '""',
236
217
  height: '0',
@@ -276,6 +257,5 @@ const generateStyle = (componentTheme, props) => {
276
257
  arrowBorderWidth: componentTheme.arrowBorderWidth
277
258
  };
278
259
  };
279
-
280
260
  var _default = generateStyle;
281
261
  exports.default = _default;