@primer/components 33.0.0-rc.b495ba4a → 33.1.0-rc.6856bcf5

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 (234) hide show
  1. package/.devcontainer/devcontainer.json +1 -1
  2. package/.github/workflows/ci.yml +1 -1
  3. package/.github/workflows/release.yml +6 -27
  4. package/.github/workflows/release_canary.yml +4 -60
  5. package/.github/workflows/release_candidate.yml +5 -51
  6. package/.github/workflows/statuses.yml +32 -0
  7. package/.gitignore +1 -0
  8. package/.nvmrc +1 -1
  9. package/CHANGELOG.md +20 -0
  10. package/contributor-docs/CONTRIBUTING.md +14 -61
  11. package/dist/browser.esm.js +2 -2209
  12. package/dist/browser.esm.js.map +1 -1
  13. package/dist/browser.umd.js +2 -2209
  14. package/dist/browser.umd.js.map +1 -1
  15. package/docs/content/AnchoredOverlay.mdx +121 -1
  16. package/docs/content/Avatar.mdx +29 -14
  17. package/docs/content/AvatarPair.mdx +47 -0
  18. package/docs/content/AvatarStack.mdx +14 -6
  19. package/docs/content/Box.mdx +13 -11
  20. package/docs/content/BranchName.mdx +52 -0
  21. package/docs/content/{Breadcrumbs.md → Breadcrumbs.mdx} +21 -13
  22. package/docs/content/Link.mdx +75 -0
  23. package/docs/content/Radio.md +90 -0
  24. package/docs/content/TextInput.mdx +125 -0
  25. package/docs/content/drafts/ActionList2.mdx +484 -0
  26. package/docs/content/drafts/ActionMenu2.mdx +302 -0
  27. package/docs/src/@primer/gatsby-theme-doctocat/live-code-scope.js +9 -1
  28. package/docs/src/@primer/gatsby-theme-doctocat/mdx-components.js +15 -2
  29. package/docs/src/@primer/gatsby-theme-doctocat/nav.yml +4 -0
  30. package/docs/src/component-checklist.js +10 -2
  31. package/docs/src/props-table.js +165 -0
  32. package/docs/src/props.js +14 -28
  33. package/lib/ActionList/Header.js +1 -1
  34. package/lib/ActionList/Item.js +10 -10
  35. package/lib/ActionList/List.js +1 -1
  36. package/lib/ActionList2/ActionListContainerContext.d.ts +10 -0
  37. package/lib/ActionList2/ActionListContainerContext.js +15 -0
  38. package/lib/ActionList2/Divider.d.ts +3 -2
  39. package/lib/ActionList2/Divider.js +10 -5
  40. package/lib/ActionList2/Item.js +22 -8
  41. package/lib/ActionList2/List.js +12 -2
  42. package/lib/ActionList2/Selection.js +11 -0
  43. package/lib/ActionList2/index.d.ts +1 -2
  44. package/lib/ActionMenu2.d.ts +317 -0
  45. package/lib/ActionMenu2.js +125 -0
  46. package/lib/Autocomplete/Autocomplete.d.ts +2 -1
  47. package/lib/Autocomplete/AutocompleteInput.d.ts +2 -1
  48. package/lib/BaseStyles.js +2 -20
  49. package/lib/BorderBox.js +1 -1
  50. package/lib/Box.js +1 -1
  51. package/lib/BranchName.js +1 -1
  52. package/lib/Breadcrumbs.js +3 -3
  53. package/lib/Button/Button.d.ts +2 -2
  54. package/lib/Button/Button.js +1 -1
  55. package/lib/Button/ButtonClose.d.ts +2 -2
  56. package/lib/Button/ButtonDanger.d.ts +2 -2
  57. package/lib/Button/ButtonGroup.js +1 -1
  58. package/lib/Button/ButtonInvisible.d.ts +2 -2
  59. package/lib/Button/ButtonOutline.d.ts +2 -2
  60. package/lib/Button/ButtonPrimary.d.ts +2 -2
  61. package/lib/Checkbox.d.ts +1 -1
  62. package/lib/Checkbox.js +1 -1
  63. package/lib/CircleOcticon.d.ts +35 -35
  64. package/lib/Details.js +1 -1
  65. package/lib/Dialog.d.ts +37 -37
  66. package/lib/Dropdown.d.ts +6 -6
  67. package/lib/DropdownMenu/DropdownButton.d.ts +6 -3
  68. package/lib/FilterList.d.ts +1 -1
  69. package/lib/FilteredActionList/FilteredActionList.js +1 -1
  70. package/lib/Flex.js +1 -1
  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/Radio.d.ts +38 -0
  77. package/lib/Radio.js +55 -0
  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/StateLabel.js +1 -1
  89. package/lib/StyledOcticon.js +1 -1
  90. package/lib/SubNav.js +3 -3
  91. package/lib/TextInputWithTokens.d.ts +2 -1
  92. package/lib/ThemeProvider.d.ts +1 -0
  93. package/lib/ThemeProvider.js +17 -4
  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__/Radio.test.d.ts +2 -0
  103. package/lib/__tests__/Radio.test.js +202 -0
  104. package/lib/__tests__/ThemeProvider.test.js +114 -0
  105. package/lib/drafts.d.ts +1 -0
  106. package/lib/drafts.js +13 -0
  107. package/lib/hooks/index.d.ts +1 -0
  108. package/lib/hooks/index.js +9 -1
  109. package/lib/index.d.ts +2 -0
  110. package/lib/index.js +8 -0
  111. package/lib/stories/ActionList.stories.js +3 -3
  112. package/lib/stories/ActionList2.stories.js +1 -1
  113. package/lib/stories/ActionMenu2.stories.js +455 -0
  114. package/lib/stories/Checkbox.stories.js +4 -4
  115. package/lib/stories/Radio.stories.js +146 -0
  116. package/lib/stories/ThemeProvider.stories.js +1 -5
  117. package/lib/stories/useFocusTrap.stories.js +1 -11
  118. package/lib/stories/useFocusZone.stories.js +2 -6
  119. package/lib-esm/ActionList/Header.js +1 -1
  120. package/lib-esm/ActionList/Item.js +10 -10
  121. package/lib-esm/ActionList/List.js +1 -1
  122. package/lib-esm/ActionList2/ActionListContainerContext.d.ts +10 -0
  123. package/lib-esm/ActionList2/ActionListContainerContext.js +3 -0
  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 -8
  127. package/lib-esm/ActionList2/List.js +10 -2
  128. package/lib-esm/ActionList2/Selection.js +9 -0
  129. package/lib-esm/ActionList2/index.d.ts +1 -2
  130. package/lib-esm/ActionMenu2.d.ts +317 -0
  131. package/lib-esm/ActionMenu2.js +100 -0
  132. package/lib-esm/Autocomplete/Autocomplete.d.ts +2 -1
  133. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +2 -1
  134. package/lib-esm/BaseStyles.js +2 -20
  135. package/lib-esm/BorderBox.js +1 -1
  136. package/lib-esm/Box.js +1 -1
  137. package/lib-esm/BranchName.js +1 -1
  138. package/lib-esm/Breadcrumbs.js +3 -3
  139. package/lib-esm/Button/Button.d.ts +2 -2
  140. package/lib-esm/Button/Button.js +1 -1
  141. package/lib-esm/Button/ButtonClose.d.ts +2 -2
  142. package/lib-esm/Button/ButtonDanger.d.ts +2 -2
  143. package/lib-esm/Button/ButtonGroup.js +1 -1
  144. package/lib-esm/Button/ButtonInvisible.d.ts +2 -2
  145. package/lib-esm/Button/ButtonOutline.d.ts +2 -2
  146. package/lib-esm/Button/ButtonPrimary.d.ts +2 -2
  147. package/lib-esm/Checkbox.d.ts +1 -1
  148. package/lib-esm/Checkbox.js +1 -1
  149. package/lib-esm/CircleOcticon.d.ts +35 -35
  150. package/lib-esm/Details.js +1 -1
  151. package/lib-esm/Dialog.d.ts +37 -37
  152. package/lib-esm/Dropdown.d.ts +6 -6
  153. package/lib-esm/DropdownMenu/DropdownButton.d.ts +6 -3
  154. package/lib-esm/FilterList.d.ts +1 -1
  155. package/lib-esm/FilteredActionList/FilteredActionList.js +1 -1
  156. package/lib-esm/Flex.js +1 -1
  157. package/lib-esm/LabelGroup.js +1 -1
  158. package/lib-esm/Overlay.js +1 -1
  159. package/lib-esm/Pagination/Pagination.js +2 -2
  160. package/lib-esm/Position.d.ts +4 -4
  161. package/lib-esm/Position.js +1 -1
  162. package/lib-esm/Radio.d.ts +38 -0
  163. package/lib-esm/Radio.js +40 -0
  164. package/lib-esm/SelectMenu/SelectMenu.d.ts +11 -10
  165. package/lib-esm/SelectMenu/SelectMenu.js +1 -1
  166. package/lib-esm/SelectMenu/SelectMenuFilter.js +1 -1
  167. package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
  168. package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
  169. package/lib-esm/SelectMenu/SelectMenuItem.js +1 -1
  170. package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
  171. package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
  172. package/lib-esm/SelectMenu/SelectMenuTabPanel.js +1 -1
  173. package/lib-esm/SelectMenu/SelectMenuTabs.js +1 -1
  174. package/lib-esm/StateLabel.js +1 -1
  175. package/lib-esm/StyledOcticon.js +1 -1
  176. package/lib-esm/SubNav.js +3 -3
  177. package/lib-esm/TextInputWithTokens.d.ts +2 -1
  178. package/lib-esm/ThemeProvider.d.ts +1 -0
  179. package/lib-esm/ThemeProvider.js +17 -4
  180. package/lib-esm/Timeline.js +4 -4
  181. package/lib-esm/Token/AvatarToken.d.ts +1 -1
  182. package/lib-esm/Token/AvatarToken.js +1 -1
  183. package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
  184. package/lib-esm/Token/Token.d.ts +1 -1
  185. package/lib-esm/Token/TokenBase.js +1 -1
  186. package/lib-esm/Tooltip.js +1 -1
  187. package/lib-esm/UnderlineNav.js +2 -2
  188. package/lib-esm/__tests__/Radio.test.d.ts +2 -0
  189. package/lib-esm/__tests__/Radio.test.js +183 -0
  190. package/lib-esm/__tests__/ThemeProvider.test.js +114 -0
  191. package/lib-esm/drafts.d.ts +1 -0
  192. package/lib-esm/drafts.js +2 -1
  193. package/lib-esm/hooks/index.d.ts +1 -0
  194. package/lib-esm/hooks/index.js +2 -1
  195. package/lib-esm/index.d.ts +2 -0
  196. package/lib-esm/index.js +1 -0
  197. package/lib-esm/stories/ActionList.stories.js +3 -3
  198. package/lib-esm/stories/ActionList2.stories.js +1 -1
  199. package/lib-esm/stories/ActionMenu2.stories.js +393 -0
  200. package/lib-esm/stories/Checkbox.stories.js +5 -5
  201. package/lib-esm/stories/Radio.stories.js +121 -0
  202. package/lib-esm/stories/ThemeProvider.stories.js +1 -5
  203. package/lib-esm/stories/useFocusTrap.stories.js +1 -11
  204. package/lib-esm/stories/useFocusZone.stories.js +2 -6
  205. package/package-lock.json +1366 -3544
  206. package/package.json +14 -8
  207. package/script/component-status-project/build.ts +100 -0
  208. package/script/component-status-project/deploy.rb +142 -0
  209. package/src/ActionList2/ActionListContainerContext.tsx +14 -0
  210. package/src/ActionList2/Divider.tsx +13 -8
  211. package/src/ActionList2/Item.tsx +14 -6
  212. package/src/ActionList2/List.tsx +6 -2
  213. package/src/ActionList2/Selection.tsx +9 -0
  214. package/src/ActionMenu2.tsx +116 -0
  215. package/src/BranchName.tsx +2 -1
  216. package/src/Radio.tsx +76 -0
  217. package/src/ThemeProvider.tsx +22 -5
  218. package/src/__tests__/Radio.test.tsx +174 -0
  219. package/src/__tests__/ThemeProvider.test.tsx +116 -0
  220. package/src/__tests__/__snapshots__/BranchName.test.tsx.snap +3 -1
  221. package/src/__tests__/__snapshots__/Radio.test.tsx.snap +16 -0
  222. package/src/drafts.ts +1 -0
  223. package/src/hooks/index.ts +1 -0
  224. package/src/index.ts +2 -0
  225. package/src/stories/ActionMenu2.stories.tsx +605 -0
  226. package/src/stories/Checkbox.stories.tsx +1 -3
  227. package/src/stories/Radio.stories.tsx +126 -0
  228. package/stats.html +1 -1
  229. package/tsconfig.build.json +1 -1
  230. package/tsconfig.json +1 -1
  231. package/docs/content/ActionList2.mdx +0 -379
  232. package/docs/content/BranchName.md +0 -39
  233. package/docs/content/Link.md +0 -29
  234. package/docs/content/TextInput.md +0 -42
