grommet 2.46.1 → 2.48.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 (575) hide show
  1. package/all/stories/AllComponents.stories.js +1 -2
  2. package/components/Accordion/Accordion.js +1 -2
  3. package/components/Accordion/index.d.ts +7 -1
  4. package/components/Accordion/stories/CustomHeader.stories.js +1 -2
  5. package/components/AccordionPanel/AccordionPanel.js +1 -2
  6. package/components/AccordionPanel/index.d.ts +4 -1
  7. package/components/Anchor/Anchor.js +5 -6
  8. package/components/Anchor/StyledAnchor.js +1 -2
  9. package/components/Anchor/index.d.ts +7 -1
  10. package/components/Avatar/Avatar.js +5 -5
  11. package/components/Avatar/index.d.ts +9 -1
  12. package/components/Avatar/propTypes.js +2 -1
  13. package/components/Box/Box.js +6 -3
  14. package/components/Box/ResponsiveContainerProvider.js +1 -2
  15. package/components/Box/StyledBox.js +13 -4
  16. package/components/Box/index.d.ts +9 -2
  17. package/components/Box/stories/ResponsiveContainer.stories.js +1 -2
  18. package/components/Button/Badge.js +1 -2
  19. package/components/Button/BusyAnimation.js +1 -2
  20. package/components/Button/Button.js +1 -2
  21. package/components/Button/StyledButton.js +4 -3
  22. package/components/Button/StyledButtonKind.js +4 -3
  23. package/components/Button/index.d.ts +15 -3
  24. package/components/Button/propTypes.js +1 -1
  25. package/components/Button/stories/Busy.stories.js +1 -2
  26. package/components/Calendar/Calendar.js +194 -161
  27. package/components/Calendar/StyledCalendar.js +86 -35
  28. package/components/Calendar/index.d.ts +15 -2
  29. package/components/Calendar/propTypes.js +1 -0
  30. package/components/Calendar/stories/ActiveDate.stories.js +1 -2
  31. package/components/Calendar/stories/CustomDay.stories.js +1 -2
  32. package/components/Calendar/stories/CustomHeader.stories.js +1 -2
  33. package/components/Calendar/stories/CustomThemed/CustomSizeHeading.stories.js +1 -2
  34. package/components/Calendar/stories/Dual.stories.js +1 -4
  35. package/components/Calendar/stories/HeaderLevel.stories.js +1 -2
  36. package/components/Calendar/stories/Multiple.stories.js +1 -2
  37. package/components/Calendar/stories/ShowAdjacentDays.stories.js +2 -3
  38. package/components/Calendar/stories/Simple.stories.js +1 -2
  39. package/components/Card/Card.js +1 -2
  40. package/components/Cards/Cards.js +1 -2
  41. package/components/Cards/index.d.ts +7 -1
  42. package/components/Carousel/Carousel.js +1 -2
  43. package/components/Carousel/CarouselChild.js +1 -2
  44. package/components/Carousel/StyledCarousel.js +1 -2
  45. package/components/Carousel/index.d.ts +4 -1
  46. package/components/Chart/Chart.js +4 -5
  47. package/components/Chart/StyledChart.js +1 -2
  48. package/components/Chart/index.d.ts +7 -1
  49. package/components/Chart/stories/Rich.stories.js +1 -2
  50. package/components/Chart/stories/Scan.stories.js +1 -2
  51. package/components/Chart/stories/Window.stories.js +1 -2
  52. package/components/Chart/stories/Zoom.stories.js +1 -2
  53. package/components/CheckBox/CheckBox.js +1 -2
  54. package/components/CheckBox/StyledCheckBox.js +1 -2
  55. package/components/CheckBox/index.d.ts +7 -1
  56. package/components/CheckBox/stories/CustomThemed/Custom.stories.js +1 -2
  57. package/components/CheckBox/stories/CustomThemed/CustomToggle.stories.js +1 -2
  58. package/components/CheckBox/stories/Indeterminate.stories.js +1 -2
  59. package/components/CheckBox/stories/NoLabel.stories.js +1 -2
  60. package/components/CheckBox/stories/Simple.stories.js +1 -2
  61. package/components/CheckBox/stories/WithStickyDiv.stories.js +1 -2
  62. package/components/CheckBoxGroup/CheckBoxGroup.js +15 -4
  63. package/components/CheckBoxGroup/index.d.ts +15 -2
  64. package/components/CheckBoxGroup/stories/Children.stories.js +1 -2
  65. package/components/CheckBoxGroup/stories/InitialValues.stories.js +1 -2
  66. package/components/Clock/Analog.js +1 -2
  67. package/components/Clock/Clock.js +1 -2
  68. package/components/Clock/Digital.js +1 -2
  69. package/components/Clock/StyledClock.js +1 -2
  70. package/components/Clock/index.d.ts +14 -2
  71. package/components/Collapsible/Collapsible.js +1 -2
  72. package/components/Collapsible/index.d.ts +4 -1
  73. package/components/Data/Data.js +1 -2
  74. package/components/Data/DataForm.js +1 -2
  75. package/components/Data/index.d.ts +7 -1
  76. package/components/Data/propTypes.js +4 -1
  77. package/components/Data/stories/Infinite.stories.js +2 -3
  78. package/components/Data/stories/Inline.stories.js +1 -2
  79. package/components/Data/stories/OnSelect.stories.js +2 -3
  80. package/components/Data/stories/SpaceX.stories.js +2 -3
  81. package/components/Data/stories/StarWars.stories.js +13 -39
  82. package/components/DataChart/DataChart.js +4 -5
  83. package/components/DataChart/Detail.js +1 -2
  84. package/components/DataChart/Legend.js +1 -2
  85. package/components/DataChart/XAxis.js +1 -2
  86. package/components/DataChart/XGuide.js +1 -2
  87. package/components/DataChart/YAxis.js +1 -2
  88. package/components/DataChart/YGuide.js +1 -2
  89. package/components/DataChart/stories/Prediction.stories.js +1 -2
  90. package/components/DataClearFilters/DataClearFilters.js +1 -2
  91. package/components/DataClearFilters/stories/Simple.stories.js +1 -2
  92. package/components/DataFilter/DataFilter.js +5 -3
  93. package/components/DataFilter/index.d.ts +4 -1
  94. package/components/DataFilters/DataFilters.js +1 -2
  95. package/components/DataFilters/index.d.ts +4 -1
  96. package/components/DataSearch/DataSearch.js +1 -2
  97. package/components/DataSort/DataSort.js +3 -3
  98. package/components/DataSummary/DataSummary.js +1 -2
  99. package/components/DataTable/Body.js +119 -42
  100. package/components/DataTable/Cell.js +1 -2
  101. package/components/DataTable/DataTable.js +55 -17
  102. package/components/DataTable/ExpanderCell.js +55 -7
  103. package/components/DataTable/Footer.js +1 -2
  104. package/components/DataTable/GroupedBody.js +12 -5
  105. package/components/DataTable/Header.js +83 -32
  106. package/components/DataTable/PlaceholderBody.js +1 -2
  107. package/components/DataTable/Resizer.js +164 -47
  108. package/components/DataTable/Searcher.js +36 -7
  109. package/components/DataTable/StyledDataTable.js +2 -3
  110. package/components/DataTable/index.d.ts +30 -2
  111. package/components/DataTable/propTypes.js +24 -1
  112. package/components/DataTable/stories/ControlledGrouped.stories.js +5 -2
  113. package/components/DataTable/stories/Grouped.stories.js +7 -1
  114. package/components/DataTable/stories/GroupedOnSelect.stories.js +7 -1
  115. package/components/DataTable/stories/OnUpdate.stories.js +4 -2
  116. package/components/DataTable/stories/SpaceX.stories.js +9 -3
  117. package/components/DataTable/stories/SpaceXUngrouped.stories.js +2 -3
  118. package/components/DataTable/stories/Styled.stories.js +5 -1
  119. package/components/DataTable/stories/rowDetails.stories.js +150 -66
  120. package/components/DataTable/stories/typescript/OnSelect.stories.tsx +3 -3
  121. package/components/DataTableColumns/DataTableColumns.js +15 -2
  122. package/components/DataTableGroupBy/DataTableGroupBy.js +1 -2
  123. package/components/DataTableGroupBy/index.d.ts +4 -1
  124. package/components/DataView/DataView.js +1 -2
  125. package/components/DataView/index.d.ts +4 -1
  126. package/components/DateInput/DateInput.js +13 -13
  127. package/components/DateInput/index.d.ts +4 -1
  128. package/components/DateInput/stories/FormatInline.stories.js +1 -2
  129. package/components/Diagram/Diagram.js +1 -2
  130. package/components/Diagram/StyledDiagram.js +1 -2
  131. package/components/Diagram/index.d.ts +4 -1
  132. package/components/Diagram/stories/Animated.stories.js +1 -2
  133. package/components/Diagram/stories/Progressing.stories.js +1 -2
  134. package/components/Distribution/index.d.ts +4 -1
  135. package/components/Drop/Drop.js +1 -2
  136. package/components/Drop/DropContainer.js +1 -2
  137. package/components/Drop/StyledDrop.js +4 -3
  138. package/components/Drop/index.d.ts +6 -2
  139. package/components/Drop/stories/CustomThemed/Lazy.stories.js +1 -2
  140. package/components/Drop/stories/CustomThemed/Themed.stories.js +1 -2
  141. package/components/Drop/stories/Inline.stories.js +1 -2
  142. package/components/Drop/stories/Meter.stories.js +1 -2
  143. package/components/Drop/stories/Multiple.stories.js +1 -2
  144. package/components/Drop/stories/Overflow.stories.js +1 -2
  145. package/components/Drop/stories/Plain.stories.js +1 -2
  146. package/components/Drop/stories/Progressive.stories.js +1 -2
  147. package/components/Drop/stories/Simple.stories.js +1 -2
  148. package/components/Drop/stories/Styled.stories.js +1 -2
  149. package/components/DropButton/DropButton.js +1 -2
  150. package/components/DropButton/index.d.ts +8 -1
  151. package/components/FileInput/FileInput.js +38 -6
  152. package/components/FileInput/index.d.ts +18 -3
  153. package/components/FileInput/propTypes.js +11 -0
  154. package/components/FocusedContainer.js +1 -2
  155. package/components/Form/Form.js +11 -12
  156. package/components/Form/FormContext.js +1 -2
  157. package/components/Form/index.d.ts +7 -1
  158. package/components/Form/stories/ArrayOfFormFields.stories.js +1 -2
  159. package/components/Form/stories/Controlled.stories.js +2 -2
  160. package/components/Form/stories/ControlledInput.stories.js +2 -2
  161. package/components/Form/stories/ControlledInputLazy.stories.js +2 -2
  162. package/components/Form/stories/ControlledLazy.stories.js +2 -2
  163. package/components/Form/stories/CustomThemed/Custom.stories.js +1 -0
  164. package/components/Form/stories/CustomThemed/FieldBorderPosition.stories.js +1 -2
  165. package/components/Form/stories/CustomThemed/FieldCustomStates.stories.js +1 -2
  166. package/components/Form/stories/DynamicFields.stories.js +1 -2
  167. package/components/Form/stories/FieldStates.stories.js +1 -2
  168. package/components/Form/stories/FieldWithChildren.stories.js +2 -0
  169. package/components/Form/stories/SolicitedFeedback.stories.js +1 -2
  170. package/components/Form/stories/Uncontrolled.stories.js +1 -0
  171. package/components/Form/stories/UnsolicitedFeedback.stories.js +1 -2
  172. package/components/Form/stories/ValidateOnBlur.stories.js +1 -1
  173. package/components/Form/stories/ValidateOnChange.stories.js +1 -2
  174. package/components/Form/stories/ValidateOnMount.stories.js +1 -2
  175. package/components/Form/stories/typescript/TypedForm.stories.tsx +7 -1
  176. package/components/FormField/FormField.js +23 -3
  177. package/components/FormField/index.d.ts +4 -1
  178. package/components/FormField/stories/Simple.stories.js +1 -2
  179. package/components/Grid/Grid.js +1 -2
  180. package/components/Grid/StyledGrid.js +1 -2
  181. package/components/Grid/index.d.ts +4 -1
  182. package/components/Grid/stories/ResponsiveCards.stories.js +1 -2
  183. package/components/Grommet/Grommet.js +1 -2
  184. package/components/Grommet/StyledGrommet.js +1 -2
  185. package/components/Grommet/index.d.ts +48 -1
  186. package/components/Grommet/propTypes.js +42 -1
  187. package/components/Header/Header.js +1 -2
  188. package/components/Header/stories/Sticky.stories.js +1 -2
  189. package/components/Header/stories/typescript/Ref.stories.tsx +1 -1
  190. package/components/Heading/Heading.js +1 -2
  191. package/components/Heading/HeadingSkeleton.js +1 -2
  192. package/components/Heading/StyledHeading.js +1 -2
  193. package/components/Heading/index.d.ts +7 -7
  194. package/components/Image/Image.js +1 -2
  195. package/components/Image/StyledImage.js +1 -2
  196. package/components/Image/index.d.ts +4 -1
  197. package/components/InfiniteScroll/InfiniteScroll.js +1 -2
  198. package/components/InfiniteScroll/index.d.ts +2 -2
  199. package/components/Layer/Layer.js +37 -13
  200. package/components/Layer/LayerContainer.js +19 -17
  201. package/components/Layer/StyledLayer.js +1 -2
  202. package/components/Layer/index.d.ts +4 -1
  203. package/components/Layer/stories/Form.stories.js +1 -1
  204. package/components/List/List.js +135 -146
  205. package/components/List/index.d.ts +12 -3
  206. package/components/List/propTypes.js +3 -0
  207. package/components/List/stories/Order.stories.js +1 -2
  208. package/components/List/stories/Pinned.stories.js +1 -2
  209. package/components/Markdown/Markdown.js +1 -2
  210. package/components/Markdown/index.d.ts +5 -1
  211. package/components/MaskedInput/MaskedInput.js +50 -6
  212. package/components/MaskedInput/index.d.ts +7 -1
  213. package/components/MaskedInput/stories/CustomBox.stories.js +1 -0
  214. package/components/MaskedInput/stories/Date.stories.js +1 -0
  215. package/components/MaskedInput/stories/DateRange.stories.js +1 -0
  216. package/components/MaskedInput/stories/DateTimeDrop.stories.js +1 -0
  217. package/components/MaskedInput/stories/Filtered.stories.js +1 -0
  218. package/components/MaskedInput/stories/SizeUnits.stories.js +1 -0
  219. package/components/MaskedInput/stories/Time.stories.js +1 -0
  220. package/components/Menu/Menu.js +1 -2
  221. package/components/Meter/Bar.js +1 -2
  222. package/components/Meter/Circle.js +1 -2
  223. package/components/Meter/Meter.js +1 -2
  224. package/components/Meter/StyledMeter.js +1 -2
  225. package/components/Meter/stories/Circle.stories.js +1 -2
  226. package/components/Meter/stories/VerticalBarMultiple.stories.js +1 -2
  227. package/components/NameValueList/NameValueList.js +1 -2
  228. package/components/NameValueList/index.d.ts +8 -1
  229. package/components/NameValuePair/NameValuePair.js +1 -2
  230. package/components/Nav/stories/CustomThemed/JustifySidebar.stories.js +1 -2
  231. package/components/Nav/stories/Sidebar.stories.js +1 -2
  232. package/components/Notification/Notification.js +21 -6
  233. package/components/Notification/index.d.ts +4 -0
  234. package/components/Notification/propTypes.js +3 -0
  235. package/components/Notification/stories/Global.stories.js +1 -2
  236. package/components/Notification/stories/Title.stories.js +1 -2
  237. package/components/Notification/stories/TitleAndMessage.stories.js +1 -2
  238. package/components/Page/Page.js +1 -2
  239. package/components/Page/stories/PageNotificaton.stories.js +1 -2
  240. package/components/PageContent/PageContent.js +1 -2
  241. package/components/PageHeader/PageHeader.js +1 -2
  242. package/components/PageHeader/index.d.ts +5 -1
  243. package/components/PageHeader/stories/MultipleActions.stories.js +1 -2
  244. package/components/Pagination/Pagination.js +1 -2
  245. package/components/Pagination/PaginationStep.js +5 -2
  246. package/components/Pagination/PaginationSummary.js +1 -2
  247. package/components/Pagination/index.d.ts +5 -0
  248. package/components/Pagination/propTypes.js +6 -1
  249. package/components/Pagination/stories/Grid.stories.js +1 -2
  250. package/components/Paragraph/Paragraph.js +1 -2
  251. package/components/Paragraph/ParagraphSkeleton.js +1 -2
  252. package/components/Paragraph/StyledParagraph.js +1 -2
  253. package/components/Paragraph/index.d.ts +7 -1
  254. package/components/RadioButton/RadioButton.js +1 -2
  255. package/components/RadioButton/StyledRadioButton.js +3 -4
  256. package/components/RadioButton/index.d.ts +7 -1
  257. package/components/RadioButtonGroup/RadioButtonGroup.js +17 -7
  258. package/components/RadioButtonGroup/index.d.ts +7 -1
  259. package/components/RadioButtonGroup/stories/Children.stories.js +1 -2
  260. package/components/RadioButtonGroup/stories/CustomThemed/CustomTheme.stories.js +1 -2
  261. package/components/RadioButtonGroup/stories/Disabled.stories.js +1 -2
  262. package/components/RangeInput/RangeInput.js +2 -3
  263. package/components/RangeInput/StyledRangeInput.js +1 -2
  264. package/components/RangeInput/index.d.ts +7 -1
  265. package/components/RangeInput/stories/CustomThemed/Bounds.stories.js +1 -2
  266. package/components/RangeSelector/EdgeControl.js +56 -13
  267. package/components/RangeSelector/RangeSelector.js +12 -25
  268. package/components/RangeSelector/index.d.ts +15 -2
  269. package/components/RangeSelector/stories/Basic.stories.js +1 -2
  270. package/components/RangeSelector/stories/CustomThemed/Custom.stories.js +1 -2
  271. package/components/RangeSelector/stories/CustomThemed/CustomEdgeControl.stories.js +1 -2
  272. package/components/RangeSelector/stories/Label.stories.js +1 -2
  273. package/components/RangeSelector/stories/Simple.stories.js +1 -2
  274. package/components/RangeSelector/stories/Step.stories.js +1 -2
  275. package/components/RangeSelector/stories/Thin.stories.js +1 -2
  276. package/components/RangeSelector/stories/Vertical.stories.js +1 -2
  277. package/components/RoutedAnchor/RoutedAnchor.js +1 -2
  278. package/components/RoutedAnchor/index.d.ts +3 -2
  279. package/components/RoutedButton/RoutedButton.js +1 -2
  280. package/components/RoutedButton/index.d.ts +3 -2
  281. package/components/Select/DefaultSelectTextInput.js +1 -2
  282. package/components/Select/Select.js +19 -8
  283. package/components/Select/SelectContainer.js +33 -10
  284. package/components/Select/index.d.ts +7 -1
  285. package/components/Select/stories/ChildrenRender.stories.js +1 -2
  286. package/components/Select/stories/Clear.stories.js +1 -2
  287. package/components/Select/stories/Controlled.stories.js +1 -2
  288. package/components/Select/stories/CustomThemed/CustomSearch.stories.js +1 -2
  289. package/components/Select/stories/Disabled.stories.js +1 -2
  290. package/components/Select/stories/InsideFormField.stories.js +1 -2
  291. package/components/Select/stories/Multiple.stories.js +1 -2
  292. package/components/Select/stories/ObjectOptions.stories.js +1 -2
  293. package/components/Select/stories/Search.stories.js +1 -2
  294. package/components/Select/stories/Simple.stories.js +1 -2
  295. package/components/Select/stories/ValueLabel.stories.js +1 -2
  296. package/components/Select/stories/components/SearchBorderBox.js +1 -2
  297. package/components/Select/stories/components/SearchInput.js +1 -2
  298. package/components/Select/utils.js +20 -2
  299. package/components/SelectMultiple/SelectMultiple.js +37 -29
  300. package/components/SelectMultiple/SelectMultipleContainer.js +28 -21
  301. package/components/SelectMultiple/SelectMultipleValue.js +2 -4
  302. package/components/SelectMultiple/SelectionSummary.js +1 -2
  303. package/components/SelectMultiple/index.d.ts +7 -1
  304. package/components/SelectMultiple/stories/CustomMessages.stories.js +1 -2
  305. package/components/SelectMultiple/stories/Default.stories.js +1 -2
  306. package/components/SelectMultiple/stories/Disabled.stories.js +1 -2
  307. package/components/SelectMultiple/stories/FormField.stories.js +1 -2
  308. package/components/SelectMultiple/stories/Help.stories.js +1 -2
  309. package/components/SelectMultiple/stories/Limited.stories.js +1 -2
  310. package/components/SelectMultiple/stories/ObjectOptions.stories.js +1 -2
  311. package/components/SelectMultiple/stories/ShowSelectedInline.stories.js +1 -2
  312. package/components/Sidebar/index.d.ts +4 -1
  313. package/components/Skeleton/Skeleton.js +6 -3
  314. package/components/Skeleton/SkeletonContext.js +1 -2
  315. package/components/Skeleton/stories/CustomThemed/Custom.stories.js +1 -4
  316. package/components/Skeleton/stories/GridContainer.stories.js +1 -2
  317. package/components/Skeleton/stories/Simple.stories.js +0 -1
  318. package/components/SkipLink/SkipLink.js +1 -2
  319. package/components/SkipLinks/SkipLinks.js +1 -2
  320. package/components/Spinner/Spinner.js +1 -2
  321. package/components/Spinner/stories/Animation.stories.js +1 -2
  322. package/components/Spinner/stories/Announced.stories.js +1 -2
  323. package/components/Stack/Stack.js +1 -2
  324. package/components/Stack/StyledStack.js +1 -2
  325. package/components/Stack/index.d.ts +4 -1
  326. package/components/StarRating/StarRating.js +1 -2
  327. package/components/Tab/StyledTab.js +1 -2
  328. package/components/Tab/Tab.js +1 -2
  329. package/components/Tab/index.d.ts +7 -1
  330. package/components/Table/StyledTable.js +1 -2
  331. package/components/Table/Table.js +1 -2
  332. package/components/Table/index.d.ts +4 -1
  333. package/components/Table/stories/InfiniteScrollInTable.stories.js +1 -2
  334. package/components/TableBody/TableBody.js +1 -2
  335. package/components/TableBody/index.d.ts +4 -1
  336. package/components/TableCell/TableCell.js +21 -5
  337. package/components/TableCell/index.d.ts +10 -3
  338. package/components/TableFooter/TableFooter.js +1 -2
  339. package/components/TableFooter/index.d.ts +4 -1
  340. package/components/TableHeader/TableHeader.js +1 -2
  341. package/components/TableHeader/index.d.ts +4 -1
  342. package/components/TableRow/TableRow.js +1 -2
  343. package/components/TableRow/index.d.ts +4 -1
  344. package/components/Tabs/StyledTabs.js +1 -2
  345. package/components/Tabs/Tabs.js +1 -2
  346. package/components/Tabs/index.d.ts +4 -1
  347. package/components/Tabs/stories/CustomThemed/States.stories.js +1 -2
  348. package/components/Tabs/stories/Responsive.stories.js +1 -2
  349. package/components/Tag/Tag.js +16 -3
  350. package/components/Tag/index.d.ts +6 -0
  351. package/components/Tag/propTypes.js +6 -0
  352. package/components/Text/StyledText.js +1 -2
  353. package/components/Text/Text.js +4 -4
  354. package/components/Text/TextSkeleton.js +1 -2
  355. package/components/Text/index.d.ts +7 -1
  356. package/components/TextArea/StyledTextArea.js +1 -2
  357. package/components/TextArea/TextArea.js +1 -2
  358. package/components/TextArea/index.d.ts +7 -1
  359. package/components/TextArea/stories/CustomThemed/Themed.stories.js +1 -2
  360. package/components/TextArea/stories/InsideFormField.stories.js +1 -2
  361. package/components/TextArea/stories/NonResizable.stories.js +1 -2
  362. package/components/TextArea/stories/Simple.stories.js +1 -2
  363. package/components/TextInput/CopyButton.js +3 -1
  364. package/components/TextInput/StyledTextInput.js +1 -2
  365. package/components/TextInput/TextInput.js +11 -5
  366. package/components/TextInput/index.d.ts +6 -3
  367. package/components/TextInput/stories/CustomThemed/CustomSuggestions.stories.tsx +2 -1
  368. package/components/TextInput/stories/CustomThemed/Themed.stories.js +1 -0
  369. package/components/TextInput/stories/InsideFormField.stories.js +1 -2
  370. package/components/TextInput/stories/OnSelect.stories.js +1 -0
  371. package/components/TextInput/stories/WithTags.stories.js +1 -0
  372. package/components/Tip/Tip.js +17 -3
  373. package/components/Tip/stories/HeaderActions.stories.js +1 -2
  374. package/components/ToggleGroup/ToggleGroup.js +1 -2
  375. package/components/ToggleGroup/index.d.ts +7 -1
  376. package/components/ToggleGroup/stories/Controlled.stories.js +1 -2
  377. package/components/Toolbar/Toolbar.js +1 -2
  378. package/components/Toolbar/index.d.ts +5 -2
  379. package/components/Video/StyledVideo.js +1 -2
  380. package/components/Video/Video.js +13 -14
  381. package/components/Video/index.d.ts +7 -1
  382. package/components/WorldMap/WorldMap.js +1 -2
  383. package/components/WorldMap/index.d.ts +7 -1
  384. package/contexts/AnalyticsContext/AnalyticsContext.js +1 -2
  385. package/contexts/AnnounceContext/AnnounceContext.js +28 -5
  386. package/contexts/AnnounceContext/stories/Polite.stories.js +1 -2
  387. package/contexts/RootsContext.js +1 -2
  388. package/contexts/ThemeContext/stories/ThemeContextExtend.stories.js +1 -2
  389. package/es6/components/Accordion/index.d.ts +7 -1
  390. package/es6/components/AccordionPanel/index.d.ts +4 -1
  391. package/es6/components/Anchor/Anchor.js +4 -4
  392. package/es6/components/Anchor/index.d.ts +7 -1
  393. package/es6/components/Avatar/Avatar.js +4 -3
  394. package/es6/components/Avatar/index.d.ts +9 -1
  395. package/es6/components/Avatar/propTypes.js +2 -1
  396. package/es6/components/Box/Box.js +5 -1
  397. package/es6/components/Box/StyledBox.js +12 -3
  398. package/es6/components/Box/index.d.ts +9 -2
  399. package/es6/components/Button/StyledButton.js +3 -1
  400. package/es6/components/Button/StyledButtonKind.js +3 -1
  401. package/es6/components/Button/index.d.ts +15 -3
  402. package/es6/components/Button/propTypes.js +1 -1
  403. package/es6/components/Calendar/Calendar.js +194 -159
  404. package/es6/components/Calendar/StyledCalendar.js +86 -34
  405. package/es6/components/Calendar/index.d.ts +15 -2
  406. package/es6/components/Calendar/propTypes.js +1 -0
  407. package/es6/components/Calendar/stories/Dual.stories.js +0 -2
  408. package/es6/components/Calendar/stories/ShowAdjacentDays.stories.js +1 -1
  409. package/es6/components/Cards/index.d.ts +7 -1
  410. package/es6/components/Carousel/index.d.ts +4 -1
  411. package/es6/components/Chart/Chart.js +3 -3
  412. package/es6/components/Chart/index.d.ts +7 -1
  413. package/es6/components/CheckBox/index.d.ts +7 -1
  414. package/es6/components/CheckBoxGroup/CheckBoxGroup.js +14 -2
  415. package/es6/components/CheckBoxGroup/index.d.ts +15 -2
  416. package/es6/components/Clock/index.d.ts +14 -2
  417. package/es6/components/Collapsible/index.d.ts +4 -1
  418. package/es6/components/Data/index.d.ts +7 -1
  419. package/es6/components/Data/propTypes.js +4 -1
  420. package/es6/components/Data/stories/Infinite.stories.js +1 -1
  421. package/es6/components/Data/stories/OnSelect.stories.js +1 -1
  422. package/es6/components/Data/stories/SpaceX.stories.js +1 -1
  423. package/es6/components/Data/stories/StarWars.stories.js +13 -38
  424. package/es6/components/DataChart/DataChart.js +3 -3
  425. package/es6/components/DataFilter/DataFilter.js +4 -1
  426. package/es6/components/DataFilter/index.d.ts +4 -1
  427. package/es6/components/DataFilters/index.d.ts +4 -1
  428. package/es6/components/DataSort/DataSort.js +2 -1
  429. package/es6/components/DataTable/Body.js +119 -40
  430. package/es6/components/DataTable/DataTable.js +54 -15
  431. package/es6/components/DataTable/ExpanderCell.js +54 -6
  432. package/es6/components/DataTable/GroupedBody.js +11 -3
  433. package/es6/components/DataTable/Header.js +82 -30
  434. package/es6/components/DataTable/Resizer.js +165 -46
  435. package/es6/components/DataTable/Searcher.js +36 -6
  436. package/es6/components/DataTable/StyledDataTable.js +1 -1
  437. package/es6/components/DataTable/index.d.ts +30 -2
  438. package/es6/components/DataTable/propTypes.js +24 -1
  439. package/es6/components/DataTable/stories/ControlledGrouped.stories.js +4 -0
  440. package/es6/components/DataTable/stories/Grouped.stories.js +7 -1
  441. package/es6/components/DataTable/stories/GroupedOnSelect.stories.js +7 -1
  442. package/es6/components/DataTable/stories/OnUpdate.stories.js +3 -0
  443. package/es6/components/DataTable/stories/SpaceX.stories.js +8 -1
  444. package/es6/components/DataTable/stories/SpaceXUngrouped.stories.js +1 -1
  445. package/es6/components/DataTable/stories/Styled.stories.js +5 -1
  446. package/es6/components/DataTable/stories/rowDetails.stories.js +149 -66
  447. package/es6/components/DataTable/stories/typescript/OnSelect.stories.tsx +3 -3
  448. package/es6/components/DataTableColumns/DataTableColumns.js +14 -0
  449. package/es6/components/DataTableGroupBy/index.d.ts +4 -1
  450. package/es6/components/DataView/index.d.ts +4 -1
  451. package/es6/components/DateInput/DateInput.js +13 -12
  452. package/es6/components/DateInput/index.d.ts +4 -1
  453. package/es6/components/Diagram/index.d.ts +4 -1
  454. package/es6/components/Distribution/index.d.ts +4 -1
  455. package/es6/components/Drop/StyledDrop.js +3 -1
  456. package/es6/components/Drop/index.d.ts +6 -2
  457. package/es6/components/DropButton/index.d.ts +8 -1
  458. package/es6/components/FileInput/FileInput.js +37 -4
  459. package/es6/components/FileInput/index.d.ts +18 -3
  460. package/es6/components/FileInput/propTypes.js +11 -0
  461. package/es6/components/Form/Form.js +10 -10
  462. package/es6/components/Form/index.d.ts +7 -1
  463. package/es6/components/Form/stories/Controlled.stories.js +1 -0
  464. package/es6/components/Form/stories/ControlledInput.stories.js +1 -0
  465. package/es6/components/Form/stories/ControlledInputLazy.stories.js +1 -0
  466. package/es6/components/Form/stories/ControlledLazy.stories.js +1 -0
  467. package/es6/components/Form/stories/CustomThemed/Custom.stories.js +1 -0
  468. package/es6/components/Form/stories/FieldWithChildren.stories.js +2 -0
  469. package/es6/components/Form/stories/Uncontrolled.stories.js +1 -0
  470. package/es6/components/Form/stories/ValidateOnBlur.stories.js +1 -1
  471. package/es6/components/Form/stories/typescript/TypedForm.stories.tsx +7 -1
  472. package/es6/components/FormField/FormField.js +22 -1
  473. package/es6/components/FormField/index.d.ts +4 -1
  474. package/es6/components/Grid/index.d.ts +4 -1
  475. package/es6/components/Grommet/index.d.ts +48 -1
  476. package/es6/components/Grommet/propTypes.js +42 -1
  477. package/es6/components/Header/stories/typescript/Ref.stories.tsx +1 -1
  478. package/es6/components/Heading/index.d.ts +7 -7
  479. package/es6/components/Image/index.d.ts +4 -1
  480. package/es6/components/InfiniteScroll/index.d.ts +2 -2
  481. package/es6/components/Layer/Layer.js +37 -12
  482. package/es6/components/Layer/LayerContainer.js +20 -16
  483. package/es6/components/Layer/index.d.ts +4 -1
  484. package/es6/components/Layer/stories/Form.stories.js +1 -1
  485. package/es6/components/List/List.js +136 -146
  486. package/es6/components/List/index.d.ts +12 -3
  487. package/es6/components/List/propTypes.js +3 -0
  488. package/es6/components/Markdown/index.d.ts +5 -1
  489. package/es6/components/MaskedInput/MaskedInput.js +49 -4
  490. package/es6/components/MaskedInput/index.d.ts +7 -1
  491. package/es6/components/MaskedInput/stories/CustomBox.stories.js +1 -0
  492. package/es6/components/MaskedInput/stories/Date.stories.js +1 -0
  493. package/es6/components/MaskedInput/stories/DateRange.stories.js +1 -0
  494. package/es6/components/MaskedInput/stories/DateTimeDrop.stories.js +1 -0
  495. package/es6/components/MaskedInput/stories/Filtered.stories.js +1 -0
  496. package/es6/components/MaskedInput/stories/SizeUnits.stories.js +1 -0
  497. package/es6/components/MaskedInput/stories/Time.stories.js +1 -0
  498. package/es6/components/NameValueList/index.d.ts +8 -1
  499. package/es6/components/Notification/Notification.js +22 -5
  500. package/es6/components/Notification/index.d.ts +4 -0
  501. package/es6/components/Notification/propTypes.js +3 -0
  502. package/es6/components/PageHeader/index.d.ts +5 -1
  503. package/es6/components/Pagination/PaginationStep.js +4 -0
  504. package/es6/components/Pagination/index.d.ts +5 -0
  505. package/es6/components/Pagination/propTypes.js +6 -1
  506. package/es6/components/Paragraph/index.d.ts +7 -1
  507. package/es6/components/RadioButton/StyledRadioButton.js +2 -2
  508. package/es6/components/RadioButton/index.d.ts +7 -1
  509. package/es6/components/RadioButtonGroup/RadioButtonGroup.js +16 -5
  510. package/es6/components/RadioButtonGroup/index.d.ts +7 -1
  511. package/es6/components/RangeInput/RangeInput.js +1 -1
  512. package/es6/components/RangeInput/index.d.ts +7 -1
  513. package/es6/components/RangeSelector/EdgeControl.js +57 -12
  514. package/es6/components/RangeSelector/RangeSelector.js +11 -23
  515. package/es6/components/RangeSelector/index.d.ts +15 -2
  516. package/es6/components/RoutedAnchor/index.d.ts +3 -2
  517. package/es6/components/RoutedButton/index.d.ts +3 -2
  518. package/es6/components/Select/Select.js +19 -7
  519. package/es6/components/Select/SelectContainer.js +32 -8
  520. package/es6/components/Select/index.d.ts +7 -1
  521. package/es6/components/Select/utils.js +19 -2
  522. package/es6/components/SelectMultiple/SelectMultiple.js +37 -28
  523. package/es6/components/SelectMultiple/SelectMultipleContainer.js +28 -20
  524. package/es6/components/SelectMultiple/SelectMultipleValue.js +2 -3
  525. package/es6/components/SelectMultiple/index.d.ts +7 -1
  526. package/es6/components/Sidebar/index.d.ts +4 -1
  527. package/es6/components/Skeleton/Skeleton.js +5 -1
  528. package/es6/components/Skeleton/stories/CustomThemed/Custom.stories.js +0 -2
  529. package/es6/components/Skeleton/stories/Simple.stories.js +0 -1
  530. package/es6/components/Stack/index.d.ts +4 -1
  531. package/es6/components/Tab/index.d.ts +7 -1
  532. package/es6/components/Table/index.d.ts +4 -1
  533. package/es6/components/TableBody/index.d.ts +4 -1
  534. package/es6/components/TableCell/TableCell.js +20 -3
  535. package/es6/components/TableCell/index.d.ts +10 -3
  536. package/es6/components/TableFooter/index.d.ts +4 -1
  537. package/es6/components/TableHeader/index.d.ts +4 -1
  538. package/es6/components/TableRow/index.d.ts +4 -1
  539. package/es6/components/Tabs/index.d.ts +4 -1
  540. package/es6/components/Tag/Tag.js +16 -2
  541. package/es6/components/Tag/index.d.ts +6 -0
  542. package/es6/components/Tag/propTypes.js +6 -0
  543. package/es6/components/Text/Text.js +3 -2
  544. package/es6/components/Text/index.d.ts +7 -1
  545. package/es6/components/TextArea/index.d.ts +7 -1
  546. package/es6/components/TextInput/CopyButton.js +3 -1
  547. package/es6/components/TextInput/TextInput.js +10 -3
  548. package/es6/components/TextInput/index.d.ts +6 -3
  549. package/es6/components/TextInput/stories/CustomThemed/CustomSuggestions.stories.tsx +2 -1
  550. package/es6/components/TextInput/stories/CustomThemed/Themed.stories.js +1 -0
  551. package/es6/components/TextInput/stories/OnSelect.stories.js +1 -0
  552. package/es6/components/TextInput/stories/WithTags.stories.js +1 -0
  553. package/es6/components/Tip/Tip.js +17 -1
  554. package/es6/components/ToggleGroup/index.d.ts +7 -1
  555. package/es6/components/Toolbar/index.d.ts +5 -2
  556. package/es6/components/Video/Video.js +12 -12
  557. package/es6/components/Video/index.d.ts +7 -1
  558. package/es6/components/WorldMap/index.d.ts +7 -1
  559. package/es6/contexts/AnnounceContext/AnnounceContext.js +28 -5
  560. package/es6/languages/default.json +39 -3
  561. package/es6/themes/base.d.ts +20 -0
  562. package/es6/themes/base.js +22 -8
  563. package/es6/utils/mixins.js +2 -1
  564. package/es6/utils/styles.js +53 -45
  565. package/grommet.min.js +1 -1
  566. package/grommet.min.js.map +1 -1
  567. package/languages/default.json +39 -3
  568. package/package.json +35 -35
  569. package/themes/base.d.ts +20 -0
  570. package/themes/base.js +22 -8
  571. package/utils/mixins.js +2 -1
  572. package/utils/styles.js +53 -45
  573. package/utils/useId.js +1 -2
  574. package/components/Drop/stories/TrapFocus.stories.js +0 -86
  575. package/es6/components/Drop/stories/TrapFocus.stories.js +0 -82
