grommet 2.42.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 (67) hide show
  1. package/all/stories/Colors.js +6 -6
  2. package/components/Accordion/stories/CustomThemed/Rich.tsx +1 -1
  3. package/components/Box/stories/Background.js +4 -10
  4. package/components/Calendar/Calendar.js +6 -3
  5. package/components/Card/stories/Simple.js +2 -2
  6. package/components/Data/stories/Cards.js +3 -2
  7. package/components/Data/stories/Properties.js +3 -2
  8. package/components/FormField/FormField.js +9 -2
  9. package/components/FormField/stories/ThresholdValidation.js +5 -1
  10. package/components/Grommet/index.d.ts +19 -1
  11. package/components/Grommet/propTypes.js +18 -0
  12. package/components/Grommet/stories/Theme.js +1 -1
  13. package/components/Grommet/stories/Vars.js +2 -2
  14. package/components/List/List.js +27 -3
  15. package/components/List/stories/RenderedList.js +1 -1
  16. package/components/Meter/Meter.js +36 -17
  17. package/components/Meter/index.d.ts +18 -0
  18. package/components/Meter/propTypes.js +18 -0
  19. package/components/Pagination/stories/CustomThemed/Custom.tsx +8 -2
  20. package/components/Pagination/stories/NumberEdgePages.js +2 -0
  21. package/components/Pagination/stories/NumberMiddlePages.js +2 -0
  22. package/components/Pagination/stories/Simple.js +4 -2
  23. package/components/Pagination/stories/Size.js +3 -0
  24. package/components/Pagination/stories/Steps.js +3 -0
  25. package/components/RadioButton/RadioButton.js +14 -3
  26. package/components/RadioButton/stories/Children.js +16 -3
  27. package/components/RadioButtonGroup/stories/Children.js +13 -1
  28. package/components/Tabs/stories/Scrollable.js +2 -1
  29. package/components/TextInput/TextInput.js +7 -2
  30. package/es6/all/stories/Colors.js +6 -6
  31. package/es6/components/Accordion/stories/CustomThemed/Rich.tsx +1 -1
  32. package/es6/components/Box/stories/Background.js +4 -10
  33. package/es6/components/Calendar/Calendar.js +6 -3
  34. package/es6/components/Card/stories/Simple.js +3 -3
  35. package/es6/components/Data/stories/Cards.js +4 -3
  36. package/es6/components/Data/stories/Properties.js +4 -3
  37. package/es6/components/FormField/FormField.js +10 -3
  38. package/es6/components/FormField/stories/ThresholdValidation.js +5 -1
  39. package/es6/components/Grommet/index.d.ts +19 -1
  40. package/es6/components/Grommet/propTypes.js +18 -0
  41. package/es6/components/Grommet/stories/Theme.js +1 -1
  42. package/es6/components/Grommet/stories/Vars.js +2 -2
  43. package/es6/components/List/List.js +27 -3
  44. package/es6/components/List/stories/RenderedList.js +1 -1
  45. package/es6/components/Meter/Meter.js +37 -18
  46. package/es6/components/Meter/index.d.ts +18 -0
  47. package/es6/components/Meter/propTypes.js +18 -0
  48. package/es6/components/Pagination/stories/CustomThemed/Custom.tsx +8 -2
  49. package/es6/components/Pagination/stories/NumberEdgePages.js +2 -0
  50. package/es6/components/Pagination/stories/NumberMiddlePages.js +2 -0
  51. package/es6/components/Pagination/stories/Simple.js +4 -2
  52. package/es6/components/Pagination/stories/Size.js +3 -0
  53. package/es6/components/Pagination/stories/Steps.js +3 -0
  54. package/es6/components/RadioButton/RadioButton.js +15 -4
  55. package/es6/components/RadioButton/stories/Children.js +16 -3
  56. package/es6/components/RadioButtonGroup/stories/Children.js +12 -1
  57. package/es6/components/Tabs/stories/Scrollable.js +2 -1
  58. package/es6/components/TextInput/TextInput.js +7 -2
  59. package/es6/languages/default.json +18 -0
  60. package/es6/utils/useId.js +3 -2
  61. package/grommet.min.js +1 -1
  62. package/grommet.min.js.map +1 -1
  63. package/languages/default.json +18 -0
  64. package/package.json +26 -26
  65. package/utils/useId.js +5 -2
  66. package/components/CheckBox/stories/InsideButton.js +0 -38
  67. package/es6/components/CheckBox/stories/InsideButton.js +0 -32
