@primer/react 37.11.1 → 37.11.2
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.
- package/CHANGELOG.md +110 -163
- package/dist/browser.esm.js +1 -1
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +1 -1
- package/dist/browser.umd.js.map +1 -1
- package/lib/node_modules/@github/relative-time-element/dist/duration.js +3 -4
- package/lib/node_modules/@github/relative-time-element/dist/relative-time-element-define.js +0 -2
- package/lib/node_modules/@github/relative-time-element/dist/relative-time-element.js +4 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
+
## 37.11.2
|
|
4
|
+
|
|
5
|
+
N/A, re-release of v37.11.1
|
|
6
|
+
|
|
3
7
|
## 37.11.1
|
|
4
8
|
|
|
5
9
|
### Patch Changes
|
|
@@ -2823,7 +2827,7 @@
|
|
|
2823
2827
|
|
|
2824
2828
|
```jsx
|
|
2825
2829
|
// Hide pane on narrow viewports
|
|
2826
|
-
<PageLayout.Pane hidden={{
|
|
2830
|
+
<PageLayout.Pane hidden={{narrow: true}}>...</PageLayout.Pane>
|
|
2827
2831
|
```
|
|
2828
2832
|
|
|
2829
2833
|
- [#2199](https://github.com/primer/react/pull/2199) [`fb385b63`](https://github.com/primer/react/commit/fb385b63f22c1eb76193e42e92ea2a056e61fdbb) Thanks [@colebemis](https://github.com/colebemis)! - \* Updated the `position` prop in `PageLayout.Pane` to use the new responsive prop API introduced in https://github.com/primer/react/pull/2174.
|
|
@@ -2984,7 +2988,7 @@
|
|
|
2984
2988
|
- [#2112](https://github.com/primer/react/pull/2112) [`74e1d138`](https://github.com/primer/react/commit/74e1d1386bc6bb6326c3c2b64b5e31146f9cc56b) Thanks [@colebemis](https://github.com/colebemis)! - [NavList](https://primer.style/NavList) is ready to use. You can now import it from the main bundle:
|
|
2985
2989
|
|
|
2986
2990
|
```js
|
|
2987
|
-
import {
|
|
2991
|
+
import {NavList} from '@primer/react'
|
|
2988
2992
|
```
|
|
2989
2993
|
|
|
2990
2994
|
### Patch Changes
|
|
@@ -3125,11 +3129,11 @@
|
|
|
3125
3129
|
```jsx
|
|
3126
3130
|
<ActionList
|
|
3127
3131
|
items={[
|
|
3128
|
-
{
|
|
3129
|
-
{
|
|
3130
|
-
{
|
|
3132
|
+
{text: 'New file'},
|
|
3133
|
+
{text: 'Copy link'},
|
|
3134
|
+
{text: 'Edit file'},
|
|
3131
3135
|
ActionList.Divider,
|
|
3132
|
-
{
|
|
3136
|
+
{text: 'Delete file', variant: 'danger'},
|
|
3133
3137
|
]}
|
|
3134
3138
|
/>
|
|
3135
3139
|
```
|
|
@@ -3157,21 +3161,21 @@
|
|
|
3157
3161
|
showItemDividers
|
|
3158
3162
|
items={[
|
|
3159
3163
|
{
|
|
3160
|
-
key:
|
|
3164
|
+
key: '0',
|
|
3161
3165
|
leadingVisual: LinkIcon,
|
|
3162
|
-
text:
|
|
3166
|
+
text: 'github/primer',
|
|
3163
3167
|
},
|
|
3164
3168
|
{
|
|
3165
|
-
key:
|
|
3169
|
+
key: '1',
|
|
3166
3170
|
leadingVisual: () => <Avatar src="https://github.com/mona.png" />,
|
|
3167
|
-
text:
|
|
3168
|
-
description:
|
|
3169
|
-
descriptionVariant:
|
|
3171
|
+
text: 'mona',
|
|
3172
|
+
description: 'Monalisa Octocat',
|
|
3173
|
+
descriptionVariant: 'block',
|
|
3170
3174
|
},
|
|
3171
3175
|
{
|
|
3172
|
-
key:
|
|
3176
|
+
key: '2',
|
|
3173
3177
|
leadingVisual: GearIcon,
|
|
3174
|
-
text:
|
|
3178
|
+
text: 'View Settings',
|
|
3175
3179
|
trailingVisual: ArrowRightIcon,
|
|
3176
3180
|
},
|
|
3177
3181
|
]}
|
|
@@ -3194,9 +3198,7 @@
|
|
|
3194
3198
|
<Avatar src="https://github.com/mona.png" />
|
|
3195
3199
|
</ActionList.LeadingVisual>
|
|
3196
3200
|
mona
|
|
3197
|
-
<ActionList.Description variant="block">
|
|
3198
|
-
Monalisa Octocat
|
|
3199
|
-
</ActionList.Description>
|
|
3201
|
+
<ActionList.Description variant="block">Monalisa Octocat</ActionList.Description>
|
|
3200
3202
|
</ActionList.Item>
|
|
3201
3203
|
<ActionList.Item>
|
|
3202
3204
|
<ActionList.LeadingVisual>
|
|
@@ -3218,14 +3220,14 @@
|
|
|
3218
3220
|
```jsx
|
|
3219
3221
|
<ActionList
|
|
3220
3222
|
groupMetadata={[
|
|
3221
|
-
{
|
|
3222
|
-
{
|
|
3223
|
+
{groupId: '0', header: {title: 'Live query'}},
|
|
3224
|
+
{groupId: '1', header: {title: 'Layout'}},
|
|
3223
3225
|
]}
|
|
3224
3226
|
items={[
|
|
3225
|
-
{
|
|
3226
|
-
{
|
|
3227
|
-
{
|
|
3228
|
-
{
|
|
3227
|
+
{key: '0', text: 'repo:github/github', groupId: '0'},
|
|
3228
|
+
{key: '1', text: 'Table', groupId: '1'},
|
|
3229
|
+
{key: '2', text: 'Board', groupId: '1'},
|
|
3230
|
+
{key: '3', text: 'View settings'},
|
|
3229
3231
|
]}
|
|
3230
3232
|
/>
|
|
3231
3233
|
```
|
|
@@ -3257,7 +3259,7 @@
|
|
|
3257
3259
|
To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`:
|
|
3258
3260
|
|
|
3259
3261
|
```js
|
|
3260
|
-
import {
|
|
3262
|
+
import {ActionList} from '@primer/react/deprecated'
|
|
3261
3263
|
```
|
|
3262
3264
|
|
|
3263
3265
|
You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically.
|
|
@@ -3308,13 +3310,13 @@
|
|
|
3308
3310
|
anchorContent="Menu"
|
|
3309
3311
|
onAction={fn}
|
|
3310
3312
|
items={[
|
|
3311
|
-
{
|
|
3312
|
-
{
|
|
3313
|
-
{
|
|
3313
|
+
{text: 'New file'},
|
|
3314
|
+
{text: 'Copy link'},
|
|
3315
|
+
{text: 'Edit file'},
|
|
3314
3316
|
ActionMenu.Divider,
|
|
3315
|
-
{
|
|
3317
|
+
{text: 'Delete file', variant: 'danger'},
|
|
3316
3318
|
]}
|
|
3317
|
-
overlayProps={{
|
|
3319
|
+
overlayProps={{width: 'small'}}
|
|
3318
3320
|
/>
|
|
3319
3321
|
```
|
|
3320
3322
|
|
|
@@ -3343,7 +3345,7 @@
|
|
|
3343
3345
|
To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`:
|
|
3344
3346
|
|
|
3345
3347
|
```js
|
|
3346
|
-
import {
|
|
3348
|
+
import {ActionMenu} from '@primer/react/deprecated'
|
|
3347
3349
|
```
|
|
3348
3350
|
|
|
3349
3351
|
You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically.
|
|
@@ -3375,19 +3377,19 @@
|
|
|
3375
3377
|
|
|
3376
3378
|
```js
|
|
3377
3379
|
const fieldTypes = [
|
|
3378
|
-
{
|
|
3379
|
-
{
|
|
3380
|
-
{
|
|
3381
|
-
{
|
|
3382
|
-
{
|
|
3383
|
-
]
|
|
3380
|
+
{key: 0, text: 'Text'},
|
|
3381
|
+
{key: 1, text: 'Number'},
|
|
3382
|
+
{key: 3, text: 'Date'},
|
|
3383
|
+
{key: 4, text: 'Single select'},
|
|
3384
|
+
{key: 5, text: 'Iteration'},
|
|
3385
|
+
]
|
|
3384
3386
|
|
|
3385
3387
|
const Example = () => {
|
|
3386
|
-
const [selectedType, setSelectedType] = React.useState()
|
|
3388
|
+
const [selectedType, setSelectedType] = React.useState()
|
|
3387
3389
|
|
|
3388
3390
|
return (
|
|
3389
3391
|
<DropdownMenu
|
|
3390
|
-
renderAnchor={({
|
|
3392
|
+
renderAnchor={({children, ...anchorProps}) => (
|
|
3391
3393
|
<ButtonInvisible {...anchorProps}>
|
|
3392
3394
|
{children} <GearIcon />
|
|
3393
3395
|
</ButtonInvisible>
|
|
@@ -3396,10 +3398,10 @@
|
|
|
3396
3398
|
items={fieldTypes}
|
|
3397
3399
|
selectedItem={selectedType}
|
|
3398
3400
|
onChange={setSelectedType}
|
|
3399
|
-
overlayProps={{
|
|
3401
|
+
overlayProps={{width: 'medium'}}
|
|
3400
3402
|
/>
|
|
3401
|
-
)
|
|
3402
|
-
}
|
|
3403
|
+
)
|
|
3404
|
+
}
|
|
3403
3405
|
```
|
|
3404
3406
|
|
|
3405
3407
|
</td>
|
|
@@ -3407,24 +3409,22 @@
|
|
|
3407
3409
|
|
|
3408
3410
|
```jsx
|
|
3409
3411
|
const fieldTypes = [
|
|
3410
|
-
{
|
|
3411
|
-
{
|
|
3412
|
-
{
|
|
3413
|
-
{
|
|
3414
|
-
{
|
|
3415
|
-
]
|
|
3412
|
+
{id: 0, text: 'Text'},
|
|
3413
|
+
{id: 1, text: 'Number'},
|
|
3414
|
+
{id: 3, text: 'Date'},
|
|
3415
|
+
{id: 4, text: 'Single select'},
|
|
3416
|
+
{id: 5, text: 'Iteration'},
|
|
3417
|
+
]
|
|
3416
3418
|
|
|
3417
3419
|
const Example = () => {
|
|
3418
|
-
const [selectedType, setSelectedType] = React.useState()
|
|
3420
|
+
const [selectedType, setSelectedType] = React.useState()
|
|
3419
3421
|
|
|
3420
3422
|
render(
|
|
3421
3423
|
<ActionMenu>
|
|
3422
|
-
<ActionMenu.Button aria-label="Select field type">
|
|
3423
|
-
{selectedType.name || "Field type"}
|
|
3424
|
-
</ActionMenu.Button>
|
|
3424
|
+
<ActionMenu.Button aria-label="Select field type">{selectedType.name || 'Field type'}</ActionMenu.Button>
|
|
3425
3425
|
<ActionMenu.Overlay width="medium">
|
|
3426
3426
|
<ActionList selectionVariant="single">
|
|
3427
|
-
{fieldTypes.map(
|
|
3427
|
+
{fieldTypes.map(type => (
|
|
3428
3428
|
<ActionList.Item
|
|
3429
3429
|
key={type.id}
|
|
3430
3430
|
selected={type.id === selectedType.id}
|
|
@@ -3436,8 +3436,8 @@
|
|
|
3436
3436
|
</ActionList>
|
|
3437
3437
|
</ActionMenu.Overlay>
|
|
3438
3438
|
</ActionMenu>,
|
|
3439
|
-
)
|
|
3440
|
-
}
|
|
3439
|
+
)
|
|
3440
|
+
}
|
|
3441
3441
|
```
|
|
3442
3442
|
|
|
3443
3443
|
</td>
|
|
@@ -3447,7 +3447,7 @@
|
|
|
3447
3447
|
To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`:
|
|
3448
3448
|
|
|
3449
3449
|
```js
|
|
3450
|
-
import {
|
|
3450
|
+
import {DropdownMenu} from '@primer/react/deprecated'
|
|
3451
3451
|
```
|
|
3452
3452
|
|
|
3453
3453
|
You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically.
|
|
@@ -3478,21 +3478,17 @@
|
|
|
3478
3478
|
<td valign="top">
|
|
3479
3479
|
|
|
3480
3480
|
```jsx
|
|
3481
|
-
import {
|
|
3481
|
+
import {Label} from '@primer/react'
|
|
3482
3482
|
|
|
3483
3483
|
function Example() {
|
|
3484
3484
|
return (
|
|
3485
3485
|
<>
|
|
3486
3486
|
<Label outline>default</Label>
|
|
3487
|
-
<Label
|
|
3488
|
-
variant="small"
|
|
3489
|
-
outline
|
|
3490
|
-
sx={{ borderColor: "danger.emphasis", color: "danger.fg" }}
|
|
3491
|
-
>
|
|
3487
|
+
<Label variant="small" outline sx={{borderColor: 'danger.emphasis', color: 'danger.fg'}}>
|
|
3492
3488
|
danger
|
|
3493
3489
|
</Label>
|
|
3494
3490
|
</>
|
|
3495
|
-
)
|
|
3491
|
+
)
|
|
3496
3492
|
}
|
|
3497
3493
|
```
|
|
3498
3494
|
|
|
@@ -3500,7 +3496,7 @@
|
|
|
3500
3496
|
<td valign="top">
|
|
3501
3497
|
|
|
3502
3498
|
```jsx
|
|
3503
|
-
import {
|
|
3499
|
+
import {Label} from '@primer/react'
|
|
3504
3500
|
|
|
3505
3501
|
function Example() {
|
|
3506
3502
|
return (
|
|
@@ -3510,7 +3506,7 @@
|
|
|
3510
3506
|
danger
|
|
3511
3507
|
</Label>
|
|
3512
3508
|
</>
|
|
3513
|
-
)
|
|
3509
|
+
)
|
|
3514
3510
|
}
|
|
3515
3511
|
```
|
|
3516
3512
|
|
|
@@ -3521,7 +3517,7 @@
|
|
|
3521
3517
|
To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`:
|
|
3522
3518
|
|
|
3523
3519
|
```js
|
|
3524
|
-
import {
|
|
3520
|
+
import {Label} from '@primer/react/deprecated'
|
|
3525
3521
|
```
|
|
3526
3522
|
|
|
3527
3523
|
You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically.
|
|
@@ -3544,12 +3540,7 @@
|
|
|
3544
3540
|
<td valign="top">
|
|
3545
3541
|
|
|
3546
3542
|
```jsx
|
|
3547
|
-
import {
|
|
3548
|
-
ButtonPrimary,
|
|
3549
|
-
ButtonInvisible,
|
|
3550
|
-
ButtonOutline,
|
|
3551
|
-
ButtonDanger,
|
|
3552
|
-
} from "@primer/react";
|
|
3543
|
+
import {ButtonPrimary, ButtonInvisible, ButtonOutline, ButtonDanger} from '@primer/react'
|
|
3553
3544
|
|
|
3554
3545
|
function Example() {
|
|
3555
3546
|
return (
|
|
@@ -3559,7 +3550,7 @@
|
|
|
3559
3550
|
<ButtonOutline>Outline Button</ButtonOutline>
|
|
3560
3551
|
<ButtonDanger>Danger Button</ButtonDanger>
|
|
3561
3552
|
</>
|
|
3562
|
-
)
|
|
3553
|
+
)
|
|
3563
3554
|
}
|
|
3564
3555
|
```
|
|
3565
3556
|
|
|
@@ -3567,7 +3558,7 @@
|
|
|
3567
3558
|
<td valign="top">
|
|
3568
3559
|
|
|
3569
3560
|
```jsx
|
|
3570
|
-
import {
|
|
3561
|
+
import {Button} from '@primer/react'
|
|
3571
3562
|
|
|
3572
3563
|
function Example() {
|
|
3573
3564
|
return (
|
|
@@ -3577,7 +3568,7 @@
|
|
|
3577
3568
|
<Button variant="outline">Outline Button</Button>
|
|
3578
3569
|
<Button variant="danger">Danger Button</Button>
|
|
3579
3570
|
</>
|
|
3580
|
-
)
|
|
3571
|
+
)
|
|
3581
3572
|
}
|
|
3582
3573
|
```
|
|
3583
3574
|
|
|
@@ -3684,50 +3675,34 @@
|
|
|
3684
3675
|
<td valign="top">
|
|
3685
3676
|
|
|
3686
3677
|
```jsx
|
|
3687
|
-
import {
|
|
3678
|
+
import {ChoiceFieldset} from '@primer/react'
|
|
3688
3679
|
|
|
3689
3680
|
function Example() {
|
|
3690
3681
|
return (
|
|
3691
3682
|
<>
|
|
3692
3683
|
{/* Multi-select */}
|
|
3693
3684
|
<ChoiceFieldset>
|
|
3694
|
-
<ChoiceFieldset.Legend>
|
|
3695
|
-
Preferred Primer component interface
|
|
3696
|
-
</ChoiceFieldset.Legend>
|
|
3685
|
+
<ChoiceFieldset.Legend>Preferred Primer component interface</ChoiceFieldset.Legend>
|
|
3697
3686
|
<ChoiceFieldset.List selectionVariant="multiple">
|
|
3698
|
-
<ChoiceFieldset.Item value="figma">
|
|
3699
|
-
Figma library
|
|
3700
|
-
</ChoiceFieldset.Item>
|
|
3687
|
+
<ChoiceFieldset.Item value="figma">Figma library</ChoiceFieldset.Item>
|
|
3701
3688
|
<ChoiceFieldset.Item value="css">Primer CSS</ChoiceFieldset.Item>
|
|
3702
|
-
<ChoiceFieldset.Item value="react">
|
|
3703
|
-
|
|
3704
|
-
</ChoiceFieldset.Item>
|
|
3705
|
-
<ChoiceFieldset.Item value="viewcomponents">
|
|
3706
|
-
Primer ViewComponents
|
|
3707
|
-
</ChoiceFieldset.Item>
|
|
3689
|
+
<ChoiceFieldset.Item value="react">Primer React components</ChoiceFieldset.Item>
|
|
3690
|
+
<ChoiceFieldset.Item value="viewcomponents">Primer ViewComponents</ChoiceFieldset.Item>
|
|
3708
3691
|
</ChoiceFieldset.List>
|
|
3709
3692
|
</ChoiceFieldset>
|
|
3710
3693
|
|
|
3711
3694
|
{/* Single select */}
|
|
3712
3695
|
<ChoiceFieldset>
|
|
3713
|
-
<ChoiceFieldset.Legend>
|
|
3714
|
-
Preferred Primer component interface
|
|
3715
|
-
</ChoiceFieldset.Legend>
|
|
3696
|
+
<ChoiceFieldset.Legend>Preferred Primer component interface</ChoiceFieldset.Legend>
|
|
3716
3697
|
<ChoiceFieldset.List>
|
|
3717
|
-
<ChoiceFieldset.Item value="figma">
|
|
3718
|
-
Figma library
|
|
3719
|
-
</ChoiceFieldset.Item>
|
|
3698
|
+
<ChoiceFieldset.Item value="figma">Figma library</ChoiceFieldset.Item>
|
|
3720
3699
|
<ChoiceFieldset.Item value="css">Primer CSS</ChoiceFieldset.Item>
|
|
3721
|
-
<ChoiceFieldset.Item value="react">
|
|
3722
|
-
|
|
3723
|
-
</ChoiceFieldset.Item>
|
|
3724
|
-
<ChoiceFieldset.Item value="viewcomponents">
|
|
3725
|
-
Primer ViewComponents
|
|
3726
|
-
</ChoiceFieldset.Item>
|
|
3700
|
+
<ChoiceFieldset.Item value="react">Primer React components</ChoiceFieldset.Item>
|
|
3701
|
+
<ChoiceFieldset.Item value="viewcomponents">Primer ViewComponents</ChoiceFieldset.Item>
|
|
3727
3702
|
</ChoiceFieldset.List>
|
|
3728
3703
|
</ChoiceFieldset>
|
|
3729
3704
|
</>
|
|
3730
|
-
)
|
|
3705
|
+
)
|
|
3731
3706
|
}
|
|
3732
3707
|
```
|
|
3733
3708
|
|
|
@@ -3735,22 +3710,14 @@
|
|
|
3735
3710
|
<td valign="top">
|
|
3736
3711
|
|
|
3737
3712
|
```jsx
|
|
3738
|
-
import {
|
|
3739
|
-
CheckboxGroup,
|
|
3740
|
-
RadioGroup,
|
|
3741
|
-
FormControl,
|
|
3742
|
-
Checkbox,
|
|
3743
|
-
Radio,
|
|
3744
|
-
} from "@primer/react";
|
|
3713
|
+
import {CheckboxGroup, RadioGroup, FormControl, Checkbox, Radio} from '@primer/react'
|
|
3745
3714
|
|
|
3746
3715
|
function Example() {
|
|
3747
3716
|
return (
|
|
3748
3717
|
<>
|
|
3749
3718
|
{/* Multi-select */}
|
|
3750
3719
|
<CheckboxGroup>
|
|
3751
|
-
<CheckboxGroup.Label>
|
|
3752
|
-
Preferred Primer component interface
|
|
3753
|
-
</CheckboxGroup.Label>
|
|
3720
|
+
<CheckboxGroup.Label>Preferred Primer component interface</CheckboxGroup.Label>
|
|
3754
3721
|
<FormControl>
|
|
3755
3722
|
<Checkbox value="figma" />
|
|
3756
3723
|
<FormControl.Label>Figma</FormControl.Label>
|
|
@@ -3771,9 +3738,7 @@
|
|
|
3771
3738
|
|
|
3772
3739
|
{/* Single select */}
|
|
3773
3740
|
<RadioGroup name="preferred-primer">
|
|
3774
|
-
<RadioGroup.Label>
|
|
3775
|
-
Preferred Primer component interface
|
|
3776
|
-
</RadioGroup.Label>
|
|
3741
|
+
<RadioGroup.Label>Preferred Primer component interface</RadioGroup.Label>
|
|
3777
3742
|
<FormControl>
|
|
3778
3743
|
<Radio value="figma" />
|
|
3779
3744
|
<FormControl.Label>Figma</FormControl.Label>
|
|
@@ -3792,7 +3757,7 @@
|
|
|
3792
3757
|
</FormControl>
|
|
3793
3758
|
</RadioGroup>
|
|
3794
3759
|
</>
|
|
3795
|
-
)
|
|
3760
|
+
)
|
|
3796
3761
|
}
|
|
3797
3762
|
```
|
|
3798
3763
|
|
|
@@ -3803,7 +3768,7 @@
|
|
|
3803
3768
|
To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`:
|
|
3804
3769
|
|
|
3805
3770
|
```js
|
|
3806
|
-
import {
|
|
3771
|
+
import {ChoiceFieldset} from '@primer/react/deprecated'
|
|
3807
3772
|
```
|
|
3808
3773
|
|
|
3809
3774
|
You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically.
|
|
@@ -3835,7 +3800,7 @@
|
|
|
3835
3800
|
<td valign="top">
|
|
3836
3801
|
|
|
3837
3802
|
```jsx
|
|
3838
|
-
import {
|
|
3803
|
+
import {FormControl, Checkbox, TextInput} from '@primer/react'
|
|
3839
3804
|
|
|
3840
3805
|
function Example() {
|
|
3841
3806
|
return (
|
|
@@ -3855,7 +3820,7 @@
|
|
|
3855
3820
|
<Checkbox />
|
|
3856
3821
|
</ChoiceInputField>
|
|
3857
3822
|
</>
|
|
3858
|
-
)
|
|
3823
|
+
)
|
|
3859
3824
|
}
|
|
3860
3825
|
```
|
|
3861
3826
|
|
|
@@ -3863,7 +3828,7 @@
|
|
|
3863
3828
|
<td valign="top">
|
|
3864
3829
|
|
|
3865
3830
|
```jsx
|
|
3866
|
-
import {
|
|
3831
|
+
import {FormGroup, TextInput} from '@primer/react'
|
|
3867
3832
|
|
|
3868
3833
|
function Example() {
|
|
3869
3834
|
return (
|
|
@@ -3878,7 +3843,7 @@
|
|
|
3878
3843
|
<Checkbox />
|
|
3879
3844
|
</FormControl>
|
|
3880
3845
|
</>
|
|
3881
|
-
)
|
|
3846
|
+
)
|
|
3882
3847
|
}
|
|
3883
3848
|
```
|
|
3884
3849
|
|
|
@@ -3888,7 +3853,7 @@
|
|
|
3888
3853
|
<td valign="top">
|
|
3889
3854
|
|
|
3890
3855
|
```jsx
|
|
3891
|
-
import {
|
|
3856
|
+
import {InputField, TextInput} from '@primer/react'
|
|
3892
3857
|
|
|
3893
3858
|
function Example() {
|
|
3894
3859
|
return (
|
|
@@ -3896,7 +3861,7 @@
|
|
|
3896
3861
|
<InputField.Label>Example text</InputField.Label>
|
|
3897
3862
|
<TextInput />
|
|
3898
3863
|
</InputField>
|
|
3899
|
-
)
|
|
3864
|
+
)
|
|
3900
3865
|
}
|
|
3901
3866
|
```
|
|
3902
3867
|
|
|
@@ -3904,7 +3869,7 @@
|
|
|
3904
3869
|
<td valign="top">
|
|
3905
3870
|
|
|
3906
3871
|
```jsx
|
|
3907
|
-
import {
|
|
3872
|
+
import {FormControl, TextInput} from '@primer/react'
|
|
3908
3873
|
|
|
3909
3874
|
function Example() {
|
|
3910
3875
|
return (
|
|
@@ -3912,7 +3877,7 @@
|
|
|
3912
3877
|
<FormControl.Label>Example text</FormControl.Label>
|
|
3913
3878
|
<TextInput />
|
|
3914
3879
|
</FormControl>
|
|
3915
|
-
)
|
|
3880
|
+
)
|
|
3916
3881
|
}
|
|
3917
3882
|
```
|
|
3918
3883
|
|
|
@@ -3923,11 +3888,7 @@
|
|
|
3923
3888
|
To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`:
|
|
3924
3889
|
|
|
3925
3890
|
```js
|
|
3926
|
-
import {
|
|
3927
|
-
FormGroup,
|
|
3928
|
-
ChoiceInputField,
|
|
3929
|
-
InputField,
|
|
3930
|
-
} from "@primer/react/deprecated";
|
|
3891
|
+
import {FormGroup, ChoiceInputField, InputField} from '@primer/react/deprecated'
|
|
3931
3892
|
```
|
|
3932
3893
|
|
|
3933
3894
|
You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically.
|
|
@@ -3998,25 +3959,23 @@
|
|
|
3998
3959
|
|
|
3999
3960
|
```jsx
|
|
4000
3961
|
const fieldTypes = [
|
|
4001
|
-
{
|
|
4002
|
-
{
|
|
4003
|
-
]
|
|
3962
|
+
{leadingVisual: TypographyIcon, text: 'Text'},
|
|
3963
|
+
{leadingVisual: NumberIcon, text: 'Number'},
|
|
3964
|
+
]
|
|
4004
3965
|
|
|
4005
3966
|
const Example = () => {
|
|
4006
|
-
const [selectedItem, setSelectedItem] = React.useState()
|
|
3967
|
+
const [selectedItem, setSelectedItem] = React.useState()
|
|
4007
3968
|
|
|
4008
3969
|
return (
|
|
4009
3970
|
<DropdownMenu
|
|
4010
|
-
renderAnchor={({
|
|
4011
|
-
<ButtonInvisible {...anchorProps}>{children}</ButtonInvisible>
|
|
4012
|
-
)}
|
|
3971
|
+
renderAnchor={({children, ...anchorProps}) => <ButtonInvisible {...anchorProps}>{children}</ButtonInvisible>}
|
|
4013
3972
|
placeholder="Select a field type"
|
|
4014
3973
|
items={fieldTypes}
|
|
4015
3974
|
selectedItem={selectedItem}
|
|
4016
3975
|
onChange={() => setSelectedIndex(index)}
|
|
4017
3976
|
/>
|
|
4018
|
-
)
|
|
4019
|
-
}
|
|
3977
|
+
)
|
|
3978
|
+
}
|
|
4020
3979
|
```
|
|
4021
3980
|
|
|
4022
3981
|
</td>
|
|
@@ -4024,36 +3983,29 @@
|
|
|
4024
3983
|
|
|
4025
3984
|
```jsx
|
|
4026
3985
|
const fieldTypes = [
|
|
4027
|
-
{
|
|
4028
|
-
{
|
|
4029
|
-
]
|
|
3986
|
+
{icon: <TypographyIcon />, name: 'Text'},
|
|
3987
|
+
{icon: <NumberIcon />, name: 'Number'},
|
|
3988
|
+
]
|
|
4030
3989
|
|
|
4031
3990
|
const Example = () => {
|
|
4032
|
-
const [selectedItem, setSelectedItem] = React.useState()
|
|
3991
|
+
const [selectedItem, setSelectedItem] = React.useState()
|
|
4033
3992
|
|
|
4034
3993
|
return (
|
|
4035
3994
|
<ActionMenu>
|
|
4036
|
-
<ActionMenu.Button>
|
|
4037
|
-
{selectedItem ? selectedItem.name : "Select a field type"}
|
|
4038
|
-
</ActionMenu.Button>
|
|
3995
|
+
<ActionMenu.Button>{selectedItem ? selectedItem.name : 'Select a field type'}</ActionMenu.Button>
|
|
4039
3996
|
<ActionMenu.Overlay>
|
|
4040
3997
|
<ActionList selectionVariant="single">
|
|
4041
|
-
{fieldTypes.map(
|
|
4042
|
-
<ActionList.Item
|
|
4043
|
-
|
|
4044
|
-
key={field.name}
|
|
4045
|
-
>
|
|
4046
|
-
<ActionList.LeadingVisual>
|
|
4047
|
-
{field.icon}
|
|
4048
|
-
</ActionList.LeadingVisual>
|
|
3998
|
+
{fieldTypes.map(field => (
|
|
3999
|
+
<ActionList.Item onSelect={() => setSelectedItem(field)} key={field.name}>
|
|
4000
|
+
<ActionList.LeadingVisual>{field.icon}</ActionList.LeadingVisual>
|
|
4049
4001
|
{field.name}
|
|
4050
4002
|
</ActionList.Item>
|
|
4051
4003
|
))}
|
|
4052
4004
|
</ActionList>
|
|
4053
4005
|
</ActionMenu.Overlay>
|
|
4054
4006
|
</ActionMenu>
|
|
4055
|
-
)
|
|
4056
|
-
}
|
|
4007
|
+
)
|
|
4008
|
+
}
|
|
4057
4009
|
```
|
|
4058
4010
|
|
|
4059
4011
|
</td>
|
|
@@ -4155,12 +4107,7 @@
|
|
|
4155
4107
|
<td valign="top">
|
|
4156
4108
|
|
|
4157
4109
|
```jsx
|
|
4158
|
-
<Box
|
|
4159
|
-
borderWidth="1px"
|
|
4160
|
-
borderStyle="solid"
|
|
4161
|
-
borderColor="border.default"
|
|
4162
|
-
borderRadius={2}
|
|
4163
|
-
>
|
|
4110
|
+
<Box borderWidth="1px" borderStyle="solid" borderColor="border.default" borderRadius={2}>
|
|
4164
4111
|
Item 1
|
|
4165
4112
|
</Box>
|
|
4166
4113
|
```
|
|
@@ -5204,8 +5151,8 @@
|
|
|
5204
5151
|
* [`beef075e`](https://github.com/primer/react/commit/beef075e0274396b77887adf0b912583fe564b3f) [#1094](https://github.com/primer/react/pull/1094) Thanks [@colebemis](https://github.com/colebemis)! - Components no longer have a default `theme` prop. To ensure components still render correctly, you'll need pass the Primer theme to a [styled-components](https://styled-components.com/) `<ThemeProvider>` at the root of your application:
|
|
5205
5152
|
|
|
5206
5153
|
```jsx
|
|
5207
|
-
import {
|
|
5208
|
-
import {
|
|
5154
|
+
import {ThemeProvider} from 'styled-components'
|
|
5155
|
+
import {theme} from '@primer/react'
|
|
5209
5156
|
|
|
5210
5157
|
function App(props) {
|
|
5211
5158
|
return (
|
|
@@ -5214,7 +5161,7 @@
|
|
|
5214
5161
|
<div>your app here</div>
|
|
5215
5162
|
</ThemeProvider>
|
|
5216
5163
|
</div>
|
|
5217
|
-
)
|
|
5164
|
+
)
|
|
5218
5165
|
}
|
|
5219
5166
|
```
|
|
5220
5167
|
|