grommet 2.46.0 → 2.47.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 (230) hide show
  1. package/components/Accordion/index.d.ts +7 -1
  2. package/components/AccordionPanel/index.d.ts +4 -1
  3. package/components/Anchor/index.d.ts +7 -1
  4. package/components/Avatar/Avatar.js +4 -3
  5. package/components/Avatar/index.d.ts +9 -1
  6. package/components/Avatar/propTypes.js +2 -1
  7. package/components/Box/Box.js +41 -6
  8. package/components/Box/{ResponsiveContainer.js → ResponsiveContainerProvider.js} +29 -28
  9. package/components/Box/StyledBox.js +13 -2
  10. package/components/Box/index.d.ts +9 -2
  11. package/components/Button/index.d.ts +14 -2
  12. package/components/Calendar/Calendar.js +43 -32
  13. package/components/Calendar/StyledCalendar.js +86 -32
  14. package/components/Calendar/index.d.ts +15 -2
  15. package/components/Calendar/propTypes.js +1 -0
  16. package/components/Cards/index.d.ts +7 -1
  17. package/components/Carousel/index.d.ts +4 -1
  18. package/components/Chart/index.d.ts +7 -1
  19. package/components/CheckBox/index.d.ts +7 -1
  20. package/components/CheckBoxGroup/index.d.ts +15 -2
  21. package/components/Clock/index.d.ts +14 -2
  22. package/components/Collapsible/index.d.ts +4 -1
  23. package/components/Data/index.d.ts +4 -1
  24. package/components/DataFilter/index.d.ts +4 -1
  25. package/components/DataFilters/index.d.ts +4 -1
  26. package/components/DataTable/Body.js +13 -7
  27. package/components/DataTable/DataTable.js +6 -1
  28. package/components/DataTable/index.d.ts +11 -2
  29. package/components/DataTable/propTypes.js +5 -1
  30. package/components/DataTable/stories/rowDetails.stories.js +174 -66
  31. package/components/DataTable/stories/typescript/OnSelect.stories.tsx +3 -3
  32. package/components/DataTableGroupBy/index.d.ts +4 -1
  33. package/components/DataView/index.d.ts +4 -1
  34. package/components/DateInput/index.d.ts +4 -1
  35. package/components/Diagram/index.d.ts +4 -1
  36. package/components/Distribution/index.d.ts +4 -1
  37. package/components/Drop/StyledDrop.js +3 -1
  38. package/components/Drop/index.d.ts +6 -2
  39. package/components/DropButton/index.d.ts +8 -1
  40. package/components/FileInput/index.d.ts +8 -2
  41. package/components/Form/index.d.ts +7 -1
  42. package/components/FormField/index.d.ts +4 -1
  43. package/components/Grid/index.d.ts +4 -1
  44. package/components/Grommet/index.d.ts +18 -1
  45. package/components/Grommet/propTypes.js +11 -0
  46. package/components/Header/stories/typescript/Ref.stories.tsx +1 -1
  47. package/components/Heading/index.d.ts +7 -7
  48. package/components/Image/index.d.ts +4 -1
  49. package/components/InfiniteScroll/index.d.ts +2 -2
  50. package/components/Layer/index.d.ts +4 -1
  51. package/components/List/index.d.ts +9 -3
  52. package/components/Markdown/index.d.ts +5 -1
  53. package/components/MaskedInput/MaskedInput.js +49 -4
  54. package/components/MaskedInput/index.d.ts +7 -1
  55. package/components/MaskedInput/stories/CustomBox.stories.js +1 -0
  56. package/components/MaskedInput/stories/Date.stories.js +1 -0
  57. package/components/MaskedInput/stories/DateRange.stories.js +1 -0
  58. package/components/MaskedInput/stories/DateTimeDrop.stories.js +1 -0
  59. package/components/MaskedInput/stories/Filtered.stories.js +1 -0
  60. package/components/MaskedInput/stories/SizeUnits.stories.js +1 -0
  61. package/components/MaskedInput/stories/Time.stories.js +1 -0
  62. package/components/NameValueList/index.d.ts +8 -1
  63. package/components/Notification/index.d.ts +1 -0
  64. package/components/PageHeader/index.d.ts +5 -1
  65. package/components/Pagination/PaginationStep.js +4 -0
  66. package/components/Pagination/index.d.ts +5 -0
  67. package/components/Pagination/propTypes.js +6 -1
  68. package/components/Paragraph/index.d.ts +7 -1
  69. package/components/RadioButton/index.d.ts +7 -1
  70. package/components/RadioButtonGroup/index.d.ts +7 -1
  71. package/components/RangeInput/index.d.ts +7 -1
  72. package/components/RangeSelector/index.d.ts +15 -2
  73. package/components/RoutedAnchor/index.d.ts +3 -2
  74. package/components/RoutedButton/index.d.ts +3 -2
  75. package/components/Select/Select.js +2 -4
  76. package/components/Select/index.d.ts +7 -1
  77. package/components/Select/utils.js +12 -3
  78. package/components/SelectMultiple/SelectMultiple.js +5 -10
  79. package/components/SelectMultiple/SelectMultipleContainer.js +2 -4
  80. package/components/SelectMultiple/SelectMultipleValue.js +1 -2
  81. package/components/SelectMultiple/index.d.ts +7 -1
  82. package/components/Sidebar/index.d.ts +4 -1
  83. package/components/Stack/index.d.ts +4 -1
  84. package/components/Tab/index.d.ts +7 -1
  85. package/components/Table/index.d.ts +4 -1
  86. package/components/TableBody/index.d.ts +4 -1
  87. package/components/TableCell/index.d.ts +10 -3
  88. package/components/TableFooter/index.d.ts +4 -1
  89. package/components/TableHeader/index.d.ts +4 -1
  90. package/components/TableRow/index.d.ts +4 -1
  91. package/components/Tabs/index.d.ts +4 -1
  92. package/components/Tag/Tag.js +15 -1
  93. package/components/Tag/index.d.ts +6 -0
  94. package/components/Tag/propTypes.js +6 -0
  95. package/components/Text/Text.js +3 -2
  96. package/components/Text/index.d.ts +7 -1
  97. package/components/TextArea/index.d.ts +7 -1
  98. package/components/TextInput/TextInput.js +6 -2
  99. package/components/TextInput/index.d.ts +6 -3
  100. package/components/TextInput/stories/CustomThemed/CustomSuggestions.stories.tsx +2 -1
  101. package/components/TextInput/stories/CustomThemed/Themed.stories.js +1 -0
  102. package/components/TextInput/stories/OnSelect.stories.js +1 -0
  103. package/components/TextInput/stories/WithTags.stories.js +1 -0
  104. package/components/Tip/Tip.js +25 -3
  105. package/components/ToggleGroup/index.d.ts +7 -1
  106. package/components/Toolbar/index.d.ts +5 -2
  107. package/components/Video/index.d.ts +7 -1
  108. package/components/WorldMap/index.d.ts +7 -1
  109. package/es6/components/Accordion/index.d.ts +7 -1
  110. package/es6/components/AccordionPanel/index.d.ts +4 -1
  111. package/es6/components/Anchor/index.d.ts +7 -1
  112. package/es6/components/Avatar/Avatar.js +4 -3
  113. package/es6/components/Avatar/index.d.ts +9 -1
  114. package/es6/components/Avatar/propTypes.js +2 -1
  115. package/es6/components/Box/Box.js +42 -7
  116. package/es6/components/Box/ResponsiveContainerProvider.js +54 -0
  117. package/es6/components/Box/StyledBox.js +12 -2
  118. package/es6/components/Box/index.d.ts +9 -2
  119. package/es6/components/Button/index.d.ts +14 -2
  120. package/es6/components/Calendar/Calendar.js +44 -32
  121. package/es6/components/Calendar/StyledCalendar.js +86 -32
  122. package/es6/components/Calendar/index.d.ts +15 -2
  123. package/es6/components/Calendar/propTypes.js +1 -0
  124. package/es6/components/Cards/index.d.ts +7 -1
  125. package/es6/components/Carousel/index.d.ts +4 -1
  126. package/es6/components/Chart/index.d.ts +7 -1
  127. package/es6/components/CheckBox/index.d.ts +7 -1
  128. package/es6/components/CheckBoxGroup/index.d.ts +15 -2
  129. package/es6/components/Clock/index.d.ts +14 -2
  130. package/es6/components/Collapsible/index.d.ts +4 -1
  131. package/es6/components/Data/index.d.ts +4 -1
  132. package/es6/components/DataFilter/index.d.ts +4 -1
  133. package/es6/components/DataFilters/index.d.ts +4 -1
  134. package/es6/components/DataTable/Body.js +13 -7
  135. package/es6/components/DataTable/DataTable.js +6 -1
  136. package/es6/components/DataTable/index.d.ts +11 -2
  137. package/es6/components/DataTable/propTypes.js +5 -1
  138. package/es6/components/DataTable/stories/rowDetails.stories.js +172 -66
  139. package/es6/components/DataTable/stories/typescript/OnSelect.stories.tsx +3 -3
  140. package/es6/components/DataTableGroupBy/index.d.ts +4 -1
  141. package/es6/components/DataView/index.d.ts +4 -1
  142. package/es6/components/DateInput/index.d.ts +4 -1
  143. package/es6/components/Diagram/index.d.ts +4 -1
  144. package/es6/components/Distribution/index.d.ts +4 -1
  145. package/es6/components/Drop/StyledDrop.js +3 -1
  146. package/es6/components/Drop/index.d.ts +6 -2
  147. package/es6/components/DropButton/index.d.ts +8 -1
  148. package/es6/components/FileInput/index.d.ts +8 -2
  149. package/es6/components/Form/index.d.ts +7 -1
  150. package/es6/components/FormField/index.d.ts +4 -1
  151. package/es6/components/Grid/index.d.ts +4 -1
  152. package/es6/components/Grommet/index.d.ts +18 -1
  153. package/es6/components/Grommet/propTypes.js +11 -0
  154. package/es6/components/Header/stories/typescript/Ref.stories.tsx +1 -1
  155. package/es6/components/Heading/index.d.ts +7 -7
  156. package/es6/components/Image/index.d.ts +4 -1
  157. package/es6/components/InfiniteScroll/index.d.ts +2 -2
  158. package/es6/components/Layer/index.d.ts +4 -1
  159. package/es6/components/List/index.d.ts +9 -3
  160. package/es6/components/Markdown/index.d.ts +5 -1
  161. package/es6/components/MaskedInput/MaskedInput.js +49 -4
  162. package/es6/components/MaskedInput/index.d.ts +7 -1
  163. package/es6/components/MaskedInput/stories/CustomBox.stories.js +1 -0
  164. package/es6/components/MaskedInput/stories/Date.stories.js +1 -0
  165. package/es6/components/MaskedInput/stories/DateRange.stories.js +1 -0
  166. package/es6/components/MaskedInput/stories/DateTimeDrop.stories.js +1 -0
  167. package/es6/components/MaskedInput/stories/Filtered.stories.js +1 -0
  168. package/es6/components/MaskedInput/stories/SizeUnits.stories.js +1 -0
  169. package/es6/components/MaskedInput/stories/Time.stories.js +1 -0
  170. package/es6/components/NameValueList/index.d.ts +8 -1
  171. package/es6/components/Notification/index.d.ts +1 -0
  172. package/es6/components/PageHeader/index.d.ts +5 -1
  173. package/es6/components/Pagination/PaginationStep.js +4 -0
  174. package/es6/components/Pagination/index.d.ts +5 -0
  175. package/es6/components/Pagination/propTypes.js +6 -1
  176. package/es6/components/Paragraph/index.d.ts +7 -1
  177. package/es6/components/RadioButton/index.d.ts +7 -1
  178. package/es6/components/RadioButtonGroup/index.d.ts +7 -1
  179. package/es6/components/RangeInput/index.d.ts +7 -1
  180. package/es6/components/RangeSelector/index.d.ts +15 -2
  181. package/es6/components/RoutedAnchor/index.d.ts +3 -2
  182. package/es6/components/RoutedButton/index.d.ts +3 -2
  183. package/es6/components/Select/Select.js +3 -5
  184. package/es6/components/Select/index.d.ts +7 -1
  185. package/es6/components/Select/utils.js +9 -2
  186. package/es6/components/SelectMultiple/SelectMultiple.js +6 -11
  187. package/es6/components/SelectMultiple/SelectMultipleContainer.js +3 -5
  188. package/es6/components/SelectMultiple/SelectMultipleValue.js +2 -3
  189. package/es6/components/SelectMultiple/index.d.ts +7 -1
  190. package/es6/components/Sidebar/index.d.ts +4 -1
  191. package/es6/components/Stack/index.d.ts +4 -1
  192. package/es6/components/Tab/index.d.ts +7 -1
  193. package/es6/components/Table/index.d.ts +4 -1
  194. package/es6/components/TableBody/index.d.ts +4 -1
  195. package/es6/components/TableCell/index.d.ts +10 -3
  196. package/es6/components/TableFooter/index.d.ts +4 -1
  197. package/es6/components/TableHeader/index.d.ts +4 -1
  198. package/es6/components/TableRow/index.d.ts +4 -1
  199. package/es6/components/Tabs/index.d.ts +4 -1
  200. package/es6/components/Tag/Tag.js +16 -2
  201. package/es6/components/Tag/index.d.ts +6 -0
  202. package/es6/components/Tag/propTypes.js +6 -0
  203. package/es6/components/Text/Text.js +3 -2
  204. package/es6/components/Text/index.d.ts +7 -1
  205. package/es6/components/TextArea/index.d.ts +7 -1
  206. package/es6/components/TextInput/TextInput.js +6 -2
  207. package/es6/components/TextInput/index.d.ts +6 -3
  208. package/es6/components/TextInput/stories/CustomThemed/CustomSuggestions.stories.tsx +2 -1
  209. package/es6/components/TextInput/stories/CustomThemed/Themed.stories.js +1 -0
  210. package/es6/components/TextInput/stories/OnSelect.stories.js +1 -0
  211. package/es6/components/TextInput/stories/WithTags.stories.js +1 -0
  212. package/es6/components/Tip/Tip.js +26 -3
  213. package/es6/components/ToggleGroup/index.d.ts +7 -1
  214. package/es6/components/Toolbar/index.d.ts +5 -2
  215. package/es6/components/Video/index.d.ts +7 -1
  216. package/es6/components/WorldMap/index.d.ts +7 -1
  217. package/es6/languages/default.json +6 -0
  218. package/es6/utils/mixins.js +2 -1
  219. package/es6/utils/responsive.js +8 -7
  220. package/grommet.min.js +1 -1
  221. package/grommet.min.js.map +1 -1
  222. package/languages/default.json +6 -0
  223. package/package.json +43 -43
  224. package/utils/mixins.js +2 -1
  225. package/utils/responsive.js +8 -7
  226. package/components/Box/StyledResponsiveContainer.js +0 -11
  227. package/components/Drop/stories/TrapFocus.stories.js +0 -86
  228. package/es6/components/Box/ResponsiveContainer.js +0 -52
  229. package/es6/components/Box/StyledResponsiveContainer.js +0 -6
  230. package/es6/components/Drop/stories/TrapFocus.stories.js +0 -82
