grommet 2.41.0 → 2.43.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 (175) hide show
  1. package/all/stories/Colors.js +6 -6
  2. package/components/Accordion/stories/CustomThemed/Rich.tsx +1 -1
  3. package/components/AccordionPanel/AccordionPanel.js +1 -7
  4. package/components/Box/Box.js +1 -1
  5. package/components/Box/StyledBox.js +1 -6
  6. package/components/Box/index.d.ts +1 -0
  7. package/components/Box/propTypes.js +1 -0
  8. package/components/Box/stories/Background.js +4 -10
  9. package/components/Button/Button.js +1 -0
  10. package/components/Button/StyledButton.js +3 -2
  11. package/components/Calendar/Calendar.js +96 -59
  12. package/components/Calendar/StyledCalendar.js +89 -7
  13. package/components/Calendar/utils.js +16 -2
  14. package/components/Card/stories/Simple.js +2 -2
  15. package/components/Carousel/Carousel.js +1 -1
  16. package/components/Chart/Chart.js +3 -3
  17. package/components/CheckBox/CheckBox.js +3 -2
  18. package/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
  19. package/components/Clock/Digital.js +1 -1
  20. package/components/Data/stories/Cards.js +3 -2
  21. package/components/Data/stories/Infinite.js +2 -2
  22. package/components/Data/stories/OnSelect.js +2 -2
  23. package/components/Data/stories/Properties.js +3 -2
  24. package/components/Data/stories/SpaceX.js +2 -2
  25. package/components/Data/stories/StarWars.js +1 -1
  26. package/components/DataFilter/DataFilter.js +1 -1
  27. package/components/DataSort/DataSort.js +46 -14
  28. package/components/DataSort/stories/Simple.js +10 -1
  29. package/components/DataTable/Body.js +14 -8
  30. package/components/DataTable/GroupedBody.js +3 -3
  31. package/components/DataTable/buildState.js +5 -1
  32. package/components/DataTable/stories/SpaceX.js +2 -2
  33. package/components/DataTable/stories/SpaceXUngrouped.js +1 -1
  34. package/components/FileInput/index.d.ts +2 -3
  35. package/components/FormField/FormField.js +9 -2
  36. package/components/FormField/stories/ThresholdValidation.js +5 -1
  37. package/components/Grommet/index.d.ts +19 -1
  38. package/components/Grommet/propTypes.js +18 -0
  39. package/components/Grommet/stories/Theme.js +1 -1
  40. package/components/Grommet/stories/Vars.js +2 -2
  41. package/components/Layer/Layer.js +1 -1
  42. package/components/Layer/index.d.ts +2 -0
  43. package/components/List/List.js +43 -13
  44. package/components/List/stories/RenderedList.js +1 -1
  45. package/components/Meter/Circle.js +2 -2
  46. package/components/Meter/Meter.js +36 -17
  47. package/components/Meter/index.d.ts +18 -0
  48. package/components/Meter/propTypes.js +18 -0
  49. package/components/Notification/Notification.js +18 -6
  50. package/components/Notification/index.d.ts +1 -0
  51. package/components/Notification/propTypes.js +1 -0
  52. package/components/Pagination/Pagination.js +4 -2
  53. package/components/Pagination/stories/CustomThemed/Custom.tsx +8 -2
  54. package/components/Pagination/stories/NumberEdgePages.js +2 -0
  55. package/components/Pagination/stories/NumberMiddlePages.js +2 -0
  56. package/components/Pagination/stories/Simple.js +4 -2
  57. package/components/Pagination/stories/Size.js +3 -0
  58. package/components/Pagination/stories/Steps.js +3 -0
  59. package/components/RadioButton/RadioButton.js +14 -3
  60. package/components/RadioButton/stories/Children.js +16 -3
  61. package/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  62. package/components/RadioButtonGroup/stories/Children.js +13 -1
  63. package/components/Select/Select.js +7 -3
  64. package/components/Select/SelectContainer.js +41 -34
  65. package/components/Select/index.d.ts +1 -1
  66. package/components/Select/utils.js +13 -2
  67. package/components/SelectMultiple/SelectMultiple.js +10 -0
  68. package/components/SelectMultiple/SelectMultipleContainer.js +28 -2
  69. package/components/SelectMultiple/SelectMultipleValue.js +14 -1
  70. package/components/SkipLinks/index.d.ts +1 -0
  71. package/components/SkipLinks/propTypes.js +1 -0
  72. package/components/Tab/Tab.js +1 -1
  73. package/components/Tabs/stories/Scrollable.js +2 -1
  74. package/components/Tag/Tag.js +11 -7
  75. package/components/TextInput/TextInput.js +7 -2
  76. package/components/ToggleGroup/StyledToggleGroup.js +12 -5
  77. package/components/ToggleGroup/ToggleGroup.js +21 -10
  78. package/components/WorldMap/WorldMap.js +1 -1
  79. package/es6/all/stories/Colors.js +6 -6
  80. package/es6/components/Accordion/stories/CustomThemed/Rich.tsx +1 -1
  81. package/es6/components/AccordionPanel/AccordionPanel.js +2 -9
  82. package/es6/components/Box/Box.js +1 -1
  83. package/es6/components/Box/StyledBox.js +1 -6
  84. package/es6/components/Box/index.d.ts +1 -0
  85. package/es6/components/Box/propTypes.js +1 -0
  86. package/es6/components/Box/stories/Background.js +4 -10
  87. package/es6/components/Button/Button.js +1 -0
  88. package/es6/components/Button/StyledButton.js +4 -3
  89. package/es6/components/Calendar/Calendar.js +95 -59
  90. package/es6/components/Calendar/StyledCalendar.js +90 -8
  91. package/es6/components/Calendar/utils.js +15 -1
  92. package/es6/components/Card/stories/Simple.js +3 -3
  93. package/es6/components/Carousel/Carousel.js +1 -1
  94. package/es6/components/Chart/Chart.js +3 -3
  95. package/es6/components/CheckBox/CheckBox.js +3 -2
  96. package/es6/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
  97. package/es6/components/Clock/Digital.js +1 -1
  98. package/es6/components/Data/stories/Cards.js +4 -3
  99. package/es6/components/Data/stories/Infinite.js +2 -2
  100. package/es6/components/Data/stories/OnSelect.js +2 -2
  101. package/es6/components/Data/stories/Properties.js +4 -3
  102. package/es6/components/Data/stories/SpaceX.js +2 -2
  103. package/es6/components/Data/stories/StarWars.js +1 -1
  104. package/es6/components/DataFilter/DataFilter.js +1 -1
  105. package/es6/components/DataSort/DataSort.js +46 -14
  106. package/es6/components/DataSort/stories/Simple.js +10 -1
  107. package/es6/components/DataTable/Body.js +14 -8
  108. package/es6/components/DataTable/GroupedBody.js +3 -3
  109. package/es6/components/DataTable/buildState.js +5 -1
  110. package/es6/components/DataTable/stories/SpaceX.js +2 -2
  111. package/es6/components/DataTable/stories/SpaceXUngrouped.js +1 -1
  112. package/es6/components/FileInput/index.d.ts +2 -3
  113. package/es6/components/FormField/FormField.js +10 -3
  114. package/es6/components/FormField/stories/ThresholdValidation.js +5 -1
  115. package/es6/components/Grommet/index.d.ts +19 -1
  116. package/es6/components/Grommet/propTypes.js +18 -0
  117. package/es6/components/Grommet/stories/Theme.js +1 -1
  118. package/es6/components/Grommet/stories/Vars.js +2 -2
  119. package/es6/components/Layer/Layer.js +1 -1
  120. package/es6/components/Layer/index.d.ts +2 -0
  121. package/es6/components/List/List.js +43 -13
  122. package/es6/components/List/stories/RenderedList.js +1 -1
  123. package/es6/components/Meter/Circle.js +2 -2
  124. package/es6/components/Meter/Meter.js +37 -18
  125. package/es6/components/Meter/index.d.ts +18 -0
  126. package/es6/components/Meter/propTypes.js +18 -0
  127. package/es6/components/Notification/Notification.js +18 -6
  128. package/es6/components/Notification/index.d.ts +1 -0
  129. package/es6/components/Notification/propTypes.js +1 -0
  130. package/es6/components/Pagination/Pagination.js +4 -2
  131. package/es6/components/Pagination/stories/CustomThemed/Custom.tsx +8 -2
  132. package/es6/components/Pagination/stories/NumberEdgePages.js +2 -0
  133. package/es6/components/Pagination/stories/NumberMiddlePages.js +2 -0
  134. package/es6/components/Pagination/stories/Simple.js +4 -2
  135. package/es6/components/Pagination/stories/Size.js +3 -0
  136. package/es6/components/Pagination/stories/Steps.js +3 -0
  137. package/es6/components/RadioButton/RadioButton.js +15 -4
  138. package/es6/components/RadioButton/stories/Children.js +16 -3
  139. package/es6/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  140. package/es6/components/RadioButtonGroup/stories/Children.js +12 -1
  141. package/es6/components/Select/Select.js +8 -4
  142. package/es6/components/Select/SelectContainer.js +41 -34
  143. package/es6/components/Select/index.d.ts +1 -1
  144. package/es6/components/Select/utils.js +15 -3
  145. package/es6/components/SelectMultiple/SelectMultiple.js +10 -0
  146. package/es6/components/SelectMultiple/SelectMultipleContainer.js +28 -2
  147. package/es6/components/SelectMultiple/SelectMultipleValue.js +14 -1
  148. package/es6/components/SkipLinks/index.d.ts +1 -0
  149. package/es6/components/SkipLinks/propTypes.js +1 -0
  150. package/es6/components/Tab/Tab.js +1 -1
  151. package/es6/components/Tabs/stories/Scrollable.js +2 -1
  152. package/es6/components/Tag/Tag.js +11 -7
  153. package/es6/components/TextInput/TextInput.js +7 -2
  154. package/es6/components/ToggleGroup/StyledToggleGroup.js +12 -5
  155. package/es6/components/ToggleGroup/ToggleGroup.js +22 -11
  156. package/es6/components/WorldMap/WorldMap.js +1 -1
  157. package/es6/languages/default.json +18 -0
  158. package/es6/themes/base.d.ts +204 -6
  159. package/es6/themes/base.js +165 -1
  160. package/es6/utils/background.js +1 -1
  161. package/es6/utils/index.js +2 -1
  162. package/es6/utils/styles.js +8 -0
  163. package/es6/utils/useId.js +17 -0
  164. package/grommet.min.js +1 -1
  165. package/grommet.min.js.map +1 -1
  166. package/languages/default.json +18 -0
  167. package/package.json +36 -36
  168. package/themes/base.d.ts +204 -6
  169. package/themes/base.js +165 -1
  170. package/utils/background.js +1 -1
  171. package/utils/index.js +6 -0
  172. package/utils/styles.js +9 -1
  173. package/utils/useId.js +22 -0
  174. package/components/CheckBox/stories/InsideButton.js +0 -38
  175. package/es6/components/CheckBox/stories/InsideButton.js +0 -32