@@ -86,6 +86,23 @@ export interface DataTableProps<TRowType = any> {
86
86
  fill?: boolean | 'vertical' | 'horizontal';
87
87
  gridArea?: GridAreaType;
88
88
  margin?: MarginType;
89
+ messages?: {
90
+ ascending?: string;
91
+ collapse?: string;
92
+ collapseAll?: string;
93
+ decrease?: string;
94
+ descending?: string;
95
+ increase?: string;
96
+ expand?: string;
97
+ expandAll?: string;
98
+ resizerAria?: string;
99
+ rows?: string;
100
+ rowsChanged?: string;
101
+ rowsSingle?: string;
102
+ searchBy?: string;
103
+ total?: string;
104
+ totalSingle?: string;
105
+ };
89
106
  pad?: PadType | Sections<PadType>;
90
107
  paginate?: boolean | PaginationType | BoxProps;
91
108
  pin?: boolean | 'header' | 'footer';
@@ -99,7 +116,14 @@ export interface DataTableProps<TRowType = any> {
99
116
  pad?: PadType;
100
117
  };
101
118
  };
102
- rowDetails?: (row: TRowType) => React.ReactNode;
119
+ rowDetails?:
120
+ | ((row: TRowType) => React.ReactNode)
121
+ | {
122
+ render: (row: TRowType) => React.ReactNode;
123
+ expand?: (string | number)[];
124
+ onExpand?: (expandedKeys: (string | number)[], datum: TRowType) => void;
125
+ expandLabel?: (datum: TRowType) => string;
126
+ };
103
127
  show?: number | { page?: number };
