grommet 2.24.0 → 2.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (487) hide show
  1. package/all/stories/AllComponents.js +2 -7
  2. package/components/Accordion/Accordion.js +1 -1
  3. package/components/Accordion/propTypes.js +1 -1
  4. package/components/Accordion/stories/CustomThemed/Custom.js +3 -2
  5. package/components/AccordionPanel/AccordionPanel.js +2 -1
  6. package/components/Anchor/Anchor.js +15 -2
  7. package/components/Anchor/propTypes.js +1 -1
  8. package/components/Avatar/Avatar.js +1 -1
  9. package/components/Box/Box.js +1 -1
  10. package/components/Box/StyledBox.js +1 -1
  11. package/components/Box/propTypes.js +1 -1
  12. package/components/Button/Button.js +83 -10
  13. package/components/Button/StyledButtonKind.js +9 -3
  14. package/components/Button/index.d.ts +1 -1
  15. package/components/Button/propTypes.js +3 -3
  16. package/components/Button/stories/Basic.js +1 -1
  17. package/components/Button/stories/Fill.js +1 -1
  18. package/components/Button/stories/Kind.js +1 -1
  19. package/components/Calendar/Calendar.js +233 -293
  20. package/components/Calendar/index.d.ts +2 -2
  21. package/components/Calendar/propTypes.js +1 -1
  22. package/components/Calendar/stories/ShowAdjacentDays.js +1 -1
  23. package/components/Calendar/utils.js +16 -129
  24. package/components/Card/Card.js +1 -1
  25. package/components/Card/stories/CustomThemed/Clickable.js +1 -1
  26. package/components/Card/stories/CustomThemed/RichFooter.js +1 -1
  27. package/components/Card/stories/CustomThemed/Themed.js +1 -1
  28. package/components/CardBody/CardBody.js +1 -1
  29. package/components/CardFooter/CardFooter.js +1 -1
  30. package/components/CardHeader/CardHeader.js +1 -1
  31. package/components/Carousel/Carousel.js +1 -1
  32. package/components/Carousel/propTypes.js +1 -1
  33. package/components/Carousel/stories/CustomThemed/Custom.js +1 -1
  34. package/components/Chart/Chart.js +1 -1
  35. package/components/Chart/calcs.js +44 -27
  36. package/components/Chart/index.d.ts +28 -2
  37. package/components/Chart/propTypes.js +1 -1
  38. package/components/Chart/stories/Rich.js +1 -1
  39. package/components/Chart/stories/Scan.js +11 -9
  40. package/components/Chart/stories/Window.js +1 -1
  41. package/components/Chart/stories/data.js +16 -17
  42. package/components/CheckBox/CheckBox.js +4 -3
  43. package/components/CheckBox/stories/CustomThemed/Custom.js +1 -1
  44. package/components/CheckBox/stories/CustomThemed/CustomToggle.js +1 -1
  45. package/components/CheckBox/stories/NoLabel.js +1 -1
  46. package/components/CheckBox/stories/Simple.js +1 -1
  47. package/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
  48. package/components/Clock/Analog.js +1 -1
  49. package/components/Clock/Clock.js +1 -1
  50. package/components/Clock/Digital.js +1 -1
  51. package/components/Clock/propTypes.js +1 -1
  52. package/components/Collapsible/stories/Nested.js +1 -1
  53. package/components/Collapsible/stories/Simple.js +1 -1
  54. package/components/DataChart/DataChart.js +22 -55
  55. package/components/DataChart/Detail.js +18 -11
  56. package/components/DataChart/Legend.js +1 -1
  57. package/components/DataChart/Swatch.js +64 -23
  58. package/components/DataChart/XAxis.js +30 -19
  59. package/components/DataChart/YGuide.js +1 -1
  60. package/components/DataChart/propTypes.js +1 -1
  61. package/components/DataChart/stories/Legend.js +6 -2
  62. package/components/DataChart/stories/Pad.js +54 -0
  63. package/components/DataChart/utils.js +11 -1
  64. package/components/DataTable/Body.js +11 -5
  65. package/components/DataTable/Cell.js +1 -1
  66. package/components/DataTable/DataTable.js +14 -10
  67. package/components/DataTable/ExpanderCell.js +1 -1
  68. package/components/DataTable/Footer.js +1 -1
  69. package/components/DataTable/GroupedBody.js +1 -1
  70. package/components/DataTable/Header.js +1 -1
  71. package/components/DataTable/Resizer.js +1 -1
  72. package/components/DataTable/Sorter.js +1 -1
  73. package/components/DataTable/buildState.js +2 -2
  74. package/components/DataTable/index.d.ts +4 -1
  75. package/components/DataTable/propTypes.js +1 -1
  76. package/components/DataTable/stories/Controlled.js +1 -1
  77. package/components/DataTable/stories/ControlledGrouped.js +1 -1
  78. package/components/DataTable/stories/CustomThemed/Fill.js +1 -1
  79. package/components/DataTable/stories/GroupedOnSelect.js +1 -1
  80. package/components/DataTable/stories/OnUpdate.js +1 -1
  81. package/components/DataTable/stories/Served.js +1 -1
  82. package/components/DataTable/stories/Sort.js +1 -1
  83. package/components/DataTable/stories/SpaceX.js +3 -1
  84. package/components/DataTable/stories/SpaceXUngrouped.js +6 -2
  85. package/components/DataTable/stories/Tunable.js +1 -1
  86. package/components/DataTable/stories/data.js +1 -1
  87. package/components/DataTable/stories/rowDetails.js +1 -1
  88. package/components/DateInput/DateInput.js +89 -92
  89. package/components/DateInput/index.d.ts +1 -0
  90. package/components/DateInput/propTypes.js +1 -0
  91. package/components/DateInput/stories/Format.js +14 -1
  92. package/components/DateInput/utils.js +31 -6
  93. package/components/Diagram/Diagram.js +1 -1
  94. package/components/Diagram/stories/Animated.js +1 -1
  95. package/components/Diagram/stories/Progressing.js +1 -1
  96. package/components/Distribution/Distribution.js +1 -1
  97. package/components/Distribution/propTypes.js +1 -1
  98. package/components/Drop/Drop.js +1 -1
  99. package/components/Drop/DropContainer.js +1 -1
  100. package/components/DropButton/DropButton.js +1 -1
  101. package/components/DropButton/propTypes.js +1 -1
  102. package/components/FileInput/FileInput.js +28 -9
  103. package/components/FileInput/StyledFileInput.js +1 -1
  104. package/components/FileInput/stories/Multiple.js +1 -0
  105. package/components/FocusedContainer.js +1 -1
  106. package/components/Footer/Footer.js +1 -1
  107. package/components/Footer/stories/DoubleFooter.js +1 -1
  108. package/components/Footer/stories/Sitemap.js +1 -1
  109. package/components/Form/Form.js +79 -6
  110. package/components/Form/stories/ArrayOfFormFields.js +1 -1
  111. package/components/Form/stories/CustomThemed/FieldSpacingOptions.js +1 -1
  112. package/components/FormField/FormField.js +30 -30
  113. package/components/Grid/Grid.js +5 -3
  114. package/components/Grid/README.md +0 -2
  115. package/components/Grid/index.d.ts +4 -2
  116. package/components/Grid/propTypes.js +1 -1
  117. package/components/Grid/stories/CustomThemed/Responsive.js +1 -1
  118. package/components/Grid/stories/typescript/App.tsx +42 -48
  119. package/components/Grommet/Grommet.js +8 -3
  120. package/components/Grommet/index.d.ts +1 -0
  121. package/components/Grommet/propTypes.js +2 -1
  122. package/components/Header/Header.js +1 -1
  123. package/components/Heading/Heading.js +5 -3
  124. package/components/Heading/StyledHeading.js +1 -1
  125. package/components/Heading/index.d.ts +1 -0
  126. package/components/Heading/propTypes.js +3 -2
  127. package/components/Image/Image.js +5 -3
  128. package/components/Image/propTypes.js +1 -1
  129. package/components/InfiniteScroll/stories/Basics.js +1 -1
  130. package/components/InfiniteScroll/stories/ClassChildren.js +1 -1
  131. package/components/InfiniteScroll/stories/Marker.js +1 -1
  132. package/components/InfiniteScroll/stories/Show.js +1 -1
  133. package/components/InfiniteScroll/stories/ShowAfter.js +1 -1
  134. package/components/InfiniteScroll/stories/ShowBefore.js +1 -1
  135. package/components/Layer/Layer.js +1 -1
  136. package/components/Layer/LayerContainer.js +19 -1
  137. package/components/List/List.js +1 -1
  138. package/components/List/propTypes.js +1 -1
  139. package/components/Main/Main.js +1 -1
  140. package/components/Markdown/Markdown.js +1 -1
  141. package/components/MaskedInput/MaskedInput.js +37 -28
  142. package/components/Menu/Menu.js +109 -62
  143. package/components/Menu/index.d.ts +2 -2
  144. package/components/Menu/propTypes.js +2 -2
  145. package/components/Menu/stories/CustomThemed/Themed.tsx +6 -0
  146. package/components/Menu/stories/Grouped.js +52 -0
  147. package/components/Meter/Bar.js +1 -1
  148. package/components/Meter/Circle.js +9 -3
  149. package/components/Meter/Meter.js +1 -1
  150. package/components/Meter/propTypes.js +1 -1
  151. package/components/NameValueList/NameValueList.js +1 -1
  152. package/components/NameValuePair/NameValuePair.js +1 -1
  153. package/components/Nav/Nav.js +1 -1
  154. package/components/Nav/stories/CustomThemed/JustifySidebar.js +1 -1
  155. package/components/Nav/stories/Sidebar.js +1 -1
  156. package/components/Notification/Notification.js +1 -1
  157. package/components/Notification/index.d.ts +1 -1
  158. package/components/Notification/propTypes.js +1 -1
  159. package/components/Page/Page.js +1 -1
  160. package/components/PageContent/PageContent.js +1 -1
  161. package/components/PageHeader/PageHeader.js +23 -14
  162. package/components/PageHeader/index.d.ts +10 -1
  163. package/components/PageHeader/propTypes.js +2 -1
  164. package/components/PageHeader/stories/Size.js +55 -0
  165. package/components/Pagination/PageControl.js +1 -1
  166. package/components/Pagination/Pagination.js +1 -1
  167. package/components/Pagination/propTypes.js +1 -1
  168. package/components/Paragraph/Paragraph.js +1 -1
  169. package/components/Paragraph/StyledParagraph.js +7 -1
  170. package/components/Paragraph/index.d.ts +1 -0
  171. package/components/Paragraph/propTypes.js +2 -1
  172. package/components/Paragraph/stories/MaxLines.js +37 -0
  173. package/components/RadioButton/RadioButton.js +1 -1
  174. package/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  175. package/components/RadioButtonGroup/stories/CustomThemed/CustomTheme.js +1 -1
  176. package/components/RadioButtonGroup/stories/Disabled.js +1 -1
  177. package/components/RangeInput/RangeInput.js +1 -1
  178. package/components/RangeSelector/EdgeControl.js +1 -1
  179. package/components/RangeSelector/RangeSelector.js +1 -1
  180. package/components/RangeSelector/stories/CustomThemed/Custom.js +1 -1
  181. package/components/RangeSelector/stories/CustomThemed/CustomEdgeControl.js +1 -1
  182. package/components/RangeSelector/stories/Step.js +1 -1
  183. package/components/RangeSelector/stories/Vertical.js +1 -1
  184. package/components/RoutedAnchor/RoutedAnchor.js +2 -2
  185. package/components/RoutedButton/RoutedButton.js +2 -2
  186. package/components/Select/Select.js +11 -30
  187. package/components/Select/SelectContainer.js +97 -76
  188. package/components/Select/propTypes.js +1 -1
  189. package/components/Select/stories/Clear.js +7 -1
  190. package/components/Select/stories/components/SearchBorderBox.js +1 -1
  191. package/components/Select/stories/components/SearchInput.js +1 -1
  192. package/components/Select/utils.js +1 -0
  193. package/components/Sidebar/Sidebar.js +1 -1
  194. package/components/Sidebar/stories/Labels.js +1 -1
  195. package/components/SkipLink/SkipLink.js +1 -1
  196. package/components/SkipLinkTarget/SkipLinkTarget.js +1 -1
  197. package/components/Spinner/Spinner.js +2 -1
  198. package/components/Stack/Stack.js +1 -1
  199. package/components/Stack/propTypes.js +1 -1
  200. package/components/Tab/StyledTab.js +2 -2
  201. package/components/Tab/Tab.js +35 -17
  202. package/components/Table/propTypes.js +1 -1
  203. package/components/TableBody/TableBody.js +1 -1
  204. package/components/TableCell/TableCell.js +1 -1
  205. package/components/TableFooter/TableFooter.js +1 -1
  206. package/components/TableHeader/TableHeader.js +1 -1
  207. package/components/TableRow/TableRow.js +1 -1
  208. package/components/Tabs/Tabs.js +241 -11
  209. package/components/Tabs/propTypes.js +1 -1
  210. package/components/Tabs/stories/Responsive.js +18 -0
  211. package/components/Tag/Tag.js +1 -1
  212. package/components/Tag/propTypes.js +1 -1
  213. package/components/Text/Text.js +1 -1
  214. package/components/Text/propTypes.js +1 -1
  215. package/components/TextArea/TextArea.js +1 -1
  216. package/components/TextArea/stories/NonResizable.js +1 -1
  217. package/components/TextArea/stories/Simple.js +1 -1
  218. package/components/TextInput/TextInput.js +1 -1
  219. package/components/TextInput/stories/InsideFormField.js +1 -1
  220. package/components/TextInput/stories/WithTags.js +1 -1
  221. package/components/Tip/Tip.js +4 -23
  222. package/components/Video/StyledVideo.js +2 -2
  223. package/components/Video/Video.js +1 -1
  224. package/components/Video/propTypes.js +1 -1
  225. package/components/WorldMap/WorldMap.js +1 -1
  226. package/components/WorldMap/propTypes.js +1 -1
  227. package/components/WorldMap/stories/Places.js +1 -1
  228. package/contexts/AnalyticsContext/AnalyticsContext.js +65 -0
  229. package/contexts/AnalyticsContext/index.d.ts +7 -0
  230. package/contexts/AnalyticsContext/index.js +11 -0
  231. package/contexts/AnnounceContext/stories/Assertive.js +1 -1
  232. package/contexts/ResponsiveContext/stories/ResponsiveGrid.js +1 -1
  233. package/contexts/index.js +8 -0
  234. package/es6/all/stories/AllComponents.js +2 -7
  235. package/es6/components/Accordion/Accordion.js +1 -1
  236. package/es6/components/Accordion/propTypes.js +1 -1
  237. package/es6/components/Accordion/stories/CustomThemed/Custom.js +3 -2
  238. package/es6/components/AccordionPanel/AccordionPanel.js +2 -1
  239. package/es6/components/Anchor/Anchor.js +15 -3
  240. package/es6/components/Anchor/propTypes.js +1 -1
  241. package/es6/components/Avatar/Avatar.js +1 -1
  242. package/es6/components/Box/Box.js +1 -1
  243. package/es6/components/Box/StyledBox.js +1 -1
  244. package/es6/components/Box/propTypes.js +1 -1
  245. package/es6/components/Button/Button.js +84 -12
  246. package/es6/components/Button/StyledButtonKind.js +9 -3
  247. package/es6/components/Button/index.d.ts +1 -1
  248. package/es6/components/Button/propTypes.js +3 -3
  249. package/es6/components/Button/stories/Basic.js +1 -1
  250. package/es6/components/Button/stories/Fill.js +1 -1
  251. package/es6/components/Button/stories/Kind.js +1 -1
  252. package/es6/components/Calendar/Calendar.js +231 -293
  253. package/es6/components/Calendar/index.d.ts +2 -2
  254. package/es6/components/Calendar/propTypes.js +1 -1
  255. package/es6/components/Calendar/stories/ShowAdjacentDays.js +1 -1
  256. package/es6/components/Calendar/utils.js +13 -114
  257. package/es6/components/Card/Card.js +1 -1
  258. package/es6/components/Card/stories/CustomThemed/Clickable.js +1 -1
  259. package/es6/components/Card/stories/CustomThemed/RichFooter.js +1 -1
  260. package/es6/components/Card/stories/CustomThemed/Themed.js +1 -1
  261. package/es6/components/CardBody/CardBody.js +1 -1
  262. package/es6/components/CardFooter/CardFooter.js +1 -1
  263. package/es6/components/CardHeader/CardHeader.js +1 -1
  264. package/es6/components/Carousel/Carousel.js +1 -1
  265. package/es6/components/Carousel/propTypes.js +1 -1
  266. package/es6/components/Carousel/stories/CustomThemed/Custom.js +1 -1
  267. package/es6/components/Chart/Chart.js +1 -1
  268. package/es6/components/Chart/calcs.js +44 -27
  269. package/es6/components/Chart/index.d.ts +28 -2
  270. package/es6/components/Chart/propTypes.js +1 -1
  271. package/es6/components/Chart/stories/Rich.js +1 -1
  272. package/es6/components/Chart/stories/Scan.js +10 -9
  273. package/es6/components/Chart/stories/Window.js +1 -1
  274. package/es6/components/Chart/stories/data.js +16 -17
  275. package/es6/components/CheckBox/CheckBox.js +4 -3
  276. package/es6/components/CheckBox/stories/CustomThemed/Custom.js +1 -1
  277. package/es6/components/CheckBox/stories/CustomThemed/CustomToggle.js +1 -1
  278. package/es6/components/CheckBox/stories/NoLabel.js +1 -1
  279. package/es6/components/CheckBox/stories/Simple.js +1 -1
  280. package/es6/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
  281. package/es6/components/Clock/Analog.js +1 -1
  282. package/es6/components/Clock/Clock.js +1 -1
  283. package/es6/components/Clock/Digital.js +1 -1
  284. package/es6/components/Clock/propTypes.js +1 -1
  285. package/es6/components/Collapsible/stories/Nested.js +1 -1
  286. package/es6/components/Collapsible/stories/Simple.js +1 -1
  287. package/es6/components/DataChart/DataChart.js +24 -57
  288. package/es6/components/DataChart/Detail.js +20 -10
  289. package/es6/components/DataChart/Legend.js +1 -1
  290. package/es6/components/DataChart/Swatch.js +64 -23
  291. package/es6/components/DataChart/XAxis.js +30 -20
  292. package/es6/components/DataChart/YGuide.js +1 -1
  293. package/es6/components/DataChart/propTypes.js +1 -1
  294. package/es6/components/DataChart/stories/Legend.js +6 -2
  295. package/es6/components/DataChart/stories/Pad.js +42 -0
  296. package/es6/components/DataChart/utils.js +7 -0
  297. package/es6/components/DataTable/Body.js +10 -5
  298. package/es6/components/DataTable/Cell.js +1 -1
  299. package/es6/components/DataTable/DataTable.js +14 -10
  300. package/es6/components/DataTable/ExpanderCell.js +1 -1
  301. package/es6/components/DataTable/Footer.js +1 -1
  302. package/es6/components/DataTable/GroupedBody.js +1 -1
  303. package/es6/components/DataTable/Header.js +1 -1
  304. package/es6/components/DataTable/Resizer.js +1 -1
  305. package/es6/components/DataTable/Sorter.js +1 -1
  306. package/es6/components/DataTable/buildState.js +2 -2
  307. package/es6/components/DataTable/index.d.ts +4 -1
  308. package/es6/components/DataTable/propTypes.js +1 -1
  309. package/es6/components/DataTable/stories/Controlled.js +1 -1
  310. package/es6/components/DataTable/stories/ControlledGrouped.js +1 -1
  311. package/es6/components/DataTable/stories/CustomThemed/Fill.js +1 -1
  312. package/es6/components/DataTable/stories/GroupedOnSelect.js +1 -1
  313. package/es6/components/DataTable/stories/OnUpdate.js +1 -1
  314. package/es6/components/DataTable/stories/Served.js +1 -1
  315. package/es6/components/DataTable/stories/Sort.js +1 -1
  316. package/es6/components/DataTable/stories/SpaceX.js +3 -1
  317. package/es6/components/DataTable/stories/SpaceXUngrouped.js +6 -2
  318. package/es6/components/DataTable/stories/Tunable.js +1 -1
  319. package/es6/components/DataTable/stories/data.js +1 -1
  320. package/es6/components/DataTable/stories/rowDetails.js +1 -1
  321. package/es6/components/DateInput/DateInput.js +85 -88
  322. package/es6/components/DateInput/index.d.ts +1 -0
  323. package/es6/components/DateInput/propTypes.js +1 -0
  324. package/es6/components/DateInput/stories/Format.js +14 -1
  325. package/es6/components/DateInput/utils.js +30 -8
  326. package/es6/components/Diagram/Diagram.js +1 -1
  327. package/es6/components/Diagram/stories/Animated.js +1 -1
  328. package/es6/components/Diagram/stories/Progressing.js +1 -1
  329. package/es6/components/Distribution/Distribution.js +1 -1
  330. package/es6/components/Distribution/propTypes.js +1 -1
  331. package/es6/components/Drop/Drop.js +1 -1
  332. package/es6/components/Drop/DropContainer.js +1 -1
  333. package/es6/components/DropButton/DropButton.js +1 -1
  334. package/es6/components/DropButton/propTypes.js +1 -1
  335. package/es6/components/FileInput/FileInput.js +28 -9
  336. package/es6/components/FileInput/StyledFileInput.js +1 -1
  337. package/es6/components/FileInput/stories/Multiple.js +1 -0
  338. package/es6/components/FocusedContainer.js +1 -1
  339. package/es6/components/Footer/Footer.js +1 -1
  340. package/es6/components/Footer/stories/DoubleFooter.js +1 -1
  341. package/es6/components/Footer/stories/Sitemap.js +1 -1
  342. package/es6/components/Form/Form.js +77 -6
  343. package/es6/components/Form/stories/ArrayOfFormFields.js +1 -1
  344. package/es6/components/Form/stories/CustomThemed/FieldSpacingOptions.js +1 -1
  345. package/es6/components/FormField/FormField.js +30 -31
  346. package/es6/components/Grid/Grid.js +5 -3
  347. package/es6/components/Grid/README.md +0 -2
  348. package/es6/components/Grid/index.d.ts +4 -2
  349. package/es6/components/Grid/propTypes.js +1 -1
  350. package/es6/components/Grid/stories/CustomThemed/Responsive.js +1 -1
  351. package/es6/components/Grid/stories/typescript/App.tsx +42 -48
  352. package/es6/components/Grommet/Grommet.js +7 -3
  353. package/es6/components/Grommet/index.d.ts +1 -0
  354. package/es6/components/Grommet/propTypes.js +2 -1
  355. package/es6/components/Header/Header.js +1 -1
  356. package/es6/components/Heading/Heading.js +5 -3
  357. package/es6/components/Heading/StyledHeading.js +1 -1
  358. package/es6/components/Heading/index.d.ts +1 -0
  359. package/es6/components/Heading/propTypes.js +3 -2
  360. package/es6/components/Image/Image.js +5 -3
  361. package/es6/components/Image/propTypes.js +1 -1
  362. package/es6/components/InfiniteScroll/stories/Basics.js +1 -1
  363. package/es6/components/InfiniteScroll/stories/ClassChildren.js +1 -1
  364. package/es6/components/InfiniteScroll/stories/Marker.js +1 -1
  365. package/es6/components/InfiniteScroll/stories/Show.js +1 -1
  366. package/es6/components/InfiniteScroll/stories/ShowAfter.js +1 -1
  367. package/es6/components/InfiniteScroll/stories/ShowBefore.js +1 -1
  368. package/es6/components/Layer/Layer.js +1 -1
  369. package/es6/components/Layer/LayerContainer.js +18 -1
  370. package/es6/components/List/List.js +1 -1
  371. package/es6/components/List/propTypes.js +1 -1
  372. package/es6/components/Main/Main.js +1 -1
  373. package/es6/components/Markdown/Markdown.js +1 -1
  374. package/es6/components/MaskedInput/MaskedInput.js +38 -29
  375. package/es6/components/Menu/Menu.js +110 -62
  376. package/es6/components/Menu/index.d.ts +2 -2
  377. package/es6/components/Menu/propTypes.js +2 -2
  378. package/es6/components/Menu/stories/CustomThemed/Themed.tsx +6 -0
  379. package/es6/components/Menu/stories/Grouped.js +40 -0
  380. package/es6/components/Meter/Bar.js +1 -1
  381. package/es6/components/Meter/Circle.js +9 -3
  382. package/es6/components/Meter/Meter.js +1 -1
  383. package/es6/components/Meter/propTypes.js +1 -1
  384. package/es6/components/NameValueList/NameValueList.js +1 -1
  385. package/es6/components/NameValuePair/NameValuePair.js +1 -1
  386. package/es6/components/Nav/Nav.js +1 -1
  387. package/es6/components/Nav/stories/CustomThemed/JustifySidebar.js +1 -1
  388. package/es6/components/Nav/stories/Sidebar.js +1 -1
  389. package/es6/components/Notification/Notification.js +1 -1
  390. package/es6/components/Notification/index.d.ts +1 -1
  391. package/es6/components/Notification/propTypes.js +1 -1
  392. package/es6/components/Page/Page.js +1 -1
  393. package/es6/components/PageContent/PageContent.js +1 -1
  394. package/es6/components/PageHeader/PageHeader.js +24 -14
  395. package/es6/components/PageHeader/index.d.ts +10 -1
  396. package/es6/components/PageHeader/propTypes.js +2 -1
  397. package/es6/components/PageHeader/stories/Size.js +43 -0
  398. package/es6/components/Pagination/PageControl.js +1 -1
  399. package/es6/components/Pagination/Pagination.js +1 -1
  400. package/es6/components/Pagination/propTypes.js +1 -1
  401. package/es6/components/Paragraph/Paragraph.js +1 -1
  402. package/es6/components/Paragraph/StyledParagraph.js +8 -1
  403. package/es6/components/Paragraph/index.d.ts +1 -0
  404. package/es6/components/Paragraph/propTypes.js +2 -1
  405. package/es6/components/Paragraph/stories/MaxLines.js +24 -0
  406. package/es6/components/RadioButton/RadioButton.js +1 -1
  407. package/es6/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  408. package/es6/components/RadioButtonGroup/stories/CustomThemed/CustomTheme.js +1 -1
  409. package/es6/components/RadioButtonGroup/stories/Disabled.js +1 -1
  410. package/es6/components/RangeInput/RangeInput.js +1 -1
  411. package/es6/components/RangeSelector/EdgeControl.js +1 -1
  412. package/es6/components/RangeSelector/RangeSelector.js +1 -1
  413. package/es6/components/RangeSelector/stories/CustomThemed/Custom.js +1 -1
  414. package/es6/components/RangeSelector/stories/CustomThemed/CustomEdgeControl.js +1 -1
  415. package/es6/components/RangeSelector/stories/Step.js +1 -1
  416. package/es6/components/RangeSelector/stories/Vertical.js +1 -1
  417. package/es6/components/RoutedAnchor/RoutedAnchor.js +2 -2
  418. package/es6/components/RoutedButton/RoutedButton.js +2 -2
  419. package/es6/components/Select/Select.js +12 -31
  420. package/es6/components/Select/SelectContainer.js +97 -78
  421. package/es6/components/Select/propTypes.js +1 -1
  422. package/es6/components/Select/stories/Clear.js +7 -1
  423. package/es6/components/Select/stories/components/SearchBorderBox.js +1 -1
  424. package/es6/components/Select/stories/components/SearchInput.js +1 -1
  425. package/es6/components/Select/utils.js +1 -0
  426. package/es6/components/Sidebar/Sidebar.js +1 -1
  427. package/es6/components/Sidebar/stories/Labels.js +1 -1
  428. package/es6/components/SkipLink/SkipLink.js +1 -1
  429. package/es6/components/SkipLinkTarget/SkipLinkTarget.js +1 -1
  430. package/es6/components/Spinner/Spinner.js +2 -1
  431. package/es6/components/Stack/Stack.js +1 -1
  432. package/es6/components/Stack/propTypes.js +1 -1
  433. package/es6/components/Tab/StyledTab.js +2 -2
  434. package/es6/components/Tab/Tab.js +35 -18
  435. package/es6/components/Table/propTypes.js +1 -1
  436. package/es6/components/TableBody/TableBody.js +1 -1
  437. package/es6/components/TableCell/TableCell.js +1 -1
  438. package/es6/components/TableFooter/TableFooter.js +1 -1
  439. package/es6/components/TableHeader/TableHeader.js +1 -1
  440. package/es6/components/TableRow/TableRow.js +1 -1
  441. package/es6/components/Tabs/Tabs.js +236 -12
  442. package/es6/components/Tabs/propTypes.js +1 -1
  443. package/es6/components/Tabs/stories/Responsive.js +18 -0
  444. package/es6/components/Tag/Tag.js +1 -1
  445. package/es6/components/Tag/propTypes.js +1 -1
  446. package/es6/components/Text/Text.js +1 -1
  447. package/es6/components/Text/propTypes.js +1 -1
  448. package/es6/components/TextArea/TextArea.js +1 -1
  449. package/es6/components/TextArea/stories/NonResizable.js +1 -1
  450. package/es6/components/TextArea/stories/Simple.js +1 -1
  451. package/es6/components/TextInput/TextInput.js +1 -1
  452. package/es6/components/TextInput/stories/InsideFormField.js +1 -1
  453. package/es6/components/TextInput/stories/WithTags.js +1 -1
  454. package/es6/components/Tip/Tip.js +4 -23
  455. package/es6/components/Video/StyledVideo.js +2 -2
  456. package/es6/components/Video/Video.js +1 -1
  457. package/es6/components/Video/propTypes.js +1 -1
  458. package/es6/components/WorldMap/WorldMap.js +1 -1
  459. package/es6/components/WorldMap/propTypes.js +1 -1
  460. package/es6/components/WorldMap/stories/Places.js +1 -1
  461. package/es6/contexts/AnalyticsContext/AnalyticsContext.js +47 -0
  462. package/es6/contexts/AnalyticsContext/index.d.ts +7 -0
  463. package/es6/contexts/AnalyticsContext/index.js +1 -0
  464. package/es6/contexts/AnnounceContext/stories/Assertive.js +1 -1
  465. package/es6/contexts/ResponsiveContext/stories/ResponsiveGrid.js +1 -1
  466. package/es6/contexts/index.js +1 -0
  467. package/es6/index.d.ts +1 -0
  468. package/es6/themes/base.d.ts +65 -33
  469. package/es6/themes/base.js +70 -2
  470. package/es6/utils/index.js +2 -1
  471. package/es6/utils/mixins.js +3 -0
  472. package/es6/utils/object.js +1 -1
  473. package/es6/utils/pagination.js +1 -1
  474. package/es6/utils/use-keyboard.js +25 -0
  475. package/grommet.min.js +1 -1
  476. package/grommet.min.js.map +1 -1
  477. package/index.d.ts +1 -0
  478. package/package.json +63 -55
  479. package/themes/base.d.ts +65 -33
  480. package/themes/base.js +70 -2
  481. package/tools/pack.js +20 -13
  482. package/tools/release-stable.js +2 -4
  483. package/utils/index.js +8 -0
  484. package/utils/mixins.js +7 -1
  485. package/utils/object.js +1 -1
  486. package/utils/pagination.js +1 -1
  487. package/utils/use-keyboard.js +34 -0