@@ -122,6 +122,24 @@ if (process.env.NODE_ENV !== 'production') {
122
122
  openMenu: PropTypes.string,
123
123
  closeMenu: PropTypes.string
124
124
  }),
125
+ meter: PropTypes.shape({
126
+ bar: PropTypes.shape({
127
+ singular: PropTypes.string,
128
+ plural: PropTypes.string
129
+ }),
130
+ circle: PropTypes.shape({
131
+ singular: PropTypes.string,
132
+ plural: PropTypes.string
133
+ }),
134
+ pie: PropTypes.shape({
135
+ singular: PropTypes.string,
136
+ plural: PropTypes.string
137
+ }),
138
+ semicirlce: PropTypes.shape({
139
+ singular: PropTypes.string,
140
+ plural: PropTypes.string
141
+ })
142
+ }),
125
143
  rangeSelector: PropTypes.shape({
126
144
  lower: PropTypes.string,
127
145
  upper: PropTypes.string
@@ -4,7 +4,7 @@ import { Add } from "grommet-icons/es6/icons/Add";
4
4
  var customTheme = {
5
5
  global: {
6
6
  colors: {
7
- custom: '#cc6633'
7
+ custom: '#a35200'
8
8
  }
9
9
  }
10
10
  };
@@ -6,11 +6,11 @@ export var Vars = function Vars() {
6
6
  cssVars: true
7
7
  }, /*#__PURE__*/React.createElement(Box, {
8
8
  pad: "medium",
9
- background: "var(--accent-2)",
9
+ background: "var(--light-6)",
10
10
  gap: "medium"
11
11
  }, /*#__PURE__*/React.createElement(Box, null, "Checkout Grommet variables, you can find them in the StyledGrommet DOM."), /*#__PURE__*/React.createElement(Box, {
12
12
  "with": true
13
- }, "For example, the background color in this Box is using var(--accent-2)")));
13
+ }, "For example, the background color in this Box is using var(--light-6)")));
14
14
  };