104
128
  size?: 'small' | 'medium' | 'large' | 'xlarge' | string;
105
129
 
@@ -112,6 +136,7 @@ export interface DataTableProps<TRowType = any> {
112
136
  property?: string;
113
137
  expand?: Array<string>;
114
138
  expandable?: Array<string>;
139
+ expandLabel?: (datum: TRowType) => string;
115
140
  select?: { [key: string]: 'all' | 'some' | 'none' };
116
141
  onExpand?: (expandedKeys: string[]) => void;
117
142
  onSelect?: (
@@ -152,7 +177,10 @@ export interface DataTableProps<TRowType = any> {
152
177
  export interface DataTableExtendedProps<TRowType = any>
153
178
  extends DataTableProps<TRowType>,
154
179
  Omit<
155
- JSX.IntrinsicElements['table'],
180
+ React.DetailedHTMLProps<
181
+ React.HTMLAttributes<HTMLTableElement>,
182
+ HTMLTableElement
183
+ >,
156
184
  'onSelect' | 'placeholder' | 'border'
157
185
  > {}
158
186
 
@@ -73,12 +73,35 @@ if (process.env.NODE_ENV !== 'production') {
73
73
  property: _propTypes["default"].string,
74
74
  expand: _propTypes["default"].arrayOf(_propTypes["default"].string),
75
75
  expandable: _propTypes["default"].arrayOf(_propTypes["default"].string),
76
+ expandLabel: _propTypes["default"].func,
76
77
  select: _propTypes["default"].objectOf(_propTypes["default"].oneOf(['all', 'some', 'none'])),
77
78
  onExpand: _propTypes["default"].func,
78
79
  onSelect: _propTypes["default"].func
79
80
  })]),
