grommet 2.42.0 → 2.44.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 (188) hide show
  1. package/all/stories/AllComponents.js +7 -2
  2. package/all/stories/Colors.js +6 -6
  3. package/components/Accordion/stories/CustomThemed/Rich.tsx +1 -1
  4. package/components/Box/stories/Background.js +5 -11
  5. package/components/Button/stories/CustomThemed/Typescript.tsx +1 -1
  6. package/components/Button/stories/Kind.js +6 -10
  7. package/components/Calendar/Calendar.js +21 -11
  8. package/components/Calendar/StyledCalendar.js +6 -5
  9. package/components/Calendar/index.d.ts +1 -0
  10. package/components/Calendar/propTypes.js +1 -0
  11. package/components/Calendar/stories/DaylightSavings.js +1 -1
  12. package/components/Calendar/stories/HeaderLevel.js +36 -0
  13. package/components/Calendar/stories/ShowAdjacentDays.js +3 -2
  14. package/components/Card/stories/CustomThemed/Clickable.js +2 -2
  15. package/components/Card/stories/CustomThemed/Stacked.js +2 -2
  16. package/components/Card/stories/CustomThemed/Themed.js +4 -4
  17. package/components/Card/stories/Simple.js +2 -2
  18. package/components/Cards/stories/Children.js +2 -2
  19. package/components/CheckBox/stories/CustomThemed/Custom.js +1 -1
  20. package/components/Data/stories/Cards.js +3 -2
  21. package/components/Data/stories/Properties.js +3 -2
  22. package/components/DataChart/Detail.js +55 -25
  23. package/components/DataChart/Legend.js +1 -0
  24. package/components/DataTable/Body.js +16 -2
  25. package/components/DataTable/stories/CustomThemed/Fill.js +1 -0
  26. package/components/Drop/stories/CustomThemed/Lazy.js +4 -4
  27. package/components/Drop/stories/CustomThemed/Themed.js +1 -1
  28. package/components/Form/stories/AggregateValidation.js +5 -2
  29. package/components/Form/stories/ArrayOfFormFields.js +19 -6
  30. package/components/Form/stories/Controlled.js +8 -1
  31. package/components/Form/stories/ControlledInput.js +8 -1
  32. package/components/Form/stories/ControlledInputLazy.js +5 -1
  33. package/components/Form/stories/ControlledLazy.js +5 -1
  34. package/components/Form/stories/CustomThemed/Custom.js +17 -1
  35. package/components/Form/stories/CustomThemed/FieldSpacingOptions.js +36 -36
  36. package/components/Form/stories/CustomThemed/RequiredLabel.js +3 -0
  37. package/components/Form/stories/CustomThemed/Themed.js +2 -2
  38. package/components/Form/stories/DynamicFields.js +9 -2
  39. package/components/Form/stories/FieldWithChildren.js +6 -1
  40. package/components/Form/stories/TriggerValidationUsingFormField.js +18 -6
  41. package/components/Form/stories/Uncontrolled.js +6 -1
  42. package/components/Form/stories/ValidateOnBlur.js +10 -3
  43. package/components/Form/stories/ValidateOnChange.js +11 -5
  44. package/components/Form/stories/ValidateOnMount.js +11 -4
  45. package/components/Form/stories/typescript/TypedForm.tsx +39 -45
  46. package/components/FormField/FormField.js +9 -2
  47. package/components/FormField/stories/CustomThemed/Custom.tsx +1 -1
  48. package/components/FormField/stories/ThresholdValidation.js +5 -1
  49. package/components/Grid/stories/AreasPropAlternative.js +4 -1
  50. package/components/Grommet/index.d.ts +23 -1
  51. package/components/Grommet/propTypes.js +22 -0
  52. package/components/Grommet/stories/Theme.js +1 -1
  53. package/components/Grommet/stories/Vars.js +2 -2
  54. package/components/Layer/LayerContainer.js +3 -14
  55. package/components/List/List.js +27 -3
  56. package/components/List/stories/RenderedList.js +1 -1
  57. package/components/Meter/Meter.js +36 -17
  58. package/components/Meter/index.d.ts +18 -0
  59. package/components/Meter/propTypes.js +18 -0
  60. package/components/Nav/stories/CustomThemed/JustifySidebar.js +1 -1
  61. package/components/Notification/stories/CustomThemed/ThemedNotification.tsx +2 -1
  62. package/components/PageHeader/stories/Level.js +2 -2
  63. package/components/PageHeader/stories/Size.js +3 -2
  64. package/components/Pagination/stories/CustomThemed/Custom.tsx +8 -2
  65. package/components/Pagination/stories/NumberEdgePages.js +2 -0
  66. package/components/Pagination/stories/NumberMiddlePages.js +2 -0
  67. package/components/Pagination/stories/Simple.js +4 -2
  68. package/components/Pagination/stories/Size.js +3 -0
  69. package/components/Pagination/stories/Steps.js +3 -0
  70. package/components/RadioButton/RadioButton.js +14 -3
  71. package/components/RadioButton/stories/Children.js +16 -3
  72. package/components/RadioButtonGroup/stories/Children.js +13 -1
  73. package/components/Skeleton/stories/CustomThemed/Custom.js +2 -0
  74. package/components/Skeleton/stories/GridContainer.js +1 -1
  75. package/components/Skeleton/stories/Group.js +1 -1
  76. package/components/Skeleton/stories/Individual.js +1 -2
  77. package/components/Skeleton/stories/Simple.js +1 -0
  78. package/components/SkipLinks/stories/CustomThemed/Themed.js +1 -1
  79. package/components/StarRating/StarRating.js +17 -3
  80. package/components/Tabs/Tabs.js +1 -1
  81. package/components/Tabs/stories/CustomThemed/Custom.js +3 -3
  82. package/components/Tabs/stories/Scrollable.js +2 -1
  83. package/components/TextArea/stories/CustomThemed/Themed.js +1 -0
  84. package/components/TextInput/TextInput.js +7 -2
  85. package/components/TextInput/stories/Simple.js +1 -6
  86. package/components/ThumbsRating/ThumbsRating.js +20 -5
  87. package/es6/all/stories/AllComponents.js +7 -2
  88. package/es6/all/stories/Colors.js +6 -6
  89. package/es6/components/Accordion/stories/CustomThemed/Rich.tsx +1 -1
  90. package/es6/components/Box/stories/Background.js +5 -11
  91. package/es6/components/Button/stories/CustomThemed/Typescript.tsx +1 -1
  92. package/es6/components/Button/stories/Kind.js +6 -10
  93. package/es6/components/Calendar/Calendar.js +21 -11
  94. package/es6/components/Calendar/StyledCalendar.js +6 -5
  95. package/es6/components/Calendar/index.d.ts +1 -0
  96. package/es6/components/Calendar/propTypes.js +1 -0
  97. package/es6/components/Calendar/stories/DaylightSavings.js +2 -2
  98. package/es6/components/Calendar/stories/HeaderLevel.js +30 -0
  99. package/es6/components/Calendar/stories/ShowAdjacentDays.js +3 -2
  100. package/es6/components/Card/stories/CustomThemed/Clickable.js +3 -3
  101. package/es6/components/Card/stories/CustomThemed/Stacked.js +3 -3
  102. package/es6/components/Card/stories/CustomThemed/Themed.js +5 -5
  103. package/es6/components/Card/stories/Simple.js +3 -3
  104. package/es6/components/Cards/stories/Children.js +3 -3
  105. package/es6/components/CheckBox/stories/CustomThemed/Custom.js +1 -1
  106. package/es6/components/Data/stories/Cards.js +4 -3
  107. package/es6/components/Data/stories/Properties.js +4 -3
  108. package/es6/components/DataChart/Detail.js +55 -25
  109. package/es6/components/DataChart/Legend.js +1 -0
  110. package/es6/components/DataTable/Body.js +18 -4
  111. package/es6/components/DataTable/stories/CustomThemed/Fill.js +1 -0
  112. package/es6/components/Drop/stories/CustomThemed/Lazy.js +4 -4
  113. package/es6/components/Drop/stories/CustomThemed/Themed.js +1 -1
  114. package/es6/components/Form/stories/AggregateValidation.js +5 -2
  115. package/es6/components/Form/stories/ArrayOfFormFields.js +20 -7
  116. package/es6/components/Form/stories/Controlled.js +8 -1
  117. package/es6/components/Form/stories/ControlledInput.js +8 -1
  118. package/es6/components/Form/stories/ControlledInputLazy.js +5 -1
  119. package/es6/components/Form/stories/ControlledLazy.js +5 -1
  120. package/es6/components/Form/stories/CustomThemed/Custom.js +17 -1
  121. package/es6/components/Form/stories/CustomThemed/FieldSpacingOptions.js +36 -36
  122. package/es6/components/Form/stories/CustomThemed/RequiredLabel.js +3 -0
  123. package/es6/components/Form/stories/CustomThemed/Themed.js +2 -2
  124. package/es6/components/Form/stories/DynamicFields.js +9 -2
  125. package/es6/components/Form/stories/FieldWithChildren.js +6 -1
  126. package/es6/components/Form/stories/TriggerValidationUsingFormField.js +19 -7
  127. package/es6/components/Form/stories/Uncontrolled.js +6 -1
  128. package/es6/components/Form/stories/ValidateOnBlur.js +10 -3
  129. package/es6/components/Form/stories/ValidateOnChange.js +12 -6
  130. package/es6/components/Form/stories/ValidateOnMount.js +11 -4
  131. package/es6/components/Form/stories/typescript/TypedForm.tsx +39 -45
  132. package/es6/components/FormField/FormField.js +10 -3
  133. package/es6/components/FormField/stories/CustomThemed/Custom.tsx +1 -1
  134. package/es6/components/FormField/stories/ThresholdValidation.js +5 -1
  135. package/es6/components/Grid/stories/AreasPropAlternative.js +4 -1
  136. package/es6/components/Grommet/index.d.ts +23 -1
  137. package/es6/components/Grommet/propTypes.js +22 -0
  138. package/es6/components/Grommet/stories/Theme.js +1 -1
  139. package/es6/components/Grommet/stories/Vars.js +2 -2
  140. package/es6/components/Layer/LayerContainer.js +4 -15
  141. package/es6/components/List/List.js +27 -3
  142. package/es6/components/List/stories/RenderedList.js +1 -1
  143. package/es6/components/Meter/Meter.js +37 -18
  144. package/es6/components/Meter/index.d.ts +18 -0
  145. package/es6/components/Meter/propTypes.js +18 -0
  146. package/es6/components/Nav/stories/CustomThemed/JustifySidebar.js +1 -1
  147. package/es6/components/Notification/stories/CustomThemed/ThemedNotification.tsx +2 -1
  148. package/es6/components/PageHeader/stories/Level.js +3 -3
  149. package/es6/components/PageHeader/stories/Size.js +3 -2
  150. package/es6/components/Pagination/stories/CustomThemed/Custom.tsx +8 -2
  151. package/es6/components/Pagination/stories/NumberEdgePages.js +2 -0
  152. package/es6/components/Pagination/stories/NumberMiddlePages.js +2 -0
  153. package/es6/components/Pagination/stories/Simple.js +4 -2
  154. package/es6/components/Pagination/stories/Size.js +3 -0
  155. package/es6/components/Pagination/stories/Steps.js +3 -0
  156. package/es6/components/RadioButton/RadioButton.js +15 -4
  157. package/es6/components/RadioButton/stories/Children.js +16 -3
  158. package/es6/components/RadioButtonGroup/stories/Children.js +12 -1
  159. package/es6/components/Skeleton/stories/CustomThemed/Custom.js +2 -0
  160. package/es6/components/Skeleton/stories/GridContainer.js +2 -2
  161. package/es6/components/Skeleton/stories/Group.js +2 -2
  162. package/es6/components/Skeleton/stories/Individual.js +2 -3
  163. package/es6/components/Skeleton/stories/Simple.js +1 -0
  164. package/es6/components/SkipLinks/stories/CustomThemed/Themed.js +1 -1
  165. package/es6/components/StarRating/StarRating.js +16 -3
  166. package/es6/components/Tabs/Tabs.js +1 -1
  167. package/es6/components/Tabs/stories/CustomThemed/Custom.js +3 -3
  168. package/es6/components/Tabs/stories/Scrollable.js +2 -1
  169. package/es6/components/TextArea/stories/CustomThemed/Themed.js +1 -0
  170. package/es6/components/TextInput/TextInput.js +7 -2
  171. package/es6/components/TextInput/stories/Simple.js +2 -7
  172. package/es6/components/ThumbsRating/ThumbsRating.js +20 -5
  173. package/es6/languages/default.json +22 -0
  174. package/es6/themes/base.d.ts +3 -0
  175. package/es6/themes/base.js +8 -5
  176. package/es6/utils/useId.js +3 -2
  177. package/grommet.min.js +1 -1
  178. package/grommet.min.js.map +1 -1
  179. package/languages/default.json +22 -0
  180. package/package.json +28 -28
  181. package/themes/base.d.ts +3 -0
  182. package/themes/base.js +8 -5
  183. package/tools/release-stable.js +1 -1
  184. package/utils/useId.js +5 -2
  185. package/components/CheckBox/stories/InsideButton.js +0 -38
  186. package/components/Form/stories/FieldWithComponentProp.js +0 -138
  187. package/es6/components/CheckBox/stories/InsideButton.js +0 -32
  188. package/es6/components/Form/stories/FieldWithComponentProp.js +0 -133
