grommet 2.48.0 → 2.50.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.
Files changed (157) hide show
  1. package/components/AccordionPanel/AccordionPanel.js +3 -6
  2. package/components/Anchor/StyledAnchor.js +1 -1
  3. package/components/Box/StyledBox.js +1 -1
  4. package/components/Button/BusyAnimation.js +5 -1
  5. package/components/Button/Button.js +3 -1
  6. package/components/Calendar/Calendar.js +7 -10
  7. package/components/Cards/Cards.js +3 -4
  8. package/components/Chart/Chart.js +11 -9
  9. package/components/Chart/calcs.js +21 -13
  10. package/components/CheckBox/CheckBox.js +1 -1
  11. package/components/CheckBoxGroup/CheckBoxGroup.js +2 -3
  12. package/components/Data/Data.js +5 -1
  13. package/components/Data/DataForm.js +6 -4
  14. package/components/Data/stories/Infinite.stories.js +10 -15
  15. package/components/Data/stories/OnSelect.stories.js +10 -15
  16. package/components/Data/stories/SpaceX.stories.js +10 -15
  17. package/components/Data/stories/StarWars.stories.js +6 -8
  18. package/components/DataChart/DataChart.js +14 -12
  19. package/components/DataChart/Detail.js +2 -2
  20. package/components/DataChart/Legend.js +8 -9
  21. package/components/DataChart/utils.js +15 -8
  22. package/components/DataFilter/DataFilter.js +10 -9
  23. package/components/DataFilters/DataFilters.js +9 -10
  24. package/components/DataSearch/DataSearch.js +5 -4
  25. package/components/DataSort/DataSort.js +4 -3
  26. package/components/DataSummary/DataSummary.js +6 -6
  27. package/components/DataTable/ExpanderCell.js +6 -3
  28. package/components/DataTable/Footer.js +6 -3
  29. package/components/DataTable/Header.js +6 -3
  30. package/components/DataTable/Resizer.js +22 -8
  31. package/components/DataTable/Searcher.js +5 -7
  32. package/components/DataTable/stories/ResizePinned.stories.js +321 -0
  33. package/components/DataTable/stories/SpaceX.stories.js +15 -16
  34. package/components/DataTable/stories/SpaceXUngrouped.stories.js +7 -7
  35. package/components/DataTable/stories/rowDetails.stories.js +6 -8
  36. package/components/DataTableColumns/DataTableColumns.js +24 -22
  37. package/components/DateInput/DateInput.js +7 -6
  38. package/components/Distribution/Distribution.js +8 -5
  39. package/components/FileInput/FileInput.js +41 -36
  40. package/components/Footer/Footer.js +5 -1
  41. package/components/Header/Header.js +2 -2
  42. package/components/Layer/Layer.js +10 -5
  43. package/components/Layer/StyledLayer.js +2 -2
  44. package/components/List/List.js +5 -4
  45. package/components/MaskedInput/MaskedInput.js +6 -1
  46. package/components/Menu/Menu.js +13 -1
  47. package/components/Meter/Bar.js +38 -17
  48. package/components/Meter/Circle.js +31 -46
  49. package/components/Meter/stories/Circle.stories.js +6 -8
  50. package/components/Meter/utils.js +15 -1
  51. package/components/Nav/Nav.js +5 -1
  52. package/components/Notification/Notification.js +6 -8
  53. package/components/Pagination/Pagination.js +5 -10
  54. package/components/Pagination/PaginationStep.js +2 -1
  55. package/components/Paragraph/ParagraphSkeleton.js +2 -1
  56. package/components/RadioButton/RadioButton.js +1 -1
  57. package/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
  58. package/components/RangeSelector/RangeSelector.js +2 -6
  59. package/components/Select/SelectContainer.js +2 -1
  60. package/components/SelectMultiple/SelectMultipleContainer.js +8 -4
  61. package/components/SelectMultiple/SelectMultipleValue.js +5 -7
  62. package/components/SelectMultiple/SelectionSummary.js +7 -8
  63. package/components/Sidebar/Sidebar.js +6 -3
  64. package/components/Spinner/Spinner.js +7 -4
  65. package/components/StarRating/StarRating.js +8 -5
  66. package/components/Tab/Tab.js +2 -1
  67. package/components/Table/StyledTable.js +2 -2
  68. package/components/Tabs/Tabs.js +8 -12
  69. package/components/Tag/StyledTag.js +9 -1
  70. package/components/TextInput/CopyButton.js +3 -2
  71. package/components/TextInput/TextInput.js +5 -0
  72. package/components/ThumbsRating/ThumbsRating.js +15 -10
  73. package/components/Toolbar/Toolbar.js +15 -11
  74. package/components/Video/Video.js +3 -5
  75. package/es6/components/AccordionPanel/AccordionPanel.js +3 -6
  76. package/es6/components/Anchor/StyledAnchor.js +2 -2
  77. package/es6/components/Box/StyledBox.js +1 -1
  78. package/es6/components/Button/BusyAnimation.js +5 -1
  79. package/es6/components/Button/Button.js +3 -1
  80. package/es6/components/Calendar/Calendar.js +7 -10
  81. package/es6/components/Cards/Cards.js +3 -4
  82. package/es6/components/Chart/Chart.js +11 -9
  83. package/es6/components/Chart/calcs.js +21 -13
  84. package/es6/components/CheckBox/CheckBox.js +1 -1
  85. package/es6/components/CheckBoxGroup/CheckBoxGroup.js +2 -3
  86. package/es6/components/Data/Data.js +5 -1
  87. package/es6/components/Data/DataForm.js +6 -4
  88. package/es6/components/Data/stories/Infinite.stories.js +10 -15
  89. package/es6/components/Data/stories/OnSelect.stories.js +10 -15
  90. package/es6/components/Data/stories/SpaceX.stories.js +10 -15
  91. package/es6/components/Data/stories/StarWars.stories.js +6 -8
  92. package/es6/components/DataChart/DataChart.js +14 -12
  93. package/es6/components/DataChart/Detail.js +2 -2
  94. package/es6/components/DataChart/Legend.js +8 -9
  95. package/es6/components/DataChart/utils.js +15 -8
  96. package/es6/components/DataFilter/DataFilter.js +10 -9
  97. package/es6/components/DataFilters/DataFilters.js +9 -10
  98. package/es6/components/DataSearch/DataSearch.js +5 -4
  99. package/es6/components/DataSort/DataSort.js +4 -3
  100. package/es6/components/DataSummary/DataSummary.js +6 -6
  101. package/es6/components/DataTable/ExpanderCell.js +4 -1
  102. package/es6/components/DataTable/Footer.js +4 -1
  103. package/es6/components/DataTable/Header.js +6 -3
  104. package/es6/components/DataTable/Resizer.js +22 -8
  105. package/es6/components/DataTable/Searcher.js +5 -7
  106. package/es6/components/DataTable/stories/ResizePinned.stories.js +316 -0
  107. package/es6/components/DataTable/stories/SpaceX.stories.js +15 -16
  108. package/es6/components/DataTable/stories/SpaceXUngrouped.stories.js +7 -7
  109. package/es6/components/DataTable/stories/rowDetails.stories.js +6 -8
  110. package/es6/components/DataTableColumns/DataTableColumns.js +23 -21
  111. package/es6/components/DateInput/DateInput.js +6 -5
  112. package/es6/components/Distribution/Distribution.js +8 -5
  113. package/es6/components/FileInput/FileInput.js +42 -37
  114. package/es6/components/Footer/Footer.js +5 -1
  115. package/es6/components/Header/Header.js +2 -2
  116. package/es6/components/Layer/Layer.js +10 -5
  117. package/es6/components/Layer/StyledLayer.js +3 -3
  118. package/es6/components/List/List.js +5 -4
  119. package/es6/components/MaskedInput/MaskedInput.js +6 -1
  120. package/es6/components/Menu/Menu.js +13 -1
  121. package/es6/components/Meter/Bar.js +39 -18
  122. package/es6/components/Meter/Circle.js +33 -48
  123. package/es6/components/Meter/stories/Circle.stories.js +7 -9
  124. package/es6/components/Meter/utils.js +14 -0
  125. package/es6/components/Nav/Nav.js +5 -1
  126. package/es6/components/Notification/Notification.js +6 -8
  127. package/es6/components/Pagination/Pagination.js +5 -10
  128. package/es6/components/Pagination/PaginationStep.js +2 -1
  129. package/es6/components/Paragraph/ParagraphSkeleton.js +2 -1
  130. package/es6/components/RadioButton/RadioButton.js +1 -1
  131. package/es6/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
  132. package/es6/components/RangeSelector/RangeSelector.js +2 -6
  133. package/es6/components/Select/SelectContainer.js +2 -1
  134. package/es6/components/SelectMultiple/SelectMultipleContainer.js +8 -4
  135. package/es6/components/SelectMultiple/SelectMultipleValue.js +5 -7
  136. package/es6/components/SelectMultiple/SelectionSummary.js +7 -8
  137. package/es6/components/Sidebar/Sidebar.js +6 -3
  138. package/es6/components/Spinner/Spinner.js +6 -3
  139. package/es6/components/StarRating/StarRating.js +8 -5
  140. package/es6/components/Tab/Tab.js +2 -1
  141. package/es6/components/Table/StyledTable.js +2 -2
  142. package/es6/components/Tabs/Tabs.js +8 -12
  143. package/es6/components/Tag/StyledTag.js +10 -2
  144. package/es6/components/TextInput/CopyButton.js +3 -2
  145. package/es6/components/TextInput/TextInput.js +5 -0
  146. package/es6/components/ThumbsRating/ThumbsRating.js +15 -10
  147. package/es6/components/Toolbar/Toolbar.js +15 -11
  148. package/es6/components/Video/Video.js +3 -5
  149. package/es6/themes/base.d.ts +284 -4
  150. package/es6/themes/base.js +369 -21
  151. package/es6/utils/graphics.js +123 -0
  152. package/grommet.min.js +1 -1
  153. package/grommet.min.js.map +1 -1
  154. package/package.json +46 -46
  155. package/themes/base.d.ts +284 -4
  156. package/themes/base.js +369 -21
  157. package/utils/graphics.js +124 -1