81
+ messages: _propTypes["default"].shape({
82
+ ascending: _propTypes["default"].string,
83
+ collapse: _propTypes["default"].string,
84
+ collapseAll: _propTypes["default"].string,
85
+ decrease: _propTypes["default"].string,
86
+ descending: _propTypes["default"].string,
87
+ increase: _propTypes["default"].string,
88
+ expand: _propTypes["default"].string,
89
+ expandAll: _propTypes["default"].string,
90
+ resizerAria: _propTypes["default"].string,
91
+ rows: _propTypes["default"].string,
92
+ rowsChanged: _propTypes["default"].string,
93
+ rowsSingle: _propTypes["default"].string,
94
+ searchBy: _propTypes["default"].string,
95
+ total: _propTypes["default"].string,
96
+ totalSingle: _propTypes["default"].string
97
+ }),
80
98
  onClickRow: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].oneOf(['select'])]),
81
- rowDetails: _propTypes["default"].func,
99
+ rowDetails: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].shape({
100
+ render: _propTypes["default"].func.isRequired,
101
+ expand: _propTypes["default"].arrayOf(_propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])),
102
+ expandLabel: _propTypes["default"].func,
103
+ onExpand: _propTypes["default"].func
104
+ })]),
82
105
  onMore: _propTypes["default"].func,
