grommet 2.40.0 → 2.40.2

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 (277) hide show
  1. package/components/AccordionPanel/AccordionPanel.js +17 -5
  2. package/components/Anchor/Anchor.js +5 -3
  3. package/components/Anchor/StyledAnchor.js +1 -2
  4. package/components/Avatar/Avatar.js +7 -5
  5. package/components/Avatar/StyledAvatar.js +2 -3
  6. package/components/Box/Box.js +7 -5
  7. package/components/Box/StyledBox.js +2 -3
  8. package/components/Box/stories/BackgroundThemed.js +3 -2
  9. package/components/Button/Badge.js +8 -6
  10. package/components/Button/Button.js +6 -4
  11. package/components/Button/StyledButton.js +1 -2
  12. package/components/Button/StyledButtonKind.js +1 -2
  13. package/components/Calendar/Calendar.js +12 -8
  14. package/components/Calendar/StyledCalendar.js +4 -5
  15. package/components/Card/Card.js +3 -2
  16. package/components/CardBody/CardBody.js +3 -2
  17. package/components/CardFooter/CardFooter.js +3 -2
  18. package/components/CardHeader/CardHeader.js +3 -2
  19. package/components/Cards/Cards.js +3 -2
  20. package/components/Carousel/Carousel.js +3 -2
  21. package/components/Chart/Chart.js +5 -3
  22. package/components/Chart/StyledChart.js +1 -2
  23. package/components/CheckBox/CheckBox.js +8 -6
  24. package/components/CheckBox/StyledCheckBox.js +6 -7
  25. package/components/CheckBoxGroup/CheckBoxGroup.js +5 -3
  26. package/components/CheckBoxGroup/StyledCheckBoxGroup.js +1 -2
  27. package/components/Clock/Analog.js +10 -8
  28. package/components/Clock/Digital.js +12 -7
  29. package/components/Clock/StyledClock.js +5 -6
  30. package/components/Collapsible/Collapsible.js +3 -2
  31. package/components/DataChart/DataChart.js +3 -2
  32. package/components/DataChart/Detail.js +3 -2
  33. package/components/DataChart/Swatch.js +3 -2
  34. package/components/DataClearFilters/DataClearFilters.js +3 -2
  35. package/components/DataFilters/DataFilters.js +3 -2
  36. package/components/DataSearch/DataSearch.js +3 -2
  37. package/components/DataSort/DataSort.js +3 -2
  38. package/components/DataTable/Body.js +5 -3
  39. package/components/DataTable/Cell.js +5 -3
  40. package/components/DataTable/DataTable.js +6 -4
  41. package/components/DataTable/ExpanderCell.js +3 -2
  42. package/components/DataTable/Footer.js +5 -2
  43. package/components/DataTable/GroupedBody.js +4 -1
  44. package/components/DataTable/Header.js +11 -10
  45. package/components/DataTable/Resizer.js +3 -2
  46. package/components/DataTable/Searcher.js +3 -2
  47. package/components/DataTable/Sorter.js +3 -2
  48. package/components/DataTable/StyledDataTable.js +4 -5
  49. package/components/DataTableColumns/DataTableColumns.js +3 -2
  50. package/components/DateInput/DateInput.js +7 -6
  51. package/components/Diagram/Diagram.js +5 -3
  52. package/components/Diagram/StyledDiagram.js +1 -2
  53. package/components/Drop/Drop.js +3 -2
  54. package/components/Drop/DropContainer.js +9 -5
  55. package/components/Drop/StyledDrop.js +1 -2
  56. package/components/FileInput/FileInput.js +14 -13
  57. package/components/FileInput/StyledFileInput.js +1 -2
  58. package/components/FormField/FormField.js +13 -10
  59. package/components/Grid/Grid.js +5 -2
  60. package/components/Grid/StyledGrid.js +1 -7
  61. package/components/Grommet/StyledGrommet.js +1 -2
  62. package/components/Header/Header.js +3 -2
  63. package/components/Heading/Heading.js +4 -1
  64. package/components/Heading/HeadingSkeleton.js +3 -2
  65. package/components/Heading/StyledHeading.js +1 -2
  66. package/components/Image/Image.js +4 -1
  67. package/components/Image/StyledImage.js +1 -2
  68. package/components/Layer/LayerContainer.js +8 -6
  69. package/components/Layer/StyledLayer.js +3 -4
  70. package/components/List/List.js +10 -9
  71. package/components/MaskedInput/MaskedInput.js +9 -8
  72. package/components/MaskedInput/StyledMaskedInput.js +3 -4
  73. package/components/Menu/Menu.js +7 -6
  74. package/components/Meter/Bar.js +5 -3
  75. package/components/Meter/Circle.js +5 -3
  76. package/components/Meter/Meter.js +3 -2
  77. package/components/Meter/StyledMeter.js +1 -2
  78. package/components/NameValueList/NameValueList.js +3 -2
  79. package/components/NameValuePair/NameValuePair.js +3 -2
  80. package/components/Notification/Notification.js +3 -2
  81. package/components/Page/Page.js +3 -2
  82. package/components/PageHeader/PageHeader.js +3 -2
  83. package/components/Pagination/PageControl.js +8 -6
  84. package/components/Pagination/Pagination.js +7 -6
  85. package/components/Pagination/PaginationStep.js +3 -2
  86. package/components/Pagination/StyledPageControl.js +3 -4
  87. package/components/Paragraph/Paragraph.js +4 -1
  88. package/components/Paragraph/ParagraphSkeleton.js +3 -2
  89. package/components/Paragraph/StyledParagraph.js +1 -2
  90. package/components/RadioButton/RadioButton.js +11 -9
  91. package/components/RadioButton/StyledRadioButton.js +5 -6
  92. package/components/RadioButtonGroup/RadioButtonGroup.js +3 -2
  93. package/components/RangeInput/RangeInput.js +5 -3
  94. package/components/RangeInput/StyledRangeInput.js +1 -2
  95. package/components/RangeSelector/EdgeControl.js +3 -2
  96. package/components/RangeSelector/RangeSelector.js +3 -2
  97. package/components/Select/Select.js +3 -2
  98. package/components/Select/SelectContainer.js +12 -9
  99. package/components/Select/StyledSelect.js +3 -4
  100. package/components/SelectMultiple/SelectMultiple.js +7 -6
  101. package/components/SelectMultiple/SelectMultipleContainer.js +3 -2
  102. package/components/Skeleton/Skeleton.js +5 -3
  103. package/components/Skeleton/StyledSkeleton.js +1 -2
  104. package/components/Skeleton/stories/Group.js +3 -2
  105. package/components/Skeleton/stories/Individual.js +3 -2
  106. package/components/SkipLinks/SkipLinks.js +3 -2
  107. package/components/Spinner/Spinner.js +3 -2
  108. package/components/Stack/Stack.js +4 -1
  109. package/components/Stack/StyledStack.js +1 -2
  110. package/components/StarRating/StarRating.js +3 -2
  111. package/components/Tab/StyledTab.js +1 -2
  112. package/components/Tab/Tab.js +5 -3
  113. package/components/Table/StyledTable.js +3 -4
  114. package/components/Table/Table.js +4 -1
  115. package/components/TableCell/TableCell.js +5 -3
  116. package/components/Tabs/StyledTabs.js +3 -4
  117. package/components/Tabs/Tabs.js +9 -7
  118. package/components/Tag/StyledTag.js +2 -3
  119. package/components/Tag/Tag.js +6 -4
  120. package/components/Text/StyledText.js +1 -2
  121. package/components/Text/Text.js +4 -1
  122. package/components/Text/TextSkeleton.js +3 -2
  123. package/components/TextArea/StyledTextArea.js +1 -2
  124. package/components/TextArea/TextArea.js +4 -1
  125. package/components/TextInput/CopyButton.js +8 -6
  126. package/components/TextInput/StyledTextInput.js +5 -6
  127. package/components/TextInput/TextInput.js +11 -10
  128. package/components/ThumbsRating/ThumbsRating.js +3 -2
  129. package/components/Tip/Tip.js +3 -2
  130. package/components/ToggleGroup/StyledToggleGroup.js +1 -2
  131. package/components/ToggleGroup/ToggleGroup.js +6 -4
  132. package/components/Video/StyledVideo.js +3 -4
  133. package/components/Video/Video.js +7 -5
  134. package/components/WorldMap/StyledWorldMap.js +1 -2
  135. package/components/WorldMap/WorldMap.js +5 -3
  136. package/es6/components/AccordionPanel/AccordionPanel.js +17 -4
  137. package/es6/components/Anchor/Anchor.js +4 -2
  138. package/es6/components/Anchor/StyledAnchor.js +1 -2
  139. package/es6/components/Avatar/Avatar.js +6 -4
  140. package/es6/components/Avatar/StyledAvatar.js +2 -3
  141. package/es6/components/Box/Box.js +6 -4
  142. package/es6/components/Box/StyledBox.js +2 -3
  143. package/es6/components/Box/stories/BackgroundThemed.js +2 -1
  144. package/es6/components/Button/Badge.js +7 -5
  145. package/es6/components/Button/Button.js +5 -3
  146. package/es6/components/Button/StyledButton.js +1 -2
  147. package/es6/components/Button/StyledButtonKind.js +1 -2
  148. package/es6/components/Calendar/Calendar.js +11 -7
  149. package/es6/components/Calendar/StyledCalendar.js +4 -5
  150. package/es6/components/Card/Card.js +2 -1
  151. package/es6/components/CardBody/CardBody.js +2 -1
  152. package/es6/components/CardFooter/CardFooter.js +2 -1
  153. package/es6/components/CardHeader/CardHeader.js +2 -1
  154. package/es6/components/Cards/Cards.js +2 -1
  155. package/es6/components/Carousel/Carousel.js +2 -1
  156. package/es6/components/Chart/Chart.js +4 -2
  157. package/es6/components/Chart/StyledChart.js +1 -2
  158. package/es6/components/CheckBox/CheckBox.js +7 -5
  159. package/es6/components/CheckBox/StyledCheckBox.js +6 -7
  160. package/es6/components/CheckBoxGroup/CheckBoxGroup.js +4 -2
  161. package/es6/components/CheckBoxGroup/StyledCheckBoxGroup.js +1 -2
  162. package/es6/components/Clock/Analog.js +9 -7
  163. package/es6/components/Clock/Digital.js +12 -7
  164. package/es6/components/Clock/StyledClock.js +5 -6
  165. package/es6/components/Collapsible/Collapsible.js +2 -1
  166. package/es6/components/DataChart/DataChart.js +2 -1
  167. package/es6/components/DataChart/Detail.js +2 -1
  168. package/es6/components/DataChart/Swatch.js +2 -1
  169. package/es6/components/DataClearFilters/DataClearFilters.js +2 -1
  170. package/es6/components/DataFilters/DataFilters.js +2 -1
  171. package/es6/components/DataSearch/DataSearch.js +2 -1
  172. package/es6/components/DataSort/DataSort.js +2 -1
  173. package/es6/components/DataTable/Body.js +4 -2
  174. package/es6/components/DataTable/Cell.js +4 -2
  175. package/es6/components/DataTable/DataTable.js +5 -3
  176. package/es6/components/DataTable/ExpanderCell.js +2 -1
  177. package/es6/components/DataTable/Footer.js +5 -2
  178. package/es6/components/DataTable/GroupedBody.js +4 -1
  179. package/es6/components/DataTable/Header.js +10 -9
  180. package/es6/components/DataTable/Resizer.js +2 -1
  181. package/es6/components/DataTable/Searcher.js +2 -1
  182. package/es6/components/DataTable/Sorter.js +2 -1
  183. package/es6/components/DataTable/StyledDataTable.js +4 -5
  184. package/es6/components/DataTableColumns/DataTableColumns.js +2 -1
  185. package/es6/components/DateInput/DateInput.js +6 -5
  186. package/es6/components/Diagram/Diagram.js +4 -2
  187. package/es6/components/Diagram/StyledDiagram.js +1 -2
  188. package/es6/components/Drop/Drop.js +2 -1
  189. package/es6/components/Drop/DropContainer.js +8 -4
  190. package/es6/components/Drop/StyledDrop.js +1 -2
  191. package/es6/components/FileInput/FileInput.js +13 -12
  192. package/es6/components/FileInput/StyledFileInput.js +1 -2
  193. package/es6/components/FormField/FormField.js +12 -9
  194. package/es6/components/Grid/Grid.js +5 -2
  195. package/es6/components/Grid/StyledGrid.js +1 -7
  196. package/es6/components/Grommet/StyledGrommet.js +1 -2
  197. package/es6/components/Header/Header.js +2 -1
  198. package/es6/components/Heading/Heading.js +4 -1
  199. package/es6/components/Heading/HeadingSkeleton.js +2 -1
  200. package/es6/components/Heading/StyledHeading.js +1 -2
  201. package/es6/components/Image/Image.js +4 -1
  202. package/es6/components/Image/StyledImage.js +1 -2
  203. package/es6/components/Layer/LayerContainer.js +7 -5
  204. package/es6/components/Layer/StyledLayer.js +3 -4
  205. package/es6/components/List/List.js +9 -8
  206. package/es6/components/MaskedInput/MaskedInput.js +8 -7
  207. package/es6/components/MaskedInput/StyledMaskedInput.js +3 -4
  208. package/es6/components/Menu/Menu.js +6 -5
  209. package/es6/components/Meter/Bar.js +4 -2
  210. package/es6/components/Meter/Circle.js +4 -2
  211. package/es6/components/Meter/Meter.js +2 -1
  212. package/es6/components/Meter/StyledMeter.js +1 -2
  213. package/es6/components/NameValueList/NameValueList.js +2 -1
  214. package/es6/components/NameValuePair/NameValuePair.js +2 -1
  215. package/es6/components/Notification/Notification.js +2 -1
  216. package/es6/components/Page/Page.js +2 -1
  217. package/es6/components/PageHeader/PageHeader.js +2 -1
  218. package/es6/components/Pagination/PageControl.js +7 -5
  219. package/es6/components/Pagination/Pagination.js +6 -5
  220. package/es6/components/Pagination/PaginationStep.js +2 -1
  221. package/es6/components/Pagination/StyledPageControl.js +3 -4
  222. package/es6/components/Paragraph/Paragraph.js +4 -1
  223. package/es6/components/Paragraph/ParagraphSkeleton.js +2 -1
  224. package/es6/components/Paragraph/StyledParagraph.js +1 -2
  225. package/es6/components/RadioButton/RadioButton.js +10 -8
  226. package/es6/components/RadioButton/StyledRadioButton.js +5 -6
  227. package/es6/components/RadioButtonGroup/RadioButtonGroup.js +2 -1
  228. package/es6/components/RangeInput/RangeInput.js +4 -2
  229. package/es6/components/RangeInput/StyledRangeInput.js +1 -2
  230. package/es6/components/RangeSelector/EdgeControl.js +2 -1
  231. package/es6/components/RangeSelector/RangeSelector.js +2 -1
  232. package/es6/components/Select/Select.js +2 -1
  233. package/es6/components/Select/SelectContainer.js +11 -8
  234. package/es6/components/Select/StyledSelect.js +3 -4
  235. package/es6/components/SelectMultiple/SelectMultiple.js +6 -5
  236. package/es6/components/SelectMultiple/SelectMultipleContainer.js +2 -1
  237. package/es6/components/Skeleton/Skeleton.js +4 -2
  238. package/es6/components/Skeleton/StyledSkeleton.js +1 -2
  239. package/es6/components/Skeleton/stories/Group.js +2 -1
  240. package/es6/components/Skeleton/stories/Individual.js +2 -1
  241. package/es6/components/SkipLinks/SkipLinks.js +2 -1
  242. package/es6/components/Spinner/Spinner.js +2 -1
  243. package/es6/components/Stack/Stack.js +4 -1
  244. package/es6/components/Stack/StyledStack.js +1 -2
  245. package/es6/components/StarRating/StarRating.js +2 -1
  246. package/es6/components/Tab/StyledTab.js +1 -2
  247. package/es6/components/Tab/Tab.js +4 -2
  248. package/es6/components/Table/StyledTable.js +3 -4
  249. package/es6/components/Table/Table.js +4 -1
  250. package/es6/components/TableCell/TableCell.js +4 -2
  251. package/es6/components/Tabs/StyledTabs.js +3 -4
  252. package/es6/components/Tabs/Tabs.js +8 -6
  253. package/es6/components/Tag/StyledTag.js +2 -3
  254. package/es6/components/Tag/Tag.js +5 -3
  255. package/es6/components/Text/StyledText.js +1 -2
  256. package/es6/components/Text/Text.js +4 -1
  257. package/es6/components/Text/TextSkeleton.js +2 -1
  258. package/es6/components/TextArea/StyledTextArea.js +1 -2
  259. package/es6/components/TextArea/TextArea.js +4 -1
  260. package/es6/components/TextInput/CopyButton.js +7 -5
  261. package/es6/components/TextInput/StyledTextInput.js +5 -6
  262. package/es6/components/TextInput/TextInput.js +10 -9
  263. package/es6/components/ThumbsRating/ThumbsRating.js +2 -1
  264. package/es6/components/Tip/Tip.js +2 -1
  265. package/es6/components/ToggleGroup/StyledToggleGroup.js +1 -2
  266. package/es6/components/ToggleGroup/ToggleGroup.js +5 -3
  267. package/es6/components/Video/StyledVideo.js +3 -4
  268. package/es6/components/Video/Video.js +6 -4
  269. package/es6/components/WorldMap/StyledWorldMap.js +1 -2
  270. package/es6/components/WorldMap/WorldMap.js +4 -2
  271. package/es6/utils/use-debounce.js +2 -1
  272. package/es6/utils/useThemeValue.js +15 -6
  273. package/grommet.min.js +1 -1
  274. package/grommet.min.js.map +1 -1
  275. package/package.json +5 -4
  276. package/utils/use-debounce.js +3 -2
  277. package/utils/useThemeValue.js +12 -3