@@ -1,7 +1,7 @@
1
- var _excluded = ["buttonProps", "calendarProps", "defaultValue", "disabled", "dropProps", "format", "id", "icon", "inline", "inputProps", "name", "onChange", "onFocus", "plain", "value", "messages"],
1
+ var _excluded = ["buttonProps", "calendarProps", "defaultValue", "disabled", "dropProps", "format", "id", "icon", "inline", "inputProps", "name", "onChange", "onFocus", "plain", "reverse", "value", "messages"],
2
2
  _excluded2 = ["icon"];
3
3
 
4
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
5
 
6
6
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7
7
 
@@ -20,9 +20,34 @@ import { FormContext } from '../Form';
20
20
  import { Keyboard } from '../Keyboard';
21
21
  import { MaskedInput } from '../MaskedInput';
22
22
  import { useForwardedRef } from '../../utils';
23
- import { getTimestamp, normalizeForTimezone } from '../Calendar/utils';
24
23
  import { formatToSchema, schemaToMask, valuesAreEqual, valueToText, textToValue } from './utils';
25
24
  import { DateInputPropTypes } from './propTypes';
25
+ import { getOutputFormat } from '../Calendar/Calendar';
26
+
27
+ var getReference = function getReference(value) {
28
+ var adjustedDate;
29
+ var res;
30
+ if (typeof value === 'string') res = value;else if (Array.isArray(value) && Array.isArray(value[0])) res = value[0].find(function (date) {
31
+ return date;
32
+ });else if (Array.isArray(value) && value.length) {
33
+ res = value[0];
34
+ }
35
+
36
+ if (res) {
37
+ var _res;
38
+
39
+ adjustedDate = new Date(res); // if time is not specified in ISOstring, normalize to midnight
40
+
41
+ if (((_res = res) == null ? void 0 : _res.indexOf('T')) === -1) {
42
+ var offset = adjustedDate.getTimezoneOffset();
43
+ var hour = adjustedDate.getHours();
44
+ adjustedDate.setHours(hour, offset);
45
+ }
46
+ }
47
+
48
+ return adjustedDate;
49
+ };
50
+
26
51
  var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
