grommet 2.58.0 → 2.59.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 (421) hide show
  1. package/all/stories/AllComponents.stories.js +2 -1
  2. package/components/Accordion/Accordion.js +2 -1
  3. package/components/Accordion/stories/CustomHeader.stories.js +2 -1
  4. package/components/AccordionPanel/AccordionPanel.js +2 -1
  5. package/components/Anchor/Anchor.js +2 -1
  6. package/components/Anchor/StyledAnchor.js +2 -1
  7. package/components/Avatar/Avatar.js +2 -1
  8. package/components/Box/Box.js +2 -1
  9. package/components/Box/ResponsiveContainerProvider.js +2 -1
  10. package/components/Box/StyledBox.js +2 -1
  11. package/components/Box/stories/ResponsiveContainer.stories.js +2 -1
  12. package/components/Button/Badge.js +2 -1
  13. package/components/Button/BusyAnimation.js +2 -1
  14. package/components/Button/Button.js +2 -1
  15. package/components/Button/StyledButton.js +2 -1
  16. package/components/Button/StyledButtonKind.js +2 -1
  17. package/components/Button/stories/Busy.stories.js +2 -1
  18. package/components/Calendar/Calendar.js +2 -1
  19. package/components/Calendar/StyledCalendar.js +2 -1
  20. package/components/Calendar/stories/ActiveDate.stories.js +2 -1
  21. package/components/Calendar/stories/CustomDay.stories.js +2 -1
  22. package/components/Calendar/stories/CustomHeader.stories.js +2 -1
  23. package/components/Calendar/stories/CustomThemed/CustomSizeHeading.stories.js +2 -1
  24. package/components/Calendar/stories/Dual.stories.js +2 -1
  25. package/components/Calendar/stories/HeaderLevel.stories.js +2 -1
  26. package/components/Calendar/stories/Multiple.stories.js +2 -1
  27. package/components/Calendar/stories/ShowAdjacentDays.stories.js +2 -1
  28. package/components/Calendar/stories/Simple.stories.js +2 -1
  29. package/components/Card/Card.js +2 -1
  30. package/components/Cards/Cards.js +2 -1
  31. package/components/Cards/index.d.ts +2 -16
  32. package/components/Carousel/Carousel.js +2 -1
  33. package/components/Carousel/CarouselChild.js +2 -1
  34. package/components/Carousel/StyledCarousel.js +2 -1
  35. package/components/Chart/Chart.js +2 -1
  36. package/components/Chart/StyledChart.js +2 -1
  37. package/components/Chart/stories/Rich.stories.js +2 -1
  38. package/components/Chart/stories/Scan.stories.js +2 -1
  39. package/components/Chart/stories/Window.stories.js +2 -1
  40. package/components/Chart/stories/Zoom.stories.js +2 -1
  41. package/components/CheckBox/CheckBox.js +2 -1
  42. package/components/CheckBox/README.md +95 -0
  43. package/components/CheckBox/StyledCheckBox.js +104 -16
  44. package/components/CheckBox/stories/CustomThemed/Appearance.stories.tsx +160 -0
  45. package/components/CheckBox/stories/CustomThemed/Custom.stories.js +2 -1
  46. package/components/CheckBox/stories/CustomThemed/CustomToggle.stories.js +2 -1
  47. package/components/CheckBox/stories/Indeterminate.stories.js +2 -1
  48. package/components/CheckBox/stories/NoLabel.stories.js +2 -1
  49. package/components/CheckBox/stories/Simple.stories.js +2 -1
  50. package/components/CheckBox/stories/WithStickyDiv.stories.js +2 -1
  51. package/components/CheckBoxGroup/CheckBoxGroup.js +2 -1
  52. package/components/CheckBoxGroup/stories/Children.stories.js +2 -1
  53. package/components/CheckBoxGroup/stories/InitialValues.stories.js +2 -1
  54. package/components/Clock/Analog.js +2 -1
  55. package/components/Clock/Clock.js +2 -1
  56. package/components/Clock/Digital.js +2 -1
  57. package/components/Clock/StyledClock.js +2 -1
  58. package/components/Collapsible/Collapsible.js +2 -1
  59. package/components/Data/Data.js +2 -1
  60. package/components/Data/DataForm.js +2 -1
  61. package/components/Data/stories/Infinite.stories.js +2 -1
  62. package/components/Data/stories/Inline.stories.js +2 -1
  63. package/components/Data/stories/OnSelect.stories.js +2 -1
  64. package/components/Data/stories/SpaceX.stories.js +2 -1
  65. package/components/Data/stories/StarWars.stories.js +2 -1
  66. package/components/DataChart/DataChart.js +2 -1
  67. package/components/DataChart/Detail.js +2 -1
  68. package/components/DataChart/Legend.js +2 -1
  69. package/components/DataChart/XAxis.js +2 -1
  70. package/components/DataChart/XGuide.js +2 -1
  71. package/components/DataChart/YAxis.js +2 -1
  72. package/components/DataChart/YGuide.js +2 -1
  73. package/components/DataChart/stories/Prediction.stories.js +2 -1
  74. package/components/DataClearFilters/DataClearFilters.js +2 -1
  75. package/components/DataClearFilters/stories/Simple.stories.js +2 -1
  76. package/components/DataFilter/DataFilter.js +2 -1
  77. package/components/DataFilters/DataFilters.js +2 -1
  78. package/components/DataSearch/DataSearch.js +2 -1
  79. package/components/DataSort/DataSort.js +2 -1
  80. package/components/DataSummary/DataSummary.js +2 -1
  81. package/components/DataTable/Body.js +2 -1
  82. package/components/DataTable/Cell.js +2 -1
  83. package/components/DataTable/DataTable.js +2 -1
  84. package/components/DataTable/ExpanderCell.js +2 -1
  85. package/components/DataTable/Footer.js +2 -1
  86. package/components/DataTable/GroupedBody.js +2 -1
  87. package/components/DataTable/Header.js +2 -1
  88. package/components/DataTable/PlaceholderBody.js +2 -1
  89. package/components/DataTable/Resizer.js +2 -1
  90. package/components/DataTable/Searcher.js +2 -1
  91. package/components/DataTable/StyledDataTable.js +2 -1
  92. package/components/DataTable/stories/ControlledGrouped.stories.js +2 -1
  93. package/components/DataTable/stories/OnUpdate.stories.js +2 -1
  94. package/components/DataTable/stories/SpaceX.stories.js +2 -1
  95. package/components/DataTable/stories/SpaceXUngrouped.stories.js +2 -1
  96. package/components/DataTable/stories/rowDetails.stories.js +2 -1
  97. package/components/DataTableColumns/DataTableColumns.js +2 -1
  98. package/components/DataTableGroupBy/DataTableGroupBy.js +2 -1
  99. package/components/DataView/DataView.js +2 -1
  100. package/components/DateInput/DateInput.js +11 -4
  101. package/components/DateInput/stories/FormatInline.stories.js +2 -1
  102. package/components/DateTimeInput/DateTimeInput.js +4 -1
  103. package/components/DateTimeInput/StyledDateTimeInput.js +11 -2
  104. package/components/Diagram/Diagram.js +2 -1
  105. package/components/Diagram/StyledDiagram.js +2 -1
  106. package/components/Diagram/stories/Animated.stories.js +2 -1
  107. package/components/Diagram/stories/Progressing.stories.js +2 -1
  108. package/components/Drop/Drop.js +2 -1
  109. package/components/Drop/DropContainer.js +2 -1
  110. package/components/Drop/StyledDrop.js +2 -1
  111. package/components/Drop/stories/CustomThemed/Lazy.stories.js +2 -1
  112. package/components/Drop/stories/CustomThemed/Themed.stories.js +2 -1
  113. package/components/Drop/stories/Inline.stories.js +2 -1
  114. package/components/Drop/stories/Meter.stories.js +2 -1
  115. package/components/Drop/stories/Multiple.stories.js +2 -1
  116. package/components/Drop/stories/Overflow.stories.js +2 -1
  117. package/components/Drop/stories/Plain.stories.js +2 -1
  118. package/components/Drop/stories/Progressive.stories.js +2 -1
  119. package/components/Drop/stories/Simple.stories.js +2 -1
  120. package/components/Drop/stories/Styled.stories.js +2 -1
  121. package/components/DropButton/DropButton.js +2 -1
  122. package/components/FileInput/FileInput.js +78 -21
  123. package/components/FileInput/README.md +5 -0
  124. package/components/FocusedContainer.js +2 -1
  125. package/components/Form/Form.js +2 -1
  126. package/components/Form/FormContext.js +2 -1
  127. package/components/Form/stories/ArrayOfFormFields.stories.js +2 -1
  128. package/components/Form/stories/Controlled.stories.js +2 -1
  129. package/components/Form/stories/ControlledInput.stories.js +2 -1
  130. package/components/Form/stories/ControlledInputLazy.stories.js +2 -1
  131. package/components/Form/stories/ControlledLazy.stories.js +2 -1
  132. package/components/Form/stories/CustomThemed/FieldBorderPosition.stories.js +2 -1
  133. package/components/Form/stories/CustomThemed/FieldCustomStates.stories.js +2 -1
  134. package/components/Form/stories/DynamicFields.stories.js +2 -1
  135. package/components/Form/stories/FieldStates.stories.js +2 -1
  136. package/components/Form/stories/SolicitedFeedback.stories.js +2 -1
  137. package/components/Form/stories/UnsolicitedFeedback.stories.js +2 -1
  138. package/components/Form/stories/ValidateOnChange.stories.js +2 -1
  139. package/components/Form/stories/ValidateOnMount.stories.js +2 -1
  140. package/components/FormField/FormField.js +207 -69
  141. package/components/FormField/README.md +56 -1
  142. package/components/FormField/stories/CustomThemed/Appearance.stories.tsx +630 -0
  143. package/components/FormField/stories/Simple.stories.js +2 -1
  144. package/components/Grid/Grid.js +2 -1
  145. package/components/Grid/StyledGrid.js +2 -1
  146. package/components/Grid/stories/ResponsiveCards.stories.js +2 -1
  147. package/components/Grommet/Grommet.js +2 -1
  148. package/components/Grommet/StyledGrommet.js +2 -1
  149. package/components/Grommet/index.d.ts +4 -0
  150. package/components/Grommet/propTypes.js +4 -1
  151. package/components/Header/Header.js +2 -1
  152. package/components/Header/stories/Sticky.stories.js +2 -1
  153. package/components/Heading/Heading.js +2 -1
  154. package/components/Heading/HeadingSkeleton.js +2 -1
  155. package/components/Heading/StyledHeading.js +2 -1
  156. package/components/Image/Image.js +2 -1
  157. package/components/Image/StyledImage.js +2 -1
  158. package/components/InfiniteScroll/InfiniteScroll.js +2 -1
  159. package/components/Layer/Layer.js +2 -1
  160. package/components/Layer/LayerContainer.js +2 -1
  161. package/components/Layer/StyledLayer.js +2 -1
  162. package/components/List/List.js +2 -1
  163. package/components/List/stories/Order.stories.js +2 -1
  164. package/components/List/stories/Pinned.stories.js +2 -1
  165. package/components/Markdown/Markdown.js +2 -1
  166. package/components/MaskedInput/MaskedInput.js +2 -1
  167. package/components/Menu/Menu.js +2 -1
  168. package/components/Meter/Bar.js +2 -1
  169. package/components/Meter/Circle.js +2 -1
  170. package/components/Meter/Meter.js +2 -1
  171. package/components/Meter/StyledMeter.js +2 -1
  172. package/components/Meter/stories/Circle.stories.js +2 -1
  173. package/components/Meter/stories/VerticalBarMultiple.stories.js +2 -1
  174. package/components/NameValueList/NameValueList.js +2 -1
  175. package/components/NameValuePair/NameValuePair.js +2 -1
  176. package/components/Nav/stories/CustomThemed/JustifySidebar.stories.js +2 -1
  177. package/components/Nav/stories/Sidebar.stories.js +2 -1
  178. package/components/Notification/Notification.js +2 -1
  179. package/components/Notification/stories/Global.stories.js +2 -1
  180. package/components/Notification/stories/Title.stories.js +2 -1
  181. package/components/Notification/stories/TitleAndMessage.stories.js +2 -1
  182. package/components/Page/Page.js +2 -1
  183. package/components/Page/stories/PageNotificaton.stories.js +2 -1
  184. package/components/PageContent/PageContent.js +2 -1
  185. package/components/PageHeader/PageHeader.js +2 -1
  186. package/components/PageHeader/stories/MultipleActions.stories.js +2 -1
  187. package/components/Pagination/Pagination.js +2 -1
  188. package/components/Pagination/PaginationStep.js +2 -1
  189. package/components/Pagination/PaginationSummary.js +2 -1
  190. package/components/Pagination/stories/Grid.stories.js +2 -1
  191. package/components/Paragraph/Paragraph.js +2 -1
  192. package/components/Paragraph/ParagraphSkeleton.js +2 -1
  193. package/components/Paragraph/StyledParagraph.js +2 -1
  194. package/components/RadioButton/README.md +93 -1
  195. package/components/RadioButton/RadioButton.js +13 -5
  196. package/components/RadioButton/StyledRadioButton.js +103 -10
  197. package/components/RadioButton/stories/CustomThemed/Appearance.stories.tsx +190 -0
  198. package/components/RadioButtonGroup/RadioButtonGroup.js +2 -1
  199. package/components/RadioButtonGroup/stories/Children.stories.js +2 -1
  200. package/components/RadioButtonGroup/stories/CustomThemed/CustomTheme.stories.js +2 -1
  201. package/components/RadioButtonGroup/stories/Disabled.stories.js +2 -1
  202. package/components/RangeInput/RangeInput.js +2 -1
  203. package/components/RangeInput/StyledRangeInput.js +2 -1
  204. package/components/RangeInput/stories/CustomThemed/Bounds.stories.js +2 -1
  205. package/components/RangeSelector/EdgeControl.js +2 -1
  206. package/components/RangeSelector/RangeSelector.js +2 -1
  207. package/components/RangeSelector/index.d.ts +1 -10
  208. package/components/RangeSelector/stories/Basic.stories.js +2 -1
  209. package/components/RangeSelector/stories/CustomThemed/Custom.stories.js +2 -1
  210. package/components/RangeSelector/stories/CustomThemed/CustomEdgeControl.stories.js +2 -1
  211. package/components/RangeSelector/stories/Label.stories.js +2 -1
  212. package/components/RangeSelector/stories/Simple.stories.js +2 -1
  213. package/components/RangeSelector/stories/Step.stories.js +2 -1
  214. package/components/RangeSelector/stories/Thin.stories.js +2 -1
  215. package/components/RangeSelector/stories/Vertical.stories.js +2 -1
  216. package/components/RoutedAnchor/RoutedAnchor.js +2 -1
  217. package/components/RoutedButton/RoutedButton.js +2 -1
  218. package/components/Select/DefaultSelectTextInput.js +2 -1
  219. package/components/Select/Select.js +2 -1
  220. package/components/Select/SelectContainer.js +2 -1
  221. package/components/Select/StyledSelect.js +11 -3
  222. package/components/Select/stories/ChildrenRender.stories.js +2 -1
  223. package/components/Select/stories/Clear.stories.js +2 -1
  224. package/components/Select/stories/Controlled.stories.js +2 -1
  225. package/components/Select/stories/CustomThemed/CustomSearch.stories.js +2 -1
  226. package/components/Select/stories/Disabled.stories.js +2 -1
  227. package/components/Select/stories/InsideFormField.stories.js +2 -1
  228. package/components/Select/stories/Multiple.stories.js +2 -1
  229. package/components/Select/stories/ObjectOptions.stories.js +2 -1
  230. package/components/Select/stories/Search.stories.js +2 -1
  231. package/components/Select/stories/Simple.stories.js +2 -1
  232. package/components/Select/stories/ValueLabel.stories.js +2 -1
  233. package/components/Select/stories/components/SearchBorderBox.js +2 -1
  234. package/components/Select/stories/components/SearchInput.js +2 -1
  235. package/components/Select/utils.js +2 -1
  236. package/components/SelectMultiple/SelectMultiple.js +10 -4
  237. package/components/SelectMultiple/SelectMultipleContainer.js +2 -1
  238. package/components/SelectMultiple/SelectMultipleValue.js +2 -1
  239. package/components/SelectMultiple/SelectionSummary.js +2 -1
  240. package/components/SelectMultiple/stories/CustomMessages.stories.js +2 -1
  241. package/components/SelectMultiple/stories/Default.stories.js +2 -1
  242. package/components/SelectMultiple/stories/Disabled.stories.js +2 -1
  243. package/components/SelectMultiple/stories/FormField.stories.js +2 -1
  244. package/components/SelectMultiple/stories/Help.stories.js +2 -1
  245. package/components/SelectMultiple/stories/Limited.stories.js +2 -1
  246. package/components/SelectMultiple/stories/ObjectOptions.stories.js +2 -1
  247. package/components/SelectMultiple/stories/ShowSelectedInline.stories.js +2 -1
  248. package/components/Skeleton/Skeleton.js +2 -1
  249. package/components/Skeleton/SkeletonContext.js +2 -1
  250. package/components/Skeleton/stories/CustomThemed/Custom.stories.js +2 -1
  251. package/components/Skeleton/stories/GridContainer.stories.js +2 -1
  252. package/components/SkipLink/SkipLink.js +2 -1
  253. package/components/SkipLinks/SkipLinks.js +2 -1
  254. package/components/Spinner/Spinner.js +2 -1
  255. package/components/Spinner/stories/Animation.stories.js +2 -1
  256. package/components/Spinner/stories/Announced.stories.js +2 -1
  257. package/components/Stack/Stack.js +2 -1
  258. package/components/Stack/StyledStack.js +2 -1
  259. package/components/StarRating/StarRating.js +2 -1
  260. package/components/Stepper/Stepper.js +138 -101
  261. package/components/Stepper/StepperContext.js +5 -4
  262. package/components/Stepper/StepperDescription.js +6 -8
  263. package/components/Stepper/StepperHelperText.js +13 -15
  264. package/components/Stepper/StepperIndicator.js +37 -34
  265. package/components/Stepper/StepperLabel.js +11 -23
  266. package/components/Stepper/StepperStep.js +139 -82
  267. package/components/Stepper/StyledStepper.js +168 -115
  268. package/components/Stepper/index.d.ts +25 -13
  269. package/components/Stepper/index.js +5 -1
  270. package/components/Stepper/propTypes.js +3 -0
  271. package/components/Stepper/stories/Children.stories.tsx +73 -0
  272. package/components/Stepper/stories/CustomThemed.stories.tsx +301 -0
  273. package/components/Stepper/stories/CustomThemedHpe.stories.tsx +328 -0
  274. package/components/Stepper/stories/DisabledSteps.stories.js +2 -1
  275. package/components/Stepper/stories/ErrorStates.stories.js +2 -1
  276. package/components/Stepper/stories/HorizontalSteps.stories.js +2 -1
  277. package/components/Stepper/stories/Interactive.stories.js +2 -1
  278. package/components/Stepper/stories/KeyboardNavigation.stories.js +2 -1
  279. package/components/Stepper/stories/NestedSubSteps.stories.js +2 -1
  280. package/components/Stepper/stories/ThemingLightDark.stories.js +2 -1
  281. package/components/Stepper/stories/VerticalSteps.stories.js +2 -1
  282. package/components/Stepper/utils.js +54 -0
  283. package/components/Tab/StyledTab.js +2 -1
  284. package/components/Tab/Tab.js +2 -1
  285. package/components/Table/StyledTable.js +2 -1
  286. package/components/Table/Table.js +2 -1
  287. package/components/Table/stories/InfiniteScrollInTable.stories.js +2 -1
  288. package/components/TableBody/TableBody.js +2 -1
  289. package/components/TableCell/TableCell.js +2 -1
  290. package/components/TableFooter/TableFooter.js +2 -1
  291. package/components/TableHeader/TableHeader.js +2 -1
  292. package/components/TableRow/TableRow.js +2 -1
  293. package/components/Tabs/StyledTabs.js +2 -1
  294. package/components/Tabs/Tabs.js +2 -1
  295. package/components/Tabs/stories/CustomThemed/States.stories.js +2 -1
  296. package/components/Tabs/stories/Responsive.stories.js +2 -1
  297. package/components/Tag/Tag.js +2 -1
  298. package/components/Text/StyledText.js +2 -1
  299. package/components/Text/Text.js +2 -1
  300. package/components/Text/TextSkeleton.js +2 -1
  301. package/components/TextArea/StyledTextArea.js +2 -1
  302. package/components/TextArea/TextArea.js +2 -1
  303. package/components/TextArea/stories/CustomThemed/Themed.stories.js +2 -1
  304. package/components/TextArea/stories/InsideFormField.stories.js +2 -1
  305. package/components/TextArea/stories/NonResizable.stories.js +2 -1
  306. package/components/TextArea/stories/Simple.stories.js +2 -1
  307. package/components/TextInput/CopyButton.js +2 -1
  308. package/components/TextInput/README.md +29 -1
  309. package/components/TextInput/StyledTextInput.js +20 -6
  310. package/components/TextInput/TextInput.js +103 -26
  311. package/components/TextInput/index.d.ts +2 -0
  312. package/components/TextInput/propTypes.js +2 -0
  313. package/components/TextInput/stories/Clear.stories.tsx +68 -0
  314. package/components/TextInput/stories/ClearFormField.stories.tsx +45 -0
  315. package/components/TextInput/stories/InsideFormField.stories.js +2 -1
  316. package/components/TimeInput/StyledTimeInput.js +28 -18
  317. package/components/TimeInput/TimeInput.js +4 -1
  318. package/components/TimeInput/TimeInputPopup.js +2 -1
  319. package/components/TimeInput/stories/Inline.stories.tsx +28 -0
  320. package/components/Tip/Tip.js +2 -1
  321. package/components/Tip/stories/HeaderActions.stories.js +2 -1
  322. package/components/ToggleGroup/ToggleGroup.js +2 -1
  323. package/components/ToggleGroup/stories/Controlled.stories.js +2 -1
  324. package/components/Toolbar/Toolbar.js +2 -1
  325. package/components/Video/StyledVideo.js +2 -1
  326. package/components/Video/Video.js +2 -1
  327. package/components/Wizard/Wizard.js +13 -2
  328. package/components/Wizard/WizardContent.js +2 -1
  329. package/components/Wizard/WizardContext.js +2 -1
  330. package/components/Wizard/WizardProgress.js +1 -4
  331. package/components/Wizard/stories/BasicLinear.stories.js +2 -1
  332. package/components/Wizard/stories/Branching.stories.js +2 -1
  333. package/components/Wizard/stories/ClickableSteps.stories.js +2 -1
  334. package/components/Wizard/stories/Composable.stories.js +2 -1
  335. package/components/Wizard/stories/Controlled.stories.js +2 -1
  336. package/components/Wizard/stories/ExternalForm.stories.js +2 -1
  337. package/components/Wizard/stories/LongContent.stories.js +2 -1
  338. package/components/Wizard/stories/Modal.stories.js +2 -1
  339. package/components/Wizard/stories/NestedSubSteps.stories.js +2 -1
  340. package/components/Wizard/stories/NonClosableHeader.stories.js +2 -1
  341. package/components/Wizard/stories/ProgressiveSubSteps.stories.tsx +209 -0
  342. package/components/Wizard/stories/Validation.stories.js +2 -1
  343. package/components/WorldMap/WorldMap.js +2 -1
  344. package/contexts/AnalyticsContext/AnalyticsContext.js +2 -1
  345. package/contexts/AnnounceContext/stories/Polite.stories.js +2 -1
  346. package/contexts/RootsContext.js +2 -1
  347. package/contexts/ThemeContext/stories/ThemeContextExtend.stories.js +2 -1
  348. package/es6/components/Cards/index.d.ts +2 -16
  349. package/es6/components/CheckBox/README.md +95 -0
  350. package/es6/components/CheckBox/StyledCheckBox.js +103 -14
  351. package/es6/components/CheckBox/stories/CustomThemed/Appearance.stories.tsx +160 -0
  352. package/es6/components/DateInput/DateInput.js +10 -3
  353. package/es6/components/DateTimeInput/DateTimeInput.js +2 -0
  354. package/es6/components/DateTimeInput/StyledDateTimeInput.js +10 -2
  355. package/es6/components/FileInput/FileInput.js +77 -20
  356. package/es6/components/FileInput/README.md +5 -0
  357. package/es6/components/FormField/FormField.js +203 -66
  358. package/es6/components/FormField/README.md +56 -1
  359. package/es6/components/FormField/stories/CustomThemed/Appearance.stories.tsx +630 -0
  360. package/es6/components/Grommet/index.d.ts +4 -0
  361. package/es6/components/Grommet/propTypes.js +4 -1
  362. package/es6/components/RadioButton/README.md +93 -1
  363. package/es6/components/RadioButton/RadioButton.js +11 -4
  364. package/es6/components/RadioButton/StyledRadioButton.js +102 -8
  365. package/es6/components/RadioButton/stories/CustomThemed/Appearance.stories.tsx +190 -0
  366. package/es6/components/RangeSelector/index.d.ts +1 -10
  367. package/es6/components/Select/StyledSelect.js +10 -3
  368. package/es6/components/SelectMultiple/SelectMultiple.js +9 -3
  369. package/es6/components/Stepper/Stepper.js +137 -101
  370. package/es6/components/Stepper/StepperContext.js +5 -4
  371. package/es6/components/Stepper/StepperDescription.js +6 -8
  372. package/es6/components/Stepper/StepperHelperText.js +13 -15
  373. package/es6/components/Stepper/StepperIndicator.js +38 -35
  374. package/es6/components/Stepper/StepperLabel.js +11 -23
  375. package/es6/components/Stepper/StepperStep.js +137 -81
  376. package/es6/components/Stepper/StyledStepper.js +167 -113
  377. package/es6/components/Stepper/index.d.ts +25 -13
  378. package/es6/components/Stepper/index.js +2 -1
  379. package/es6/components/Stepper/propTypes.js +3 -0
  380. package/es6/components/Stepper/stories/Children.stories.tsx +73 -0
  381. package/es6/components/Stepper/stories/CustomThemed.stories.tsx +301 -0
  382. package/es6/components/Stepper/stories/CustomThemedHpe.stories.tsx +328 -0
  383. package/es6/components/Stepper/utils.js +50 -0
  384. package/es6/components/TextInput/README.md +29 -1
  385. package/es6/components/TextInput/StyledTextInput.js +19 -6
  386. package/es6/components/TextInput/TextInput.js +101 -25
  387. package/es6/components/TextInput/index.d.ts +2 -0
  388. package/es6/components/TextInput/propTypes.js +2 -0
  389. package/es6/components/TextInput/stories/Clear.stories.tsx +68 -0
  390. package/es6/components/TextInput/stories/ClearFormField.stories.tsx +45 -0
  391. package/es6/components/TimeInput/StyledTimeInput.js +27 -18
  392. package/es6/components/TimeInput/TimeInput.js +2 -0
  393. package/es6/components/TimeInput/stories/Inline.stories.tsx +28 -0
  394. package/es6/components/Wizard/Wizard.js +10 -1
  395. package/es6/components/Wizard/WizardProgress.js +1 -4
  396. package/es6/components/Wizard/stories/ProgressiveSubSteps.stories.tsx +209 -0
  397. package/es6/languages/default.json +5 -1
  398. package/es6/themes/base.d.ts +88 -95
  399. package/es6/themes/base.js +198 -167
  400. package/es6/utils/border.js +7 -0
  401. package/es6/utils/styles.js +144 -24
  402. package/grommet.min.js +1 -1
  403. package/grommet.min.js.map +1 -1
  404. package/languages/default.json +5 -1
  405. package/package.json +35 -35
  406. package/themes/base.d.ts +88 -95
  407. package/themes/base.js +198 -167
  408. package/tools/draft-release-version-pr.js +1 -1
  409. package/tools/generate-release-notes.js +1 -1
  410. package/tools/license-header.js +1 -1
  411. package/tools/pack.js +1 -1
  412. package/tools/release-checklist.js +1 -1
  413. package/tools/release-notes-utils.js +1 -1
  414. package/tools/release-preparation.md +55 -0
  415. package/tools/release-stable.js +1 -1
  416. package/tools/release-styled-components-beta-stable.js +1 -1
  417. package/utils/border.js +8 -1
  418. package/utils/styles.js +145 -27
  419. package/utils/useId.js +2 -1
  420. package/components/Stepper/StepConnector.js +0 -38
  421. package/es6/components/Stepper/StepConnector.js +0 -33