@@ -26,7 +26,9 @@ var Tabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
26
26
  _ref$responsive = _ref.responsive,
27
27
  responsive = _ref$responsive === void 0 ? true : _ref$responsive,
28
28
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
29
- var theme = useThemeValue();
29
+ var _useThemeValue = useThemeValue(),
30
+ theme = _useThemeValue.theme,
31
+ passThemeFlag = _useThemeValue.passThemeFlag;
30
32
  var _useContext = useContext(MessageContext),
31
33
  format = _useContext.format;
32
34
  var propsActiveIndex = rest.activeIndex,
@@ -265,7 +267,7 @@ var Tabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
265
267
  ref: ref,
266
268
  flex: flex,
267
269
  responsive: responsive
268
- }, rest, {
270
+ }, passThemeFlag, rest, {
269
271
  background: theme.tabs.background
270
272
  }), /*#__PURE__*/React.createElement(Box, _extends({
271
273
  alignSelf: alignControls || ((_theme$tabs$header = theme.tabs.header) == null ? void 0 : _theme$tabs$header.alignSelf),
@@ -288,7 +290,7 @@ var Tabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
288
290
  }
289
291
  }, /*#__PURE__*/React.createElement(Previous, {
290
292
  color: disableLeftArrow ? theme.button.disabled.color : theme.global.colors.text
291
- }))), /*#__PURE__*/React.createElement(StyledTabsHeader, {
293
+ }))), /*#__PURE__*/React.createElement(StyledTabsHeader, _extends({
292
294
  ref: headerRef,
293
295
  direction: "row",
294
296
  justify: overflow ? 'start' : justify,
@@ -299,7 +301,7 @@ var Tabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
299
301
  gap: theme.tabs.gap,
300
302
  pad: overflow ? '2px' : undefined,
301
303
  margin: overflow ? '-2px' : undefined
302
- }, tabs), overflow && /*#__PURE__*/React.createElement(Button, {
304
+ }, passThemeFlag), tabs), overflow && /*#__PURE__*/React.createElement(Button, {
303
305
  a11yTitle: "Next Tab",
304
306
  disabled: disableRightArrow
305
307
  // removed from tabIndex, button is redundant for keyboard users
@@ -315,11 +317,11 @@ var Tabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
315
317
  }
316
318
  }, /*#__PURE__*/React.createElement(Next, {
317
319
  color: disableRightArrow ? theme.button.disabled.color : theme.global.colors.text
318
- })))), /*#__PURE__*/React.createElement(StyledTabPanel, {
320
+ })))), /*#__PURE__*/React.createElement(StyledTabPanel, _extends({
319
321
  flex: flex,
320
322
  "aria-label": tabContentTitle,
321
323
  role: "tabpanel"
322
- }, activeContent));
324
+ }, passThemeFlag), activeContent));
323
325
  });
