@primer/components 0.0.0-2021102995710 → 0.0.0-202110303104

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 (427) hide show
  1. package/CHANGELOG.md +4 -90
  2. package/dist/browser.esm.js +774 -718
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +772 -716
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/ActionList/Divider.jsx +29 -0
  7. package/lib/ActionList/Group.jsx +23 -0
  8. package/lib/ActionList/Header.jsx +66 -0
  9. package/lib/ActionList/Item.js +52 -27
  10. package/lib/ActionList/Item.jsx +311 -0
  11. package/lib/ActionList/List.jsx +138 -0
  12. package/lib/ActionList/index.js +12 -23
  13. package/lib/ActionList2/Description.jsx +29 -0
  14. package/lib/ActionList2/Divider.jsx +22 -0
  15. package/lib/ActionList2/Group.d.ts +2 -28
  16. package/lib/ActionList2/Group.js +6 -55
  17. package/lib/ActionList2/Group.jsx +25 -0
  18. package/lib/ActionList2/Header.jsx +36 -0
  19. package/lib/ActionList2/Item.jsx +174 -0
  20. package/lib/ActionList2/LinkItem.jsx +28 -0
  21. package/lib/ActionList2/List.d.ts +1 -1
  22. package/lib/ActionList2/List.js +2 -1
  23. package/lib/ActionList2/List.jsx +41 -0
  24. package/lib/ActionList2/Selection.jsx +50 -0
  25. package/lib/ActionList2/Visuals.jsx +48 -0
  26. package/lib/ActionList2/index.js +23 -41
  27. package/lib/ActionMenu.jsx +73 -0
  28. package/lib/AnchoredOverlay/AnchoredOverlay.jsx +100 -0
  29. package/lib/AnchoredOverlay/index.js +4 -12
  30. package/lib/Autocomplete/Autocomplete.d.ts +3 -3
  31. package/lib/Autocomplete/Autocomplete.jsx +100 -0
  32. package/lib/Autocomplete/AutocompleteContext.jsx +5 -0
  33. package/lib/Autocomplete/AutocompleteInput.d.ts +3 -3
  34. package/lib/Autocomplete/AutocompleteInput.jsx +113 -0
  35. package/lib/Autocomplete/AutocompleteMenu.jsx +190 -0
  36. package/lib/Autocomplete/AutocompleteOverlay.jsx +55 -0
  37. package/lib/Autocomplete/index.js +7 -14
  38. package/lib/Avatar.jsx +34 -0
  39. package/lib/AvatarPair.jsx +29 -0
  40. package/lib/AvatarStack.jsx +151 -0
  41. package/lib/BaseStyles.jsx +65 -0
  42. package/lib/BorderBox.jsx +18 -0
  43. package/lib/Box.jsx +10 -0
  44. package/lib/BranchName.jsx +20 -0
  45. package/lib/Breadcrumbs.d.ts +7 -8
  46. package/lib/Breadcrumbs.js +12 -7
  47. package/lib/Breadcrumbs.jsx +74 -0
  48. package/lib/Button/Button.d.ts +3 -2
  49. package/lib/Button/Button.js +6 -2
  50. package/lib/Button/Button.jsx +60 -0
  51. package/lib/Button/ButtonBase.d.ts +8 -5
  52. package/lib/Button/ButtonBase.js +5 -1
  53. package/lib/Button/ButtonBase.jsx +36 -0
  54. package/lib/Button/ButtonClose.d.ts +46 -3
  55. package/lib/Button/ButtonClose.js +1 -1
  56. package/lib/Button/ButtonClose.jsx +55 -0
  57. package/lib/Button/ButtonDanger.d.ts +3 -2
  58. package/lib/Button/ButtonDanger.js +6 -2
  59. package/lib/Button/ButtonDanger.jsx +63 -0
  60. package/lib/Button/ButtonGroup.jsx +55 -0
  61. package/lib/Button/ButtonInvisible.d.ts +3 -2
  62. package/lib/Button/ButtonInvisible.js +6 -2
  63. package/lib/Button/ButtonInvisible.jsx +52 -0
  64. package/lib/Button/ButtonOutline.d.ts +3 -2
  65. package/lib/Button/ButtonOutline.js +6 -2
  66. package/lib/Button/ButtonOutline.jsx +63 -0
  67. package/lib/Button/ButtonPrimary.d.ts +3 -2
  68. package/lib/Button/ButtonPrimary.js +6 -2
  69. package/lib/Button/ButtonPrimary.jsx +62 -0
  70. package/lib/Button/ButtonStyles.jsx +37 -0
  71. package/lib/Button/ButtonTableList.d.ts +2 -1
  72. package/lib/Button/ButtonTableList.js +1 -1
  73. package/lib/Button/ButtonTableList.jsx +49 -0
  74. package/lib/Button/index.js +21 -70
  75. package/lib/Caret.jsx +93 -0
  76. package/lib/CircleBadge.d.ts +5 -4
  77. package/lib/CircleBadge.js +1 -1
  78. package/lib/CircleBadge.jsx +43 -0
  79. package/lib/CircleOcticon.d.ts +1 -1
  80. package/lib/CircleOcticon.jsx +21 -0
  81. package/lib/CounterLabel.d.ts +2 -1
  82. package/lib/CounterLabel.js +1 -1
  83. package/lib/CounterLabel.jsx +44 -0
  84. package/lib/Details.jsx +21 -0
  85. package/lib/Dialog/ConfirmationDialog.jsx +146 -0
  86. package/lib/Dialog/Dialog.d.ts +9 -5
  87. package/lib/Dialog/Dialog.js +11 -17
  88. package/lib/Dialog/Dialog.jsx +273 -0
  89. package/lib/Dialog.d.ts +5 -4
  90. package/lib/Dialog.js +1 -1
  91. package/lib/Dialog.jsx +131 -0
  92. package/lib/Dropdown.d.ts +99 -10
  93. package/lib/Dropdown.js +3 -3
  94. package/lib/Dropdown.jsx +134 -0
  95. package/lib/DropdownMenu/DropdownButton.d.ts +47 -3
  96. package/lib/DropdownMenu/DropdownButton.js +1 -3
  97. package/lib/DropdownMenu/DropdownButton.jsx +14 -0
  98. package/lib/DropdownMenu/DropdownMenu.jsx +70 -0
  99. package/lib/DropdownMenu/index.js +6 -20
  100. package/lib/DropdownStyles.js +18 -26
  101. package/lib/EmojiPicker/EmojiPicker.d.ts +15 -0
  102. package/lib/EmojiPicker/EmojiPicker.js +205 -0
  103. package/lib/EmojiPicker/EmojiPicker.jsx +125 -0
  104. package/lib/EmojiPicker/EmojiPickerAnchor.d.ts +0 -0
  105. package/lib/EmojiPicker/EmojiPickerAnchor.js +1 -0
  106. package/lib/EmojiPicker/EmojiPickerAnchor.jsx +1 -0
  107. package/lib/EmojiPicker/EmojiPickerPanel.d.ts +3 -0
  108. package/lib/EmojiPicker/EmojiPickerPanel.js +18 -0
  109. package/lib/EmojiPicker/EmojiPickerPanel.jsx +10 -0
  110. package/lib/EmojiPicker/data.d.ts +9 -0
  111. package/lib/EmojiPicker/data.js +7254 -0
  112. package/lib/EmojiPicker/index.d.ts +2 -0
  113. package/lib/EmojiPicker/index.js +8 -0
  114. package/lib/FilterList.d.ts +303 -264
  115. package/lib/FilterList.js +6 -2
  116. package/lib/FilterList.jsx +63 -0
  117. package/lib/FilteredActionList/FilteredActionList.jsx +100 -0
  118. package/lib/FilteredActionList/index.js +4 -12
  119. package/lib/FilteredSearch.d.ts +2 -1
  120. package/lib/FilteredSearch.js +1 -1
  121. package/lib/FilteredSearch.jsx +29 -0
  122. package/lib/Flash.d.ts +2 -1
  123. package/lib/Flash.js +1 -1
  124. package/lib/Flash.jsx +70 -0
  125. package/lib/Flex.jsx +15 -0
  126. package/lib/FormGroup.d.ts +5 -4
  127. package/lib/FormGroup.js +2 -2
  128. package/lib/FormGroup.jsx +25 -0
  129. package/lib/Grid.jsx +15 -0
  130. package/lib/Header.d.ts +7 -6
  131. package/lib/Header.js +4 -4
  132. package/lib/Header.jsx +90 -0
  133. package/lib/Heading.jsx +21 -0
  134. package/lib/Label.d.ts +2 -1
  135. package/lib/Label.js +3 -2
  136. package/lib/Label.jsx +84 -0
  137. package/lib/LabelGroup.d.ts +2 -1
  138. package/lib/LabelGroup.js +1 -1
  139. package/lib/LabelGroup.jsx +19 -0
  140. package/lib/Link.d.ts +2 -1
  141. package/lib/Link.js +1 -1
  142. package/lib/Link.jsx +38 -0
  143. package/lib/NewButton/button-counter.jsx +14 -0
  144. package/lib/NewButton/button.js +42 -34
  145. package/lib/NewButton/button.jsx +278 -0
  146. package/lib/NewButton/index.js +5 -12
  147. package/lib/NewButton/types.js +2 -1
  148. package/lib/Overlay.d.ts +11 -14
  149. package/lib/Overlay.js +4 -3
  150. package/lib/Overlay.jsx +156 -0
  151. package/lib/Pagehead.d.ts +2 -1
  152. package/lib/Pagehead.js +1 -1
  153. package/lib/Pagehead.jsx +18 -0
  154. package/lib/Pagination/Pagination.js +1 -1
  155. package/lib/Pagination/Pagination.jsx +163 -0
  156. package/lib/Pagination/index.js +6 -12
  157. package/lib/Pagination/model.jsx +174 -0
  158. package/lib/PointerBox.jsx +25 -0
  159. package/lib/Popover.d.ts +5 -4
  160. package/lib/Popover.js +5 -4
  161. package/lib/Popover.jsx +210 -0
  162. package/lib/Portal/Portal.jsx +79 -0
  163. package/lib/Portal/index.js +5 -16
  164. package/lib/Position.d.ts +4 -4
  165. package/lib/Position.jsx +46 -0
  166. package/lib/ProgressBar.jsx +39 -0
  167. package/lib/SelectMenu/SelectMenu.d.ts +189 -21
  168. package/lib/SelectMenu/SelectMenu.js +3 -1
  169. package/lib/SelectMenu/SelectMenu.jsx +114 -0
  170. package/lib/SelectMenu/SelectMenuContext.jsx +5 -0
  171. package/lib/SelectMenu/SelectMenuDivider.d.ts +2 -1
  172. package/lib/SelectMenu/SelectMenuDivider.js +1 -1
  173. package/lib/SelectMenu/SelectMenuDivider.jsx +43 -0
  174. package/lib/SelectMenu/SelectMenuFilter.js +1 -1
  175. package/lib/SelectMenu/SelectMenuFilter.jsx +59 -0
  176. package/lib/SelectMenu/SelectMenuFooter.d.ts +2 -1
  177. package/lib/SelectMenu/SelectMenuFooter.js +1 -1
  178. package/lib/SelectMenu/SelectMenuFooter.jsx +46 -0
  179. package/lib/SelectMenu/SelectMenuHeader.d.ts +2 -1
  180. package/lib/SelectMenu/SelectMenuHeader.js +1 -1
  181. package/lib/SelectMenu/SelectMenuHeader.jsx +44 -0
  182. package/lib/SelectMenu/SelectMenuItem.d.ts +3 -2
  183. package/lib/SelectMenu/SelectMenuItem.js +1 -1
  184. package/lib/SelectMenu/SelectMenuItem.jsx +143 -0
  185. package/lib/SelectMenu/SelectMenuList.d.ts +2 -1
  186. package/lib/SelectMenu/SelectMenuList.js +1 -1
  187. package/lib/SelectMenu/SelectMenuList.jsx +60 -0
  188. package/lib/SelectMenu/SelectMenuLoadingAnimation.d.ts +2 -2
  189. package/lib/SelectMenu/SelectMenuLoadingAnimation.js +1 -3
  190. package/lib/SelectMenu/SelectMenuLoadingAnimation.jsx +21 -0
  191. package/lib/SelectMenu/SelectMenuModal.d.ts +3 -2
  192. package/lib/SelectMenu/SelectMenuModal.js +1 -1
  193. package/lib/SelectMenu/SelectMenuModal.jsx +119 -0
  194. package/lib/SelectMenu/SelectMenuTab.d.ts +2 -1
  195. package/lib/SelectMenu/SelectMenuTab.js +1 -1
  196. package/lib/SelectMenu/SelectMenuTab.jsx +93 -0
  197. package/lib/SelectMenu/SelectMenuTabPanel.d.ts +2 -1
  198. package/lib/SelectMenu/SelectMenuTabPanel.js +1 -1
  199. package/lib/SelectMenu/SelectMenuTabPanel.jsx +43 -0
  200. package/lib/SelectMenu/SelectMenuTabs.d.ts +2 -1
  201. package/lib/SelectMenu/SelectMenuTabs.js +1 -1
  202. package/lib/SelectMenu/SelectMenuTabs.jsx +58 -0
  203. package/lib/SelectMenu/hooks/useKeyboardNav.js +80 -96
  204. package/lib/SelectMenu/index.js +7 -14
  205. package/lib/SelectPanel/SelectPanel.jsx +105 -0
  206. package/lib/SelectPanel/index.js +4 -12
  207. package/lib/SideNav.d.ts +8 -11
  208. package/lib/SideNav.js +15 -8
  209. package/lib/SideNav.jsx +177 -0
  210. package/lib/Spinner.jsx +35 -0
  211. package/lib/StateLabel.d.ts +2 -1
  212. package/lib/StateLabel.js +5 -6
  213. package/lib/StateLabel.jsx +94 -0
  214. package/lib/StyledOcticon.d.ts +2 -1
  215. package/lib/StyledOcticon.js +3 -1
  216. package/lib/StyledOcticon.jsx +20 -0
  217. package/lib/SubNav.d.ts +11 -5
  218. package/lib/SubNav.js +12 -7
  219. package/lib/SubNav.jsx +104 -0
  220. package/lib/TabNav.d.ts +4 -3
  221. package/lib/TabNav.js +2 -2
  222. package/lib/TabNav.jsx +60 -0
  223. package/lib/Text.jsx +14 -0
  224. package/lib/TextInput.jsx +23 -0
  225. package/lib/TextInputWithTokens.d.ts +3 -3
  226. package/lib/TextInputWithTokens.jsx +218 -0
  227. package/lib/ThemeProvider.jsx +130 -0
  228. package/lib/Timeline.d.ts +393 -19
  229. package/lib/Timeline.js +13 -16
  230. package/lib/Timeline.jsx +124 -0
  231. package/lib/Token/AvatarToken.jsx +54 -0
  232. package/lib/Token/IssueLabelToken.jsx +125 -0
  233. package/lib/Token/Token.d.ts +1 -1
  234. package/lib/Token/Token.jsx +103 -0
  235. package/lib/Token/TokenBase.jsx +88 -0
  236. package/lib/Token/_RemoveTokenButton.jsx +108 -0
  237. package/lib/Token/_TokenTextContainer.jsx +49 -0
  238. package/lib/Token/index.js +11 -30
  239. package/lib/Tooltip.d.ts +2 -1
  240. package/lib/Tooltip.js +1 -1
  241. package/lib/Tooltip.jsx +246 -0
  242. package/lib/Truncate.d.ts +2 -1
  243. package/lib/Truncate.js +3 -1
  244. package/lib/Truncate.jsx +27 -0
  245. package/lib/UnderlineNav.d.ts +3 -2
  246. package/lib/UnderlineNav.js +2 -2
  247. package/lib/UnderlineNav.jsx +90 -0
  248. package/lib/_TextInputWrapper.jsx +120 -0
  249. package/lib/_UnstyledTextInput.jsx +22 -0
  250. package/lib/behaviors/anchoredPosition.js +205 -234
  251. package/lib/behaviors/focusTrap.js +121 -157
  252. package/lib/behaviors/focusZone.js +434 -509
  253. package/lib/behaviors/scrollIntoViewingArea.js +18 -35
  254. package/lib/constants.js +39 -43
  255. package/lib/drafts.js +20 -30
  256. package/lib/hooks/index.js +16 -60
  257. package/lib/hooks/useAnchoredPosition.js +32 -40
  258. package/lib/hooks/useCombinedRefs.js +32 -36
  259. package/lib/hooks/useDetails.jsx +39 -0
  260. package/lib/hooks/useDialog.js +72 -96
  261. package/lib/hooks/useFocusTrap.js +43 -60
  262. package/lib/hooks/useFocusZone.js +54 -50
  263. package/lib/hooks/useOnEscapePress.js +25 -36
  264. package/lib/hooks/useOnOutsideClick.jsx +61 -0
  265. package/lib/hooks/useOpenAndCloseFocus.js +22 -34
  266. package/lib/hooks/useOverlay.jsx +15 -0
  267. package/lib/hooks/useProvidedRefOrCreate.js +10 -14
  268. package/lib/hooks/useProvidedStateOrCreate.js +13 -16
  269. package/lib/hooks/useRenderForcingRef.js +13 -17
  270. package/lib/hooks/useResizeObserver.js +15 -18
  271. package/lib/hooks/useSafeTimeout.js +22 -30
  272. package/lib/hooks/useScrollFlash.js +16 -23
  273. package/lib/index.d.ts +2 -2
  274. package/lib/index.js +165 -652
  275. package/lib/polyfills/eventListenerSignal.js +37 -45
  276. package/lib/sx.js +10 -22
  277. package/lib/theme-preval.js +64 -3169
  278. package/lib/theme.js +3 -12
  279. package/lib/utils/create-slots.jsx +65 -0
  280. package/lib/utils/deprecate.jsx +59 -0
  281. package/lib/utils/isNumeric.jsx +7 -0
  282. package/lib/utils/iterateFocusableElements.js +63 -85
  283. package/lib/utils/ssr.jsx +6 -0
  284. package/lib/utils/test-deprecations.jsx +20 -0
  285. package/lib/utils/test-helpers.jsx +8 -0
  286. package/lib/utils/test-matchers.jsx +100 -0
  287. package/lib/utils/testing.d.ts +61 -28
  288. package/lib/utils/testing.js +0 -29
  289. package/lib/utils/testing.jsx +206 -0
  290. package/lib/utils/theme.js +33 -47
  291. package/lib/utils/types/AriaRole.js +2 -1
  292. package/lib/utils/types/ComponentProps.js +2 -1
  293. package/lib/utils/types/Flatten.js +2 -1
  294. package/lib/utils/types/KeyPaths.js +2 -1
  295. package/lib/utils/types/MandateProps.js +16 -1
  296. package/lib/utils/types/Merge.js +2 -1
  297. package/lib/utils/types/index.js +16 -69
  298. package/lib/utils/uniqueId.js +5 -8
  299. package/lib/utils/use-force-update.js +8 -14
  300. package/lib/utils/useIsomorphicLayoutEffect.js +8 -11
  301. package/lib/utils/userAgent.js +8 -12
  302. package/lib-esm/ActionList/Item.js +53 -28
  303. package/lib-esm/ActionList2/Group.d.ts +2 -28
  304. package/lib-esm/ActionList2/Group.js +5 -52
  305. package/lib-esm/ActionList2/List.d.ts +1 -1
  306. package/lib-esm/ActionList2/List.js +2 -1
  307. package/lib-esm/Autocomplete/Autocomplete.d.ts +3 -3
  308. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +3 -3
  309. package/lib-esm/Breadcrumbs.d.ts +7 -8
  310. package/lib-esm/Breadcrumbs.js +13 -8
  311. package/lib-esm/Button/Button.d.ts +3 -2
  312. package/lib-esm/Button/Button.js +2 -2
  313. package/lib-esm/Button/ButtonBase.d.ts +8 -5
  314. package/lib-esm/Button/ButtonBase.js +3 -1
  315. package/lib-esm/Button/ButtonClose.d.ts +46 -3
  316. package/lib-esm/Button/ButtonClose.js +2 -2
  317. package/lib-esm/Button/ButtonDanger.d.ts +3 -2
  318. package/lib-esm/Button/ButtonDanger.js +2 -2
  319. package/lib-esm/Button/ButtonInvisible.d.ts +3 -2
  320. package/lib-esm/Button/ButtonInvisible.js +2 -2
  321. package/lib-esm/Button/ButtonOutline.d.ts +3 -2
  322. package/lib-esm/Button/ButtonOutline.js +2 -2
  323. package/lib-esm/Button/ButtonPrimary.d.ts +3 -2
  324. package/lib-esm/Button/ButtonPrimary.js +2 -2
  325. package/lib-esm/Button/ButtonTableList.d.ts +2 -1
  326. package/lib-esm/Button/ButtonTableList.js +2 -2
  327. package/lib-esm/CircleBadge.d.ts +5 -4
  328. package/lib-esm/CircleBadge.js +2 -2
  329. package/lib-esm/CircleOcticon.d.ts +1 -1
  330. package/lib-esm/CounterLabel.d.ts +2 -1
  331. package/lib-esm/CounterLabel.js +2 -2
  332. package/lib-esm/Dialog/Dialog.d.ts +9 -5
  333. package/lib-esm/Dialog/Dialog.js +12 -12
  334. package/lib-esm/Dialog.d.ts +5 -4
  335. package/lib-esm/Dialog.js +2 -2
  336. package/lib-esm/Dropdown.d.ts +99 -10
  337. package/lib-esm/Dropdown.js +4 -4
  338. package/lib-esm/DropdownMenu/DropdownButton.d.ts +47 -3
  339. package/lib-esm/DropdownMenu/DropdownButton.js +1 -3
  340. package/lib-esm/EmojiPicker/EmojiPicker.d.ts +15 -0
  341. package/lib-esm/EmojiPicker/EmojiPicker.js +184 -0
  342. package/lib-esm/EmojiPicker/EmojiPickerAnchor.d.ts +0 -0
  343. package/lib-esm/EmojiPicker/EmojiPickerAnchor.js +0 -0
  344. package/lib-esm/EmojiPicker/EmojiPickerPanel.d.ts +3 -0
  345. package/lib-esm/EmojiPicker/EmojiPickerPanel.js +8 -0
  346. package/lib-esm/EmojiPicker/data.d.ts +9 -0
  347. package/lib-esm/EmojiPicker/data.js +5434 -0
  348. package/lib-esm/EmojiPicker/index.d.ts +2 -0
  349. package/lib-esm/EmojiPicker/index.js +1 -0
  350. package/lib-esm/FilterList.d.ts +303 -264
  351. package/lib-esm/FilterList.js +7 -3
  352. package/lib-esm/FilteredSearch.d.ts +2 -1
  353. package/lib-esm/FilteredSearch.js +2 -2
  354. package/lib-esm/Flash.d.ts +2 -1
  355. package/lib-esm/Flash.js +2 -2
  356. package/lib-esm/FormGroup.d.ts +5 -4
  357. package/lib-esm/FormGroup.js +3 -3
  358. package/lib-esm/Header.d.ts +7 -6
  359. package/lib-esm/Header.js +5 -5
  360. package/lib-esm/Label.d.ts +2 -1
  361. package/lib-esm/Label.js +4 -3
  362. package/lib-esm/LabelGroup.d.ts +2 -1
  363. package/lib-esm/LabelGroup.js +2 -2
  364. package/lib-esm/Link.d.ts +2 -1
  365. package/lib-esm/Link.js +2 -2
  366. package/lib-esm/NewButton/button.js +42 -31
  367. package/lib-esm/Overlay.d.ts +11 -14
  368. package/lib-esm/Overlay.js +3 -2
  369. package/lib-esm/Pagehead.d.ts +2 -1
  370. package/lib-esm/Pagehead.js +2 -2
  371. package/lib-esm/Pagination/Pagination.js +2 -2
  372. package/lib-esm/Popover.d.ts +5 -4
  373. package/lib-esm/Popover.js +5 -4
  374. package/lib-esm/Position.d.ts +4 -4
  375. package/lib-esm/SelectMenu/SelectMenu.d.ts +189 -21
  376. package/lib-esm/SelectMenu/SelectMenu.js +2 -1
  377. package/lib-esm/SelectMenu/SelectMenuDivider.d.ts +2 -1
  378. package/lib-esm/SelectMenu/SelectMenuDivider.js +2 -2
  379. package/lib-esm/SelectMenu/SelectMenuFilter.js +2 -2
  380. package/lib-esm/SelectMenu/SelectMenuFooter.d.ts +2 -1
  381. package/lib-esm/SelectMenu/SelectMenuFooter.js +2 -2
  382. package/lib-esm/SelectMenu/SelectMenuHeader.d.ts +2 -1
  383. package/lib-esm/SelectMenu/SelectMenuHeader.js +2 -2
  384. package/lib-esm/SelectMenu/SelectMenuItem.d.ts +3 -2
  385. package/lib-esm/SelectMenu/SelectMenuItem.js +2 -2
  386. package/lib-esm/SelectMenu/SelectMenuList.d.ts +2 -1
  387. package/lib-esm/SelectMenu/SelectMenuList.js +2 -2
  388. package/lib-esm/SelectMenu/SelectMenuLoadingAnimation.d.ts +2 -2
  389. package/lib-esm/SelectMenu/SelectMenuLoadingAnimation.js +2 -3
  390. package/lib-esm/SelectMenu/SelectMenuModal.d.ts +3 -2
  391. package/lib-esm/SelectMenu/SelectMenuModal.js +2 -2
  392. package/lib-esm/SelectMenu/SelectMenuTab.d.ts +2 -1
  393. package/lib-esm/SelectMenu/SelectMenuTab.js +2 -2
  394. package/lib-esm/SelectMenu/SelectMenuTabPanel.d.ts +2 -1
  395. package/lib-esm/SelectMenu/SelectMenuTabPanel.js +2 -2
  396. package/lib-esm/SelectMenu/SelectMenuTabs.d.ts +2 -1
  397. package/lib-esm/SelectMenu/SelectMenuTabs.js +2 -2
  398. package/lib-esm/SideNav.d.ts +8 -11
  399. package/lib-esm/SideNav.js +16 -8
  400. package/lib-esm/StateLabel.d.ts +2 -1
  401. package/lib-esm/StateLabel.js +6 -7
  402. package/lib-esm/StyledOcticon.d.ts +2 -1
  403. package/lib-esm/StyledOcticon.js +2 -1
  404. package/lib-esm/SubNav.d.ts +11 -5
  405. package/lib-esm/SubNav.js +13 -8
  406. package/lib-esm/TabNav.d.ts +4 -3
  407. package/lib-esm/TabNav.js +3 -3
  408. package/lib-esm/TextInputWithTokens.d.ts +3 -3
  409. package/lib-esm/Timeline.d.ts +393 -19
  410. package/lib-esm/Timeline.js +13 -12
  411. package/lib-esm/Token/Token.d.ts +1 -1
  412. package/lib-esm/Tooltip.d.ts +2 -1
  413. package/lib-esm/Tooltip.js +2 -2
  414. package/lib-esm/Truncate.d.ts +2 -1
  415. package/lib-esm/Truncate.js +2 -1
  416. package/lib-esm/UnderlineNav.d.ts +3 -2
  417. package/lib-esm/UnderlineNav.js +3 -3
  418. package/lib-esm/index.d.ts +2 -2
  419. package/lib-esm/index.js +1 -1
  420. package/lib-esm/theme-preval.js +366 -512
  421. package/lib-esm/utils/testing.d.ts +61 -28
  422. package/lib-esm/utils/testing.js +0 -24
  423. package/package.json +5 -4
  424. package/lib/Checkbox.d.ts +0 -29
  425. package/lib/Checkbox.js +0 -64
  426. package/lib-esm/Checkbox.d.ts +0 -29
  427. package/lib-esm/Checkbox.js +0 -44