27
52
  var buttonProps = _ref.buttonProps,
28
53
  calendarProps = _ref.calendarProps,
@@ -39,6 +64,8 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
39
64
  _onChange = _ref.onChange,
40
65
  _onFocus = _ref.onFocus,
41
66
  plain = _ref.plain,
67
+ _ref$reverse = _ref.reverse,
68
+ reverseProp = _ref$reverse === void 0 ? false : _ref$reverse,
42
69
  valueArg = _ref.value,
43
70
  messages = _ref.messages,
44
71
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
@@ -65,25 +92,24 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
65
92
  value = _useFormInput[0],
66
93
  setValue = _useFormInput[1];
67
94
 
68
- var timestamp = useMemo(function () {
69
- if (Array.isArray(defaultValue) && defaultValue.length) return getTimestamp(defaultValue[0]);
70
- if (typeof defaultValue === 'string') return getTimestamp(defaultValue);
71
- if (Array.isArray(value) && value.length) return getTimestamp(value[0]); // check to see if value is not an empty string
72
- // empty string should behave like undefined
95
+ var _useState = useState(getOutputFormat(value)),
96
+ outputFormat = _useState[0],
97
+ setOutputFormat = _useState[1];
73
98
 
74
- if (typeof value === 'string' && value.length) return getTimestamp(value);
75
- return undefined;
76
- }, [defaultValue, value]); // whether or not we should normalize the date based on the timestamp.
77
- // will be set to false if the initial timestamp is undefined (meaning
78
- // a user did not provide a defaultValue or value). in this case, we
79
- // will just rely on the UTC timestamp and don't need to normalize.
99
+ useEffect(function () {
100
+ setOutputFormat(function (previousFormat) {
101
+ var nextFormat = getOutputFormat(value); // when user types, date could become something like 07//2020
102
+ // and value becomes undefined. don't lose the format from the
103
+ // previous valid date
80
104
 
81
- var _useState = useState(true),
82
- normalize = _useState[0],
83
- setNormalize = _useState[1]; // normalize value based on timestamp vs user's local timezone
105
+ return previousFormat !== nextFormat ? previousFormat : nextFormat;
106
+ });
107
+ }, [value]); // keep track of timestamp from original date(s)
84
108
 