@@ -17,17 +17,20 @@ var Steps = exports.Steps = function Steps() {
17
17
  }, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
18
18
  fill: "horizontal"
19
19
  }, /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "Pagination with stepOptions"), /*#__PURE__*/_react["default"].createElement(_grommet.Pagination, {
20
+ "aria-label": "Pagination with step options to change items per page",
20
21
  numberItems: 237,
21
22
  stepOptions: true
22
23
  })), /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
23
24
  fill: "horizontal"
24
25
  }, /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "Pagination with stepOptions and summary"), /*#__PURE__*/_react["default"].createElement(_grommet.Pagination, {
26
+ "aria-label": "Pagination with step options and summary of items per page",
25
27
  numberItems: 237,
26
28
  stepOptions: true,
27
29
  summary: true
28
30
  })), /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
29
31
  fill: "horizontal"
30
32
  }, /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "Pagination with custom step sizes"), /*#__PURE__*/_react["default"].createElement(_grommet.Pagination, {
33
+ "aria-label": "Pagination with custom step sizes and summary",
31
34
  numberItems: 237,
32
35
  stepOptions: [10, 20, 30, 1000],
33
36
  summary: true
@@ -18,8 +18,9 @@ var RadioButton = exports.RadioButton = /*#__PURE__*/(0, _react.forwardRef)(func
18
18
  checked = _ref.checked,
19
19
  children = _ref.children,
20
20
  disabled = _ref.disabled,
21
- focus = _ref.focus,
22
- focusIndicator = _ref.focusIndicator,
21
+ focusProp = _ref.focus,
22
+ _ref$focusIndicator = _ref.focusIndicator,
23
+ focusIndicator = _ref$focusIndicator === void 0 ? true : _ref$focusIndicator,
23
24
  id = _ref.id,
24
25
  label = _ref.label,
25
26
  name = _ref.name,
@@ -31,6 +32,10 @@ var RadioButton = exports.RadioButton = /*#__PURE__*/(0, _react.forwardRef)(func
31
32
  var _useState = (0, _react.useState)(),
32
33
  hover = _useState[0],
33
34
  setHover = _useState[1];
35
+ var _useState2 = (0, _react.useState)(focusProp),
36
+ focus = _useState2[0],
37
+ setFocus = _useState2[1];
38
+ var usingKeyboard = (0, _utils.useKeyboard)();
34
39
  var normalizedLabel = typeof label === 'string' ? /*#__PURE__*/_react["default"].createElement(_StyledRadioButton.StyledRadioButtonLabel, passThemeFlag, label) : label;
35
40
  var Icon = theme.radioButton.icons.circle;
36
41
  var borderColor = (0, _utils.normalizeColor)(theme.radioButton.border.color, theme);
@@ -55,6 +60,12 @@ var RadioButton = exports.RadioButton = /*#__PURE__*/(0, _react.forwardRef)(func
55
60
  },
56
61
  focus: focus,
57
62
  focusIndicator: focusIndicator,
63
+ onFocus: function onFocus() {
64
+ return setFocus(true);
65
+ },
66
+ onBlur: function onBlur() {
67
+ return setFocus(false);
68
+ },
58
69
  onMouseEnter: function onMouseEnter() {
59
70
  return setHover(true);
60
71
  },
@@ -82,7 +93,7 @@ var RadioButton = exports.RadioButton = /*#__PURE__*/(0, _react.forwardRef)(func
82
93
  focus: focus && focusIndicator,
83
94
  hover: hover
84
95
  }) : /*#__PURE__*/_react["default"].createElement(_StyledRadioButton.StyledRadioButtonBox, _extends({
85
- focus: focus && focusIndicator,
96
+ focus: focus && focusIndicator && usingKeyboard,
86
97
  align: "center",
87
98
  justify: "center",
88
99
  width: theme.radioButton.size,
@@ -5,11 +5,20 @@ exports["default"] = exports.Children = void 0;
5
5
  var _react = _interopRequireDefault(require("react"));
6
6
  var _grommet = require("grommet");
7
7
  var _grommetIcons = require("grommet-icons");
8
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
9
+ var _utils = require("grommet/utils");
8
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
11
+ var StyledRadioChild = (0, _styledComponents["default"])(_grommet.Box).withConfig({
12
+ displayName: "Children__StyledRadioChild",
13
+ componentId: "sc-1occfxm-0"
14
+ })(["", ""], function (props) {
15
+ return props.focus && props.keyboard && (0, _utils.focusStyle)();
16
+ });
9
17
  var Children = exports.Children = function Children() {
10
18
  var _React$useState = _react["default"].useState(),
11
19
  selected = _React$useState[0],
12
20
  setSelected = _React$useState[1];
21
+ var usingKeyboard = (0, _utils.useKeyboard)();
13
22
  return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
14
23
  align: "center",
15
24
  pad: "large",
@@ -22,10 +31,14 @@ var Children = exports.Children = function Children() {
22
31
  return setSelected(event.target.value);
23
32
  }
24
33
  }, function (_ref) {
25
- var checked = _ref.checked;
26
- return /*#__PURE__*/_react["default"].createElement(_grommetIcons.Ascend, {
34
+ var checked = _ref.checked,
35
+ focus = _ref.focus;
36
+ return /*#__PURE__*/_react["default"].createElement(StyledRadioChild, {
37
+ focus: focus,
38
+ keyboard: usingKeyboard
39
+ }, /*#__PURE__*/_react["default"].createElement(_grommetIcons.Ascend, {
27
40
  color: checked ? 'brand' : 'status-unknown'
28
- });
41
+ }));
29
42
  }), /*#__PURE__*/_react["default"].createElement(_grommet.Button, {
30
43
  label: "clear",
31
44
  onClick: function onClick() {
@@ -5,12 +5,22 @@ exports["default"] = exports.Children = void 0;
5
5
  var _react = _interopRequireWildcard(require("react"));
6
6
  var _grommet = require("grommet");
7
7
  var _grommetIcons = require("grommet-icons");
8
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
9
+ var _utils = require("grommet/utils");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
8
11
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
9
12
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
13
+ var StyledRadioChild = (0, _styledComponents["default"])(_grommet.Box).withConfig({
14
+ displayName: "Children__StyledRadioChild",
15
+ componentId: "sc-19d15gj-0"
16
+ })(["", ""], function (props) {
17
+ return props.focus && props.keyboard && (0, _utils.focusStyle)();
18
+ });
10
19
  var Children = exports.Children = function Children() {
11
20
  var _useState = (0, _react.useState)(),
12
21
  value = _useState[0],
13
22
  setValue = _useState[1];
23
+ var usingKeyboard = (0, _utils.useKeyboard)();
14
24
  return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
15
25
  align: "center",
16
26
  pad: "large"
@@ -30,7 +40,9 @@ var Children = exports.Children = function Children() {
30
40
  var Icon = option === 'asc' ? _grommetIcons.Ascend : _grommetIcons.Descend;
31
41
  var background;
32
42
  if (checked) background = 'brand';else if (hover) background = 'light-4';else if (focus) background = 'light-4';else background = 'light-2';
33
- return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
43
+ return /*#__PURE__*/_react["default"].createElement(StyledRadioChild, {
44
+ focus: focus,
45
+ keyboard: usingKeyboard,
34
46
  background: background,
35
47
  pad: "xsmall"
36
48
  }, /*#__PURE__*/_react["default"].createElement(Icon, null));
@@ -22,7 +22,8 @@ var ScrollableTabs = function ScrollableTabs() {
22
22
  overflow: "auto",
23
23
  pad: "xlarge",
24
24
  align: "center",
25
- background: "light-2"
25
+ background: "light-2",
26
+ tabIndex: 0
26
27
  }, /*#__PURE__*/_react["default"].createElement(_grommet.Heading, null, "Title"), /*#__PURE__*/_react["default"].createElement(_grommet.Paragraph, null, /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
27
28
  weight: "bold"
28
29
  }, "This is a tab with a lot of content. If you scroll down, the tabs header remains in view.")), /*#__PURE__*/_react["default"].createElement(_grommet.Paragraph, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam porttitor ipsum a ligula tincidunt, tempor posuere massa gravida. Morbi at magna lacus. Vivamus eu consequat lectus. Quisque a aliquam risus. Ut vel dignissim nunc. Etiam rhoncus pellentesque porttitor. Sed nec gravida nisl. Cras justo ex, condimentum at dolor vel, lacinia efficitur dui. Nullam pellentesque metus nec felis gravida, vel suscipit sem condimentum. Ut hendrerit varius enim. Donec congue vestibulum neque accumsan fermentum. Nulla facilisi. Praesent ornare id magna vitae malesuada. Aenean nulla enim, pretium ac est vel, tristique condimentum ex. Phasellus ante enim, pellentesque ut arcu sit amet, semper sodales dolor."), /*#__PURE__*/_react["default"].createElement(_grommet.Paragraph, null, "Proin sollicitudin dui eget diam mollis mattis eget id magna. Pellentesque tristique aliquet leo, a euismod velit molestie non. Donec lacinia, lectus quis mollis pretium, turpis erat sollicitudin mauris, vitae luctus velit lacus eu metus. Nam pulvinar mauris vitae massa faucibus, id semper sapien facilisis. Integer a congue ex. Vestibulum dapibus est fermentum felis hendrerit vulputate. Fusce libero odio, posuere sit amet mi vitae, cursus aliquam nulla. Nunc ornare augue vitae mauris ultricies gravida. In quis enim at nisi semper ultrices. Nunc posuere sed libero in facilisis."), /*#__PURE__*/_react["default"].createElement(_grommet.Paragraph, null, "Etiam sit amet ligula nunc. Pellentesque pulvinar nisl ornare dui molestie, sed faucibus elit rhoncus. In nec pellentesque enim, eget ultricies tortor. Phasellus tincidunt ultrices tortor vitae malesuada. Proin rhoncus maximus mauris, a commodo tortor blandit quis. Phasellus tincidunt luctus dapibus. Sed in imperdiet enim. Vivamus varius ut dolor non scelerisque. Praesent volutpat ligula sodales augue auctor tempor. Quisque eleifend eleifend turpis nec egestas. Nunc dapibus semper commodo. Sed volutpat arcu eleifend ipsum volutpat, eu sagittis leo hendrerit. Nulla consequat justo non erat finibus cursus. Integer porttitor ante in ultrices semper."), /*#__PURE__*/_react["default"].createElement(_grommet.Paragraph, null, "Praesent vel tellus sagittis, fringilla arcu vel, sodales turpis. Nam id accumsan nibh. Pellentesque eget diam eleifend, ultrices diam ac, suscipit ipsum. Curabitur euismod sodales sem vel ultricies. Proin euismod ipsum eros, ut efficitur felis pharetra finibus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Ut tincidunt posuere augue at porttitor. Sed venenatis iaculis est, sit amet interdum magna varius ut. In euismod scelerisque velit, vel aliquet enim. Etiam lacinia justo nec nibh aliquam, et pulvinar eros luctus. Fusce quis nisi eu tellus imperdiet bibendum ac id nulla. Proin ut tincidunt libero. Phasellus sed velit eu risus hendrerit suscipit at eget felis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus at blandit est. Phasellus fringilla nibh ac est scelerisque, id faucibus enim interdum."))), /*#__PURE__*/_react["default"].createElement(_grommet.Tab, {
@@ -49,7 +49,7 @@ var defaultDropAlign = {
49
49
  left: 'left'
50
50
  };
51
51
  var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
52
- var _inputRef$current;
52
+ var _inputRef$current, _inputRef$current2;
53
53
  var a11yTitle = _ref.a11yTitle,
54
54
  defaultSuggestion = _ref.defaultSuggestion,
55
55
  defaultValue = _ref.defaultValue,
@@ -238,6 +238,11 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
238
238
  return clearTimeout(timer);
239
239
  };
240
240
  }, [activeSuggestionIndex, showDrop]);
241
+ (0, _react.useEffect)(function () {
242
+ if (readOnly && inputRef != null && inputRef.current && inputRef.current.scrollLeft > 0) {
243
+ inputRef.current.scrollLeft = 0;
244
+ }
245
+ }, [readOnly, inputRef, inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.scrollLeft]);
241
246
  var setValueFromSuggestion = function setValueFromSuggestion(event, suggestion) {
242
247
  // if we stole the focus in the drop, perhaps by interacting with
243
248
  // a suggestion button or the scrollbar, give it back
@@ -266,7 +271,7 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
266
271
  }, [activeSuggestionIndex]);
267
272
 
268
273
  // account for input value in both controlled and uncontrolled scenarios
269
- var hasValue = value || ((_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.value);
274
+ var hasValue = value || ((_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.value);
270
275
  var showStyledPlaceholder = (0, _react.useMemo)(function () {
271
276
  return placeholder && typeof placeholder !== 'string' && !hasValue;
272
277
  }, [hasValue, placeholder]);
@@ -18,13 +18,13 @@ var customTheme = {
18
18
  blue: '#00C8FF',
19
19
  green: '#17EBA0',
20
20
  teal: '#82FFF2',
21
- purple: '#F740FF',
22
- red: '#FC6161',
21
+ purple: '#694b75',
22
+ red: '#914049',
23
23
  orange: '#FFBC44',
24
- yellow: '#FFEB59',
24
+ yellow: '#faf6d4',
25
25
  // you can also point to existing grommet colors
26
26
  brightGreen: 'accent-1',
27
- deepGreen: 'neutral-2',
27
+ dark: 'dark-1',
28
28
  // Changing default text color,
29
29
  // all colors could be either a string or a dark and light object
30
30
  text: {
@@ -42,8 +42,8 @@ export var Colors = function Colors() {
42
42
  gap: "medium",
43
43
  pad: "small"
44
44
  }, /*#__PURE__*/React.createElement(Text, null, "Custom color purple"), /*#__PURE__*/React.createElement(Text, {
45
- color: "deepGreen"
46
- }, "Inline custom color of deepGreen"), /*#__PURE__*/React.createElement(Paragraph, {
45
+ color: "dark"
46
+ }, "Inline custom dark color"), /*#__PURE__*/React.createElement(Paragraph, {
47
47
  color: "red"
48
48
  }, "Wrapping your application with the Grommet component that is pointing to your customTheme object as shown on the example, will allow you full access to your custom colors across your application. You can override any Grommet color that is mentioned in the docs in a similar fashion."), /*#__PURE__*/React.createElement(Anchor, {
49
49
  href: "https://github.com/grommet/grommet/wiki/Color-Properties"
@@ -50,7 +50,7 @@ const RichPanel = ({ children, icon, label }) => {
50
50
  pad={{ horizontal: 'small' }}
51
51
  >
52
52
  {icon}
53
- <Heading level={4} color={hovering ? 'dark-1' : 'dark-3'}>
53
+ <Heading level={4} color={hovering ? 'dark-1' : 'dark-2'}>
54
54
  {label}
55
55
  </Heading>
56
56
  </Box>
@@ -56,9 +56,7 @@ export var BackgroundBox = function BackgroundBox() {
56
56
  dark: true
57
57
  },
58
58
  pad: "medium"
59
- }, /*#__PURE__*/React.createElement(Text, {
60
- color: "brand"
61
- }, "force dark background")), /*#__PURE__*/React.createElement(Box, {
59
+ }, /*#__PURE__*/React.createElement(Text, null, "force dark background")), /*#__PURE__*/React.createElement(Box, {
62
60
  background: "dark-1",
63
61
  pad: "medium"
64
62
  }, /*#__PURE__*/React.createElement(Box, {
@@ -72,15 +70,13 @@ export var BackgroundBox = function BackgroundBox() {
72
70
  }, "force light background"))), /*#__PURE__*/React.createElement(Box, {
73
71
  background: {
74
72
  color: {
75
- dark: 'darkgrey',
73
+ dark: 'dark-2',
76
74
  light: 'lightgrey'
77
75
  },
78
76
  dark: true
79
77
  },
80
78
  pad: "medium"
81
- }, /*#__PURE__*/React.createElement(Text, {
82
- color: "brand"
83
- }, "force dark background with color as object")), /*#__PURE__*/React.createElement(Box, {
79
+ }, /*#__PURE__*/React.createElement(Text, null, "force dark background with color as object")), /*#__PURE__*/React.createElement(Box, {
84
80
  background: "dark-1",
85
81
  pad: "medium"
86
82
  }, /*#__PURE__*/React.createElement(Box, {
@@ -92,9 +88,7 @@ export var BackgroundBox = function BackgroundBox() {
92
88
  dark: false
93
89
  },
94
90
  pad: "medium"
95
- }, /*#__PURE__*/React.createElement(Text, {
96
- color: "brand"
97
- }, "force light background with color as object"))))
91
+ }, /*#__PURE__*/React.createElement(Text, null, "force light background with color as object"))))
98
92
  // </Grommet>
99
93
  );
100
94
  };
@@ -779,7 +779,10 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
779
779
  },
780
780
  previousInBound: betweenDates(previousMonth, bounds),
781
781
  nextInBound: betweenDates(nextMonth, bounds)
782
- }) : renderCalendarHeader(previousMonth, nextMonth), daysOfWeek && renderDaysOfWeek(), /*#__PURE__*/React.createElement(Keyboard, {
782
+ }) : renderCalendarHeader(previousMonth, nextMonth), /*#__PURE__*/React.createElement(Box, {
783
+ fill: true,
784
+ role: "grid"
785
+ }, daysOfWeek && renderDaysOfWeek(), /*#__PURE__*/React.createElement(Keyboard, {
783
786
  onEnter: function onEnter() {
784
787
  return active !== undefined ? _onClick(active) : undefined;
785
788
  },
@@ -819,7 +822,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
819
822
  }
820
823
  }, /*#__PURE__*/React.createElement(StyledWeeksContainer, _extends({
821
824
  tabIndex: 0,
822
- role: "grid",
825
+ role: "rowgroup",
823
826
  "aria-label": reference.toLocaleDateString(locale, {
824
827
  month: 'long',
825
828
  year: 'numeric'
@@ -843,7 +846,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
843
846
  slide: slide,
844
847
  sizeProp: size,
845
848
  fillContainer: fill
846
- }, passThemeFlag), weeks)))));
849
+ }, passThemeFlag), weeks))))));
847
850
  });