@@ -26,14 +26,6 @@ var dropProps = {
26
26
  left: 'left'
27
27
  }
28
28
  };
29
- var tabsProps = {
30
- drop: {
31
- pad: 'small'
32
- },
33
- noDrop: {
34
- justify: 'start'
35
- }
36
- };
37
29
 
38
30
  // options can either be an array of property names or an array of objects.
39
31
  // The form value always uses an array of property names.
@@ -70,6 +62,7 @@ var alignOrder = function alignOrder(value, prevValue, options) {
70
62
  // Content is a separate component since it might be getting its form context
71
63
  // from the DataForm rendered inside DataTableColumns.
72
64
  var Content = function Content(_ref) {
65
+ var _theme$dataTableColum, _theme$dataTableColum2;
73
66
  var drop = _ref.drop,
74
67
  _ref$options = _ref.options,
75
68
  options = _ref$options === void 0 ? [] : _ref$options,
@@ -81,6 +74,18 @@ var Content = function Content(_ref) {
81
74
  useFormInput = _useContext2.useFormInput;
82
75
  var _useContext3 = useContext(MessageContext),
83
76
  format = _useContext3.format;
77
+ var _useThemeValue = useThemeValue(),
78
+ theme = _useThemeValue.theme;
79
+ var PinnedIcon = ((_theme$dataTableColum = theme.dataTableColumns) == null || (_theme$dataTableColum = _theme$dataTableColum.icons) == null ? void 0 : _theme$dataTableColum.pinned) || Lock;
80
+ var SearchIcon = ((_theme$dataTableColum2 = theme.dataTableColumns) == null || (_theme$dataTableColum2 = _theme$dataTableColum2.icons) == null ? void 0 : _theme$dataTableColum2.search) || Search;
81
+ var tabsProps = {
82
+ drop: {
83
+ pad: theme.dataTableColumns.tabs.pad
84
+ },
85
+ noDrop: {
86
+ justify: 'start'
87
+ }
88
+ };
84
89
 
85
90
  // If the user searches for a particular option, render
86
91
  // the filtered list of options.
@@ -105,7 +110,7 @@ var Content = function Content(_ref) {
105
110
  return items != null && items.length ? {
106
111
  background: 'none',
107
112
  color: 'text-weak',
108
- icon: /*#__PURE__*/React.createElement(Lock, null),
113
+ icon: /*#__PURE__*/React.createElement(PinnedIcon, null),
109
114
  items: items
110
115
  } : undefined;
111
116
  }, [options, objectOptions]);
@@ -142,13 +147,11 @@ var Content = function Content(_ref) {
142
147
  messages: messages == null ? void 0 : messages.dataTableColumns
143
148
  })
144
149
  }, /*#__PURE__*/React.createElement(Box, {
145
- pad: {
146
- vertical: 'small'
147
- },
148
- gap: "xsmall"
150
+ pad: theme.dataTableColumns.selectColumns.pad,
151
+ gap: theme.dataTableColumns.selectColumns.gap
149
152
  }, /*#__PURE__*/React.createElement(TextInput, {
150
153
  type: "search",
151
- icon: /*#__PURE__*/React.createElement(Search, null),
154
+ icon: /*#__PURE__*/React.createElement(SearchIcon, null),
152
155
  placeholder: "Search",
153
156
  value: search,
154
157
  onChange: function onChange(event) {
@@ -177,9 +180,7 @@ var Content = function Content(_ref) {
177
180
  messages: messages == null ? void 0 : messages.dataTableColumns
178
181
  })
179
182
  }, /*#__PURE__*/React.createElement(Box, {
180
- pad: {
181
- top: 'small'
182
- }
183
+ pad: theme.dataTableColumns.orderColumns.pad
183
184
  }, /*#__PURE__*/React.createElement(List, {
184
185
  id: dataId + "--order-columns",
185
186
  "aria-labelledby": dataId + "--order-columns-tab"
@@ -205,7 +206,7 @@ var Content = function Content(_ref) {
205
206
  })))));