@@ -9,6 +9,8 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _styledComponents = _interopRequireDefault(require("styled-components"));
11
11
 
12
+ var _constants = require("../constants");
13
+
12
14
  var _sx = _interopRequireDefault(require("../sx"));
13
15
 
14
16
  var _useKeyboardNav = _interopRequireDefault(require("./hooks/useKeyboardNav"));
@@ -63,7 +65,7 @@ const wrapperStyles = `
63
65
  const StyledSelectMenu = _styledComponents.default.details.withConfig({
64
66
  displayName: "SelectMenu__StyledSelectMenu",
65
67
  componentId: "i7h45b-0"
66
- })(["", " ", ";"], wrapperStyles, _sx.default);
68
+ })(["", " ", " ", ";"], wrapperStyles, _constants.COMMON, _sx.default);
67
69
 
68
70
  // 'as' is spread out because we don't want users to be able to change the tag.
69
71
  const SelectMenu = /*#__PURE__*/_react.default.forwardRef(({
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const react_1 = __importStar(require("react"));
26
+ const styled_components_1 = __importDefault(require("styled-components"));
27
+ const constants_1 = require("../constants");
28
+ const sx_1 = __importDefault(require("../sx"));
29
+ const useKeyboardNav_1 = __importDefault(require("./hooks/useKeyboardNav"));
30
+ const SelectMenuContext_1 = require("./SelectMenuContext");
31
+ const SelectMenuDivider_1 = __importDefault(require("./SelectMenuDivider"));
32
+ const SelectMenuFilter_1 = __importDefault(require("./SelectMenuFilter"));
33
+ const SelectMenuFooter_1 = __importDefault(require("./SelectMenuFooter"));
34
+ const SelectMenuHeader_1 = __importDefault(require("./SelectMenuHeader"));
35
+ const SelectMenuItem_1 = __importDefault(require("./SelectMenuItem"));
36
+ const SelectMenuList_1 = __importDefault(require("./SelectMenuList"));
37
+ const SelectMenuLoadingAnimation_1 = __importDefault(require("./SelectMenuLoadingAnimation"));
38
+ const SelectMenuModal_1 = __importDefault(require("./SelectMenuModal"));
39
+ const SelectMenuTab_1 = __importDefault(require("./SelectMenuTab"));
40
+ const SelectMenuTabPanel_1 = __importDefault(require("./SelectMenuTabPanel"));
41
+ const SelectMenuTabs_1 = __importDefault(require("./SelectMenuTabs"));
42
+ const wrapperStyles = `
43
+ // Remove marker added by the display: list-item browser default
44
+ > summary {
45
+ list-style: none;
46
+ }
47
+ // Remove marker added by details polyfill
48
+ > summary::before {
49
+ display: none;
50
+ }
51
+ // Remove marker added by Chrome
52
+ > summary::-webkit-details-marker {
53
+ display: none;
54
+ }
55
+ `;
56
+ const StyledSelectMenu = styled_components_1.default.details `
57
+ ${wrapperStyles}
58
+ ${constants_1.COMMON}
59
+ ${sx_1.default};
60
+ `;
61
+ // 'as' is spread out because we don't want users to be able to change the tag.
62
+ const SelectMenu = react_1.default.forwardRef(({ children, initialTab = '', as: _ignoredAs, ...rest }, forwardedRef) => {
63
+ const backupRef = react_1.useRef(null);
64
+ const ref = forwardedRef ?? backupRef;
65
+ const [selectedTab, setSelectedTab] = react_1.useState(initialTab);
66
+ const [open, setOpen] = react_1.useState(false);
67
+ const menuProviderValues = {
68
+ selectedTab,
69
+ setSelectedTab,
70
+ setOpen,
71
+ open,
72
+ initialTab
73
+ };
74
+ const onClickOutside = react_1.useCallback(event => {
75
+ if ('current' in ref && ref.current && !ref.current.contains(event.target)) {
76
+ if (!event.defaultPrevented) {
77
+ setOpen(false);
78
+ }
79
+ }
80
+ }, [ref, setOpen]);
81
+ // handles the overlay behavior - closing the menu when clicking outside of it
82
+ react_1.useEffect(() => {
83
+ if (open) {
84
+ document.addEventListener('click', onClickOutside);
85
+ return () => {
86
+ document.removeEventListener('click', onClickOutside);
87
+ };
88
+ }
89
+ }, [open, onClickOutside]);
90
+ function toggle(event) {
91
+ setOpen(event.target.open);
92
+ }
93
+ useKeyboardNav_1.default(ref, open, setOpen);
94
+ return (<SelectMenuContext_1.MenuContext.Provider value={menuProviderValues}>
95
+ <StyledSelectMenu ref={ref} {...rest} open={open} onToggle={toggle}>
96
+ {children}
97
+ </StyledSelectMenu>
98
+ </SelectMenuContext_1.MenuContext.Provider>);
99
+ });
100
+ SelectMenu.displayName = 'SelectMenu';
101
+ exports.default = Object.assign(SelectMenu, {
102
+ MenuContext: SelectMenuContext_1.MenuContext,
103
+ List: SelectMenuList_1.default,
104
+ Divider: SelectMenuDivider_1.default,
105
+ Filter: SelectMenuFilter_1.default,
106
+ Footer: SelectMenuFooter_1.default,
107
+ Item: SelectMenuItem_1.default,
108
+ Modal: SelectMenuModal_1.default,
109
+ Tabs: SelectMenuTabs_1.default,
110
+ Tab: SelectMenuTab_1.default,
111
+ TabPanel: SelectMenuTabPanel_1.default,
112
+ Header: SelectMenuHeader_1.default,
113
+ LoadingAnimation: SelectMenuLoadingAnimation_1.default
114
+ });
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MenuContext = void 0;
4
+ const react_1 = require("react");
5
+ exports.MenuContext = react_1.createContext({});
@@ -1,5 +1,6 @@
1
+ import { SystemCommonProps } from '../constants';
1
2
  import { SxProp } from '../sx';
2
3
  import { ComponentProps } from '../utils/types';
3
- declare const SelectMenuDivider: import("styled-components").StyledComponent<"div", any, SxProp, never>;
4
+ declare const SelectMenuDivider: import("styled-components").StyledComponent<"div", any, SystemCommonProps & SxProp, never>;
4
5
  export declare type SelectMenuDividerProps = ComponentProps<typeof SelectMenuDivider>;
5
6
  export default SelectMenuDivider;
@@ -22,7 +22,7 @@ const dividerStyles = (0, _styledComponents.css)(["padding:", " ", ";margin:0;fo
22
22
  const SelectMenuDivider = _styledComponents.default.div.withConfig({
23
23
  displayName: "SelectMenuDivider",
24
24
  componentId: "sc-2p0bwt-0"
25
- })(["", " ", ";"], dividerStyles, _sx.default);
25
+ })(["", " ", " ", ";"], dividerStyles, _constants.COMMON, _sx.default);
26
26
 
27
27
  SelectMenuDivider.displayName = 'SelectMenu.Divider';
28
28
  var _default = SelectMenuDivider;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const styled_components_1 = __importStar(require("styled-components"));
26
+ const constants_1 = require("../constants");
27
+ const sx_1 = __importDefault(require("../sx"));
28
+ const dividerStyles = styled_components_1.css `
29
+ padding: ${constants_1.get('space.1')} ${constants_1.get('space.3')};
30
+ margin: 0;
31
+ font-size: ${constants_1.get('fontSizes.0')};
32
+ font-weight: ${constants_1.get('fontWeights.bold')};
33
+ color: ${constants_1.get('colors.fg.muted')};
34
+ background-color: ${constants_1.get('colors.canvas.subtle')};
35
+ border-bottom: ${constants_1.get('borderWidths.1')} solid ${constants_1.get('colors.border.muted')};
36
+ `;
37
+ const SelectMenuDivider = styled_components_1.default.div `
38
+ ${dividerStyles}
39
+ ${constants_1.COMMON}
40
+ ${sx_1.default};
41
+ `;
42
+ SelectMenuDivider.displayName = 'SelectMenu.Divider';
43
+ exports.default = SelectMenuDivider;
@@ -28,7 +28,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
28
28
  const StyledForm = _styledComponents.default.form.withConfig({
29
29
  displayName: "SelectMenuFilter__StyledForm",
30
30
  componentId: "s7ktlh-0"
31
- })(["padding:", ";margin:0;border-bottom:", " solid ", ";background-color:", ";@media (min-width:", "){padding:", ";}", ";"], (0, _constants.get)('space.3'), (0, _constants.get)('borderWidths.1'), (0, _constants.get)('colors.border.muted'), (0, _constants.get)('colors.canvas.overlay'), (0, _constants.get)('breakpoints.0'), (0, _constants.get)('space.2'), _sx.default);
31
+ })(["padding:", ";margin:0;border-bottom:", " solid ", ";background-color:", ";", ";@media (min-width:", "){padding:", ";}", ";"], (0, _constants.get)('space.3'), (0, _constants.get)('borderWidths.1'), (0, _constants.get)('colors.border.muted'), (0, _constants.get)('colors.canvas.overlay'), _constants.COMMON, (0, _constants.get)('breakpoints.0'), (0, _constants.get)('space.2'), _sx.default);
32
32
 
33
33
  const SelectMenuFilter = /*#__PURE__*/(0, _react.forwardRef)(({
34
34
  theme,
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const react_1 = __importStar(require("react"));
26
+ const styled_components_1 = __importDefault(require("styled-components"));
27
+ const constants_1 = require("../constants");
28
+ const sx_1 = __importDefault(require("../sx"));
29
+ const TextInput_1 = __importDefault(require("../TextInput"));
30
+ const SelectMenuContext_1 = require("./SelectMenuContext");
31
+ const StyledForm = styled_components_1.default.form `
32
+ padding: ${constants_1.get('space.3')};
33
+ margin: 0;
34
+ border-bottom: ${constants_1.get('borderWidths.1')} solid ${constants_1.get('colors.border.muted')};
35
+ background-color: ${constants_1.get('colors.canvas.overlay')};
36
+ ${constants_1.COMMON};
37
+
38
+ @media (min-width: ${constants_1.get('breakpoints.0')}) {
39
+ padding: ${constants_1.get('space.2')};
40
+ }
41
+
42
+ ${sx_1.default};
43
+ `;
44
+ const SelectMenuFilter = react_1.forwardRef(({ theme, value, sx: sxProp, ...rest }, forwardedRef) => {
45
+ const inputRef = react_1.useRef(null);
46
+ const ref = forwardedRef ?? inputRef;
47
+ const { open } = react_1.useContext(SelectMenuContext_1.MenuContext);
48
+ // puts focus on the filter input when the menu is opened
49
+ react_1.useEffect(() => {
50
+ if (open) {
51
+ inputRef.current?.focus();
52
+ }
53
+ }, [open]);
54
+ return (<StyledForm theme={theme} sx={sxProp}>
55
+ <TextInput_1.default theme={theme} ref={ref} width="100%" block value={value} contrast {...rest}/>
56
+ </StyledForm>);
57
+ });
58
+ SelectMenuFilter.displayName = 'SelectMenu.Filter';
59
+ exports.default = SelectMenuFilter;
@@ -1,5 +1,6 @@
1
+ import { SystemCommonProps } from '../constants';
1
2
  import { SxProp } from '../sx';
2
3
  import { ComponentProps } from '../utils/types';
3
- declare const SelectMenuFooter: import("styled-components").StyledComponent<"footer", any, SxProp, never>;
4
+ declare const SelectMenuFooter: import("styled-components").StyledComponent<"footer", any, SystemCommonProps & SxProp, never>;
4
5
  export declare type SelectMenuFooterProps = ComponentProps<typeof SelectMenuFooter>;
5
6
  export default SelectMenuFooter;
@@ -22,7 +22,7 @@ const footerStyles = (0, _styledComponents.css)(["margin-top:-1px;padding:", " "
22
22
  const SelectMenuFooter = _styledComponents.default.footer.withConfig({
23
23
  displayName: "SelectMenuFooter",
24
24
  componentId: "rkvco1-0"
25
- })(["", " ", ";"], footerStyles, _sx.default);
25
+ })(["", " ", " ", ";"], footerStyles, _constants.COMMON, _sx.default);
26
26
 
27
27
  SelectMenuFooter.displayName = 'SelectMenu.Footer';
28
28
  var _default = SelectMenuFooter;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const styled_components_1 = __importStar(require("styled-components"));
26
+ const constants_1 = require("../constants");
27
+ const sx_1 = __importDefault(require("../sx"));
28
+ const footerStyles = styled_components_1.css `
29
+ margin-top: -1px;
30
+ padding: ${constants_1.get('space.2')} ${constants_1.get('space.3')};
31
+ font-size: ${constants_1.get('fontSizes.0')};
32
+ color: ${constants_1.get('colors.fg.muted')};
33
+ text-align: center;
34
+ border-top: ${constants_1.get('borderWidths.1')} solid ${constants_1.get('colors.border.muted')};
35
+
36
+ @media (min-width: ${constants_1.get('breakpoints.0')}) {
37
+ padding: ${constants_1.get('space.1')} ${constants_1.get('space.2')};
38
+ }
39
+ `;
40
+ const SelectMenuFooter = styled_components_1.default.footer `
41
+ ${footerStyles}
42
+ ${constants_1.COMMON}
43
+ ${sx_1.default};
44
+ `;
45
+ SelectMenuFooter.displayName = 'SelectMenu.Footer';
46
+ exports.default = SelectMenuFooter;
@@ -1,7 +1,8 @@
1
1
  /// <reference types="react" />
2
+ import { SystemCommonProps, SystemTypographyProps } from '../constants';
2
3
  import { SxProp } from '../sx';
3
4
  import { ComponentProps } from '../utils/types';
4
- declare const StyledHeader: import("styled-components").StyledComponent<"header", any, SxProp, never>;
5
+ declare const StyledHeader: import("styled-components").StyledComponent<"header", any, SystemTypographyProps & SystemCommonProps & SxProp, never>;
5
6
  export declare type SelectMenuHeaderProps = ComponentProps<typeof StyledHeader>;
6
7
  declare const SelectMenuHeader: {
7
8
  ({ children, theme, ...rest }: SelectMenuHeaderProps): JSX.Element;
@@ -27,7 +27,7 @@ const SelectMenuTitle = _styledComponents.default.h3.withConfig({
27
27
  const StyledHeader = _styledComponents.default.header.withConfig({
28
28
  displayName: "SelectMenuHeader__StyledHeader",
29
29
  componentId: "sc-1pwppzc-1"
30
- })(["display:flex;flex:none;padding:", ";border-bottom:", " solid ", ";@media (min-width:", "){padding-top:", ";padding-bottom:", ";}", ";"], (0, _constants.get)('space.3'), (0, _constants.get)('borderWidths'), (0, _constants.get)('colors.border.muted'), (0, _constants.get)('breakpoints.0'), (0, _constants.get)('space.2'), (0, _constants.get)('space.2'), _sx.default);
30
+ })(["display:flex;flex:none;padding:", ";border-bottom:", " solid ", ";", " ", " @media (min-width:", "){padding-top:", ";padding-bottom:", ";}", ";"], (0, _constants.get)('space.3'), (0, _constants.get)('borderWidths'), (0, _constants.get)('colors.border.muted'), _constants.COMMON, _constants.TYPOGRAPHY, (0, _constants.get)('breakpoints.0'), (0, _constants.get)('space.2'), (0, _constants.get)('space.2'), _sx.default);
31
31
 
32
32
  const SelectMenuHeader = ({
33
33
  children,
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const styled_components_1 = __importDefault(require("styled-components"));
8
+ const constants_1 = require("../constants");
9
+ const sx_1 = __importDefault(require("../sx"));
10
+ // SelectMenu.Header is intentionally not exported, it's an internal component used in
11
+ // SelectMenu.Modal
12
+ const SelectMenuTitle = styled_components_1.default.h3 `
13
+ color: ${constants_1.get('colors.fg.default')};
14
+ flex: auto;
15
+ font-size: ${constants_1.get('fontSizes.1')};
16
+ font-weight: ${constants_1.get('fontWeights.bold')};
17
+ margin: 0;
18
+
19
+ @media (min-width: ${constants_1.get('breakpoints.0')}) {
20
+ font-size: inherit;
21
+ }
22
+ `;
23
+ const StyledHeader = styled_components_1.default.header `
24
+ display: flex;
25
+ flex: none; // fixes header from getting squeezed in Safari iOS
26
+ padding: ${constants_1.get('space.3')};
27
+ border-bottom: ${constants_1.get('borderWidths')} solid ${constants_1.get('colors.border.muted')};
28
+ ${constants_1.COMMON}
29
+ ${constants_1.TYPOGRAPHY}
30
+
31
+ @media (min-width: ${constants_1.get('breakpoints.0')}) {
32
+ padding-top: ${constants_1.get('space.2')};
33
+ padding-bottom: ${constants_1.get('space.2')};
34
+ }
35
+
36
+ ${sx_1.default};
37
+ `;
38
+ const SelectMenuHeader = ({ children, theme, ...rest }) => {
39
+ return (<StyledHeader theme={theme} {...rest}>
40
+ <SelectMenuTitle theme={theme}>{children}</SelectMenuTitle>
41
+ </StyledHeader>);
42
+ };
43
+ SelectMenuHeader.displayName = 'SelectMenu.Header';
44
+ exports.default = SelectMenuHeader;
@@ -1,14 +1,15 @@
1
1
  import React from 'react';
2
+ import { SystemCommonProps } from '../constants';
2
3
  import { SxProp } from '../sx';
3
4
  import { ComponentProps } from '../utils/types';
4
5
  export declare const listItemStyles: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<any>>;
5
6
  declare const StyledItem: import("styled-components").StyledComponent<"a", any, {
6
7
  role: "menuitemcheckbox";
7
- } & SxProp, "role">;
8
+ } & SystemCommonProps & SxProp, "role">;
8
9
  declare type SelectMenuItemInteralProps = {
9
10
  as?: React.ElementType;
10
11
  selected?: boolean;
11
12
  } & ComponentProps<typeof StyledItem>;
12
- declare const SelectMenuItem: React.ForwardRefExoticComponent<Pick<SelectMenuItemInteralProps, "color" | "translate" | "hidden" | "children" | "theme" | "slot" | "style" | "title" | "role" | "sx" | "type" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "as" | "selected" | "download" | "href" | "hrefLang" | "media" | "ping" | "rel" | "target" | "referrerPolicy"> & React.RefAttributes<HTMLAnchorElement>>;
13
+ declare const SelectMenuItem: React.ForwardRefExoticComponent<Pick<SelectMenuItemInteralProps, "translate" | "hidden" | "children" | "theme" | "slot" | "style" | "title" | "sx" | "role" | "type" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "as" | "selected" | "download" | "href" | "hrefLang" | "media" | "ping" | "rel" | "target" | "referrerPolicy" | keyof SystemCommonProps> & React.RefAttributes<HTMLAnchorElement>>;
13
14
  export declare type SelectMenuItemProps = ComponentProps<typeof SelectMenuItem>;
14
15
  export default SelectMenuItem;
@@ -35,7 +35,7 @@ const StyledItem = _styledComponents.default.a.attrs(() => ({
35
35
  })).withConfig({
36
36
  displayName: "SelectMenuItem__StyledItem",
37
37
  componentId: "gjymba-0"
38
- })(["", " ", ";"], listItemStyles, _sx.default);
38
+ })(["", " ", " ", ";"], listItemStyles, _constants.COMMON, _sx.default);
39
39
 
40
40
  const SelectMenuItem = /*#__PURE__*/(0, _react.forwardRef)(({
41
41
  children,
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.listItemStyles = void 0;
26
+ const octicons_react_1 = require("@primer/octicons-react");
27
+ const react_1 = __importStar(require("react"));
28
+ const styled_components_1 = __importStar(require("styled-components"));
29
+ const constants_1 = require("../constants");
30
+ const StyledOcticon_1 = __importDefault(require("../StyledOcticon"));
31
+ const sx_1 = __importDefault(require("../sx"));
32
+ const SelectMenuContext_1 = require("./SelectMenuContext");
33
+ exports.listItemStyles = styled_components_1.css `
34
+ display: flex;
35
+ align-items: center;
36
+ padding: ${constants_1.get('space.3')};
37
+ overflow: hidden;
38
+ text-align: left;
39
+ cursor: pointer;
40
+ background-color: ${constants_1.get('colors.canvas.overlay')};
41
+ border: 0;
42
+ border-bottom: ${constants_1.get('borderWidths.1')} solid ${constants_1.get('colors.border.muted')};
43
+ color: ${constants_1.get('colors.fg.muted')};
44
+ text-decoration: none;
45
+ font-size: ${constants_1.get('fontSizes.0')};
46
+ font-family: inherit; // needed if user uses a "button" tag
47
+ width: 100%;
48
+
49
+ &:hover {
50
+ text-decoration: none;
51
+ }
52
+ &:focus {
53
+ outline: none;
54
+ }
55
+
56
+ &[hidden] {
57
+ display: none !important;
58
+ }
59
+
60
+ @media (min-width: ${constants_1.get('breakpoints.0')}) {
61
+ padding-top: ${constants_1.get('space.2')};
62
+ padding-bottom: ${constants_1.get('space.2')};
63
+ }
64
+
65
+ .SelectMenu-icon {
66
+ width: ${constants_1.get('space.3')};
67
+ margin-right: ${constants_1.get('space.2')};
68
+ flex-shrink: 0;
69
+ }
70
+
71
+ .SelectMenu-selected-icon {
72
+ visibility: hidden;
73
+ transition: transform 0.12s cubic-bezier(0.5, 0.1, 1, 0.5), visibility 0s 0.12s linear;
74
+ transform: scale(0);
75
+ }
76
+
77
+ // selected items
78
+ &[aria-checked='true'] {
79
+ font-weight: 500;
80
+ color: ${constants_1.get('colors.fg.default')};
81
+
82
+ .SelectMenu-selected-icon {
83
+ visibility: visible;
84
+ transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1), visibility 0s linear;
85
+ transform: scale(1);
86
+ }
87
+ }
88
+
89
+ // can hover states
90
+ @media (hover: hover) {
91
+ &:hover,
92
+ &:active,
93
+ &:focus {
94
+ background-color: ${constants_1.get('colors.neutral.subtle')};
95
+ }
96
+ }
97
+
98
+ // Can not hover states
99
+ //
100
+ // For touch input
101
+
102
+ @media (hover: none) {
103
+ // Android
104
+ &:focus,
105
+ &:active {
106
+ background-color: ${constants_1.get('colors.canvas.subtle')};
107
+ }
108
+
109
+ // iOS Safari
110
+ // :active would work if ontouchstart is added to the button
111
+ // Instead this tweaks the "native" highlight color
112
+ -webkit-tap-highlight-color: ${constants_1.get('colors.selectMenu.tapHighlight')};
113
+ }
114
+ `;
115
+ const StyledItem = styled_components_1.default.a.attrs(() => ({
116
+ role: 'menuitemcheckbox'
117
+ })) `
118
+ ${exports.listItemStyles}
119
+ ${constants_1.COMMON}
120
+ ${sx_1.default};
121
+ `;
122
+ const SelectMenuItem = react_1.forwardRef(({ children, selected, theme, onClick, ...rest }, forwardedRef) => {
123
+ const menuContext = react_1.useContext(SelectMenuContext_1.MenuContext);
124
+ const backupRef = react_1.useRef(null);
125
+ const itemRef = forwardedRef ?? backupRef;
126
+ // close the menu when an item is clicked
127
+ // this can be overriden if the user provides a `onClick` prop and prevents default in it
128
+ const handleClick = (e) => {
129
+ onClick && onClick(e);
130
+ if (!e.defaultPrevented) {
131
+ menuContext.setOpen?.(false);
132
+ }
133
+ };
134
+ return (<StyledItem ref={itemRef} {...rest} theme={theme} onClick={handleClick} aria-checked={selected}>
135
+ <StyledOcticon_1.default theme={theme} className="SelectMenu-icon SelectMenu-selected-icon" icon={octicons_react_1.CheckIcon}/>
136
+ {children}
137
+ </StyledItem>);
138
+ });
139
+ SelectMenuItem.defaultProps = {
140
+ selected: false
141
+ };
142
+ SelectMenuItem.displayName = 'SelectMenu.Item';
143
+ exports.default = SelectMenuItem;
@@ -1,5 +1,6 @@
1
+ import { SystemCommonProps } from '../constants';
1
2
  import { SxProp } from '../sx';
2
3
  import { ComponentProps } from '../utils/types';
3
- declare const SelectMenuList: import("styled-components").StyledComponent<"div", any, SxProp, never>;
4
+ declare const SelectMenuList: import("styled-components").StyledComponent<"div", any, SystemCommonProps & SxProp, never>;
4
5
  export declare type SelectMenuListProps = ComponentProps<typeof SelectMenuList>;
5
6
  export default SelectMenuList;
@@ -22,7 +22,7 @@ const listStyles = (0, _styledComponents.css)(["position:relative;padding:0;marg
22
22
  const SelectMenuList = _styledComponents.default.div.withConfig({
23
23
  displayName: "SelectMenuList",
24
24
  componentId: "sc-1opbpf6-0"
25
- })(["", " ", ";"], listStyles, _sx.default);
25
+ })(["", " ", " ", ";"], listStyles, _constants.COMMON, _sx.default);
26
26
 
27
27
  SelectMenuList.displayName = 'SelectMenu.List';
28
28
  var _default = SelectMenuList;