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

Sign up to get free protection for your applications and to get access to all the features.
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
package/tsconfig.json CHANGED
@@ -16,5 +16,5 @@
16
16
  "forceConsistentCasingInFileNames": true,
17
17
  "typeRoots": ["./node_modules/@types", "./@types"]
18
18
  },
19
- "include": ["@types/**/*.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.tsx"]
19
+ "include": ["@types/**/*.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.tsx", "script/**/*.ts"]
20
20
  }
@@ -1,379 +0,0 @@
1
- ---
2
- title: ActionList v2
3
- status: Alpha
4
- source: https://github.com/primer/react/tree/main/src/ActionList2
5
- storybook: '/react/storybook?path=/story/composite-components-actionlist2'
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
- ---
8
-
9
- import {BorderBox, Avatar} from '@primer/components'
10
- import {ActionList} from '@primer/components/drafts'
11
- import {ComponentChecklist} from '../src/component-checklist'
12
-
13
- import {ImageContainer} from '@primer/gatsby-theme-doctocat'
14
- import {LinkIcon, AlertIcon, ArrowRightIcon} from '@primer/octicons-react'
15
-
16
- <br />
17
-
18
- <BorderBox sx={{padding: 6}}>
19
- <ActionList sx={{width: 320}}>
20
- <ActionList.Item>
21
- <ActionList.LeadingVisual>
22
- <LinkIcon />
23
- </ActionList.LeadingVisual>
24
- github.com/primer
25
- <ActionList.Description variant="block">
26
- A React implementation of GitHub's Primer Design System
27
- </ActionList.Description>
28
- </ActionList.Item>
29
- <ActionList.Item>
30
- <ActionList.LeadingVisual>
31
- <Avatar src="https://github.com/mona.png" />
32
- </ActionList.LeadingVisual>
33
- mona
34
- <ActionList.Description>Monalisa Octocat</ActionList.Description>
35
- </ActionList.Item>
36
- <ActionList.Item variant="danger">
37
- <ActionList.LeadingVisual>
38
- <AlertIcon />
39
- </ActionList.LeadingVisual>
40
- 4 vulnerabilities
41
- <ActionList.TrailingVisual>
42
- <ArrowRightIcon />
43
- </ActionList.TrailingVisual>
44
- </ActionList.Item>
45
- </ActionList>
46
- </BorderBox>
47
-
48
- <br />
49
-
50
- ```js
51
- import {ActionList} from '@primer/components/drafts'
52
- ```
53
-
54
- <br />
55
-
56
- ## Examples
57
-
58
- ### Minimal example
59
-
60
- ```javascript live noinline
61
- // import {ActionList} from '@primer/components/drafts'
62
- const {ActionList} = drafts // ignore docs silliness; import like that ↑
63
-
64
- render(
65
- <ActionList>
66
- <ActionList.Item>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
- )
73
- ```
74
-
75
- <br />
76
-
77
- ### With leading visual
78
-
79
- Leading visuals are optional and appear at the start of an item. They can be octicons, avatars, and other custom visuals that fit a small area.
80
-
81
- <!-- prettier-ignore -->
82
- ```javascript live noinline
83
- // import {ActionList} from '@primer/components/drafts'
84
- const {ActionList} = drafts // ignore docs silliness; import like that ↑
85
-
86
- render(
87
- <ActionList>
88
- <ActionList.Item>
89
- <ActionList.LeadingVisual><LinkIcon /></ActionList.LeadingVisual>
90
- github.com/primer
91
- </ActionList.Item>
92
- <ActionList.Item variant="danger">
93
- <ActionList.LeadingVisual><AlertIcon /></ActionList.LeadingVisual>
94
- 4 vulnerabilities
95
- </ActionList.Item>
96
- <ActionList.Item>
97
- <ActionList.LeadingVisual><Avatar src="https://github.com/mona.png" /></ActionList.LeadingVisual>
98
- mona
99
- </ActionList.Item>
100
- </ActionList>
101
- )
102
- ```
103
-
104
- <br />
105
-
106
- ### With trailing visual
107
-
108
- Trailing visual and trailing text can display auxiliary information. They're placed at the right of the item, and can denote status, keyboard shortcuts, or be used to set expectations about what the action does.
109
-
110
- ```javascript live noinline
111
- // import {ActionList} from '@primer/components/drafts'
112
- const {ActionList} = drafts // ignore docs silliness; import like that ↑
113
-
114
- render(
115
- <ActionList>
116
- <ActionList.Item>
117
- New file
118
- <ActionList.TrailingVisual>⌘ + N</ActionList.TrailingVisual>
119
- </ActionList.Item>
120
- <ActionList.Item>
121
- Copy link
122
- <ActionList.TrailingVisual>⌘ + C</ActionList.TrailingVisual>
123
- </ActionList.Item>
124
- <ActionList.Item>
125
- Edit file
126
- <ActionList.TrailingVisual>⌘ + E</ActionList.TrailingVisual>
127
- </ActionList.Item>
128
- <ActionList.Item variant="danger">
129
- Delete file
130
- <ActionList.TrailingVisual>⌫</ActionList.TrailingVisual>
131
- </ActionList.Item>
132
- </ActionList>
133
- )
134
- ```
135
-
136
- <br />
137
-
138
- ### With description and dividers
139
-
140
- Item dividers allow users to parse heavier amounts of information. They're placed between items and are useful in complex lists, particularly when descriptions or multi-line text is present.
141
-
142
- ```javascript live noinline
143
- // import {ActionList} from '@primer/components/drafts'
144
- const {ActionList} = drafts // ignore docs silliness; import like that ↑
145
-
146
- render(
147
- <ActionList showDividers>
148
- <ActionList.Item>
149
- <ActionList.LeadingVisual>
150
- <Avatar src="https://github.com/mona.png" />
151
- </ActionList.LeadingVisual>
152
- mona
153
- <ActionList.Description>Monalisa Octocat</ActionList.Description>
154
- </ActionList.Item>
155
- <ActionList.Item>
156
- <ActionList.LeadingVisual>
157
- <Avatar src="https://github.com/hubot.png" />
158
- </ActionList.LeadingVisual>
159
- hubot
160
- <ActionList.Description>Hubot</ActionList.Description>
161
- </ActionList.Item>
162
- <ActionList.Item>
163
- <ActionList.LeadingVisual>
164
- <Avatar src="https://github.com/primer-css.png" />
165
- </ActionList.LeadingVisual>
166
- primer-css
167
- <ActionList.Description>GitHub Design Systems Bot</ActionList.Description>
168
- </ActionList.Item>
169
- </ActionList>
170
- )
171
- ```
172
-
173
- ### With links
174
-
175
- When you want to add links to the List instead of actions, use `ActionList.LinkItem`
176
-
177
- <!-- prettier-ignore -->
178
- ```javascript live noinline
179
- // import {ActionList} from '@primer/components/drafts'
180
- const {ActionList} = drafts // ignore docs silliness; import like that ↑
181
-
182
- render(
183
- <ActionList>
184
- <ActionList.LinkItem href="https://github.com/primer">
185
- <ActionList.LeadingVisual>
186
- <LinkIcon />
187
- </ActionList.LeadingVisual>
188
- github/primer
189
- </ActionList.LinkItem>
190
- <ActionList.LinkItem as={ReactRouterLink} to="/">
191
- <ActionList.LeadingVisual>
192
- <LawIcon />
193
- </ActionList.LeadingVisual>
194
- MIT License
195
- </ActionList.LinkItem>
196
- <ActionList.LinkItem
197
- href="https://github.com/primer/react/stargazers"
198
- target="_blank"
199
- rel="noopener noreferrer"
200
- >
201
- <ActionList.LeadingVisual>
202
- <StarIcon />
203
- </ActionList.LeadingVisual>
204
- 1.4k stars
205
- </ActionList.LinkItem>
206
- </ActionList>
207
- )
208
- ```
209
-
210
- <br />
211
-
212
- ### With groups
213
-
214
- ```javascript live noinline
215
- // import {ActionList} from '@primer/components/drafts'
216
- const {ActionList} = drafts // ignore docs silliness; import like that ↑
217
-
218
- const SelectFields = () => {
219
- const [options, setOptions] = React.useState([
220
- {text: 'Status', selected: true},
221
- {text: 'Stage', selected: true},
222
- {text: 'Assignee', selected: true},
223
- {text: 'Team', selected: true},
224
- {text: 'Estimate', selected: false},
225
- {text: 'Due Date', selected: false}
226
- ])
227
-
228
- const visibleOptions = options.filter(option => option.selected)
229
- const hiddenOptions = options.filter(option => !option.selected)
230
-
231
- const toggle = text => {
232
- setOptions(
233
- options.map(option => {
234
- if (option.text === text) option.selected = !option.selected
235
- return option
236
- })
237
- )
238
- }
239
-
240
- return (
241
- <ActionList selectionVariant="multiple">
242
- <ActionList.Group title="Visible fields (can be reordered)">
243
- {visibleOptions.map(option => (
244
- <ActionList.Item key={option.text} selected={true} onSelect={() => toggle(option.text)}>
245
- {option.text}
246
- </ActionList.Item>
247
- ))}
248
- </ActionList.Group>
249
- <ActionList.Group
250
- title="Hidden fields"
251
- selectionVariant={
252
- /** selectionVariant override on Group: disable selection if there are no options */
253
- hiddenOptions.length ? 'multiple' : false
254
- }
255
- >
256
- {hiddenOptions.map((option, index) => (
257
- <ActionList.Item key={option.text} selected={false} onSelect={() => toggle(option.text)}>
258
- {option.text}
259
- </ActionList.Item>
260
- ))}
261
- {hiddenOptions.length === 0 && <ActionList.Item disabled>No hidden fields</ActionList.Item>}
262
- </ActionList.Group>
263
- </ActionList>
264
- )
265
- }
266
-
267
- render(<SelectFields />)
268
- ```
269
-
270
- <br />
271
-
272
- ## Props / API reference
273
-
274
- ### ActionList
275
-
276
- | Name | Type | Default | Description |
277
- | :--------------- | :------------------------------------------------------------------------------------------------ | :-----: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
278
- | children\* | `ActionList.Item[]` or ActionList.LinkItem[] or `ActionList.Group[]` | - | Required. |
279
- | variant | `'inset'` or `'full'` | 'inset' | Optional. Usage is discretionary, `inset` children are offset (vertically and horizontally) from `List`’s edges, `full` children are flush (vertically and horizontally) with `List` edges |
280
- | selectionVariant | `'single'` or `'multiple'` | - | Optional. Whether multiple Items or a single Item can be selected. |
281
- | showDivider | boolean | false | Optional. Display a divider above each `Item` in this `List` when it does not follow a `Header` or `Divider`. |
282
- | sx | sxProp | - | Optional. See guide to [Overriding styles](/overriding-styles) |
283
- | role | [AriaRole](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques#roles) | - | Optional. The ARIA role describing the function of `List` component. `listbox` or `menu` are a common values. |
284
-
285
- <br />
286
-
287
- ### ActionList.Item
288
-
289
- | Name | Type | Default | Description |
290
- | :--------- | :------------------------------------------------------------------------------------------------------------ | :---------: | :----------------------------------------------------------------------------------------------- |
291
- | children\* | one of [`React.ReactNode`, `ActionList.LeadingVisual`, `ActionList.Description`, `ActionList.TrailingVisual`] | - | Required. |
292
- | variant | `'default'` or `'danger'` | `'default'` | Optional. variant="danger" creates a destructive action `Item`. |
293
- | onSelect | Function | - | Optional. Callback that will trigger both on click selection and keyboard selection. |
294
- | selected | boolean | false | Optional. For `Item`s which can be selected, whether the `Item` is currently selected. |
295
- | disabled | boolean | false | Optional. Items that are disabled can not be clicked, selected, or navigated through. |
296
- | role | [AriaRole](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques#roles) | - | Optional. The ARIA role describing the function of `Item` component. `option` is a common value. |
297
- | sx | sxProp | - | Optional. See guide to [Overriding styles](/overriding-styles) |
298
-
299
- <br />
300
-
301
- ### ActionList.LinkItem
302
-
303
- | Name | Type | Default | Description |
304
- | :-------------------------------------------------- | :------------------------------------------------------------------------------------------------------------ | :-----: | :------------------------------------------------------------- |
305
- | children\* | one of [`React.ReactNode`, `ActionList.LeadingVisual`, `ActionList.Description`, `ActionList.TrailingVisual`] | - | Required. |
306
- | sx | sxProp | - | Optional. See guide to [Overriding styles](/overriding-styles) |
307
- | + AnchorHTMLAttributes like href, target, rel, etc. | | | |
308
-
309
- <br />
310
-
311
- ### ActionList.LeadingVisual
312
-
313
- | Name | Type | Default | Description |
314
- | :--------- | :------------------ | :-----: | :------------------------------------------------------------- |
315
- | children\* | `React.ReactNode` - | - | Required. Icon (or similar) positioned before `Item` text. |
316
- | sx | sxProp | - | Optional. See guide to [Overriding styles](/overriding-styles) |
317
-
318
- ### ActionList.TrailingVisual
319
-
320
- | Name | Type | Default | Description |
321
- | :--------- | :------------------ | :-----: | :------------------------------------------------------------- |
322
- | children\* | `React.ReactNode` - | - | Required. Visual positioned after `Item` text. |
323
- | sx | sxProp | - | Optional. See guide to [Overriding styles](/overriding-styles) |
324
-
325
- <br />
326
-
327
- ### ActionList.Description
328
-
329
- | Name | Type | Default | Description |
330
- | :--------- | :---------------------- | :--------: | :-------------------------------------------------------------------------------------------------------------------------------- |
331
- | children\* | `React.ReactNode` - | - | Required. Visual positioned after `Item` text. |
332
- | variant | `'inline'` or `'block'` | `'inline'` | Optional. `"inline"` secondary text is positioned beside primary text. `"block"` secondary text is positioned below primary text. |
333
- | sx | sxProp | - | Optional. See guide to [Overriding styles](/overriding-styles) |
334
-
335
- <br />
336
-
337
- ### ActionList.Group
338
-
339
- | Name | Type | Default | Description |
340
- | :--------------- | :------------------------------------------------------------------------------------------------ | :--------: | :--------------------------------------------------------------------------------------------------------------------------------------- |
341
- | children\* | `ActionList.Item[] or ActionList.LinkItem[]` | - | Required. |
342
- | title | string | - | Optional. Primary text which names a `Group` |
343
- | auxiliaryText | string | - | Optional. Secondary text which provides additional information about a `Group`. |
344
- | variant | `'filled'` or `'subtle'` | `'subtle'` | Optional. `"filled"` - Superimposed on a background, offset from nearby content, `"subtle"` - Relatively less offset from nearby content |
345
- | selectionVariant | `'single'` or `'multiple'` or `false` | - | Optional. Set `selectionVariant` at the group level |
346
- | role | [AriaRole](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques#roles) | - | Optional. \* The ARIA role describing the function of the list inside `Group` component. `listbox` or `menu` are a common values. |
347
-
348
- <br />
349
-
350
- ## Further reading
351
-
352
- - [Interface guidelines: Action List](https://primer.style/design/components/action-list)
353
-
354
- <br />
355
-
356
- ## Related components
357
-
358
- - [ActionMenu](/ActionMenu)
359
- - [SelectPanel](/SelectPanel)
360
-
361
- ## Component status
362
-
363
- <ComponentChecklist
364
- items={{
365
- propsDocumented: true,
366
- noUnnecessaryDeps: true,
367
- adaptsToThemes: true,
368
- adaptsToScreenSizes: true,
369
- fullTestCoverage: false,
370
- usedInProduction: false,
371
- usageExamplesDocumented: true,
372
- designReviewed: false,
373
- a11yReviewed: false,
374
- stableApi: false,
375
- addressedApiFeedback: false,
376
- hasDesignGuidelines: true,
377
- hasFigmaComponent: true
378
- }}
379
- />
@@ -1,39 +0,0 @@
1
- ---
2
- title: BranchName
3
- status: Alpha
4
- source: https://github.com/primer/react/blob/main/src/BranchName.tsx
5
- ---
6
-
7
- BranchName is a label-type component rendered as an `<a>` tag by default with monospace font.
8
-
9
- ```jsx live
10
- <BranchName>a_new_feature_branch</BranchName>
11
- ```
12
-
13
- ## Props
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 |
19
- | sx | SystemStyleObject | {} | Style to be applied to the component |
20
-
21
- ## Component status
22
-
23
- <ComponentChecklist
24
- items={{
25
- propsDocumented: true,
26
- noUnnecessaryDeps: true,
27
- adaptsToThemes: true,
28
- adaptsToScreenSizes: true,
29
- fullTestCoverage: true,
30
- usedInProduction: false,
31
- usageExamplesDocumented: true,
32
- designReviewed: false,
33
- a11yReviewed: false,
34
- stableApi: false,
35
- addressedApiFeedback: false,
36
- hasDesignGuidelines: false,
37
- hasFigmaComponent: false
38
- }}
39
- />
@@ -1,29 +0,0 @@
1
- ---
2
- title: Link
3
- status: Alpha
4
- ---
5
-
6
- The Link component styles anchor tags with default hyperlink color cues and hover text decoration. `Link` is used for destinations, or moving from one page to another.
7
-
8
- In special cases where you'd like a `<button>` styled like a `Link`, use `<Link as='button'>`. Make sure to provide a click handler with `onClick`.
9
-
10
- **Important:** When using the `as` prop, be sure to always render an accessible element type, like `a`, `button`, `input`, or `summary`.
11
-
12
- ## Default example
13
-
14
- ```jsx live
15
- <Link sx={{mb: 1}} href="https://github.com">
16
- Link
17
- </Link>
18
- ```
19
-
20
- ## Component props
21
-
22
- | Name | Type | Default | Description |
23
- | :--------- | :---------------- | :-----: | :------------------------------------------------------------------------------ |
24
- | href | String | | URL to be used for the Link |
25
- | muted | Boolean | false | Uses a less prominent shade for Link color, and the default link shade on hover |
26
- | underline | Boolean | false | Adds underline to the Link |
27
- | as | String | 'a' | Can be 'a', 'button', 'input', or 'summary' |
28
- | hoverColor | String | | Color used when hovering over link |
29
- | sx | SystemStyleObject | {} | Style to be applied to the component |
@@ -1,42 +0,0 @@
1
- ---
2
- title: TextInput
3
- status: Alpha
4
- ---
5
-
6
- TextInput is a form component to add default styling to the native text input.
7
-
8
- **Note:** Don't forget to set `aria-label` to make the TextInput accessible to screen reader users.
9
-
10
- ## Default example
11
-
12
- ```jsx live
13
- <>
14
- <TextInput aria-label="Zipcode" name="zipcode" placeholder="Zipcode" autoComplete="postal-code" />
15
-
16
- <TextInput sx={{ml: 4}} aria-label="City" name="city" placeholder="City" contrast />
17
-
18
- <TextInput
19
- sx={{ml: 4}}
20
- icon={SearchIcon}
21
- aria-label="Zipcode"
22
- name="zipcode"
23
- placeholder="Find user"
24
- autoComplete="postal-code"
25
- />
26
- </>
27
- ```
28
-
29
- ## Component props
30
-
31
- Native `<input>` attributes are forwarded to the underlying React `input` component and are not listed below.
32
-
33
- | Name | Type | Default | Description |
34
- | :--------- | :------------------------------------------------------------------------ | :-----: | :------------------------------------------------------------------------------------ |
35
- | aria-label | String | | Required. Allows input to be accessible. |
36
- | block | Boolean | | Adds `display: block` to element |
37
- | contrast | Boolean | | Changes background color to a higher contrast color |
38
- | variant | String | | Can be either `small` or `large`. Creates a smaller or larger input than the default. |
39
- | width | String or Number | | Set the width of the input |
40
- | maxWidth | String or Number or [Array](https://styled-system.com/guides/array-props) | | Set the maximum width of the input |
41
- | minWidth | String or Number or [Array](https://styled-system.com/guides/array-props) | | Set the minimum width of the input |
42
- | icon | Node (pass Octicon react component) | | Icon to be used inside of input. Positioned on the left edge. |