@@ -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, formatValueForA11y } from './utils';
11
+ import { applyKey, getNormalizedValue, changeEvent, getSelectIcon, getDisplayLabelKey, getIconColor, formatValueForA11y, inertTrueValue } from './utils';
12
12
  import { DefaultSelectTextInput } from './DefaultSelectTextInput';
13
13
  import { MessageContext } from '../../contexts/MessageContext';
14
14
  import { SelectPropTypes } from './propTypes';
@@ -325,8 +325,7 @@ 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
+ inert: inertTrueValue,
330
329
  value: inputValue,
331
330
  ref: inputRef,
332
331
  readOnly: true
@@ -334,8 +333,7 @@ var Select = /*#__PURE__*/forwardRef(function (_ref, ref) {
334
333
  a11yTitle: (ariaLabel || a11yTitle) && "" + (ariaLabel || a11yTitle) + (value && typeof value === 'string' ? ", " + value : ''),
335
334
  disabled: disabled,
336
335
  id: id,
337
- inert: "" // revisit for React 19
338
- ,
336
+ inert: inertTrueValue,
339
337
  name: name,
340
338
  ref: inputRef,
341
339
  placeholder: placeholder,
@@ -63,7 +63,13 @@ export interface SelectProps extends BasicSelectProps {
63
63
  // value, name, id, onChange, placeholder
64
64
  export interface SelectExtendedProps
65
65
  extends SelectProps,
66
- Omit<JSX.IntrinsicElements['input'], keyof SelectProps | 'readOnly'> {}
66
+ Omit<
67
+ React.DetailedHTMLProps<
68
+ React.InputHTMLAttributes<HTMLInputElement>,
69
+ HTMLInputElement
70
+ >,
71
+ keyof SelectProps | 'readOnly'
72
+ > {}
67
73
 
68
74
  declare const Select: React.FC<SelectExtendedProps>;
69
75
 
@@ -1,4 +1,4 @@
1
- import { useCallback, isValidElement } from 'react';
1
+ import React, { useCallback, isValidElement } from 'react';
2
2
  import { normalizeColor } from '../../utils';
3
3
  var _applyKey = function applyKey(option, key) {
4
4
  if (/*#__PURE__*/isValidElement(option)) return option;
@@ -105,4 +105,11 @@ var _formatValueForA11y = function formatValueForA11y(value, labelKey) {
105
105
  }
106
106
  return _applyKey(value, labelKey);
107
107
  };
108
- export { _formatValueForA11y as formatValueForA11y };
108
+
109
+ // In react 18 and below the inert attribute is not supported
110
+ // so we use an empty string instead of true. In react 19 and above
111
+ // inert is supported so we should use true. The use function is
112
+ // used to determine the react version because it is only available
113
+ // in react 19 and above.
114
+ export { _formatValueForA11y as formatValueForA11y };
115
+ export var inertTrueValue = React.use ? true : '';
@@ -11,7 +11,7 @@ import { FormContext } from '../Form/FormContext';
11
11
  import { SelectMultipleValue } from './SelectMultipleValue';
12
12
  import { SelectMultipleContainer } from './SelectMultipleContainer';
13
13
  import { HiddenInput, SelectTextInput, StyledSelectDropButton } from '../Select/StyledSelect';
14
- import { applyKey, getNormalizedValue, changeEvent, getSelectIcon, getIconColor, getDisplayLabelKey, arrayIncludes } from '../Select/utils';
14
+ import { applyKey, getNormalizedValue, changeEvent, getSelectIcon, getIconColor, getDisplayLabelKey, arrayIncludes, inertTrueValue } from '../Select/utils';
15
15
  import { DefaultSelectTextInput } from '../Select/DefaultSelectTextInput';
16
16
  import { MessageContext } from '../../contexts/MessageContext';
17
17
  import { SelectMultiplePropTypes } from './propTypes';
@@ -402,8 +402,7 @@ 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
+ inert: inertTrueValue,
407
406
  name: name,
408
407
  width: "100%"
409
408
  }, rest, {
@@ -426,8 +425,7 @@ var SelectMultiple = /*#__PURE__*/forwardRef(function (_ref, ref) {
426
425
  type: "text",
427
426
  name: name,
428
427
  id: id ? id + "__input" : undefined,
429
- inert: "" // revisit for React 19
430
- ,
428
+ inert: inertTrueValue,
431
429
  value: inputValue,
432
430
  ref: inputRef,
433
431
  readOnly: true
@@ -437,8 +435,7 @@ var SelectMultiple = /*#__PURE__*/forwardRef(function (_ref, ref) {
437
435
  a11yTitle: ariaLabel || a11yTitle,
438
436
  disabled: disabled,
439
437
  id: id,
440
- inert: "" // revisit for React 19
441
- ,
438
+ inert: inertTrueValue,
442
439
  name: name,
443
440
  ref: inputRef,
444
441
  placeholder: placeholder || 'Select',
@@ -465,8 +462,7 @@ var SelectMultiple = /*#__PURE__*/forwardRef(function (_ref, ref) {
465
462
  type: "text",
466
463
  name: name,
467
464
  id: id ? id + "__input" : undefined,
468
- inert: "" // revisit for React 19
469
- ,
465
+ inert: inertTrueValue,
470
466
  value: inputValue,
471
467
  ref: inputRef,
472
468
  readOnly: true
@@ -474,8 +470,7 @@ var SelectMultiple = /*#__PURE__*/forwardRef(function (_ref, ref) {
474
470
  a11yTitle: ariaLabel || a11yTitle,
475
471
  disabled: disabled,
476
472
  id: id,
477
- inert: "" // revisit for React 19
478
- ,
473
+ inert: inertTrueValue,
479
474
  name: name,
480
475
  ref: inputRef,
481
476
  placeholder: placeholder,
@@ -10,7 +10,7 @@ import { Text } from '../Text';
10
10
  import { TextInput } from '../TextInput';
11
11
  import { SelectionSummary } from './SelectionSummary';
12
12
  import { StyledContainer, OptionsContainer, SelectOption } from '../Select/StyledSelect';
13
- import { applyKey, getOptionLabel, getOptionValue, useDisabled, getOptionIndex, arrayIncludes } from '../Select/utils';
13
+ import { applyKey, getOptionLabel, getOptionValue, useDisabled, getOptionIndex, arrayIncludes, inertTrueValue } from '../Select/utils';
14
14
  import { EmptySearchOption } from '../Select/EmptySearchOption';
15
15
  import { MessageContext } from '../../contexts/MessageContext';
16
16
  import { useThemeValue } from '../../utils/useThemeValue';
@@ -366,8 +366,7 @@ var SelectMultipleContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
366
366
  tabIndex: "-1",
367
367
  checked: optionSelected,
368
368
  disabled: optionDisabled,
369
- inert: "" // revisit for React 19
370
- ,
369
+ inert: inertTrueValue,
371
370
  containerProps: {
372
371
  // in Firefox when we have inert set, the checkbox
373
372
  // click event gets swallowed by the checkbox.
@@ -401,8 +400,7 @@ var SelectMultipleContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
401
400
  tabIndex: "-1",
402
401
  checked: optionSelected,
403
402
  disabled: optionDisabled,
404
- inert: "" // revisit for React 19
405
- ,
403
+ inert: inertTrueValue,
406
404
  containerProps: {
407
405
  // in Firefox when we have inert set, the checkbox
408
406
  // click event gets swallowed by the checkbox.
@@ -3,7 +3,7 @@ import { Box } from '../Box';
3
3
  import { Button } from '../Button';
4
4
  import { CheckBox } from '../CheckBox';
5
5
  import { SelectOption } from '../Select/StyledSelect';
6
- import { applyKey, getOptionLabel, useDisabled, arrayIncludes, getOptionIndex } from '../Select/utils';
6
+ import { applyKey, getOptionLabel, useDisabled, arrayIncludes, getOptionIndex, inertTrueValue } from '../Select/utils';
7
7
  import { MessageContext } from '../../contexts/MessageContext';
8
8
  var SelectMultipleValue = function SelectMultipleValue(_ref) {
9
9
  var allOptions = _ref.allOptions,
@@ -101,8 +101,7 @@ var SelectMultipleValue = function SelectMultipleValue(_ref) {
101
101
  pad: "xsmall",
102
102
  tabIndex: "-1",
103
103
  checked: optionSelected,
104
- inert: "" // revisit for React 19
105
- ,
104
+ inert: inertTrueValue,
106
105
  containerProps: {
107
106
  // in Firefox when we have inert set, the checkbox
108
107
  // click event gets swallowed by the checkbox.
@@ -31,7 +31,13 @@ export interface SelectMultipleProps extends BasicSelectProps {
31
31
  // value, name, id, onChange, placeholder
32
32
  export interface SelectMultipleExtendedProps
33
33
  extends SelectMultipleProps,
34
- Omit<JSX.IntrinsicElements['input'], keyof SelectMultipleProps> {}
34
+ Omit<
35
+ React.DetailedHTMLProps<
36
+ React.InputHTMLAttributes<HTMLInputElement>,
37
+ HTMLInputElement
38
+ >,
39
+ keyof SelectMultipleProps
40
+ > {}
35
41
 
36
42
  declare const SelectMultiple: React.FC<SelectMultipleExtendedProps>;
37
43
 
@@ -6,7 +6,10 @@ export interface SidebarProps {
6
6
  header?: React.ReactNode;
7
7
  }
8
8
 
9
- type divProps = Omit<JSX.IntrinsicElements['div'], 'onClick'>;
9
+ type divProps = Omit<
10
+ React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
11
+ 'onClick'
12
+ >;
10
13
 
11
14
  export interface SidebarExtendedProps
12
15
  extends BoxProps,
@@ -27,7 +27,10 @@ export interface StackProps {
27
27
  margin?: MarginType;
28
28
  }
29
29
 
30
- type divProps = JSX.IntrinsicElements['div'];
30
+ type divProps = React.DetailedHTMLProps<
31
+ React.HTMLAttributes<HTMLDivElement>,
32
+ HTMLDivElement
33
+ >;
31
34
 
32
35
  export interface StackExtendedProps extends StackProps, divProps {}
33
36
 
@@ -12,7 +12,13 @@ export interface TabProps {
12
12
 
13
13
  export interface TabExtendedProps
14
14
  extends TabProps,
15
- Omit<JSX.IntrinsicElements['button'], 'title'> {}
15
+ Omit<
16
+ React.DetailedHTMLProps<
17
+ React.ButtonHTMLAttributes<HTMLButtonElement>,
18
+ HTMLButtonElement
19
+ >,
20
+ 'title'
21
+ > {}
16
22
 
17
23
  declare const Tab: React.FC<TabExtendedProps>;
18
24
 
@@ -14,7 +14,10 @@ export interface TableProps {
14
14
  margin?: MarginType;
15
15
  }
16
16
 
17
- type htmlTableProps = JSX.IntrinsicElements['table'];
17
+ type htmlTableProps = React.DetailedHTMLProps<
18
+ React.HTMLAttributes<HTMLTableElement>,
19
+ HTMLTableElement
20
+ >;
18
21
 
19
22
  export interface TableExtendedProps extends TableProps, htmlTableProps {}
20
23
 
@@ -2,7 +2,10 @@ import * as React from 'react';
2
2
 
3
3
  export interface TableBodyProps {}
4
4
 
5
- type htmlTableBodyProps = JSX.IntrinsicElements['tbody'];
5
+ type htmlTableBodyProps = React.DetailedHTMLProps<
6
+ React.HTMLAttributes<HTMLTableSectionElement>,
7
+ HTMLTableSectionElement
8
+ >;
6
9
 
7
10
  export interface TableBodyExtendedProps
8
11
  extends TableBodyProps,
@@ -22,12 +22,19 @@ export interface TableCellProps {
22
22
  verticalAlign?: 'top' | 'middle' | 'bottom';
23
23
  }
24
24
 
25
- // We combine BoxTypes & JSX.IntrinsicElements['td'] inline here since BoxTypes
26
- // is a combination of BoxProps & JSX.IntrinsicElements['div'], and there is a
25
+ // We combine BoxTypes & React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableCellElement>, HTMLTableCellElement> inline here since BoxTypes
26
+ // is a combination of BoxProps & React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, and there is a
27
27
  // large overlap between td and div attributes.
28
28
  export interface TableCellExtendedProps
29
29
  extends TableCellProps,
30
- Omit<BoxTypes & JSX.IntrinsicElements['td'], 'scope'> {}
30
+ Omit<
31
+ BoxTypes &
32
+ React.DetailedHTMLProps<
33
+ React.TdHTMLAttributes<HTMLTableCellElement>,
34
+ HTMLTableCellElement
35
+ >,
36
+ 'scope'
37
+ > {}
31
38
 
32
39
  declare const TableCell: React.FC<TableCellExtendedProps>;
33
40
 
@@ -2,7 +2,10 @@ import * as React from 'react';
2
2
 
3
3
  export interface TableFooterProps {}
4
4
 
5
- type htmlTableFooterProps = JSX.IntrinsicElements['tfoot'];
5
+ type htmlTableFooterProps = React.DetailedHTMLProps<
6
+ React.HTMLAttributes<HTMLTableSectionElement>,
7
+ HTMLTableSectionElement
8
+ >;
6
9
 
7
10
  export interface TableFooterExtendedProps
8
11
  extends TableFooterProps,
@@ -2,7 +2,10 @@ import * as React from 'react';
2
2
 
3
3
  export interface TableHeaderProps {}
4
4
 
5
- type htmlTableHeaderProps = JSX.IntrinsicElements['thead'];
5
+ type htmlTableHeaderProps = React.DetailedHTMLProps<
6
+ React.HTMLAttributes<HTMLTableSectionElement>,
7
+ HTMLTableSectionElement
8
+ >;
6
9
 
7
10
  export interface TableHeaderExtendedProps
8
11
  extends TableHeaderProps,
@@ -2,7 +2,10 @@ import * as React from 'react';
2
2
 
3
3
  export interface TableRowProps {}
4
4
 
5
- type htmlTableRowProps = JSX.IntrinsicElements['tr'];
5
+ type htmlTableRowProps = React.DetailedHTMLProps<
6
+ React.HTMLAttributes<HTMLTableRowElement>,
7
+ HTMLTableRowElement
8
+ >;
6
9
 
7
10
  export interface TableRowExtendedProps
8
11
  extends TableRowProps,
@@ -20,7 +20,10 @@ export interface TabsProps {
20
20
  onActive?: (index: number) => void;
21
21
  }
22
22
 
23
- type divProps = Omit<JSX.IntrinsicElements['div'], 'children'>;
23
+ type divProps = Omit<
24
+ React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
25
+ 'children'
26
+ >;
24
27
 
25
28
  export interface TabsExtendedProps extends TabsProps, divProps {}
26
29
 
@@ -1,13 +1,14 @@
1
- var _excluded = ["name", "value", "size", "onRemove", "onClick"];
1
+ var _excluded = ["name", "value", "size", "onRemove", "onClick", "messages"];
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 (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
- import React, { forwardRef } from 'react';
4
+ import React, { useContext, forwardRef } from 'react';
5
5
  import { FormClose } from 'grommet-icons/icons/FormClose';
6
6
  import { TagPropTypes } from './propTypes';
7
7
  import { Box } from '../Box';
8
8
  import { Text } from '../Text';
9
9
  import { StyledRemoveButton, StyledTagButton } from './StyledTag';
10
10
  import { useThemeValue } from '../../utils/useThemeValue';
11
+ import { MessageContext } from '../../contexts/MessageContext';
11
12
  var Tag = /*#__PURE__*/forwardRef(function (_ref, ref) {
12
13
  var _theme$tag$icons, _theme$tag$size, _theme$tag$size2, _theme$tag$size3, _theme$tag$size4, _theme$tag$size5;
13
14
  var name = _ref.name,
@@ -16,11 +17,23 @@ var Tag = /*#__PURE__*/forwardRef(function (_ref, ref) {
16
17
  size = _ref$size === void 0 ? 'medium' : _ref$size,
17
18
  onRemove = _ref.onRemove,
18
19
  onClick = _ref.onClick,
20
+ messages = _ref.messages,
19
21
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
22
+ var _useContext = useContext(MessageContext),
23
+ format = _useContext.format;
20
24
  var _useThemeValue = useThemeValue(),
21
25
  theme = _useThemeValue.theme,
22
26
  passThemeFlag = _useThemeValue.passThemeFlag;
23
27
  var RemoveIcon = ((_theme$tag$icons = theme.tag.icons) == null ? void 0 : _theme$tag$icons.remove) || FormClose;
28
+ var removeLabelId = name ? 'tag.removeLabel.nameAndValue' : 'tag.removeLabel.valueOnly';
29
+ var removeLabel = format({
30
+ id: removeLabelId,
31
+ messages: messages,
32
+ values: {
33
+ name: name,
34
+ value: value
35
+ }
36
+ });
24
37
  var containerProps = _extends({
25
38
  ref: ref,
26
39
  align: 'center',
@@ -59,6 +72,7 @@ var Tag = /*#__PURE__*/forwardRef(function (_ref, ref) {
59
72
  }, containerProps), contents, onRemove && /*#__PURE__*/React.createElement(StyledRemoveButton, _extends({
60
73
  onClick: onRemove
61
74
  }, removeProps, {
75
+ "aria-label": removeLabel,
62
76
  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),
63
77
  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
64
78
  }, 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({
@@ -5,6 +5,12 @@ export interface TagProps {
5
5
  name?: string;
6
6
  onClick?: (...args: any[]) => any;
7
7
  onRemove?: (...args: any[]) => any;
8
+ messages?: {
9
+ removeLabel?: {
10
+ nameAndValue?: string;
11
+ valueOnly?: string;
12
+ };
13
+ };
8
14
  size?:
9
15
  | 'xsmall'
10
16
  | 'small'
@@ -6,6 +6,12 @@ if (process.env.NODE_ENV !== 'production') {
6
6
  value: PropTypes.string.isRequired,
7
7
  onClick: PropTypes.func,
8
8
  onRemove: PropTypes.func,
9
+ messages: PropTypes.shape({
10
+ removeLabel: PropTypes.shape({
11
+ nameAndValue: PropTypes.string,
12
+ valueOnly: PropTypes.string
13
+ })
14
+ }),
9
15
  size: PropTypes.oneOfType([PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge']), PropTypes.string])
10
16
  };
11
17
  }
@@ -72,18 +72,19 @@ var Text = /*#__PURE__*/forwardRef(function (_ref, ref) {
72
72
  }), children !== undefined ? /*#__PURE__*/React.createElement(TextContext.Provider, {
73
73
  value: textContextValue
74
74
  }, children) : undefined);
75
+ var tipProps = tipProp && typeof tipProp === 'object' ? tipProp : {};
75
76
  if (tipProp || textTruncated) {
76
77
  // place the text content in a tip if truncate === 'tip'
77
78
  // and the text has been truncated
78
79
  if (textTruncated) {
79
80
  return /*#__PURE__*/React.createElement(Tip, _extends({
80
81
  content: children
81
- }, tipProp), styledTextResult);
82
+ }, tipProps), styledTextResult);
82
83
  }
83
84
  // place the text content in a tip if truncate !== 'tip'
84
85
  // it displays even if the text has not truncated
85
86
  if (truncate !== 'tip') {
86
- return /*#__PURE__*/React.createElement(Tip, tipProp, styledTextResult);
87
+ return /*#__PURE__*/React.createElement(Tip, tipProps, styledTextResult);
87
88
  }
88
89
  }
89
90
  return styledTextResult;
@@ -43,7 +43,13 @@ export interface TextProps {
43
43
  }
44
44
  export interface TextExtendedProps
45
45
  extends TextProps,
46
- Omit<JSX.IntrinsicElements['span'], 'color'> {}
46
+ Omit<
47
+ React.DetailedHTMLProps<
48
+ React.HTMLAttributes<HTMLSpanElement>,
49
+ HTMLSpanElement
50
+ >,
51
+ 'color'
52
+ > {}
47
53
 
48
54
  declare const Text: React.FC<TextExtendedProps>;
49
55
  export type TextType = TextProps;
@@ -14,7 +14,13 @@ export interface TextAreaProps {
14
14
  value?: string;
15
15
  }
16
16
 
17
- type textareaProps = Omit<JSX.IntrinsicElements['textarea'], 'value'>;
17
+ type textareaProps = Omit<
18
+ React.DetailedHTMLProps<
19
+ React.TextareaHTMLAttributes<HTMLTextAreaElement>,
20
+ HTMLTextAreaElement
21
+ >,
22
+ 'value'
23
+ >;
18
24
 
19
25
  export interface TextAreaExtendedProps extends TextAreaProps, textareaProps {}
20
26
 
@@ -333,7 +333,8 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
333
333
  },
334
334
  onMouseMove: mouseMovedSinceLastKey && activeSuggestionIndex !== index ? function () {
335
335
  return setActiveSuggestionIndex(index);
336
- } : undefined
336
+ } : undefined,
337
+ keyboard: !mouseMovedSinceLastKey
337
338
  }, child));
338
339
  }))));
339
340
  }
@@ -390,7 +391,10 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
390
391
  ,
391
392
  readOnlyCopy: readOnlyCopy,
392
393
  plain: plain,
393
- border: !plain
394
+ border: !plain,
395
+ onMouseMove: function onMouseMove() {
396
+ return setMouseMovedSinceLastKey(true);
397
+ }
394
398
  }, passThemeFlag), reverse && readOnlyCopy && ReadOnlyCopyButton, showStyledPlaceholder && /*#__PURE__*/React.createElement(StyledPlaceholder, passThemeFlag, placeholder), textInputIcon && !readOnly && /*#__PURE__*/React.createElement(StyledIcon, {
395
399
  reverse: reverse,
396
400
  theme: theme
@@ -10,7 +10,10 @@ import { DropType } from '../Drop';
10
10
 
11
11
  export interface TextInputProps
12
12
  extends Omit<
13
- JSX.IntrinsicElements['input'],
13
+ React.DetailedHTMLProps<
14
+ React.InputHTMLAttributes<HTMLInputElement>,
15
+ HTMLInputElement
16
+ >,
14
17
  'onSelect' | 'size' | 'placeholder' | 'width'
15
18
  > {
16
19
  a11yTitle?: A11yTitleType;
@@ -35,11 +38,11 @@ export interface TextInputProps
35
38
  };
36
39
  name?: string;
37
40
  onSelect?: (x: {
38
- target: React.RefObject<HTMLElement>['current'];
41
+ target: React.RefObject<HTMLElement | null>['current'];
39
42
  suggestion: any;
40
43
  }) => void;
41
44
  onSuggestionSelect?: (x: {
42
- target: React.RefObject<HTMLElement>['current'];
45
+ target: React.RefObject<HTMLElement | null>['current'];
43
46
  suggestion: any;
44
47
  }) => void;
45
48
  onSuggestionsOpen?: () => void;
@@ -99,7 +99,7 @@ export const CustomSuggestions = () => {
99
99
  const [value, setValue] = useState('');
100
100
  const [suggestionOpen, setSuggestionOpen] = useState(false);
101
101
  const [suggestions, setSuggestions] = useState([]);
102
- const boxRef = useRef();
102
+ const boxRef = useRef(undefined);
103
103
 
104
104
  const onChange = useCallback((event) => {
105
105
  const { value: newValue } = event.target;
@@ -156,6 +156,7 @@ export const CustomSuggestions = () => {
156
156
  >
157
157
  <Search color="brand" />
158
158
  <TextInput
159
+ id="grommet-custom-suggestions"
159
160
  dropTarget={boxRef.current}
160
161
  placeholder="Enter your name..."
161
162
  plain
@@ -56,6 +56,7 @@ export var Themed = function Themed() {
56
56
  }, /*#__PURE__*/React.createElement(Box, {
57
57
  width: "medium"
58
58
  }, /*#__PURE__*/React.createElement(TextInput, {
59
+ id: "grommet-password",
59
60
  type: "password",
60
61
  value: value,
61
62
  dropProps: {
@@ -30,6 +30,7 @@ export var OnSelect = function OnSelect() {
30
30
  }, /*#__PURE__*/React.createElement(Box, {
31
31
  width: "medium"
32
32
  }, /*#__PURE__*/React.createElement(TextInput, {
33
+ id: "grommet-onselect",
33
34
  value: value,
34
35
  onChange: onChange,
35
36
  onSelect: onHighlight,
@@ -135,6 +135,7 @@ export var WithTags = function WithTags() {
135
135
  React.createElement(Box, {
136
136
  pad: "small"
137
137
  }, /*#__PURE__*/React.createElement(TagInput, {
138
+ id: "grommet-tag-input",
138
139
  placeholder: "Search for aliases...",
139
140
  suggestions: suggestions,
140
141
  value: selectedTags,
@@ -2,9 +2,26 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
2
2
  import React, { Children, cloneElement, forwardRef, useEffect, useState } from 'react';
3
3
  import { Box } from '../Box';
4
4
  import { Drop } from '../Drop';
5
+ import { Keyboard } from '../Keyboard';
5
6
  import { useForwardedRef, useKeyboard } from '../../utils';
6
7
  import { TipPropTypes } from './propTypes';
7
8
  import { useThemeValue } from '../../utils/useThemeValue';
9
+
10
+ /*
11
+ * This function getReactNodeRef is adapted from
12
+ * [Material UI] (https://github.com/mui/material-ui)
13
+ * Licensed under the MIT License (c) 2024 aarongarciah
14
+ * The function has been modified from its original version.
15
+ */
16
+ var getReactNodeRef = function getReactNodeRef(element) {
17
+ if (!element || ! /*#__PURE__*/React.isValidElement(element)) {
18
+ return null;
19
+ }
20
+
21
+ // 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to
22
+ // children in older versions
23
+ return {}.propertyIsEnumerable.call(element.props, 'ref') ? element.props.ref : element.ref;
24
+ };
8
25
  var Tip = /*#__PURE__*/forwardRef(function (_ref, tipRef) {
9
26
  var children = _ref.children,
10
27
  content = _ref.content,
@@ -59,7 +76,7 @@ var Tip = /*#__PURE__*/forwardRef(function (_ref, tipRef) {
59
76
  componentRef.current = node;
60
77
  }
61
78
  // Call the original ref, if any
62
- var callerRef = child.ref;
79
+ var callerRef = getReactNodeRef(child);
63
80
  if (typeof callerRef === 'function') {
64
81
  callerRef(node);
65
82
  } else if (callerRef) {
@@ -70,7 +87,13 @@ var Tip = /*#__PURE__*/forwardRef(function (_ref, tipRef) {
70
87
  useEffect(function () {
71
88
  setOver(defaultVisible);
72
89
  }, [defaultVisible]);
73
- return [clonedChild, (over || tooltipOver) && /*#__PURE__*/React.createElement(Drop, _extends({
90
+ return [clonedChild, (over || tooltipOver) && /*#__PURE__*/React.createElement(Keyboard, {
91
+ key: "tip-keyboard",
92
+ onEsc: function onEsc() {
93
+ setOver(false);
94
+ setTooltipOver(false);
95
+ }
96
+ }, /*#__PURE__*/React.createElement(Drop, _extends({
74
97
  target: componentRef.current,
75
98
  trapFocus: false,
76
99
  key: "tip-drop"
@@ -81,7 +104,7 @@ var Tip = /*#__PURE__*/forwardRef(function (_ref, tipRef) {
81
104
  onMouseLeave: function onMouseLeave() {
82
105
  return setTooltipOver(false);
83
106
  }
84
- }), plain ? content : /*#__PURE__*/React.createElement(Box, theme.tip.content, content))];
107
+ }), plain ? content : /*#__PURE__*/React.createElement(Box, theme.tip.content, content)))];
85
108
  });
86
109
  Tip.displayName = 'Tip';
87
110
  Tip.propTypes = TipPropTypes;
@@ -20,7 +20,13 @@ export interface ToggleGroupProps {
20
20
  export interface ToggleGroupExtendedProps
21
21
  extends ToggleGroupProps,
22
22
  BoxProps,
23
- Omit<JSX.IntrinsicElements['div'], keyof ToggleGroupProps> {}
23
+ Omit<
24
+ React.DetailedHTMLProps<
25
+ React.HTMLAttributes<HTMLDivElement>,
26
+ HTMLDivElement
27
+ >,
28
+ keyof ToggleGroupProps
29
+ > {}
24
30
 
25
31
  declare const ToggleGroup: React.FC<ToggleGroupExtendedProps>;
26
32
 
@@ -3,11 +3,14 @@ import { BoxProps } from '../Box/index';
3
3
 
4
4
  export interface ToolbarProps {}
5
5
 
6
- type divProps = Omit<JSX.IntrinsicElements['div'], 'onClick'>;
6
+ type divProps = Omit<
7
+ React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
8
+ 'onClick'
9
+ >;
7
10
 
8
11
  export interface ToolbarExtendedProps
9
12
  extends BoxProps,
10
- ToolbarProps,
13
+ ToolbarProps,
11
14
  divProps {}
12
15
 
13
16
  declare const Toolbar: React.FC<ToolbarExtendedProps>;