@@ -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]),
@@ -36,7 +36,7 @@ var SidebarNav = function SidebarNav() {
36
36
  fill: true,
37
37
  direction: "row"
38
38
  }, /*#__PURE__*/React.createElement(Nav, {
39
- background: "neutral-1"
39
+ background: "dark-2"
40
40
  }, [{
41
41
  label: 'Dashboard',
42
42
  icon: /*#__PURE__*/React.createElement(Dashboard, null),
@@ -41,11 +41,12 @@ const customTheme: ThemeType = deepMerge(grommet, {
41
41
  },
42
42
  },
43
43
  close: {
44
- color: '#e0ffcc',
44
+ color: '#000000',
45
45
  },
46
46
  unknown: {
47
47
  icon: CircleQuestion,
48
48
  background: '#87a200',
49
+ color: '#000000',
49
50
  },
50
51
  },
51
52
  });
@@ -1,4 +1,4 @@
1
- import { Button, Page, PageContent, PageHeader } from 'grommet';
1
+ import { Button, Main, Page, PageContent, PageHeader } from 'grommet';
2
2
  import React from 'react';
3
3
  export var Level = function Level() {
4
4
  return /*#__PURE__*/React.createElement(Page, null, /*#__PURE__*/React.createElement(PageContent, null, /*#__PURE__*/React.createElement(PageHeader, {
@@ -8,7 +8,7 @@ export var Level = function Level() {
8
8
  label: "View Details"
9
9
  }),
10
10
  level: 1 // Use different levels for different headers
11
- }), /*#__PURE__*/React.createElement(PageHeader, {
11
+ }), /*#__PURE__*/React.createElement(Main, null, /*#__PURE__*/React.createElement(PageHeader, {
12
12
  title: "Main Section",
13
13
  subtitle: "This is the main section of your application where you can display more detailed information about a specific topic or category.",
14
14
  actions: /*#__PURE__*/React.createElement(Button, {
@@ -22,7 +22,7 @@ export var Level = function Level() {
22
22
  label: "View Details"
23
23
  }),
24
24
  level: 3
25
- })));
25
+ }))));
26
26
  };