109
+ var _useState2 = useState(getReference(value)),
110
+ reference = _useState2[0],
111
+ setReference = _useState2[1]; // do we expect multiple dates?
85
112
 
86
- var normalizedDate = normalizeForTimezone(value, timestamp, normalize); // do we expect multiple dates?
87
113
 
88
114
  var range = Array.isArray(value) || format && format.includes('-'); // parse format and build a formal schema we can use elsewhere
89
115
 
@@ -95,9 +121,9 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
95
121
  return schemaToMask(schema);
96
122
  }, [schema]); // textValue is only used when a format is provided
97
123
 
98
- var _useState2 = useState(schema ? valueToText(normalizedDate, schema) : undefined),
99
- textValue = _useState2[0],
100
- setTextValue = _useState2[1]; // Setting the icon through `inputProps` is deprecated.
124
+ var _useState3 = useState(schema ? valueToText(value, schema) : undefined),
125
+ textValue = _useState3[0],
126
+ setTextValue = _useState3[1]; // Setting the icon through `inputProps` is deprecated.
101
127
  // The `icon` prop should be used instead.
102
128
 
103
129
 
@@ -107,27 +133,32 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
107
133
 
108
134
  if (MaskedInputIcon) {
109
135
  console.warn("Customizing the DateInput icon through inputProps is deprecated. \nUse the icon prop instead.");
110
- } // We need to distinguish between the caller changing a Form value
136
+ }
137
+
138
+ var reverse = reverseProp || restOfInputProps.reverse;
139
+ var calendarDropdownAlign = {
140
+ top: 'bottom',
141
+ left: 'left'
142
+ }; // We need to distinguish between the caller changing a Form value
111
143
  // and the user typing a date that he isn't finished with yet.