848
851
  Calendar.displayName = 'Calendar';
849
852
  Calendar.propTypes = CalendarPropTypes;
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { Box, Card, CardBody, CardFooter, CardHeader, Text } from 'grommet';
2
+ import { Box, Card, CardBody, CardFooter, CardHeader, Main, Text } from 'grommet';
3
3
  export var Simple = function Simple() {
4
4
  return (
5
5
  /*#__PURE__*/
6
6
  // Uncomment <Grommet> lines when using outside of storybook
7
7
  // <Grommet theme={...}>
8
- React.createElement(Box, {
8
+ React.createElement(Main, null, /*#__PURE__*/React.createElement(Box, {
9
9
  pad: "large",
10
10
  gap: "medium",
11
11
  width: "medium"
@@ -24,7 +24,7 @@ export var Simple = function Simple() {
24
24
  pad: "small",
25
25
  gap: "medium",
26
26
  background: "light-1"
27
- }, /*#__PURE__*/React.createElement(Text, null, "text - random component"), /*#__PURE__*/React.createElement(Box, null, "box - random component")))
27
+ }, /*#__PURE__*/React.createElement(Text, null, "text - random component"), /*#__PURE__*/React.createElement(Box, null, "box - random component"))))
28
28
  // </Grommet>
29
29
  );
