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
@@ -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
 
@@ -9,7 +9,8 @@ var _Box = require("../Box");
9
9
  var _Text = require("../Text");
10
10
  var _StyledTag = require("./StyledTag");
11
11
  var _useThemeValue2 = require("../../utils/useThemeValue");
12
- var _excluded = ["name", "value", "size", "onRemove", "onClick"];
12
+ var _MessageContext = require("../../contexts/MessageContext");
13
+ var _excluded = ["name", "value", "size", "onRemove", "onClick", "messages"];
13
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
15
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
15
16
  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); }
@@ -22,11 +23,23 @@ var Tag = exports.Tag = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
22
23
  size = _ref$size === void 0 ? 'medium' : _ref$size,
23
24
  onRemove = _ref.onRemove,
24
25
  onClick = _ref.onClick,
26
+ messages = _ref.messages,
25
27
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
28
+ var _useContext = (0, _react.useContext)(_MessageContext.MessageContext),
29
+ format = _useContext.format;
26
30
  var _useThemeValue = (0, _useThemeValue2.useThemeValue)(),
27
31
  theme = _useThemeValue.theme,
28
32
  passThemeFlag = _useThemeValue.passThemeFlag;
29
33
  var RemoveIcon = ((_theme$tag$icons = theme.tag.icons) == null ? void 0 : _theme$tag$icons.remove) || _FormClose.FormClose;
34
+ var removeLabelId = name ? 'tag.removeLabel.nameAndValue' : 'tag.removeLabel.valueOnly';
35
+ var removeLabel = format({
36
+ id: removeLabelId,
37
+ messages: messages,
38
+ values: {
39
+ name: name,
40
+ value: value
41
+ }
42
+ });
30
43
  var containerProps = _extends({
31
44
  ref: ref,
32
45
  align: 'center',
@@ -65,6 +78,7 @@ var Tag = exports.Tag = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
65
78
  }, containerProps), contents, onRemove && /*#__PURE__*/_react["default"].createElement(_StyledTag.StyledRemoveButton, _extends({
66
79
  onClick: onRemove
67
80
  }, removeProps, {
81
+ "aria-label": removeLabel,
68
82
  icon: /*#__PURE__*/_react["default"].createElement(RemoveIcon, (_theme$tag$size3 = theme.tag.size) == null || (_theme$tag$size3 = _theme$tag$size3[size]) == null ? void 0 : _theme$tag$size3.icon),
69
83
  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
70
84
  }, 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["default"].createElement(_StyledTag.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'
@@ -11,6 +11,12 @@ if (process.env.NODE_ENV !== 'production') {
11
11
  value: _propTypes["default"].string.isRequired,
12
12
  onClick: _propTypes["default"].func,
13
13
  onRemove: _propTypes["default"].func,
14
+ messages: _propTypes["default"].shape({
15
+ removeLabel: _propTypes["default"].shape({
16
+ nameAndValue: _propTypes["default"].string,
17
+ valueOnly: _propTypes["default"].string
18
+ })
19
+ }),
14
20
  size: _propTypes["default"].oneOfType([_propTypes["default"].oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge']), _propTypes["default"].string])
15
21
  };
16
22
  }
@@ -78,18 +78,19 @@ var Text = exports.Text = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
78
78
  }), children !== undefined ? /*#__PURE__*/_react["default"].createElement(_TextContext.TextContext.Provider, {
79
79
  value: textContextValue
80
80
  }, children) : undefined);
81
+ var tipProps = tipProp && typeof tipProp === 'object' ? tipProp : {};
81
82
  if (tipProp || textTruncated) {
82
83
  // place the text content in a tip if truncate === 'tip'
83
84
  // and the text has been truncated
84
85
  if (textTruncated) {
85
86
  return /*#__PURE__*/_react["default"].createElement(_Tip.Tip, _extends({
86
87
  content: children
87
- }, tipProp), styledTextResult);
88
+ }, tipProps), styledTextResult);
88
89
  }
89
90
  // place the text content in a tip if truncate !== 'tip'
90
91
  // it displays even if the text has not truncated
91
92
  if (truncate !== 'tip') {
92
- return /*#__PURE__*/_react["default"].createElement(_Tip.Tip, tipProp, styledTextResult);
93
+ return /*#__PURE__*/_react["default"].createElement(_Tip.Tip, tipProps, styledTextResult);
93
94
  }