206
207
  };
207
208
  export var DataTableColumns = function DataTableColumns(_ref5) {
208
- var _theme$data$button;
209
+ var _theme$dataTableColum3, _theme$data$button;
209
210
  var drop = _ref5.drop,
210
211
  options = _ref5.options,
211
212
  rest = _objectWithoutPropertiesLoose(_ref5, _excluded2);
@@ -216,11 +217,12 @@ export var DataTableColumns = function DataTableColumns(_ref5) {
216
217
  inDataForm = _useContext5.inDataForm;
217
218
  var _useContext6 = useContext(MessageContext),
218
219
  format = _useContext6.format;
219
- var _useThemeValue = useThemeValue(),
220
- theme = _useThemeValue.theme;
220
+ var _useThemeValue2 = useThemeValue(),
221
+ theme = _useThemeValue2.theme;
221
222
  var _useState3 = useState(),
222
223
  showContent = _useState3[0],
223
224
  setShowContent = _useState3[1];
225
+ var ControlIcon = ((_theme$dataTableColum3 = theme.dataTableColumns) == null || (_theme$dataTableColum3 = _theme$dataTableColum3.icons) == null ? void 0 : _theme$dataTableColum3.control) || Splits;
224
226
  var tip = format({
225
227
  id: 'dataTableColumns.tip',
226
228
  messages: messages == null ? void 0 : messages.dataTableColumns
@@ -241,7 +243,7 @@ export var DataTableColumns = function DataTableColumns(_ref5) {
241
243
  messages: messages == null ? void 0 : messages.dataTableColumns
242
244
  }),
243
245
  kind: (_theme$data$button = theme.data.button) == null ? void 0 : _theme$data$button.kind,
244
- icon: /*#__PURE__*/React.createElement(Splits, null),
246
+ icon: /*#__PURE__*/React.createElement(ControlIcon, null),
245
247
  tip: tip,
246
248
  dropProps: dropProps,
247
249
  dropContent: content,
@@ -4,7 +4,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
4
4
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
5
5
  import React, { useRef, forwardRef, useContext, useEffect, useMemo, useState, useCallback } from 'react';
6
6
  import styled from 'styled-components';
7
- import { Calendar as CalendarIcon } from 'grommet-icons/icons/Calendar';
7
+ import { Calendar as GrommetCalendarIcon } from 'grommet-icons/icons/Calendar';
8
8
  import { AnnounceContext } from '../../contexts/AnnounceContext';
9
9
  import { MessageContext } from '../../contexts/MessageContext';
10
10
  import { Box } from '../Box';
@@ -49,7 +49,7 @@ var getReference = function getReference(value) {
49
49
  return adjustedDate;
50
50
  };
51
51
  var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
52
- var _theme$icon, _theme$dateInput$icon;
52
+ var _theme$icon, _theme$dateInput$icon, _theme$dateInput$icon2, _theme$dateInput$butt, _theme$dateInput$butt2;
53
53
  var buttonProps = _ref.buttonProps,
54
54
  calendarProps = _ref.calendarProps,
55
55
  defaultValue = _ref.defaultValue,
@@ -78,7 +78,7 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
78
78
  var announce = useContext(AnnounceContext);
79
79
  var _useContext = useContext(MessageContext),
80
80
  formatMessage = _useContext.format;
81
- var iconSize = ((_theme$icon = theme.icon) == null ? void 0 : _theme$icon.matchSize) && rest.size || ((_theme$dateInput$icon = theme.dateInput.icon) == null ? void 0 : _theme$dateInput$icon.size) || 'medium';
81
+ var iconSize = ((_theme$icon = theme.icon) == null ? void 0 : _theme$icon.matchSize) && rest.size || ((_theme$dateInput$icon = theme.dateInput.icon) == null ? void 0 : _theme$dateInput$icon.size);
82
82
  var _useContext2 = useContext(FormContext),
83
83
  useFormInput = _useContext2.useFormInput;
84
84
  var ref = useForwardedRef(refArg);
@@ -92,6 +92,7 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
92
92
  value = _useFormInput[0],
93
93
  setValue = _useFormInput[1];
94
94
  var usingKeyboard = useKeyboard();
95
+ var CalendarIcon = ((_theme$dateInput$icon2 = theme.dateInput.icon) == null ? void 0 : _theme$dateInput$icon2.calendar) || GrommetCalendarIcon;
95
96
  var _useState = useState(getOutputFormat(value)),
96
97
  outputFormat = _useState[0],
97
98
  setOutputFormat = _useState[1];
@@ -290,9 +291,9 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
290
291
  size: iconSize
291
292
  }),
292
293
  margin: reverse ? {
293
- left: 'small'
294
+ left: (_theme$dateInput$butt = theme.dateInput.button) == null ? void 0 : _theme$dateInput$butt.margin
294
295
  } : {
295
- right: 'small'
296
+ right: (_theme$dateInput$butt2 = theme.dateInput.button) == null ? void 0 : _theme$dateInput$butt2.margin
296
297
  }
297
298
  });