30
30
  };
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
- import { Box, Card, CardBody, CardFooter, Cards, Data, Heading } from 'grommet';
2
+ import { Box, Card, CardBody, CardFooter, Cards, Data, Heading, Main } from 'grommet';
3
3
  import { DATA } from '../../DataTable/stories/data';
4
4
  export var Example = function Example() {
5
5
  return (
6
6
  /*#__PURE__*/
7
7
  // Uncomment <Grommet> lines when using outside of storybook
8
8
  // <Grommet theme={...}>
9
- React.createElement(Box, {
9
+ React.createElement(Main, null, /*#__PURE__*/React.createElement(Box, {
10
10
  pad: "large"
11
11
  }, /*#__PURE__*/React.createElement(Data, {
12
12
  data: DATA,
@@ -15,13 +15,14 @@ export var Example = function Example() {
15
15
  size: "medium"
16
16
  }, function (item) {
17
17
  return /*#__PURE__*/React.createElement(Card, {
18
+ as: "li",
18
19
  key: item.name,
19
20
  pad: "small"
20
21
  }, /*#__PURE__*/React.createElement(CardBody, null, /*#__PURE__*/React.createElement(Heading, {
21
22
  level: 2,
22
23
  margin: "none"
23
24
  }, item.name)), /*#__PURE__*/React.createElement(CardFooter, null, item.location || '--'));
24
- })))
25
+ }))))
25
26
  // </Grommet>