@@ -1,7 +1,7 @@
1
1
  // SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import styled, { css } from 'styled-components';
4
- import { controlBorderStyle, disabledStyle, getInputPadBySide, inputStyle, parseMetricToNum, plainInputStyle, textAlignStyle, widthStyle, styledComponentsConfig } from '../../utils';
4
+ import { controlBorderStyle, disabledStyle, getInputPadBySide, inputAppearanceStyle, inputStyle, parseMetricToNum, plainInputStyle, textAlignStyle, widthStyle, styledComponentsConfig } from '../../utils';
5
5
  import { inputPadForIcon } from '../../utils/styles';
6
6
  import { readOnlyStyle } from '../../utils/readOnly';
7
7
  var getPlainStyle = function getPlainStyle(plain) {
@@ -13,19 +13,26 @@ var getPlainStyle = function getPlainStyle(plain) {
13
13
  var StyledTextInput = styled.input.withConfig(styledComponentsConfig).withConfig({
14
14
  displayName: "StyledTextInput",
15
15
  componentId: "sc-1x30a0s-0"
16
- })(["", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ";"], inputStyle, function (props) {
16
+ })(["", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ";"], inputStyle, function (props) {
17
17
  return (props.hasButton || props.readOnlyCopy) && 'flex: 1 1 auto;';
18
18
  }, function (props) {
19
19
  return (props.hasButton || props.readOnlyCopy) && 'min-width: 0;';
20
- }, function (props) {
21
- if (!(props.readOnlyCopy || props.hasButton)) return '';
22
- return 'padding-right: 0px;';
23
20
  }, function (props) {
24
21
  return (props.readOnly || props.hasButton) && "border: none;";
25
22
  }, function (props) {
26
23
  return getPlainStyle(props.plain);
27
24
  }, function (props) {
28
25
  return props.icon && !props.hasActionsGroup && inputPadForIcon;
26
+ }, function (props) {
27
+ return (
28
+ // the static leading icon already pads its right side
29
+ props.hasLeadingIcon && props.hasActionsGroup && 'padding-left: 0px;'
30
+ );
31
+ }, function (props) {
32
+ return (
33
+ // avoid a second, native clear button on type="search" in WebKit/Blink
34
+ props.hasClear && "&::-webkit-search-cancel-button {\n -webkit-appearance: none;\n appearance: none;\n }"
35
+ );
29
36
  }, function (props) {
30
37
  return props.disabled && disabledStyle(props.theme.textInput.disabled && props.theme.textInput.disabled.opacity);
31
38
  }, function (props) {
@@ -51,7 +58,13 @@ var StyledTextInputContainer = styled.div.withConfig(styledComponentsConfig).wit
51
58
  }, function (props) {
52
59
  return props.readOnlyProp && !props.plain && readOnlyStyle(props.theme);
53
60
  }, function (props) {
54
- return props.theme.textInput && props.theme.textInput.container && props.theme.textInput.container.extend;
61
+ var _props$theme$textInpu;
62
+ var appearance = (props.readOnlyProp || props.hasButton) && inputAppearanceStyle(props, {
63
+ wrapper: true,
64
+ skipPadding: true
65
+ });
66
+ var extend = (_props$theme$textInpu = props.theme.textInput) == null || (_props$theme$textInpu = _props$theme$textInpu.container) == null ? void 0 : _props$theme$textInpu.extend;
67
+ return appearance ? css(["", "", ""], appearance, extend) : extend;
55
68
  });
56
69
  var StyledPlaceholder = styled.div.withConfig(styledComponentsConfig).withConfig({
57
70
  displayName: "StyledTextInput__StyledPlaceholder",
@@ -1,4 +1,4 @@
1
- var _excluded = ["a11yTitle", "copy", "defaultSuggestion", "defaultValue", "disabled", "dropAlign", "dropHeight", "dropProps", "dropTarget", "focusIndicator", "icon", "id", "messages", "name", "onBlur", "onChange", "onClickCopy", "onFocus", "onKeyDown", "onSelect", "onSuggestionSelect", "onSuggestionsClose", "onSuggestionsOpen", "password", "placeholder", "plain", "readOnly", "readOnlyCopy", "reverse", "suggestions", "textAlign", "type", "value", "width"];
1
+ var _excluded = ["a11yTitle", "clear", "copy", "defaultSuggestion", "defaultValue", "disabled", "dropAlign", "dropHeight", "dropProps", "dropTarget", "focusIndicator", "icon", "id", "messages", "name", "onBlur", "onChange", "onClickCopy", "onFocus", "onKeyDown", "onSelect", "onSuggestionSelect", "onSuggestionsClose", "onSuggestionsOpen", "password", "placeholder", "plain", "readOnly", "readOnlyCopy", "reverse", "suggestions", "textAlign", "type", "value", "width"];
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
4
4
  function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
@@ -48,17 +48,23 @@ var ContainerBox = styled(Box).withConfig({
48
48
  })(["", ";@media screen and (-ms-high-contrast:active),(-ms-high-contrast:none){width:100%;}"], function (props) {
49
49
  return props.dropHeight ? sizeStyle('max-height', props.dropHeight, props.theme) : 'max-height: inherit;';
50
50
  });
51
- var StyledPasswordToggleButton = styled(Button).withConfig({
52
- displayName: "TextInput__StyledPasswordToggleButton",
51
+ var StyledInlineActionButton = styled(Button).withConfig({
52
+ displayName: "TextInput__StyledInlineActionButton",
53
53
  componentId: "sc-1ai0c08-1"
54
- })(["padding-top:0;padding-bottom:0;"]);
54
+ })(["padding-top:0;padding-bottom:0;", ""], function (props) {
55
+ return props.$hidden && 'visibility: hidden;';
56
+ });
57
+ var isEmptyValue = function isEmptyValue(value) {
58
+ return value === undefined || value === null || value === '';
59
+ };
55
60
  var defaultDropAlign = {
56
61
  top: 'bottom',
57
62
  left: 'left'
58
63
  };
59
64
  var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
60
- var _inputRef$current2, _inputRef$current3, _theme$textInput, _theme$textInput2;
65
+ var _inputRef$current4, _inputRef$current5, _theme$textInput, _theme$textInput2, _theme$textInput3;
61
66
  var a11yTitle = _ref.a11yTitle,
67
+ clear = _ref.clear,
62
68
  copy = _ref.copy,
63
69
  defaultSuggestion = _ref.defaultSuggestion,
64
70
  defaultValue = _ref.defaultValue,
@@ -123,15 +129,22 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
123
129
  var _useState3 = useState(false),
124
130
  passwordRevealed = _useState3[0],
125
131
  setPasswordRevealed = _useState3[1];
132
+ // uncontrolled inputs outside a Form don't re-render on change, so track
133
+ // emptiness here to toggle the clear button
134
+ var _useState4 = useState(function () {
135
+ return !isEmptyValue(defaultValue);
136
+ }),
137
+ uncontrolledHasValue = _useState4[0],
138
+ setUncontrolledHasValue = _useState4[1];
126
139
  var handleSuggestionSelect = useMemo(function () {
127
140
  return onSelect && !onSuggestionSelect ? onSelect : onSuggestionSelect;
128
141
  }, [onSelect, onSuggestionSelect]);
129
142
  var handleTextSelect = useMemo(function () {
130
143
  return onSelect && onSuggestionSelect ? onSelect : undefined;
131
144
  }, [onSelect, onSuggestionSelect]);
132
- var _useState4 = useState(),
133
- suggestionsAtClose = _useState4[0],
134
- setSuggestionsAtClose = _useState4[1];
145
+ var _useState5 = useState(),
146
+ suggestionsAtClose = _useState5[0],
147
+ setSuggestionsAtClose = _useState5[1];
135
148
  var readOnlyCopyValidation = format({
136
149
  id: 'input.readOnlyCopy.validation',
137
150
  messages: messages
@@ -140,9 +153,9 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
140
153
  id: 'input.readOnlyCopy.prompt',
141
154
  messages: messages
142
155
  });
143
- var _useState5 = useState(readOnlyCopyPrompt),
144
- tip = _useState5[0],
145
- setTip = _useState5[1];
156
+ var _useState6 = useState(readOnlyCopyPrompt),
157
+ tip = _useState6[0],
158
+ setTip = _useState6[1];
146
159
  var showPasswordMessage = format({
147
160
  id: 'textInput.showPassword',
148
161
  messages: messages
@@ -151,6 +164,10 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
151
164
  id: 'textInput.hidePassword',
152
165
  messages: messages
153
166
  });
167
+ var clearMessage = format({
168
+ id: 'textInput.clear',
169
+ messages: messages
170
+ });
154
171
  var handleCopyClick = /*#__PURE__*/function () {
155
172
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(event) {
156
173
  var _ref3, _inputRef$current$val, _inputRef$current;
@@ -188,12 +205,43 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
188
205
  var onBlurCopy = function onBlurCopy() {
189
206
  if (tip === readOnlyCopyValidation) setTip(readOnlyCopyPrompt);
190
207
  };
208
+ var handleClearClick = function handleClearClick() {
209
+ // Set the value natively so React emits onChange for controlled,
210
+ // uncontrolled, and Form-managed inputs alike.
211
+ var nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set;
212
+ nativeInputValueSetter.call(inputRef.current, '');
213
+ inputRef.current.dispatchEvent(new Event('input', {
214
+ bubbles: true
215
+ }));
216
+ // the clear button hides once the value is empty
217
+ inputRef.current.focus();
218
+ };
191
219
  var authoredType = typeProp || (password ? 'password' : undefined);
192
220
  var passwordToggle = password && authoredType === 'password' && !readOnlyCopy;
193
221
  useEffect(function () {
194
222
  // When the toggle stops applying, return the input to its authored type.
195
223
  if (!passwordToggle) setPasswordRevealed(false);
196
224
  }, [passwordToggle]);
225
+
226
+ // form reset changes the value without firing onChange
227
+ useEffect(function () {
228
+ var _inputRef$current2;
229
+ var form = clear ? (_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.form : undefined;
230
+ if (!form) return undefined;
231
+ var timer;
232
+ var handleFormReset = function handleFormReset() {
233
+ // reset fires before the browser restores field values
234
+ timer = setTimeout(function () {
235
+ var _inputRef$current3;
236
+ return setUncontrolledHasValue(!!((_inputRef$current3 = inputRef.current) != null && _inputRef$current3.value));
237
+ });
238
+ };
239
+ form.addEventListener('reset', handleFormReset);
240
+ return function () {
241
+ clearTimeout(timer);
242
+ form.removeEventListener('reset', handleFormReset);
243
+ };
244
+ }, [clear, inputRef]);
197
245
  var openDrop = useCallback(function () {
198
246
  setShowDrop(true);
199
247
  announce(format({
@@ -250,15 +298,15 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
250
298
 
251
299
  // activeSuggestionIndex unifies mouse and keyboard interaction of
252
300
  // the suggestions
253
- var _useState6 = useState(resetSuggestionIndex),
254
- activeSuggestionIndex = _useState6[0],
255
- setActiveSuggestionIndex = _useState6[1];
301
+ var _useState7 = useState(resetSuggestionIndex),
302
+ activeSuggestionIndex = _useState7[0],
303
+ setActiveSuggestionIndex = _useState7[1];
256
304
 
257
305
  // Only update active suggestion index when the mouse actually moves,
258
306
  // not when suggestions are moving under the mouse.
259
- var _useState7 = useState(),
260
- mouseMovedSinceLastKey = _useState7[0],
261
- setMouseMovedSinceLastKey = _useState7[1];
307
+ var _useState8 = useState(),
308
+ mouseMovedSinceLastKey = _useState8[0],
309
+ setMouseMovedSinceLastKey = _useState8[1];
262
310
 
263
311
  // set activeSuggestionIndex when value changes
264
312
  useEffect(function () {
@@ -301,7 +349,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
301
349
  if (readOnly && inputRef != null && inputRef.current && inputRef.current.scrollLeft > 0) {
302
350
  inputRef.current.scrollLeft = 0;
303
351
  }
304
- }, [readOnly, inputRef, inputRef == null || (_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.scrollLeft]);
352
+ }, [readOnly, inputRef, inputRef == null || (_inputRef$current4 = inputRef.current) == null ? void 0 : _inputRef$current4.scrollLeft]);
305
353
  var setValueFromSuggestion = function setValueFromSuggestion(event, suggestion) {
306
354
  // if we stole the focus in the drop, perhaps by interacting with
307
355
  // a suggestion button or the scrollbar, give it back
@@ -315,6 +363,9 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
315
363
  handleSuggestionSelect(adjustedEvent);
316
364
  }
317
365
  setValue(suggestion);
366
+ if (clear) {
367
+ setUncontrolledHasValue(!isEmptyValue(suggestion));
368
+ }
318
369
  };
319
370
  var onNextSuggestion = useCallback(function (event) {
320
371
  event.preventDefault();
@@ -330,7 +381,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
330
381
  }, [activeSuggestionIndex]);
331
382
 
332
383
  // account for input value in both controlled and uncontrolled scenarios
333
- var hasValue = value || ((_inputRef$current3 = inputRef.current) == null ? void 0 : _inputRef$current3.value);
384
+ var hasValue = value || ((_inputRef$current5 = inputRef.current) == null ? void 0 : _inputRef$current5.value);
334
385
  var showStyledPlaceholder = useMemo(function () {
335
386
  return placeholder && typeof placeholder !== 'string' && !hasValue;
336
387
  }, [hasValue, placeholder]);
@@ -452,6 +503,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
452
503
  var textInputIcon = useSizedIcon(icon, rest.size, theme);
453
504
  var showPasswordIcon = (_theme$textInput = theme.textInput) == null || (_theme$textInput = _theme$textInput.icons) == null ? void 0 : _theme$textInput.showPassword;
454
505
  var hidePasswordIcon = (_theme$textInput2 = theme.textInput) == null || (_theme$textInput2 = _theme$textInput2.icons) == null ? void 0 : _theme$textInput2.hidePassword;
506
+ var clearIcon = (_theme$textInput3 = theme.textInput) == null || (_theme$textInput3 = _theme$textInput3.icons) == null ? void 0 : _theme$textInput3.clear;
455
507
  var inputType = authoredType;
456
508
  if (passwordToggle) {
457
509
  inputType = passwordRevealed ? 'text' : 'password';
@@ -466,7 +518,21 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
466
518
  tip: tip,
467
519
  value: value
468
520
  });
469
- var passwordToggleButton = passwordToggle ? /*#__PURE__*/React.createElement(StyledPasswordToggleButton, _extends({
521
+ var clearable = clear && !readOnly;
522
+ var hasClearableValue = value !== undefined && value !== null ? value !== '' : uncontrolledHasValue;
523
+ var clearButton = clearable ? /*#__PURE__*/React.createElement(StyledInlineActionButton, _extends({
524
+ disabled: disabled,
525
+ kind: "toolbar",
526
+ icon: renderIcon(clearIcon, {
527
+ 'aria-hidden': true
528
+ }),
529
+ onClick: handleClearClick,
530
+ "aria-label": clearMessage
531
+ // keep the slot while empty so the input width doesn't shift
532
+ ,
533
+ $hidden: !hasClearableValue
534
+ }, passThemeFlag)) : undefined;
535
+ var passwordToggleButton = passwordToggle ? /*#__PURE__*/React.createElement(StyledInlineActionButton, _extends({
470
536
  disabled: disabled,
471
537
  kind: "toolbar",
472
538
  icon: passwordRevealed ? renderIcon(hidePasswordIcon, {
@@ -482,15 +548,19 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
482
548
  "aria-label": passwordRevealed ? hidePasswordMessage : showPasswordMessage
483
549
  }, passThemeFlag)) : undefined;
484
550
  var copyButton = readOnlyCopy || copy ? copyButtonElement : undefined;
485
- // Keep state-changing password visibility before the non-destructive
486
- // copy action.
487
- var actionsGroup = passwordToggleButton || copyButton ? /*#__PURE__*/React.createElement(StyledActionsGroup, passThemeFlag, passwordToggleButton, copyButton) : undefined;
551
+ // Order: clear sits next to the text, then password visibility, then the
552
+ // non-destructive copy action.
553
+ var actionsGroup = clearButton || passwordToggleButton || copyButton ? /*#__PURE__*/React.createElement(StyledActionsGroup, passThemeFlag, clearButton, passwordToggleButton, copyButton) : undefined;
488
554
  var hasActionsGroup = !!actionsGroup;
489
555
  var iconOnRight = reverse;
490
556
  var showLeadingIcon = showTextInputIcon && !iconOnRight;
491
557
  var showTrailingIcon = showTextInputIcon && iconOnRight;
492
558
  return /*#__PURE__*/React.createElement(StyledTextInputContainer, _extends({
559
+ $inputDisabled: disabled,
493
560
  hasButton: !!actionsGroup,
561
+ icon: showTextInputIcon && !hasActionsGroup ? icon : undefined,
562
+ reverse: iconOnRight,
563
+ size: rest.size,
494
564
  readOnlyProp: readOnly // readOnlyProp to avoid passing to DOM
495
565
  ,
496
566
  readOnlyCopy: readOnlyCopy,
@@ -507,6 +577,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
507
577
  }, textInputIcon), /*#__PURE__*/React.createElement(Keyboard, _extends({
508
578
  target: focus ? 'document' : undefined
509
579
  }, keyboardProps), /*#__PURE__*/React.createElement(StyledTextInput, _extends({
580
+ $inputInner: readOnly || hasActionsGroup,
510
581
  "aria-label": a11yTitle,
511
582
  ref: inputRef,
512
583
  id: id,
@@ -520,6 +591,8 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
520
591
  focus: focus,
521
592
  hasButton: hasActionsGroup,
522
593
  hasActionsGroup: hasActionsGroup,
594
+ hasClear: clearable,
595
+ hasLeadingIcon: showLeadingIcon,
523
596
  hasTrailingIcon: showTrailingIcon,
524
597
  focusIndicator: focusIndicator,
525
598
  textAlign: textAlign,
@@ -565,14 +638,17 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
565
638
  openDrop();
566
639
  }
567
640
  setValue(event.target.value);
641
+ if (clear) {
642
+ setUncontrolledHasValue(!!event.target.value);
643
+ }
568
644
  setActiveSuggestionIndex(resetSuggestionIndex);
569
645
  if (onChange) onChange(event);
570
646
  }
571
- }))), showTrailingIcon && /*#__PURE__*/React.createElement(StyledIcon, {
647
+ }))), actionsGroup, showTrailingIcon && /*#__PURE__*/React.createElement(StyledIcon, {
572
648
  reverse: iconOnRight,
573
649
  hasActionsGroup: hasActionsGroup,
574
650
  theme: theme
575
- }, textInputIcon), actionsGroup, !readOnly && drop);
651
+ }, textInputIcon), !readOnly && drop);
576
652
  });
577
653
  TextInput.displayName = 'TextInput';
578
654
  TextInput.propTypes = TextInputPropTypes;
@@ -13,6 +13,7 @@ export interface TextInputProps
13
13
  'onSelect' | 'size' | 'placeholder' | 'width'
14
14
  > {
15
15
  a11yTitle?: A11yTitleType;
16
+ clear?: boolean;
16
17
  copy?: boolean;
17
18
  defaultSuggestion?: number;
18
19
  dropAlign?: {
@@ -28,6 +29,7 @@ export interface TextInputProps
28
29
  icon?: React.ReactNode;
29
30
  id?: string;
30
31
  messages?: {
32
+ clear?: string;
31
33
  enterSelect?: string;
32
34
  hidePassword?: string;
33
35
  showPassword?: string;
@@ -6,6 +6,7 @@ var PropType = {};
6
6
  if (process.env.NODE_ENV !== 'production') {
7
7
  PropType = {
8
8
  a11yTitle: PropTypes.string,
9
+ clear: PropTypes.bool,
9
10
  defaultSuggestion: PropTypes.number,
10
11
  dropAlign: PropTypes.shape({
11
12
  top: PropTypes.oneOf(['top', 'bottom']),
@@ -20,6 +21,7 @@ if (process.env.NODE_ENV !== 'production') {
20
21
  id: PropTypes.string,
21
22
  focusIndicator: PropTypes.bool,
22
23
  messages: PropTypes.shape({
24
+ clear: PropTypes.string,
23
25
  enterSelect: PropTypes.string,
24
26
  hidePassword: PropTypes.string,
25
27
  showPassword: PropTypes.string,
@@ -0,0 +1,68 @@
1
+ // SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import React from 'react';
4
+ import type { Meta, StoryObj } from '@storybook/react';
5
+
6
+ import { Search } from 'grommet-icons';
7
+ import { Box, TextInput } from 'grommet';
8
+
9
+ const meta: Meta<typeof TextInput> = {
10
+ title: 'Input/TextInput/Clear',
11
+ component: TextInput,
12
+ };
13
+
14
+ export default meta;
15
+ type Story = StoryObj<typeof TextInput>;
16
+
17
+ const ClearExample = () => {
18
+ const [value, setValue] = React.useState<string>('Clearable value');
19
+
20
+ return (
21
+ // Uncomment <Grommet> lines when using outside of storybook
22
+ // <Grommet theme={...}>
23
+ <Box fill align="center" justify="start" pad="large" gap="medium">
24
+ <Box width="medium" gap="small">
25
+ <TextInput
26
+ value={value}
27
+ onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
28
+ setValue(event.target.value)
29
+ }
30
+ clear
31
+ aria-label="Controlled value"
32
+ />
33
+ <TextInput
34
+ defaultValue="Uncontrolled value"
35
+ clear
36
+ aria-label="Uncontrolled value"
37
+ />
38
+ <TextInput
39
+ icon={<Search />}
40
+ placeholder="Search"
41
+ clear
42
+ aria-label="Search"
43
+ />
44
+ <TextInput
45
+ icon={<Search />}
46
+ reverse
47
+ placeholder="Search"
48
+ clear
49
+ aria-label="Search"
50
+ />
51
+ <TextInput
52
+ icon={<Search />}
53
+ reverse
54
+ password
55
+ clear
56
+ copy
57
+ placeholder="Search"
58
+ aria-label="Search"
59
+ />
60
+ </Box>
61
+ </Box>
62
+ // </Grommet>
63
+ );
64
+ };
65
+
66
+ export const Clear: Story = {
67
+ render: () => <ClearExample />,
68
+ };
@@ -0,0 +1,45 @@
1
+ // SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import React from 'react';
4
+ import type { Meta, StoryObj } from '@storybook/react';
5
+
6
+ import { Box, Button, Form, FormField, Text, TextInput } from 'grommet';
7
+
8
+ const meta: Meta<typeof TextInput> = {
9
+ title: 'Input/TextInput/Clear in FormField',
10
+ component: TextInput,
11
+ };
12
+
13
+ export default meta;
14
+ type Story = StoryObj<typeof TextInput>;
15
+
16
+ const ClearFormFieldExample = () => {
17
+ const [submitted, setSubmitted] = React.useState<string>();
18
+
19
+ return (
20
+ // Uncomment <Grommet> lines when using outside of storybook
21
+ // <Grommet theme={...}>
22
+ <Box align="center" pad="large">
23
+ <Form
24
+ validate="blur"
25
+ onSubmit={({ value }) => setSubmitted(JSON.stringify(value))}
26
+ onReset={() => setSubmitted(undefined)}
27
+ >
28
+ <FormField htmlFor="clear-name" name="name" label="Name" required>
29
+ <TextInput id="clear-name" name="name" clear />
30
+ </FormField>
31
+ <Box direction="row" gap="small">
32
+ <Button type="submit" label="Submit" primary />
33
+ <Button type="reset" label="Reset" />
34
+ </Box>
35
+ {submitted && <Text margin={{ top: 'small' }}>{submitted}</Text>}
36
+ </Form>
37
+ </Box>
38
+ // </Grommet>
39
+ );
40
+ };
41
+
42
+ export const ClearInFormField: Story = {
43
+ name: 'Clear in FormField',
44
+ render: () => <ClearFormFieldExample />,
45
+ };
@@ -1,7 +1,7 @@
1
1
  // SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import styled, { css } from 'styled-components';
4
- import { backgroundStyle, borderStyle, disabledStyle, edgeStyle, elevationStyle, focusStyle, heightStyle, inputStyle, normalizeColor, parseMetricToNum, plainInputStyle, readOnlyStyle, roundStyle, styledComponentsConfig, widthStyle } from '../../utils';
4
+ import { backgroundStyle, borderStyle, disabledStyle, edgeStyle, elevationStyle, focusStyle, heightStyle, inputAppearanceStyle, inputStyle, normalizeColor, parseMetricToNum, plainInputStyle, readOnlyStyle, roundStyle, styledComponentsConfig, widthStyle } from '../../utils';
5
5
  import { Box } from '../Box';
6
6
  export var StyledTimeInputContainer = styled(Box).withConfig({
7
7
  // Keep Box styling props like border and round flowing into Box.
@@ -11,10 +11,17 @@ export var StyledTimeInputContainer = styled(Box).withConfig({
11
11
  }).withConfig({
12
12
  displayName: "StyledTimeInput__StyledTimeInputContainer",
13
13
  componentId: "sc-xktdr3-0"
14
- })(["position:relative;", " ", " ", ""], function (props) {
14
+ })(["position:relative;", " ", " ", " ", ""], function (props) {
15
15
  return props.disabled && disabledStyle();
16
16
  }, function (props) {
17
17
  return props.readOnlyProp && readOnlyStyle(props.theme);
18
+ }, function (props) {
19
+ var _props$theme$timeInpu;
20
+ return inputAppearanceStyle(props, {
21
+ wrapper: true,
22
+ skipPadding: true,
23
+ padSelector: ((_props$theme$timeInpu = props.theme.timeInput) == null || (_props$theme$timeInpu = _props$theme$timeInpu.value) == null ? void 0 : _props$theme$timeInpu.pad) === undefined ? '[role="group"]' : undefined
24
+ });
18
25
  }, function (props) {
19
26
  return props.focusIndicator !== false && css(["&:focus-within{", "}"], focusStyle());
20
27
  });
@@ -30,11 +37,13 @@ export var StyledTimeInputDisplay = styled(Box).withConfig({
30
37
  displayName: "StyledTimeInput__StyledTimeInputDisplay",
31
38
  componentId: "sc-xktdr3-3"
32
39
  })(["position:absolute;inset:0;overflow:hidden;", ""], function (props) {
33
- var _props$theme$timeInpu;
34
- var valuePad = (_props$theme$timeInpu = props.theme.timeInput) == null || (_props$theme$timeInpu = _props$theme$timeInpu.value) == null ? void 0 : _props$theme$timeInpu.pad;
40
+ var _props$theme$timeInpu2;
41
+ var valuePad = (_props$theme$timeInpu2 = props.theme.timeInput) == null || (_props$theme$timeInpu2 = _props$theme$timeInpu2.value) == null ? void 0 : _props$theme$timeInpu2.pad;
35
42
  if (valuePad !== undefined) {
36
43
  return edgeStyle('padding', valuePad, props.responsive, props.theme.box.responsiveBreakpoint, props.theme);
37
44
  }
45
+ var inputPad = props.theme.global.input.pad;
46
+ if (inputPad !== undefined) return edgeStyle('padding', inputPad, props.responsive, props.theme.box.responsiveBreakpoint, props.theme);
38
47
  var inputPadding = props.theme.global.input.padding;
39
48
  if (!inputPadding) return undefined;
40
49
  if (typeof inputPadding !== 'object') return "padding: " + (parseMetricToNum(props.theme.global.edgeSize[inputPadding] || inputPadding) - parseMetricToNum(props.theme.global.control.border.width)) + "px;";
@@ -44,8 +53,8 @@ export var StyledTimeInputSeparator = styled.span.withConfig(styledComponentsCon
44
53
  displayName: "StyledTimeInput__StyledTimeInputSeparator",
45
54
  componentId: "sc-xktdr3-4"
46
55
  })(["display:inline-flex;line-height:inherit;align-items:center;color:", ";", " ", ""], function (props) {
47
- var _props$theme$timeInpu2, _props$theme$timeInpu3;
48
- return normalizeColor(props.$filled ? ((_props$theme$timeInpu2 = props.theme.timeInput) == null || (_props$theme$timeInpu2 = _props$theme$timeInpu2.segment) == null ? void 0 : _props$theme$timeInpu2.color) || 'text' : ((_props$theme$timeInpu3 = props.theme.timeInput) == null || (_props$theme$timeInpu3 = _props$theme$timeInpu3.segment) == null || (_props$theme$timeInpu3 = _props$theme$timeInpu3.placeholder) == null ? void 0 : _props$theme$timeInpu3.color) || props.theme.global.colors.placeholder, props.theme);
56
+ var _props$theme$timeInpu3, _props$theme$timeInpu4;
57
+ return normalizeColor(props.$filled ? ((_props$theme$timeInpu3 = props.theme.timeInput) == null || (_props$theme$timeInpu3 = _props$theme$timeInpu3.segment) == null ? void 0 : _props$theme$timeInpu3.color) || 'text' : ((_props$theme$timeInpu4 = props.theme.timeInput) == null || (_props$theme$timeInpu4 = _props$theme$timeInpu4.segment) == null || (_props$theme$timeInpu4 = _props$theme$timeInpu4.placeholder) == null ? void 0 : _props$theme$timeInpu4.color) || props.theme.global.colors.placeholder, props.theme);
49
58
  }, function (props) {
50
59
  var _props$theme$text;
51
60
  var _ref = props.theme.timeInput || {},
@@ -55,8 +64,8 @@ export var StyledTimeInputSeparator = styled.span.withConfig(styledComponentsCon
55
64
  var fontSize = ((_props$theme$text = props.theme.text) == null || (_props$theme$text = _props$theme$text[size]) == null ? void 0 : _props$theme$text.size) || size;
56
65
  return css(["", " ", ""], weight && "font-weight: " + weight + ";", fontSize && "font-size: " + fontSize + ";");
57
66
  }, function (props) {
58
- var _props$theme$timeInpu4, _props$theme$text2;
59
- var placeholder = (_props$theme$timeInpu4 = props.theme.timeInput) == null || (_props$theme$timeInpu4 = _props$theme$timeInpu4.segment) == null ? void 0 : _props$theme$timeInpu4.placeholder;
67
+ var _props$theme$timeInpu5, _props$theme$text2;
68
+ var placeholder = (_props$theme$timeInpu5 = props.theme.timeInput) == null || (_props$theme$timeInpu5 = _props$theme$timeInpu5.segment) == null ? void 0 : _props$theme$timeInpu5.placeholder;
60
69
  if (props.$filled || !placeholder) return '';
61
70
  var fontSize = ((_props$theme$text2 = props.theme.text) == null || (_props$theme$text2 = _props$theme$text2[placeholder.size]) == null ? void 0 : _props$theme$text2.size) || placeholder.size;
62
71
  return css(["", " ", ""], placeholder.weight !== undefined && "font-weight: " + placeholder.weight + ";", fontSize && "font-size: " + fontSize + ";");
@@ -65,8 +74,8 @@ export var StyledTimeInputSegment = styled.span.withConfig(styledComponentsConfi
65
74
  displayName: "StyledTimeInput__StyledTimeInputSegment",
66
75
  componentId: "sc-xktdr3-5"
67
76
  })(["&:focus{outline:none;}display:inline-flex;align-items:center;position:relative;line-height:inherit;", ";color:", ";", " ", " ", " ", ""], function (props) {
68
- var _props$theme$timeInpu5;
69
- var segment = (_props$theme$timeInpu5 = props.theme.timeInput) == null ? void 0 : _props$theme$timeInpu5.segment;
77
+ var _props$theme$timeInpu6;
78
+ var segment = (_props$theme$timeInpu6 = props.theme.timeInput) == null ? void 0 : _props$theme$timeInpu6.segment;
70
79
  var responsive = props.responsive === undefined ? true : props.responsive;
71
80
  var styles = [];
72
81
  if ((segment == null ? void 0 : segment.background) !== undefined) styles.push(backgroundStyle(segment.background, props.theme));
@@ -81,8 +90,8 @@ export var StyledTimeInputSegment = styled.span.withConfig(styledComponentsConfi
81
90
  if (segment != null && segment.width) styles.push(widthStyle(segment.width, props.theme));
82
91
  return styles;
83
92
  }, function (props) {
84
- var _props$theme$timeInpu6, _props$theme$timeInpu7;
85
- return normalizeColor(props.$filled ? ((_props$theme$timeInpu6 = props.theme.timeInput) == null || (_props$theme$timeInpu6 = _props$theme$timeInpu6.segment) == null ? void 0 : _props$theme$timeInpu6.color) || 'text' : ((_props$theme$timeInpu7 = props.theme.timeInput) == null || (_props$theme$timeInpu7 = _props$theme$timeInpu7.segment) == null || (_props$theme$timeInpu7 = _props$theme$timeInpu7.placeholder) == null ? void 0 : _props$theme$timeInpu7.color) || props.theme.global.colors.placeholder, props.theme);
93
+ var _props$theme$timeInpu7, _props$theme$timeInpu8;
94
+ return normalizeColor(props.$filled ? ((_props$theme$timeInpu7 = props.theme.timeInput) == null || (_props$theme$timeInpu7 = _props$theme$timeInpu7.segment) == null ? void 0 : _props$theme$timeInpu7.color) || 'text' : ((_props$theme$timeInpu8 = props.theme.timeInput) == null || (_props$theme$timeInpu8 = _props$theme$timeInpu8.segment) == null || (_props$theme$timeInpu8 = _props$theme$timeInpu8.placeholder) == null ? void 0 : _props$theme$timeInpu8.color) || props.theme.global.colors.placeholder, props.theme);
86
95
  }, function (props) {
87
96
  var _props$theme$text3;
88
97
  var _ref2 = props.theme.timeInput || {},
@@ -92,15 +101,15 @@ export var StyledTimeInputSegment = styled.span.withConfig(styledComponentsConfi
92
101
  var fontSize = ((_props$theme$text3 = props.theme.text) == null || (_props$theme$text3 = _props$theme$text3[size]) == null ? void 0 : _props$theme$text3.size) || size;
93
102
  return css(["", " ", ""], weight && "font-weight: " + weight + ";", fontSize && "font-size: " + fontSize + ";");
94
103
  }, function (props) {
95
- var _props$theme$timeInpu8, _props$theme$text4;
96
- var placeholder = (_props$theme$timeInpu8 = props.theme.timeInput) == null || (_props$theme$timeInpu8 = _props$theme$timeInpu8.segment) == null ? void 0 : _props$theme$timeInpu8.placeholder;
104
+ var _props$theme$timeInpu9, _props$theme$text4;
105
+ var placeholder = (_props$theme$timeInpu9 = props.theme.timeInput) == null || (_props$theme$timeInpu9 = _props$theme$timeInpu9.segment) == null ? void 0 : _props$theme$timeInpu9.placeholder;
97
106
  if (props.$filled || !placeholder) return '';
98
107
  var fontSize = ((_props$theme$text4 = props.theme.text) == null || (_props$theme$text4 = _props$theme$text4[placeholder.size]) == null ? void 0 : _props$theme$text4.size) || placeholder.size;
99
108
  return css(["", " ", ""], placeholder.weight !== undefined && "font-weight: " + placeholder.weight + ";", fontSize && "font-size: " + fontSize + ";");
100
109
  }, function (props) {
101
- var _props$theme$timeInpu9;
110
+ var _props$theme$timeInpu0;
102
111
  if (!props.$active) return '';
103
- var _ref3 = ((_props$theme$timeInpu9 = props.theme.timeInput) == null ? void 0 : _props$theme$timeInpu9.segment) || {},
112
+ var _ref3 = ((_props$theme$timeInpu0 = props.theme.timeInput) == null ? void 0 : _props$theme$timeInpu0.segment) || {},
104
113
  active = _ref3.active;
105
114
  if (!active) return '';
106
115
  var responsive = props.responsive === undefined ? true : props.responsive;
@@ -119,9 +128,9 @@ export var StyledTimeInputSegment = styled.span.withConfig(styledComponentsConfi
119
128
  if (active.weight !== undefined) styles.push("font-weight: " + active.weight + ";");
120
129
  return styles;
121
130
  }, function (props) {
122
- var _props$theme$timeInpu0, _active$round, _props$theme$global$e;
131
+ var _props$theme$timeInpu1, _active$round, _props$theme$global$e;
123
132
  if (!props.$active) return '';
124
- var _ref4 = ((_props$theme$timeInpu0 = props.theme.timeInput) == null ? void 0 : _props$theme$timeInpu0.segment) || {},
133
+ var _ref4 = ((_props$theme$timeInpu1 = props.theme.timeInput) == null ? void 0 : _props$theme$timeInpu1.segment) || {},
125
134
  active = _ref4.active,
126
135
  segmentRound = _ref4.round;
127
136
  var responsive = props.responsive === undefined ? true : props.responsive;
@@ -634,6 +634,8 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
634
634
  }, containerTheme, {
635
635
  round: (_theme$timeInput$cont = (_theme$timeInput3 = theme.timeInput) == null || (_theme$timeInput3 = _theme$timeInput3.container) == null ? void 0 : _theme$timeInput3.round) != null ? _theme$timeInput$cont : (_theme$global = theme.global) == null || (_theme$global = _theme$global.control) == null || (_theme$global = _theme$global.border) == null ? void 0 : _theme$global.radius,
636
636
  disabled: disabled,
637
+ plain: plainProp,
638
+ $inputPlain: plainProp,
637
639
  readOnlyProp: readOnly,
638
640
  focusIndicator: (focusIndicatorProp != null ? focusIndicatorProp : true) && !iconFocused
639
641
  }, passThemeFlag), /*#__PURE__*/React.createElement(StyledTimeInputField, passThemeFlag, /*#__PURE__*/React.createElement(StyledTimeInputDisplay, _extends({}, (_theme$timeInput4 = theme.timeInput) == null ? void 0 : _theme$timeInput4.value, {
@@ -0,0 +1,28 @@
1
+ // SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import React from 'react';
4
+
5
+ import { Box } from '../../Box';
6
+ import { TimeInput } from '..';
7
+
8
+ export const Inline = () => {
9
+ const [value, setValue] = React.useState('13:30');
10
+
11
+ return (
12
+ <Box align="center" pad="large">
13
+ <TimeInput
14
+ id="inline-time"
15
+ inline
16
+ format="24"
17
+ value={value}
18
+ onChange={({ value: next }: { value?: string }) => {
19
+ setValue(next || '');
20
+ }}
21
+ />
22
+ </Box>
23
+ );
24
+ };
25
+
26
+ export default {
27
+ title: 'Input/TimeInput/Inline',
28
+ };