15
15
  export default {
16
16
  title: 'Utilities/Grommet/Vars'
@@ -68,7 +68,7 @@ var Layer = /*#__PURE__*/forwardRef(function (props, ref) {
68
68
  }
69
69
  };
70
70
  }, [animate, animation, containerTarget, layerContainer, originalFocusedElement]);
71
- return layerContainer ? /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(LayerContainer, _extends({
71
+ return layerContainer ? /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement(LayerContainer, _extends({
72
72
  ref: ref
73
73
  }, props)), layerContainer) : null;
74
74
  });
@@ -14,6 +14,8 @@ export type LayerPositionType =
14
14
  | 'hidden'
15
15
  | 'left'
16
16
  | 'right'
17
+ | 'start'
18
+ | 'end'
17
19
  | 'top'
18
20
  | 'top-left'
19
21
  | 'top-right';
@@ -208,7 +208,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
208
208
  var draggingRef = useRef();
209
209
  var sendAnalytics = useAnalytics();
210
210
  var ariaProps = {
211
- role: onClickItem || onOrder ? 'listbox' : 'list'
211
+ role: onClickItem ? 'listbox' : 'list'
212
212
  };
213
213
  if (active >= 0) {
214
214
  var activeId;
@@ -258,22 +258,52 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
258
258
  return /*#__PURE__*/React.createElement(Container, containterProps, /*#__PURE__*/React.createElement(Keyboard, {
259
259
  onEnter: onSelectOption,
260
260
  onSpace: function onSpace(event) {
261
- event.preventDefault();
261
+ if (onClickItem || onOrder) {
262
+ event.preventDefault();
263
+ }
262
264
  onSelectOption(event);
263
265
  },
264
266
  onUp: function onUp(event) {
265
- event.preventDefault();
266
- if ((onClickItem || onOrder) && active) {
267
- var min = onOrder ? 1 : 0;
268
- updateActive(Math.max(active - 1, min));
267
+ if (onClickItem || onOrder) {
268
+ event.preventDefault();
269
+ if (active) {
270
+ var min = onOrder ? 1 : 0;
271
+ var activeElementIndex = Math.max(active - 1, min);
272
+ updateActive(activeElementIndex);
273
+
274
+ // Ensure the active item is in view
275
+ // setTimeout for activeElement to be updated
276
+ setTimeout(function () {
277
+ var _listRef$current;
278
+ // eslint-disable max-len
279
+ (_listRef$current = listRef.current) == null || (_listRef$current = _listRef$current.children[activeElementIndex]) == null || _listRef$current.scrollIntoView({
280
+ behavior: 'smooth',
281
+ block: 'nearest'
282
+ });
283
+ }, 0);
284
+ }
269
285
  }
270
286
  },
271
287
  onDown: function onDown(event) {
272
- event.preventDefault();
273
- if ((onClickItem || onOrder) && orderableData && orderableData.length) {
274
- var min = onOrder ? 1 : 0;
275
- var max = onOrder ? orderableData.length * 2 - 2 : data.length - 1;
276
- updateActive(active >= min ? Math.min(active + 1, max) : min);
288
+ if (onClickItem || onOrder) {
289
+ event.preventDefault();
290
+ if (orderableData && orderableData.length) {
291
+ var min = onOrder ? 1 : 0;
292
+ var max = onOrder ? orderableData.length * 2 - 2 : data.length - 1;
293
+ var activeElementIndex = active >= min ? Math.min(active + 1, max) : min;
294
+ updateActive(activeElementIndex);
295
+
296
+ // Ensure the active item is in view
297
+ // setTimeout for activeElement to be updated
298
+ setTimeout(function () {
299
+ var _listRef$current2;
300
+ // eslint-disable max-len
301
+ (_listRef$current2 = listRef.current) == null || (_listRef$current2 = _listRef$current2.children[activeElementIndex]) == null || _listRef$current2.scrollIntoView({
302
+ behavior: 'smooth',
303
+ block: 'nearest'
304
+ });
305
+ }, 0);
306
+ }
277
307
  }
278
308
  },
279
309
  onKeyDown: onKeyDown
@@ -315,7 +345,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
315
345
  var isPinned;
316
346
  if (Array.isArray(pinned) && pinned.length > 0 || Array.isArray(pinned == null ? void 0 : pinned.items) && (pinned == null || (_pinned$items2 = pinned.items) == null ? void 0 : _pinned$items2.length) > 0) {
317
347
  if (typeof item === 'object' && !itemKey) {
318
- console.error( // eslint-disable-next-line max-len
348
+ console.error(// eslint-disable-next-line max-len
319
349
  "Warning: Missing prop itemKey. Prop pin requires itemKey to be specified when data is of type 'object'.");
320
350
  }
321
351
  isPinned = Array.isArray(pinned) ? pinned == null ? void 0 : pinned.includes(key) : pinned.items.some(function (pinnedItem) {
@@ -367,7 +397,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
367
397
  var isDisabled;
368
398
  if (disabledItems) {
369
399
  if (typeof item === 'object' && !itemKey) {
370
- console.error( // eslint-disable-next-line max-len
400
+ console.error(// eslint-disable-next-line max-len
371
401
  "Warning: Missing prop itemKey. Prop disabled requires itemKey to be specified when data is of type 'object'.");
372
402
  }
373
403
  isDisabled = disabledItems == null ? void 0 : disabledItems.includes(key);
@@ -25,7 +25,7 @@ export var RenderedList = function RenderedList() {
25
25
  return /*#__PURE__*/React.createElement(Text, {
26
26
  key: item.location,
27
27
  size: "small",
28
- color: "dark-4"
28
+ color: "dark-2"
29
29
  }, item.location);
30
30
  },
31
31
  itemKey: function itemKey(item) {
@@ -69,7 +69,7 @@ var Circle = /*#__PURE__*/forwardRef(function (props, ref) {
69
69
  var stroke = strokeProps(someHighlight && !highlight ? background : colorName, theme);
70
70
  if (round) {
71
71
  var d1 = arcCommands(centerX, centerY, radius, startAngle, endAngle);
72
- paths.unshift( /*#__PURE__*/React.createElement("path", _extends({
72
+ paths.unshift(/*#__PURE__*/React.createElement("path", _extends({
73
73
  key: key,
74
74
  d: d1,
75
75
  fill: "none"
@@ -98,7 +98,7 @@ var Circle = /*#__PURE__*/forwardRef(function (props, ref) {
98
98
  pathCaps.unshift(pathCap);
99
99
  } else {
100
100
  var d = arcCommands(centerX, centerY, radius, startAngle, endAngle);
101
- paths.push( /*#__PURE__*/React.createElement("path", _extends({
101
+ paths.push(/*#__PURE__*/React.createElement("path", _extends({
102
102
  key: key,
103
103
  d: d,
104
104
  fill: "none"
@@ -1,23 +1,16 @@
1
- var _excluded = ["background", "color", "direction", "size", "thickness", "type", "reverse", "value", "values"];
1
+ var _excluded = ["aria-label", "background", "color", "direction", "max", "messages", "size", "thickness", "type", "reverse", "value", "values"];
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
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
4
- import React, { forwardRef, useMemo } from 'react';
4
+ import React, { forwardRef, useContext, useMemo } from 'react';
5
5
  import { Bar } from './Bar';
6
6
  import { Circle } from './Circle';
7
7
  import { MeterPropTypes } from './propTypes';
8
8
  import { useThemeValue } from '../../utils/useThemeValue';
9
- var deriveMax = function deriveMax(values) {
10
- var max = 100;
11
- if (values && values.length > 1) {
12
- max = 0;
13
- values.forEach(function (v) {
14
- max += v.value;
15
- });
16
- }
17
- return max;
18
- };
9
+ import { MessageContext } from '../../contexts/MessageContext';
19
10
  var Meter = /*#__PURE__*/forwardRef(function (_ref, ref) {
20
- var _ref$background = _ref.background,
11
+ var _messages$meter;
12
+ var ariaLabel = _ref['aria-label'],
13
+ _ref$background = _ref.background,
21
14
  background = _ref$background === void 0 ? {
22
15
  color: 'light-2',
23
16
  opacity: 'medium'
@@ -25,6 +18,8 @@ var Meter = /*#__PURE__*/forwardRef(function (_ref, ref) {
25
18
  color = _ref.color,
26
19
  _ref$direction = _ref.direction,
27
20
  direction = _ref$direction === void 0 ? 'horizontal' : _ref$direction,
21
+ maxProp = _ref.max,
22
+ messages = _ref.messages,
28
23
  _ref$size = _ref.size,
29
24
  size = _ref$size === void 0 ? 'medium' : _ref$size,
30
25
  _ref$thickness = _ref.thickness,
@@ -37,6 +32,8 @@ var Meter = /*#__PURE__*/forwardRef(function (_ref, ref) {
37
32
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
38
33
  var _useThemeValue = useThemeValue(),
39
34
  theme = _useThemeValue.theme;
35
+ var _useContext = useContext(MessageContext),
36
+ format = _useContext.format;
40
37
 
41
38
  // normalize values to an array of objects
42
39
  var values = useMemo(function () {
@@ -48,14 +45,35 @@ var Meter = /*#__PURE__*/forwardRef(function (_ref, ref) {
48
45
  return [];
49
46
  }, [color, value, valuesProp]);
50
47
  var reverse = direction === 'horizontal' && (theme.dir === 'rtl' || reverseProp) && !(theme.dir === 'rtl' && reverseProp);
51
- var memoizedMax = useMemo(function () {
52
- return deriveMax(values);
53
- }, [values]);
48
+ var max = useMemo(function () {
49
+ var maxValue = 100;
50
+ if ((values == null ? void 0 : values.length) > 1) {
51
+ maxValue = values.reduce(function (total, currentValue) {
52
+ return total + currentValue.value;
53
+ }, 0);
54
+ }
55
+ return maxProp || maxValue || 100;
56
+ }, [maxProp, values]);
57
+ var messageId = (values == null ? void 0 : values.length) === 1 ? 'singular' : 'plural';
58
+ var meterType = type || 'bar';
59
+ var meterAriaLabel = ariaLabel || format({
60
+ id: "meter." + meterType + "." + messageId,
61
+ messages: messages == null || (_messages$meter = messages.meter) == null ? void 0 : _messages$meter[meterType],
62
+ values: {
63
+ meterValue: value || values.map(function (item) {
64
+ var _item$value;
65
+ return (_item$value = item.value) != null ? _item$value : 0;
66
+ }).join(', ') || 0,
67
+ type: type,
68
+ max: max
69
+ }
70
+ });
54
71
  var content;
55
72
  if (type === 'bar') {
56
73
  content = /*#__PURE__*/React.createElement(Bar, _extends({
57
74
  ref: ref,
58
- max: memoizedMax,
75
+ "aria-label": meterAriaLabel,
76
+ max: max,
59
77
  values: values,
60
78
  size: size,
61
79
  thickness: thickness,
@@ -65,8 +83,9 @@ var Meter = /*#__PURE__*/forwardRef(function (_ref, ref) {
65
83
  }, rest));
66
84
  } else if (type === 'circle' || type === 'pie' || type === 'semicircle') {
67
85
  content = /*#__PURE__*/React.createElement(Circle, _extends({
86
+ "aria-label": meterAriaLabel,
68
87
  ref: ref,
69
- max: memoizedMax,
88
+ max: max,
70
89
  values: values,
71
90
  size: size,
72
91
  thickness: thickness,
@@ -16,6 +16,24 @@ export interface MeterProps {
16
16
  gridArea?: GridAreaType;
17
17
  margin?: MarginType;
18
18
  max?: number;
19
+ messages?: {
20
+ bar?: {
21
+ singular?: string;
22
+ plural?: string;
23
+ };
24
+ circle?: {
25
+ singular?: string;
26
+ plural?: string;
27
+ };
28
+ pie?: {
29
+ singular?: string;
30
+ plural?: string;
31
+ };
32
+ semicircle?: {
33
+ singular?: string;
34
+ plural?: string;
35
+ };
36
+ };
19
37
  reverse?: boolean;
20
38
  round?: boolean;
21
39
  size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'full' | string;
@@ -10,6 +10,24 @@ if (process.env.NODE_ENV !== 'production') {
10
10
  })]),
11
11
  color: PropTypes.string,
12
12
  max: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
13
+ messages: PropTypes.shape({
14
+ bar: PropTypes.shape({
15
+ singular: PropTypes.string,
16
+ plural: PropTypes.string
17
+ }),
18
+ circle: PropTypes.shape({
19
+ singular: PropTypes.string,
20
+ plural: PropTypes.string
21
+ }),
22
+ pie: PropTypes.shape({
23
+ singular: PropTypes.string,
24
+ plural: PropTypes.string
25
+ }),
26
+ semicirlce: PropTypes.shape({
27
+ singular: PropTypes.string,
28
+ plural: PropTypes.string
29
+ })
30
+ }),
13
31
  reverse: PropTypes.bool,
14
32
  round: PropTypes.bool,
15
33
  size: PropTypes.oneOfType([PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'full']), PropTypes.string]),
@@ -45,12 +45,18 @@ var adaptThemeStyle = function adaptThemeStyle(value, theme) {
45
45
  }
46
46
  return [textStyle, closeButtonStyle];
47
47
  };
48
+ var getTextColor = function getTextColor(part, status, kind, theme) {
49
+ var _theme$notification, _theme$notification2, _theme$notification3, _theme$notification4, _theme$notification5;
50
+ var color;
51
+ if ((_theme$notification = theme.notification) != null && (_theme$notification = _theme$notification[status]) != null && (_theme$notification = _theme$notification[kind]) != null && (_theme$notification = _theme$notification[part]) != null && _theme$notification.color) color = (_theme$notification2 = theme.notification) == null || (_theme$notification2 = _theme$notification2[status]) == null || (_theme$notification2 = _theme$notification2[kind]) == null || (_theme$notification2 = _theme$notification2[part]) == null ? void 0 : _theme$notification2.color;else if ((_theme$notification3 = theme.notification) != null && (_theme$notification3 = _theme$notification3[status]) != null && (_theme$notification3 = _theme$notification3[part]) != null && _theme$notification3.color) color = (_theme$notification4 = theme.notification) == null || (_theme$notification4 = _theme$notification4[status]) == null || (_theme$notification4 = _theme$notification4[part]) == null ? void 0 : _theme$notification4.color;else color = (_theme$notification5 = theme.notification) == null || (_theme$notification5 = _theme$notification5[part]) == null ? void 0 : _theme$notification5.color;
52
+ return color;
53
+ };
48
54
  var NotificationAnchor = styled(Anchor).withConfig({
49
55
  displayName: "Notification__NotificationAnchor",
50
56
  componentId: "sc-1yq09yz-0"
51
57
  })(["white-space:nowrap;"]);
52
58
  var Notification = function Notification(_ref) {
53
- var _theme$notification, _theme$notification2, _theme$notification3, _theme$notification4, _theme$notification5;
59
+ var _theme$notification6, _theme$notification7, _theme$notification8, _theme$notification9, _theme$notification10;
54
60
  var actionsProp = _ref.actions,
55
61
  messageProp = _ref.message,
56
62
  onClose = _ref.onClose,
@@ -87,7 +93,7 @@ var Notification = function Notification(_ref) {
87
93
  return undefined;
88
94
  }, [autoClose, close, theme.notification.toast.time, theme.notification.time, time]);
89
95
  var CloseIcon = theme.notification.close.icon;
90
- var _ref2 = ((_theme$notification = theme.notification) == null ? void 0 : _theme$notification[status]) || theme.notification.unknown,
96
+ var _ref2 = ((_theme$notification6 = theme.notification) == null ? void 0 : _theme$notification6[status]) || theme.notification.unknown,
91
97
  StatusIcon = _ref2.icon,
92
98
  color = _ref2.color;
93
99
  var closeIconColor = theme.notification.close.color;
@@ -99,7 +105,7 @@ var Notification = function Notification(_ref) {
99
105
  var direction;
100
106
  if (kind && theme.notification[kind].direction) direction = theme.notification[kind].direction;else direction = theme.notification.direction;
101
107
  var background;
102
- if (kind && (_theme$notification2 = theme.notification) != null && (_theme$notification2 = _theme$notification2[status]) != null && (_theme$notification2 = _theme$notification2[kind]) != null && _theme$notification2.background) background = theme.notification[status][kind].background;else if ((_theme$notification3 = theme.notification) != null && (_theme$notification3 = _theme$notification3[status]) != null && _theme$notification3.background) background = theme.notification[status].background;else background = ((_theme$notification4 = theme.notification) == null || (_theme$notification4 = _theme$notification4[kind]) == null || (_theme$notification4 = _theme$notification4.container) == null ? void 0 : _theme$notification4.background) || theme.notification.container.background;
108
+ if (kind && (_theme$notification7 = theme.notification) != null && (_theme$notification7 = _theme$notification7[status]) != null && (_theme$notification7 = _theme$notification7[kind]) != null && _theme$notification7.background) background = theme.notification[status][kind].background;else if ((_theme$notification8 = theme.notification) != null && (_theme$notification8 = _theme$notification8[status]) != null && _theme$notification8.background) background = theme.notification[status].background;else background = ((_theme$notification9 = theme.notification) == null || (_theme$notification9 = _theme$notification9[kind]) == null || (_theme$notification9 = _theme$notification9.container) == null ? void 0 : _theme$notification9.background) || theme.notification.container.background;
103
109
  var TextWrapper = direction === 'row' ? Text : Fragment;
104
110
 
105
111
  // notification is built with two child boxes that contain:
@@ -118,6 +124,8 @@ var Notification = function Notification(_ref) {
118
124
  } else textPad = pad;
119
125
  var actions;
120
126
  var message = messageProp;
127
+ var messageColor = getTextColor('message', status, kind, theme);
128
+ var titleColor = getTextColor('title', status, kind, theme);
121
129
  if (actionsProp) actions = actionsProp.map(function (action) {
122
130
  return /*#__PURE__*/React.createElement(Fragment, {
123
131
  key: action.label
@@ -131,12 +139,14 @@ var Notification = function Notification(_ref) {
131
139
  }, action, theme.notification.actions)), ' ');
132
140
  });
133
141
  var Message = direction !== 'row' ? Paragraph : Text;
134
- if (message || actions) message = typeof message === 'string' ? /*#__PURE__*/React.createElement(Message, theme.notification.message, /*#__PURE__*/React.createElement(Text, {
142
+ if (message || actions) message = typeof message === 'string' ? /*#__PURE__*/React.createElement(Message, _extends({}, theme.notification.message, {
143
+ color: messageColor
144
+ }), /*#__PURE__*/React.createElement(Text, {
135
145
  margin: {
136
146
  right: 'xsmall'
137
147
  }
138
148
  }, message), actions) : message;
139
- var iconDimension = ((_theme$notification5 = theme.notification) == null || (_theme$notification5 = _theme$notification5.message) == null ? void 0 : _theme$notification5.size) || 'medium';
149
+ var iconDimension = ((_theme$notification10 = theme.notification) == null || (_theme$notification10 = _theme$notification10.message) == null ? void 0 : _theme$notification10.size) || 'medium';
140
150
  var content = /*#__PURE__*/React.createElement(Box, _extends({}, theme.notification.container, global ? _extends({}, theme.notification.global.container) : {}, toast ? _extends({}, theme.notification.toast.container) : {}, {
141
151
  background: background
142
152
  // let internal box control pad
@@ -152,7 +162,9 @@ var Notification = function Notification(_ref) {
152
162
  }, /*#__PURE__*/React.createElement(Box, theme.notification.iconContainer, icon || /*#__PURE__*/React.createElement(StatusIcon, {
153
163
  color: color,
154
164
  height: iconDimension
155
- })), /*#__PURE__*/React.createElement(Box, theme.notification.textContainer, /*#__PURE__*/React.createElement(TextWrapper, null, title && /*#__PURE__*/React.createElement(Text, theme.notification.title, title), message && title && direction === 'row' && /*#__PURE__*/React.createElement(React.Fragment, null, "\xA0"), message))), onClose &&
165
+ })), /*#__PURE__*/React.createElement(Box, theme.notification.textContainer, /*#__PURE__*/React.createElement(TextWrapper, null, title && /*#__PURE__*/React.createElement(Text, _extends({}, theme.notification.title, {
166
+ color: titleColor
167
+ }), title), message && title && direction === 'row' && /*#__PURE__*/React.createElement(React.Fragment, null, "\xA0"), message))), onClose &&
156
168
  /*#__PURE__*/
157
169
  // theme.notification.container and textContainer may both have pad,
158
170
  // account for both
@@ -4,6 +4,7 @@ import { AnchorType } from '..';
4
4
  export type StatusType = 'critical' | 'warning' | 'normal' | 'info' | 'unknown';
5
5
 
6
6
  export interface NotificationProps {
7
+ id?: string;
7
8
  actions?: AnchorType[];
8
9
  global?: boolean;
9
10
  title?: string;
@@ -3,6 +3,7 @@ import { AnchorPropTypes } from '../Anchor/propTypes';
3
3
  var PropType = {};
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  PropType = {
6
+ id: PropTypes.string,
6
7
  actions: PropTypes.arrayOf(PropTypes.shape(AnchorPropTypes)),
7
8
  global: PropTypes.bool,
8
9
  title: PropTypes.string,
@@ -82,7 +82,7 @@ var Pagination = /*#__PURE__*/forwardRef(function (_ref, ref) {
82
82
  var numberMiddlePages;
83
83
  if (numberMiddlePagesProp < 1) {
84
84
  numberMiddlePages = 1;
85
- console.warn( // eslint-disable-next-line max-len
85
+ console.warn(// eslint-disable-next-line max-len
86
86
  "Property \"numberMiddlePages\" should not be < 1. One middle page button will be shown. Set \"numberMiddlePages\" >= 1 to remove this warning.");
87
87
  } else numberMiddlePages = numberMiddlePagesProp;
88
88
  var startingMiddlePages;
@@ -181,7 +181,9 @@ var Pagination = /*#__PURE__*/forwardRef(function (_ref, ref) {
181
181
  ref: ref
182
182
  }, /*#__PURE__*/React.createElement(Box, _extends({
183
183
  as: "ul"
184
- }, theme.pagination.controls), controls.map(function (control, index) {
184
+ }, theme.pagination.controls, {
185
+ cssGap: true
186
+ }), controls.map(function (control, index) {
185
187
  return (
186
188
  /*#__PURE__*/
187
189
  /* Using index as key (as opposed to a unique id) seems to
@@ -52,7 +52,10 @@ export const Custom = () => (
52
52
  <Text margin={{ bottom: 'small' }}>
53
53
  Custom Theme via theme.pagination.button
54
54
  </Text>
55
- <Pagination numberItems={237} />
55
+ <Pagination
56
+ aria-label="Pagination with custom button theme"
57
+ numberItems={237}
58
+ />
56
59
  </Box>
57
60
  <Box
58
61
  align="start"
@@ -62,7 +65,10 @@ export const Custom = () => (
62
65
  <Text margin={{ bottom: 'small' }}>
63
66
  Custom Theme via theme.pagination.button
64
67
  </Text>
65
- <Pagination numberItems={237} />
68
+ <Pagination
69
+ aria-label="Pagination with custom button theme and black background"
70
+ numberItems={237}
71
+ />
66
72
  </Box>
67
73
  </Box>
68
74
  </Grommet>
@@ -9,10 +9,12 @@ export var NumberEdgePages = function NumberEdgePages() {
9
9
  pad: "small",
10
10
  gap: "medium"
11
11
  }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, null, "numberEdgePages = 2 (number of pages on start/end)"), /*#__PURE__*/React.createElement(Pagination, {
12
+ "aria-label": "Pagination with 2 pages at the start and end",
12
13
  numberItems: 237,
13
14
  page: 10,
14
15
  numberEdgePages: 2
15
16
  })), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, null, "numberEdgePages = 0"), /*#__PURE__*/React.createElement(Pagination, {
17
+ "aria-label": "Pagination with no pages at the start and end",
16
18
  numberItems: 237,
17
19
  page: 10,
18
20
  numberEdgePages: 0
@@ -9,10 +9,12 @@ export var NumberMiddlePages = function NumberMiddlePages() {
9
9
  pad: "small",
10
10
  gap: "medium"
11
11
  }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, null, "numberMiddlePages = 4 (number of pages in the middle)"), /*#__PURE__*/React.createElement(Pagination, {
12
+ "aria-label": "Pagination with 4 pages in the middle",
12
13
  numberItems: 237,
13
14
  page: 10,
14
15
  numberMiddlePages: 4
15
16
  })), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, null, "numberMiddlePages = 5 (number of pages in the middle)"), /*#__PURE__*/React.createElement(Pagination, {
17
+ "aria-label": "Pagination with 5 pages in the middle",
16
18
  numberItems: 237,
17
19
  page: 10,
18
20
  numberMiddlePages: 5
@@ -10,13 +10,15 @@ export var Simple = function Simple() {
10
10
  pad: "small",
11
11
  gap: "medium"
12
12
  }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, null, "Default"), /*#__PURE__*/React.createElement(Pagination, {
13
+ "aria-label": "Pagination with default settings",
13
14
  numberItems: 237
14
15
  })), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, null, "Box Props"), /*#__PURE__*/React.createElement(Pagination, {
15
16
  numberItems: 1237,
16
17
  page: 24,
17
- background: "brand",
18
+ background: "dark-1",
18
19
  pad: "medium",
19
- margin: "small"
20
+ margin: "small",
21
+ "aria-label": "Pagination with custom background and spacing"
20
22
  })))
21
23
  // </Grommet>
22
24
  );
@@ -10,12 +10,15 @@ export var Size = function Size() {
10
10
  pad: "small",
11
11
  gap: "medium"
12
12
  }, /*#__PURE__*/React.createElement(Text, null, "Small"), /*#__PURE__*/React.createElement(Pagination, {
13
+ "aria-label": "Pagination with small size",
13
14
  numberItems: 237,
14
15
  size: "small"
15
16
  }), /*#__PURE__*/React.createElement(Text, null, "Medium (Default)"), /*#__PURE__*/React.createElement(Pagination, {
17
+ "aria-label": "Pagination with medium size",
16
18
  numberItems: 237,
17
19
  size: "medium"
18
20
  }), /*#__PURE__*/React.createElement(Text, null, "Large"), /*#__PURE__*/React.createElement(Pagination, {
21
+ "aria-label": "Pagination with large size",
19
22
  numberItems: 237,
20
23
  size: "large"
21
24
  }))
@@ -12,17 +12,20 @@ export var Steps = function Steps() {
12
12
  }, /*#__PURE__*/React.createElement(Box, {
13
13
  fill: "horizontal"
14
14
  }, /*#__PURE__*/React.createElement(Text, null, "Pagination with stepOptions"), /*#__PURE__*/React.createElement(Pagination, {
15
+ "aria-label": "Pagination with step options to change items per page",
15
16
  numberItems: 237,
16
17
  stepOptions: true
17
18
  })), /*#__PURE__*/React.createElement(Box, {
18
19
  fill: "horizontal"
19
20
  }, /*#__PURE__*/React.createElement(Text, null, "Pagination with stepOptions and summary"), /*#__PURE__*/React.createElement(Pagination, {
21
+ "aria-label": "Pagination with step options and summary of items per page",
20
22
  numberItems: 237,
21
23
  stepOptions: true,
22
24
  summary: true
23
25
  })), /*#__PURE__*/React.createElement(Box, {
24
26
  fill: "horizontal"
25
27
  }, /*#__PURE__*/React.createElement(Text, null, "Pagination with custom step sizes"), /*#__PURE__*/React.createElement(Pagination, {
28
+ "aria-label": "Pagination with custom step sizes and summary",
26
29
  numberItems: 237,
27
30
  stepOptions: [10, 20, 30, 1000],
28
31
  summary: true
@@ -2,7 +2,7 @@ var _excluded = ["a11yTitle", "checked", "children", "disabled", "focus", "focus
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
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
4
4
  import React, { forwardRef, useState } from 'react';
5
- import { normalizeColor, removeUndefined } from '../../utils';
5
+ import { normalizeColor, removeUndefined, useKeyboard } from '../../utils';
6
6
  import { StyledRadioButton, StyledRadioButtonContainer, StyledRadioButtonIcon, StyledRadioButtonInput, StyledRadioButtonLabel, StyledRadioButtonBox } from './StyledRadioButton';
7
7
  import { RadioButtonPropTypes } from './propTypes';
8
8
  import { useThemeValue } from '../../utils/useThemeValue';
@@ -12,8 +12,9 @@ var RadioButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
12
12
  checked = _ref.checked,
13
13
  children = _ref.children,
14
14
  disabled = _ref.disabled,
15
- focus = _ref.focus,
16
- focusIndicator = _ref.focusIndicator,
15
+ focusProp = _ref.focus,
16
+ _ref$focusIndicator = _ref.focusIndicator,
17
+ focusIndicator = _ref$focusIndicator === void 0 ? true : _ref$focusIndicator,
17
18
  id = _ref.id,
18
19
  label = _ref.label,
19
20
  name = _ref.name,
@@ -25,6 +26,10 @@ var RadioButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
25
26
  var _useState = useState(),
26
27
  hover = _useState[0],
27
28
  setHover = _useState[1];
29
+ var _useState2 = useState(focusProp),
30
+ focus = _useState2[0],
31
+ setFocus = _useState2[1];
32
+ var usingKeyboard = useKeyboard();
28
33
  var normalizedLabel = typeof label === 'string' ? /*#__PURE__*/React.createElement(StyledRadioButtonLabel, passThemeFlag, label) : label;
29
34
  var Icon = theme.radioButton.icons.circle;
30
35
  var borderColor = normalizeColor(theme.radioButton.border.color, theme);
@@ -49,6 +54,12 @@ var RadioButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
49
54
  },
50
55
  focus: focus,
51
56
  focusIndicator: focusIndicator,
57
+ onFocus: function onFocus() {
58
+ return setFocus(true);
59
+ },
60
+ onBlur: function onBlur() {
61
+ return setFocus(false);
62
+ },
52
63
  onMouseEnter: function onMouseEnter() {
53
64
  return setHover(true);
54
65
  },
@@ -76,7 +87,7 @@ var RadioButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
76
87
  focus: focus && focusIndicator,
77
88
  hover: hover
78
89
  }) : /*#__PURE__*/React.createElement(StyledRadioButtonBox, _extends({
79
- focus: focus && focusIndicator,
90
+ focus: focus && focusIndicator && usingKeyboard,
80
91
  align: "center",
81
92
  justify: "center",
82
93
  width: theme.radioButton.size,