26
27
  );
27
28
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Box, Cards, Card, CardBody, CardFooter, Heading, Data, DataSort, DataSearch, DataFilters, Text, Toolbar } from 'grommet';
2
+ import { Box, Cards, Card, CardBody, CardFooter, Heading, Data, DataSort, DataSearch, DataFilters, Main, Text, Toolbar } from 'grommet';
3
3
  import { DATA } from '../../DataTable/stories/data';
4
4
  import { DataSummary } from '../../DataSummary';
5
5
  var amountFormatter = new Intl.NumberFormat('en-US', {
@@ -12,7 +12,7 @@ export var Properties = function Properties() {
12
12
  /*#__PURE__*/
13
13
  // Uncomment <Grommet> lines when using outside of storybook
14
14
  // <Grommet theme={...}>
15
- React.createElement(Box, {
15
+ React.createElement(Main, null, /*#__PURE__*/React.createElement(Box, {
16
16
  pad: "large"
17
17
  }, /*#__PURE__*/React.createElement(Data, {
18
18
  data: DATA,
@@ -45,13 +45,14 @@ export var Properties = function Properties() {
45
45
  size: "medium"
46
46
  }, function (item) {
47
47
  return /*#__PURE__*/React.createElement(Card, {
48
+ as: "li",
48
49
  key: item.name,
49
50
  pad: "small"
50
51
  }, /*#__PURE__*/React.createElement(CardBody, null, /*#__PURE__*/React.createElement(Heading, {
51
52
  level: 2,
52
53
  margin: "none"
53
54
  }, item.name), /*#__PURE__*/React.createElement(Text, null, amountFormatter.format(item.paid / 100))), /*#__PURE__*/React.createElement(CardFooter, null, item.location || '--'));
54
- })))
55
+ }))))
55
56
  // </Grommet>
56
57
  );
