@primer/components 32.1.1-rc.b4502a34 → 33.0.0-rc.956a1af6

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 (240) hide show
  1. package/.devcontainer/devcontainer.json +1 -1
  2. package/.github/workflows/ci.yml +1 -1
  3. package/.github/workflows/release.yml +1 -1
  4. package/.github/workflows/release_canary.yml +1 -1
  5. package/.github/workflows/release_candidate.yml +1 -1
  6. package/.github/workflows/statuses.yml +32 -0
  7. package/.gitignore +1 -0
  8. package/.nvmrc +1 -1
  9. package/CHANGELOG.md +17 -1
  10. package/contributor-docs/CONTRIBUTING.md +14 -58
  11. package/dist/browser.esm.js +2 -2213
  12. package/dist/browser.esm.js.map +1 -1
  13. package/dist/browser.umd.js +2 -2213
  14. package/dist/browser.umd.js.map +1 -1
  15. package/docs/content/BranchName.md +6 -5
  16. package/docs/content/Details.md +4 -8
  17. package/docs/content/Heading.md +5 -10
  18. package/docs/content/Label.md +6 -7
  19. package/docs/content/ProgressBar.mdx +7 -6
  20. package/docs/content/Text.md +0 -6
  21. package/docs/content/{ActionList2.mdx → drafts/ActionList2.mdx} +5 -9
  22. package/docs/content/drafts/ActionMenu2.mdx +251 -0
  23. package/docs/content/status.mdx +1 -1
  24. package/docs/content/system-props.mdx +1 -1
  25. package/docs/src/@primer/gatsby-theme-doctocat/live-code-scope.js +9 -1
  26. package/docs/src/@primer/gatsby-theme-doctocat/nav.yml +1 -1
  27. package/docs/src/component-checklist.js +10 -2
  28. package/lib/ActionList/Header.js +1 -1
  29. package/lib/ActionList/Item.js +10 -10
  30. package/lib/ActionList/List.js +1 -1
  31. package/lib/ActionList2/Divider.d.ts +3 -2
  32. package/lib/ActionList2/Divider.js +10 -5
  33. package/lib/ActionList2/Item.js +22 -6
  34. package/lib/ActionList2/List.js +12 -2
  35. package/lib/ActionList2/MenuContext.d.ts +10 -0
  36. package/lib/ActionList2/MenuContext.js +15 -0
  37. package/lib/ActionList2/Selection.js +11 -0
  38. package/lib/ActionList2/index.d.ts +1 -2
  39. package/lib/ActionMenu2.d.ts +313 -0
  40. package/lib/ActionMenu2.js +91 -0
  41. package/lib/Autocomplete/Autocomplete.d.ts +2 -1
  42. package/lib/Autocomplete/AutocompleteInput.d.ts +2 -1
  43. package/lib/Avatar.d.ts +1 -2
  44. package/lib/Avatar.js +1 -1
  45. package/lib/BaseStyles.js +2 -20
  46. package/lib/BorderBox.js +1 -1
  47. package/lib/Box.js +1 -1
  48. package/lib/BranchName.d.ts +1 -2
  49. package/lib/BranchName.js +1 -1
  50. package/lib/Breadcrumbs.js +3 -3
  51. package/lib/Button/Button.d.ts +2 -2
  52. package/lib/Button/Button.js +1 -1
  53. package/lib/Button/ButtonClose.d.ts +2 -2
  54. package/lib/Button/ButtonDanger.d.ts +2 -2
  55. package/lib/Button/ButtonGroup.js +1 -1
  56. package/lib/Button/ButtonInvisible.d.ts +2 -2
  57. package/lib/Button/ButtonOutline.d.ts +2 -2
  58. package/lib/Button/ButtonPrimary.d.ts +2 -2
  59. package/lib/Checkbox.js +1 -1
  60. package/lib/CircleOcticon.d.ts +35 -35
  61. package/lib/Details.d.ts +1 -2
  62. package/lib/Details.js +2 -4
  63. package/lib/Dialog.d.ts +37 -37
  64. package/lib/Dropdown.d.ts +8 -72
  65. package/lib/DropdownMenu/DropdownButton.d.ts +6 -3
  66. package/lib/FilterList.d.ts +1 -1
  67. package/lib/FilteredActionList/FilteredActionList.js +1 -1
  68. package/lib/Flex.js +1 -1
  69. package/lib/Heading.d.ts +1 -2
  70. package/lib/Heading.js +1 -6
  71. package/lib/LabelGroup.js +1 -1
  72. package/lib/Overlay.js +1 -1
  73. package/lib/Pagination/Pagination.js +2 -2
  74. package/lib/Position.d.ts +4 -4
  75. package/lib/Position.js +1 -1
  76. package/lib/ProgressBar.d.ts +16 -11
  77. package/lib/ProgressBar.js +6 -10
  78. package/lib/SelectMenu/SelectMenu.d.ts +11 -10
  79. package/lib/SelectMenu/SelectMenu.js +1 -1
  80. package/lib/SelectMenu/SelectMenuFilter.js +1 -1
  81. package/lib/SelectMenu/SelectMenuFooter.js +1 -1
  82. package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
  83. package/lib/SelectMenu/SelectMenuItem.js +1 -1
  84. package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
  85. package/lib/SelectMenu/SelectMenuTab.js +1 -1
  86. package/lib/SelectMenu/SelectMenuTabPanel.js +1 -1
  87. package/lib/SelectMenu/SelectMenuTabs.js +1 -1
  88. package/lib/Spinner.d.ts +1 -2
  89. package/lib/Spinner.js +1 -3
  90. package/lib/StateLabel.js +1 -1
  91. package/lib/StyledOcticon.js +1 -1
  92. package/lib/SubNav.js +3 -3
  93. package/lib/TextInputWithTokens.d.ts +2 -1
  94. package/lib/Timeline.js +4 -4
  95. package/lib/Token/AvatarToken.d.ts +1 -1
  96. package/lib/Token/AvatarToken.js +1 -1
  97. package/lib/Token/IssueLabelToken.d.ts +1 -1
  98. package/lib/Token/Token.d.ts +1 -1
  99. package/lib/Token/TokenBase.js +1 -1
  100. package/lib/Tooltip.js +1 -1
  101. package/lib/UnderlineNav.js +2 -2
  102. package/lib/__tests__/Avatar.test.js +4 -2
  103. package/lib/__tests__/Avatar.types.test.d.ts +3 -0
  104. package/lib/__tests__/Avatar.types.test.js +31 -0
  105. package/lib/__tests__/BranchName.types.test.d.ts +3 -0
  106. package/lib/__tests__/BranchName.types.test.js +28 -0
  107. package/lib/__tests__/Details.types.test.d.ts +3 -0
  108. package/lib/__tests__/Details.types.test.js +28 -0
  109. package/lib/__tests__/Heading.test.js +63 -30
  110. package/lib/__tests__/Heading.types.test.d.ts +3 -0
  111. package/lib/__tests__/Heading.types.test.js +28 -0
  112. package/lib/drafts.d.ts +1 -0
  113. package/lib/drafts.js +13 -0
  114. package/lib/stories/ActionList.stories.js +3 -3
  115. package/lib/stories/ActionList2.stories.js +1 -1
  116. package/lib/stories/ActionMenu2.stories.js +433 -0
  117. package/lib/stories/Checkbox.stories.js +2 -2
  118. package/lib/stories/ThemeProvider.stories.js +1 -5
  119. package/lib/stories/useFocusTrap.stories.js +1 -11
  120. package/lib/stories/useFocusZone.stories.js +2 -6
  121. package/lib-esm/ActionList/Header.js +1 -1
  122. package/lib-esm/ActionList/Item.js +10 -10
  123. package/lib-esm/ActionList/List.js +1 -1
  124. package/lib-esm/ActionList2/Divider.d.ts +3 -2
  125. package/lib-esm/ActionList2/Divider.js +8 -5
  126. package/lib-esm/ActionList2/Item.js +20 -6
  127. package/lib-esm/ActionList2/List.js +10 -2
  128. package/lib-esm/ActionList2/MenuContext.d.ts +10 -0
  129. package/lib-esm/ActionList2/MenuContext.js +3 -0
  130. package/lib-esm/ActionList2/Selection.js +9 -0
  131. package/lib-esm/ActionList2/index.d.ts +1 -2
  132. package/lib-esm/ActionMenu2.d.ts +313 -0
  133. package/lib-esm/ActionMenu2.js +67 -0
  134. package/lib-esm/Autocomplete/Autocomplete.d.ts +2 -1
  135. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +2 -1
  136. package/lib-esm/Avatar.d.ts +1 -2
  137. package/lib-esm/Avatar.js +2 -2
  138. package/lib-esm/BaseStyles.js +2 -20
  139. package/lib-esm/BorderBox.js +1 -1
  140. package/lib-esm/Box.js +1 -1
  141. package/lib-esm/BranchName.d.ts +1 -2
  142. package/lib-esm/BranchName.js +2 -2
  143. package/lib-esm/Breadcrumbs.js +3 -3
  144. package/lib-esm/Button/Button.d.ts +2 -2
  145. package/lib-esm/Button/Button.js +1 -1
  146. package/lib-esm/Button/ButtonClose.d.ts +2 -2
  147. package/lib-esm/Button/ButtonDanger.d.ts +2 -2
  148. package/lib-esm/Button/ButtonGroup.js +1 -1
  149. package/lib-esm/Button/ButtonInvisible.d.ts +2 -2
  150. package/lib-esm/Button/ButtonOutline.d.ts +2 -2
  151. package/lib-esm/Button/ButtonPrimary.d.ts +2 -2
  152. package/lib-esm/Checkbox.js +1 -1
  153. package/lib-esm/CircleOcticon.d.ts +35 -35
  154. package/lib-esm/Details.d.ts +1 -2
  155. package/lib-esm/Details.js +2 -3
  156. package/lib-esm/Dialog.d.ts +37 -37
  157. package/lib-esm/Dropdown.d.ts +8 -72
  158. package/lib-esm/DropdownMenu/DropdownButton.d.ts +6 -3
  159. package/lib-esm/FilterList.d.ts +1 -1
  160. package/lib-esm/FilteredActionList/FilteredActionList.js +1 -1
  161. package/lib-esm/Flex.js +1 -1
  162. package/lib-esm/Heading.d.ts +1 -2
  163. package/lib-esm/Heading.js +2 -6
  164. package/lib-esm/LabelGroup.js +1 -1
  165. package/lib-esm/Overlay.js +1 -1
  166. package/lib-esm/Pagination/Pagination.js +2 -2
  167. package/lib-esm/Position.d.ts +4 -4
  168. package/lib-esm/Position.js +1 -1
  169. package/lib-esm/ProgressBar.d.ts +16 -11
  170. package/lib-esm/ProgressBar.js +7 -11
  171. package/lib-esm/SelectMenu/SelectMenu.d.ts +11 -10
  172. package/lib-esm/SelectMenu/SelectMenu.js +1 -1
  173. package/lib-esm/SelectMenu/SelectMenuFilter.js +1 -1
  174. package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
  175. package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
  176. package/lib-esm/SelectMenu/SelectMenuItem.js +1 -1
  177. package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
  178. package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
  179. package/lib-esm/SelectMenu/SelectMenuTabPanel.js +1 -1
  180. package/lib-esm/SelectMenu/SelectMenuTabs.js +1 -1
  181. package/lib-esm/Spinner.d.ts +1 -2
  182. package/lib-esm/Spinner.js +1 -2
  183. package/lib-esm/StateLabel.js +1 -1
  184. package/lib-esm/StyledOcticon.js +1 -1
  185. package/lib-esm/SubNav.js +3 -3
  186. package/lib-esm/TextInputWithTokens.d.ts +2 -1
  187. package/lib-esm/Timeline.js +4 -4
  188. package/lib-esm/Token/AvatarToken.d.ts +1 -1
  189. package/lib-esm/Token/AvatarToken.js +1 -1
  190. package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
  191. package/lib-esm/Token/Token.d.ts +1 -1
  192. package/lib-esm/Token/TokenBase.js +1 -1
  193. package/lib-esm/Tooltip.js +1 -1
  194. package/lib-esm/UnderlineNav.js +2 -2
  195. package/lib-esm/__tests__/Avatar.test.js +4 -2
  196. package/lib-esm/__tests__/Avatar.types.test.d.ts +3 -0
  197. package/lib-esm/__tests__/Avatar.types.test.js +16 -0
  198. package/lib-esm/__tests__/BranchName.types.test.d.ts +3 -0
  199. package/lib-esm/__tests__/BranchName.types.test.js +13 -0
  200. package/lib-esm/__tests__/Details.types.test.d.ts +3 -0
  201. package/lib-esm/__tests__/Details.types.test.js +13 -0
  202. package/lib-esm/__tests__/Heading.test.js +62 -30
  203. package/lib-esm/__tests__/Heading.types.test.d.ts +3 -0
  204. package/lib-esm/__tests__/Heading.types.test.js +13 -0
  205. package/lib-esm/drafts.d.ts +1 -0
  206. package/lib-esm/drafts.js +2 -1
  207. package/lib-esm/stories/ActionList.stories.js +3 -3
  208. package/lib-esm/stories/ActionList2.stories.js +1 -1
  209. package/lib-esm/stories/ActionMenu2.stories.js +376 -0
  210. package/lib-esm/stories/Checkbox.stories.js +2 -2
  211. package/lib-esm/stories/ThemeProvider.stories.js +1 -5
  212. package/lib-esm/stories/useFocusTrap.stories.js +1 -11
  213. package/lib-esm/stories/useFocusZone.stories.js +2 -6
  214. package/package-lock.json +1366 -3544
  215. package/package.json +14 -8
  216. package/script/component-status-project/build.ts +100 -0
  217. package/script/component-status-project/deploy.rb +142 -0
  218. package/src/ActionList2/Divider.tsx +13 -8
  219. package/src/ActionList2/Item.tsx +13 -3
  220. package/src/ActionList2/List.tsx +6 -2
  221. package/src/ActionList2/MenuContext.tsx +6 -0
  222. package/src/ActionList2/Selection.tsx +9 -0
  223. package/src/ActionMenu2.tsx +94 -0
  224. package/src/Avatar.tsx +2 -4
  225. package/src/BranchName.tsx +3 -3
  226. package/src/Details.tsx +1 -5
  227. package/src/Heading.tsx +2 -9
  228. package/src/ProgressBar.tsx +11 -10
  229. package/src/Spinner.tsx +1 -3
  230. package/src/__tests__/Avatar.test.tsx +1 -1
  231. package/src/__tests__/Avatar.types.test.tsx +11 -0
  232. package/src/__tests__/BranchName.types.test.tsx +11 -0
  233. package/src/__tests__/Details.types.test.tsx +11 -0
  234. package/src/__tests__/Heading.test.tsx +71 -25
  235. package/src/__tests__/Heading.types.test.tsx +11 -0
  236. package/src/drafts.ts +1 -0
  237. package/src/stories/ActionMenu2.stories.tsx +551 -0
  238. package/stats.html +1 -1
  239. package/tsconfig.build.json +1 -1
  240. package/tsconfig.json +1 -1
