Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
eebb3f2
Adds CheckboxGroup and RadioGroup components to replace ChoiceFieldse…
mperrotti Feb 25, 2022
e899578
prepare integration branch
rezrah Feb 21, 2022
728410a
Move deprecated components to deprecated folder (#1881)
pksjce Feb 24, 2022
0c2ca6e
Prefix component with types exported from ActionList2 and ActionMenu2…
siddharthkp Feb 24, 2022
9c3f8b2
Export PageLayout from main bundle (#1882)
colebemis Feb 24, 2022
3f0a1b8
Update release notes and add deprecation notices for SelectMenu and D…
rezrah Feb 25, 2022
15a9f34
Deprecate ActionMenu v1 & Promote drafts/ActionMenu v2 (#1895)
siddharthkp Feb 25, 2022
4771be8
Revert "Deprecate ActionMenu v1 & Promote drafts/ActionMenu v2 (#189…
siddharthkp Feb 25, 2022
cc87f44
Deprecate ActionList v1 & Promote drafts/ActionList v2 (#1893)
siddharthkp Feb 25, 2022
41dccce
Move deprecated components to deprecated folder (#1881)
pksjce Feb 24, 2022
26a050a
adds ChoiceGroup components and Storybook stories
mperrotti Feb 10, 2022
5c10e3d
removes unnecessary code from ChoiceGroup
mperrotti Feb 10, 2022
73cfe29
adds tests and fixes issues discovered during testing
mperrotti Feb 11, 2022
1ad87a2
adds sx prop and standard component tests
mperrotti Feb 11, 2022
a55c979
converts stories to fixtures and examples, adds axe violation tests
mperrotti Feb 11, 2022
65b1dbe
marks ChoiceFieldset as deprecated
mperrotti Feb 11, 2022
228d11d
adds ChoiceGroup docs
mperrotti Feb 11, 2022
3156e6c
updates snapshots
mperrotti Feb 11, 2022
e5eeacd
adds changeset
mperrotti Feb 11, 2022
91892c9
fixes tests I accidentally broke
mperrotti Feb 11, 2022
60ca8f1
addresses PR feedback
mperrotti Feb 17, 2022
427929e
cleanup
mperrotti Feb 17, 2022
e06bd94
WIP - splitting CheckboxGroup and RadioGroup
mperrotti Feb 17, 2022
f461985
cleans up, adds RadioGroup component
mperrotti Feb 22, 2022
9f64b2b
adds stories for CheckboxGroup and RadioGroup
mperrotti Feb 22, 2022
1e657f1
adds and updates tests
mperrotti Feb 22, 2022
b5f0230
ts fixes, rm ChoiceGroup stories
mperrotti Feb 22, 2022
1ee685f
renames ChoiceGroup to CheckboxOrRadioGroup
mperrotti Feb 22, 2022
37af747
updates docs, handles pre-selected radios and/or checkboxes
mperrotti Feb 23, 2022
5c489f3
updates snapshots
mperrotti Feb 23, 2022
9b22838
cleans up, fixes broken tests
mperrotti Feb 23, 2022
e287611
deprecates ChoiceFieldset and ChoiceInputField
mperrotti Feb 25, 2022
ab34fd4
corrects test imports
mperrotti Feb 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .changeset/actionlist2-actionmenu2-prefix-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
'@primer/react': major
---

`ActionList2` exported types are now prefixed with `ActionList`:

```
ListProps → ActionListProps
GroupProps → ActionListGroupProps
ItemProps → ActionListItemProps
DescriptionProps → ActionListDescriptionProps
LeadingVisualProps → ActionListLeadingVisualProps,
TrailingVisualProps → ActionListTrailingVisualProps
```

`ActionMenu2` exported types are now prefixed with `ActionMenu`:

```
MenuButtonProps → ActionMenuButtonProps
MenuAnchorProps → ActionMenuAnchorProps
```
154 changes: 154 additions & 0 deletions .changeset/deprecate-actionlistv1-promote-actionlistv2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
---
'@primer/react': major
---

### ActionList

ActionList has been rewritten with a composable API, design updates and accessibility fixes.

See full list of props and examples: https://primer.style/react/ActionList

<table>
<tr>
<th> Before (v34)</th> <th> After (v35)</th>
</tr>
<tr>
<td valign="top">

```jsx
<ActionList
items={[
{text: 'New file'},
{text: 'Copy link'},
{text: 'Edit file'},
ActionList.Divider,
{text: 'Delete file', variant: 'danger'}
]}
/>
```

</td>
<td valign="top">

```jsx
<ActionList>
<ActionList.Item>New file</ActionList.Item>
<ActionList.Item>Copy link</ActionList.Item>
<ActionList.Item>Edit file</ActionList.Item>
<ActionList.Divider />
<ActionList.Item variant="danger">Delete file</ActionList.Item>
</ActionList>
```

</td>
</tr>
<tr>
<td valign="top">

```jsx
<ActionList
showItemDividers
items={[
{
key: '0',
leadingVisual: LinkIcon,
text: 'github/primer'
},
{
key: '1',
leadingVisual: () => <Avatar src="https://github.com/mona.png" />,
text: 'mona',
description: 'Monalisa Octocat',
descriptionVariant: 'block'
},
{
key: '2',
leadingVisual: GearIcon,
text: 'View Settings',
trailingVisual: ArrowRightIcon
}
]}
/>
```

</td>
<td valign="top">

```jsx
<ActionList showDividers>
<ActionList.Item>
<ActionList.LeadingVisual>
<LinkIcon />
</ActionList.LeadingVisual>
github/primer
</ActionList.Item>
<ActionList.Item>
<ActionList.LeadingVisual>
<Avatar src="https://github.com/mona.png" />
</ActionList.LeadingVisual>
mona
<ActionList.Description variant="block">Monalisa Octocat</ActionList.Description>
</ActionList.Item>
<ActionList.Item>
<ActionList.LeadingVisual>
<GearIcon />
</ActionList.LeadingVisual>
View settings
<ActionList.TrailingVisual>
<ArrowRightIcon />
</ActionList.TrailingVisual>
</ActionList.Item>
</ActionList>
```

</td>
</tr>
<tr>
<td valign="top">

```jsx
<ActionList
groupMetadata={[
{groupId: '0', header: {title: 'Live query'}},
{groupId: '1', header: {title: 'Layout'}}
]}
items={[
{key: '0', text: 'repo:github/github', groupId: '0'},
{key: '1', text: 'Table', groupId: '1'},
{key: '2', text: 'Board', groupId: '1'},
{key: '3', text: 'View settings'}
]}
/>
```

</td>
<td valign="top">

```jsx
<ActionList>
<ActionList.Group title="Live query">
<ActionList.Item>repo:github/github</ActionList.Item>
</ActionList.Group>
<ActionList.Divider />

<ActionList.Group title="Layout">
<ActionList.Item>Table</ActionList.Item>
<ActionList.Item>Board Description></ActionList.Item>
</ActionList.Group>
<ActionList.Divider />

<ActionList.Item>View settings</ActionList.Item>
</ActionList>
```

</td>
</tr>
</table>

To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`:

```js
import {ActionList} from '@primer/react/deprecated'
```

You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically.
5 changes: 5 additions & 0 deletions .changeset/empty-pillows-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': major
---

Prepare library for `v35`
5 changes: 5 additions & 0 deletions .changeset/hip-buses-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': minor
---

Adds CheckboxGroup and RadioGroup components to replace the ChoiceFieldset component
116 changes: 116 additions & 0 deletions .changeset/nervous-pets-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
'@primer/react': major
---

![image](https://user-images.githubusercontent.com/2313998/155632630-60822d7b-6053-480d-925d-cea4d3b04919.png)

The `CheckboxGroup` and `RadioGroup` components will be used to deprecate the `ChoiceFieldset` component. The deprecation of `ChoiceFieldset` also allows us to deprecate `ChoiceInputField`.

`CheckboxGroup` and `RadioGroup` have the ability to render contextual content with your fieldset: labels, validation statuses, captions. It also handles the ARIA attributes that make the form controls accessible to assistive technology.

<table>
<tr>
<th> Before </th> <th> After </th>
</tr>
<tr>
<td valign="top">

```jsx
import {ChoiceFieldset} from "@primer/react";

// Multi-select
<ChoiceFieldset>
<ChoiceFieldset.Legend>Prefered Primer component interface</ChoiceFieldset.Legend>

<ChoiceFieldset.List selectionVariant="multiple">
<ChoiceFieldset.Item value="figma">Figma library</ChoiceFieldset.Item>
<ChoiceFieldset.Item value="css">Primer CSS</ChoiceFieldset.Item>
<ChoiceFieldset.Item value="react">Primer React components</ChoiceFieldset.Item>
<ChoiceFieldset.Item value="viewcomponents">Primer ViewComponents</ChoiceFieldset.Item>
</ChoiceFieldset.List>
</ChoiceFieldset>

// Single select
<ChoiceFieldset>
<ChoiceFieldset.Legend>Prefered Primer component interface</ChoiceFieldset.Legend>

<ChoiceFieldset.List>
<ChoiceFieldset.Item value="figma">Figma library</ChoiceFieldset.Item>
<ChoiceFieldset.Item value="css">Primer CSS</ChoiceFieldset.Item>
<ChoiceFieldset.Item value="react">Primer React components</ChoiceFieldset.Item>
<ChoiceFieldset.Item value="viewcomponents">Primer ViewComponents</ChoiceFieldset.Item>
</ChoiceFieldset.List>
</ChoiceFieldset>

```

</td>
<td valign="top">

```jsx
import {FormGroup, Checkbox} from "@primer/react";

// Multi-select
<CheckboxGroup>
<CheckboxGroup.Label>Prefered Primer component interface</CheckboxGroup.Label>
<FormControl>
<Checkbox value="figma" />
<FormControl.Label>Figma</FormControl.Label>
</FormControl>
<FormControl>
<Checkbox value="css" />
<FormControl.Label>CSS</FormControl.Label>
</FormControl>
<FormControl>
<Checkbox value="react" />
<FormControl.Label>Primer React components</FormControl.Label>
</FormControl>
<FormControl>
<Checkbox value="viewcomponents" />
<FormControl.Label>Primer ViewComponents</FormControl.Label>
</FormControl>
</CheckboxGroup>

// Single select
<RadioGroup name="preferred-primer">
<RadioGroup.Label>Prefered Primer component interface</RadioGroup.Label>
<FormControl>
<Radio value="figma" />
<FormControl.Label>Figma</FormControl.Label>
</FormControl>
<FormControl>
<Radio value="css" />
<FormControl.Label>CSS</FormControl.Label>
</FormControl>
<FormControl>
<Radio value="react" />
<FormControl.Label>Primer React components</FormControl.Label>
</FormControl>
<FormControl>
<Radio value="viewcomponents" />
<FormControl.Label>Primer ViewComponents</FormControl.Label>
</FormControl>
</RadioGroup>
```

</td>
</tr>
</table>
<table style="display: table">
<tr><th>Migration steps to CheckboxGroup and RadioGroup</th></tr>
<tr>
<td>

<strong>Upgrade to the new</strong> `CheckboxGroup` and `RadioGroup` components by referring to the examples in our documentation: [CheckboxGroup](https://primer.style/react/CheckboxGroup), [RadioGroup](https://primer.style/react/RadioGroup).

or

<strong>Continue using the deprecated</strong> `ChoiceFieldset` component :

```js
import {ChoiceFieldset} from '@primer/react/deprecated' // change your import statements
```

</td>
</tr>
</table>
12 changes: 12 additions & 0 deletions .changeset/odd-apes-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@primer/react": major
---

`PageLayout` is being graduated from the `drafts` bundle to the `main` bundle.

To upgrade, rewrite your imports accordingly:

```diff
- import {PageLayout} from '@primer/react/drafts'
+ import {PageLayout} from '@primer/react'
```
5 changes: 5 additions & 0 deletions .changeset/smooth-cameras-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": major
---

Move deprecated components to deprecated folder
9 changes: 9 additions & 0 deletions deprecated/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"_comment1": "this is required only for typescript. once this is fixed https://github.com/microsoft/TypeScript/issues/33079 we can remove this hack",
"name": "@primer/react/deprecated",
"types": "../lib-esm/deprecated/index.d.ts",
"main": "../lib-esm/deprecated/index.js",
"type": "module",
"sideEffects": false
}

Loading