@@ -0,0 +1,302 @@
1
+ ---
2
+ title: ActionMenu v2
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
+ <ActionMenu.Overlay>
19
+ <ActionList>
20
+ <ActionList.Item>
21
+ Copy link
22
+ <ActionList.TrailingVisual>⌘C</ActionList.TrailingVisual>
23
+ </ActionList.Item>
24
+ <ActionList.Item>
25
+ Quote reply
26
+ <ActionList.TrailingVisual>⌘Q</ActionList.TrailingVisual>
27
+ </ActionList.Item>
28
+ <ActionList.Item>
29
+ Edit comment
30
+ <ActionList.TrailingVisual>⌘E</ActionList.TrailingVisual>
31
+ </ActionList.Item>
32
+ <ActionList.Divider />
33
+ <ActionList.Item variant="danger">
34
+ Delete file
35
+ <ActionList.TrailingVisual>⌘D</ActionList.TrailingVisual>
36
+ </ActionList.Item>
37
+ </ActionList>
38
+ </ActionMenu.Overlay>
39
+ </ActionMenu>
40
+ </Box>
41
+
42
+ <br />
43
+
44
+ ```js
45
+ import {ActionMenu} from '@primer/components/drafts'
46
+ ```
47
+
48
+ <br />
49
+
50
+ ## Examples
51
+
52
+ ### Minimal example
53
+
54
+ `ActionMenu` ships with `ActionMenu.Button` which is an accessible trigger for the overlay. It's recommended to compose `ActionList` with `ActionMenu.Overlay`
55
+
56
+ &nbsp;
57
+
58
+ ```javascript live noinline
59
+ // import {ActionMenu, ActionList} from '@primer/components/drafts'
60
+ const {ActionMenu, ActionList} = drafts // ignore docs silliness; import like that ↑
61
+
62
+ render(
63
+ <ActionMenu>
64
+ <ActionMenu.Button>Menu</ActionMenu.Button>
65
+
66
+ <ActionMenu.Overlay>
67
+ <ActionList>
68
+ <ActionList.Item onSelect={event => console.log('New file')}>New file</ActionList.Item>
69
+ <ActionList.Item>Copy link</ActionList.Item>
70
+ <ActionList.Item>Edit file</ActionList.Item>
71
+ <ActionList.Divider />
72
+ <ActionList.Item variant="danger">Delete file</ActionList.Item>
73
+ </ActionList>
74
+ </ActionMenu.Overlay>
75
+ </ActionMenu>
76
+ )
77
+ ```
78
+
79
+ ### With a custom anchor
80
+
81
+ You can choose to have a different _anchor_ for the Menu dependending on the application's context.
82
+
83
+ &nbsp;
84
+
85
+ ```javascript live noinline
86
+ // import {ActionMenu, ActionList} from '@primer/components/drafts'
87
+ const {ActionMenu, ActionList} = drafts // ignore docs silliness; import like that ↑
88
+
89
+ render(
90
+ <ActionMenu>
91
+ <ActionMenu.Anchor>
92
+ <ButtonInvisible aria-label="Open column options">
93
+ <KebabHorizontalIcon />
94
+ </ButtonInvisible>
95
+ </ActionMenu.Anchor>
96
+
97
+ <ActionMenu.Overlay>
98
+ <ActionList>
99
+ <ActionList.Item>
100
+ <ActionList.LeadingVisual>
101
+ <PencilIcon />
102
+ </ActionList.LeadingVisual>
103
+ Rename
104
+ </ActionList.Item>
105
+ <ActionList.Item>
106
+ <ActionList.LeadingVisual>
107
+ <ArchiveIcon />
108
+ </ActionList.LeadingVisual>
109
+ Archive all cards
110
+ </ActionList.Item>
111
+ <ActionList.Item variant="danger">
112
+ <ActionList.LeadingVisual>
113
+ <TrashIcon />
114
+ </ActionList.LeadingVisual>
115
+ Delete
116
+ </ActionList.Item>
117
+ </ActionList>
118
+ </ActionMenu.Overlay>
119
+ </ActionMenu>
120
+ )
121
+ ```
122
+
123
+ ### With Groups
124
+
125
+ ```javascript live noinline
126
+ // import {ActionMenu, ActionList} from '@primer/components/drafts'
127
+ const {ActionMenu, ActionList} = drafts // ignore docs silliness; import like that ↑
128
+
129
+ render(
130
+ <ActionMenu>
131
+ <ActionMenu.Button>Open column menu</ActionMenu.Button>
132
+
133
+ <ActionMenu.Overlay>
134
+ <ActionList showDividers>
135
+ <ActionList.Group title="Live query">
136
+ <ActionList.Item>
137
+ <ActionList.LeadingVisual>
138
+ <SearchIcon />
139
+ </ActionList.LeadingVisual>
140
+ repo:github/memex,github/github
141
+ </ActionList.Item>
142
+ </ActionList.Group>
143
+ <ActionList.Divider />
144
+ <ActionList.Group title="Layout" variant="subtle">
145
+ <ActionList.Item>
146
+ <ActionList.LeadingVisual>
147
+ <NoteIcon />
148
+ </ActionList.LeadingVisual>
149
+ Table
150
+ <ActionList.Description variant="block">
151
+ Information-dense table optimized for operations across teams
152
+ </ActionList.Description>
153
+ </ActionList.Item>
154
+ <ActionList.Item role="listitem">
155
+ <ActionList.LeadingVisual>
156
+ <ProjectIcon />
157
+ </ActionList.LeadingVisual>
158
+ Board
159
+ <ActionList.Description variant="block">Kanban-style board focused on visual states</ActionList.Description>
160
+ </ActionList.Item>
161
+ </ActionList.Group>
162
+ <ActionList.Divider />
163
+ <ActionList.Group>
164
+ <ActionList.Item>
165
+ <ActionList.LeadingVisual>
166
+ <FilterIcon />
167
+ </ActionList.LeadingVisual>
168
+ Save sort and filters to current view
169
+ </ActionList.Item>
170
+ <ActionList.Item>
171
+ <ActionList.LeadingVisual>
172
+ <FilterIcon />
173
+ </ActionList.LeadingVisual>
174
+ Save sort and filters to new view
175
+ </ActionList.Item>
176
+ </ActionList.Group>
177
+ <ActionList.Divider />
178
+ <ActionList.Group>
179
+ <ActionList.Item>
180
+ <ActionList.LeadingVisual>
181
+ <GearIcon />
182
+ </ActionList.LeadingVisual>
183
+ View settings
184
+ </ActionList.Item>
185
+ </ActionList.Group>
186
+ </ActionList>
187
+ </ActionMenu.Overlay>
188
+ </ActionMenu>
189
+ )
190
+ ```
191
+
192
+ ### With External Anchor
193
+
194
+ 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`:
195
+
196
+ ```javascript live noinline
197
+ // import {ActionMenu, ActionList} from '@primer/components/drafts'
198
+ const {ActionMenu, ActionList} = drafts // ignore docs silliness; import like that ↑
199
+
200
+ const Example = () => {
201
+ const [open, setOpen] = React.useState(false)
202
+ const anchorRef = React.createRef()
203
+
204
+ return (
205
+ <>
206
+ <Button ref={anchorRef} onClick={() => setOpen(!open)}>
207
+ {open ? 'Close Menu' : 'Open Menu'}
208
+ </Button>
209
+
210
+ <ActionMenu open={open} onOpenChange={setOpen} anchorRef={anchorRef}>
211
+ <ActionMenu.Overlay>
212
+ <ActionList>
213
+ <ActionList.Item>Copy link</ActionList.Item>
214
+ <ActionList.Item>Quote reply</ActionList.Item>
215
+ <ActionList.Item>Edit comment</ActionList.Item>
216
+ <ActionList.Divider />
217
+ <ActionList.Item variant="danger">Delete file</ActionList.Item>
218
+ </ActionList>
219
+ </ActionMenu.Overlay>
220
+ </ActionMenu>
221
+ </>
222
+ )
223
+ }
224
+
225
+ render(<Example />)
226
+ ```
227
+
228
+ ### With Overlay Props
229
+
230
+ 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`:
231
+
232
+ ```javascript live noinline
233
+ // import {ActionMenu, ActionList} from '@primer/components/drafts'
234
+ const {ActionMenu, ActionList} = drafts // ignore docs silliness; import like that ↑
235
+
236
+ const handleEscape = () => alert('you hit escape!')
237
+
238
+ render(
239
+ <ActionMenu>
240
+ <ActionMenu.Button>Open Actions Menu</ActionMenu.Button>
241
+ <ActionMenu.Overlay width="medium" onEscape={handleEscape}>
242
+ <ActionList>
243
+ <ActionList.Item>
244
+ Open current Codespace
245
+ <ActionList.Description variant="block">
246
+ Your existing Codespace will be opened to its previous state, and you&apos;ll be asked to manually switch to
247
+ new-branch.
248
+ </ActionList.Description>
249
+ <ActionList.TrailingVisual>⌘O</ActionList.TrailingVisual>
250
+ </ActionList.Item>
251
+ <ActionList.Item>
252
+ Create new Codespace
253
+ <ActionList.Description variant="block">
254
+ Create a brand new Codespace with a fresh image and checkout this branch.
255
+ </ActionList.Description>
256
+ <ActionList.TrailingVisual>⌘C</ActionList.TrailingVisual>
257
+ </ActionList.Item>
258
+ </ActionList>
259
+ </ActionMenu.Overlay>
260
+ </ActionMenu>
261
+ )
262
+ ```
263
+
264
+ ## Props / API reference
265
+
266
+ ### ActionMenu
267
+
268
+ | Name | Type | Default | Description |
269
+ | :----------- | :----------------------------- | :-----: | :----------------------------------------------------------------------------------------------------------------------- |
270
+ | children\* | `React.ReactElement[]` | - | Required. Recommended: `ActionMenu.Button` or `ActionMenu.Anchor` with `ActionMenu.Overlay` |
271
+ | open | `boolean` | - | Optional. If defined, will control the open/closed state of the overlay. Must be used in conjuction with `onOpenChange`. |
272
+ | onOpenChange | `(open: boolean) => void` | - | Optional. If defined, will control the open/closed state of the overlay. Must be used in conjuction with `open`. |
273
+ | anchorRef | `React.RefObject<HTMLElement>` | - | Optional. Useful for defining an external anchor |
274
+
275
+ ### ActionMenu.Button
276
+
277
+ | Type | Default | Description |
278
+ | :-------------------------------------- | :-----: | :------------------------------------------------------------------------------------------------------------------- |
279
+ | [ButtonProps](/Buttons#component-props) | - | Optional. You can pass all of the props that you would pass to a [`Button`](/Buttons) component like `variant`, `sx` |
280
+
281
+ ### ActionMenu.Anchor
282
+
283
+ | Name | Type | Default | Description |
284
+ | :--------- | :------------------- | :-----: | :-------------------------------- |
285
+ | children\* | `React.ReactElement` | - | Required. Accepts a single child. |
286
+
287
+ ### ActionMenu.Overlay
288
+
289
+ | Name | Type | Default | Description |
290
+ | :--------------------------------------- | :-------------------- | :-----------------: | :-------------------------------------------------------------------------------------------- |
291
+ | children\* | `React.ReactElement[] | React.ReactElement` | Required. Recommended: [`ActionList`](/drafts/ActionList2) |
292
+ | [OverlayProps](/Overlay#component-props) | - | - | Optional. Props to be spread on the internal [`AnchoredOverlay`](/AnchoredOverlay) component. |
293
+
294
+ ## Further reading
295
+
296
+ [Interface guidelines: Action List + Menu](https://primer.style/design/components/action-list)
297
+
298
+ ## Related components
299
+
300
+ - [ActionList](/drafts/ActionList2)
301
+ - [DropdownMenu](/DropdownMenu)
302
+ - [SelectPanel](/SelectPanel)
@@ -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,
@@ -1,9 +1,22 @@
1
- import {Box} from '@primer/components'
1
+ import {Box, Link} from '@primer/components'
2
+ import InlineCode from '@primer/gatsby-theme-doctocat/src/components/inline-code'
2
3
  import {ComponentChecklist} from '../../component-checklist'
3
4
  import {Props} from '../../props'
5
+ import {PropsTable} from '../../props-table'
4
6
 
5
7
  export default {
6
8
  Box,
9
+ Link,
10
+ InlineCode,
7
11
  ComponentChecklist,
8
- Props
12
+ Props,
13
+ PropsTable,
14
+ // HACK: MDX doesn't support rendering subcomponents with dot notation
15
+ // so we need to alias them
16
+ PropsTableRow: PropsTable.Row,
17
+ PropsTableBasePropRows: PropsTable.BasePropRows,
18
+ PropsTablePassthroughPropsRow: PropsTable.PassthroughPropsRow,
19
+ PropsTableAsRow: PropsTable.AsRow,
20
+ PropsTableRefRow: PropsTable.RefRow,
21
+ PropsTableSxRow: PropsTable.SxRow
9
22
  }
@@ -39,6 +39,8 @@
39
39
  url: /Autocomplete
40
40
  - title: Avatar
41
41
  url: /Avatar
42
+ - title: AvatarPair
43
+ url: /AvatarPair
42
44
  - title: AvatarStack
43
45
  url: /AvatarStack
44
46
  - title: Box
@@ -95,6 +97,8 @@
95
97
  # url: /Portal
96
98
  - title: ProgressBar
97
99
  url: /ProgressBar
100
+ - title: Radio
101
+ url: /Radio
98
102
  - title: SelectMenu
99
103
  url: /SelectMenu
100
104
  - title: SideNav
@@ -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>
@@ -0,0 +1,165 @@
1
+ import React from 'react'
2
+ import {Box, Link, Label} from '@primer/components'
3
+ import Table from '@primer/gatsby-theme-doctocat/src/components/table'
4
+ import InlineCode from '@primer/gatsby-theme-doctocat/src/components/inline-code'
5
+
6
+ function PropsTable({children}) {
7
+ return (
8
+ <Table>
9
+ <colgroup>
10
+ <col style={{width: '20%'}} />
11
+ <col style={{width: '30%'}} />
12
+ <col style={{width: '10%'}} />
13
+ <col style={{width: '40%'}} />
14
+ </colgroup>
15
+ <thead>
16
+ <tr>
17
+ <Box as="th" textAlign="left">
18
+ Name
19
+ </Box>
20
+ <Box as="th" textAlign="left">
21
+ Type
22
+ </Box>
23
+ <Box as="th" textAlign="left">
24
+ Default
25
+ </Box>
26
+ <Box as="th" textAlign="left">
27
+ Description
28
+ </Box>
29
+ </tr>
30
+ </thead>
31
+ <tbody>{children}</tbody>
32
+ </Table>
33
+ )
34
+ }
35
+
36
+ function Row({name, type, defaultValue, description, required, deprecated}) {
37
+ return (
38
+ <tr>
39
+ <Box as="td" fontFamily="mono" fontSize={1} sx={{whiteSpace: 'nowrap'}} verticalAlign="top">
40
+ {name}
41
+ {required ? (
42
+ <>
43
+ {` `}
44
+ <Label outline sx={{verticalAlign: 'middle', fontFamily: 'normal'}}>
45
+ Required
46
+ </Label>
47
+ </>
48
+ ) : null}
49
+ {deprecated ? (
50
+ <>
51
+ {` `}
52
+ <Label
53
+ outline
54
+ sx={{verticalAlign: 'middle', fontFamily: 'normal', color: 'danger.fg', borderColor: 'danger.emphasis'}}
55
+ >
56
+ Deprecated
57
+ </Label>
58
+ </>
59
+ ) : null}
60
+ </Box>
61
+ <Box as="td" fontFamily="mono" fontSize={1} verticalAlign="top">
62
+ <Box as="pre" fontFamily="inherit" fontSize="inherit" margin={0} sx={{whiteSpace: 'pre-wrap'}}>
63
+ {type}
64
+ </Box>
65
+ </Box>
66
+ <Box as="td" fontFamily="mono" fontSize={1} verticalAlign="top">
67
+ {defaultValue}
68
+ </Box>
69
+ <Box as="td" verticalAlign="top">
70
+ {description}
71
+ </Box>
72
+ </tr>
73
+ )
74
+ }
75
+
76
+ function BasePropRows({passthroughPropsLink, elementType, isPolymorphic, refType}) {
77
+ return (
78
+ <>
79
+ <SxRow />
80
+ {isPolymorphic && <AsRow defaultElementType={elementType} />}
81
+ <RefRow refType={refType} isPolymorphic={isPolymorphic} />
82
+ <PassthroughPropsRow
83
+ passthroughPropsLink={passthroughPropsLink}
84
+ elementName={elementType}
85
+ isPolymorphic={isPolymorphic}
86
+ />
87
+ </>
88
+ )
89
+ }
90
+
91
+ function PassthroughPropsRow({elementName, isPolymorphic, passthroughPropsLink}) {
92
+ return (
93
+ <tr>
94
+ <Box as="td" colSpan={4} fontSize={1} verticalAlign="top">
95
+ Additional props are passed to the <InlineCode>&lt;{elementName}&gt;</InlineCode> element. See{' '}
96
+ {passthroughPropsLink} for a list of props accepted by the <InlineCode>&lt;{elementName}&gt;</InlineCode>{' '}
97
+ element.
98
+ {isPolymorphic && (
99
+ <>
100
+ {' '}
101
+ If an <InlineCode>as</InlineCode> prop is specified, the accepted props will change accordingly.
102
+ </>
103
+ )}
104
+ </Box>
105
+ </tr>
106
+ )
107
+ }
108
+
109
+ function AsRow({defaultElementType}) {
110
+ return (
111
+ <Row
112
+ name="as"
113
+ defaultValue={`"${defaultElementType}"`}
114
+ type={
115
+ <Link href="https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L73">
116
+ React.ElementType
117
+ </Link>
118
+ }
119
+ description="The underlying element to render — either a HTML element name or a React component."
120
+ />
121
+ )
122
+ }
123
+
124
+ function RefRow({refType, isPolymorphic}) {
125
+ return (
126
+ <Row
127
+ name="ref"
128
+ type={`React.RefObject<${refType}>`}
129
+ description={
130
+ <>
131
+ A ref to the element rendered by this component.
132
+ {isPolymorphic && (
133
+ <>
134
+ {' '}
135
+ Because this component is polymorphic, the type will vary based on the value of the{' '}
136
+ <InlineCode>as</InlineCode> prop.
137
+ </>
138
+ )}
139
+ </>
140
+ }
141
+ />
142
+ )
143
+ }
144
+
145
+ function SxRow() {
146
+ return (
147
+ <Row
148
+ name="sx"
149
+ type={
150
+ <Link href="https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/styled-system__css/index.d.ts#L407">
151
+ SystemStyleObject
152
+ </Link>
153
+ }
154
+ description={
155
+ <>
156
+ Style overrides to apply to the component. See also <Link href="/overriding-styles">overriding styles</Link>.
157
+ </>
158
+ }
159
+ />
160
+ )
161
+ }
162
+
163
+ Object.assign(PropsTable, {Row, BasePropRows, AsRow, RefRow, PassthroughPropsRow, SxRow})
164
+
165
+ export {PropsTable}
package/docs/src/props.js CHANGED
@@ -1,10 +1,9 @@
1
- import {Flash, Label} from '@primer/components'
1
+ import {Flash} from '@primer/components'
2
2
  import {H3} from '@primer/gatsby-theme-doctocat/src/components/heading'
3
- import InlineCode from '@primer/gatsby-theme-doctocat/src/components/inline-code'
4
3
  import Paragraph from '@primer/gatsby-theme-doctocat/src/components/paragraph'
5
- import Table from '@primer/gatsby-theme-doctocat/src/components/table'
6
4
  import {graphql, useStaticQuery} from 'gatsby'
7
5
  import React from 'react'
6
+ import {PropsTable} from './props-table'
8
7
 
9
8
  /** Render prop documentation for the given component */
10
9
  export function Props({of}) {
@@ -44,31 +43,18 @@ export function Props({of}) {
44
43
  <>
45
44
  <H3>{component.name}</H3>
46
45
  {component.props.length > 0 ? (
47
- <Table>
48
- <thead>
49
- <tr>
50
- <th align="left">Prop</th>
51
- <th align="left">Type</th>
52
- <th align="left">Default</th>
53
- <th align="left">Description</th>
54
- </tr>
55
- </thead>
56
- <tbody>
57
- {component.props.map(prop => (
58
- <tr key={prop.name}>
59
- <td style={{whiteSpace: 'nowrap'}}>
60
- <InlineCode>{prop.name}</InlineCode>{' '}
61
- {prop.required ? <Label style={{verticalAlign: 'text-top'}}>Required</Label> : null}
62
- </td>
63
- <td>
64
- <InlineCode>{prop.type}</InlineCode>
65
- </td>
66
- <td>{prop.defaultValue ? <InlineCode>{prop.defaultValue}</InlineCode> : '–'}</td>
67
- <td>{prop.description}</td>
68
- </tr>
69
- ))}
70
- </tbody>
71
- </Table>
46
+ <PropsTable>
47
+ {component.props.map(prop => (
48
+ <PropsTable.Row
49
+ key={prop.name}
50
+ required={prop.required}
51
+ name={prop.name}
52
+ defaultValue={prop.defaultValue}
53
+ type={prop.type}
54
+ description={prop.description}
55
+ />
56
+ ))}
57
+ </PropsTable>
72
58
  ) : (
73
59
  <Paragraph>No props</Paragraph>
74
60
  )}
@@ -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);