94
95
  }
95
96
  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
 
@@ -340,7 +340,8 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
340
340
  },
341
341
  onMouseMove: mouseMovedSinceLastKey && activeSuggestionIndex !== index ? function () {
342
342
  return setActiveSuggestionIndex(index);
343
- } : undefined
343
+ } : undefined,
344
+ keyboard: !mouseMovedSinceLastKey
344
345
  }, child));
345
346
  }))));
346
347
  }
@@ -397,7 +398,10 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
397
398
  ,
398
399
  readOnlyCopy: readOnlyCopy,
399
400
  plain: plain,
400
- border: !plain
401
+ border: !plain,
402
+ onMouseMove: function onMouseMove() {
403
+ return setMouseMovedSinceLastKey(true);
404
+ }
401
405
  }, passThemeFlag), reverse && readOnlyCopy && ReadOnlyCopyButton, showStyledPlaceholder && /*#__PURE__*/_react["default"].createElement(_StyledTextInput.StyledPlaceholder, passThemeFlag, placeholder), textInputIcon && !readOnly && /*#__PURE__*/_react["default"].createElement(_StyledTextInput.StyledIcon, {
402
406
  reverse: reverse,
403
407
  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
@@ -61,6 +61,7 @@ var Themed = exports.Themed = function Themed() {
61
61
  }, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
62
62
  width: "medium"
63
63
  }, /*#__PURE__*/_react["default"].createElement(_grommet.TextInput, {
64
+ id: "grommet-password",
64
65
  type: "password",
65
66
  value: value,
66
67
  dropProps: {
@@ -35,6 +35,7 @@ var OnSelect = exports.OnSelect = function OnSelect() {
35
35
  }, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
36
36
  width: "medium"
37
37
  }, /*#__PURE__*/_react["default"].createElement(_grommet.TextInput, {
38
+ id: "grommet-onselect",
38
39
  value: value,
39
40
  onChange: onChange,
40
41
  onSelect: onHighlight,
@@ -140,6 +140,7 @@ var WithTags = exports.WithTags = function WithTags() {
140
140
  _react["default"].createElement(_grommet.Box, {
141
141
  pad: "small"
142
142
  }, /*#__PURE__*/_react["default"].createElement(TagInput, {
143
+ id: "grommet-tag-input",
143
144
  placeholder: "Search for aliases...",
144
145
  suggestions: suggestions,
145
146
  value: selectedTags,
@@ -5,12 +5,28 @@ exports.Tip = void 0;
5
5
  var _react = _interopRequireWildcard(require("react"));
6
6
  var _Box = require("../Box");
7
7
  var _Drop = require("../Drop");
8
+ var _Keyboard = require("../Keyboard");
8
9
  var _utils = require("../../utils");
9
10
  var _propTypes = require("./propTypes");
10
11
  var _useThemeValue2 = require("../../utils/useThemeValue");
11
12
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
12
13
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
13
14
  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); }
15
+ /*
16
+ * This function getReactNodeRef is adapted from
17
+ * [Material UI] (https://github.com/mui/material-ui)
18
+ * Licensed under the MIT License (c) 2024 aarongarciah
19
+ * The function has been modified from its original version.
20
+ */
21
+ var getReactNodeRef = function getReactNodeRef(element) {
22
+ if (!element || ! /*#__PURE__*/_react["default"].isValidElement(element)) {
23
+ return null;
24
+ }
25
+
26
+ // 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to
27
+ // children in older versions
28
+ return {}.propertyIsEnumerable.call(element.props, 'ref') ? element.props.ref : element.ref;
29
+ };
14
30
  var Tip = exports.Tip = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, tipRef) {
15
31
  var children = _ref.children,
16
32
  content = _ref.content,
@@ -65,7 +81,7 @@ var Tip = exports.Tip = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, tipR
65
81
  componentRef.current = node;
66
82
  }
67
83
  // Call the original ref, if any
68
- var callerRef = child.ref;
84
+ var callerRef = getReactNodeRef(child);
69
85
  if (typeof callerRef === 'function') {
70
86
  callerRef(node);
71
87
  } else if (callerRef) {
@@ -76,7 +92,13 @@ var Tip = exports.Tip = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, tipR
76
92
  (0, _react.useEffect)(function () {
77
93
  setOver(defaultVisible);
78
94
  }, [defaultVisible]);
79
- return [clonedChild, (over || tooltipOver) && /*#__PURE__*/_react["default"].createElement(_Drop.Drop, _extends({
95
+ return [clonedChild, (over || tooltipOver) && /*#__PURE__*/_react["default"].createElement(_Keyboard.Keyboard, {
96
+ key: "tip-keyboard",
97
+ onEsc: function onEsc() {
98
+ setOver(false);
99
+ setTooltipOver(false);
100
+ }
101
+ }, /*#__PURE__*/_react["default"].createElement(_Drop.Drop, _extends({
80
102
  target: componentRef.current,
81
103
  trapFocus: false,
82
104
  key: "tip-drop"
@@ -87,7 +109,7 @@ var Tip = exports.Tip = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, tipR
87
109
  onMouseLeave: function onMouseLeave() {
88
110
  return setTooltipOver(false);
89
111
  }
90
- }), plain ? content : /*#__PURE__*/_react["default"].createElement(_Box.Box, theme.tip.content, content))];
112
+ }), plain ? content : /*#__PURE__*/_react["default"].createElement(_Box.Box, theme.tip.content, content)))];
91
113
  });
92
114
  Tip.displayName = 'Tip';
93
115
  Tip.propTypes = _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>;
@@ -53,7 +53,13 @@ export interface VideoProps {
53
53
 
54
54
  export interface VideoExtendedProps
55
55
  extends VideoProps,
56
- Omit<JSX.IntrinsicElements['video'], 'controls'> {}
56
+ Omit<
57
+ React.DetailedHTMLProps<
58
+ React.VideoHTMLAttributes<HTMLVideoElement>,
59
+ HTMLVideoElement
60
+ >,
61
+ 'controls'
62
+ > {}
57
63
 
58
64
  declare const Video: React.FC<VideoExtendedProps>;
59
65
 
@@ -43,7 +43,13 @@ export interface WorldMapProps {
43
43
 
44
44
  export interface WorldMapExtendedProps
45
45
  extends WorldMapProps,
46
- Omit<JSX.IntrinsicElements['svg'], 'color' | 'fill'> {}
46
+ Omit<
47
+ React.DetailedHTMLProps<
48
+ React.SVGAttributes<SVGSVGElement>,
49
+ SVGSVGElement
50
+ >,
51
+ 'color' | 'fill'
52
+ > {}
47
53
 
48
54
  declare const WorldMap: React.FC<WorldMapExtendedProps>;
49
55
 
@@ -14,7 +14,13 @@ export interface AccordionProps {
14
14
  export interface AccordionExtendedProps
15
15
  extends AccordionProps,
16
16
  BoxProps,
17
- Omit<JSX.IntrinsicElements['div'], 'onClick'> {}
17
+ Omit<
18
+ React.DetailedHTMLProps<
19
+ React.HTMLAttributes<HTMLDivElement>,
20
+ HTMLDivElement
21
+ >,
22
+ 'onClick'
23
+ > {}
18
24
 
19
25
  declare const Accordion: React.FC<AccordionExtendedProps>;
20
26
 
@@ -5,7 +5,10 @@ export interface AccordionPanelProps {
5
5
  header?: React.ReactNode;
6
6
  }
7
7
 
8
- type divType = JSX.IntrinsicElements['div'];
8
+ type divType = React.DetailedHTMLProps<
9
+ React.HTMLAttributes<HTMLDivElement>,
10
+ HTMLDivElement
11
+ >;
9
12
 
10
13
  export interface AccordionPanelExtendedProps
11
14
  extends AccordionPanelProps,
@@ -34,7 +34,13 @@ export interface AnchorProps {
34
34
  weight?: 'normal' | 'bold' | string | number;
35
35
  }
36
36
 
37
- type aProps = Omit<JSX.IntrinsicElements['a'], 'color'>;
37
+ type aProps = Omit<
38
+ React.DetailedHTMLProps<
39
+ React.AnchorHTMLAttributes<HTMLAnchorElement>,
40
+ HTMLAnchorElement
41
+ >,
42
+ 'color'
43
+ >;
38
44
 
39
45
  export interface AnchorExtendedProps extends AnchorProps, aProps {}
40
46
 
@@ -1,4 +1,4 @@
1
- var _excluded = ["a11yTitle", "aria-label", "align", "children", "height", "justify", "round", "size", "src", "width"];
1
+ var _excluded = ["a11yTitle", "aria-label", "align", "children", "height", "imageProps", "justify", "round", "size", "src", "width"];
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
4
  import React, { useCallback, useMemo } from 'react';
@@ -13,6 +13,7 @@ var Avatar = function Avatar(_ref) {
13
13
  align = _ref$align === void 0 ? 'center' : _ref$align,
14
14
  children = _ref.children,
15
15
  height = _ref.height,
16
+ imageProps = _ref.imageProps,
16
17
  _ref$justify = _ref.justify,
17
18
  justify = _ref$justify === void 0 ? 'center' : _ref$justify,
18
19
  _ref$round = _ref.round,
@@ -50,11 +51,11 @@ var Avatar = function Avatar(_ref) {
50
51
  size: avatarTextSize
51
52
  }, passThemeFlag), children);
52
53
  } else if (typeof src === 'string') {
53
- content = /*#__PURE__*/React.createElement(Image, {
54
+ content = /*#__PURE__*/React.createElement(Image, _extends({
54
55
  role: "presentation",
55
56
  fit: "contain",
56
57
  src: src
57
- });
58
+ }, imageProps));
58
59
  }
59
60
  if (typeof children === 'string' || typeof src === 'string') {
60
61
  return /*#__PURE__*/React.createElement(StyledAvatar, _extends({
@@ -1,15 +1,23 @@
1
1
  import * as React from 'react';
2
2
  import { BoxProps } from '../Box/index';
3
+ import { ImageExtendedProps } from '../Image';
3
4
 
4
5
  export interface AvatarProps {
5
6
  size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | string;
6
7
  src?: string;
8
+ imageProps?: ImageExtendedProps;
7
9
  }
8
10
 
9
11
  export interface AvatarExtendedProps
10
12
  extends BoxProps,
11
13
  AvatarProps,
12
- Omit<JSX.IntrinsicElements['div'], 'onClick'> {}
14
+ Omit<
15
+ React.DetailedHTMLProps<
16
+ React.HTMLAttributes<HTMLDivElement>,
17
+ HTMLDivElement
18
+ >,
19
+ 'onClick'
20
+ > {}
13
21
 
14
22
  declare const Avatar: React.FC<AvatarExtendedProps>;
15
23
 
@@ -3,7 +3,8 @@ var PropType = {};
3
3
  if (process.env.NODE_ENV !== 'production') {
4
4
  PropType = {
5
5
  size: PropTypes.oneOfType([PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', '2xl', '3xl', '4xl', '5xl']), PropTypes.string]),
6
- src: PropTypes.string
6
+ src: PropTypes.string,
7
+ imageProps: PropTypes.object
7
8
  };
8
9
  }
9
10
  export var AvatarPropTypes = PropType;
@@ -4,18 +4,18 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
4
4
  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; }
5
5
  import React, { Children, forwardRef, useContext, useEffect, useMemo, useState } from 'react';
6
6
  import { ThemeContext } from 'styled-components';
7
- import { backgroundIsDark } from '../../utils';
7
+ import { backgroundIsDark, useForwardedRef } from '../../utils';
8
8
  import { Keyboard } from '../Keyboard';
9
9
  import { StyledBox, StyledBoxGap } from './StyledBox';
10
10
  import { BoxPropTypes } from './propTypes';
11
- import { ResponsiveContainer } from './ResponsiveContainer';
12
11
  import { SkeletonContext, useSkeleton } from '../Skeleton';
13
12
  import { AnnounceContext } from '../../contexts/AnnounceContext';
14
13
  import { OptionsContext } from '../../contexts/OptionsContext';
15
14
  import { ResponsiveContainerContext } from '../../contexts';
15
+ import { ResponsiveContainerProvider } from './ResponsiveContainerProvider';
16
16
  import { useThemeValue } from '../../utils/useThemeValue';
17
17
  import { supportsContainerQueries } from '../../utils/responsive';
18
- var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
18
+ var Box = /*#__PURE__*/forwardRef(function (_ref, refProp) {
19
19
  var a11yTitle = _ref.a11yTitle,
20
20
  backgroundProp = _ref.background,
21
21
  border = _ref.border,
@@ -49,10 +49,35 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
49
49
  var _useContext = useContext(OptionsContext),
50
50
  boxOptions = _useContext.box;
51
51
  var skeleton = useSkeleton();
52
+ var _useState = useState(undefined),
53
+ containerElement = _useState[0],
54
+ setContainerElement = _useState[1];
52
55
  var responsiveContainer = useContext(ResponsiveContainerContext);
53
56
  var responsive = responsiveContainer && responsiveProp ? 'container' : responsiveProp;
54
57
  var background = backgroundProp;
55
58
  var announce = useContext(AnnounceContext);
59
+ var containerRef = useForwardedRef(refProp);
60
+
61
+ // Save the ref as a state if we're in a responsive container.
62
+ // We only need it in the responsive container case and it
63
+ // needs to be in a state to cause a re-render.
64
+ useEffect(function () {
65
+ if (responsiveProp === 'container' && containerRef.current) {
66
+ setContainerElement(containerRef.current);
67
+ }
68
+ }, [containerRef, responsiveProp]);
69
+ useEffect(function () {
70
+ if (typeof as === 'function') {
71
+ if (refProp) {
72
+ console.warn('ref and as={function} are incompatible. The ref will not get set.');
73
+ }
74
+ if (responsiveProp === 'container') {
75
+ console.warn(
76
+ // eslint-disable-next-line max-len
77
+ 'responsive="container" and as={function} are incompatible. Use one or the other.');
78
+ }
79
+ }
80
+ }, [refProp, as, responsiveProp]);
56
81
  useEffect(function () {
57
82
  var _skeletonProp$message;
58
83
  if (skeletonProp != null && (_skeletonProp$message = skeletonProp.message) != null && _skeletonProp$message.start) announce(skeletonProp.message.start);else if (typeof (skeletonProp == null ? void 0 : skeletonProp.message) === 'string') announce(skeletonProp.message);
@@ -64,9 +89,9 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
64
89
  var focusable = useMemo(function () {
65
90
  return onClick && !(tabIndex < 0);
66
91
  }, [onClick, tabIndex]);
67
- var _useState = useState(),
68
- focus = _useState[0],
69
- setFocus = _useState[1];
92
+ var _useState2 = useState(),
93
+ focus = _useState2[0],
94
+ setFocus = _useState2[1];
70
95
  var clickProps = useMemo(function () {
71
96
  if (focusable) {
72
97
  return {
@@ -182,6 +207,12 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
182
207
  }
183
208
  return result || theme;
184
209
  }, [background, theme]);
210
+
211
+ // Only pass along the ref if the as prop is not a function.
212
+ // The styled component will throw a warning if we try to pass
213
+ // a ref when the as prop is a function. We do a console.warn
214
+ // about this above in this case.
215
+ var ref = typeof as === 'function' ? undefined : containerRef;
185
216
  var content = /*#__PURE__*/React.createElement(StyledBox, _extends({
186
217
  as: !as && tag ? tag : as,
187
218
  "aria-label": a11yTitle,
@@ -201,13 +232,17 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
201
232
  widthProp: width,
202
233
  heightProp: height,
203
234
  responsive: responsive,
235
+ responsiveContainer: responsiveProp === 'container',
204
236
  tabIndex: adjustedTabIndex
205
237
  }, clickProps, passThemeFlag, rest, skeletonProps), /*#__PURE__*/React.createElement(ThemeContext.Provider, {
206
238
  value: nextTheme
207
239
  }, contents));
208
240
  if (responsiveProp === 'container') {
209
241
  if (supportsContainerQueries()) {
210
- content = /*#__PURE__*/React.createElement(ResponsiveContainer, null, content);
242
+ content = /*#__PURE__*/React.createElement(ResponsiveContainerProvider, {
243
+ container: containerElement,
244
+ theme: theme
245
+ }, content);
211
246
  } else {
212
247
  console.warn('<Box responsive="container"> requires styled-components v6 or later');
213
248
  }