83
106
  onSearch: _propTypes["default"].func,
84
107
  onSelect: _propTypes["default"].func,
@@ -5,8 +5,7 @@ exports["default"] = exports.ControlledGroupedDataTable = void 0;
5
5
  var _react = _interopRequireWildcard(require("react"));
6
6
  var _grommet = require("grommet");
7
7
  var _data = require("./data");
8
- 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); }
9
- 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; }
8
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
10
9
  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); } // Source code for the data can be found here
11
10
  // https://github.com/grommet/grommet/blob/master/src/js/components/DataTable/stories/data.js
12
11
  var groupColumns = [].concat(_data.columns);
@@ -15,6 +14,9 @@ groupColumns[0] = _extends({}, groupColumns[1]);
15
14
  groupColumns[1] = _extends({}, first);
16
15
  groupColumns[0].footer = groupColumns[1].footer;
17
16
  delete groupColumns[1].footer;
17
+ var expandLabel = function expandLabel(row) {
18
+ return row == null ? void 0 : row.location;
19
+ };
18
20
  var ControlledGroupedDataTable = exports.ControlledGroupedDataTable = function ControlledGroupedDataTable() {
19
21
  var _useState = (0, _react.useState)([_data.DATA[2].location]),
20
22
  expandedGroups = _useState[0],
@@ -29,6 +31,7 @@ var ControlledGroupedDataTable = exports.ControlledGroupedDataTable = function C
29
31
  groupBy: {
30
32
  property: 'location',
31
33
  expand: expandedGroups,
34
+ expandLabel: expandLabel,
32
35
  onExpand: setExpandedGroups
33
36
  },
34
37
  sortable: true
@@ -9,6 +9,9 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
9
9
  // Source code for the data can be found here
10
10
  // https://github.com/grommet/grommet/blob/master/src/js/components/DataTable/stories/data.js
11
11
 
12
+ var expandLabel = function expandLabel(row) {
13
+ return row == null ? void 0 : row.location;
14
+ };
12
15
  var GroupedDataTable = exports.GroupedDataTable = function GroupedDataTable() {
13
16
  return (
14
17
  /*#__PURE__*/
@@ -20,7 +23,10 @@ var GroupedDataTable = exports.GroupedDataTable = function GroupedDataTable() {
20
23
  }, /*#__PURE__*/_react["default"].createElement(_grommet.DataTable, {
21
24
  columns: _data.groupColumns,
22
25
  data: _data.DATA,
23
- groupBy: "location",
26
+ groupBy: {
27
+ property: 'location',
28
+ expandLabel: expandLabel
29
+ },
24
30
  sortable: true
25
31
  }))
26
32
  // </Grommet>
@@ -14,6 +14,9 @@ groupColumns[0] = _extends({}, groupColumns[1]);
14
14
  groupColumns[1] = _extends({}, first);
15
15
  groupColumns[0].footer = groupColumns[1].footer;
16
16
  delete groupColumns[1].footer;
17
+ var expandLabel = function expandLabel(row) {
18
+ return (row == null ? void 0 : row.location) + " location";
19
+ };
17
20
  var GroupedOnSelectDataTable = exports.GroupedOnSelectDataTable = function GroupedOnSelectDataTable() {
18
21
  return (
19
22
  /*#__PURE__*/
@@ -25,7 +28,10 @@ var GroupedOnSelectDataTable = exports.GroupedOnSelectDataTable = function Group
25
28
  }, /*#__PURE__*/_react["default"].createElement(_grommet.DataTable, {
26
29
  columns: groupColumns,
27
30
  data: _data.DATA,
28
- groupBy: "location",
31
+ groupBy: {
32
+ property: 'location',
33
+ expandLabel: expandLabel
34
+ },
29
35
  onSelect: function onSelect() {},
30
36
  sortable: true
31
37
  }))
@@ -5,8 +5,7 @@ exports["default"] = exports.OnUpdateDataTable = void 0;
5
5
  var _react = _interopRequireWildcard(require("react"));
6
6
  var _grommet = require("grommet");
7
7
  var _data = require("./data");
8
- 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); }
9
- 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; }
8
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
10
9
  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); } // Source code for the data can be found here