298
299
  var input = /*#__PURE__*/React.createElement(FormContext.Provider, {
@@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
6
6
  import { Box } from '../Box';
7
7
  import { Text } from '../Text';
8
8
  import { DistributionPropTypes } from './propTypes';
9
+ import { useThemeValue } from '../../utils/useThemeValue';
9
10
  var Value = function Value(_ref) {
10
11
  var basis = _ref.basis,
11
12
  children = _ref.children;
@@ -33,11 +34,12 @@ var _Distribution = function Distribution(_ref2) {
33
34
  _ref2$direction = _ref2.direction,
34
35
  direction = _ref2$direction === void 0 ? 'row' : _ref2$direction,
35
36
  fill = _ref2.fill,
36
- _ref2$gap = _ref2.gap,
37
- gap = _ref2$gap === void 0 ? 'xsmall' : _ref2$gap,
37
+ gap = _ref2.gap,
38
38
  _ref2$values = _ref2.values,
39
39
  values = _ref2$values === void 0 ? defaultValues : _ref2$values,
40
40
  rest = _objectWithoutPropertiesLoose(_ref2, _excluded);
41
+ var _useThemeValue = useThemeValue(),
42
+ theme = _useThemeValue.theme;
41
43
  if (values.length === 1) {
42
44
  var value = values[0];
43
45
  return /*#__PURE__*/React.createElement(Value, {
@@ -46,6 +48,7 @@ var _Distribution = function Distribution(_ref2) {
46
48
  }, children(value));
47
49
  }
48
50
  if (values.length > 1) {
51
+ var _theme$distribution, _theme$distribution2, _theme$distribution3;
49
52
  var reducer = function reducer(accumulator, _ref3) {
50
53
  var value = _ref3.value;
51
54
  return accumulator + (value || 0);
@@ -90,18 +93,18 @@ var _Distribution = function Distribution(_ref2) {
90
93
  basis: basis,
91
94
  flex: basis ? 'shrink' : true,
92
95
  overflow: "hidden",
93
- gap: gap,
96
+ gap: gap || ((_theme$distribution = theme.distribution) == null ? void 0 : _theme$distribution.gap),
94
97
  fill: fill
95
98
  }, rest), /*#__PURE__*/React.createElement(_Distribution, {
96
99
  values: values.slice(0, subIndex),
97
100
  basis: childBasis[0],
98
101
  direction: direction === 'row' ? 'column' : 'row',
99
- gap: gap
102
+ gap: gap || ((_theme$distribution2 = theme.distribution) == null ? void 0 : _theme$distribution2.gap)
100
103
  }, children), /*#__PURE__*/React.createElement(_Distribution, {
101
104
  values: values.slice(subIndex),
102
105
  basis: childBasis[1],
103
106
  direction: direction === 'row' ? 'column' : 'row',
104
- gap: gap
107
+ gap: gap || ((_theme$distribution3 = theme.distribution) == null ? void 0 : _theme$distribution3.gap)
105
108
  }, children));
106
109
  }
107
110
  return null;
@@ -5,7 +5,7 @@ import React, { forwardRef, useContext, useRef, useState } from 'react';
5
5
  import styled from 'styled-components';
6
6
  import { CircleAlert } from 'grommet-icons/icons/CircleAlert';
7
7
  import { MessageContext } from '../../contexts/MessageContext';
8
- import { disabledStyle, focusStyle, parseMetricToNum, unfocusStyle, useForwardedRef, useKeyboard } from '../../utils';
8
+ import { disabledStyle, focusStyle, unfocusStyle, useForwardedRef, useKeyboard } from '../../utils';
9
9
  import { Anchor } from '../Anchor';
10
10
  import { Box } from '../Box';
11
11
  import { Button } from '../Button';
@@ -56,6 +56,7 @@ var defaultPendingRemoval = {
56
56
  index: undefined
57
57
  };
58
58
  var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
59
+ var _theme$fileInput, _theme$fileInput$anch;
59
60
  var a11yTitle = _ref.a11yTitle,
60
61
  background = _ref.background,
61
62
  border = _ref.border,
@@ -101,6 +102,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
101
102
  var removeRef = useRef();
102
103
  var ConfirmRemove = confirmRemove;
103
104
  var RemoveIcon = theme.fileInput.icons.remove;
105
+ var ErrorIcon = ((_theme$fileInput = theme.fileInput) == null || (_theme$fileInput = _theme$fileInput.icons) == null ? void 0 : _theme$fileInput.error) || CircleAlert;
104
106
  var usingKeyboard = useKeyboard();
105
107
  var _formContext$useFormI = formContext.useFormInput({
106
108
  name: name,
@@ -166,36 +168,6 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
166
168
  } else result = _extends({}, result, dragOverThemeProp);
167
169
  return typeof result === 'object' && Object.keys(result).length === 0 ? undefined : result;
168
170
  };
169
- var rightPad;
170
- if (mergeTheme('pad')) {
171
- var _mergeTheme = mergeTheme('pad'),
172
- horizontal = _mergeTheme.horizontal,
173
- right = _mergeTheme.right;
174
- if (right) {
175
- rightPad = theme.global.edgeSize[right] || right;
176
- } else if (horizontal) {
177
- rightPad = theme.global.edgeSize[horizontal] || horizontal;
178
- }
179
- }
180
-
181
- // rightPad needs to be included in the rightOffset
182
- // otherwise input may cover the RemoveButton, making it
183
- // unreachable by mouse click.
184
- // If browse anchor or button is greater than remove button then
185
- // rightoffset will take the larger width
186
- var rightOffset;
187
- if (removeRef.current && controlRef.current) {
188
- var rightOffsetBrowse = controlRef.current.getBoundingClientRect().width;
189
- var rightOffsetRemove = removeRef.current.getBoundingClientRect().width;
190
- if (rightPad && typeof rightPad === 'string') rightOffset = rightOffsetRemove + parseMetricToNum(rightPad);
191
- if (files.length === 1 || files.length > aggregateThreshold) {
192
- rightOffset = rightOffsetBrowse + rightOffsetRemove + parseMetricToNum(theme.global.edgeSize.small) * 2;
193
- } else if (rightOffsetBrowse > rightOffsetRemove) {
194
- rightOffset = rightOffsetBrowse + parseMetricToNum(theme.global.edgeSize.small) * 2;
195
- } else rightOffset = rightOffsetRemove;
196
- } else if (!files.length && controlRef.current) {
197
- rightOffset = controlRef.current.getBoundingClientRect().width + parseMetricToNum(theme.global.edgeSize.small) * 2;
198
- }
199
171
 
200
172
  // Show the number of files when more than one
201
173
 
@@ -238,6 +210,40 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
238
210
  });
239
211
  inputRef.current.focus();
240
212
  };
213
+
214
+ // rightPad needs to be included in the rightOffset
215
+ // otherwise input may cover the RemoveButton, making it
216
+ // unreachable by mouse click.
217
+ var rightPad = '0px';
218
+ if (mergeTheme('pad')) {
219
+ var _mergeTheme = mergeTheme('pad'),
220
+ horizontal = _mergeTheme.horizontal,
221
+ right = _mergeTheme.right;
222
+ if (right) {
223
+ rightPad = theme.global.edgeSize[right] || right;
224
+ } else if (horizontal) {
225
+ rightPad = theme.global.edgeSize[horizontal] || horizontal;
226
+ }
227
+ }
228
+ var removeWidth = removeRef.current ? removeRef.current.getBoundingClientRect().width : 0;
229
+ var controlWidth = controlRef.current ? controlRef.current.getBoundingClientRect().width : 0;
230
+ if (controlRef.current && (_theme$fileInput$anch = theme.fileInput.anchor) != null && _theme$fileInput$anch.margin) {
231
+ if (typeof theme.fileInput.anchor.margin === 'string') {
232
+ controlWidth += parseInt(theme.global.edgeSize[theme.fileInput.anchor.margin] || theme.fileInput.anchor.margin, 10) * 2;
233
+ } else if (typeof theme.fileInput.anchor.margin === 'object') {
234
+ var _theme$fileInput$anch2, _theme$fileInput$anch3, _theme$fileInput$anch4;
235
+ if ((_theme$fileInput$anch2 = theme.fileInput.anchor.margin) != null && _theme$fileInput$anch2.horizontal) {
236
+ controlWidth += parseInt(theme.global.edgeSize[theme.fileInput.anchor.margin.horizontal] || theme.fileInput.anchor.margin.horizontal, 10) * 2;
237
+ }
238
+ if ((_theme$fileInput$anch3 = theme.fileInput.anchor.margin) != null && _theme$fileInput$anch3.right) {
239
+ controlWidth += parseInt(theme.global.edgeSize[theme.fileInput.anchor.margin.right] || theme.fileInput.anchor.margin.right, 10);
240
+ }
241
+ if ((_theme$fileInput$anch4 = theme.fileInput.anchor.margin) != null && _theme$fileInput$anch4.left) {
242
+ controlWidth += parseInt(theme.global.edgeSize[theme.fileInput.anchor.margin.left] || theme.fileInput.anchor.margin.left, 10);
243
+ }
244
+ }
245
+ }
246
+ var rightOffset = files.length > 1 ? removeWidth + parseInt(rightPad, 10) : removeWidth + controlWidth + parseInt(rightPad, 10);
241
247
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ContentsBox, _extends({
242
248
  theme: theme,
243
249
  flex: false,
@@ -270,7 +276,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
270
276
  "aria-invalid": maxSize && files.some(function (f) {
271
277
  return f.size > maxSize;
272
278
  }) || max != null && files.length > max,
273
- rightOffset: rightOffset
279
+ rightOffset: rightOffset || undefined
274
280
  }, passThemeFlag, rest, {
275
281
  onDragOver: function onDragOver() {
276
282
  return setDragOver(true);
@@ -341,7 +347,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
341
347
  alignSelf: "center",
342
348
  disabled: disabled,
343
349
  ref: controlRef,
344
- margin: "small",
350
+ margin: theme.fileInput.anchor.margin,
345
351
  onClick: function onClick() {
346
352
  inputRef.current.click();
347
353
  inputRef.current.focus();
@@ -409,7 +415,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
409
415
  alignSelf: "center",
410
416
  disabled: disabled,
411
417
  ref: controlRef,
412
- margin: "small",
418
+ margin: theme.fileInput.anchor.margin,
413
419
  onClick: function onClick() {
414
420
  inputRef.current.click();
415
421
  inputRef.current.focus();
@@ -431,10 +437,9 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
431
437
  direction: "row",
432
438
  align: "center"
433
439
  }, renderFile ? renderFile(file) : /*#__PURE__*/React.createElement(Box, _extends({}, theme.fileInput.label, {
434
- gap: "xsmall",
435
440
  align: "center",
436
441
  direction: "row"
437
- }), (typeof maxSize === 'number' && file.size > maxSize || typeof max === 'number' && index >= max) && /*#__PURE__*/React.createElement(CircleAlert, {
442
+ }), (typeof maxSize === 'number' && file.size > maxSize || typeof max === 'number' && index >= max) && /*#__PURE__*/React.createElement(ErrorIcon, {
438
443
  a11yTitle: format({
439
444
  id: messageId,
440
445
  messages: messages,
@@ -501,7 +506,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
501
506
  tabIndex: -1,
502
507
  disabled: disabled,
503
508
  ref: controlRef,
504
- margin: "small",
509
+ margin: theme.fileInput.anchor.margin,
505
510
  onClick: function onClick() {
506
511
  inputRef.current.click();
507
512
  inputRef.current.focus();
@@ -2,14 +2,18 @@ function _objectDestructuringEmpty(t) { if (null == t) throw new TypeError("Cann
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  import React from 'react';
4
4
  import { Box } from '../Box';
5
+ import { useThemeValue } from '../../utils/useThemeValue';
5
6
  var Footer = function Footer(_ref) {
7
+ var _theme$footer;
6
8
  var rest = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
9
+ var _useThemeValue = useThemeValue(),
10
+ theme = _useThemeValue.theme;
7
11
  return /*#__PURE__*/React.createElement(Box, _extends({
8
12
  as: "footer",
9
13
  align: "center",
10
14
  direction: "row",
11
15
  flex: false,
12
- gap: "medium",
16
+ gap: (_theme$footer = theme.footer) == null ? void 0 : _theme$footer.gap,
13
17
  justify: "between"
14
18
  }, rest));
15
19
  };
@@ -6,7 +6,7 @@ import { findScrollParent, useForwardedRef } from '../../utils';
6
6
  import { Box } from '../Box';
7
7
  import { useThemeValue } from '../../utils/useThemeValue';
8
8
  var Header = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
9
- var _theme$header2;
9
+ var _theme$header2, _theme$header3;
10
10
  var sticky = _ref.sticky,
11
11
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
12
12
  var _useThemeValue = useThemeValue(),
@@ -52,7 +52,7 @@ var Header = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
52
52
  direction: "row",
53
53
  flex: false,
54
54
  justify: "between",
55
- gap: "medium",
55
+ gap: (_theme$header3 = theme.header) == null ? void 0 : _theme$header3.gap,
56
56
  ref: headerRef
57
57
  }, rest));
58
58
  });
@@ -77,12 +77,17 @@ var Layer = /*#__PURE__*/forwardRef(function (props, ref) {
77
77
  }
78
78
  setTimeout(function () {
79
79
  // we add the id and query here so the unit tests work
80
- var clone = containerTarget.getRootNode().getElementById('layerClone');
81
- if (clone) {
82
- if (containerTarget.contains(clone)) {
83
- containerTarget.removeChild(clone);
80
+ var rootNode = containerTarget.getRootNode();
81
+ // Not all root nodes (ShadowRoot, DocumentFragment)
82
+ // have getElementById.
83
+ if (rootNode && typeof rootNode.getElementById === 'function') {
84
+ var clone = rootNode.getElementById('layerClone');
85
+ if (clone) {
86
+ if (containerTarget.contains(clone)) {
87
+ containerTarget.removeChild(clone);
88
+ }
89
+ layerContainer.remove();
84
90
  }
85
- layerContainer.remove();
86
91
  }
87
92
  }, animationDuration);
88
93
  } else if (containerTarget.contains(layerContainer)) {
@@ -1,6 +1,6 @@
1
1
  import styled, { css, keyframes } from 'styled-components';
2
2
  import isPropValid from '@emotion/is-prop-valid';
3
- import { baseStyle, backgroundStyle, breakpointStyle, parseMetricToNum, styledComponentsConfig } from '../../utils';
3
+ import { baseStyle, backgroundStyle, breakpointStyle, heightStyle, parseMetricToNum, styledComponentsConfig } from '../../utils';
4
4
  var hiddenPositionStyle = css(["left:-100%;right:100%;z-index:-1;position:fixed;"]);
5
5
  var desktopLayerStyle = "\n position: fixed;\n top: 0px;\n left: 0px;\n right: 0px;\n bottom: 0px;\n";
6
6
  var responsiveLayerStyle = "\n position: fixed;\n width: 100%;\n height: 100%;\n min-height: 100vh;\n";
@@ -445,10 +445,10 @@ var StyledContainer = styled.div.withConfig({
445
445
  }).withConfig({
446
446
  displayName: "StyledLayer__StyledContainer",
447
447
  componentId: "sc-rmtehz-2"
448
- })(["", " display:flex;flex-direction:column;min-height:", ";", " outline:none;pointer-events:all;z-index:", ";", " ", " ", ";", ";"], function (props) {
448
+ })(["", " display:flex;flex-direction:column;", " ", " outline:none;pointer-events:all;z-index:", ";", " ", " ", ";", ";"], function (props) {
449
449
  return !props.modal ? baseStyle : '';
450
450
  }, function (props) {
451
- return props.theme.global.size.xxsmall;
451
+ return heightStyle(props.theme.layer.container.height, props.theme);
452
452
  }, function (props) {
453
453
  return !props.plain && (props.background || props.theme.layer.background) && backgroundStyle(props.background || props.theme.layer.background, props.theme);
454
454
  }, function (props) {
@@ -364,6 +364,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
364
364
  key: "p"
365
365
  }, theme.list.primaryKey), primary) : primary;
366
366
  if (secondaryKey) {
367
+ var _theme$list;
367
368
  var secondary = getValue(item, index, secondaryKey);
368
369
  content = [content, typeof secondary === 'string' || typeof secondary === 'number' ? /*#__PURE__*/React.createElement(Text, {
369
370
  color: pinnedColor,
@@ -373,7 +374,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
373
374
  direction: 'row',
374
375
  align: 'center',
375
376
  justify: 'between',
376
- gap: 'medium'
377
+ gap: (_theme$list = theme.list) == null || (_theme$list = _theme$list.item) == null ? void 0 : _theme$list.gap
377
378
  };
378
379
  }
379
380
  } else if (typeof item === 'object') {
@@ -411,7 +412,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
411
412
  direction: 'row',
412
413
  align: secondaryKey ? 'start' : 'center',
413
414
  justify: 'between',
414
- gap: 'medium'
415
+ gap: theme.list.item.gap
415
416
  };
416
417
  }
417
418
  var adjustedBackground = background || theme.list.item.background;
@@ -564,7 +565,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
564
565
  boxProps = {
565
566
  direction: 'row',
566
567
  align: defaultItemProps && defaultItemProps.align || 'center',
567
- gap: 'medium'
568
+ gap: theme.list.item.gap
568
569
  };
569
570
  }
570
571
  var itemAriaProps;
@@ -597,7 +598,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
597
598
  boxProps = {
598
599
  direction: 'row',
599
600
  align: defaultItemProps && defaultItemProps.align || 'center',
600
- gap: 'medium'
601
+ gap: theme.list.item.gap
601
602
  };
602
603
  displayPinned = /*#__PURE__*/React.createElement(Box, {
603
604
  direction: "row",
@@ -433,7 +433,12 @@ var MaskedInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
433
433
  }, passThemeFlag), mask[activeMaskIndex].options.map(function (option, index) {
434
434
  // Determine whether the label is done as a child or
435
435
  // as an option Button kind property.
436
- var child = !theme.button.option ? /*#__PURE__*/React.createElement(Box, {
436
+ var child = !theme.button.option ?
437
+ /*#__PURE__*/
438
+ // Not adding a theme object now because this code path
439
+ // is not used in the HPE theme, but we may add theme
440
+ // support here in the future.
441
+ React.createElement(Box, {
437
442
  pad: {
438
443
  horizontal: 'small',
439
444
  vertical: 'xsmall'
@@ -221,6 +221,11 @@ var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
221
221
  if (children) {
222
222
  content = children;
223
223
  } else if (!theme.button["default"]) {
224
+ /*
225
+ Not adding a theme object now because this code path
226
+ is not used in the HPE theme, but we may add theme
227
+ support here in the future.
228
+ */
224
229
  content = /*#__PURE__*/React.createElement(Box, {
225
230
  direction: "row",
226
231
  justify: justifyContent,
@@ -274,7 +279,14 @@ var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
274
279
  var _theme$menu$item, _theme$menu$item2, _theme$menu$item3, _theme$menu$item4;
275
280
  // Determine whether the label is done as a child or
276
281
  // as an option Button kind property.
277
- var child = !theme.button.option ? /*#__PURE__*/React.createElement(Box, {
282
+ var child = !theme.button.option ?
283
+ /*#__PURE__*/
284
+ /*
285
+ Not adding a theme object now because this code path
286
+ is not used in the HPE theme, but we may add theme
287
+ support here in the future.
288
+ */
289
+ React.createElement(Box, {
278
290
  align: ((_theme$menu$item = theme.menu.item) == null ? void 0 : _theme$menu$item.align) || 'start',
279
291
  pad: "small",
280
292
  direction: "row",
@@ -5,9 +5,10 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
5
5
  import React, { forwardRef } from 'react';
6
6
  import { parseMetricToNum } from '../../utils';
7
7
  import { StyledMeter } from './StyledMeter';
8
- import { strokeProps, defaultColor } from './utils';
8
+ import { strokeProps, defaultColor, fillProps } from './utils';
9
9
  import { useThemeValue } from '../../utils/useThemeValue';
10
10
  var Bar = /*#__PURE__*/forwardRef(function (props, ref) {
11
+ var _theme$meter$gap, _theme$meter;
11
12
  var _props$background = props.background,
12
13
  background = _props$background === void 0 ? 'light-1' : _props$background,
13
14
  max = props.max,
@@ -23,13 +24,20 @@ var Bar = /*#__PURE__*/forwardRef(function (props, ref) {
23
24
  passThemeFlag = _useThemeValue.passThemeFlag;
24
25
  var length = size === 'full' ? 288 : parseMetricToNum(theme.global.size[size] || size);
25
26
  var thickness = parseMetricToNum(theme.global.edgeSize[thicknessProp] || thicknessProp);
27
+ var gapTheme = (_theme$meter$gap = (_theme$meter = theme.meter) == null ? void 0 : _theme$meter.gap) != null ? _theme$meter$gap : 0;
28
+ var gap = parseMetricToNum(theme.global.edgeSize[gapTheme] || gapTheme);
29
+
26
30
  // account for the round cap, if any
27
- var capOffset = round ? thickness / 2 : 0;
31
+ var capRadius = round ? thickness / 2 : 0;
28
32
  var mid = thickness / 2;
29
33
  var someHighlight = (values || []).some(function (v) {
30
34
  return v.highlight;
31
35
  });
32
- var start = direction === 'horizontal' ? capOffset : max * (length - 2 * capOffset) / max;
36
+ var start = direction === 'horizontal' ? capRadius : length - capRadius;
37
+
38
+ // Available space for the bar is the length of the meter minus an end cap
39
+ // on each end, minus the gap between bars.
40
+ var lengthAvailable = length - 2 * capRadius - gap * (values.length - 1);
33
41
  var paths = (values || []).reduce(function (acc, valueArg, index) {
34
42
  if (valueArg.value > 0) {
35
43
  var color = valueArg.color,
@@ -39,8 +47,22 @@ var Bar = /*#__PURE__*/forwardRef(function (props, ref) {
39
47
  value = valueArg.value,
40
48
  pathRest = _objectWithoutPropertiesLoose(valueArg, _excluded2);
41
49
  var key = "p-" + index;
42
- var delta = value * (length - 2 * capOffset) / max;
43
- var d = direction === 'horizontal' ? "M " + start + "," + mid + " L " + (start + delta) + "," + mid : "M " + mid + "," + start + " L " + mid + "," + (start - delta);
50
+ var delta = value * lengthAvailable / max;
51
+
52
+ // add a little bit extra to start to allow for larger rounded inset cap
53
+ // The extra needed can be calculated by the Pythagorean theorem
54
+ var extraGap = round && index !== 0 ? Math.sqrt(Math.pow(thickness / 2 + gap / 4, 2) - Math.pow(thickness / 2, 2)) : 0;
55
+ var initialStart = direction === 'horizontal' ? start + extraGap : start - extraGap;
56
+
57
+ // define the x,y points for the corners of the bar.
58
+ var points = direction === 'horizontal' ? [initialStart + "," + thickness, initialStart + ",0", start + delta + ",0", start + delta + "," + thickness] : [thickness + "," + initialStart, "0," + initialStart, "0," + (start - delta), thickness + "," + (start - delta)];
59
+
60
+ // if rounded, the starting cap is an arc. All but the first bar
61
+ // will have a gap and a slightly larger radius
62
+ var startRadius = index === 0 ? capRadius : capRadius + gap / 2;
63
+ var startCap = round ? "A " + startRadius + "," + startRadius + " 0 0 " + (index === 0 ? 1 : 0) + " " + points[1] : "L " + points[1];
64
+ var endCap = round ? "A " + capRadius + "," + capRadius + " 0 0 1 " + points[3] : "L " + points[3];
65
+ var d = "M " + points[0] + " " + startCap + " L " + points[2] + " " + endCap + " Z";
44
66
  var colorName = color || defaultColor(index, theme, values ? values.length : 0);
45
67
  var hoverProps;
46
68
  if (onHover) {
@@ -53,23 +75,22 @@ var Bar = /*#__PURE__*/forwardRef(function (props, ref) {
53
75
  }
54
76
  };
55
77
  }
78
+ var fill = fillProps(someHighlight && !highlight ? background : colorName, theme);
79
+ acc.push(/*#__PURE__*/React.createElement("path", _extends({
80
+ key: key,
81
+ d: d
82
+ }, fill, {
83
+ strokeWidth: 0,
84
+ stroke: "none"
85
+ }, hoverProps, pathRest)));
56
86
  if (direction === 'horizontal') {
57
- start += delta;
87
+ start += delta + gap;
58
88
  } else {
59
- start -= delta;
89
+ start -= delta + gap;
60
90
  }
61
- var result = /*#__PURE__*/React.createElement("path", _extends({
62
- key: key,
63
- d: d,
64
- fill: "none"
65
- }, strokeProps(someHighlight && !highlight ? background : colorName, theme), {
66
- strokeWidth: direction === 'horizontal' ? thickness : length,
67
- strokeLinecap: round ? 'round' : 'butt'
68
- }, hoverProps, pathRest));
69
- acc.push(result);
70
91
  }
71
92
  return acc;
72
- }, []).reverse(); // reverse so the caps looks right
93
+ }, []).reverse(); // reverse so the caps look right
73
94
 
74
95
  var width;
75
96
  if (direction === 'horizontal') {
@@ -77,7 +98,7 @@ var Bar = /*#__PURE__*/forwardRef(function (props, ref) {
77
98
  } else {
78
99
  width = size === 'full' ? '100%' : thickness;
79
100
  }
80
- var backgroundPath = direction === 'horizontal' ? "M " + capOffset + "," + mid + " L " + (length - capOffset) + "," + mid : "M " + mid + "," + capOffset + " L " + mid + "," + (length - capOffset);
101
+ var backgroundPath = direction === 'horizontal' ? "M " + capRadius + "," + mid + " L " + (length - capRadius) + "," + mid : "M " + mid + "," + capRadius + " L " + mid + "," + (length - capRadius);
81
102
  return /*#__PURE__*/React.createElement(StyledMeter, _extends({
82
103
  ref: ref,
83
104
  viewBox: direction === 'horizontal' ? "0 0 " + length + " " + thickness : "0 0 " + thickness + " " + length,