112
144
  // To handle this, we see if we have a value and the text value
113
145
  // associated with it doesn't align to it, then we update the text value.
114
146
  // We compare using textToValue to avoid "06/01/2021" not
115
147
  // matching "06/1/2021".
116
148
 
117
-
118
149
  useEffect(function () {
119
150
  if (schema && value !== undefined) {
120
- var nextTextValue = valueToText(normalizedDate, schema);
151
+ var nextTextValue = valueToText(value, schema);
121
152
 
122
- if (!valuesAreEqual(textToValue(textValue, schema, range, timestamp), textToValue(nextTextValue, schema, range, timestamp)) || textValue === '' && nextTextValue !== '') {
153
+ if (!valuesAreEqual(textToValue(textValue, schema, range, reference), textToValue(nextTextValue, schema, range, reference)) || textValue === '' && nextTextValue !== '') {
123
154
  setTextValue(nextTextValue);
124
155
  }
125
156
  }
126
- }, [range, schema, textValue, value, normalizedDate, timestamp]); // when format and not inline, whether to show the Calendar in a Drop
157
+ }, [range, schema, textValue, reference, value]); // when format and not inline, whether to show the Calendar in a Drop
127
158
 
128
- var _useState3 = useState(),
129
- open = _useState3[0],
130
- setOpen = _useState3[1];
159
+ var _useState4 = useState(),
160
+ open = _useState4[0],
161
+ setOpen = _useState4[1];
131
162
 
