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
package/themes/base.js CHANGED
@@ -355,6 +355,12 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
355
355
  }
356
356
  },
357
357
  input: {
358
+ // any BoxPartThemeType
359
+ // disabled: undefined, // any BoxStateThemeType
360
+ // focus: undefined, // any BoxStateThemeType
361
+ // hover: undefined, // any BoxStateThemeType
362
+ // pad: undefined,
363
+ // placeholder: undefined, // any TextThemeType
358
364
  padding: {
359
365
  horizontal: (0, _mixins.parseMetricToNum)(baseSpacing / 2 + "px") - (0, _mixins.parseMetricToNum)(controlBorderWidth + "px") + "px",
360
366
  vertical: (0, _mixins.parseMetricToNum)(baseSpacing / 2 + "px") - (0, _mixins.parseMetricToNum)(controlBorderWidth + "px") + "px"
@@ -367,6 +373,7 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
367
373
  // deprecate in v3
368
374
  // weight: undefined,
369
375
  readOnly: {
376
+ // any BoxStateThemeType
370
377
  // background: undefined,
371
378
  // border: {
372
379
  // color: undefined,
@@ -898,6 +905,18 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
898
905
  // extend: undefined,
899
906
  },
900
907
  checkBox: {
908
+ // control: {
909
+ // // any BoxPartThemeType
910
+ // hover: // any BoxStateThemeType
911
+ // selected: {
912
+ // // any BoxStateThemeType
913
+ // hover: // any BoxStateThemeType,
914
+ // },
915
+ // },
916
+ // container: {
917
+ // // any BoxPartThemeType
918
+ // hover: // any BoxStateThemeType,
919
+ // },
901
920
  border: {
902
921
  color: {
903
922
  dark: 'rgba(255, 255, 255, 0.5)',
@@ -907,7 +926,7 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
907
926
  },
908
927
  check: {
909
928
  // extend: undefined,
910
- radius: '4px',
929
+ radius: '4px' /** @deprecated Use checkBox.control.round instead. */,
911
930
  thickness: '4px'
912
931
  },
913
932
  label: {
@@ -923,6 +942,7 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
923
942
  light: 'black'
924
943
  }
925
944
  }
945
+ /** @deprecated Use checkBox.container.hover.background instead. */
926
946
  // background: undefined,
927
947
  // extend: undefined,
928
948
  },
@@ -934,6 +954,7 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
934
954
  // checked: undefined,
935
955
  // indeterminate: undefined,
936
956
  },
957
+ /** @deprecated Use checkBox.container.pad instead. */
937
958
  // pad: undefined,
938
959
  size: baseSpacing + "px",
939
960
  toggle: {
@@ -1385,7 +1406,10 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
1385
1406
  gap: 'medium'
1386
1407
  },
1387
1408
  formField: {
1409
+ // background: undefined, // input area only, not labels or messages
1388
1410
  // [inputname]: {
1411
+ // background: undefined, // 'transparent' opts out of shared background
1412
+ // error: undefined, // any BoxStateThemeType
1389
1413
  // container: {
1390
1414
  // extend: undefined,
1391
1415
  // },
@@ -2240,30 +2264,49 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
2240
2264
  }
2241
2265
  },
