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
@@ -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() {
@@ -122,7 +122,7 @@ var RadioButtonGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
122
122
  // on the first radiobutton
123
123
  value === '' && index === 0;
124
124
  if (optionRest.checked) {
125
- console.warn( // eslint-disable-next-line max-len
125
+ console.warn(// eslint-disable-next-line max-len
126
126
  "'checked' prop of an individual RadioButton shouldn't be used in a RadioButtonGroup component. Use the RadioButtonGroup 'value' prop instead.");
127
127
  }
128
128
  return /*#__PURE__*/React.createElement(RadioButton, _extends({
@@ -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));
@@ -8,7 +8,7 @@ import { Keyboard } from '../Keyboard';
8
8
  import { FormContext } from '../Form/FormContext';
9
9
  import { SelectContainer } from './SelectContainer';
10
10
  import { HiddenInput, StyledSelectDropButton } from './StyledSelect';
11
- import { applyKey, getNormalizedValue, changeEvent, getSelectIcon, getDisplayLabelKey, getIconColor } from './utils';
11
+ import { applyKey, getNormalizedValue, changeEvent, getSelectIcon, getDisplayLabelKey, getIconColor, formatValueForA11y } from './utils';
12
12
  import { DefaultSelectTextInput } from './DefaultSelectTextInput';
13
13
  import { MessageContext } from '../../contexts/MessageContext';
14
14
  import { SelectPropTypes } from './propTypes';
@@ -223,7 +223,7 @@ var Select = /*#__PURE__*/forwardRef(function (_ref, ref) {
223
223
  var selectValue = useMemo(function () {
224
224
  if (valueLabel instanceof Function) {
225
225
  if (value || value === 0 || value === false) return valueLabel(value);
226
- } else if (valueLabel) return valueLabel;else if ( /*#__PURE__*/React.isValidElement(value)) return value; // deprecated
226
+ } else if (valueLabel) return valueLabel;else if (/*#__PURE__*/React.isValidElement(value)) return value; // deprecated
227
227
  return undefined;
228
228
  }, [value, valueLabel]);
229
229
  var displayLabelKey = useMemo(function () {
@@ -260,7 +260,7 @@ var Select = /*#__PURE__*/forwardRef(function (_ref, ref) {
260
260
  id: 'select.selected',
261
261
  messages: messages,
262
262
  values: {
263
- currentSelectedValue: value
263
+ currentSelectedValue: formatValueForA11y(value, labelKey)
264
264
  }
265
265
  }) : ''),
266
266
  "aria-expanded": Boolean(open),
@@ -271,7 +271,7 @@ var Select = /*#__PURE__*/forwardRef(function (_ref, ref) {
271
271
  dropTarget: dropTarget,
272
272
  open: open,
273
273
  alignSelf: alignSelf,
274
- focusIndicator: focusIndicator,
274
+ focusIndicator: plain ? focusIndicator : true,
275
275
  onFocus: onFocus,
276
276
  onBlur: onBlur,
277
277
  gridArea: gridArea,
@@ -325,6 +325,8 @@ var Select = /*#__PURE__*/forwardRef(function (_ref, ref) {
325
325
  type: "text",
326
326
  name: name,
327
327
  id: id ? id + "__input" : undefined,
328
+ inert: "" // revisit for React 19
329
+ ,
328
330
  value: inputValue,
329
331
  ref: inputRef,
330
332
  readOnly: true
@@ -332,6 +334,8 @@ var Select = /*#__PURE__*/forwardRef(function (_ref, ref) {
332
334
  a11yTitle: (ariaLabel || a11yTitle) && "" + (ariaLabel || a11yTitle) + (value && typeof value === 'string' ? ", " + value : ''),
333
335
  disabled: disabled,
334
336
  id: id,
337
+ inert: "" // revisit for React 19
338
+ ,
335
339
  name: name,
336
340
  ref: inputRef,
337
341
  placeholder: placeholder,
@@ -39,41 +39,48 @@ var ClearButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
39
39
  fill: "horizontal",
40
40
  ref: ref,
41
41
  onClick: onClear,
42
- focusIndicator: false
43
- }, passThemeFlag, rest), /*#__PURE__*/React.createElement(Box, _extends({}, theme.select.clear.container, {
44
- align: align
45
- }), /*#__PURE__*/React.createElement(Text, theme.select.clear.text, buttonLabel)));
42
+ focusIndicator: false,
43
+ plain: true
44
+ }, passThemeFlag, rest), function (_ref2) {
45
+ var _theme$select$clear;
46
+ var hover = _ref2.hover;
47
+ var boxProps = _extends({}, theme.select.clear.container);
48
+ delete boxProps.hover; // avoid passing hover object to Box
49
+ return /*#__PURE__*/React.createElement(Box, _extends({}, boxProps, hover ? (_theme$select$clear = theme.select.clear) == null || (_theme$select$clear = _theme$select$clear.container) == null ? void 0 : _theme$select$clear.hover : {}, {
50
+ align: align
51
+ }), /*#__PURE__*/React.createElement(Text, theme.select.clear.text, buttonLabel));
52
+ });
46
53
  });
47
- var SelectContainer = /*#__PURE__*/forwardRef(function (_ref2, ref) {
48
- var clear = _ref2.clear,
49
- _ref2$children = _ref2.children,
50
- children = _ref2$children === void 0 ? null : _ref2$children,
51
- disabled = _ref2.disabled,
52
- disabledKey = _ref2.disabledKey,
53
- dropHeight = _ref2.dropHeight,
54
- _ref2$emptySearchMess = _ref2.emptySearchMessage,
55
- emptySearchMessage = _ref2$emptySearchMess === void 0 ? 'No matches found' : _ref2$emptySearchMess,
56
- id = _ref2.id,
57
- labelKey = _ref2.labelKey,
58
- multiple = _ref2.multiple,
59
- name = _ref2.name,
60
- onChange = _ref2.onChange,
61
- onKeyDown = _ref2.onKeyDown,
62
- onMore = _ref2.onMore,
63
- onSearch = _ref2.onSearch,
64
- optionIndexesInValue = _ref2.optionIndexesInValue,
65
- options = _ref2.options,
66
- allOptions = _ref2.allOptions,
67
- searchPlaceholder = _ref2.searchPlaceholder,
68
- search = _ref2.search,
69
- setSearch = _ref2.setSearch,
70
- selected = _ref2.selected,
71
- usingKeyboard = _ref2.usingKeyboard,
72
- _ref2$value = _ref2.value,
73
- value = _ref2$value === void 0 ? '' : _ref2$value,
74
- valueKey = _ref2.valueKey,
75
- _ref2$replace = _ref2.replace,
76
- replace = _ref2$replace === void 0 ? true : _ref2$replace;
54
+ var SelectContainer = /*#__PURE__*/forwardRef(function (_ref3, ref) {
55
+ var clear = _ref3.clear,
56
+ _ref3$children = _ref3.children,
57
+ children = _ref3$children === void 0 ? null : _ref3$children,
58
+ disabled = _ref3.disabled,
59
+ disabledKey = _ref3.disabledKey,
60
+ dropHeight = _ref3.dropHeight,
61
+ _ref3$emptySearchMess = _ref3.emptySearchMessage,
62
+ emptySearchMessage = _ref3$emptySearchMess === void 0 ? 'No matches found' : _ref3$emptySearchMess,
63
+ id = _ref3.id,
64
+ labelKey = _ref3.labelKey,
65
+ multiple = _ref3.multiple,
66
+ name = _ref3.name,
67
+ onChange = _ref3.onChange,
68
+ onKeyDown = _ref3.onKeyDown,
69
+ onMore = _ref3.onMore,
70
+ onSearch = _ref3.onSearch,
71
+ optionIndexesInValue = _ref3.optionIndexesInValue,
72
+ options = _ref3.options,
73
+ allOptions = _ref3.allOptions,
74
+ searchPlaceholder = _ref3.searchPlaceholder,
75
+ search = _ref3.search,
76
+ setSearch = _ref3.setSearch,
77
+ selected = _ref3.selected,
78
+ usingKeyboard = _ref3.usingKeyboard,
79
+ _ref3$value = _ref3.value,
80
+ value = _ref3$value === void 0 ? '' : _ref3$value,
81
+ valueKey = _ref3.valueKey,
82
+ _ref3$replace = _ref3.replace,
83
+ replace = _ref3$replace === void 0 ? true : _ref3$replace;
77
84
  var _useThemeValue2 = useThemeValue(),
78
85
  theme = _useThemeValue2.theme,
79
86
  passThemeFlag = _useThemeValue2.passThemeFlag;
@@ -34,7 +34,7 @@ export interface BasicSelectProps {
34
34
  name?: string;
35
35
  onChange?: (...args: any[]) => void;
36
36
  onClose?: (...args: any[]) => any;
37
- onMore?: (...args: any[]) => any;
37
+ onMore?: () => void;
38
38
  onOpen?: (...args: any[]) => any;
39
39
  onSearch?: (search: string) => void;
40
40
  options: (string | boolean | number | JSX.Element | object)[];
@@ -1,11 +1,12 @@
1
- import { useCallback } from 'react';
1
+ import { useCallback, isValidElement } from 'react';
2
2
  import { normalizeColor } from '../../utils';
3
3
  var _applyKey = function applyKey(option, key) {
4
+ if (/*#__PURE__*/isValidElement(option)) return option;
4
5
  if (option === undefined || option === null) return undefined;
5
6
  if (typeof key === 'object') return _applyKey(option, key.key);
6
7
  if (typeof key === 'function') return key(option);
7
8
  if (key !== undefined && typeof option === 'object') return option[key];
8
- if (typeof option === 'object' && Object.keys(option)) return option[Object.keys(option)[0]];
9
+ if (typeof option === 'object' && Object.keys(option).length > 0) return option[Object.keys(option)[0]];
9
10
  return option;
10
11
  };
11
12
  export { _applyKey as applyKey };
@@ -93,4 +94,15 @@ export var getDisplayLabelKey = function getDisplayLabelKey(labelKey, allOptions
93
94
  };
94
95
  export var getIconColor = function getIconColor(theme) {
95
96
  return normalizeColor(theme.select.icons.color || 'control', theme);
96
- };
97
+ };
98
+ var _formatValueForA11y = function formatValueForA11y(value, labelKey) {
99
+ if (typeof value === 'string') return value;
100
+ if (/*#__PURE__*/isValidElement(value)) return value.toString();
101
+ if (Array.isArray(value)) {
102
+ return value.map(function (item) {
103
+ return _formatValueForA11y(item, labelKey);
104
+ }).join(', ');
105
+ }
106
+ return _applyKey(value, labelKey);
107
+ };
108
+ export { _formatValueForA11y as formatValueForA11y };
@@ -402,6 +402,8 @@ var SelectMultiple = /*#__PURE__*/forwardRef(function (_ref, ref) {
402
402
  defaultCursor: disabled === true || undefined,
403
403
  focusIndicator: false,
404
404
  id: id ? id + "__input" : undefined,
405
+ inert: "" // revisit for React 19
406
+ ,
405
407
  name: name,
406
408
  width: "100%"
407
409
  }, rest, {
@@ -426,6 +428,8 @@ var SelectMultiple = /*#__PURE__*/forwardRef(function (_ref, ref) {
426
428
  type: "text",
427
429
  name: name,
428
430
  id: id ? id + "__input" : undefined,
431
+ inert: "" // revisit for React 19
432
+ ,
429
433
  value: inputValue,
430
434
  ref: inputRef,
431
435
  readOnly: true
@@ -435,6 +439,8 @@ var SelectMultiple = /*#__PURE__*/forwardRef(function (_ref, ref) {
435
439
  a11yTitle: ariaLabel || a11yTitle,
436
440
  disabled: disabled,
437
441
  id: id,
442
+ inert: "" // revisit for React 19
443
+ ,
438
444
  name: name,
439
445
  ref: inputRef,
440
446
  placeholder: placeholder || 'Select',
@@ -461,6 +467,8 @@ var SelectMultiple = /*#__PURE__*/forwardRef(function (_ref, ref) {
461
467
  type: "text",
462
468
  name: name,
463
469
  id: id ? id + "__input" : undefined,
470
+ inert: "" // revisit for React 19
471
+ ,
464
472
  value: inputValue,
465
473
  ref: inputRef,
466
474
  readOnly: true
@@ -468,6 +476,8 @@ var SelectMultiple = /*#__PURE__*/forwardRef(function (_ref, ref) {
468
476
  a11yTitle: ariaLabel || a11yTitle,
469
477
  disabled: disabled,
470
478
  id: id,
479
+ inert: "" // revisit for React 19
480
+ ,
471
481
  name: name,
472
482
  ref: inputRef,
473
483
  placeholder: placeholder,
@@ -364,7 +364,20 @@ var SelectMultipleContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
364
364
  pad: "xsmall",
365
365
  tabIndex: "-1",
366
366
  checked: optionSelected,
367
- disabled: optionDisabled
367
+ disabled: optionDisabled,
368
+ inert: "" // revisit for React 19
369
+ ,
370
+ containerProps: {
371
+ // in Firefox when we have inert set, the checkbox
372
+ // click event gets swallowed by the checkbox.
373
+ // We need the click event to go the the button
374
+ // around the checkbox so we use pointerEvents =
375
+ // none. For code clarity we decided an inline
376
+ // style made sense here.
377
+ style: {
378
+ pointerEvents: 'none'
379
+ }
380
+ }
368
381
  });
369
382
  }
370
383
  if (!children && search) {
@@ -386,7 +399,20 @@ var SelectMultipleContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
386
399
  pad: "xsmall",
387
400
  tabIndex: "-1",
388
401
  checked: optionSelected,
389
- disabled: optionDisabled
402
+ disabled: optionDisabled,
403
+ inert: "" // revisit for React 19
404
+ ,
405
+ containerProps: {
406
+ // in Firefox when we have inert set, the checkbox
407
+ // click event gets swallowed by the checkbox.
408
+ // We need the click event to go the the button
409
+ // around the checkbox so we use pointerEvents =
410
+ // none. For code clarity we decided an inline
411
+ // style made sense here.
412
+ style: {
413
+ pointerEvents: 'none'
414
+ }
415
+ }
390
416
  });
391
417
  }
392
418
  }
@@ -100,7 +100,20 @@ var SelectMultipleValue = function SelectMultipleValue(_ref) {
100
100
  key: optionLabel,
101
101
  pad: "xsmall",
102
102
  tabIndex: "-1",
103
- checked: optionSelected
103
+ checked: optionSelected,
104
+ inert: "" // revisit for React 19
105
+ ,
106
+ containerProps: {
107
+ // in Firefox when we have inert set, the checkbox
108
+ // click event gets swallowed by the checkbox.
109
+ // We need the click event to go the the button
110
+ // around the checkbox so we use pointerEvents =
111
+ // none. For code clarity we decided an inline
112
+ // style made sense here.
113
+ style: {
114
+ pointerEvents: 'none'
115
+ }
116
+ }
104
117
  }));
105
118
  }
106
119
  return undefined;
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  export interface SkipLinksProps {
4
+ id?: string;
4
5
  children: React.ReactNode;
5
6
  messages?: { skipTo?: string };
6
7
  }
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
2
2
  var PropType = {};
3
3
  if (process.env.NODE_ENV !== 'production') {
4
4
  PropType = {
5
+ id: PropTypes.string,
5
6
  children: PropTypes.node.isRequired,
6
7
  messages: PropTypes.shape({
7
8
  skipTo: PropTypes.string
@@ -89,7 +89,7 @@ var Tab = /*#__PURE__*/forwardRef(function (_ref, ref) {
89
89
  }
90
90
  };
91
91
  if (active && disabled) {
92
- console.warn( // eslint-disable-next-line max-len
92
+ console.warn(// eslint-disable-next-line max-len
93
93
  "Warning: Tab props 'active' and 'disabled' have both been set to TRUE on the same Tab resulting in an interesting Tab state. Is this your intent?");
94
94
  }
95
95
  if (!plain) {
@@ -17,7 +17,8 @@ var ScrollableTabs = function ScrollableTabs() {
17
17
  overflow: "auto",
18
18
  pad: "xlarge",
19
19
  align: "center",
20
- background: "light-2"
20
+ background: "light-2",
21
+ tabIndex: 0
21
22
  }, /*#__PURE__*/React.createElement(Heading, null, "Title"), /*#__PURE__*/React.createElement(Paragraph, null, /*#__PURE__*/React.createElement(Text, {
22
23
  weight: "bold"
23
24
  }, "This is a tab with a lot of content. If you scroll down, the tabs header remains in view.")), /*#__PURE__*/React.createElement(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.createElement(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.createElement(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.createElement(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.createElement(Tab, {
@@ -9,10 +9,11 @@ import { Text } from '../Text';
9
9
  import { StyledRemoveButton, StyledTagButton } from './StyledTag';
10
10
  import { useThemeValue } from '../../utils/useThemeValue';
11
11
  var Tag = /*#__PURE__*/forwardRef(function (_ref, ref) {
12
- var _theme$tag$icons, _theme$tag$size, _theme$tag$size2, _theme$tag$size3, _theme$tag$size4;
12
+ var _theme$tag$icons, _theme$tag$size, _theme$tag$size2, _theme$tag$size3, _theme$tag$size4, _theme$tag$size5;
13
13
  var name = _ref.name,
14
14
  value = _ref.value,
15
- size = _ref.size,
15
+ _ref$size = _ref.size,
16
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
16
17
  onRemove = _ref.onRemove,
17
18
  onClick = _ref.onClick,
18
19
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
@@ -44,6 +45,11 @@ var Tag = /*#__PURE__*/forwardRef(function (_ref, ref) {
44
45
  if (onClick && onRemove) {
45
46
  console.warn('Tag cannot combine "onClick" and "onRemove".');
46
47
  }
48
+ var removeProps = !theme.tag.remove.kind ? {
49
+ plain: true,
50
+ hoverIndicator: true,
51
+ focusIndicator: true
52
+ } : {};
47
53
  return onRemove || !onClick ? /*#__PURE__*/React.createElement(Box, _extends({
48
54
  flex: false,
49
55
  direction: "row",
@@ -51,13 +57,11 @@ var Tag = /*#__PURE__*/forwardRef(function (_ref, ref) {
51
57
  min: 'min-content'
52
58
  }
53
59
  }, containerProps), contents, onRemove && /*#__PURE__*/React.createElement(StyledRemoveButton, _extends({
54
- onClick: onRemove,
55
- plain: true,
56
- hoverIndicator: true,
57
- focusIndicator: true,
60
+ onClick: onRemove
61
+ }, removeProps, {
58
62
  icon: /*#__PURE__*/React.createElement(RemoveIcon, (_theme$tag$size3 = theme.tag.size) == null || (_theme$tag$size3 = _theme$tag$size3[size]) == null ? void 0 : _theme$tag$size3.icon),
59
63
  round: ((_theme$tag$size4 = theme.tag.size) == null || (_theme$tag$size4 = _theme$tag$size4[size]) == null ? void 0 : _theme$tag$size4.round) || theme.tag.round
60
- }, theme.tag.remove, passThemeFlag))) : /*#__PURE__*/React.createElement(StyledTagButton, _extends({
64
+ }, theme.tag.remove, (_theme$tag$size5 = theme.tag.size) == null || (_theme$tag$size5 = _theme$tag$size5[size]) == null ? void 0 : _theme$tag$size5.remove, passThemeFlag))) : /*#__PURE__*/React.createElement(StyledTagButton, _extends({
61
65
  flex: false,
62
66
  plain: true,
63
67
  onClick: onClick,
@@ -42,7 +42,7 @@ var defaultDropAlign = {
42
42
  left: 'left'
43
43
  };
44
44
  var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
45
- var _inputRef$current;
45
+ var _inputRef$current, _inputRef$current2;
46
46
  var a11yTitle = _ref.a11yTitle,
47
47
  defaultSuggestion = _ref.defaultSuggestion,
48
48
  defaultValue = _ref.defaultValue,
@@ -231,6 +231,11 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
231
231
  return clearTimeout(timer);
232
232
  };
233
233
  }, [activeSuggestionIndex, showDrop]);
234
+ useEffect(function () {
235
+ if (readOnly && inputRef != null && inputRef.current && inputRef.current.scrollLeft > 0) {
236
+ inputRef.current.scrollLeft = 0;
237
+ }
238
+ }, [readOnly, inputRef, inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.scrollLeft]);
234
239
  var setValueFromSuggestion = function setValueFromSuggestion(event, suggestion) {
235
240
  // if we stole the focus in the drop, perhaps by interacting with
236
241
  // a suggestion button or the scrollbar, give it back
@@ -259,7 +264,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
259
264
  }, [activeSuggestionIndex]);
260
265
 
261
266
  // account for input value in both controlled and uncontrolled scenarios
262
- var hasValue = value || ((_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.value);
267
+ var hasValue = value || ((_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.value);
263
268
  var showStyledPlaceholder = useMemo(function () {
264
269
  return placeholder && typeof placeholder !== 'string' && !hasValue;
265
270
  }, [hasValue, placeholder]);
@@ -18,14 +18,21 @@ var adjustPad = function adjustPad(value, theme) {
18
18
  export var StyledButton = styled(Button).withConfig({
19
19
  displayName: "StyledToggleGroup__StyledButton",
20
20
  componentId: "sc-13k5sx8-0"
21
- })(["border-radius:0;border:none;", ";", " &:hover{border:none;box-shadow:none;}"], function (props) {
22
- return roundStyle(props.round, false, props.theme);
21
+ })(["", " ", ";", " &:hover{", "}"], function (props) {
22
+ return !props.kind && "border: none;";
23
23
  }, function (props) {
24
- var _props$theme, _props$theme2, _props$theme3, _props$theme4;
24
+ return !props.kind && ['border-radius: 0;', props.round && roundStyle(props.round, false, props.theme)];
25
+ }, function (props) {
26
+ var _props$theme, _props$theme2, _props$theme3, _props$theme4, _props$theme5;
25
27
  var themePad = props.icon && !props.label && (_props$theme = props.theme) != null && (_props$theme = _props$theme.toggleGroup) != null && (_props$theme = _props$theme.button) != null && (_props$theme = _props$theme.iconOnly) != null && _props$theme.pad ? (_props$theme2 = props.theme) == null || (_props$theme2 = _props$theme2.toggleGroup) == null || (_props$theme2 = _props$theme2.button) == null || (_props$theme2 = _props$theme2.iconOnly) == null ? void 0 : _props$theme2.pad : (_props$theme3 = props.theme) == null || (_props$theme3 = _props$theme3.toggleGroup.button) == null ? void 0 : _props$theme3.pad;
26
28
 
27
29
  // adjust pad for "kind" themes to align with how "kind" themes
28
30
  // manages this calculation
29
- var pad = (_props$theme4 = props.theme) != null && (_props$theme4 = _props$theme4.button) != null && _props$theme4["default"] ? adjustPad(themePad, props.theme) : themePad;
30
- return edgeStyle('padding', pad, false, undefined, props.theme);
31
+ var pad = (_props$theme4 = props.theme) != null && (_props$theme4 = _props$theme4.button) != null && _props$theme4["default"] && (_props$theme5 = props.theme) != null && (_props$theme5 = _props$theme5.button) != null && _props$theme5.intelligentPad ? adjustPad(themePad, props.theme) : themePad;
32
+ return !props.kind && edgeStyle('padding', pad, false, undefined, props.theme);
33
+ }, function (props) {
34
+ return (
35
+ // remove hover style from StyledButton/StyledButtonKind theme
36
+ !props.kind && "border: none;\n box-shadow: none;"
37
+ );
31
38
  });
@@ -1,7 +1,7 @@
1
1
  var _excluded = ["defaultValue", "multiple", "options", "onToggle", "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
- import React, { useCallback, useState, useRef } from 'react';
4
+ import React, { useCallback, useState, useRef, useMemo } from 'react';
5
5
  import { Box } from '../Box';
6
6
  import { Keyboard } from '../Keyboard';
7
7
  import { ToggleGroupPropTypes } from './propTypes';
@@ -93,6 +93,11 @@ var ToggleGroup = function ToggleGroup(_ref2) {
93
93
  adjustedEvent.value = nextValue;
94
94
  setValue(adjustedEvent);
95
95
  };
96
+
97
+ // if caller defines a button "kind", respect that kind style
98
+ var kind = useMemo(function () {
99
+ return theme.toggleGroup.button.kind;
100
+ }, [theme.toggleGroup.button]);
96
101
  return /*#__PURE__*/React.createElement(Keyboard, {
97
102
  onUp: onPrevious,
98
103
  onDown: onNext,
@@ -127,25 +132,31 @@ var ToggleGroup = function ToggleGroup(_ref2) {
127
132
  optionValue = option;
128
133
  }
129
134
  var active = Array.isArray(value) ? !!value.includes(optionValue) : value === optionValue;
130
- var round = 0;
131
- // round corners of first and last buttons to match container
132
- if (typeof theme.toggleGroup.container.round === 'string' && (index === 0 || index === options.length - 1)) {
133
- round = {
134
- corner: index === 0 ? 'left' : 'right',
135
- size: theme.toggleGroup.container.round
136
- };
135
+ var round;
136
+ if (!kind) {
137
+ var _theme$toggleGroup$bu;
138
+ if ((_theme$toggleGroup$bu = theme.toggleGroup.button.border) != null && _theme$toggleGroup$bu.radius) {
139
+ round = theme.toggleGroup.button.border.radius;
140
+ } else if (typeof theme.toggleGroup.container.round === 'string' && (index === 0 || index === options.length - 1)) {
141
+ // round corners of first and last buttons to match container
142
+ round = {
143
+ corner: index === 0 ? 'left' : 'right',
144
+ size: theme.toggleGroup.container.round
145
+ };
146
+ } else round = 0;
137
147
  }
138
148
  return /*#__PURE__*/React.createElement(Box, {
139
- border: index < options.length - 1 ? {
149
+ border: index < options.length - 1 && theme.toggleGroup.divider ? {
140
150
  side: 'right',
141
151
  color: theme.toggleGroup.divider.color
142
152
  } : undefined,
143
153
  key: optionValue || index
144
154
  }, /*#__PURE__*/React.createElement(StyledButton, _extends({
145
155
  active: active,
146
- "aria-pressed": multiple && active,
147
- "aria-checked": !multiple && active,
156
+ "aria-pressed": multiple ? active : undefined,
157
+ "aria-checked": !multiple ? active : undefined,
148
158
  icon: icon,
159
+ kind: kind,
149
160
  label: label,
150
161
  tip: tip,
151
162
  onClick: function onClick(event) {
@@ -321,7 +321,7 @@ var WorldMap = /*#__PURE__*/forwardRef(function (_ref5, ref) {
321
321
  }, active);
322
322
  }
323
323
  if (content && targets[index]) {
324
- placesContent.push( /*#__PURE__*/React.createElement(Drop, _extends({
324
+ placesContent.push(/*#__PURE__*/React.createElement(Drop, _extends({
325
325
  key: key || name
326
326
  }, dropProps, {
327
327
  target: targets[index]
@@ -104,6 +104,24 @@
104
104
  "openMenu": "Open Menu",
105
105
  "closeMenu": "Close Menu"
106
106
  },
107
+ "meter": {
108
+ "bar": {
109
+ "singular": "Bar meter with value {meterValue} out of {max}",
110
+ "plural": "Bar meter with values {meterValue} out of {max}"
111
+ },
112
+ "circle": {
113
+ "singular": "Circle meter with value {meterValue} out of {max}",
114
+ "plural": "Circle meter with values {meterValue} out of {max}"
115
+ },
116
+ "pie": {
117
+ "singular": "Pie meter with value {meterValue} out of {max}",
118
+ "plural": "Pie meter with values {meterValue} out of {max}"
119
+ },
120
+ "semicircle": {
121
+ "singular": "Semicircle meter with value {meterValue} out of {max}",
122
+ "plural": "Semicircle meter with values {meterValue} out of {max}"
123
+ }
124
+ },
107
125
  "pagination": {
108
126
  "stepLabel": "Items per page",
109
127
  "summary": "Showing {start}-{end} of {total}",