132
163
  var openCalendar = useCallback(function () {
133
164
  setOpen(true);
@@ -147,33 +178,23 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
147
178
  ref: inline ? ref : undefined,
148
179
  id: inline && !format ? id : undefined,
149
180
  range: range,
150
- date: range ? undefined : normalizedDate // when caller initializes with empty array, dates should be undefined
181
+ date: range ? undefined : value // when caller initializes with empty array, dates should be undefined
151
182
  // allowing the user to select both begin and end of the range
152
183
  ,
153
- dates: range && value.length ? [normalizedDate] : undefined // places focus on days grid when Calendar opens
184
+ dates: range && value.length ? [value] : undefined // places focus on days grid when Calendar opens
154
185
  ,
155
186
  initialFocus: open ? 'days' : undefined,
156
- normalize: normalize,
157
187
  onSelect: disabled ? undefined : function (nextValue) {
158
188
  var normalizedValue;
159
189
 
160
190
  if (range && Array.isArray(nextValue)) {
161
191
  normalizedValue = nextValue[0];
162
192
  } // clicking an edge date removes it
163
- else if (range) normalizedValue = [nextValue, nextValue];else normalizedValue = nextValue; // timestamp will be undefined if no defaultValue or value have
164
- // been passed in, indicating that we should stay local if the
165
- // user first picks a date via the Calendar.
166
-
167
-
168
- var nextNormalize = normalize;
169
-
170
- if (timestamp === undefined) {
171
- nextNormalize = false;
172
- setNormalize(nextNormalize);
173
- }
193
+ else if (range) normalizedValue = [nextValue, nextValue];else normalizedValue = nextValue;
174
194
 
175
- if (schema) setTextValue(valueToText(normalizeForTimezone(normalizedValue, undefined, nextNormalize), schema));
195
+ if (schema) setTextValue(valueToText(normalizedValue, schema));
176
196
  setValue(normalizedValue);
197
+ setReference(getReference(nextValue));
177
198
  if (_onChange) _onChange({
178
199
  value: normalizedValue
179
200
  });
@@ -185,9 +206,7 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
185
206
  }, 1);
186
207
  }
187
208
  }
188
- }, _extends({}, calendarProps, {
189
- timestamp: timestamp
190
- })));
209
+ }, calendarProps));
191
210
  var formContextValue = useMemo(function () {
192
211
  return {
193
212
  useFormInput: function useFormInput(_ref3) {
@@ -204,10 +223,7 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
204
223
  ref: ref,
205
224
  id: id,
206
225
  dropProps: _extends({
207
- align: {
208
- top: 'bottom',
209
- left: 'left'
210
- }
226
+ align: calendarDropdownAlign
211
227
  }, dropProps),
212
228
  dropContent: calendar,
213
229
  icon: icon || MaskedInputIcon || /*#__PURE__*/React.createElement(CalendarIcon, {
@@ -216,6 +232,18 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
216
232
  }, buttonProps));
217
233
  }
218
234
 
235
+ var calendarButton = /*#__PURE__*/React.createElement(Button, {
236
+ onClick: open ? closeCalendar : openCalendar,
237
+ plain: true,
238
+ icon: icon || MaskedInputIcon || /*#__PURE__*/React.createElement(CalendarIcon, {
239
+ size: iconSize
240
+ }),
241
+ margin: reverse ? {
242
+ left: 'small'
243
+ } : {
244
+ right: 'small'
245
+ }
246
+ });
219
247
  var input = /*#__PURE__*/React.createElement(FormContext.Provider, {
220
248
  key: "input" // don't let MaskedInput drive the Form
221
249
  ,
@@ -234,7 +262,7 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
234
262
  round: "xxsmall",
235
263
  direction: "row",
236
264
  fill: true
237
- }, /*#__PURE__*/React.createElement(MaskedInput, _extends({
265
+ }, reverse && calendarButton, /*#__PURE__*/React.createElement(MaskedInput, _extends({
238
266
  ref: ref,
239
267
  id: id,
240
268
  name: name,
@@ -247,27 +275,8 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
247
275
  onChange: function onChange(event) {
248
276
  var nextTextValue = event.target.value;
249
277
  setTextValue(nextTextValue);
250
- var localTimestamp; // get the UTC timestamp relative to the user's timezone
251
- // once a date is complete
252
-
253
- if (timestamp === undefined && Date.parse(nextTextValue)) {
254
- var _Date$toISOString$spl = new Date(nextTextValue).toISOString().split('T');
255
-
256
- localTimestamp = _Date$toISOString$spl[1];
257
- } // timestamp will be undefined if no defaultValue or value have
258
- // been passed in, indicating that we should stay local
259
-
260
-
261
- var nextNormalize = normalize;
262
-
263
- if (timestamp === undefined) {
264
- nextNormalize = false;
265
- setNormalize(nextNormalize);
266
- }
267
-
268
- var nextValue = textToValue(nextTextValue, schema, range, timestamp || localTimestamp, nextNormalize); // reset to original state
269
-
270
- if (nextValue === undefined) setNormalize(true); // update value even when undefined
278
+ var nextValue = textToValue(nextTextValue, schema, range, reference, outputFormat);
279
+ if (nextValue !== undefined) setReference(getReference(nextValue)); // update value even when undefined
271
280
 
272
281
  setValue(nextValue);
273
282
 
@@ -287,16 +296,7 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
287
296
  }));
288
297
  if (_onFocus) _onFocus(event);
289
298
  }
290
- })), /*#__PURE__*/React.createElement(Button, {
291
- onClick: open ? closeCalendar : openCalendar,
292
- plain: true,
293
- icon: icon || MaskedInputIcon || /*#__PURE__*/React.createElement(CalendarIcon, {
294
- size: iconSize
295
- }),
296
- margin: {
297
- right: 'small'
298
- }
299
- }))));
299
+ })), !reverse && calendarButton)));
300
300
 