2242
2266
  radioButton: {
2267
+ // control: {
2268
+ // // any BoxPartThemeType
2269
+ // hover: // any BoxStateThemeType
2270
+ // selected: {
2271
+ // // any BoxStateThemeType
2272
+ // hover: // any BoxStateThemeType,
2273
+ // },
2274
+ // },
2243
2275
  border: {
2276
+ /** @deprecated Use radioButton.control.border.color instead. */
2244
2277
  color: {
2245
2278
  dark: 'rgba(255, 255, 255, 0.5)',
2246
2279
  light: 'rgba(0, 0, 0, 0.15)'
2247
2280
  },
2281
+ /** @deprecated Use radioButton.control.border.size instead. */
2248
2282
  width: '2px'
2249
2283
  },
2284
+ /** @deprecated Use radioButton.control.background instead. */
2250
2285
  // background: {
2251
2286
  // color: undefined,
2252
2287
  // },
2253
2288
  check: {
2289
+ /** @deprecated Use radioButton.control.round instead. */
2254
2290
  radius: '100%'
2291
+ /** @deprecated Use radioButton.control.selected.background instead. */
2255
2292
  // background: {
2256
2293
  // color: undefined,
2257
2294
  // },
2258
2295
  // color: { dark: undefined, light: undefined },
2259
2296
  // extend: undefined,
2260
2297
  },
2298
+ /** @deprecated Use radioButton.control.selected.border.color instead. */
2261
2299
  // color: undefined,
2262
2300
  hover: {
2301
+ /** @deprecated Use radioButton.container.hover.background instead. */
2263
2302
  // background: {
2264
2303
  // color: undefined,
2265
2304
  // },
2266
2305
  border: {
2306
+ /**
2307
+ * @deprecated Use radioButton.control.hover.border.color and
2308
+ * radioButton.control.selected.hover.border.color instead.
2309
+ */
2267
2310
  color: {
2268
2311
  dark: 'white',
2269
2312
  light: 'black'
@@ -2283,6 +2326,8 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
2283
2326
  // weight: undefined,
2284
2327
  },
2285
2328
  container: {
2329
+ // any BoxPartThemeType
2330
+ // hover: // any BoxStateThemeType,
2286
2331
  // extend: undefined
2287
2332
  }
2288
2333
  },
@@ -2461,137 +2506,69 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
2461
2506
  // unselected: undefined,
2462
2507
  // },
2463
2508
  },
2464
- tab: {
2465
- active: {
2466
- color: 'text'
2467
- // background: undefined,
2468
- },
2469
- // background: undefined,
2470
- border: {
2471
- side: 'bottom',
2472
- size: 'small',
2473
- color: {
2474
- dark: 'accent-1',
2475
- light: 'brand'
2476
- },
2477
- active: {
2478
- color: {
2479
- dark: 'white',
2480
- light: 'black'
2481
- }
2482
- },
2483
- disabled: {
2484
- // color: undefined,
2485
- },
2486
- hover: {
2487
- color: {
2488
- dark: 'white',
2489
- light: 'black'
2490
- }
2491
- // extend: undefined,
2492
- }
2493
- },
2494
- color: 'control',
2495
- // disabled: {
2496
- // color: undefined,
2497
- // },
2498
- // extend: undefined,
2499
- gap: 'small',
2500
- hover: {
2501
- // background: undefined,
2502
- // extend: undefined,
2503
- color: {
2504
- dark: 'white',
2505
- light: 'black'
2506
- }
2507
- },
2508
- margin: {
2509
- vertical: 'xxsmall',
2510
- horizontal: 'small'
2511
- },
2512
- pad: {
2513
- bottom: 'xsmall'
2514
- }
2515
- },
2516
- tabs: {
2517
- // background: undefined,
2518
- // extend: undefined,
2519
- // gap: undefined,
2520
- header: {
2521
- // alignSelf: undefined,
2522
- // background: undefined,
2523
- // border: {
2524
- // side: undefined,
2525
- // size: undefined,
2526
- // style: undefined,
2527
- // color: undefined,
2528
- // },
2529
- // extend: undefined,
2530
- nextButton: {
2531
- // icon: undefined,
2532
- pad: {
2533
- horizontal: 'small',
2534
- vertical: 'xsmall'
2535
- }
2536
- },
2537
- previousButton: {
2538
- // icon: undefined,
2539
- pad: {
2540
- horizontal: 'small',
2541
- vertical: 'xsmall'
2542
- }
2509
+ stepper: {
2510
+ container: {
2511
+ gap: {
2512
+ row: 'medium',
2513
+ column: 'small'
2543
2514
  }
2544
2515
  },
2545
- panel: {
2546
- // extend: undefined,
2547
- },
2548
- step: {
2549
- small: 1,
2550
- medium: 3,
2551
- large: 3
2552
- }
2553
- },
2554
- stepper: {
2555
2516
  indicator: {
2556
2517
  size: 'medium',
2557
2518
  // 'small' | 'medium' | 'large'
2519
+ iconSize: 'medium',
2558
2520
  border: {
2559
- width: '2px'
2560
- }
2521
+ size: 'small'
2522
+ },
2523
+ round: '50%',
2524
+ align: 'center',
2525
+ justify: 'center'
2561
2526
  },
2562
2527
  label: {
2563
2528
  size: 'medium',
2564
- substep: {
2565
- size: 'small'
2566
- }
2529
+ color: 'text'
2567
2530
  },
2568
2531
  connector: {
2569
- stroke: {
2570
- width: 'small'
2571
- }
2532
+ thickness: 'small',
2533
+ color: 'border',
2534
+ gap: baseSpacing / 6 + "px" // 4,
2572
2535
  },
2573
2536
  description: {
2574
2537
  size: 'small',
2575
2538
  color: 'text-weak'
2576
2539
  },
2577
- helperText: {
2540
+ errorText: {
2541
+ size: 'xsmall',
2542
+ color: 'status-critical'
2543
+ },
2544
+ disabledReason: {
2578
2545
  size: 'xsmall',
2579
2546
  color: 'text-weak'
2580
2547
  },
2581
2548
  button: {
2582
- pad: 'xxsmall'
2549
+ pad: 'xxsmall',
2550
+ gap: 'xsmall',
2551
+ align: 'center'
2583
2552
  },
2584
- horizontal: {
2585
- connector: {
2586
- margin: 'xxsmall'
2587
- },
2588
- button: {
2589
- gap: 'xsmall'
2590
- }
2553
+ children: {
2554
+ pad: 'none'
2591
2555
  },
2592
2556
  vertical: {
2593
2557
  button: {
2594
- gap: 'small'
2558
+ gap: 'small',
2559
+ direction: 'row',
2560
+ // baseline pairs with the StyledIndicator baseline strut to
2561
+ // center the label's first line against the indicator
2562
+ align: 'baseline'
2563
+ }
2564
+ },
2565
+ subStep: {
2566
+ indicator: {
2567
+ size: 'small',
2568
+ iconSize: 'small'
2569
+ },
2570
+ label: {
2571
+ size: 'small'
2595
2572
  }
2596
2573
  },
2597
2574
  // States: [component].[state].[element].[property]
@@ -2599,34 +2576,18 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
2599
2576
  indicator: {
2600
2577
  background: 'background-front',
2601
2578
  color: 'text-strong',
2602
- border: 'text-xweak',
2603
- substep: {
2604
- iconSize: 'small'
2605
- },
2606
- hover: {
2607
- background: 'background-front',
2608
- border: 'text-strong'
2579
+ border: {
2580
+ color: 'text-xweak'
2609
2581
  }
2610
- },
2611
- label: {
2612
- color: 'text'
2613
- },
2614
- connector: {
2615
- color: 'border'
2616
2582
  }
2617
2583
  },
2618
2584
  current: {
2619
2585
  indicator: {
2620
2586
  icon: _StatusGoodSmall.StatusGoodSmall,
2621
- iconSize: 'medium',
2622
2587
  background: 'brand',
2623
- color: 'white',
2624
- border: 'brand',
2625
- substep: {
2626
- iconSize: 'small'
2627
- },
2628
- hover: {
2629
- color: 'white'
2588
+ color: 'background-front',
2589
+ border: {
2590
+ color: 'brand'
2630
2591
  }
2631
2592
  },
2632
2593
  label: {
@@ -2639,15 +2600,10 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
2639
2600
  currentCompleted: {
2640
2601
  indicator: {
2641
2602
  icon: _FormCheckmark.FormCheckmark,
2642
- iconSize: 'medium',
2643
2603
  background: 'brand',
2644
2604
  color: 'white',
2645
- border: 'brand',
2646
- substep: {
2647
- iconSize: 'small'
2648
- },
2649
- hover: {
2650
- color: 'white'
2605
+ border: {
2606
+ color: 'brand'
2651
2607
  }
2652
2608
  },
2653
2609
  label: {
@@ -2655,20 +2611,17 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
2655
2611
  dark: 'text-strong',
2656
2612
  light: 'brand'
2657
2613
  }
2614
+ },
2615
+ connector: {
2616
+ color: 'brand'
2658
2617
  }
2659
2618
  },
2660
2619
  completed: {
2661
2620
  indicator: {
2662
2621
  icon: _FormCheckmark.FormCheckmark,
2663
- iconSize: 'medium',
2664
- background: 'background-front',
2665
2622
  color: 'brand',
2666
- border: 'brand',
2667
- substep: {
2668
- iconSize: 'small'
2669
- },
2670
- hover: {
2671
- background: 'background-front'
2623
+ border: {
2624
+ color: 'brand'
2672
2625
  }
2673
2626
  },
2674
2627
  label: {
@@ -2681,58 +2634,135 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
2681
2634
  error: {
2682
2635
  indicator: {
2683
2636
  icon: _StatusCriticalSmall.StatusCriticalSmall,
2637
+ iconSize: 'small',
2684
2638
  background: 'background-front',
2685
2639
  color: 'status-critical',
2686
- border: 'status-critical',
2687
- substep: {
2688
- iconSize: 'small'
2689
- },
2690
- hover: {
2691
- background: 'background-front'
2640
+ border: {
2641
+ color: 'status-critical'
2692
2642
  }
2693
2643
  },
2694
- label: {
2695
- color: 'text'
2696
- },
2697
2644
  connector: {
2698
2645
  color: 'status-critical'
2699
- },
2700
- helperText: {
2701
- color: 'status-critical'
2702
2646
  }
2703
2647
  },
2704
2648
  currentError: {
2705
2649
  indicator: {
2706
2650
  icon: _StatusCriticalSmall.StatusCriticalSmall,
2651
+ iconSize: 'small',
2707
2652
  background: 'status-critical',
2708
2653
  color: 'white',
2709
- border: 'status-critical',
2710
- substep: {
2711
- iconSize: 'small'
2712
- },
2713
- hover: {
2714
- color: 'white'
2654
+ border: {
2655
+ color: 'status-critical'
2715
2656
  }
2716
2657
  },
2717
2658
  label: {
2718
2659
  color: 'status-critical'
2660
+ },
2661
+ connector: {
2662
+ color: 'status-critical'
2719
2663
  }
2720
2664
  },
2721
2665
  disabled: {
2722
2666
  indicator: {
2723
2667
  background: 'background-contrast',
2724
2668
  color: 'text-weak',
2725
- border: 'border',
2726
- substep: {
2727
- iconSize: 'small'
2669
+ border: {
2670
+ color: 'border'
2728
2671
  }
2729
2672
  },
2730
2673
  label: {
2731
2674
  color: 'text-weak'
2675
+ }
2676
+ }
2677
+ },
2678
+ tab: {
2679
+ active: {
2680
+ color: 'text'
2681
+ // background: undefined,
2682
+ },
2683
+ // background: undefined,
2684
+ border: {
2685
+ side: 'bottom',
2686
+ size: 'small',
2687
+ color: {
2688
+ dark: 'accent-1',
2689
+ light: 'brand'
2732
2690
  },
2733
- connector: {
2734
- color: 'border'
2691
+ active: {
2692
+ color: {
2693
+ dark: 'white',
2694
+ light: 'black'
2695
+ }
2696
+ },
2697
+ disabled: {
2698
+ // color: undefined,
2699
+ },
2700
+ hover: {
2701
+ color: {
2702
+ dark: 'white',
2703
+ light: 'black'
2704
+ }
2705
+ // extend: undefined,
2706
+ }
2707
+ },
2708
+ color: 'control',
2709
+ // disabled: {
2710
+ // color: undefined,
2711
+ // },
2712
+ // extend: undefined,
2713
+ gap: 'small',
2714
+ hover: {
2715
+ // background: undefined,
2716
+ // extend: undefined,
2717
+ color: {
2718
+ dark: 'white',
2719
+ light: 'black'
2735
2720
  }
2721
+ },
2722
+ margin: {
2723
+ vertical: 'xxsmall',
2724
+ horizontal: 'small'
2725
+ },
2726
+ pad: {
2727
+ bottom: 'xsmall'
2728
+ }
2729
+ },
2730
+ tabs: {
2731
+ // background: undefined,
2732
+ // extend: undefined,
2733
+ // gap: undefined,
2734
+ header: {
2735
+ // alignSelf: undefined,
2736
+ // background: undefined,
2737
+ // border: {
2738
+ // side: undefined,
2739
+ // size: undefined,
2740
+ // style: undefined,
2741
+ // color: undefined,
2742
+ // },
2743
+ // extend: undefined,
2744
+ nextButton: {
2745
+ // icon: undefined,
2746
+ pad: {
2747
+ horizontal: 'small',
2748
+ vertical: 'xsmall'
2749
+ }
2750
+ },
2751
+ previousButton: {
2752
+ // icon: undefined,
2753
+ pad: {
2754
+ horizontal: 'small',
2755
+ vertical: 'xsmall'
2756
+ }
2757
+ }
2758
+ },
2759
+ panel: {
2760
+ // extend: undefined,
2761
+ },
2762
+ step: {
2763
+ small: 1,
2764
+ medium: 3,
2765
+ large: 3
2736
2766
  }
2737
2767
  },
2738
2768
  table: {
@@ -2900,6 +2930,7 @@ var generate = exports.generate = function generate(baseSpacing, scale) {
2900
2930
  // extend: undefined,
2901
2931
  // disabled: { opacity: undefined },
2902
2932
  icons: {
2933
+ clear: _FormClose.FormClose,
2903
2934
  // copy: undefined,
2904
2935
  hidePassword: _Hide.Hide,
2905
2936
  showPassword: _View.View
@@ -1 +1 @@
1
- import{readFileSync,writeFileSync,appendFileSync}from"fs";const NOTES_PATH="RELEASE_NOTES_DRAFT.md",CHECKLIST_PATH="RELEASE_CHECKLIST.md",PACKAGE_PATH="package.json",CHANGELOG_PATH="CHANGELOG.md";function suggestBump(e){const n=e.match(/── Suggested semver bump ─+\n\n(MAJOR|MINOR|PATCH)\b/);if(!n)throw new Error("Could not find a suggested semver bump in RELEASE_CHECKLIST.md");return n[1].toLowerCase()}function bumpVersion(e,n){const[t,r,i]=e.split(".").map(Number);return"major"===n?`${t+1}.0.0`:"minor"===n?`${t}.${r+1}.0`:`${t}.${r}.${i+1}`}function setGithubOutput(e,n){const t=process.env.GITHUB_OUTPUT;t&&appendFileSync(t,`${e}=${n}\n`)}const notes=readFileSync(NOTES_PATH,"utf8").trim(),checklist=readFileSync(CHECKLIST_PATH,"utf8"),override=process.env.BUMP_OVERRIDE,bump=override&&"auto"!==override?override:suggestBump(checklist),pkg=JSON.parse(readFileSync(PACKAGE_PATH,"utf8")),nextVersion=bumpVersion(pkg.version,bump);pkg.version=nextVersion,writeFileSync(PACKAGE_PATH,`${JSON.stringify(pkg,null,2)}\n`,"utf8");const changelog=readFileSync("CHANGELOG.md","utf8"),entry=`# ${nextVersion}\n\n${notes}\n\n`;writeFileSync("CHANGELOG.md",entry+changelog,"utf8"),console.log(`Suggested bump: ${bump} -> v${nextVersion}`),setGithubOutput("version",nextVersion),setGithubOutput("bump",bump);
1
+ import{readFileSync,writeFileSync,appendFileSync}from"fs";const NOTES_PATH="RELEASE_NOTES_DRAFT.md",CHECKLIST_PATH="RELEASE_CHECKLIST.md",PACKAGE_PATH="package.json",CHANGELOG_PATH="CHANGELOG.md";function suggestBump(e){const t=e.match(/── Suggested semver bump ─+\n\n(MAJOR|MINOR|PATCH)\b/);if(!t)throw new Error("Could not find a suggested semver bump in RELEASE_CHECKLIST.md");return t[1].toLowerCase()}function bumpVersion(e,t){const[n,s,r]=e.split(".").map(Number);return"major"===t?`${n+1}.0.0`:"minor"===t?`${n}.${s+1}.0`:`${n}.${s}.${r+1}`}function setGithubOutput(e,t){const n=process.env.GITHUB_OUTPUT;n&&appendFileSync(n,`${e}=${t}\n`)}const notes=readFileSync(NOTES_PATH,"utf8").trim(),checklist=readFileSync(CHECKLIST_PATH,"utf8"),bump=process.env.BUMP_OVERRIDE;if("true"!==process.env.CHECKLIST_REVIEWED)throw new Error("Review the release checklist before creating a release PR.");if(!["patch","minor","major"].includes(bump))throw new Error("Explicitly select patch, minor, or major after review.");const suggested=suggestBump(checklist);if(!notes||!/^[-*] /m.test(notes))throw new Error("Release notes must contain reviewed change entries.");const pkg=JSON.parse(readFileSync(PACKAGE_PATH,"utf8"));if(!/^\d+\.\d+\.\d+$/.test(pkg.version))throw new Error("Expected a stable package version in package.json.");const nextVersion=bumpVersion(pkg.version,bump);pkg.version=nextVersion,writeFileSync(PACKAGE_PATH,`${JSON.stringify(pkg,null,2)}\n`,"utf8");const changelog=readFileSync("CHANGELOG.md","utf8"),entry=`# ${nextVersion}\n\n${notes}\n\n`;writeFileSync("CHANGELOG.md",entry+changelog,"utf8"),console.log(`Checklist suggestion: ${suggested}; selected: ${bump} -> v${nextVersion}`),setGithubOutput("version",nextVersion),setGithubOutput("bump",bump);const template=readFileSync(".github/PULL_REQUEST_TEMPLATE.md","utf8"),answers={"What does this PR do?":`Prepares Grommet v${nextVersion} with a maintainer-selected ${bump} bump.\n\nCopies the reviewed release-note draft unchanged into CHANGELOG.md.`,"Where should the reviewer start?":`Review package.json and the new CHANGELOG.md section.\n\nChecklist suggestion: **${suggested}**; selected bump: **${bump}**.\n\n- Patch: backwards-compatible bug fixes.\n- Minor: new components, props, or compatible functionality.\n- Major: incompatible public API or behavior changes.\n\nConfirm the version, PR title/branch, and changelog heading agree.`,"What testing has been done on this PR?":"The release checklist completed for the reviewed commit. Its findings were acknowledged before creating this PR. This is not a test coverage guarantee.\n\nReview PR CI results separately; no build or browser QA is claimed here.","How should this be manually tested?":"- [ ] Confirm version scope and release-note wording.\n- [ ] Resolve or explicitly accept missing-test findings.\n- [ ] Complete the listed component QA in Chrome, Firefox, and Safari.\n- [ ] Wait for required CI checks before merging.","Do Jest tests follow these best practices?":"Not applicable to this version/changelog PR; template checklist follows.","Any background context you want to provide?":`Merging triggers tag creation after merge-commit CI, then package build and npm staging. Public npm publication requires manual approval.\n\n<details><summary>Reviewed release checklist</summary>\n\n\`\`\`text\n${checklist.trim()}\n\`\`\`\n\n</details>`,"What are the relevant issues?":"See the linked PRs in the release notes.","Screenshots (if appropriate)":"Not applicable.","Do the grommet docs need to be updated?":"Review documentation requirements for the included changes.","Should this PR be mentioned in the release notes?":"No. This PR only prepares the version and changelog.","Is this change backwards compatible or is it a breaking change?":"major"===bump?"Major release selected; review the documented breaking changes.":"Backwards-compatible release selected; confirm during final review."},body=template.replace(/^#### (.+)$/gm,(e,t)=>answers[t]?`${e}\n\n${answers[t]}`:e);writeFileSync("PR_BODY.md",body,"utf8");
@@ -1 +1 @@
1
- import{existsSync,readdirSync,readFileSync,statSync,writeFileSync}from"fs";import{join}from"path";import{formatReleaseSentence,getSkipReason,isTypeScriptChange}from"./release-notes-utils";const OWNER="grommet",REPO="grommet",API=`https://api.github.com/repos/${OWNER}/${REPO}`,GH_PR_URL=`https://github.com/${OWNER}/${REPO}/pull`,GH_RELEASE_URL=`https://github.com/${OWNER}/${REPO}/releases/tag`,GH_COMPARE_URL=`https://github.com/${OWNER}/${REPO}/compare`,DEFAULT_CHANGELOG_FILE="CHANGELOG.md",PLACEHOLDER_VERSION="X.X.X",LABEL_SECTION_MAP=new Map([["DataTable","DataTable"],["DateInput","DateInput"],["DateTimeInput","DateTimeInput"],["TimeInput","TimeInput"],["FileInput","FileInput"],["Select","Select / SelectMultiple"],["SelectMultiple","Select / SelectMultiple"],["List","List"],["RadioButton","RadioButton / RadioButtonGroup"],["RadioButtonGroup","RadioButton / RadioButtonGroup"],["RangeSelector","RangeSelector"],["TypeScript","TypeScript"],["typescript","TypeScript"],["Beta","Beta"],["beta","Beta"],["Calendar","Calendar"],["TextInput","TextInput"],["MaskedInput","MaskedInput"],["Notification","Notification"],["Layer","Layer"],["Button","Button"],["Form","Form"],["FormField","FormField"],["Stepper","Stepper"],["Wizard","Wizard"],["Tabs","Tabs"],["Pagination","Pagination"],["Menu","Menu"],["Anchor","Anchor"],["CheckBox","CheckBox / CheckBoxGroup"],["CheckBoxGroup","CheckBoxGroup / CheckBox"],["Data","Data"],["DataChart","Chart / DataChart"],["Chart","Chart / DataChart"],["DataFilter","DataFilter"]]),SECTION_ORDER=["General","Anchor","Button","Calendar","Chart / DataChart","CheckBox","Data","DataFilter","DataTable","DateInput","DateTimeInput","FileInput","Form","FormField","Layer","List","MaskedInput","Menu","Notification","Pagination","RadioButton / RadioButtonGroup","RangeSelector","Select / SelectMultiple","Stepper","Tabs","TextInput","TimeInput","TypeScript","Beta"],BETA_LABELS=new Set(["beta","Beta"]),DEFAULT_BETA_COMPONENT_SECTIONS=new Set(["DateTimeInput","Stepper","TimeInput","Wizard"]),MIN_COMPONENT_SECTION_SIZE=3,BETA_WARNING_PATTERN=/currently in beta[\s\S]*api is subject\s+to\s+change/i;function getSourceBetaComponentSections(){const e=join(process.cwd(),"src","js","components");if(!existsSync(e))return new Set;const t=new Set,n=readdirSync(e);for(const o of n){const n=join(e,o);if(!statSync(n).isDirectory())continue;const r=join(n,`${o}.js`);if(existsSync(r))try{const e=readFileSync(r,"utf8");BETA_WARNING_PATTERN.test(e)&&t.add(o)}catch{}}return t}const BETA_COMPONENT_SECTIONS=new Set([...Array.from(DEFAULT_BETA_COMPONENT_SECTIONS),...Array.from(getSourceBetaComponentSections())]);function parseArgs(){const e=process.argv.slice(2),t={from:null,to:null,format:(process.argv[1]||"").includes("announcement")?"announcement":"release-notes",output:null,changelog:null,version:null,token:process.env.GH_TOKEN||null};for(let n=0;n<e.length;n++){const o=e[n];if("--from"===o)t.from=e[++n];else if("--to"===o)t.to=e[++n];else if("--format"===o)t.format=e[++n];else if("--output"===o)t.output=e[++n];else if("--changelog"===o){const o=e[n+1];t.changelog=o&&!o.startsWith("--")?e[++n]:"CHANGELOG.md"}else"--no-changelog"===o?t.changelog=!1:"--version"===o?t.version=e[++n]:"--token"===o?t.token=e[++n]:o.startsWith("--")||t.from?o.startsWith("--")||t.to||(t.to=o):t.from=o}return t}function getRequestHeaders(e){return{...e?{Authorization:`Bearer ${e}`}:{},Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"}}async function ghGet(e,t){const n=await fetch(e,{headers:getRequestHeaders(t)});if(!n.ok){const t=await n.text();if(403===n.status&&t.includes("API rate limit exceeded"))throw new Error("GitHub API rate limit exceeded. Set GH_TOKEN or pass --token to generate release output.");throw new Error(`GitHub API ${n.status} at ${e}:\n${t}`)}return n.json()}async function resolveRef(e,t){if(!e||"HEAD"===e){const e=await ghGet(`${API}`,t),n=await ghGet(`${API}/branches/${e.default_branch}`,t);return{sha:n.commit.sha,date:n.commit.commit.committer.date}}try{const n=await ghGet(`${API}/git/refs/tags/${e}`,t);let{sha:o}=n.object;return"tag"===n.object.type&&(o=(await ghGet(`${API}/git/tags/${o}`,t)).object.sha),{sha:o,date:(await ghGet(`${API}/commits/${o}`,t)).commit.committer.date}}catch{const n=await ghGet(`${API}/commits/${e}`,t);return{sha:n.sha,date:n.commit.committer.date}}}async function getLatestTag(e){const t=await ghGet(`${API}/tags?per_page=5`,e);if(!t.length)throw new Error("No tags found in repository.");return t[0].name}function getSection(e){const t=e.labels.map((e=>e.name));if(isTypeScriptChange(e))return"TypeScript";if(t.some((e=>BETA_LABELS.has(e))))return"Beta";for(const e of t){const t=LABEL_SECTION_MAP.get(e);if(t)return t}const n=e.title.match(/^[A-Za-z]+\(([^)]+)\):/);if(n){const e=n[1].trim();for(const[t,n]of LABEL_SECTION_MAP)if(t.toLowerCase()===e.toLowerCase())return n}const o=e.title.toLowerCase();for(const[e,t]of LABEL_SECTION_MAP){const n=e.toLowerCase();if(o.startsWith(`${n} `)||o.startsWith(`${n}:`)||o.startsWith(`${n}-`)||o.startsWith(`${n},`))return t}return"General"}function formatEntry(e){return`- ${formatReleaseSentence(e).replace(/[.!?]+$/,"")}. ([#${e.number}](${GH_PR_URL}/${e.number}))`}function formatTitlePhrase(e){const t=e.trim().replace(/[.!?]+$/,"");return t.charAt(0).toLowerCase()+t.slice(1)}function humanJoin(e){return 0===e.length?"":1===e.length?e[0]:2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`}function unique(e){return e.filter(((t,n)=>t&&e.indexOf(t)===n))}function getAnnouncementHighlights(e){const t=[/^added\b/i,/^enhanced\b/i,/^improved\b/i];return e.filter((e=>t.some((t=>t.test(e.title))))).slice(0,2).map((e=>formatTitlePhrase(e.title)))}function getFixSummary(e){const t=unique(e.filter((e=>/^fixed\b/i.test(e.title))).map((e=>e.section)).filter((e=>e&&"General"!==e&&"Beta"!==e)));if(0===t.length)return null;const n=t.slice(0,5),o=t.length>5?", and more":"";return`There are also fixes across ${humanJoin(n)}${o}.`}function formatContributors(e){const t=unique(e.map((e=>e.user?.login)).filter((e=>e&&"app/dependabot"!==e)));return 0===t.length?null:`Thank you to everyone who contributed to this release ${humanJoin(t.map((e=>`<https://github.com/${e}|${e}>`)))}!`}function inferNextReleaseTag(e,t){if(t&&/^v\d+\.\d+\.\d+$/i.test(t))return t;const n=(e||"").match(/^v(\d+)\./i);return n?`v${n[1]}.x.x`:"v2.x.x"}function extractComponentName(e){const t=(e.title||"").trim(),n=t.match(/^[A-Za-z]+\(([^)]+)\):/);if(n)return n[1].trim();const o=t.match(/^([A-Za-z][A-Za-z0-9]+)/);return o?o[1].trim():null}function inferComponentFromText(e){const t=e.title||"";for(const[e,n]of LABEL_SECTION_MAP)if(new RegExp(`\\b${e}\\b`,"i").test(t))return n;return null}function resolveHighlightComponent(e){return e.section&&"General"!==e.section?e.section:extractComponentName(e)||inferComponentFromText(e)||e.section}function getFixComponents(e){const t=[];for(const n of e){const e=(n.title||"").toLowerCase();if(!/\bfix(e[ds])?\b/.test(e))continue;const o=resolveHighlightComponent(n);o&&"General"!==o&&"Beta"!==o&&(t.includes(o)||t.push(o))}return t}function getEnhancementComponents(e){const t=[];for(const n of e){const e=(n.title||"").toLowerCase();if(/\bfix(e[ds])?\b/.test(e))continue;const o=resolveHighlightComponent(n);o&&"General"!==o&&"Beta"!==o&&(t.includes(o)||t.push(o))}return t}function formatBetaDescription(e){const t=(e.title||"").trim().replace(/[.!?]+$/,"").toLowerCase(),n=extractComponentName(e)||"Component";return/feat\(|\badd\b/.test(t)?`${n} - allows you to guide users through multi-step forms.`:/fix/.test(t)?`${n} - includes important bug fixes.`:`${n} - includes beta updates.`}function getNewBetaComponentLines(e){const t=e.filter((e=>{const t=(e.title||"").toLowerCase();return!("Beta"!==e.section||!t.startsWith("feat(")&&(!t.startsWith("add")||!t.includes("component")))})),n=new Set,o=[];for(const e of t){const t=extractComponentName(e);t&&!n.has(t.toLowerCase())&&(n.add(t.toLowerCase()),o.push(`- **${t}** - allows you to guide users through multi-step forms.`))}return o}function normalizeSection(e){return BETA_COMPONENT_SECTIONS.has(e)?"Beta":e}function mentionsBetaComponent(e){const t=`${e.title||""}\n${e.body||""}`.toLowerCase();return Array.from(BETA_COMPONENT_SECTIONS).some((e=>t.includes(e.toLowerCase())))}function shouldForceIncludeAsBeta(e){return!isTypeScriptChange(e)&&(!!mentionsBetaComponent(e)||"Beta"===normalizeSection(getSection(e)))}function buildReleaseSections(e){const t=new Map(SECTION_ORDER.map((e=>[e,[]]))),n=new Map;for(const t of e){const e=normalizeSection(t.section);n.set(e,(n.get(e)||0)+1)}for(const o of e){const e=normalizeSection(o.section);let r=e;!("General"===e||"Beta"===e||"TypeScript"===e)&&(n.get(e)||0)<3&&(r="General"),t.has(r)||t.set(r,[]),t.get(r).push(formatEntry(o))}return t}function buildSectionOrder(e){const t=new Set(SECTION_ORDER),n=Array.from(e.keys()).filter((e=>!t.has(e))).sort();return[...SECTION_ORDER.slice(0,-2),...n,...SECTION_ORDER.slice(-2)]}function formatReleaseNotes(e){const t=buildSectionOrder(e),n=[];for(const o of t){const t=e.get(o);if(!t||0===t.length)continue;const r="Beta"===o?"Beta - APIs are subject to change:":`${o}:`;n.push({heading:r,entries:t})}const o=[];if(1===n.length&&"General:"===n[0].heading)for(const e of n[0].entries)o.push(e);else for(const{heading:e,entries:t}of n){o.push(e),o.push("");for(const e of t)o.push(e);o.push("")}return o.join("\n").trim()}function normalizeVersionHeading(e){return String(e).trim().replace(/^v/i,"")}function updateChangelog(e,t,n){const o=`# ${normalizeVersionHeading(t)}`,r=`${o}\n\n${n}\n`,s=existsSync(e)?readFileSync(e,"utf8"):"",a=s.split("\n"),i=a.findIndex((e=>e.trim()===o));let c;if(-1===i)c=`${r}\n${s}`;else{let e=i+1;for(;e<a.length&&!/^# /.test(a[e]);)e+=1;const t=a.slice(0,i).join("\n");c=`${t&&!t.endsWith("\n")?`${t}\n`:t}${r}\n${a.slice(e).join("\n")}`}writeFileSync(e,c,"utf8"),console.error(`Changelog updated at ${e} under "${o}".`)}function describeHighlightGroup(e,t,n,o){return 0===e.length?null:1===e.length?`${o} ${t} to ${e[0]}`:`${n} to ${humanJoin(e)}`}function formatAnnouncement(e){const t=getFixComponents(e.prs),n=getEnhancementComponents(e.prs),o=getNewBetaComponentLines(e.prs),r=[describeHighlightGroup(t,"fix","fixes","a"),describeHighlightGroup(n,"enhancement","enhancements","an")].filter(Boolean),s=r.length>0?`This release included ${r.join(" as well as ")}. Check out the full <${e.releaseUrl}|release notes> for details.`:`Check out the full <${e.releaseUrl}|release notes> for details.`,a=[`Grommet ${e.releaseLabel} is released`,"",s];return o.length>0&&(a.push(""),a.push("**New BETA components** *(APIs are subject to change)*:"),a.push(""),a.push(...o)),a.join("\n").trim()}const args=parseArgs();(async()=>{let e=args.from;e||(e=await getLatestTag(args.token),console.error(`Auto-detected --from: ${e}`));const t=args.to||"HEAD";console.error(`Resolving refs: ${e} → ${t}`);const n=await resolveRef(e,args.token),o=await resolveRef(t,args.token);console.error(`Fetching commits between ${e} and ${t}...`);const r=await ghGet(`${API}/compare/${n.sha}...${o.sha}`,args.token);if(r.total_commits>r.commits.length)throw new Error(`Compare API returned only ${r.commits.length} of ${r.total_commits} commits. The release range is too large; please choose a smaller range or switch to a paginated strategy.`);const s=new Set;for(const e of r.commits){const t=e.commit.message.matchAll(/#(\d+)/g);for(const e of t)s.add(Number(e[1]))}0===s.size?console.error("No PR references found in commits. Output will be empty."):console.error(`Found ${s.size} PR reference(s) in commits.`);const a=Array.from(s),i=[],c=[];for(let e=0;e<a.length;e+=5){const t=a.slice(e,e+5),n=await Promise.all(t.map((e=>ghGet(`${API}/pulls/${e}`,args.token).then((e=>({pr:e}))).catch((t=>({error:t,number:e}))))));i.push(...n.filter((e=>e.pr)).map((e=>e.pr))),c.push(...n.filter((e=>e.error)).map((e=>e.error)))}if(0===i.length&&c.length>0)throw c[0];c.length>0&&console.error(`Warning: failed to fetch ${c.length} PR(s).`);const l=[];let u=0,m=0;for(const e of i){const t=getSkipReason(e);if(t){console.error(` skip [${t}] #${e.number}: ${e.title}`),m++;continue}const n=shouldForceIncludeAsBeta(e)?"Beta":getSection(e);console.error(` include [${n}] #${e.number}: ${e.title}`),l.push({...e,section:n}),u++}const h=buildReleaseSections(l);console.error(`\nSummary: ${u} included, ${m} skipped.\n`);const p=inferNextReleaseTag(e,t),f="HEAD"!==t&&/^v\d/.test(t)?t:p||`changes through ${t}`,g="HEAD"!==t&&/^v\d/.test(t)?`${GH_RELEASE_URL}/${t}`:`${GH_COMPARE_URL}/${e}...${o.sha}`,d="announcement"===args.format?formatAnnouncement({prs:l,releaseLabel:f,releaseUrl:g,sections:h}):formatReleaseNotes(h);args.output?(writeFileSync(args.output,`${d}\n`,"utf8"),console.error(`Release notes written to ${args.output}`)):process.stdout.write(`${d}\n`);const $=!1===args.changelog||"announcement"===args.format?null:args.changelog||(args.output?null:"CHANGELOG.md");$&&updateChangelog($,args.version||(/^v?\d+\.\d+\.\d+$/i.test(t)?t:"X.X.X"),d)})().catch((e=>{console.error(e.message||e),process.exit(1)}));
1
+ import{existsSync,readdirSync,readFileSync,statSync,writeFileSync}from"fs";import{join}from"path";import{formatReleaseSentence,getSkipReason,isTypeScriptChange}from"./release-notes-utils";const OWNER="grommet",REPO="grommet",API=`https://api.github.com/repos/${OWNER}/${REPO}`,GH_PR_URL=`https://github.com/${OWNER}/${REPO}/pull`,GH_RELEASE_URL=`https://github.com/${OWNER}/${REPO}/releases/tag`,GH_COMPARE_URL=`https://github.com/${OWNER}/${REPO}/compare`,DEFAULT_CHANGELOG_FILE="CHANGELOG.md",PLACEHOLDER_VERSION="X.X.X",LABEL_SECTION_MAP=new Map([["DataTable","DataTable"],["DateInput","DateInput"],["DateTimeInput","DateTimeInput"],["TimeInput","TimeInput"],["FileInput","FileInput"],["Select","Select / SelectMultiple"],["SelectMultiple","Select / SelectMultiple"],["List","List"],["RadioButton","RadioButton / RadioButtonGroup"],["RadioButtonGroup","RadioButton / RadioButtonGroup"],["RangeSelector","RangeSelector"],["TypeScript","TypeScript"],["typescript","TypeScript"],["Beta","Beta"],["beta","Beta"],["Calendar","Calendar"],["TextInput","TextInput"],["MaskedInput","MaskedInput"],["Notification","Notification"],["Layer","Layer"],["Button","Button"],["Form","Form"],["FormField","FormField"],["Stepper","Stepper"],["Wizard","Wizard"],["Tabs","Tabs"],["Pagination","Pagination"],["Menu","Menu"],["Anchor","Anchor"],["CheckBox","CheckBox / CheckBoxGroup"],["CheckBoxGroup","CheckBoxGroup / CheckBox"],["Data","Data"],["DataChart","Chart / DataChart"],["Chart","Chart / DataChart"],["DataFilter","DataFilter"]]),SECTION_ORDER=["General","Anchor","Button","Calendar","Chart / DataChart","CheckBox","Data","DataFilter","DataTable","DateInput","DateTimeInput","FileInput","Form","FormField","Layer","List","MaskedInput","Menu","Notification","Pagination","RadioButton / RadioButtonGroup","RangeSelector","Select / SelectMultiple","Stepper","Tabs","TextInput","TimeInput","TypeScript","Beta"],BETA_LABELS=new Set(["beta","Beta"]),DEFAULT_BETA_COMPONENT_SECTIONS=new Set(["DateTimeInput","Stepper","TimeInput","Wizard"]),MIN_COMPONENT_SECTION_SIZE=3,BETA_WARNING_PATTERN=/currently in beta[\s\S]*api is subject\s+to\s+change/i;function getSourceBetaComponentSections(){const e=join(process.cwd(),"src","js","components");if(!existsSync(e))return new Set;const t=new Set,n=readdirSync(e);for(const o of n){const n=join(e,o);if(!statSync(n).isDirectory())continue;const r=join(n,`${o}.js`);if(existsSync(r))try{const e=readFileSync(r,"utf8");BETA_WARNING_PATTERN.test(e)&&t.add(o)}catch{}}return t}const BETA_COMPONENT_SECTIONS=new Set([...Array.from(DEFAULT_BETA_COMPONENT_SECTIONS),...Array.from(getSourceBetaComponentSections())]);function parseArgs(){const e=process.argv.slice(2),t={from:null,to:null,format:(process.argv[1]||"").includes("announcement")?"announcement":"release-notes",output:null,changelog:null,version:null,token:process.env.GH_TOKEN||null};for(let n=0;n<e.length;n++){const o=e[n];if("--from"===o)t.from=e[++n];else if("--to"===o)t.to=e[++n];else if("--format"===o)t.format=e[++n];else if("--output"===o)t.output=e[++n];else if("--changelog"===o){const o=e[n+1];t.changelog=o&&!o.startsWith("--")?e[++n]:"CHANGELOG.md"}else"--no-changelog"===o?t.changelog=!1:"--version"===o?t.version=e[++n]:"--token"===o?t.token=e[++n]:o.startsWith("--")||t.from?o.startsWith("--")||t.to||(t.to=o):t.from=o}return t}function getRequestHeaders(e){return{...e?{Authorization:`Bearer ${e}`}:{},Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"}}async function ghGet(e,t){const n=await fetch(e,{headers:getRequestHeaders(t)});if(!n.ok){const t=await n.text();if(403===n.status&&t.includes("API rate limit exceeded"))throw new Error("GitHub API rate limit exceeded. Set GH_TOKEN or pass --token to generate release output.");throw new Error(`GitHub API ${n.status} at ${e}:\n${t}`)}return n.json()}async function resolveRef(e,t){if(!e||"HEAD"===e){const e=await ghGet(`${API}`,t),n=await ghGet(`${API}/branches/${e.default_branch}`,t);return{sha:n.commit.sha,date:n.commit.commit.committer.date}}try{const n=await ghGet(`${API}/git/refs/tags/${e}`,t);let{sha:o}=n.object;return"tag"===n.object.type&&(o=(await ghGet(`${API}/git/tags/${o}`,t)).object.sha),{sha:o,date:(await ghGet(`${API}/commits/${o}`,t)).commit.committer.date}}catch{const n=await ghGet(`${API}/commits/${e}`,t);return{sha:n.sha,date:n.commit.committer.date}}}async function getLatestTag(e){const t=await ghGet(`${API}/tags?per_page=5`,e);if(!t.length)throw new Error("No tags found in repository.");return t[0].name}function getSection(e){const t=e.labels.map(e=>e.name);if(isTypeScriptChange(e))return"TypeScript";if(t.some(e=>BETA_LABELS.has(e)))return"Beta";for(const e of t){const t=LABEL_SECTION_MAP.get(e);if(t)return t}const n=e.title.match(/^[A-Za-z]+\(([^)]+)\):/);if(n){const e=n[1].trim();for(const[t,n]of LABEL_SECTION_MAP)if(t.toLowerCase()===e.toLowerCase())return n}const o=e.title.toLowerCase();for(const[e,t]of LABEL_SECTION_MAP){const n=e.toLowerCase();if(o.startsWith(`${n} `)||o.startsWith(`${n}:`)||o.startsWith(`${n}-`)||o.startsWith(`${n},`))return t}return"General"}function formatEntry(e){return`- ${formatReleaseSentence(e).replace(/[.!?]+$/,"")}. ([#${e.number}](${GH_PR_URL}/${e.number}))`}function formatTitlePhrase(e){const t=e.trim().replace(/[.!?]+$/,"");return t.charAt(0).toLowerCase()+t.slice(1)}function humanJoin(e){return 0===e.length?"":1===e.length?e[0]:2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`}function unique(e){return e.filter((t,n)=>t&&e.indexOf(t)===n)}function getAnnouncementHighlights(e){const t=[/^added\b/i,/^enhanced\b/i,/^improved\b/i];return e.filter(e=>t.some(t=>t.test(e.title))).slice(0,2).map(e=>formatTitlePhrase(e.title))}function getFixSummary(e){const t=unique(e.filter(e=>/^fixed\b/i.test(e.title)).map(e=>e.section).filter(e=>e&&"General"!==e&&"Beta"!==e));if(0===t.length)return null;const n=t.slice(0,5),o=t.length>5?", and more":"";return`There are also fixes across ${humanJoin(n)}${o}.`}function formatContributors(e){const t=unique(e.map(e=>e.user?.login).filter(e=>e&&"app/dependabot"!==e));return 0===t.length?null:`Thank you to everyone who contributed to this release ${humanJoin(t.map(e=>`<https://github.com/${e}|${e}>`))}!`}function inferNextReleaseTag(e,t){if(t&&/^v\d+\.\d+\.\d+$/i.test(t))return t;const n=(e||"").match(/^v(\d+)\./i);return n?`v${n[1]}.x.x`:"v2.x.x"}function extractComponentName(e){const t=(e.title||"").trim(),n=t.match(/^[A-Za-z]+\(([^)]+)\):/);if(n)return n[1].trim();const o=t.match(/^([A-Za-z][A-Za-z0-9]+)/);return o?o[1].trim():null}function inferComponentFromText(e){const t=e.title||"";for(const[e,n]of LABEL_SECTION_MAP)if(new RegExp(`\\b${e}\\b`,"i").test(t))return n;return null}function resolveHighlightComponent(e){return e.section&&"General"!==e.section?e.section:extractComponentName(e)||inferComponentFromText(e)||e.section}function getFixComponents(e){const t=[];for(const n of e){const e=(n.title||"").toLowerCase();if(!/\bfix(e[ds])?\b/.test(e))continue;const o=resolveHighlightComponent(n);o&&"General"!==o&&"Beta"!==o&&(t.includes(o)||t.push(o))}return t}function getEnhancementComponents(e){const t=[];for(const n of e){const e=(n.title||"").toLowerCase();if(/\bfix(e[ds])?\b/.test(e))continue;const o=resolveHighlightComponent(n);o&&"General"!==o&&"Beta"!==o&&(t.includes(o)||t.push(o))}return t}function formatBetaDescription(e){const t=(e.title||"").trim().replace(/[.!?]+$/,"").toLowerCase(),n=extractComponentName(e)||"Component";return/feat\(|\badd\b/.test(t)?`${n} - allows you to guide users through multi-step forms.`:/fix/.test(t)?`${n} - includes important bug fixes.`:`${n} - includes beta updates.`}function getNewBetaComponentLines(e){const t=e.filter(e=>{const t=(e.title||"").toLowerCase();return!("Beta"!==e.section||!t.startsWith("feat(")&&(!t.startsWith("add")||!t.includes("component")))}),n=new Set,o=[];for(const e of t){const t=extractComponentName(e);t&&!n.has(t.toLowerCase())&&(n.add(t.toLowerCase()),o.push(`- **${t}** - allows you to guide users through multi-step forms.`))}return o}function normalizeSection(e){return BETA_COMPONENT_SECTIONS.has(e)?"Beta":e}function mentionsBetaComponent(e){const t=`${e.title||""}\n${e.body||""}`.toLowerCase();return Array.from(BETA_COMPONENT_SECTIONS).some(e=>t.includes(e.toLowerCase()))}function shouldForceIncludeAsBeta(e){return!isTypeScriptChange(e)&&(!!mentionsBetaComponent(e)||"Beta"===normalizeSection(getSection(e)))}function buildReleaseSections(e){const t=new Map(SECTION_ORDER.map(e=>[e,[]])),n=new Map;for(const t of e){const e=normalizeSection(t.section);n.set(e,(n.get(e)||0)+1)}for(const o of e){const e=normalizeSection(o.section);let r=e;!("General"===e||"Beta"===e||"TypeScript"===e)&&(n.get(e)||0)<3&&(r="General"),t.has(r)||t.set(r,[]),t.get(r).push(formatEntry(o))}return t}function buildSectionOrder(e){const t=new Set(SECTION_ORDER),n=Array.from(e.keys()).filter(e=>!t.has(e)).sort();return[...SECTION_ORDER.slice(0,-2),...n,...SECTION_ORDER.slice(-2)]}function formatReleaseNotes(e){const t=buildSectionOrder(e),n=[];for(const o of t){const t=e.get(o);if(!t||0===t.length)continue;const r="Beta"===o?"Beta - APIs are subject to change:":`${o}:`;n.push({heading:r,entries:t})}const o=[];if(1===n.length&&"General:"===n[0].heading)for(const e of n[0].entries)o.push(e);else for(const{heading:e,entries:t}of n){o.push(e),o.push("");for(const e of t)o.push(e);o.push("")}return o.join("\n").trim()}function normalizeVersionHeading(e){return String(e).trim().replace(/^v/i,"")}function updateChangelog(e,t,n){const o=`# ${normalizeVersionHeading(t)}`,r=`${o}\n\n${n}\n`,s=existsSync(e)?readFileSync(e,"utf8"):"",a=s.split("\n"),i=a.findIndex(e=>e.trim()===o);let c;if(-1===i)c=`${r}\n${s}`;else{let e=i+1;for(;e<a.length&&!/^# /.test(a[e]);)e+=1;const t=a.slice(0,i).join("\n");c=`${t&&!t.endsWith("\n")?`${t}\n`:t}${r}\n${a.slice(e).join("\n")}`}writeFileSync(e,c,"utf8"),console.error(`Changelog updated at ${e} under "${o}".`)}function describeHighlightGroup(e,t,n,o){return 0===e.length?null:1===e.length?`${o} ${t} to ${e[0]}`:`${n} to ${humanJoin(e)}`}function formatAnnouncement(e){const t=getFixComponents(e.prs),n=getEnhancementComponents(e.prs),o=getNewBetaComponentLines(e.prs),r=[describeHighlightGroup(t,"fix","fixes","a"),describeHighlightGroup(n,"enhancement","enhancements","an")].filter(Boolean),s=r.length>0?`This release included ${r.join(" as well as ")}. Check out the full <${e.releaseUrl}|release notes> for details.`:`Check out the full <${e.releaseUrl}|release notes> for details.`,a=[`Grommet ${e.releaseLabel} is released`,"",s];return o.length>0&&(a.push(""),a.push("**New BETA components** *(APIs are subject to change)*:"),a.push(""),a.push(...o)),a.join("\n").trim()}const args=parseArgs();(async()=>{let e=args.from;e||(e=await getLatestTag(args.token),console.error(`Auto-detected --from: ${e}`));const t=args.to||"HEAD";console.error(`Resolving refs: ${e} → ${t}`);const n=await resolveRef(e,args.token),o=await resolveRef(t,args.token);console.error(`Fetching commits between ${e} and ${t}...`);const r=await ghGet(`${API}/compare/${n.sha}...${o.sha}`,args.token);if(r.total_commits>r.commits.length)throw new Error(`Compare API returned only ${r.commits.length} of ${r.total_commits} commits. The release range is too large; please choose a smaller range or switch to a paginated strategy.`);const s=new Set;for(const e of r.commits){const t=e.commit.message.matchAll(/#(\d+)/g);for(const e of t)s.add(Number(e[1]))}0===s.size?console.error("No PR references found in commits. Output will be empty."):console.error(`Found ${s.size} PR reference(s) in commits.`);const a=Array.from(s),i=[],c=[];for(let e=0;e<a.length;e+=5){const t=a.slice(e,e+5),n=await Promise.all(t.map(e=>ghGet(`${API}/pulls/${e}`,args.token).then(e=>({pr:e})).catch(t=>({error:t,number:e}))));i.push(...n.filter(e=>e.pr).map(e=>e.pr)),c.push(...n.filter(e=>e.error).map(e=>e.error))}if(0===i.length&&c.length>0)throw c[0];c.length>0&&console.error(`Warning: failed to fetch ${c.length} PR(s).`);const l=[];let u=0,m=0;for(const e of i){const t=getSkipReason(e);if(t){console.error(` skip [${t}] #${e.number}: ${e.title}`),m++;continue}const n=shouldForceIncludeAsBeta(e)?"Beta":getSection(e);console.error(` include [${n}] #${e.number}: ${e.title}`),l.push({...e,section:n}),u++}const h=buildReleaseSections(l);console.error(`\nSummary: ${u} included, ${m} skipped.\n`);const p=inferNextReleaseTag(e,t),f="HEAD"!==t&&/^v\d/.test(t)?t:p||`changes through ${t}`,g="HEAD"!==t&&/^v\d/.test(t)?`${GH_RELEASE_URL}/${t}`:`${GH_COMPARE_URL}/${e}...${o.sha}`,d="announcement"===args.format?formatAnnouncement({prs:l,releaseLabel:f,releaseUrl:g,sections:h}):formatReleaseNotes(h);args.output?(writeFileSync(args.output,`${d}\n`,"utf8"),console.error(`Release notes written to ${args.output}`)):process.stdout.write(`${d}\n`);const $=!1===args.changelog||"announcement"===args.format?null:args.changelog||(args.output?null:"CHANGELOG.md");$&&updateChangelog($,args.version||(/^v?\d+\.\d+\.\d+$/i.test(t)?t:"X.X.X"),d)})().catch(e=>{console.error(e.message||e),process.exit(1)});
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const fs=require("fs"),path=require("path"),{execFileSync}=require("child_process"),HEADER="// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP\n// SPDX-License-Identifier: Apache-2.0\n",ROOTS=["src","e2e","storybook","tools"],EXTENSIONS=new Set([".js",".jsx",".ts",".tsx",".mjs",".cjs"]),EXCLUDED_DIRS=new Set(["node_modules","dist","coverage",".git",".yarn","storybook-static","__snapshots__"]);function isIncluded(e){return!e.endsWith(".snap")&&EXTENSIONS.has(path.extname(e))}function collectStagedFiles(){return execFileSync("git",["diff","--cached","--name-only","--diff-filter=ACMR"],{encoding:"utf8"}).split("\n").map((e=>e.trim())).filter(Boolean).filter((e=>ROOTS.some((t=>e===t||e.startsWith(`${t}/`))))).filter((e=>isIncluded(e))).filter((e=>fs.existsSync(e)))}function collectFiles(e,t){if(!fs.existsSync(e))return;const s=fs.statSync(e);s.isDirectory()?fs.readdirSync(e,{withFileTypes:!0}).forEach((s=>{s.isDirectory()&&EXCLUDED_DIRS.has(s.name)||collectFiles(path.join(e,s.name),t)})):s.isFile()&&isIncluded(e)&&t.push(e)}function buildExpected(e){let t="",s=e;if(e.startsWith("#!")){const i=e.indexOf("\n");t=-1===i?`${e}\n`:e.slice(0,i+1),s=-1===i?"":e.slice(i+1)}const i=s.split("\n");let n=0;for(;n<i.length&&/^\/\/\s*SPDX-/i.test(i[n]);)n+=1;n>0&&""===i[n]?.trim()&&(n+=1);const c=i.slice(n),l=/^\s*(['"])use [\w-]+\1;?\s*$/.test(c[0]??"");return`${t}${HEADER}${l?"\n":""}${c.join("\n")}`}function main(){const e=process.argv.slice(2),t=e.includes("--check"),s=e.includes("--staged"),i=e.filter((e=>!e.startsWith("--")));let n;if(s)n=collectStagedFiles();else{const e=i.length>0?i:ROOTS;n=[],e.forEach((e=>collectFiles(e,n)))}const c=[];if(n.forEach((e=>{const s=fs.readFileSync(e,"utf8"),i=buildExpected(s);i!==s&&(c.push(e),t||fs.writeFileSync(e,i))})),s&&!t&&c.length>0&&execFileSync("git",["add","--",...c]),t)return c.length>0&&(console.error(`License header check failed: ${c.length} file(s) missing or with an incorrect SPDX header.`),c.forEach((e=>console.error(` ${e}`))),console.error('\nRun "yarn license" to fix the headers.'),process.exit(1)),void console.log(`License header check passed (${n.length} file(s)).`);c.length>0?console.log(`Updated SPDX header in ${c.length} file(s).`):console.log(`All ${n.length} file(s) already compliant.`)}main();
2
+ const fs=require("fs"),path=require("path"),{execFileSync}=require("child_process"),HEADER="// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP\n// SPDX-License-Identifier: Apache-2.0\n",ROOTS=["src","e2e","storybook","tools"],EXTENSIONS=new Set([".js",".jsx",".ts",".tsx",".mjs",".cjs"]),EXCLUDED_DIRS=new Set(["node_modules","dist","coverage",".git",".yarn","storybook-static","__snapshots__"]);function isIncluded(e){return!e.endsWith(".snap")&&EXTENSIONS.has(path.extname(e))}function collectStagedFiles(){return execFileSync("git",["diff","--cached","--name-only","--diff-filter=ACMR"],{encoding:"utf8"}).split("\n").map(e=>e.trim()).filter(Boolean).filter(e=>ROOTS.some(t=>e===t||e.startsWith(`${t}/`))).filter(e=>isIncluded(e)).filter(e=>fs.existsSync(e))}function collectFiles(e,t){if(!fs.existsSync(e))return;const s=fs.statSync(e);s.isDirectory()?fs.readdirSync(e,{withFileTypes:!0}).forEach(s=>{s.isDirectory()&&EXCLUDED_DIRS.has(s.name)||collectFiles(path.join(e,s.name),t)}):s.isFile()&&isIncluded(e)&&t.push(e)}function buildExpected(e){let t="",s=e;if(e.startsWith("#!")){const i=e.indexOf("\n");t=-1===i?`${e}\n`:e.slice(0,i+1),s=-1===i?"":e.slice(i+1)}const i=s.split("\n");let n=0;for(;n<i.length&&/^\/\/\s*SPDX-/i.test(i[n]);)n+=1;n>0&&""===i[n]?.trim()&&(n+=1);const c=i.slice(n),l=/^\s*(['"])use [\w-]+\1;?\s*$/.test(c[0]??"");return`${t}${HEADER}${l?"\n":""}${c.join("\n")}`}function main(){const e=process.argv.slice(2),t=e.includes("--check"),s=e.includes("--staged"),i=e.filter(e=>!e.startsWith("--"));let n;if(s)n=collectStagedFiles();else{const e=i.length>0?i:ROOTS;n=[],e.forEach(e=>collectFiles(e,n))}const c=[];if(n.forEach(e=>{const s=fs.readFileSync(e,"utf8"),i=buildExpected(s);i!==s&&(c.push(e),t||fs.writeFileSync(e,i))}),s&&!t&&c.length>0&&execFileSync("git",["add","--",...c]),t)return c.length>0&&(console.error(`License header check failed: ${c.length} file(s) missing or with an incorrect SPDX header.`),c.forEach(e=>console.error(` ${e}`)),console.error('\nRun "yarn license" to fix the headers.'),process.exit(1)),void console.log(`License header check passed (${n.length} file(s)).`);c.length>0?console.log(`Updated SPDX header in ${c.length} file(s).`):console.log(`All ${n.length} file(s) already compliant.`)}main();
package/tools/pack.js CHANGED
@@ -1 +1 @@
1
- import path from"path";import del from"del";import fs from"fs";import cp from"child_process";import tarball from"tarball-extract";const packageJSON=path.resolve(__dirname,"../package.json"),packageJSONAsString=fs.readFileSync(packageJSON),json=JSON.parse(packageJSONAsString);json.dependencies&&(json.bundledDependencies=Object.keys(json.dependencies),fs.writeFileSync(packageJSON,JSON.stringify(json,null,2)));try{cp.exec("npm pack",(e=>{if(e)throw e;const n={name:json.name,version:json.version,dependencies:{licenseNotFound:[]}},s=`${json.name}-${json.version}.tgz`;tarball.extractTarball(s,"./tmp",(e=>{if(e)throw e;fs.renameSync(path.resolve(__dirname,`../${s}`),path.resolve(__dirname,`../${json.name}-${json.version}-src-with-dependecies.tgz`)),fs.readdirSync(path.resolve(__dirname,"../tmp/package/node_modules")).forEach((e=>{const s=path.resolve(__dirname,`../node_modules/${e}/package.json`);if(fs.existsSync(s)){const a=fs.readFileSync(s),r=JSON.parse(a);let i=r.license;!i&&r.licenses&&(i=r.licenses[0]),i?i.type?n.dependencies[e]=i.type:n.dependencies[e]=i:n.dependencies.licenseNotFound.push(e)}}));const a=path.resolve(__dirname,`../${json.name}-${json.version}-licenses.json`);fs.writeFileSync(a,JSON.stringify(n,null,2)),fs.writeFileSync(packageJSON,`${JSON.stringify(JSON.parse(packageJSONAsString),null,2)}\n`),del.sync(["./tmp"])}))}))}catch(e){console.log(e),fs.writeFileSync(packageJSON,`${JSON.stringify(JSON.parse(packageJSONAsString),null,2)}\n`)}
1
+ import path from"path";import del from"del";import fs from"fs";import cp from"child_process";import tarball from"tarball-extract";const packageJSON=path.resolve(__dirname,"../package.json"),packageJSONAsString=fs.readFileSync(packageJSON),json=JSON.parse(packageJSONAsString);json.dependencies&&(json.bundledDependencies=Object.keys(json.dependencies),fs.writeFileSync(packageJSON,JSON.stringify(json,null,2)));try{cp.exec("npm pack",e=>{if(e)throw e;const n={name:json.name,version:json.version,dependencies:{licenseNotFound:[]}},s=`${json.name}-${json.version}.tgz`;tarball.extractTarball(s,"./tmp",e=>{if(e)throw e;fs.renameSync(path.resolve(__dirname,`../${s}`),path.resolve(__dirname,`../${json.name}-${json.version}-src-with-dependecies.tgz`)),fs.readdirSync(path.resolve(__dirname,"../tmp/package/node_modules")).forEach(e=>{const s=path.resolve(__dirname,`../node_modules/${e}/package.json`);if(fs.existsSync(s)){const a=fs.readFileSync(s),r=JSON.parse(a);let i=r.license;!i&&r.licenses&&(i=r.licenses[0]),i?i.type?n.dependencies[e]=i.type:n.dependencies[e]=i:n.dependencies.licenseNotFound.push(e)}});const a=path.resolve(__dirname,`../${json.name}-${json.version}-licenses.json`);fs.writeFileSync(a,JSON.stringify(n,null,2)),fs.writeFileSync(packageJSON,`${JSON.stringify(JSON.parse(packageJSONAsString),null,2)}\n`),del.sync(["./tmp"])})})}catch(e){console.log(e),fs.writeFileSync(packageJSON,`${JSON.stringify(JSON.parse(packageJSONAsString),null,2)}\n`)}