@@ -12,15 +12,16 @@ BranchName is a label-type component rendered as an `<a>` tag by default with mo
12
12
 
13
13
  ## Props
14
14
 
15
- | Name | Type | Default | Description |
16
- | :--- | :----- | :-----: | :---------------------------------- |
17
- | as | String | `<a>` | sets the HTML tag for the component |
18
- | href | String | | a URL to link the component to |
15
+ | Name | Type | Default | Description |
16
+ | :--- | :---------------- | :-----: | :----------------------------------- |
17
+ | as | String | `<a>` | sets the HTML tag for the component |
18
+ | href | String | | a URL to link the component to |
19
+ | sx | SystemStyleObject | {} | Style to be applied to the component |
19
20
 
20
21
  ## Component status
21
22
 
22
23
  <ComponentChecklist
23
- items={{
24
+ items={{
24
25
  propsDocumented: true,
25
26
  noUnnecessaryDeps: true,
26
27
  adaptsToThemes: true,
@@ -79,15 +79,11 @@ In previous versions of Primer React Components, we allowed users to pass in a c
79
79
  </State>
80
80
  ```
81
81
 
82
- ## `Details` System props
82
+ ## Details props
83
83
 
84
- <Note variant="warning">
85
-
86
- System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead.
87
-
88
- </Note>
89
-
90
- Details components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props.
84
+ | Name | Type | Default | Description |
85
+ | :--- | :---------------- | :-----: | :----------------------------------- |
86
+ | sx | SystemStyleObject | {} | Style to be applied to the component |
91
87
 
92
88
  ## `useDetails` hook configuration options
93
89
 
@@ -10,17 +10,12 @@ The Heading component will render an html `h2` tag without any default styling.
10
10
  ## Default example
11
11
 
12
12
  ```jsx live
13
- <Heading fontSize={1} mb={2}>
14
- H2 heading with fontSize={1}
15
- </Heading>
13
+ <Heading sx={{fontSize: 1, mb: 2}}>H2 heading with fontSize={1}</Heading>
16
14
  ```
17
15
 
18
- ## System props
19
-
20
- Heading components get `TYPOGRAPHY` and `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props.
21
-
22
16
  ## Component props
23
17
 
24
- | Prop name | Type | Description |
25
- | :-------- | :---------------------- | :---------------------------------- |
26
- | as | String or React element | sets the HTML tag for the component |
18
+ | Name | Type | Default | Description |
19
+ | :--- | :---------------------- | :-----: | :----------------------------------- |
20
+ | as | String or React element | | sets the HTML tag for the component |
21
+ | sx | SystemStyleObject | {} | Style to be applied to the component |
@@ -41,10 +41,9 @@ The Label component is used to add contextual metadata to a design. Visually it
41
41
 
42
42
  ## Component props
43
43
 
44
- | Name | Type | Default | Description |
45
- | :--------- | :---------------- | :--------------------: | :----------------------------------------------------------------------------- |
46
- | outline | Boolean | | Creates an outline style label |
47
- | variant | String | 'medium' | Can be one of `small`, `medium` (default), `large` or `xl` . |
48
- | dropshadow | Boolean | | Adds a dropshadow to the label |
49
- | bg | String | 'label.primary.border' | Part of the `COMMON` system props, used to change the background of the label. |
50
- | sx | SystemStyleObject | {} | Style to be applied to the component |
44
+ | Name | Type | Default | Description |
45
+ | :--------- | :---------------- | :------: | :----------------------------------------------------------- |
46
+ | outline | Boolean | | Creates an outline style label |
47
+ | variant | String | 'medium' | Can be one of `small`, `medium` (default), `large` or `xl` . |
48
+ | dropshadow | Boolean | | Adds a dropshadow to the label |
49
+ | sx | SystemStyleObject | {} | Style to be applied to the component |
@@ -22,9 +22,10 @@ If you'd like to use ProgressBar inline, pass the `inline` boolean prop & **be s
22
22
 
23
23
  ## Component props
24
24
 
25
- | Name | Type | Default | Description |
26
- | :------- | :------ | :-----------------: | :------------------------------------------------------------------------------------------------------------------------------- |
27
- | progress | Number | | Used to set the size of the green bar |
28
- | barSize | String | 'default' | Controls the height of the progress bar. Can be 'small', 'large', or 'default'. If omitted, height is set to the default height. |
29
- | inline | Boolean | false | Styles the progress bar inline |
30
- | bg | String | 'bg.successInverse' | Set the progress bar color, defaults to bg-green |
25
+ | Name | Type | Default | Description |
26
+ | :------- | :---------------- | :-----------------: | :------------------------------------------------------------------------------------------------------------------------------- |
27
+ | progress | Number | | Used to set the size of the green bar |
28
+ | barSize | String | 'default' | Controls the height of the progress bar. Can be 'small', 'large', or 'default'. If omitted, height is set to the default height. |
29
+ | inline | Boolean | false | Styles the progress bar inline |
30
+ | bg | String | 'bg.successInverse' | Set the progress bar color, defaults to bg-green |
31
+ | sx | SystemStyleObject | {} | Style to be applied to the component |
@@ -23,12 +23,6 @@ The Text component is a wrapper component that will apply typography styles to t
23
23
 
24
24
  ## System props
25
25
 
26
- <Note variant="warning">
27
-
28
- System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead.
29
-
30
- </Note>
31
-
32
26
  Text components get `TYPOGRAPHY` and `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props.
33
27
 
34
28
  ## Component props
@@ -6,16 +6,13 @@ storybook: '/react/storybook?path=/story/composite-components-actionlist2'
6
6
  description: An ActionList is a list of items that can be activated or selected. ActionList is the base component for many menu-type components, including DropdownMenu and ActionMenu.
7
7
  ---
8
8
 
9
- import {BorderBox, Avatar} from '@primer/components'
9
+ import {Box, Avatar} from '@primer/components'
10
10
  import {ActionList} from '@primer/components/drafts'
11
- import {ComponentChecklist} from '../src/component-checklist'
12
-
13
- import {ImageContainer} from '@primer/gatsby-theme-doctocat'
14
11
  import {LinkIcon, AlertIcon, ArrowRightIcon} from '@primer/octicons-react'
15
12
 
16
13
  <br />
17
14
 
18
- <BorderBox sx={{padding: 6}}>
15
+ <Box sx={{border: '1px solid', borderColor: 'border.default', borderRadius: 2, padding: 6}}>
19
16
  <ActionList sx={{width: 320}}>
20
17
  <ActionList.Item>
21
18
  <ActionList.LeadingVisual>
@@ -43,7 +40,7 @@ import {LinkIcon, AlertIcon, ArrowRightIcon} from '@primer/octicons-react'
43
40
  </ActionList.TrailingVisual>
44
41
  </ActionList.Item>
45
42
  </ActionList>
46
- </BorderBox>
43
+ </Box>
47
44
 
48
45
  <br />
49
46
 
@@ -351,11 +348,10 @@ render(<SelectFields />)
351
348
 
352
349
  - [Interface guidelines: Action List](https://primer.style/design/components/action-list)
353
350
 
354
- <br />
355
-
356
351
  ## Related components
357
352
 
358
- - [ActionMenu](/ActionMenu)
353
+ - [ActionMenu](/drafts/ActionMenu2)
354
+ - [DropdownMenu](/DropdownMenu)
359
355
  - [SelectPanel](/SelectPanel)
360
356
 
361
357
  ## Component status
@@ -0,0 +1,251 @@
1
+ ---
2
+ title: ActionMenu
3
+ status: Alpha
4
+ source: https://github.com/primer/react/tree/main/src/ActionMenu
5
+ storybook: '/react/storybook?path=/story/composite-components-actionmenu2'
6
+ description: An ActionMenu is an ActionList-based component for creating a menu of actions that expands through a trigger button.
7
+ ---
8
+
9
+ import {Box, Avatar} from '@primer/components'
10
+ import {ActionMenu, ActionList} from '@primer/components/drafts'
11
+ import {Props} from '../../src/props'
12
+
13
+ <br />
14
+
15
+ <Box sx={{border: '1px solid', borderColor: 'border.default', borderRadius: 2, padding: 6}}>
16
+ <ActionMenu>
17
+ <ActionMenu.Button>Menu</ActionMenu.Button>
18
+ <ActionList>
19
+ <ActionList.Item onSelect={() => onSelect('Copy link')}>
20
+ Copy link
21
+ <ActionList.TrailingVisual>⌘C</ActionList.TrailingVisual>
22
+ </ActionList.Item>
23
+ <ActionList.Item onSelect={() => onSelect('Quote reply')}>
24
+ Quote reply
25
+ <ActionList.TrailingVisual>⌘Q</ActionList.TrailingVisual>
26
+ </ActionList.Item>
27
+ <ActionList.Item onSelect={() => onSelect('Edit comment')}>
28
+ Edit comment
29
+ <ActionList.TrailingVisual>⌘E</ActionList.TrailingVisual>
30
+ </ActionList.Item>
31
+ <ActionList.Divider />
32
+ <ActionList.Item variant="danger" onSelect={() => onSelect('Delete file')}>
33
+ Delete file
34
+ <ActionList.TrailingVisual>⌘D</ActionList.TrailingVisual>
35
+ </ActionList.Item>
36
+ </ActionList>
37
+
38
+ </ActionMenu>
39
+ </Box>
40
+
41
+ <br />
42
+
43
+ ```js
44
+ import {ActionMenu} from '@primer/components/drafts'
45
+ ```
46
+
47
+ <br />
48
+
49
+ ## Examples
50
+
51
+ ### Minimal example
52
+
53
+ `ActionMenu` ships with `ActionMenu.Button` which is an accessible trigger for the overlay. It's recommended to compose `ActionList` with this component.
54
+
55
+ &nbsp;
56
+
57
+ ```javascript live noinline
58
+ // import {ActionMenu, ActionList} from '@primer/components/drafts'
59
+ const {ActionMenu, ActionList} = drafts // ignore docs silliness; import like that ↑
60
+
61
+ render(
62
+ <ActionMenu>
63
+ <ActionMenu.Button>Menu</ActionMenu.Button>
64
+
65
+ <ActionList>
66
+ <ActionList.Item onSelect={event => console.log('New file')}>New file</ActionList.Item>
67
+ <ActionList.Item>Copy link</ActionList.Item>
68
+ <ActionList.Item>Edit file</ActionList.Item>
69
+ <ActionList.Divider />
70
+ <ActionList.Item variant="danger">Delete file</ActionList.Item>
71
+ </ActionList>
72
+ </ActionMenu>
73
+ )
74
+ ```
75
+
76
+ ### With a custom anchor
77
+
78
+ You can choose to have a different _anchor_ for the Menu dependending on the application's context.
79
+
80
+ &nbsp;
81
+
82
+ ```javascript live noinline
83
+ // import {ActionMenu, ActionList} from '@primer/components/drafts'
84
+ const {ActionMenu, ActionList} = drafts // ignore docs silliness; import like that ↑
85
+
86
+ render(
87
+ <ActionMenu>
88
+ <ActionMenu.Anchor>
89
+ <ButtonInvisible aria-label="Open column options">
90
+ <KebabHorizontalIcon />
91
+ </ButtonInvisible>
92
+ </ActionMenu.Anchor>
93
+
94
+ <ActionList>
95
+ <ActionList.Item>
96
+ <ActionList.LeadingVisual>
97
+ <PencilIcon />
98
+ </ActionList.LeadingVisual>
99
+ Rename
100
+ </ActionList.Item>
101
+ <ActionList.Item>
102
+ <ActionList.LeadingVisual>
103
+ <ArchiveIcon />
104
+ </ActionList.LeadingVisual>
105
+ Archive all cards
106
+ </ActionList.Item>
107
+ <ActionList.Item variant="danger">
108
+ <ActionList.LeadingVisual>
109
+ <TrashIcon />
110
+ </ActionList.LeadingVisual>
111
+ Delete
112
+ </ActionList.Item>
113
+ </ActionList>
114
+ </ActionMenu>
115
+ )
116
+ ```
117
+
118
+ ### With Groups
119
+
120
+ ```javascript live noinline
121
+ // import {ActionMenu, ActionList} from '@primer/components/drafts'
122
+ const {ActionMenu, ActionList} = drafts // ignore docs silliness; import like that ↑
123
+
124
+ render(
125
+ <ActionMenu>
126
+ <ActionMenu.Button>Open column menu</ActionMenu.Button>
127
+
128
+ <ActionList showDividers>
129
+ <ActionList.Group title="Live query">
130
+ <ActionList.Item>
131
+ <ActionList.LeadingVisual>
132
+ <SearchIcon />
133
+ </ActionList.LeadingVisual>
134
+ repo:github/memex,github/github
135
+ </ActionList.Item>
136
+ </ActionList.Group>
137
+ <ActionList.Divider />
138
+ <ActionList.Group title="Layout" variant="subtle">
139
+ <ActionList.Item>
140
+ <ActionList.LeadingVisual>
141
+ <NoteIcon />
142
+ </ActionList.LeadingVisual>
143
+ Table
144
+ <ActionList.Description variant="block">
145
+ Information-dense table optimized for operations across teams
146
+ </ActionList.Description>
147
+ </ActionList.Item>
148
+ <ActionList.Item role="listitem">
149
+ <ActionList.LeadingVisual>
150
+ <ProjectIcon />
151
+ </ActionList.LeadingVisual>
152
+ Board
153
+ <ActionList.Description variant="block">Kanban-style board focused on visual states</ActionList.Description>
154
+ </ActionList.Item>
155
+ </ActionList.Group>
156
+ <ActionList.Divider />
157
+ <ActionList.Group>
158
+ <ActionList.Item>
159
+ <ActionList.LeadingVisual>
160
+ <FilterIcon />
161
+ </ActionList.LeadingVisual>
162
+ Save sort and filters to current view
163
+ </ActionList.Item>
164
+ <ActionList.Item>
165
+ <ActionList.LeadingVisual>
166
+ <FilterIcon />
167
+ </ActionList.LeadingVisual>
168
+ Save sort and filters to new view
169
+ </ActionList.Item>
170
+ </ActionList.Group>
171
+ <ActionList.Divider />
172
+ <ActionList.Group>
173
+ <ActionList.Item>
174
+ <ActionList.LeadingVisual>
175
+ <GearIcon />
176
+ </ActionList.LeadingVisual>
177
+ View settings
178
+ </ActionList.Item>
179
+ </ActionList.Group>
180
+ </ActionList>
181
+ </ActionMenu>
182
+ )
183
+ ```
184
+
185
+ ### With External Anchor
186
+
187
+ To create an anchor outside of the menu, you need to switch to controlled mode for the menu and pass it as `anchorRef` to `ActionMenu`:
188
+
189
+ ```javascript live noinline
190
+ // import {ActionMenu, ActionList} from '@primer/components/drafts'
191
+ const {ActionMenu, ActionList} = drafts // ignore docs silliness; import like that ↑
192
+
193
+ const Example = () => {
194
+ const [open, setOpen] = React.useState(false)
195
+ const anchorRef = React.createRef()
196
+
197
+ return (
198
+ <>
199
+ <Button ref={anchorRef} onClick={() => setOpen(!open)}>
200
+ {open ? 'Close Menu' : 'Open Menu'}
201
+ </Button>
202
+
203
+ <ActionMenu open={open} onOpenChange={setOpen} anchorRef={anchorRef}>
204
+ <ActionList>
205
+ <ActionList.Item>Copy link</ActionList.Item>
206
+ <ActionList.Item>Quote reply</ActionList.Item>
207
+ <ActionList.Item>Edit comment</ActionList.Item>
208
+ <ActionList.Divider />
209
+ <ActionList.Item variant="danger">Delete file</ActionList.Item>
210
+ </ActionList>
211
+ </ActionMenu>
212
+ </>
213
+ )
214
+ }
215
+
216
+ render(<Example />)
217
+ ```
218
+
219
+ ## Props / API reference
220
+
221
+ ### ActionMenu
222
+
223
+ | Name | Type | Default | Description |
224
+ | :----------- | :-------------------------------------------------- | :-----: | :----------------------------------------------------------------------------------------------------------------------- |
225
+ | children\* | `React.ReactElement[]` | - | Required. Recommended: `ActionMenu.Button` or `ActionMenu.Anchor` with [`ActionList`](/drafts/ActionList2) |
226
+ | open | `boolean` | - | Optional. If defined, will control the open/closed state of the overlay. Must be used in conjuction with `onOpenChange`. |
227
+ | onOpenChange | `(open: boolean) => void` | - | Optional. If defined, will control the open/closed state of the overlay. Must be used in conjuction with `open`. |
228
+ | anchorRef | `React.RefObject<HTMLElement>` | - | Optional. Useful for defining an external anchor |
229
+ | overlayProps | [`Partial<OverlayProps>`](/Overlay#component-props) | - | Optional. Props to be spread on the internal [`AnchoredOverlay`](/AnchoredOverlay) component. |
230
+
231
+ ### ActionMenu.Button
232
+
233
+ | Type | Default | Description |
234
+ | :-------------------------------------- | :-----: | :------------------------------------------------------------------------------------------------------------------- |
235
+ | [ButtonProps](/Buttons#component-props) | - | Optional. You can pass all of the props that you would pass to a [`Button`](/Buttons) component like `variant`, `sx` |
236
+
237
+ ### ActionMenu.Anchor
238
+
239
+ | Name | Type | Default | Description |
240
+ | :--------- | :------------------- | :-----: | :-------------------------------- |
241
+ | children\* | `React.ReactElement` | - | Required. Accepts a single child. |
242
+
243
+ ## Further reading
244
+
245
+ [Interface guidelines: Action List + Menu](https://primer.style/design/components/action-list)
246
+
247
+ ## Related components
248
+
249
+ - [ActionList](/drafts/ActionList2)
250
+ - [DropdownMenu](/DropdownMenu)
251
+ - [SelectPanel](/SelectPanel)
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: Component statuses
2
+ title: Component status
3
3
  description: Check the current status of Primer React components
4
4
  ---
5
5
 
@@ -6,7 +6,7 @@ import {PropsList, COMMON, LAYOUT, BORDER, TYPOGRAPHY, FLEX, POSITION, GRID} fro
6
6
 
7
7
  <Note variant="warning">
8
8
 
9
- System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead.
9
+ System props are deprecated in all components except [Box](/Box) and [Text](/Text). Please use the [`sx` prop](/overriding-styles) instead.
10
10
 
11
11
  </Note>
12
12
 
@@ -24,7 +24,11 @@ import {
24
24
  LawIcon,
25
25
  StarIcon,
26
26
  AlertIcon,
27
- ArrowRightIcon
27
+ ArrowRightIcon,
28
+ KebabHorizontalIcon,
29
+ PencilIcon,
30
+ ArchiveIcon,
31
+ TrashIcon
28
32
  } from '@primer/octicons-react'
29
33
  import State from '../../../components/State'
30
34
  import {Dialog as Dialog2} from '../../../../src/Dialog/Dialog'
@@ -65,6 +69,10 @@ export default {
65
69
  StarIcon,
66
70
  AlertIcon,
67
71
  ArrowRightIcon,
72
+ KebabHorizontalIcon,
73
+ PencilIcon,
74
+ ArchiveIcon,
75
+ TrashIcon,
68
76
  Dialog2,
69
77
  ConfirmationDialog,
70
78
  useConfirm,
@@ -19,7 +19,7 @@
19
19
  url: /overriding-styles
20
20
  - title: Server-side rendering
21
21
  url: /ssr
22
- - title: Component statuses
22
+ - title: Component status
23
23
  url: /status
24
24
  - title: Hooks
25
25
  children:
@@ -9,7 +9,9 @@ export function ComponentChecklist({items}) {
9
9
  <>
10
10
  <H3>Alpha</H3>
11
11
  <Checklist aria-describedby="alpha">
12
- <Checklist.Item checked={items.propsDocumented}>Component props are documented.</Checklist.Item>
12
+ <Checklist.Item checked={items.propsDocumented}>
13
+ Component props are documented on <Link href="https://primer.style/react/">primer.style/react</Link>.
14
+ </Checklist.Item>
13
15
  <Checklist.Item checked={items.noUnnecessaryDeps}>
14
16
  Component does not have any unnecessary third-party dependencies.
15
17
  </Checklist.Item>
@@ -22,7 +24,13 @@ export function ComponentChecklist({items}) {
22
24
  <H3>Beta</H3>
23
25
  <Checklist aria-describedby="beta">
24
26
  <Checklist.Item checked={items.usedInProduction}>Component is used in a production application.</Checklist.Item>
25
- <Checklist.Item checked={items.usageExamplesDocumented}>Common usage examples are documented.</Checklist.Item>
27
+ <Checklist.Item checked={items.usageExamplesDocumented}>
28
+ Common usage examples are documented on <Link href="https://primer.style/react/">primer.style/react</Link>.
29
+ </Checklist.Item>
30
+ <Checklist.Item checked={items.hasStorybookStories}>
31
+ Common usage examples are documented in <Link href="https://primer.style/react/storybook">storybook</Link>{' '}
32
+ stories.
33
+ </Checklist.Item>
26
34
  <Checklist.Item checked={items.designReviewed}>
27
35
  Component has been reviewed by a systems designer and any resulting issues have been addressed.
28
36
  </Checklist.Item>
@@ -24,7 +24,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
24
24
 
25
25
  const StyledHeader = _styledComponents.default.div.withConfig({
26
26
  displayName: "Header__StyledHeader",
27
- componentId: "qmofje-0"
27
+ componentId: "sc-qmofje-0"
28
28
  })(["{}padding:6px ", ";font-size:", ";font-weight:", ";color:", ";", " ", ""], (0, _constants.get)('space.3'), (0, _constants.get)('fontSizes.0'), (0, _constants.get)('fontWeights.bold'), (0, _constants.get)('colors.fg.muted'), ({
29
29
  variant
30
30
  }) => variant === 'filled' && (0, _styledComponents.css)(["background:", ";margin:", " 0;border-top:1px solid ", ";border-bottom:1px solid ", ";&:first-child{margin-top:0;}"], (0, _constants.get)('colors.canvas.subtle'), (0, _constants.get)('space.2'), (0, _constants.get)('colors.neutral.muted'), (0, _constants.get)('colors.neutral.muted')), _sx.default);
@@ -71,17 +71,17 @@ const getItemVariant = (variant = 'default', disabled) => {
71
71
 
72
72
  const DividedContent = _styledComponents.default.div.withConfig({
73
73
  displayName: "Item__DividedContent",
74
- componentId: "jqpvy8-0"
74
+ componentId: "sc-jqpvy8-0"
75
75
  })(["display:flex;min-width:0;position:relative;flex-grow:1;"]);
76
76
 
77
77
  const MainContent = _styledComponents.default.div.withConfig({
78
78
  displayName: "Item__MainContent",
79
- componentId: "jqpvy8-1"
79
+ componentId: "sc-jqpvy8-1"
80
80
  })(["align-items:baseline;display:flex;min-width:0;flex-direction:var(--main-content-flex-direction);flex-grow:1;"]);
81
81
 
82
82
  const StyledItem = _styledComponents.default.div.withConfig({
83
83
  displayName: "Item__StyledItem",
84
- componentId: "jqpvy8-2"
84
+ componentId: "sc-jqpvy8-2"
85
85
  })(["padding:6px ", ";display:flex;border-radius:", ";color:", ";transition:background 33.333ms linear;text-decoration:none;@media (hover:hover) and (pointer:fine){:hover{background:var( --item-hover-bg-override,", " );color:", ";cursor:", ";}}:not(:first-of-type):not(", " + &):not(", " + &){margin-top:", ";", "::before{content:' ';display:block;position:absolute;width:100%;top:-7px;border:0 solid ", ";border-top-width:", ";}}&:hover ", "::before,:hover + * ", "::before{border-color:var(--item-hover-divider-border-color-override,transparent) !important;}&:focus ", "::before,:focus + * ", "::before,&[", "] ", "::before,[", "] + & ", "::before{border-color:transparent !important;}&[", "='", "']{background:", ";}&[", "='", "']{background:", ";}&:focus{background:", ";outline:none;}&:active{background:", ";}", ""], (0, _constants.get)('space.2'), (0, _constants.get)('radii.2'), ({
86
86
  variant,
87
87
  item
@@ -114,30 +114,30 @@ const StyledItem = _styledComponents.default.div.withConfig({
114
114
 
115
115
  const TextContainer = _styledComponents.default.span.withConfig({
116
116
  displayName: "Item__TextContainer",
117
- componentId: "jqpvy8-3"
117
+ componentId: "sc-jqpvy8-3"
118
118
  })([""]);
119
119
 
120
120
  exports.TextContainer = TextContainer;
121
121
 
122
122
  const BaseVisualContainer = _styledComponents.default.div.withConfig({
123
123
  displayName: "Item__BaseVisualContainer",
124
- componentId: "jqpvy8-4"
124
+ componentId: "sc-jqpvy8-4"
125
125
  })(["height:20px;width:", ";margin-right:", ";display:flex;justify-content:center;align-items:center;flex-shrink:0;"], (0, _constants.get)('space.3'), (0, _constants.get)('space.2'));
126
126
 
127
127
  const ColoredVisualContainer = (0, _styledComponents.default)(BaseVisualContainer).withConfig({
128
128
  displayName: "Item__ColoredVisualContainer",
129
- componentId: "jqpvy8-5"
129
+ componentId: "sc-jqpvy8-5"
130
130
  })(["svg{fill:", ";font-size:", ";}"], ({
131
131
  variant,
132
132
  disabled
133
133
  }) => getItemVariant(variant, disabled).iconColor, (0, _constants.get)('fontSizes.0'));
134
134
  const LeadingVisualContainer = (0, _styledComponents.default)(ColoredVisualContainer).withConfig({
135
135
  displayName: "Item__LeadingVisualContainer",
136
- componentId: "jqpvy8-6"
136
+ componentId: "sc-jqpvy8-6"
137
137
  })(["display:flex;flex-direction:column;justify-content:center;"]);
138
138
  const TrailingContent = (0, _styledComponents.default)(ColoredVisualContainer).withConfig({
139
139
  displayName: "Item__TrailingContent",
140
- componentId: "jqpvy8-7"
140
+ componentId: "sc-jqpvy8-7"
141
141
  })(["color:", "};margin-left:", ";margin-right:0;width:auto;div:nth-child(2){margin-left:", ";}"], ({
142
142
  variant,
143
143
  disabled
@@ -145,12 +145,12 @@ const TrailingContent = (0, _styledComponents.default)(ColoredVisualContainer).w
145
145
 
146
146
  const DescriptionContainer = _styledComponents.default.span.withConfig({
147
147
  displayName: "Item__DescriptionContainer",
148
- componentId: "jqpvy8-8"
148
+ componentId: "sc-jqpvy8-8"
149
149
  })(["color:", ";font-size:", ";line-height:16px;margin-left:var(--description-container-margin-left);min-width:0;flex-grow:1;flex-basis:var(--description-container-flex-basis);"], (0, _constants.get)('colors.fg.muted'), (0, _constants.get)('fontSizes.0'));
150
150
 
151
151
  const MultiSelectIcon = _styledComponents.default.svg.withConfig({
152
152
  displayName: "Item__MultiSelectIcon",
153
- componentId: "jqpvy8-9"
153
+ componentId: "sc-jqpvy8-9"
154
154
  })(["rect{fill:", ";stroke:", ";shape-rendering:auto;}path{fill:", ";boxshadow:", ";opacity:", ";}"], ({
155
155
  selected
156
156
  }) => selected ? (0, _constants.get)('colors.accent.fg') : (0, _constants.get)('colors.canvas.default'), ({
@@ -37,7 +37,7 @@ function isGroupedListProps(props) {
37
37
 
38
38
  const StyledList = _styledComponents.default.div.withConfig({
39
39
  displayName: "List__StyledList",
40
- componentId: "yr2k7d-0"
40
+ componentId: "sc-yr2k7d-0"
41
41
  })(["font-size:", ";line-height:20px;&[", "],&:focus-within{--item-hover-bg-override:none;--item-hover-divider-border-color-override:", ";}"], (0, _constants.get)('fontSizes.1'), _focusZone.hasActiveDescendantAttribute, (0, _constants.get)('colors.border.muted'));
42
42
  /**
43
43
  * Returns `sx` prop values for `List` children matching the given `List` style variation.
@@ -1,5 +1,6 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
+ import { SxProp } from '../sx';
2
3
  /**
3
4
  * Visually separates `Item`s or `Group`s in an `ActionList`.
4
5
  */
5
- export declare function Divider(): JSX.Element;
6
+ export declare const Divider: React.FC<SxProp>;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Divider = Divider;
6
+ exports.Divider = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -11,25 +11,30 @@ var _Box = _interopRequireDefault(require("../Box"));
11
11
 
12
12
  var _constants = require("../constants");
13
13
 
14
+ var _sx = require("../sx");
15
+
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
17
 
16
18
  /**
17
19
  * Visually separates `Item`s or `Group`s in an `ActionList`.
18
20
  */
19
- function Divider() {
21
+ const Divider = ({
22
+ sx = {}
23
+ }) => {
20
24
  return /*#__PURE__*/_react.default.createElement(_Box.default, {
21
25
  as: "li",
22
26
  role: "separator",
23
- sx: {
27
+ sx: (0, _sx.merge)({
24
28
  height: 1,
25
29
  backgroundColor: 'actionListItem.inlineDivider',
26
30
  marginTop: theme => `calc(${(0, _constants.get)('space.2')(theme)} - 1px)`,
27
31
  marginBottom: 2,
28
32
  listStyle: 'none' // hide the ::marker inserted by browser's stylesheet
29
33
 
30
- },
34
+ }, sx),
31
35
  "data-component": "ActionList.Divider"
32
36
  });
33
- }
37
+ };
34
38
 
39
+ exports.Divider = Divider;
35
40
  Divider.displayName = "Divider";