57
58
  };
@@ -3,7 +3,7 @@ var _excluded = ["error", "info", "message", "type"],
3
3
  _excluded3 = ["children", "className", "component", "contentProps", "disabled", "error", "help", "htmlFor", "info", "label", "margin", "name", "onBlur", "onChange", "onFocus", "pad", "required", "style", "validate", "validateOn"];
4
4
  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); }
5
5
  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; }
6
- import React, { Children, cloneElement, forwardRef, useContext, useMemo, useState } from 'react';
6
+ import React, { Children, cloneElement, forwardRef, useContext, useEffect, useMemo, useState } from 'react';
7
7
  import styled from 'styled-components';
8
8
  import { containsFocus, shouldKeepFocus, withinDropPortal, PortalContext } from '../../utils';
9
9
  import { useDebounce } from '../../utils/use-debounce';
@@ -19,8 +19,9 @@ import { TextInput } from '../TextInput';
19
19
  import { FormContext } from '../Form/FormContext';
20
20
  import { FormFieldPropTypes } from './propTypes';
21
21
  import { useThemeValue } from '../../utils/useThemeValue';
22
- var grommetInputNames = ['CheckBox', 'CheckBoxGroup', 'TextInput', 'Select', 'MaskedInput', 'SelectMultiple', 'TextArea', 'DateInput', 'FileInput', 'RadioButtonGroup', 'RangeInput', 'RangeSelector', 'StarRating', 'ThumbsRating'];
23
- var grommetInputPadNames = ['CheckBox', 'CheckBoxGroup', 'RadioButtonGroup', 'RangeInput', 'RangeSelector'];
22
+ import { AnnounceContext } from '../../contexts/AnnounceContext';
23
+ var grommetInputNames = ['CheckBox', 'CheckBoxGroup', 'TextInput', 'Select', 'MaskedInput', 'SelectMultiple', 'TextArea', 'DateInput', 'FileInput', 'RadioButton', 'RadioButtonGroup', 'RangeInput', 'RangeSelector', 'StarRating', 'ThumbsRating'];
24
+ var grommetInputPadNames = ['CheckBox', 'CheckBoxGroup', 'RadioButton', 'RadioButtonGroup', 'RangeInput', 'RangeSelector'];
24
25
  var isGrommetInput = function isGrommetInput(comp) {
25
26
  return comp && (grommetInputNames.indexOf(comp.displayName) !== -1 || grommetInputPadNames.indexOf(comp.displayName) !== -1);
26
27
  };