11
10
  // https://github.com/grommet/grommet/blob/master/src/js/components/DataTable/stories/data.js
12
11
  // The key of the header selection state in groupBy.select
@@ -263,6 +262,9 @@ var OnUpdateDataTable = exports.OnUpdateDataTable = function OnUpdateDataTable()
263
262
  return {
264
263
  expandable: expandable,
265
264
  expand: expand,
265
+ expandLabel: function expandLabel(row) {
266
+ return row.location + " location";
267
+ },
266
268
  select: groupSelected,
267
269
  property: 'location',
268
270
  onSelect: onGroupSelect
@@ -5,9 +5,8 @@ exports["default"] = exports.SpaceX = void 0;
5
5
  var _react = _interopRequireWildcard(require("react"));
6
6
  var _grommet = require("grommet");
7
7
  var _grommetIcons = require("grommet-icons");
8
- 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); }
9
- 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; }
10
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(typeof e + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
8
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
9
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == typeof f && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(typeof r + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
11
10
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
12
11
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
13
12
  var columns = [{
@@ -118,6 +117,12 @@ var SpaceX = exports.SpaceX = function SpaceX() {
118
117
  return id;
119
118
  });
120
119
  }, [groups]);
120
+ var expandLabel = function expandLabel(row) {
121
+ if (row && row.name) {
122
+ return row.name;
123
+ }
124
+ return undefined;
125
+ };
121
126
  (0, _react.useEffect)(function () {
122
127
  var fetchData = /*#__PURE__*/function () {
123
128
  var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -239,6 +244,7 @@ var SpaceX = exports.SpaceX = function SpaceX() {
239
244
  groupBy: {
240
245
  expandable: expandable,
241
246
  expand: expanded,
247
+ expandLabel: expandLabel,
242
248
  property: 'rocketId'
243
249
  },
244
250
  onUpdate: function onUpdate(opts) {
@@ -5,9 +5,8 @@ exports["default"] = exports.SpaceXUngrouped = void 0;
5
5
  var _react = _interopRequireWildcard(require("react"));
6
6
  var _grommet = require("grommet");
7
7
  var _grommetIcons = require("grommet-icons");
8
- 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); }
9
- 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; }
10
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(typeof e + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
8
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
9
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == typeof f && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(typeof r + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
11
10
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
12
11
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
13
12
  var columns = [{
@@ -10,6 +10,9 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
10
10
  // https://github.com/grommet/grommet/blob/master/src/js/components/DataTable/stories/data.js
11
11
 
12
12
  var StyledDataTable = exports.StyledDataTable = function StyledDataTable() {
13
+ var expandLabel = function expandLabel(row) {
14
+ return row.location;
15
+ };
13
16
  return (
14
17
  /*#__PURE__*/
15
18
  // Uncomment <Grommet> lines when using outside of storybook
@@ -41,7 +44,8 @@ var StyledDataTable = exports.StyledDataTable = function StyledDataTable() {
41
44
  },
42
45
  groupBy: {
43
46
  property: 'location',
44
- expand: ['Palo Alto']
47
+ expand: ['Palo Alto'],
48
+ expandLabel: expandLabel
45
49
  },
46
50
  rowProps: {
47
51
  Eric: {
@@ -1,83 +1,167 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports["default"] = exports.ControlledDataTable = void 0;
5
- var _react = _interopRequireDefault(require("react"));
4
+ exports["default"] = exports.RowDetails = void 0;
5
+ var _react = _interopRequireWildcard(require("react"));
6
6
  var _grommet = require("grommet");
7
- var _data = require("./data");
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
9
- 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); } // Source code for the data can be found here
10
- // https://github.com/grommet/grommet/blob/master/src/js/components/DataTable/stories/data.js
11
- var controlledColumns = _data.columns.map(function (col) {
12
- return _extends({}, col);
13
- });
14
- delete controlledColumns[0].footer;
15
- delete controlledColumns[3].footer;
16
- delete controlledColumns[4].footer;
17
- delete controlledColumns[4].aggregate;
18
- var ControlledDataTable = exports.ControlledDataTable = function ControlledDataTable() {
19
- var _React$useState = _react["default"].useState([]),
20
- checked = _React$useState[0],
21
- setChecked = _React$useState[1];
22
- var onCheck = function onCheck(event, value) {
23
- if (event.target.checked) {
24
- setChecked([].concat(checked, [value]));
25
- } else {
26
- setChecked(checked.filter(function (item) {
27
- return item !== value;
28
- }));
29
- }
30
- };
31
- var onCheckAll = function onCheckAll(event) {
32
- return setChecked(event.target.checked ? _data.DATA.map(function (datum) {
33
- return datum.name;
34
- }) : []);
7
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
8
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == typeof f && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(typeof r + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
9
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
10
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
11
+ // Uses the StarWars API for starships, see https://swapi.info
12
+
13
+ var fetchData = /*#__PURE__*/function () {
14
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
15
+ var url;
16
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
17
+ while (1) switch (_context.prev = _context.next) {
18
+ case 0:
19
+ url = "https://swapi.info/api/starships";
20
+ return _context.abrupt("return", fetch(url, {
21
+ method: 'GET',
22
+ headers: {
23
+ 'Content-Type': 'application/json'
24
+ }
25
+ }).then(function (response) {
26
+ return response.json();
27
+ })["catch"](function (err) {
28
+ if (err.name !== 'AbortError') throw err;
29
+ return {};
30
+ }));
31
+ case 2:
32
+ case "end":
33
+ return _context.stop();
34
+ }
35
+ }, _callee);
36
+ }));
37
+ return function fetchData() {
38
+ return _ref.apply(this, arguments);
35
39
  };
40
+ }();
41
+ var ShipProperties = function ShipProperties(_ref2) {
42
+ var ship = _ref2.ship;
43
+ return /*#__PURE__*/_react["default"].createElement(_grommet.NameValueList, {
44
+ pairProps: {
45
+ direction: 'column'
46
+ },
47
+ valueProps: {
48
+ width: 'xsmall'
49
+ },
50
+ layout: "grid",
51
+ pad: {
52
+ left: 'large',
53
+ bottom: 'small'
54
+ },
55
+ gap: {
56
+ row: 'xsmall',
57
+ column: 'large'
58
+ }
59
+ }, /*#__PURE__*/_react["default"].createElement(_grommet.NameValuePair, {
60
+ name: /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
61
+ size: "small",
62
+ weight: "bold"
63
+ }, "Name")
64
+ }, /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
65
+ size: "xsmall"
66
+ }, ship.name)), /*#__PURE__*/_react["default"].createElement(_grommet.NameValuePair, {
67
+ name: /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
68
+ size: "small",
69
+ weight: "bold"
70
+ }, "Model")
71
+ }, /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
72
+ size: "xsmall"
73
+ }, ship.model)), /*#__PURE__*/_react["default"].createElement(_grommet.NameValuePair, {
74
+ name: /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
75
+ size: "small",
76
+ weight: "bold"
77
+ }, "Manufacturer")
78
+ }, /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
79
+ size: "xsmall"
80
+ }, ship.manufacturer)), /*#__PURE__*/_react["default"].createElement(_grommet.NameValuePair, {
81
+ name: /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
82
+ size: "small",
83
+ weight: "bold"
84
+ }, "Passengers")
85
+ }, /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
86
+ size: "xsmall"
87
+ }, ship.passengers)));
88
+ };
89
+ var RowDetails = exports.RowDetails = function RowDetails() {
90
+ var _useState = (0, _react.useState)({}),
91
+ result = _useState[0],
92
+ setResult = _useState[1];
93
+ var _useState2 = (0, _react.useState)(0),
94
+ total = _useState2[0],
95
+ setTotal = _useState2[1];
96
+ var _useState3 = (0, _react.useState)(['Y-wing']),
97
+ expand = _useState3[0],
98
+ setExpand = _useState3[1];
99
+ (0, _react.useEffect)(function () {
100
+ fetchData().then(function (results) {
101
+ if (results) {
102
+ // The API doesn't provide a non-filtered total, so we rely on the
103
+ // first call having no filtering telling us the total.
104
+ setTotal(function (prevTotal) {
105
+ return Math.max(prevTotal, results.length);
106
+ });
107
+ setResult({
108
+ data: results
109
+ });
110
+ }
111
+ });
112
+ }, []);
113
+ var rowDetails = (0, _react.useMemo)(function () {
114
+ return {
115
+ render: function render(row) {
116
+ return /*#__PURE__*/_react["default"].createElement(ShipProperties, {
117
+ ship: row
118
+ });
119
+ },
120
+ expand: expand,
121
+ expandLabel: function expandLabel(row) {
122
+ return "details for " + row.name;
123
+ },
124
+ onExpand: function onExpand(nextExpand /* , datum */) {
125
+ return setExpand(nextExpand);
126
+ }
127
+ };
128
+ }, [expand]);
36
129
  return (
37
130
  /*#__PURE__*/
38
131
  // Uncomment <Grommet> lines when using outside of storybook
39
- // <Grommet theme={grommet}>
132
+ // <Grommet theme={...}>
40
133
  _react["default"].createElement(_grommet.Box, {
41
- align: "center",
42
- pad: "medium"
134
+ skeleton: !result.data,
135
+ width: "large",
136
+ pad: "large"
137
+ }, /*#__PURE__*/_react["default"].createElement(_grommet.Data, {
138
+ data: result.data,
139
+ total: total,
140
+ toolbar: "search"
43
141
  }, /*#__PURE__*/_react["default"].createElement(_grommet.DataTable, {
44
142
  columns: [{
45
- property: 'checkbox',
46
- render: function render(_ref) {
47
- var name = _ref.name;
48
- return /*#__PURE__*/_react["default"].createElement(_grommet.CheckBox, {
49
- key: name,
50
- checked: checked.indexOf(name) !== -1,
51
- onChange: function onChange(e) {
52
- return onCheck(e, name);
53
- },
54
- "aria-label": "row checkbox"
55
- });
56
- },
57
- header: /*#__PURE__*/_react["default"].createElement(_grommet.CheckBox, {
58
- checked: checked.length === _data.DATA.length,
59
- indeterminate: checked.length > 0 && checked.length < _data.DATA.length,
60
- onChange: onCheckAll,
61
- "aria-label": "header checkbox"
62
- }),
63
- sortable: false
64
- }].concat(controlledColumns).map(function (col) {
65
- return _extends({}, col);
66
- }),
67
- data: _data.DATA,
68
- sortable: true,
69
- rowDetails: function rowDetails(row) {
70
- if (row.name === 'Alan') {
71
- return /*#__PURE__*/_react["default"].createElement(_grommet.Box, null, " ", row.name, " ");
72
- }
73
- return /*#__PURE__*/_react["default"].createElement(_grommet.Box, null, "Blah ", row.name, " ");
74
- },
75
- size: "medium"
76
- }))
143
+ property: 'name',
144
+ header: 'Name',
145
+ primary: true
146
+ }, {
147
+ property: 'starship_class',
148
+ header: 'Class'
149
+ }],
150
+ rowDetails: rowDetails
151
+ }), /*#__PURE__*/_react["default"].createElement(_grommet.Pagination, null)))
152
+
77
153
  // </Grommet>