301
301
  if (inline) {
302
302
  return /*#__PURE__*/React.createElement(Box, null, input, calendar);
@@ -311,11 +311,8 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
311
311
  }, /*#__PURE__*/React.createElement(Drop, _extends({
312
312
  overflow: "visible",
313
313
  id: id ? id + "__drop" : undefined,
314
- target: ref.current,
315
- align: _extends({
316
- top: 'bottom',
317
- left: 'left'
318
- }, dropProps),
314
+ target: containerRef.current,
315
+ align: _extends({}, calendarDropdownAlign, dropProps),
319
316
  onEsc: closeCalendar,
320
317
  onClickOutside: function onClickOutside(_ref4) {
321
318
  var target = _ref4.target;
@@ -14,6 +14,7 @@ export interface DateInputProps {
14
14
  icon?: JSX.Element;
15
15
  id?: string;
16
16
  inline?: boolean;
17
+ reverse?: boolean;
17
18
  inputProps?: MaskedInputType;
18
19
  messages?: {
19
20
  enterCalendar?: string;
@@ -11,6 +11,7 @@ if (process.env.NODE_ENV !== 'production') {
11
11
  icon: PropTypes.element,
12
12
  id: PropTypes.string,
13
13
  inline: PropTypes.bool,
14
+ reverse: PropTypes.bool,
14
15
  inputProps: PropTypes.shape({}),
15
16
  name: PropTypes.string,
16
17
  onChange: PropTypes.func,
@@ -16,11 +16,24 @@ export var Format = function Format() {
16
16
  align: "center",
17
17
  pad: "large"
18
18
  }, /*#__PURE__*/React.createElement(Box, {
19
- width: "medium"
19
+ width: "medium",
20
+ margin: {
21
+ vertical: 'small'
22
+ }
20
23
  }, /*#__PURE__*/React.createElement(DateInput, {
21
24
  format: "m/d/yy",
22
25
  value: value,
23
26
  onChange: onChange
27
+ })), /*#__PURE__*/React.createElement(Box, {
28
+ width: "medium",
29
+ margin: {
30
+ vertical: 'small'
31
+ }
32
+ }, /*#__PURE__*/React.createElement(DateInput, {
33
+ format: "m/d/yy",
34
+ value: value,
35
+ reverse: true,
36
+ onChange: onChange
24
37
  })));
25
38
  };
26
39
  export default {
@@ -1,9 +1,15 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
2
2
 
3
- // Converting between Date and String types is handled via a "schema".
3
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
4
+
5
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
6
+
7
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
8
+
9
+ import { handleOffset } from '../Calendar/utils'; // Converting between Date and String types is handled via a "schema".
4
10
  // The schema is an array of strings, split into strings with identical
5
11
  // characters. So, 'mm/dd/yyyy' will be ['mm', '/', 'dd', '/', 'yyyyy'].
6
- import { formatToLocalYYYYMMDD } from '../Calendar/utils';
12
+
7
13
  export var formatToSchema = function formatToSchema(format) {
8
14
  if (!format) return undefined;
9
15
  var result = [];
@@ -70,7 +76,16 @@ export var valueToText = function valueToText(value, schema) {
70
76
 
71
77
  if (!value || Array.isArray(value) && !value.length) return text;
72
78
  var dates = (Array.isArray(value) ? value : [value]).map(function (v) {
73
- return new Date(v);
79
+ // TO DO should we extract this to a reusable function?
80
+ var adjustedDate = new Date(v); // if time is not specified in ISOstring, normalize to midnight
81
+
82
+ if (v.indexOf('T') === -1) {
83
+ var offset = adjustedDate.getTimezoneOffset();
84
+ var hour = adjustedDate.getHours();
85
+ adjustedDate.setHours(hour, offset);
86
+ }
87
+
88
+ return adjustedDate;
74
89
  });
75
90
  var dateIndex = 0;
76
91
  var parts = {};
@@ -126,7 +141,7 @@ var pullDigits = function pullDigits(text, index) {
126
141
  return text.slice(index, end);
127
142
  };
128
143
 
129
- export var textToValue = function textToValue(text, schema, range, timestamp, normalize) {
144
+ export var textToValue = function textToValue(text, schema, range, reference, outputFormat) {
130
145
  if (!text) return range ? [] : undefined;
131
146
  var result;
132
147
 
@@ -134,10 +149,17 @@ export var textToValue = function textToValue(text, schema, range, timestamp, no
134
149
  var leapYear = parts.y % 4 === 0 && parts.y % 100 !== 0 || parts.y % 400 === 0; // Do a little sanity checking on the parts first.
135
150
  // If not valid, leave as is.
136
151
 
137
- if (!parts.m || !parts.d || !parts.y || parts.y.length < 4 || parts.m.length > 2 || parts.d.length > 2 || parts.m > 12 || parts.d > 31 || (parts.m === "02" || parts.m === "2") && parts.d > (leapYear ? 29 : 28)) return parts;
138
- var date = new Date(parts.y, parts.m - 1, parts.d).toISOString(); // match time and timezone of any supplied valueProp
152
+ if (!parts.m || !parts.d || !parts.y || parts.y.length < 4 || parts.m.length > 2 || parts.d.length > 2 || parts.m > 12 || parts.d > 31 || (parts.m === "02" || parts.m === "2") && parts.d > (leapYear ? 29 : 28)) return parts; // use time info from reference date
153
+
154
+ var time = reference ? [reference.getHours(), reference.getMinutes(), reference.getSeconds(), reference.getMilliseconds()] : null;
155
+
156
+ var date = _construct(Date, [parts.y, parts.m - 1, parts.d].concat(time)).toISOString();
139
157
 
140
- if (timestamp) date = formatToLocalYYYYMMDD(date, normalize).split('T')[0] + "T" + timestamp;else date = "" + formatToLocalYYYYMMDD(date, normalize).split('T')[0];
158
+ if (date && outputFormat === 'no timezone') {
159
+ var _handleOffset$toISOSt = handleOffset(date).toISOString().split('T');
160
+
161
+ date = _handleOffset$toISOSt[0];
162
+ }
141
163
 
142
164
  if (!range) {
143
165
  if (!result) result = date;
@@ -1,7 +1,7 @@
1
1
  var _excluded = ["connections"],
2
2
  _excluded2 = ["anchor", "animation", "color", "offset", "round", "thickness", "type"];
3
3
 
4
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
5
 
6
6
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7
7
 
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React, { useReducer, useEffect } from 'react';
4
4
  import { Box, Diagram, Stack, Text } from 'grommet';
@@ -1,7 +1,7 @@
1
1
  var _excluded = ["id"],
2
2
  _excluded2 = ["color"];
3
3
 
4
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
5
 
6
6
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7
7
 
@@ -1,6 +1,6 @@
1
1
  var _excluded = ["basis", "children", "direction", "fill", "gap", "values"];
2
2
 
3
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
5
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
6
 
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import PropTypes from 'prop-types';
4
4
  import { genericProps } from '../../utils/general-prop-types';
@@ -1,6 +1,6 @@
1
1
  var _excluded = ["inline", "restrictFocus", "target", "trapFocus"];
2
2
 
3
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
5
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
6
 
@@ -1,6 +1,6 @@
1
1
  var _excluded = ["a11yTitle", "aria-label", "align", "background", "onAlign", "children", "dropTarget", "elevation", "onClickOutside", "onEsc", "onKeyDown", "overflow", "plain", "responsive", "restrictFocus", "stretch", "trapFocus"];
2
2
 
3
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
5
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
6
 
@@ -1,6 +1,6 @@
1
1
  var _excluded = ["a11yTitle", "onAlign", "disabled", "dropAlign", "dropProps", "dropContent", "dropTarget", "id", "open", "onClick", "onClose", "onOpen"];
2
2
 
3
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
5
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
6
 
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import PropTypes from 'prop-types';
4
4
  import { genericProps } from '../../utils/general-prop-types';
@@ -1,6 +1,6 @@
1
1
  var _excluded = ["a11yTitle", "background", "border", "confirmRemove", "disabled", "id", "plain", "renderFile", "maxSize", "messages", "margin", "multiple", "name", "onChange", "pad", "value"];
2
2
 
3
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
5
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
6
 
@@ -42,7 +42,7 @@ var formatBytes = function formatBytes(size) {
42
42
  var ContentsBox = styled(Box).withConfig({
43
43
  displayName: "FileInput__ContentsBox",
44
44
  componentId: "sc-1jzq7im-0"
45
- })(["position:relative;", " ", ";", ";", ";"], function (props) {
45
+ })(["cursor:pointer;position:relative;", " ", ";", ";", ";"], function (props) {
46
46
  return props.disabled && disabledStyle();
47
47
  }, function (props) {
48
48
  return props.theme.fileInput && props.theme.fileInput.extend;
@@ -229,8 +229,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
229
229
  });
230
230
  } else message = files.length + " items";
231
231
 
232
- var removeFile = function removeFile(event, index) {
233
- event.stopPropagation();
232
+ var removeFile = function removeFile(index) {
234
233
  var nextFiles;
235
234
 
236
235
  if (index === 'all') {
@@ -240,11 +239,30 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
240
239
  nextFiles.splice(index, 1);
241
240
  }
242
241
 
243
- setFiles(nextFiles);
242
+ setFiles(nextFiles); // Need to have a way to track the files other than an array
243
+ // since inputRef.current.files is a read-only FileList
244
+ // https://stackoverflow.com/a/64019766
245
+
246
+ /* eslint-disable no-undef */
247
+
248
+ var dt = new DataTransfer();
249
+ var curFiles = inputRef.current.files;
250
+ if (index === 'all' || nextFiles.length === 0) inputRef.current.value = '';
251
+
252
+ for (var i = 0; i < curFiles.length; i += 1) {
253
+ var curfile = curFiles[i];
254
+ if (index !== i) dt.items.add(curfile);
255
+ }
256
+
257
+ var nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'files').set;
258
+ nativeInputValueSetter.call(inputRef.current, dt.files);
259
+ var event = new Event('input', {
260
+ bubbles: true
261
+ });
262
+ inputRef.current.dispatchEvent(event);
244
263
  if (_onChange) _onChange(event, {
245
264
  files: nextFiles
246
265
  });
247
- if (nextFiles.length === 0) inputRef.current.value = '';
248
266
  inputRef.current.focus();
249
267
  };
250
268
 
@@ -274,6 +292,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
274
292
  justify: "between"
275
293
  }, files.length <= aggregateThreshold && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Message, theme.fileInput.message, message), /*#__PURE__*/React.createElement(Keyboard, {
276
294
  onSpace: function onSpace(event) {
295
+ event.preventDefault();
277
296
  if (controlRef.current === event.target) inputRef.current.click();
278
297
  },
279
298
  onEnter: function onEnter(event) {
@@ -331,7 +350,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
331
350
  index: 'all'
332
351
  });
333
352
  setShowRemoveConfirmation(true);
334
- } else removeFile(event, 'all');
353
+ } else removeFile('all');
335
354
  }
336
355
  }), /*#__PURE__*/React.createElement(Keyboard, {
337
356
  onSpace: function onSpace(event) {
@@ -398,7 +417,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
398
417
  index: index
399
418
  });
400
419
  setShowRemoveConfirmation(true);
401
- } else removeFile(event, index);
420
+ } else removeFile(index);
402
421
  }
403
422
  }), files.length === 1 && /*#__PURE__*/React.createElement(Keyboard, {
404
423
  onSpace: function onSpace(event) {
@@ -476,7 +495,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
476
495
  }
477
496
  }))), showRemoveConfirmation && /*#__PURE__*/React.createElement(ConfirmRemove, {
478
497
  onConfirm: function onConfirm() {
479
- removeFile(pendingRemoval.event, pendingRemoval.index);
498
+ removeFile(pendingRemoval.index);
480
499
  setPendingRemoval(defaultPendingRemoval);
481
500
  setShowRemoveConfirmation(false);
482
501
  },
@@ -4,7 +4,7 @@ import { defaultProps } from '../../default-props';
4
4
  var StyledFileInput = styled.input.withConfig({
5
5
  displayName: "StyledFileInput",
6
6
  componentId: "sc-rl7ywv-0"
7
- })(["position:absolute;height:100%;width:100%;", " opacity:0;border:none;", " ", " &::-moz-focus-inner{border:none;outline:none;}"], inputStyle, function (props) {
7
+ })(["position:absolute;height:100%;width:100%;", " font-size:0;opacity:0;border:none;", " ", " &::-moz-focus-inner{border:none;outline:none;}&::-webkit-file-upload-button{cursor:pointer;}"], inputStyle, function (props) {
8
8
  return !props.disabled && 'cursor: pointer;';
9
9
  }, function (props) {
10
10
  return props.rightOffset && "\n width: calc(100% - " + props.rightOffset + "px);\n right: " + props.rightOffset + "px;\n ";
@@ -15,6 +15,7 @@ export var Multiple = function Multiple() {
15
15
  onChange: function onChange(event, _ref) {
16
16
  var files = _ref.files;
17
17
  console.log(event);
18
+ console.log(event.target.files);
18
19
 
19
20
  for (var i = 0; i < files.length; i += 1) {
20
21
  var file = files[i];
@@ -1,6 +1,6 @@
1
1
  var _excluded = ["hidden", "restrictScroll", "children", "trapFocus"];
2
2
 
3
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
5
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
6
 
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React from 'react';
4
4
  import { Box } from '../Box';
@@ -1,4 +1,4 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React from 'react';
4
4
  import styled from 'styled-components';