@@ -170,6 +171,12 @@ var FormField = /*#__PURE__*/forwardRef(function (_ref3, ref) {
170
171
  var themeBorder = formFieldTheme.border;
171
172
  var debounce = useDebounce();
172
173
  var portalContext = useContext(PortalContext);
174
+ var announce = useContext(AnnounceContext);
175
+ useEffect(function () {
176
+ if (error && validate != null && validate.max) {
177
+ announce(error, 'polite', 5000);
178
+ }
179
+ }, [error, announce, validate == null ? void 0 : validate.max]);
173
180
  var readOnlyField = useMemo(function () {
174
181
  var readOnly = false;
175
182
  if (children) {
@@ -18,7 +18,10 @@ export var ThresholdValidation = function ThresholdValidation() {
18
18
  },
19
19
  name: "issue-description",
20
20
  htmlFor: "issue-description"
21
- }, /*#__PURE__*/React.createElement(TextInput, {
21
+ }, /*#__PURE__*/React.createElement(TextInput
22
+ // eslint-disable-next-line max-len
23
+ , {
24
+ "aria-label": "text input with limit of 10 characters and threshold of 0.25",
22
25
  id: "issue-description",
23
26
  name: "issue-description",
24
27
  placeholder: "placeholder"
@@ -30,6 +33,7 @@ export var ThresholdValidation = function ThresholdValidation() {
30
33
  name: "issue-description-with-default-threshold",
31
34
  htmlFor: "issue-description-with-default-threshold"
32
35
  }, /*#__PURE__*/React.createElement(TextInput, {
36
+ "aria-label": "text input with limit of 10 characters",
33
37
  id: "issue-description-with-default-threshold",
34
38
  name: "issue-description-with-default-threshold",
35
39
  placeholder: "placeholder"
@@ -120,6 +120,24 @@ export interface GrommetProps {
120
120
  openMenu?: string;
121
121
  closeMenu?: string;
122
122
  };
123
+ meter?: {
124
+ bar?: {
125
+ singular?: string;
126
+ plural?: string;
127
+ };
128
+ circle?: {
129
+ singular?: string;
130
+ plural?: string;
131
+ };
132
+ pie?: {
133
+ singular?: string;
134
+ plural?: string;
135
+ };
136
+ semicircle?: {
137
+ singular?: string;
138
+ plural?: string;
139
+ };
140
+ };
123
141
  rangeSelector?: {
124
142
  lower?: string;
125
143
  upper?: string;
@@ -171,7 +189,7 @@ export interface GrommetProps {
171
189
  volumeUp?: string;
172
190
  };
173
191
  };
174
- format: (...args: any[]) => void;
192
+ format?: (...args: any[]) => void;
175
193
  };
176
194
  onAnalytics?: (data: any) => void;
177
195
  plain?: boolean;
@@ -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'
@@ -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;
@@ -268,7 +268,19 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
268
268
  event.preventDefault();
269
269
  if (active) {
270
270
  var min = onOrder ? 1 : 0;
271
- updateActive(Math.max(active - 1, min));
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);
272
284
  }
273
285
  }
274
286
  },
@@ -278,7 +290,19 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
278
290
  if (orderableData && orderableData.length) {
279
291
  var min = onOrder ? 1 : 0;
280
292
  var max = onOrder ? orderableData.length * 2 - 2 : data.length - 1;
281
- updateActive(active >= min ? Math.min(active + 1, max) : min);
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);
282
306
  }
283
307
  }
284
308
  },
@@ -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) {