78
154
  );
79
155
  };
80
- ControlledDataTable.storyName = 'rowDetails';
156
+ RowDetails.storyName = 'rowDetails';
157
+ RowDetails.parameters = {
158
+ chromatic: {
159
+ disable: true
160
+ }
161
+ };
162
+ RowDetails.args = {
163
+ full: true
164
+ };
81
165
  var _default = exports["default"] = {
82
166
  title: 'Visualizations/DataTable/rowDetails'
83
167
  };
@@ -1,4 +1,4 @@
1
- import React, { ReactText, useState } from 'react';
1
+ import React, { useState } from 'react';
2
2
 
3
3
  import { Box, DataTable, Meter, Text } from 'grommet';
4
4
 
@@ -148,8 +148,8 @@ const DATA: RowType[] = [
148
148
 
149
149
  export const OnSelectDataTable = () => {
150
150
  // Type arguments can only be used in TypeScript files.
151
- // Remove <ReactText[]> if you are not using Typescript.
152
- const [select, setSelect] = useState<ReactText[]>([]);
151
+ // Remove <(number | string)[]> if you are not using Typescript.
152
+ const [select, setSelect] = useState<(number | string)[]>([]);
153
153
 
154
154
  return (
155
155
  // Uncomment <Grommet> lines when using outside of storybook