324
326
  Tabs.displayName = 'Tabs';
325
327
  Tabs.propTypes = TabsPropTypes;
@@ -1,8 +1,7 @@
1
1
  import styled from 'styled-components';
2
2
  import { borderStyle, roundStyle } from '../../utils';
3
3
  import { Button } from '../Button';
4
- import { withTheme } from '../../default-props';
5
- export var StyledTagButton = styled(Button).attrs(withTheme).withConfig({
4
+ export var StyledTagButton = styled(Button).withConfig({
6
5
  displayName: "StyledTag__StyledTagButton",
7
6
  componentId: "sc-cb9fl2-0"
8
7
  })(["", " ", ""], function (props) {
@@ -10,7 +9,7 @@ export var StyledTagButton = styled(Button).attrs(withTheme).withConfig({
10
9
  }, function (props) {
11
10
  return props.round && roundStyle(props.round, true, props.theme);
12
11
  });
13
- export var StyledRemoveButton = styled(Button).attrs(withTheme).withConfig({
12
+ export var StyledRemoveButton = styled(Button).withConfig({
14
13
  displayName: "StyledTag__StyledRemoveButton",
15
14
  componentId: "sc-cb9fl2-1"
16
15
  })(["", ""], function (props) {
@@ -16,7 +16,9 @@ var Tag = /*#__PURE__*/forwardRef(function (_ref, ref) {
16
16
  onRemove = _ref.onRemove,
17
17
  onClick = _ref.onClick,
18
18
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
19
- var theme = useThemeValue();
19
+ var _useThemeValue = useThemeValue(),
20
+ theme = _useThemeValue.theme,
21
+ passThemeFlag = _useThemeValue.passThemeFlag;
20
22
  var RemoveIcon = ((_theme$tag$icons = theme.tag.icons) == null ? void 0 : _theme$tag$icons.remove) || FormClose;
21
23
  var containerProps = _extends({
22
24
  ref: ref,
@@ -55,13 +57,13 @@ var Tag = /*#__PURE__*/forwardRef(function (_ref, ref) {
55
57
  focusIndicator: true,
56
58
  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),
57
59
  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
58
- }, theme.tag.remove))) : /*#__PURE__*/React.createElement(StyledTagButton, _extends({
60
+ }, theme.tag.remove, passThemeFlag))) : /*#__PURE__*/React.createElement(StyledTagButton, _extends({
59
61
  flex: false,
60
62
  plain: true,
61
63
  onClick: onClick,
62
64
  hoverIndicator: true,
63
65
  focusIndicator: true
64
- }, containerProps), contents);
66
+ }, containerProps, passThemeFlag), contents);
65
67
  });
66
68
  Tag.displayName = 'Tag';
67
69
  Tag.prototype = TagPropTypes;
@@ -1,6 +1,5 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { genericStyles, normalizeColor, textAlignStyle, styledComponentsConfig } from '../../utils';
3
- import { withTheme } from '../../default-props';
4
3
  var sizeStyle = function sizeStyle(props) {
5
4
  var size = props.size || 'medium';
6
5
  var data = props.theme.text[size];
@@ -22,7 +21,7 @@ var wordBreakStyle = css(["word-break:", ";"], function (props) {
22
21
  var fontFamily = css(["font-family:", ";"], function (props) {
23
22
  return props.theme.text.font.family;
24
23
  });
25
- var StyledText = styled('span').attrs(withTheme).withConfig(styledComponentsConfig).withConfig({
24
+ var StyledText = styled('span').withConfig(styledComponentsConfig).withConfig({
26
25
  displayName: "StyledText",
27
26
  componentId: "sc-1sadyjn-0"
28
27
  })(["", " ", " ", " ", " ", " ", " ", " ", " ", ""], genericStyles, function (props) {
@@ -10,6 +10,7 @@ import { TextPropTypes } from './propTypes';
10
10
  import { useSkeleton } from '../Skeleton';
11
11
  import { TextSkeleton } from './TextSkeleton';
12
12
  import { TextContext } from './TextContext';
13
+ import { useThemeValue } from '../../utils/useThemeValue';
13
14
  var Text = /*#__PURE__*/forwardRef(function (_ref, ref) {
14
15
  var children = _ref.children,
15
16
  color = _ref.color,
@@ -24,6 +25,8 @@ var Text = /*#__PURE__*/forwardRef(function (_ref, ref) {
24
25
  _ref$level = _ref.level,
25
26
  level = _ref$level === void 0 ? 1 : _ref$level,
26
27
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
28
+ var _useThemeValue = useThemeValue(),
29
+ passThemeFlag = _useThemeValue.passThemeFlag;
27
30
  var textRef = useForwardedRef(ref);
28
31
  var _useState = useState(false),
29
32
  textTruncated = _useState[0],
@@ -64,7 +67,7 @@ var Text = /*#__PURE__*/forwardRef(function (_ref, ref) {
64
67
  level: level,
65
68
  truncate: truncate,
66
69
  size: size
67
- }, rest, {
70
+ }, passThemeFlag, rest, {
68
71
  ref: textRef
69
72
  }), children !== undefined ? /*#__PURE__*/React.createElement(TextContext.Provider, {
70
73
  value: textContextValue
@@ -8,7 +8,8 @@ var TextSkeleton = /*#__PURE__*/forwardRef(function (_ref, ref) {
8
8
  var as = _ref.as,
9
9
  sizeProp = _ref.size,
10
10
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
11
- var theme = useThemeValue();
11
+ var _useThemeValue = useThemeValue(),
12
+ theme = _useThemeValue.theme;
12
13
  var size = sizeProp || 'medium';
13
14
  var data = theme.text[size];
14
15
  var height = data ? data.size : sizeProp;
@@ -1,6 +1,5 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { disabledStyle, inputStyle, styledComponentsConfig } from '../../utils';
3
- import { withTheme } from '../../default-props';
4
3
  var plainStyle = css(["outline:none;border:none;width:100%;-webkit-appearance:none;"]);
5
4
  var resizeStyle = function resizeStyle(resize) {
6
5
  if (resize === 'horizontal') {
@@ -14,7 +13,7 @@ var resizeStyle = function resizeStyle(resize) {
14
13
  }
15
14
  return 'resize: none;';
16
15
  };
17
- var StyledTextArea = styled.textarea.withConfig(styledComponentsConfig).attrs(withTheme).withConfig({
16
+ var StyledTextArea = styled.textarea.withConfig(styledComponentsConfig).withConfig({
18
17
  displayName: "StyledTextArea",
19
18
  componentId: "sc-17i3mwp-0"
20
19
  })(["", " ", " ", " ", " ", " ", ";max-width:100%;"], inputStyle, function (props) {
@@ -6,6 +6,7 @@ import { FormContext } from '../Form/FormContext';
6
6
  import { Keyboard } from '../Keyboard';
7
7
  import { StyledTextArea } from './StyledTextArea';
8
8
  import { TextAreaPropTypes } from './propTypes';
9
+ import { useThemeValue } from '../../utils/useThemeValue';
9
10
  var TextArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
10
11
  var a11yTitle = _ref.a11yTitle,
11
12
  fill = _ref.fill,
@@ -18,6 +19,8 @@ var TextArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
18
19
  onKeyDown = _ref.onKeyDown,
19
20
  valueProp = _ref.value,
20
21
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
22
+ var _useThemeValue = useThemeValue(),
23
+ passThemeFlag = _useThemeValue.passThemeFlag;
21
24
  var formContext = useContext(FormContext);
22
25
  var _formContext$useFormI = formContext.useFormInput({
23
26
  name: name,
@@ -44,7 +47,7 @@ var TextArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
44
47
  focus: focus,
45
48
  value: value,
46
49
  focusIndicator: focusIndicator
47
- }, rest, {
50
+ }, passThemeFlag, rest, {
48
51
  onFocus: function onFocus(event) {
49
52
  setFocus(true);
50
53
  if (_onFocus) _onFocus(event);
@@ -1,15 +1,15 @@
1
+ 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); }
1
2
  import React from 'react';
2
3
  import styled from 'styled-components';
3
4
  import { Copy } from 'grommet-icons/icons/Copy';
4
5
  import { Button } from '../Button';
5
6
  import { Tip } from '../Tip';
6
7
  import { edgeStyle } from '../../utils/styles';
7
- import { withTheme } from '../../default-props';
8
8
  import { useThemeValue } from '../../utils/useThemeValue';
9
9
 
10
10
  // to overcome `plain` styling due to (icon && !label) condition
11
11
  // in buttons without theme.button.default, apply the padding here
12
- var StyledButton = styled(Button).attrs(withTheme).withConfig({
12
+ var StyledButton = styled(Button).withConfig({
13
13
  displayName: "CopyButton__StyledButton",
14
14
  componentId: "sc-1bp1m18-0"
15
15
  })(["border-radius:", ";", ""], function (props) {
@@ -24,7 +24,9 @@ export var CopyButton = function CopyButton(_ref) {
24
24
  readOnlyCopyPrompt = _ref.readOnlyCopyPrompt,
25
25
  tip = _ref.tip,
26
26
  value = _ref.value;
27
- var theme = useThemeValue();
27
+ var _useThemeValue = useThemeValue(),
28
+ theme = _useThemeValue.theme,
29
+ passThemeFlag = _useThemeValue.passThemeFlag;
28
30
  return /*#__PURE__*/React.createElement(Tip, {
29
31
  dropProps: {
30
32
  align: {
@@ -32,7 +34,7 @@ export var CopyButton = function CopyButton(_ref) {
32
34
  }
33
35
  },
34
36
  content: tip
35
- }, /*#__PURE__*/React.createElement(StyledButton, {
37
+ }, /*#__PURE__*/React.createElement(StyledButton, _extends({
36
38
  onClick: onClickCopy,
37
39
  icon: /*#__PURE__*/React.createElement(Copy, null),
38
40
  pad: {
@@ -47,5 +49,5 @@ export var CopyButton = function CopyButton(_ref) {
47
49
  onBlur: onBlurCopy,
48
50
  onMouseOut: onBlurCopy,
49
51
  "aria-label": readOnlyCopyPrompt + " " + value
50
- }));
52
+ }, passThemeFlag)));
51
53
  };
@@ -2,14 +2,13 @@ import styled, { css } from 'styled-components';
2
2
  import { controlBorderStyle, disabledStyle, getInputPadBySide, inputStyle, parseMetricToNum, plainInputStyle, textAlignStyle, widthStyle, styledComponentsConfig } from '../../utils';
3
3
  import { inputPadForIcon } from '../../utils/styles';
4
4
  import { readOnlyStyle } from '../../utils/readOnly';
5
- import { withTheme } from '../../default-props';
6
5
  var getPlainStyle = function getPlainStyle(plain) {
7
6
  if (plain === 'full') {
8
7
  return css(["", " padding:0;"], plainInputStyle);
9
8
  }
10
9
  return plain && plainInputStyle;
11
10
  };
12
- var StyledTextInput = styled.input.withConfig(styledComponentsConfig).attrs(withTheme).withConfig({
11
+ var StyledTextInput = styled.input.withConfig(styledComponentsConfig).withConfig({
13
12
  displayName: "StyledTextInput",
14
13
  componentId: "sc-1x30a0s-0"
15
14
  })(["", " ", " ", " ", " ", " ", " ", " ", " ", ";"], inputStyle, function (props) {
@@ -29,7 +28,7 @@ var StyledTextInput = styled.input.withConfig(styledComponentsConfig).attrs(with
29
28
  }, function (props) {
30
29
  return props.theme.textInput && props.theme.textInput.extend;
31
30
  });
32
- var StyledTextInputContainer = styled.div.withConfig(styledComponentsConfig).attrs(withTheme).withConfig({
31
+ var StyledTextInputContainer = styled.div.withConfig(styledComponentsConfig).withConfig({
33
32
  displayName: "StyledTextInput__StyledTextInputContainer",
34
33
  componentId: "sc-1x30a0s-1"
35
34
  })(["position:relative;width:100%;", ";", ";", " ", ";"], function (props) {
@@ -41,7 +40,7 @@ var StyledTextInputContainer = styled.div.withConfig(styledComponentsConfig).att
41
40
  }, function (props) {
42
41
  return props.theme.textInput && props.theme.textInput.container && props.theme.textInput.container.extend;
43
42
  });
44
- var StyledPlaceholder = styled.div.withConfig(styledComponentsConfig).attrs(withTheme).withConfig({
43
+ var StyledPlaceholder = styled.div.withConfig(styledComponentsConfig).withConfig({
45
44
  displayName: "StyledTextInput__StyledPlaceholder",
46
45
  componentId: "sc-1x30a0s-2"
47
46
  })(["position:absolute;left:", "px;top:50%;transform:translateY(-50%);display:flex;justify-content:center;pointer-events:none;", ";"], function (props) {
@@ -49,13 +48,13 @@ var StyledPlaceholder = styled.div.withConfig(styledComponentsConfig).attrs(with
49
48
  }, function (props) {
50
49
  return props.theme.textInput && props.theme.textInput.placeholder && props.theme.textInput.placeholder.extend;
51
50
  });
52
- var StyledIcon = styled.div.withConfig(styledComponentsConfig).attrs(withTheme).withConfig({
51
+ var StyledIcon = styled.div.withConfig(styledComponentsConfig).withConfig({
53
52
  displayName: "StyledTextInput__StyledIcon",
54
53
  componentId: "sc-1x30a0s-3"
55
54
  })(["position:absolute;display:flex;justify:center;top:50%;transform:translateY(-50%);pointer-events:none;", ""], function (props) {
56
55
  return props.reverse ? "right: " + getInputPadBySide(props, 'right') + ";" : "left: " + getInputPadBySide(props, 'left') + ";";
57
56
  });
58
- var StyledSuggestions = styled.ol.withConfig(styledComponentsConfig).attrs(withTheme).withConfig({
57
+ var StyledSuggestions = styled.ol.withConfig(styledComponentsConfig).withConfig({
59
58
  displayName: "StyledTextInput__StyledSuggestions",
60
59
  componentId: "sc-1x30a0s-4"
61
60
  })(["border-top-left-radius:0;border-top-right-radius:0;margin:0;padding:0;list-style-type:none;", ";"], function (props) {
@@ -16,7 +16,6 @@ import { MessageContext } from '../../contexts/MessageContext';
16
16
  import { TextInputPropTypes } from './propTypes';
17
17
  import { CopyButton } from './CopyButton';
18
18
  import { useThemeValue } from '../../utils/useThemeValue';
19
- import { withTheme } from '../../default-props';
20
19
  var renderLabel = function renderLabel(suggestion) {
21
20
  if (suggestion && typeof suggestion === 'object') {
22
21
  return suggestion.label || suggestion.value;
@@ -32,7 +31,7 @@ var stringLabel = function stringLabel(suggestion) {
32
31
  }
33
32
  return suggestion;
34
33
  };
35
- var ContainerBox = styled(Box).attrs(withTheme).withConfig({
34
+ var ContainerBox = styled(Box).withConfig({
36
35
  displayName: "TextInput__ContainerBox",
37
36
  componentId: "sc-1ai0c08-0"
38
37
  })(["", ";@media screen and (-ms-high-contrast:active),(-ms-high-contrast:none){width:100%;}"], function (props) {
@@ -76,7 +75,9 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
76
75
  valueProp = _ref.value,
77
76
  widthProp = _ref.width,
78
77
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
79
- var theme = useThemeValue();
78
+ var _useThemeValue = useThemeValue(),
79
+ theme = _useThemeValue.theme,
80
+ passThemeFlag = _useThemeValue.passThemeFlag;
80
81
  var _useContext = useContext(MessageContext),
81
82
  format = _useContext.format;
82
83
  var announce = useContext(AnnounceContext);
@@ -275,7 +276,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
275
276
  target: dropTarget || inputRef.current,
276
277
  onClickOutside: clickOutside,
277
278
  onEsc: closeDrop
278
- }, dropProps), /*#__PURE__*/React.createElement(ContainerBox, {
279
+ }, dropProps), /*#__PURE__*/React.createElement(ContainerBox, _extends({
279
280
  id: id ? "listbox__" + id : undefined,
280
281
  role: "listbox",
281
282
  overflow: "auto",
@@ -283,9 +284,9 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
283
284
  onMouseMove: function onMouseMove() {
284
285
  return setMouseMovedSinceLastKey(true);
285
286
  }
286
- }, /*#__PURE__*/React.createElement(StyledSuggestions, {
287
+ }, passThemeFlag), /*#__PURE__*/React.createElement(StyledSuggestions, _extends({
287
288
  ref: suggestionsRef
288
- }, /*#__PURE__*/React.createElement(InfiniteScroll, {
289
+ }, passThemeFlag), /*#__PURE__*/React.createElement(InfiniteScroll, {
289
290
  items: suggestions,
290
291
  step: theme.select.step,
291
292
  show: activeSuggestionIndex !== -1 ? activeSuggestionIndex : undefined
@@ -376,13 +377,13 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
376
377
  tip: tip,
377
378
  value: value
378
379
  });
379
- return /*#__PURE__*/React.createElement(StyledTextInputContainer, {
380
+ return /*#__PURE__*/React.createElement(StyledTextInputContainer, _extends({
380
381
  readOnlyProp: readOnly // readOnlyProp to avoid passing to DOM
381
382
  ,
382
383
  readOnlyCopy: readOnlyCopy,
383
384
  plain: plain,
384
385
  border: !plain
385
- }, reverse && readOnlyCopy && ReadOnlyCopyButton, showStyledPlaceholder && /*#__PURE__*/React.createElement(StyledPlaceholder, null, placeholder), textInputIcon && !readOnly && /*#__PURE__*/React.createElement(StyledIcon, {
386
+ }, passThemeFlag), reverse && readOnlyCopy && ReadOnlyCopyButton, showStyledPlaceholder && /*#__PURE__*/React.createElement(StyledPlaceholder, passThemeFlag, placeholder), textInputIcon && !readOnly && /*#__PURE__*/React.createElement(StyledIcon, {
386
387
  reverse: reverse,
387
388
  theme: theme
388
389
  }, textInputIcon), /*#__PURE__*/React.createElement(Keyboard, _extends({
@@ -401,7 +402,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
401
402
  focusIndicator: focusIndicator,
402
403
  textAlign: textAlign,
403
404
  widthProp: widthProp
404
- }, rest, extraProps, comboboxProps, {
405
+ }, passThemeFlag, rest, extraProps, comboboxProps, {
405
406
  defaultValue: renderLabel(defaultValue),
406
407
  value: renderLabel(value),
407
408
  readOnly: readOnly,
@@ -9,7 +9,8 @@ import { RadioButtonGroup } from '../RadioButtonGroup';
9
9
  import { useThemeValue } from '../../utils/useThemeValue';
10
10
  var ThumbsRating = function ThumbsRating(_ref) {
11
11
  var rest = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
12
- var theme = useThemeValue();
12
+ var _useThemeValue = useThemeValue(),
13
+ theme = _useThemeValue.theme;
13
14
  return /*#__PURE__*/React.createElement(RadioButtonGroup, _extends({
14
15
  direction: "row",
15
16
  options: ['like', 'dislike']
@@ -12,7 +12,8 @@ var Tip = /*#__PURE__*/forwardRef(function (_ref, tipRef) {
12
12
  defaultVisible = _ref$defaultVisible === void 0 ? false : _ref$defaultVisible,
13
13
  dropProps = _ref.dropProps,
14
14
  plain = _ref.plain;
15
- var theme = useThemeValue();
15
+ var _useThemeValue = useThemeValue(),
16
+ theme = _useThemeValue.theme;
16
17
  var _useState = useState(false),
17
18
  over = _useState[0],
18
19
  setOver = _useState[1];
@@ -1,7 +1,6 @@
1
1
  import styled from 'styled-components';
2
2
  import { Button } from '../Button';
3
3
  import { roundStyle, edgeStyle, parseMetricToNum } from '../../utils';
4
- import { withTheme } from '../../default-props';
5
4
  var adjustPad = function adjustPad(value, theme) {
6
5
  // resolve t-shirt size if it exists
7
6
  var vertical = typeof value === 'string' ? value : value == null ? void 0 : value.vertical;
@@ -16,7 +15,7 @@ var adjustPad = function adjustPad(value, theme) {
16
15
  horizontal: horizontal
17
16
  };
18
17
  };
19
- export var StyledButton = styled(Button).attrs(withTheme).withConfig({
18
+ export var StyledButton = styled(Button).withConfig({
20
19
  displayName: "StyledToggleGroup__StyledButton",
21
20
  componentId: "sc-13k5sx8-0"
22
21
  })(["border-radius:0;border:none;", ";", " &:hover{border:none;box-shadow:none;}"], function (props) {
@@ -42,7 +42,9 @@ var ToggleGroup = function ToggleGroup(_ref2) {
42
42
  _useControlled$ = _useControlled[0],
43
43
  value = _useControlled$ === void 0 ? multiple ? [] : '' : _useControlled$,
44
44
  setValue = _useControlled[1];
45
- var theme = useThemeValue();
45
+ var _useThemeValue = useThemeValue(),
46
+ theme = _useThemeValue.theme,
47
+ passThemeFlag = _useThemeValue.passThemeFlag;
46
48
  var ref = useRef();
47
49
  var buttonRefs = useRef([]);
48
50
  var values = options == null ? void 0 : options.map(function (option) {
@@ -139,7 +141,7 @@ var ToggleGroup = function ToggleGroup(_ref2) {
139
141
  color: theme.toggleGroup.divider.color
140
142
  } : undefined,
141
143
  key: optionValue || index
142
- }, /*#__PURE__*/React.createElement(StyledButton, {
144
+ }, /*#__PURE__*/React.createElement(StyledButton, _extends({
143
145
  active: active,
144
146
  "aria-pressed": multiple && active,
145
147
  "aria-checked": !multiple && active,
@@ -155,7 +157,7 @@ var ToggleGroup = function ToggleGroup(_ref2) {
155
157
  role: !multiple ? 'radio' : undefined,
156
158
  round: round,
157
159
  tabIndex: index === focusableIndex ? '0' : '-1'
158
- }));
160
+ }, passThemeFlag)));
159
161
  })));
160
162
  };
161
163
  ToggleGroup.displayName = 'ToggleGroup';
@@ -1,6 +1,5 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { focusStyle, genericStyles, normalizeColor, styledComponentsConfig } from '../../utils';
3
- import { withTheme } from '../../default-props';
4
3
  var FIT_MAP = {
5
4
  cover: 'cover',
6
5
  contain: 'contain'
@@ -10,7 +9,7 @@ var fitStyle = css(["flex:1 1;min-height:0;object-fit:", ";"], function (props)
10
9
  });
11
10
 
12
11
  // z-index is for Safari so controls aren't hidden
13
- var StyledVideo = styled.video.withConfig(styledComponentsConfig).attrs(withTheme).withConfig({
12
+ var StyledVideo = styled.video.withConfig(styledComponentsConfig).withConfig({
14
13
  displayName: "StyledVideo",
15
14
  componentId: "sc-w4v8h9-0"
16
15
  })(["max-width:100%;z-index:1;", " ::cue{background:", ";}", ";"], function (props) {
@@ -20,7 +19,7 @@ var StyledVideo = styled.video.withConfig(styledComponentsConfig).attrs(withThem
20
19
  }, function (props) {
21
20
  return props.theme.video && props.theme.video.extend;
22
21
  });
23
- var StyledVideoContainer = styled.div.withConfig(styledComponentsConfig).attrs(withTheme).withConfig({
22
+ var StyledVideoContainer = styled.div.withConfig(styledComponentsConfig).withConfig({
24
23
  displayName: "StyledVideo__StyledVideoContainer",
25
24
  componentId: "sc-w4v8h9-1"
26
25
  })(["flex:1 1;display:flex;flex-direction:column;overflow:hidden;position:relative;", ";&:focus{", "}"], genericStyles, focusStyle());
@@ -42,7 +41,7 @@ var headStyle = css(["::after{content:'';height:100%;width:", ";background:", ";
42
41
  }, function (props) {
43
42
  return props.value + "%";
44
43
  });
45
- var StyledVideoScrubber = styled.div.withConfig(styledComponentsConfig).attrs(withTheme).withConfig({
44
+ var StyledVideoScrubber = styled.div.withConfig(styledComponentsConfig).withConfig({
46
45
  displayName: "StyledVideo__StyledVideoScrubber",
47
46
  componentId: "sc-w4v8h9-3"
48
47
  })(["cursor:pointer;width:100%;height:100%;", ";&:focus{", "}"], function (props) {
@@ -48,7 +48,9 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
48
48
  _onVolumeChange = _ref.onVolumeChange,
49
49
  skipInterval = _ref.skipInterval,
50
50
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
51
- var theme = useThemeValue();
51
+ var _useThemeValue = useThemeValue(),
52
+ theme = _useThemeValue.theme,
53
+ passThemeFlag = _useThemeValue.passThemeFlag;
52
54
  var _useContext = useContext(MessageContext),
53
55
  format = _useContext.format;
54
56
  var announce = useContext(AnnounceContext);
@@ -460,7 +462,7 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
460
462
  values: [{
461
463
  value: percentagePlayed || 0
462
464
  }]
463
- }), /*#__PURE__*/React.createElement(StyledVideoScrubber, {
465
+ }), /*#__PURE__*/React.createElement(StyledVideoScrubber, _extends({
464
466
  "aria-label": format({
465
467
  id: 'video.scrubber',
466
468
  messages: messages
@@ -477,7 +479,7 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
477
479
  onFocus: function onFocus() {
478
480
  return setInteracting(true);
479
481
  }
480
- }))), /*#__PURE__*/React.createElement(Box, {
482
+ }, passThemeFlag)))), /*#__PURE__*/React.createElement(Box, {
481
483
  pad: {
482
484
  horizontal: 'small'
483
485
  }
@@ -547,7 +549,7 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
547
549
  margin: margin,
548
550
  style: style,
549
551
  tabIndex: "-1"
550
- }), /*#__PURE__*/React.createElement(StyledVideo, _extends({}, rest, {
552
+ }, passThemeFlag), /*#__PURE__*/React.createElement(StyledVideo, _extends({}, passThemeFlag, rest, {
551
553
  ref: videoRef,
552
554
  onDurationChange: function onDurationChange(event) {
553
555
  var video = videoRef.current;
@@ -1,6 +1,5 @@
1
1
  import styled from 'styled-components';
2
2
  import { genericStyles, styledComponentsConfig } from '../../utils';
3
- import { withTheme } from '../../default-props';
4
3
  var fillStyle = function fillStyle(fillProp) {
5
4
  if (fillProp === 'horizontal') {
6
5
  return "\n width: 100%;\n height: unset;\n ";
@@ -15,7 +14,7 @@ var fillStyle = function fillStyle(fillProp) {
15
14
  };
16
15
 
17
16
  // undefined fillProp has width for backwards compatibility
18
- var StyledWorldMap = styled.svg.withConfig(styledComponentsConfig).attrs(withTheme).withConfig({
17
+ var StyledWorldMap = styled.svg.withConfig(styledComponentsConfig).withConfig({
19
18
  displayName: "StyledWorldMap",
20
19
  componentId: "sc-had4c3-0"
21
20
  })(["", " ", " ", ";"], genericStyles, function (props) {
@@ -199,7 +199,9 @@ var WorldMap = /*#__PURE__*/forwardRef(function (_ref5, ref) {
199
199
  onSelectPlace = _ref5.onSelectPlace,
200
200
  placesProp = _ref5.places,
201
201
  rest = _objectWithoutPropertiesLoose(_ref5, _excluded);
202
- var theme = useThemeValue();
202
+ var _useThemeValue = useThemeValue(),
203
+ theme = _useThemeValue.theme,
204
+ passThemeFlag = _useThemeValue.passThemeFlag;
203
205
  var world = React.useMemo(buildWorld, []);
204
206
  var _React$useState = React.useState({}),
205
207
  continents = _React$useState[0],
@@ -376,7 +378,7 @@ var WorldMap = /*#__PURE__*/forwardRef(function (_ref5, ref) {
376
378
  fillProp: fill,
377
379
  width: world.width,
378
380
  height: world.height
379
- }, interactiveProps, rest), /*#__PURE__*/React.createElement("g", {
381
+ }, interactiveProps, passThemeFlag, rest), /*#__PURE__*/React.createElement("g", {
380
382
  ref: containerRef,
381
383
  stroke: "none",
382
384
  fill: "none",
@@ -4,7 +4,8 @@ export var useDebounce = function useDebounce(debounceDelay) {
4
4
  var _useState = useState(),
5
5
  func = _useState[0],
6
6
  setFunc = _useState[1];
7
- var theme = useThemeValue();
7
+ var _useThemeValue = useThemeValue(),
8
+ theme = _useThemeValue.theme;
8
9
  var delay = debounceDelay || theme.global.debounceDelay;
9
10
  useEffect(function () {
10
11
  var timer;
@@ -1,12 +1,21 @@
1
- import { useContext } from "react";
2
- import { ThemeContext } from "styled-components";
3
- import { defaultProps } from "../default-props";
1
+ 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); }
2
+ import { useContext } from 'react';
3
+ import { ThemeContext } from 'styled-components';
4
+ import { defaultProps } from '../default-props';
4
5
 
5
6
  /*
6
- Hook that returns theme value.
7
- If used outside of `<Grommet>` wrapper, falls back to default theme.
7
+ Hook that returns theme value along with a flag to determine if we are
8
+ outside of a theme context provider, if so pass the base theme.
9
+ If used outside of `<Grommet>` wrapper, falls back to base theme.
8
10
  */
9
11
  var useThemeValue = function useThemeValue() {
10
- return useContext(ThemeContext) || defaultProps.theme;
12
+ var context = useContext(ThemeContext);
13
+ var theme = context || defaultProps.theme;
14
+ return {
15
+ theme: theme,
16
+ passThemeFlag: _extends({}, context === undefined ? {
17
+ theme: theme
18
+ } : {})
19
+ };
11
20
  };
12
21
  export { useThemeValue };