@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.
- package/.devcontainer/devcontainer.json +1 -1
- package/.github/workflows/ci.yml +1 -1
- package/.github/workflows/release.yml +6 -27
- package/.github/workflows/release_canary.yml +4 -60
- package/.github/workflows/release_candidate.yml +5 -51
- package/.github/workflows/statuses.yml +32 -0
- package/.gitignore +1 -0
- package/.nvmrc +1 -1
- package/CHANGELOG.md +20 -0
- package/contributor-docs/CONTRIBUTING.md +14 -61
- package/dist/browser.esm.js +2 -2209
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +2 -2209
- package/dist/browser.umd.js.map +1 -1
- package/docs/content/AnchoredOverlay.mdx +121 -1
- package/docs/content/Avatar.mdx +29 -14
- package/docs/content/AvatarPair.mdx +47 -0
- package/docs/content/AvatarStack.mdx +14 -6
- package/docs/content/Box.mdx +13 -11
- package/docs/content/BranchName.mdx +52 -0
- package/docs/content/{Breadcrumbs.md → Breadcrumbs.mdx} +21 -13
- package/docs/content/Link.mdx +75 -0
- package/docs/content/Radio.md +90 -0
- package/docs/content/TextInput.mdx +125 -0
- package/docs/content/drafts/ActionList2.mdx +484 -0
- package/docs/content/drafts/ActionMenu2.mdx +302 -0
- package/docs/src/@primer/gatsby-theme-doctocat/live-code-scope.js +9 -1
- package/docs/src/@primer/gatsby-theme-doctocat/mdx-components.js +15 -2
- package/docs/src/@primer/gatsby-theme-doctocat/nav.yml +4 -0
- package/docs/src/component-checklist.js +10 -2
- package/docs/src/props-table.js +165 -0
- package/docs/src/props.js +14 -28
- package/lib/ActionList/Header.js +1 -1
- package/lib/ActionList/Item.js +10 -10
- package/lib/ActionList/List.js +1 -1
- package/lib/ActionList2/ActionListContainerContext.d.ts +10 -0
- package/lib/ActionList2/ActionListContainerContext.js +15 -0
- package/lib/ActionList2/Divider.d.ts +3 -2
- package/lib/ActionList2/Divider.js +10 -5
- package/lib/ActionList2/Item.js +22 -8
- package/lib/ActionList2/List.js +12 -2
- package/lib/ActionList2/Selection.js +11 -0
- package/lib/ActionList2/index.d.ts +1 -2
- package/lib/ActionMenu2.d.ts +317 -0
- package/lib/ActionMenu2.js +125 -0
- package/lib/Autocomplete/Autocomplete.d.ts +2 -1
- package/lib/Autocomplete/AutocompleteInput.d.ts +2 -1
- package/lib/BaseStyles.js +2 -20
- package/lib/BorderBox.js +1 -1
- package/lib/Box.js +1 -1
- package/lib/BranchName.js +1 -1
- package/lib/Breadcrumbs.js +3 -3
- package/lib/Button/Button.d.ts +2 -2
- package/lib/Button/Button.js +1 -1
- package/lib/Button/ButtonClose.d.ts +2 -2
- package/lib/Button/ButtonDanger.d.ts +2 -2
- package/lib/Button/ButtonGroup.js +1 -1
- package/lib/Button/ButtonInvisible.d.ts +2 -2
- package/lib/Button/ButtonOutline.d.ts +2 -2
- package/lib/Button/ButtonPrimary.d.ts +2 -2
- package/lib/Checkbox.d.ts +1 -1
- package/lib/Checkbox.js +1 -1
- package/lib/CircleOcticon.d.ts +35 -35
- package/lib/Details.js +1 -1
- package/lib/Dialog.d.ts +37 -37
- package/lib/Dropdown.d.ts +6 -6
- package/lib/DropdownMenu/DropdownButton.d.ts +6 -3
- package/lib/FilterList.d.ts +1 -1
- package/lib/FilteredActionList/FilteredActionList.js +1 -1
- package/lib/Flex.js +1 -1
- package/lib/LabelGroup.js +1 -1
- package/lib/Overlay.js +1 -1
- package/lib/Pagination/Pagination.js +2 -2
- package/lib/Position.d.ts +4 -4
- package/lib/Position.js +1 -1
- package/lib/Radio.d.ts +38 -0
- package/lib/Radio.js +55 -0
- package/lib/SelectMenu/SelectMenu.d.ts +11 -10
- package/lib/SelectMenu/SelectMenu.js +1 -1
- package/lib/SelectMenu/SelectMenuFilter.js +1 -1
- package/lib/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuItem.js +1 -1
- package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuTab.js +1 -1
- package/lib/SelectMenu/SelectMenuTabPanel.js +1 -1
- package/lib/SelectMenu/SelectMenuTabs.js +1 -1
- package/lib/StateLabel.js +1 -1
- package/lib/StyledOcticon.js +1 -1
- package/lib/SubNav.js +3 -3
- package/lib/TextInputWithTokens.d.ts +2 -1
- package/lib/ThemeProvider.d.ts +1 -0
- package/lib/ThemeProvider.js +17 -4
- package/lib/Timeline.js +4 -4
- package/lib/Token/AvatarToken.d.ts +1 -1
- package/lib/Token/AvatarToken.js +1 -1
- package/lib/Token/IssueLabelToken.d.ts +1 -1
- package/lib/Token/Token.d.ts +1 -1
- package/lib/Token/TokenBase.js +1 -1
- package/lib/Tooltip.js +1 -1
- package/lib/UnderlineNav.js +2 -2
- package/lib/__tests__/Radio.test.d.ts +2 -0
- package/lib/__tests__/Radio.test.js +202 -0
- package/lib/__tests__/ThemeProvider.test.js +114 -0
- package/lib/drafts.d.ts +1 -0
- package/lib/drafts.js +13 -0
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +9 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +8 -0
- package/lib/stories/ActionList.stories.js +3 -3
- package/lib/stories/ActionList2.stories.js +1 -1
- package/lib/stories/ActionMenu2.stories.js +455 -0
- package/lib/stories/Checkbox.stories.js +4 -4
- package/lib/stories/Radio.stories.js +146 -0
- package/lib/stories/ThemeProvider.stories.js +1 -5
- package/lib/stories/useFocusTrap.stories.js +1 -11
- package/lib/stories/useFocusZone.stories.js +2 -6
- package/lib-esm/ActionList/Header.js +1 -1
- package/lib-esm/ActionList/Item.js +10 -10
- package/lib-esm/ActionList/List.js +1 -1
- package/lib-esm/ActionList2/ActionListContainerContext.d.ts +10 -0
- package/lib-esm/ActionList2/ActionListContainerContext.js +3 -0
- package/lib-esm/ActionList2/Divider.d.ts +3 -2
- package/lib-esm/ActionList2/Divider.js +8 -5
- package/lib-esm/ActionList2/Item.js +20 -8
- package/lib-esm/ActionList2/List.js +10 -2
- package/lib-esm/ActionList2/Selection.js +9 -0
- package/lib-esm/ActionList2/index.d.ts +1 -2
- package/lib-esm/ActionMenu2.d.ts +317 -0
- package/lib-esm/ActionMenu2.js +100 -0
- package/lib-esm/Autocomplete/Autocomplete.d.ts +2 -1
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +2 -1
- package/lib-esm/BaseStyles.js +2 -20
- package/lib-esm/BorderBox.js +1 -1
- package/lib-esm/Box.js +1 -1
- package/lib-esm/BranchName.js +1 -1
- package/lib-esm/Breadcrumbs.js +3 -3
- package/lib-esm/Button/Button.d.ts +2 -2
- package/lib-esm/Button/Button.js +1 -1
- package/lib-esm/Button/ButtonClose.d.ts +2 -2
- package/lib-esm/Button/ButtonDanger.d.ts +2 -2
- package/lib-esm/Button/ButtonGroup.js +1 -1
- package/lib-esm/Button/ButtonInvisible.d.ts +2 -2
- package/lib-esm/Button/ButtonOutline.d.ts +2 -2
- package/lib-esm/Button/ButtonPrimary.d.ts +2 -2
- package/lib-esm/Checkbox.d.ts +1 -1
- package/lib-esm/Checkbox.js +1 -1
- package/lib-esm/CircleOcticon.d.ts +35 -35
- package/lib-esm/Details.js +1 -1
- package/lib-esm/Dialog.d.ts +37 -37
- package/lib-esm/Dropdown.d.ts +6 -6
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +6 -3
- package/lib-esm/FilterList.d.ts +1 -1
- package/lib-esm/FilteredActionList/FilteredActionList.js +1 -1
- package/lib-esm/Flex.js +1 -1
- package/lib-esm/LabelGroup.js +1 -1
- package/lib-esm/Overlay.js +1 -1
- package/lib-esm/Pagination/Pagination.js +2 -2
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/Position.js +1 -1
- package/lib-esm/Radio.d.ts +38 -0
- package/lib-esm/Radio.js +40 -0
- package/lib-esm/SelectMenu/SelectMenu.d.ts +11 -10
- package/lib-esm/SelectMenu/SelectMenu.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuFilter.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuItem.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuTabPanel.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuTabs.js +1 -1
- package/lib-esm/StateLabel.js +1 -1
- package/lib-esm/StyledOcticon.js +1 -1
- package/lib-esm/SubNav.js +3 -3
- package/lib-esm/TextInputWithTokens.d.ts +2 -1
- package/lib-esm/ThemeProvider.d.ts +1 -0
- package/lib-esm/ThemeProvider.js +17 -4
- package/lib-esm/Timeline.js +4 -4
- package/lib-esm/Token/AvatarToken.d.ts +1 -1
- package/lib-esm/Token/AvatarToken.js +1 -1
- package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
- package/lib-esm/Token/Token.d.ts +1 -1
- package/lib-esm/Token/TokenBase.js +1 -1
- package/lib-esm/Tooltip.js +1 -1
- package/lib-esm/UnderlineNav.js +2 -2
- package/lib-esm/__tests__/Radio.test.d.ts +2 -0
- package/lib-esm/__tests__/Radio.test.js +183 -0
- package/lib-esm/__tests__/ThemeProvider.test.js +114 -0
- package/lib-esm/drafts.d.ts +1 -0
- package/lib-esm/drafts.js +2 -1
- package/lib-esm/hooks/index.d.ts +1 -0
- package/lib-esm/hooks/index.js +2 -1
- package/lib-esm/index.d.ts +2 -0
- package/lib-esm/index.js +1 -0
- package/lib-esm/stories/ActionList.stories.js +3 -3
- package/lib-esm/stories/ActionList2.stories.js +1 -1
- package/lib-esm/stories/ActionMenu2.stories.js +393 -0
- package/lib-esm/stories/Checkbox.stories.js +5 -5
- package/lib-esm/stories/Radio.stories.js +121 -0
- package/lib-esm/stories/ThemeProvider.stories.js +1 -5
- package/lib-esm/stories/useFocusTrap.stories.js +1 -11
- package/lib-esm/stories/useFocusZone.stories.js +2 -6
- package/package-lock.json +1366 -3544
- package/package.json +14 -8
- package/script/component-status-project/build.ts +100 -0
- package/script/component-status-project/deploy.rb +142 -0
- package/src/ActionList2/ActionListContainerContext.tsx +14 -0
- package/src/ActionList2/Divider.tsx +13 -8
- package/src/ActionList2/Item.tsx +14 -6
- package/src/ActionList2/List.tsx +6 -2
- package/src/ActionList2/Selection.tsx +9 -0
- package/src/ActionMenu2.tsx +116 -0
- package/src/BranchName.tsx +2 -1
- package/src/Radio.tsx +76 -0
- package/src/ThemeProvider.tsx +22 -5
- package/src/__tests__/Radio.test.tsx +174 -0
- package/src/__tests__/ThemeProvider.test.tsx +116 -0
- package/src/__tests__/__snapshots__/BranchName.test.tsx.snap +3 -1
- package/src/__tests__/__snapshots__/Radio.test.tsx.snap +16 -0
- package/src/drafts.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/index.ts +2 -0
- package/src/stories/ActionMenu2.stories.tsx +605 -0
- package/src/stories/Checkbox.stories.tsx +1 -3
- package/src/stories/Radio.stories.tsx +126 -0
- package/stats.html +1 -1
- package/tsconfig.build.json +1 -1
- package/tsconfig.json +1 -1
- package/docs/content/ActionList2.mdx +0 -379
- package/docs/content/BranchName.md +0 -39
- package/docs/content/Link.md +0 -29
- package/docs/content/TextInput.md +0 -42
@@ -1,6 +1,8 @@
|
|
1
1
|
---
|
2
2
|
title: AnchoredOverlay
|
3
3
|
status: Alpha
|
4
|
+
source: https://github.com/primer/react/blob/main/src/AnchoredOverlay/AnchoredOverlay.tsx
|
5
|
+
storybook: https://primer.style/react/storybook?path=/story/generic-behaviors-anchoredoverlay--default-portal
|
4
6
|
---
|
5
7
|
|
6
8
|
An `AnchoredOverlay` provides an anchor that will open a floating overlay positioned relative to the anchor.
|
@@ -8,7 +10,7 @@ The overlay can be opened and navigated using keyboard or mouse.
|
|
8
10
|
|
9
11
|
See also [Overlay positioning](/Overlay#positioning).
|
10
12
|
|
11
|
-
##
|
13
|
+
## Examples
|
12
14
|
|
13
15
|
```jsx live
|
14
16
|
<State default={false}>
|
@@ -35,3 +37,121 @@ See also [Overlay positioning](/Overlay#positioning).
|
|
35
37
|
}}
|
36
38
|
</State>
|
37
39
|
```
|
40
|
+
|
41
|
+
## Props
|
42
|
+
|
43
|
+
<PropsTable>
|
44
|
+
<PropsTableRow
|
45
|
+
name="open"
|
46
|
+
type="boolean"
|
47
|
+
defaultValue="false"
|
48
|
+
description="Determines whether the overlay portion of the component should be shown or not."
|
49
|
+
/>
|
50
|
+
<PropsTableRow
|
51
|
+
name="onOpen"
|
52
|
+
type="(gesture: 'anchor-click' | 'anchor-key-press') => unknown"
|
53
|
+
description='A callback that is called whenever the overlay is currently closed and an "open gesture" is detected.'
|
54
|
+
/>
|
55
|
+
<PropsTableRow
|
56
|
+
name="onClose"
|
57
|
+
type="(gesture: 'anchor-click' | 'click-outside' | 'escape') => unknown"
|
58
|
+
description='A callback that is called whenever the overlay is currently open and a "close gesture" is detected.'
|
59
|
+
/>
|
60
|
+
<PropsTableRow
|
61
|
+
name="renderAnchor"
|
62
|
+
type="<T extends React.HTMLAttributes<HTMLElement>>(props: T) => JSX.Element"
|
63
|
+
description={
|
64
|
+
<>
|
65
|
+
A custom function component used to render the anchor element. When renderAnchor is null, an anchorRef is
|
66
|
+
required.
|
67
|
+
</>
|
68
|
+
}
|
69
|
+
/>
|
70
|
+
<PropsTableRow
|
71
|
+
name="anchorRef"
|
72
|
+
type="React.RefObject<HTMLElement>"
|
73
|
+
description={
|
74
|
+
<>
|
75
|
+
An override to the internal <InlineCode>renderAnchor</InlineCode> ref that will be used to position the overlay.
|
76
|
+
When <InlineCode>renderAnchor</InlineCode> is
|
77
|
+
<InlineCode>null</InlineCode>, this can be used to make an anchor that is detached from <InlineCode>
|
78
|
+
AnchoredOverlay
|
79
|
+
</InlineCode>.
|
80
|
+
</>
|
81
|
+
}
|
82
|
+
/>
|
83
|
+
<PropsTableRow
|
84
|
+
name="side"
|
85
|
+
type={`| 'inside-top'
|
86
|
+
| 'inside-bottom'
|
87
|
+
| 'inside-left'
|
88
|
+
| 'inside-right'
|
89
|
+
| 'inside-center'
|
90
|
+
| 'outside-top'
|
91
|
+
| 'outside-bottom'
|
92
|
+
| 'outside-left'
|
93
|
+
| 'outside-right'`}
|
94
|
+
defaultValue="'outside-bottom'"
|
95
|
+
/>
|
96
|
+
<PropsTableRow name="align" type="'start' | 'center' | 'end'" defaultValue="'start'" />
|
97
|
+
<PropsTableRow
|
98
|
+
name="overlayProps"
|
99
|
+
type={
|
100
|
+
<>
|
101
|
+
Partial<<Link href="/Overlay#props">OverlayProps</Link>>
|
102
|
+
</>
|
103
|
+
}
|
104
|
+
description={
|
105
|
+
<>
|
106
|
+
Props to be spread on the internal <InlineCode>Overlay</InlineCode> component.
|
107
|
+
</>
|
108
|
+
}
|
109
|
+
/>
|
110
|
+
<PropsTableRow
|
111
|
+
name="focusTrapSettings"
|
112
|
+
type={
|
113
|
+
<>
|
114
|
+
Partial<<Link href="/focusTrap#focustraphooksettings-interface">FocusTrapHookSettings</Link>>
|
115
|
+
</>
|
116
|
+
}
|
117
|
+
description={
|
118
|
+
<>
|
119
|
+
Settings to apply to the focus trap on the internal <InlineCode>Overlay</InlineCode> component.
|
120
|
+
</>
|
121
|
+
}
|
122
|
+
/>
|
123
|
+
<PropsTableRow
|
124
|
+
name="focusZoneSettings"
|
125
|
+
type={
|
126
|
+
<>
|
127
|
+
Partial<<Link href="/focusZone#focuszonehooksettings-interface">FocusZoneHookSettings</Link>>
|
128
|
+
</>
|
129
|
+
}
|
130
|
+
description={
|
131
|
+
<>
|
132
|
+
Settings to apply to the focus zone on the internal <InlineCode>Overlay</InlineCode> component.
|
133
|
+
</>
|
134
|
+
}
|
135
|
+
/>
|
136
|
+
</PropsTable>
|
137
|
+
|
138
|
+
## Status
|
139
|
+
|
140
|
+
<ComponentChecklist
|
141
|
+
items={{
|
142
|
+
propsDocumented: true,
|
143
|
+
noUnnecessaryDeps: true,
|
144
|
+
adaptsToThemes: true,
|
145
|
+
adaptsToScreenSizes: true,
|
146
|
+
fullTestCoverage: false,
|
147
|
+
usedInProduction: true,
|
148
|
+
usageExamplesDocumented: false,
|
149
|
+
hasStorybookStories: true,
|
150
|
+
designReviewed: false,
|
151
|
+
a11yReviewed: false,
|
152
|
+
stableApi: false,
|
153
|
+
addressedApiFeedback: false,
|
154
|
+
hasDesignGuidelines: false,
|
155
|
+
hasFigmaComponent: false
|
156
|
+
}}
|
157
|
+
/>
|
package/docs/content/Avatar.mdx
CHANGED
@@ -5,17 +5,19 @@ componentId: avatar
|
|
5
5
|
source: https://github.com/primer/react/blob/main/src/Avatar.tsx
|
6
6
|
---
|
7
7
|
|
8
|
-
import {Avatar} from '@primer/components'
|
8
|
+
import {Avatar, Box} from '@primer/components'
|
9
9
|
|
10
|
-
```
|
11
|
-
|
10
|
+
```js
|
11
|
+
import {Avatar} from '@primer/components'
|
12
12
|
```
|
13
13
|
|
14
|
-
##
|
14
|
+
## Examples
|
15
15
|
|
16
|
-
|
16
|
+
### Default
|
17
17
|
|
18
|
-
|
18
|
+
```jsx live
|
19
|
+
<Avatar src="https://avatars.githubusercontent.com/primer" />
|
20
|
+
```
|
19
21
|
|
20
22
|
### Square
|
21
23
|
|
@@ -23,16 +25,29 @@ import {Avatar} from '@primer/components'
|
|
23
25
|
<Avatar square src="https://avatars.githubusercontent.com/primer" />
|
24
26
|
```
|
25
27
|
|
26
|
-
|
28
|
+
## Props
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
<
|
32
|
-
|
33
|
-
|
30
|
+
### Avatar
|
31
|
+
|
32
|
+
<PropsTable>
|
33
|
+
<PropsTableRow name="src" type="string" required description="URL of the avatar image." />{' '}
|
34
|
+
<PropsTableRow
|
35
|
+
name="alt"
|
36
|
+
type="string"
|
37
|
+
defaultValue="''"
|
38
|
+
description="Provide alt text when the avatar is used without a name next to it."
|
39
|
+
/>
|
40
|
+
<PropsTableRow name="size" type="number" defaultValue="20" description="The size of the avatar in pixels." />
|
41
|
+
<PropsTableRow
|
42
|
+
name="square"
|
43
|
+
type="boolean"
|
44
|
+
defaultValue="false"
|
45
|
+
description="If true, the avatar will be square instead of circular."
|
46
|
+
/>
|
47
|
+
<PropsTableSxRow />
|
48
|
+
</PropsTable>
|
34
49
|
|
35
|
-
##
|
50
|
+
## Status
|
36
51
|
|
37
52
|
<ComponentChecklist
|
38
53
|
items={{
|
@@ -0,0 +1,47 @@
|
|
1
|
+
---
|
2
|
+
title: AvatarPair
|
3
|
+
status: Alpha
|
4
|
+
source: https://github.com/primer/react/blob/main/src/AvatarPair.tsx
|
5
|
+
---
|
6
|
+
|
7
|
+
```js
|
8
|
+
import {AvatarPair} from '@primer/components'
|
9
|
+
```
|
10
|
+
|
11
|
+
## Examples
|
12
|
+
|
13
|
+
```jsx live
|
14
|
+
<AvatarPair>
|
15
|
+
<Avatar src="https://avatars.githubusercontent.com/github" />
|
16
|
+
<Avatar src="https://avatars.githubusercontent.com/primer" />
|
17
|
+
</AvatarPair>
|
18
|
+
```
|
19
|
+
|
20
|
+
## Props
|
21
|
+
|
22
|
+
### AvatarPair
|
23
|
+
|
24
|
+
<PropsTable>
|
25
|
+
<PropsTableRow name="children" type="Avatar[]" />
|
26
|
+
<PropsTableSxRow />
|
27
|
+
</PropsTable>
|
28
|
+
|
29
|
+
## Status
|
30
|
+
|
31
|
+
<ComponentChecklist
|
32
|
+
items={{
|
33
|
+
propsDocumented: true,
|
34
|
+
noUnnecessaryDeps: true,
|
35
|
+
adaptsToThemes: true,
|
36
|
+
adaptsToScreenSizes: true,
|
37
|
+
fullTestCoverage: false,
|
38
|
+
usedInProduction: false,
|
39
|
+
usageExamplesDocumented: true,
|
40
|
+
designReviewed: false,
|
41
|
+
a11yReviewed: false,
|
42
|
+
stableApi: false,
|
43
|
+
addressedApiFeedback: false,
|
44
|
+
hasDesignGuidelines: false,
|
45
|
+
hasFigmaComponent: false
|
46
|
+
}}
|
47
|
+
/>
|
@@ -7,7 +7,13 @@ source: https://github.com/primer/react/blob/main/src/AvatarStack.tsx
|
|
7
7
|
|
8
8
|
import {AvatarStack} from '@primer/components'
|
9
9
|
|
10
|
-
|
10
|
+
```js
|
11
|
+
import {AvatarStack} from '@primer/components'
|
12
|
+
```
|
13
|
+
|
14
|
+
## Examples
|
15
|
+
|
16
|
+
### Default
|
11
17
|
|
12
18
|
```jsx live
|
13
19
|
<AvatarStack>
|
@@ -31,12 +37,14 @@ import {AvatarStack} from '@primer/components'
|
|
31
37
|
|
32
38
|
## Props
|
33
39
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
40
|
+
### AvatarStack
|
41
|
+
|
42
|
+
<PropsTable>
|
43
|
+
<PropsTableRow name="alignRight" type="boolean" defaultValue="false" description="Align the avatars to the right" />
|
44
|
+
<PropsTableSxRow />
|
45
|
+
</PropsTable>
|
38
46
|
|
39
|
-
##
|
47
|
+
## Status
|
40
48
|
|
41
49
|
<ComponentChecklist
|
42
50
|
items={{
|
package/docs/content/Box.mdx
CHANGED
@@ -9,18 +9,10 @@ import {Props} from '../src/props'
|
|
9
9
|
import {ComponentChecklist} from '../src/component-checklist'
|
10
10
|
import {Box} from '@primer/components'
|
11
11
|
|
12
|
-
```
|
13
|
-
|
14
|
-
Hello
|
15
|
-
</Box>
|
12
|
+
```js
|
13
|
+
import {Box} from '@primer/components'
|
16
14
|
```
|
17
15
|
|
18
|
-
## Props
|
19
|
-
|
20
|
-
<Props of={Box} />
|
21
|
-
|
22
|
-
Box also accepts all [styled system props](https://styled-system.com/table/).
|
23
|
-
|
24
16
|
## Examples
|
25
17
|
|
26
18
|
### Border on all sides
|
@@ -75,7 +67,17 @@ Use Box to create [grid](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_
|
|
75
67
|
</Box>
|
76
68
|
```
|
77
69
|
|
78
|
-
##
|
70
|
+
## Props
|
71
|
+
|
72
|
+
### Box
|
73
|
+
|
74
|
+
<PropsTable>
|
75
|
+
<PropsTableBasePropRows elementType="div" isPolymorphic refType="HTMLDivElement" />
|
76
|
+
</PropsTable>
|
77
|
+
|
78
|
+
Box also accepts all [styled system props](https://styled-system.com/table/).
|
79
|
+
|
80
|
+
## Status
|
79
81
|
|
80
82
|
<ComponentChecklist
|
81
83
|
items={{
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
title: BranchName
|
3
|
+
status: Alpha
|
4
|
+
source: https://github.com/primer/react/blob/main/src/BranchName.tsx
|
5
|
+
---
|
6
|
+
|
7
|
+
```js
|
8
|
+
import {BranchName} from '@primer/components'
|
9
|
+
```
|
10
|
+
|
11
|
+
BranchName is a label-type component rendered as an `<a>` tag by default with monospace font.
|
12
|
+
|
13
|
+
## Examples
|
14
|
+
|
15
|
+
```jsx live
|
16
|
+
<BranchName href="#">a_new_feature_branch</BranchName>
|
17
|
+
```
|
18
|
+
|
19
|
+
## Props
|
20
|
+
|
21
|
+
### BranchName
|
22
|
+
|
23
|
+
<PropsTable>
|
24
|
+
<PropsTableBasePropRows
|
25
|
+
elementType="a"
|
26
|
+
refType="HTMLAnchorElement"
|
27
|
+
isPolymorphic
|
28
|
+
passthroughPropsLink={
|
29
|
+
<Link href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#Attributes">MDN</Link>
|
30
|
+
}
|
31
|
+
/>
|
32
|
+
</PropsTable>
|
33
|
+
|
34
|
+
## Status
|
35
|
+
|
36
|
+
<ComponentChecklist
|
37
|
+
items={{
|
38
|
+
propsDocumented: true,
|
39
|
+
noUnnecessaryDeps: true,
|
40
|
+
adaptsToThemes: true,
|
41
|
+
adaptsToScreenSizes: false,
|
42
|
+
fullTestCoverage: false,
|
43
|
+
usedInProduction: false,
|
44
|
+
usageExamplesDocumented: false,
|
45
|
+
designReviewed: false,
|
46
|
+
a11yReviewed: false,
|
47
|
+
stableApi: false,
|
48
|
+
addressedApiFeedback: false,
|
49
|
+
hasDesignGuidelines: false,
|
50
|
+
hasFigmaComponent: false
|
51
|
+
}}
|
52
|
+
/>
|
@@ -5,6 +5,10 @@ description: Use breadcrumbs to show navigational context on pages that are many
|
|
5
5
|
source: https://github.com/primer/react/blob/main/src/Breadcrumbs.tsx
|
6
6
|
---
|
7
7
|
|
8
|
+
```js
|
9
|
+
import {Breadcrumbs} from '@primer/components'
|
10
|
+
```
|
11
|
+
|
8
12
|
Breadcrumbs are used to show taxonomical context on pages that are many levels deep in a site’s hierarchy. Breadcrumbs show and link to parent, grandparent, and sometimes great-grandparent pages. Breadcrumbs are most appropriate on pages that:
|
9
13
|
|
10
14
|
- Are many levels deep on a site
|
@@ -16,7 +20,7 @@ To use Breadcrumbs with [react-router](https://github.com/ReactTraining/react-ro
|
|
16
20
|
`as={NavLink}` and omit the `selected` prop.
|
17
21
|
This ensures that the NavLink gets `activeClassName='selected'`
|
18
22
|
|
19
|
-
##
|
23
|
+
## Examples
|
20
24
|
|
21
25
|
```jsx live
|
22
26
|
<Breadcrumbs>
|
@@ -32,22 +36,26 @@ This ensures that the NavLink gets `activeClassName='selected'`
|
|
32
36
|
|
33
37
|
### Breadcrumbs
|
34
38
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
| sx | SystemStyleObject | `{}` | Style to be applied to the component |
|
39
|
+
<PropsTable>
|
40
|
+
<PropsTableRow name="children" type="Breadcrumbs.Item[]" />
|
41
|
+
<PropsTableSxRow />
|
42
|
+
</PropsTable>
|
40
43
|
|
41
44
|
### Breadcrumbs.Item
|
42
45
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
<PropsTable>
|
47
|
+
<PropsTableRow name="selected" type="boolean" defaultValue="false" />
|
48
|
+
<PropsTableBasePropRows
|
49
|
+
elementType="a"
|
50
|
+
refType="HTMLAnchorElement"
|
51
|
+
isPolymorphic
|
52
|
+
passthroughPropsLink={
|
53
|
+
<Link href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#Attributes">MDN</Link>
|
54
|
+
}
|
55
|
+
/>
|
56
|
+
</PropsTable>
|
49
57
|
|
50
|
-
##
|
58
|
+
## Status
|
51
59
|
|
52
60
|
<ComponentChecklist
|
53
61
|
items={{
|
@@ -0,0 +1,75 @@
|
|
1
|
+
---
|
2
|
+
title: Link
|
3
|
+
status: Alpha
|
4
|
+
source: https://github.com/primer/react/blob/main/src/Link.tsx
|
5
|
+
---
|
6
|
+
|
7
|
+
import InlineCode from '@primer/gatsby-theme-doctocat/src/components/inline-code'
|
8
|
+
import {Link} from '@primer/components'
|
9
|
+
|
10
|
+
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.
|
11
|
+
|
12
|
+
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`.
|
13
|
+
|
14
|
+
**Important:** When using the `as` prop, be sure to always render an accessible element type, like `a`, `button`, `input`, or `summary`.
|
15
|
+
|
16
|
+
## Examples
|
17
|
+
|
18
|
+
```jsx live
|
19
|
+
<Link href="https://github.com">Link</Link>
|
20
|
+
```
|
21
|
+
|
22
|
+
## Props
|
23
|
+
|
24
|
+
### Link
|
25
|
+
|
26
|
+
<PropsTable>
|
27
|
+
<PropsTableRow
|
28
|
+
name="href"
|
29
|
+
type="string"
|
30
|
+
description={
|
31
|
+
<>
|
32
|
+
URL to be used for the Link. (The <InlineCode>href</InlineCode> is passed to the underlying{' '}
|
33
|
+
<InlineCode><a></InlineCode> element. If <InlineCode>as</InlineCode> is specified, the link behavior may
|
34
|
+
need different props).
|
35
|
+
</>
|
36
|
+
}
|
37
|
+
/>
|
38
|
+
<PropsTableRow
|
39
|
+
name="muted"
|
40
|
+
type="boolean"
|
41
|
+
defaultValue="false"
|
42
|
+
description="Uses a less prominent shade for Link color, and the default link shade on hover"
|
43
|
+
/>
|
44
|
+
<PropsTableRow name="underline" type="boolean" defaultValue="false" description="Adds underline to the Link" />
|
45
|
+
<PropsTableRow name="hoverColor" type="string" description="Color used when hovering over link" />
|
46
|
+
<PropsTableBasePropRows
|
47
|
+
elementType="a"
|
48
|
+
refType="HTMLAnchorElement"
|
49
|
+
passthroughPropsLink={
|
50
|
+
<Link href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#Attributes">MDN</Link>
|
51
|
+
}
|
52
|
+
isPolymorphic
|
53
|
+
/>
|
54
|
+
</PropsTable>
|
55
|
+
|
56
|
+
## Status
|
57
|
+
|
58
|
+
<ComponentChecklist
|
59
|
+
items={{
|
60
|
+
propsDocumented: true,
|
61
|
+
noUnnecessaryDeps: true,
|
62
|
+
adaptsToThemes: true,
|
63
|
+
adaptsToScreenSizes: true,
|
64
|
+
fullTestCoverage: false,
|
65
|
+
usedInProduction: true,
|
66
|
+
usageExamplesDocumented: false,
|
67
|
+
hasStorybookStories: false,
|
68
|
+
designReviewed: false,
|
69
|
+
a11yReviewed: false,
|
70
|
+
stableApi: false,
|
71
|
+
addressedApiFeedback: false,
|
72
|
+
hasDesignGuidelines: false,
|
73
|
+
hasFigmaComponent: false
|
74
|
+
}}
|
75
|
+
/>
|
@@ -0,0 +1,90 @@
|
|
1
|
+
---
|
2
|
+
title: Radio
|
3
|
+
description: Use radios when a user needs to select one option from a list
|
4
|
+
status: Alpha
|
5
|
+
source: https://github.com/primer/react/blob/main/src/Radio.tsx
|
6
|
+
storybook: '/react/storybook?path=/story/forms-radio-button--default'
|
7
|
+
---
|
8
|
+
|
9
|
+
## Default example
|
10
|
+
|
11
|
+
```jsx live
|
12
|
+
<>
|
13
|
+
<Radio value="one" name="radio-group-name" />
|
14
|
+
<Radio value="two" name="radio-group-name" />
|
15
|
+
<Radio disabled value="three" name="radio-group-name" />
|
16
|
+
</>
|
17
|
+
```
|
18
|
+
|
19
|
+
<Note>
|
20
|
+
Please use a [Checkbox](/Checkbox) if the user needs to select more than one option in a list
|
21
|
+
</Note>
|
22
|
+
<Note variant="warning">
|
23
|
+
Radio components should always be accompanied by a corresponding label to improve support for assistive technologies.
|
24
|
+
</Note>
|
25
|
+
|
26
|
+
## Grouping Radio components
|
27
|
+
|
28
|
+
Use the `name` prop to group together related `Radio` components in a list.
|
29
|
+
|
30
|
+
```jsx live
|
31
|
+
<form>
|
32
|
+
<Box sx={{p: 1, display: 'flex', alignItems: 'center'}}>
|
33
|
+
<Radio id="radio-0" value="1" name="radio-example" />
|
34
|
+
<Text as="label" htmlFor="radio-0" sx={{fontSize: 1, marginLeft: 1}}>
|
35
|
+
<Text sx={{display: 'block'}}>Radio 1</Text>
|
36
|
+
</Text>
|
37
|
+
</Box>
|
38
|
+
<Box sx={{p: 1, display: 'flex', alignItems: 'center'}}>
|
39
|
+
<Radio id="radio-1" value="2" name="radio-example" />
|
40
|
+
<Text as="label" htmlFor="radio-1" sx={{fontSize: 1, marginLeft: 1}}>
|
41
|
+
<Text sx={{display: 'block'}}>Radio 2</Text>
|
42
|
+
</Text>
|
43
|
+
</Box>
|
44
|
+
<Box sx={{p: 1, display: 'flex', alignItems: 'center'}}>
|
45
|
+
<Radio id="radio-2" value="3" name="radio-example" />
|
46
|
+
<Text as="label" htmlFor="radio-2" sx={{fontSize: 1, marginLeft: 1}}>
|
47
|
+
<Text sx={{display: 'block'}}>Radio 3</Text>
|
48
|
+
</Text>
|
49
|
+
</Box>
|
50
|
+
<Box sx={{p: 1, display: 'flex', alignItems: 'center'}}>
|
51
|
+
<Radio id="radio-3" value="4" name="radio-example" />
|
52
|
+
<Text as="label" htmlFor="radio-3" sx={{fontSize: 1, marginLeft: 1}}>
|
53
|
+
<Text sx={{display: 'block'}}>Radio 4</Text>
|
54
|
+
</Text>
|
55
|
+
</Box>
|
56
|
+
</form>
|
57
|
+
```
|
58
|
+
|
59
|
+
## Component props
|
60
|
+
|
61
|
+
Native `<input>` attributes are forwarded to the underlying React `input` component and are not listed below.
|
62
|
+
|
63
|
+
| Name | Type | Default | Description |
|
64
|
+
| :------------- | :---------- | :-------: | :--------------------------------------------------------------------------------------- |
|
65
|
+
| value | String | undefined | Required. A unique value that is never shown to the user. |
|
66
|
+
| name | String | undefined | Required. Used for grouping multiple radios |
|
67
|
+
| checked | Boolean | undefined | Optional. Modifies true/false value of the native radio |
|
68
|
+
| defaultChecked | Boolean | undefined | Optional. Selects the radio by default in uncontrolled mode |
|
69
|
+
| onChange | ChangeEvent | undefined | Optional. A callback function that is triggered when the checked state has been changed. |
|
70
|
+
| disabled | Boolean | undefined | Optional. Modifies the native disabled state of the native radio |
|
71
|
+
|
72
|
+
## Component status
|
73
|
+
|
74
|
+
<ComponentChecklist
|
75
|
+
items={{
|
76
|
+
propsDocumented: true,
|
77
|
+
noUnnecessaryDeps: true,
|
78
|
+
adaptsToThemes: true,
|
79
|
+
adaptsToScreenSizes: true,
|
80
|
+
fullTestCoverage: true,
|
81
|
+
usedInProduction: false,
|
82
|
+
usageExamplesDocumented: false,
|
83
|
+
designReviewed: false,
|
84
|
+
a11yReviewed: false,
|
85
|
+
stableApi: false,
|
86
|
+
addressedApiFeedback: false,
|
87
|
+
hasDesignGuidelines: false,
|
88
|
+
hasFigmaComponent: false
|
89
|
+
}}
|
90
|
+
/>
|