27
27
  export default {
28
28
  title: 'Layout/PageHeader/Level'
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Anchor, Button, PageHeader, Page, PageContent } from 'grommet';
3
+ import { Main } from '../../Main';
3
4
  export var Size = function Size() {
4
5
  return (
5
6
  /*#__PURE__*/
@@ -15,7 +16,7 @@ export var Size = function Size() {
15
16
  label: "Parent Page"
16
17
  }),
17
18
  size: "small"
18
- }), /*#__PURE__*/React.createElement(PageHeader, {
19
+ }), /*#__PURE__*/React.createElement(Main, null, /*#__PURE__*/React.createElement(PageHeader, {
19
20
  title: "Medium PageHeader (default)",
20
21
  subtitle: "Grommet helps you build responsive and accessible \n mobile-first projects for the web with an easy to use component \n library.",
21
22
  actions: /*#__PURE__*/React.createElement(Button, {
@@ -34,7 +35,7 @@ export var Size = function Size() {
34
35
  label: "Parent Page"
35
36
  }),
36
37
  size: "large"
37
- })))
38
+ }))))
38
39
  // </Grommet>
39
40
  );
40
41
  };
@@ -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,
@@ -1,10 +1,19 @@
1
1
  import React from 'react';
2
2
  import { Box, Button, RadioButton } from 'grommet';
3
3
  import { Ascend } from "grommet-icons/es6/icons/Ascend";
4
+ import styled from 'styled-components';
5
+ import { focusStyle, useKeyboard } from 'grommet/utils';
6
+ var StyledRadioChild = styled(Box).withConfig({
7
+ displayName: "Children__StyledRadioChild",
8
+ componentId: "sc-1occfxm-0"
9
+ })(["", ""], function (props) {
10
+ return props.focus && props.keyboard && focusStyle();
11
+ });
4
12
  export var Children = function Children() {
5
13
  var _React$useState = React.useState(),
6
14
  selected = _React$useState[0],
7
15
  setSelected = _React$useState[1];
16
+ var usingKeyboard = useKeyboard();
8
17
  return /*#__PURE__*/React.createElement(Box, {
9
18
  align: "center",
10
19
  pad: "large",
@@ -17,10 +26,14 @@ export var Children = function Children() {
17
26
  return setSelected(event.target.value);
18
27
  }
19
28
  }, function (_ref) {
20
- var checked = _ref.checked;
21
- return /*#__PURE__*/React.createElement(Ascend, {
29
+ var checked = _ref.checked,
30
+ focus = _ref.focus;
31
+ return /*#__PURE__*/React.createElement(StyledRadioChild, {
32
+ focus: focus,
33
+ keyboard: usingKeyboard
34
+ }, /*#__PURE__*/React.createElement(Ascend, {
22
35
  color: checked ? 'brand' : 'status-unknown'
23
- });
36
+ }));
24
37
  }), /*#__PURE__*/React.createElement(Button, {
25
38
  label: "clear",
26
39
  onClick: function onClick() {
@@ -2,10 +2,19 @@ import React, { useState } from 'react';
2
2
  import { Box, RadioButtonGroup } from 'grommet';
3
3
  import { Ascend } from "grommet-icons/es6/icons/Ascend";
4
4
  import { Descend } from "grommet-icons/es6/icons/Descend";
5
+ import styled from 'styled-components';
6
+ import { focusStyle, useKeyboard } from 'grommet/utils';
7
+ var StyledRadioChild = styled(Box).withConfig({
8
+ displayName: "Children__StyledRadioChild",
9
+ componentId: "sc-19d15gj-0"
10
+ })(["", ""], function (props) {
11
+ return props.focus && props.keyboard && focusStyle();
12
+ });
5
13
  export var Children = function Children() {
6
14
  var _useState = useState(),
7
15
  value = _useState[0],
8
16
  setValue = _useState[1];
17
+ var usingKeyboard = useKeyboard();
9
18
  return /*#__PURE__*/React.createElement(Box, {
10
19
  align: "center",
11
20
  pad: "large"
@@ -25,7 +34,9 @@ export var Children = function Children() {
25
34
  var Icon = option === 'asc' ? Ascend : Descend;
26
35
  var background;
27
36
  if (checked) background = 'brand';else if (hover) background = 'light-4';else if (focus) background = 'light-4';else background = 'light-2';
28
- return /*#__PURE__*/React.createElement(Box, {
37
+ return /*#__PURE__*/React.createElement(StyledRadioChild, {
38
+ focus: focus,
39
+ keyboard: usingKeyboard,
29
40
  background: background,
30
41
  pad: "xsmall"
31
42
  }, /*#__PURE__*/React.createElement(Icon, null));
@@ -46,8 +46,10 @@ export var Custom = function Custom() {
46
46
  align: "start",
47
47
  skeleton: skeleton
48
48
  }, /*#__PURE__*/React.createElement(Heading, {
49
+ "aria-label": skeleton ? 'heading 1 loading' : undefined,
49
50
  level: 1
50
51
  }, "Heading 1"), /*#__PURE__*/React.createElement(Text, null, "text"), /*#__PURE__*/React.createElement(Heading, {
52
+ "aria-label": skeleton ? 'heading 2 loading' : undefined,
51
53
  level: 2
52
54
  }, "Heading 2"), /*#__PURE__*/React.createElement(Button, {
53
55
  alignSelf: "end",
@@ -2,7 +2,7 @@ var _excluded = ["title"];
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, { useEffect, useState } from 'react';
5
- import { Box, Button, Card, Grid, Image, Text } from 'grommet';
5
+ import { Box, Button, Card, Grid, Text } from 'grommet';
6
6
  import { FormAdd } from "grommet-icons/es6/icons/FormAdd";
7
7
  var labels = [];
8
8
  for (var i = 0; i < 10; i += 1) labels.push("Item " + i);
@@ -34,7 +34,7 @@ var Item = function Item(_ref) {
34
34
  background: "brand",
35
35
  round: "small",
36
36
  flex: false
37
- }, /*#__PURE__*/React.createElement(Image, null)), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, {
37
+ }), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, {
38
38
  size: "large",
39
39
  color: "text-strong",
40
40
  weight: "bold",
@@ -1,7 +1,7 @@
1
1
  function _objectDestructuringEmpty(t) { if (null == t) throw new TypeError("Cannot destructure " + t); }
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
- import { Box, Button, Card, Grommet, Image, Text } from 'grommet';
4
+ import { Box, Button, Card, Grommet, Text } from 'grommet';
5
5
  import { FormAdd } from "grommet-icons/es6/icons/FormAdd";
6
6
  import { useThemeValue } from '../../../utils/useThemeValue';
7
7
  var Item = function Item(_ref) {
@@ -26,7 +26,7 @@ var Item = function Item(_ref) {
26
26
  height: "xsmall",
27
27
  background: "orange!",
28
28
  round: "small"
29
- }, /*#__PURE__*/React.createElement(Image, null)), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, {
29
+ }), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, {
30
30
  size: "large",
31
31
  color: "text-strong",
32
32
  weight: "bold",
@@ -2,7 +2,7 @@ var _excluded = ["title"];
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 from 'react';
5
- import { Box, Button, Card, Grommet, Image, Text } from 'grommet';
5
+ import { Box, Button, Card, Grommet, Text } from 'grommet';
6
6
  import { useThemeValue } from '../../../utils/useThemeValue';
7
7
  var Item = function Item(_ref) {
8
8
  var title = _ref.title,
@@ -12,7 +12,6 @@ var Item = function Item(_ref) {
12
12
  pad: "medium",
13
13
  gap: "large",
14
14
  round: "medium",
15
- background: "status-warning",
16
15
  flex: "grow"
17
16
  }, rest), /*#__PURE__*/React.createElement(Text, {
18
17
  color: "text-strong",
@@ -34,7 +33,7 @@ var Item = function Item(_ref) {
34
33
  height: "xsmall",
35
34
  background: "orange!",
36
35
  round: "small"
37
- }, /*#__PURE__*/React.createElement(Image, null)), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, {
36
+ }), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, {
38
37
  size: "large",
39
38
  color: "text-strong",
40
39
  weight: "bold",
@@ -8,6 +8,7 @@ var HeadingExample = function HeadingExample() {
8
8
  }, "Heading"), /*#__PURE__*/React.createElement(Box, {
9
9
  skeleton: true
10
10
  }, /*#__PURE__*/React.createElement(Heading, {
11
+ "aria-label": "loading heading",
11
12
  level: 2
12
13
  }, "Heading")));
13
14
  };
@@ -41,7 +41,7 @@ export var Themed = function Themed() {
41
41
  })), /*#__PURE__*/React.createElement(Box, {
42
42
  gap: "large"
43
43
  }, /*#__PURE__*/React.createElement(Box, {
44
- background: "light-4",
44
+ background: "light-2",
45
45
  pad: "small",
46
46
  fill: "horizontal"
47
47
  }, /*#__PURE__*/React.createElement(Header, {
@@ -2,11 +2,20 @@ var _excluded = ["name", "defaultValue", "value"];
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, { useContext } from 'react';
5
+ import styled from 'styled-components';
5
6
  import { Star } from 'grommet-icons/icons/Star';
6
7
  import { StarOutline } from 'grommet-icons/icons/StarOutline';
8
+ import { Box } from '../Box';
7
9
  import { FormContext } from '../Form/FormContext';
8
10
  import { RadioButtonGroup } from '../RadioButtonGroup';
9
11
  import { useThemeValue } from '../../utils/useThemeValue';
12
+ import { useKeyboard, focusStyle } from '../../utils';
13
+ var StyledStarRatingBox = styled(Box).withConfig({
14
+ displayName: "StarRating__StyledStarRatingBox",
15
+ componentId: "sc-34rgjv-0"
16
+ })(["", ";"], function (props) {
17
+ return props.focus && focusStyle();
18
+ });
10
19
  var StarRating = function StarRating(_ref) {
11
20
  var name = _ref.name,
12
21
  defaultValue = _ref.defaultValue,
@@ -15,6 +24,7 @@ var StarRating = function StarRating(_ref) {
15
24
  var formContext = useContext(FormContext);
16
25
  var _useThemeValue = useThemeValue(),
17
26
  theme = _useThemeValue.theme;
27
+ var usingKeyboard = useKeyboard();
18
28
  var _formContext$useFormI = formContext.useFormInput({
19
29
  name: name,
20
30
  value: valueProp,
@@ -33,13 +43,16 @@ var StarRating = function StarRating(_ref) {
33
43
  onChange: function onChange(event) {
34
44
  setValue(event.value);
35
45
  }
36
- }, rest), function (option) {
46
+ }, rest), function (option, _ref2) {
37
47
  var _theme$starRating, _theme$starRating2;
38
- return option <= value ? /*#__PURE__*/React.createElement(Star, {
48
+ var focus = _ref2.focus;
49
+ return /*#__PURE__*/React.createElement(StyledStarRatingBox, {
50
+ focus: focus && usingKeyboard
51
+ }, option <= value ? /*#__PURE__*/React.createElement(Star, {
39
52
  color: (_theme$starRating = theme.starRating) == null ? void 0 : _theme$starRating.color
40
53
  }) : /*#__PURE__*/React.createElement(StarOutline, {
41
54
  color: (_theme$starRating2 = theme.starRating) == null ? void 0 : _theme$starRating2.color
42
- });
55
+ }));
43
56
  });
44
57
  };
45
58
  StarRating.displayName = 'StarRating';
@@ -271,7 +271,6 @@ var Tabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
271
271
  background: theme.tabs.background
272
272
  }), /*#__PURE__*/React.createElement(Box, _extends({
273
273
  alignSelf: alignControls || ((_theme$tabs$header = theme.tabs.header) == null ? void 0 : _theme$tabs$header.alignSelf),
274
- role: "tablist",
275
274
  flex: false,
276
275
  direction: overflow ? 'row' : 'column'
277
276
  }, tabsHeaderStyles), overflow && /*#__PURE__*/React.createElement(Button, {
@@ -291,6 +290,7 @@ var Tabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
291
290
  }, /*#__PURE__*/React.createElement(Previous, {
292
291
  color: disableLeftArrow ? theme.button.disabled.color : theme.global.colors.text
293
292
  }))), /*#__PURE__*/React.createElement(StyledTabsHeader, _extends({
293
+ role: "tablist",
294
294
  ref: headerRef,
295
295
  direction: "row",
296
296
  justify: overflow ? 'start' : justify,
@@ -34,7 +34,7 @@ var customTheme = deepMerge(grommet, {
34
34
  background: 'dark-1',
35
35
  color: 'accent-1'
36
36
  },
37
- background: 'dark-3',
37
+ background: 'dark-2',
38
38
  border: undefined,
39
39
  color: 'white',
40
40
  hover: {
@@ -51,10 +51,10 @@ var customTheme = deepMerge(grommet, {
51
51
  }
52
52
  },
53
53
  tabs: {
54
- background: 'dark-3',
54
+ background: 'dark-1',
55
55
  gap: 'medium',
56
56
  header: {
57
- background: 'dark-2',
57
+ background: 'dark-3',
58
58
  extend: function extend(_ref3) {
59
59
  var theme = _ref3.theme;
60
60
  return css(["padding:10px;box-shadow:0px 3px 8px rgba(0,0,0,0.5);"]);