@primer/react 37.11.0 → 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 +116 -163
- package/dist/browser.esm.js +3 -3
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +1 -1
- package/dist/browser.umd.js.map +1 -1
- package/generated/hooks.json +969 -0
- package/lib/FormControl/FormControl.d.ts.map +1 -1
- package/lib/FormControl/FormControl.js +18 -7
- package/lib-esm/FormControl/FormControl.js +18 -7
- package/package.json +1 -1
- package/lib/ActionBar/disabled.ActionBar.Figma.d.ts +0 -2
- package/lib/ActionBar/disabled.ActionBar.Figma.d.ts.map +0 -1
- package/lib-esm/ActionBar/disabled.ActionBar.Figma.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
+
## 37.11.2
|
|
4
|
+
|
|
5
|
+
N/A, re-release of v37.11.1
|
|
6
|
+
|
|
7
|
+
## 37.11.1
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`a12ab59`](https://github.com/primer/react/commit/a12ab599565651cf30233a2cd97357f07cf39cb8) Thanks [@hussam-i-am](https://github.com/hussam-i-am)! - fix(FormControl): fix spacing in vertical layouts"
|
|
12
|
+
|
|
3
13
|
## 37.11.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -2817,7 +2827,7 @@
|
|
|
2817
2827
|
|
|
2818
2828
|
```jsx
|
|
2819
2829
|
// Hide pane on narrow viewports
|
|
2820
|
-
<PageLayout.Pane hidden={{
|
|
2830
|
+
<PageLayout.Pane hidden={{narrow: true}}>...</PageLayout.Pane>
|
|
2821
2831
|
```
|
|
2822
2832
|
|
|
2823
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.
|
|
@@ -2978,7 +2988,7 @@
|
|
|
2978
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:
|
|
2979
2989
|
|
|
2980
2990
|
```js
|
|
2981
|
-
import {
|
|
2991
|
+
import {NavList} from '@primer/react'
|
|
2982
2992
|
```
|
|
2983
2993
|
|
|
2984
2994
|
### Patch Changes
|
|
@@ -3119,11 +3129,11 @@
|
|
|
3119
3129
|
```jsx
|
|
3120
3130
|
<ActionList
|
|
3121
3131
|
items={[
|
|
3122
|
-
{
|
|
3123
|
-
{
|
|
3124
|
-
{
|
|
3132
|
+
{text: 'New file'},
|
|
3133
|
+
{text: 'Copy link'},
|
|
3134
|
+
{text: 'Edit file'},
|
|
3125
3135
|
ActionList.Divider,
|
|
3126
|
-
{
|
|
3136
|
+
{text: 'Delete file', variant: 'danger'},
|
|
3127
3137
|
]}
|
|
3128
3138
|
/>
|
|
3129
3139
|
```
|
|
@@ -3151,21 +3161,21 @@
|
|
|
3151
3161
|
showItemDividers
|
|
3152
3162
|
items={[
|
|
3153
3163
|
{
|
|
3154
|
-
key:
|
|
3164
|
+
key: '0',
|
|
3155
3165
|
leadingVisual: LinkIcon,
|
|
3156
|
-
text:
|
|
3166
|
+
text: 'github/primer',
|
|
3157
3167
|
},
|
|
3158
3168
|
{
|
|
3159
|
-
key:
|
|
3169
|
+
key: '1',
|
|
3160
3170
|
leadingVisual: () => <Avatar src="https://github.com/mona.png" />,
|
|
3161
|
-
text:
|
|
3162
|
-
description:
|
|
3163
|
-
descriptionVariant:
|
|
3171
|
+
text: 'mona',
|
|
3172
|
+
description: 'Monalisa Octocat',
|
|
3173
|
+
descriptionVariant: 'block',
|
|
3164
3174
|
},
|
|
3165
3175
|
{
|
|
3166
|
-
key:
|
|
3176
|
+
key: '2',
|
|
3167
3177
|
leadingVisual: GearIcon,
|
|
3168
|
-
text:
|
|
3178
|
+
text: 'View Settings',
|
|
3169
3179
|
trailingVisual: ArrowRightIcon,
|
|
3170
3180
|
},
|
|
3171
3181
|
]}
|
|
@@ -3188,9 +3198,7 @@
|
|
|
3188
3198
|
<Avatar src="https://github.com/mona.png" />
|
|
3189
3199
|
</ActionList.LeadingVisual>
|
|
3190
3200
|
mona
|
|
3191
|
-
<ActionList.Description variant="block">
|
|
3192
|
-
Monalisa Octocat
|
|
3193
|
-
</ActionList.Description>
|
|
3201
|
+
<ActionList.Description variant="block">Monalisa Octocat</ActionList.Description>
|
|
3194
3202
|
</ActionList.Item>
|
|
3195
3203
|
<ActionList.Item>
|
|
3196
3204
|
<ActionList.LeadingVisual>
|
|
@@ -3212,14 +3220,14 @@
|
|
|
3212
3220
|
```jsx
|
|
3213
3221
|
<ActionList
|
|
3214
3222
|
groupMetadata={[
|
|
3215
|
-
{
|
|
3216
|
-
{
|
|
3223
|
+
{groupId: '0', header: {title: 'Live query'}},
|
|
3224
|
+
{groupId: '1', header: {title: 'Layout'}},
|
|
3217
3225
|
]}
|
|
3218
3226
|
items={[
|
|
3219
|
-
{
|
|
3220
|
-
{
|
|
3221
|
-
{
|
|
3222
|
-
{
|
|
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'},
|
|
3223
3231
|
]}
|
|
3224
3232
|
/>
|
|
3225
3233
|
```
|
|
@@ -3251,7 +3259,7 @@
|
|
|
3251
3259
|
To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`:
|
|
3252
3260
|
|
|
3253
3261
|
```js
|
|
3254
|
-
import {
|
|
3262
|
+
import {ActionList} from '@primer/react/deprecated'
|
|
3255
3263
|
```
|
|
3256
3264
|
|
|
3257
3265
|
You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically.
|
|
@@ -3302,13 +3310,13 @@
|
|
|
3302
3310
|
anchorContent="Menu"
|
|
3303
3311
|
onAction={fn}
|
|
3304
3312
|
items={[
|
|
3305
|
-
{
|
|
3306
|
-
{
|
|
3307
|
-
{
|
|
3313
|
+
{text: 'New file'},
|
|
3314
|
+
{text: 'Copy link'},
|
|
3315
|
+
{text: 'Edit file'},
|
|
3308
3316
|
ActionMenu.Divider,
|
|
3309
|
-
{
|
|
3317
|
+
{text: 'Delete file', variant: 'danger'},
|
|
3310
3318
|
]}
|
|
3311
|
-
overlayProps={{
|
|
3319
|
+
overlayProps={{width: 'small'}}
|
|
3312
3320
|
/>
|
|
3313
3321
|
```
|
|
3314
3322
|
|
|
@@ -3337,7 +3345,7 @@
|
|
|
3337
3345
|
To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`:
|
|
3338
3346
|
|
|
3339
3347
|
```js
|
|
3340
|
-
import {
|
|
3348
|
+
import {ActionMenu} from '@primer/react/deprecated'
|
|
3341
3349
|
```
|
|
3342
3350
|
|
|
3343
3351
|
You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically.
|
|
@@ -3369,19 +3377,19 @@
|
|
|
3369
3377
|
|
|
3370
3378
|
```js
|
|
3371
3379
|
const fieldTypes = [
|
|
3372
|
-
{
|
|
3373
|
-
{
|
|
3374
|
-
{
|
|
3375
|
-
{
|
|
3376
|
-
{
|
|
3377
|
-
]
|
|
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
|
+
]
|
|
3378
3386
|
|
|
3379
3387
|
const Example = () => {
|
|
3380
|
-
const [selectedType, setSelectedType] = React.useState()
|
|
3388
|
+
const [selectedType, setSelectedType] = React.useState()
|
|
3381
3389
|
|
|
3382
3390
|
return (
|
|
3383
3391
|
<DropdownMenu
|
|
3384
|
-
renderAnchor={({
|
|
3392
|
+
renderAnchor={({children, ...anchorProps}) => (
|
|
3385
3393
|
<ButtonInvisible {...anchorProps}>
|
|
3386
3394
|
{children} <GearIcon />
|
|
3387
3395
|
</ButtonInvisible>
|
|
@@ -3390,10 +3398,10 @@
|
|
|
3390
3398
|
items={fieldTypes}
|
|
3391
3399
|
selectedItem={selectedType}
|
|
3392
3400
|
onChange={setSelectedType}
|
|
3393
|
-
overlayProps={{
|
|
3401
|
+
overlayProps={{width: 'medium'}}
|
|
3394
3402
|
/>
|
|
3395
|
-
)
|
|
3396
|
-
}
|
|
3403
|
+
)
|
|
3404
|
+
}
|
|
3397
3405
|
```
|
|
3398
3406
|
|
|
3399
3407
|
</td>
|
|
@@ -3401,24 +3409,22 @@
|
|
|
3401
3409
|
|
|
3402
3410
|
```jsx
|
|
3403
3411
|
const fieldTypes = [
|
|
3404
|
-
{
|
|
3405
|
-
{
|
|
3406
|
-
{
|
|
3407
|
-
{
|
|
3408
|
-
{
|
|
3409
|
-
]
|
|
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
|
+
]
|
|
3410
3418
|
|
|
3411
3419
|
const Example = () => {
|
|
3412
|
-
const [selectedType, setSelectedType] = React.useState()
|
|
3420
|
+
const [selectedType, setSelectedType] = React.useState()
|
|
3413
3421
|
|
|
3414
3422
|
render(
|
|
3415
3423
|
<ActionMenu>
|
|
3416
|
-
<ActionMenu.Button aria-label="Select field type">
|
|
3417
|
-
{selectedType.name || "Field type"}
|
|
3418
|
-
</ActionMenu.Button>
|
|
3424
|
+
<ActionMenu.Button aria-label="Select field type">{selectedType.name || 'Field type'}</ActionMenu.Button>
|
|
3419
3425
|
<ActionMenu.Overlay width="medium">
|
|
3420
3426
|
<ActionList selectionVariant="single">
|
|
3421
|
-
{fieldTypes.map(
|
|
3427
|
+
{fieldTypes.map(type => (
|
|
3422
3428
|
<ActionList.Item
|
|
3423
3429
|
key={type.id}
|
|
3424
3430
|
selected={type.id === selectedType.id}
|
|
@@ -3430,8 +3436,8 @@
|
|
|
3430
3436
|
</ActionList>
|
|
3431
3437
|
</ActionMenu.Overlay>
|
|
3432
3438
|
</ActionMenu>,
|
|
3433
|
-
)
|
|
3434
|
-
}
|
|
3439
|
+
)
|
|
3440
|
+
}
|
|
3435
3441
|
```
|
|
3436
3442
|
|
|
3437
3443
|
</td>
|
|
@@ -3441,7 +3447,7 @@
|
|
|
3441
3447
|
To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`:
|
|
3442
3448
|
|
|
3443
3449
|
```js
|
|
3444
|
-
import {
|
|
3450
|
+
import {DropdownMenu} from '@primer/react/deprecated'
|
|
3445
3451
|
```
|
|
3446
3452
|
|
|
3447
3453
|
You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically.
|
|
@@ -3472,21 +3478,17 @@
|
|
|
3472
3478
|
<td valign="top">
|
|
3473
3479
|
|
|
3474
3480
|
```jsx
|
|
3475
|
-
import {
|
|
3481
|
+
import {Label} from '@primer/react'
|
|
3476
3482
|
|
|
3477
3483
|
function Example() {
|
|
3478
3484
|
return (
|
|
3479
3485
|
<>
|
|
3480
3486
|
<Label outline>default</Label>
|
|
3481
|
-
<Label
|
|
3482
|
-
variant="small"
|
|
3483
|
-
outline
|
|
3484
|
-
sx={{ borderColor: "danger.emphasis", color: "danger.fg" }}
|
|
3485
|
-
>
|
|
3487
|
+
<Label variant="small" outline sx={{borderColor: 'danger.emphasis', color: 'danger.fg'}}>
|
|
3486
3488
|
danger
|
|
3487
3489
|
</Label>
|
|
3488
3490
|
</>
|
|
3489
|
-
)
|
|
3491
|
+
)
|
|
3490
3492
|
}
|
|
3491
3493
|
```
|
|
3492
3494
|
|
|
@@ -3494,7 +3496,7 @@
|
|
|
3494
3496
|
<td valign="top">
|
|
3495
3497
|
|
|
3496
3498
|
```jsx
|
|
3497
|
-
import {
|
|
3499
|
+
import {Label} from '@primer/react'
|
|
3498
3500
|
|
|
3499
3501
|
function Example() {
|
|
3500
3502
|
return (
|
|
@@ -3504,7 +3506,7 @@
|
|
|
3504
3506
|
danger
|
|
3505
3507
|
</Label>
|
|
3506
3508
|
</>
|
|
3507
|
-
)
|
|
3509
|
+
)
|
|
3508
3510
|
}
|
|
3509
3511
|
```
|
|
3510
3512
|
|
|
@@ -3515,7 +3517,7 @@
|
|
|
3515
3517
|
To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`:
|
|
3516
3518
|
|
|
3517
3519
|
```js
|
|
3518
|
-
import {
|
|
3520
|
+
import {Label} from '@primer/react/deprecated'
|
|
3519
3521
|
```
|
|
3520
3522
|
|
|
3521
3523
|
You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically.
|
|
@@ -3538,12 +3540,7 @@
|
|
|
3538
3540
|
<td valign="top">
|
|
3539
3541
|
|
|
3540
3542
|
```jsx
|
|
3541
|
-
import {
|
|
3542
|
-
ButtonPrimary,
|
|
3543
|
-
ButtonInvisible,
|
|
3544
|
-
ButtonOutline,
|
|
3545
|
-
ButtonDanger,
|
|
3546
|
-
} from "@primer/react";
|
|
3543
|
+
import {ButtonPrimary, ButtonInvisible, ButtonOutline, ButtonDanger} from '@primer/react'
|
|
3547
3544
|
|
|
3548
3545
|
function Example() {
|
|
3549
3546
|
return (
|
|
@@ -3553,7 +3550,7 @@
|
|
|
3553
3550
|
<ButtonOutline>Outline Button</ButtonOutline>
|
|
3554
3551
|
<ButtonDanger>Danger Button</ButtonDanger>
|
|
3555
3552
|
</>
|
|
3556
|
-
)
|
|
3553
|
+
)
|
|
3557
3554
|
}
|
|
3558
3555
|
```
|
|
3559
3556
|
|
|
@@ -3561,7 +3558,7 @@
|
|
|
3561
3558
|
<td valign="top">
|
|
3562
3559
|
|
|
3563
3560
|
```jsx
|
|
3564
|
-
import {
|
|
3561
|
+
import {Button} from '@primer/react'
|
|
3565
3562
|
|
|
3566
3563
|
function Example() {
|
|
3567
3564
|
return (
|
|
@@ -3571,7 +3568,7 @@
|
|
|
3571
3568
|
<Button variant="outline">Outline Button</Button>
|
|
3572
3569
|
<Button variant="danger">Danger Button</Button>
|
|
3573
3570
|
</>
|
|
3574
|
-
)
|
|
3571
|
+
)
|
|
3575
3572
|
}
|
|
3576
3573
|
```
|
|
3577
3574
|
|
|
@@ -3678,50 +3675,34 @@
|
|
|
3678
3675
|
<td valign="top">
|
|
3679
3676
|
|
|
3680
3677
|
```jsx
|
|
3681
|
-
import {
|
|
3678
|
+
import {ChoiceFieldset} from '@primer/react'
|
|
3682
3679
|
|
|
3683
3680
|
function Example() {
|
|
3684
3681
|
return (
|
|
3685
3682
|
<>
|
|
3686
3683
|
{/* Multi-select */}
|
|
3687
3684
|
<ChoiceFieldset>
|
|
3688
|
-
<ChoiceFieldset.Legend>
|
|
3689
|
-
Preferred Primer component interface
|
|
3690
|
-
</ChoiceFieldset.Legend>
|
|
3685
|
+
<ChoiceFieldset.Legend>Preferred Primer component interface</ChoiceFieldset.Legend>
|
|
3691
3686
|
<ChoiceFieldset.List selectionVariant="multiple">
|
|
3692
|
-
<ChoiceFieldset.Item value="figma">
|
|
3693
|
-
Figma library
|
|
3694
|
-
</ChoiceFieldset.Item>
|
|
3687
|
+
<ChoiceFieldset.Item value="figma">Figma library</ChoiceFieldset.Item>
|
|
3695
3688
|
<ChoiceFieldset.Item value="css">Primer CSS</ChoiceFieldset.Item>
|
|
3696
|
-
<ChoiceFieldset.Item value="react">
|
|
3697
|
-
|
|
3698
|
-
</ChoiceFieldset.Item>
|
|
3699
|
-
<ChoiceFieldset.Item value="viewcomponents">
|
|
3700
|
-
Primer ViewComponents
|
|
3701
|
-
</ChoiceFieldset.Item>
|
|
3689
|
+
<ChoiceFieldset.Item value="react">Primer React components</ChoiceFieldset.Item>
|
|
3690
|
+
<ChoiceFieldset.Item value="viewcomponents">Primer ViewComponents</ChoiceFieldset.Item>
|
|
3702
3691
|
</ChoiceFieldset.List>
|
|
3703
3692
|
</ChoiceFieldset>
|
|
3704
3693
|
|
|
3705
3694
|
{/* Single select */}
|
|
3706
3695
|
<ChoiceFieldset>
|
|
3707
|
-
<ChoiceFieldset.Legend>
|
|
3708
|
-
Preferred Primer component interface
|
|
3709
|
-
</ChoiceFieldset.Legend>
|
|
3696
|
+
<ChoiceFieldset.Legend>Preferred Primer component interface</ChoiceFieldset.Legend>
|
|
3710
3697
|
<ChoiceFieldset.List>
|
|
3711
|
-
<ChoiceFieldset.Item value="figma">
|
|
3712
|
-
Figma library
|
|
3713
|
-
</ChoiceFieldset.Item>
|
|
3698
|
+
<ChoiceFieldset.Item value="figma">Figma library</ChoiceFieldset.Item>
|
|
3714
3699
|
<ChoiceFieldset.Item value="css">Primer CSS</ChoiceFieldset.Item>
|
|
3715
|
-
<ChoiceFieldset.Item value="react">
|
|
3716
|
-
|
|
3717
|
-
</ChoiceFieldset.Item>
|
|
3718
|
-
<ChoiceFieldset.Item value="viewcomponents">
|
|
3719
|
-
Primer ViewComponents
|
|
3720
|
-
</ChoiceFieldset.Item>
|
|
3700
|
+
<ChoiceFieldset.Item value="react">Primer React components</ChoiceFieldset.Item>
|
|
3701
|
+
<ChoiceFieldset.Item value="viewcomponents">Primer ViewComponents</ChoiceFieldset.Item>
|
|
3721
3702
|
</ChoiceFieldset.List>
|
|
3722
3703
|
</ChoiceFieldset>
|
|
3723
3704
|
</>
|
|
3724
|
-
)
|
|
3705
|
+
)
|
|
3725
3706
|
}
|
|
3726
3707
|
```
|
|
3727
3708
|
|
|
@@ -3729,22 +3710,14 @@
|
|
|
3729
3710
|
<td valign="top">
|
|
3730
3711
|
|
|
3731
3712
|
```jsx
|
|
3732
|
-
import {
|
|
3733
|
-
CheckboxGroup,
|
|
3734
|
-
RadioGroup,
|
|
3735
|
-
FormControl,
|
|
3736
|
-
Checkbox,
|
|
3737
|
-
Radio,
|
|
3738
|
-
} from "@primer/react";
|
|
3713
|
+
import {CheckboxGroup, RadioGroup, FormControl, Checkbox, Radio} from '@primer/react'
|
|
3739
3714
|
|
|
3740
3715
|
function Example() {
|
|
3741
3716
|
return (
|
|
3742
3717
|
<>
|
|
3743
3718
|
{/* Multi-select */}
|
|
3744
3719
|
<CheckboxGroup>
|
|
3745
|
-
<CheckboxGroup.Label>
|
|
3746
|
-
Preferred Primer component interface
|
|
3747
|
-
</CheckboxGroup.Label>
|
|
3720
|
+
<CheckboxGroup.Label>Preferred Primer component interface</CheckboxGroup.Label>
|
|
3748
3721
|
<FormControl>
|
|
3749
3722
|
<Checkbox value="figma" />
|
|
3750
3723
|
<FormControl.Label>Figma</FormControl.Label>
|
|
@@ -3765,9 +3738,7 @@
|
|
|
3765
3738
|
|
|
3766
3739
|
{/* Single select */}
|
|
3767
3740
|
<RadioGroup name="preferred-primer">
|
|
3768
|
-
<RadioGroup.Label>
|
|
3769
|
-
Preferred Primer component interface
|
|
3770
|
-
</RadioGroup.Label>
|
|
3741
|
+
<RadioGroup.Label>Preferred Primer component interface</RadioGroup.Label>
|
|
3771
3742
|
<FormControl>
|
|
3772
3743
|
<Radio value="figma" />
|
|
3773
3744
|
<FormControl.Label>Figma</FormControl.Label>
|
|
@@ -3786,7 +3757,7 @@
|
|
|
3786
3757
|
</FormControl>
|
|
3787
3758
|
</RadioGroup>
|
|
3788
3759
|
</>
|
|
3789
|
-
)
|
|
3760
|
+
)
|
|
3790
3761
|
}
|
|
3791
3762
|
```
|
|
3792
3763
|
|
|
@@ -3797,7 +3768,7 @@
|
|
|
3797
3768
|
To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`:
|
|
3798
3769
|
|
|
3799
3770
|
```js
|
|
3800
|
-
import {
|
|
3771
|
+
import {ChoiceFieldset} from '@primer/react/deprecated'
|
|
3801
3772
|
```
|
|
3802
3773
|
|
|
3803
3774
|
You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically.
|
|
@@ -3829,7 +3800,7 @@
|
|
|
3829
3800
|
<td valign="top">
|
|
3830
3801
|
|
|
3831
3802
|
```jsx
|
|
3832
|
-
import {
|
|
3803
|
+
import {FormControl, Checkbox, TextInput} from '@primer/react'
|
|
3833
3804
|
|
|
3834
3805
|
function Example() {
|
|
3835
3806
|
return (
|
|
@@ -3849,7 +3820,7 @@
|
|
|
3849
3820
|
<Checkbox />
|
|
3850
3821
|
</ChoiceInputField>
|
|
3851
3822
|
</>
|
|
3852
|
-
)
|
|
3823
|
+
)
|
|
3853
3824
|
}
|
|
3854
3825
|
```
|
|
3855
3826
|
|
|
@@ -3857,7 +3828,7 @@
|
|
|
3857
3828
|
<td valign="top">
|
|
3858
3829
|
|
|
3859
3830
|
```jsx
|
|
3860
|
-
import {
|
|
3831
|
+
import {FormGroup, TextInput} from '@primer/react'
|
|
3861
3832
|
|
|
3862
3833
|
function Example() {
|
|
3863
3834
|
return (
|
|
@@ -3872,7 +3843,7 @@
|
|
|
3872
3843
|
<Checkbox />
|
|
3873
3844
|
</FormControl>
|
|
3874
3845
|
</>
|
|
3875
|
-
)
|
|
3846
|
+
)
|
|
3876
3847
|
}
|
|
3877
3848
|
```
|
|
3878
3849
|
|
|
@@ -3882,7 +3853,7 @@
|
|
|
3882
3853
|
<td valign="top">
|
|
3883
3854
|
|
|
3884
3855
|
```jsx
|
|
3885
|
-
import {
|
|
3856
|
+
import {InputField, TextInput} from '@primer/react'
|
|
3886
3857
|
|
|
3887
3858
|
function Example() {
|
|
3888
3859
|
return (
|
|
@@ -3890,7 +3861,7 @@
|
|
|
3890
3861
|
<InputField.Label>Example text</InputField.Label>
|
|
3891
3862
|
<TextInput />
|
|
3892
3863
|
</InputField>
|
|
3893
|
-
)
|
|
3864
|
+
)
|
|
3894
3865
|
}
|
|
3895
3866
|
```
|
|
3896
3867
|
|
|
@@ -3898,7 +3869,7 @@
|
|
|
3898
3869
|
<td valign="top">
|
|
3899
3870
|
|
|
3900
3871
|
```jsx
|
|
3901
|
-
import {
|
|
3872
|
+
import {FormControl, TextInput} from '@primer/react'
|
|
3902
3873
|
|
|
3903
3874
|
function Example() {
|
|
3904
3875
|
return (
|
|
@@ -3906,7 +3877,7 @@
|
|
|
3906
3877
|
<FormControl.Label>Example text</FormControl.Label>
|
|
3907
3878
|
<TextInput />
|
|
3908
3879
|
</FormControl>
|
|
3909
|
-
)
|
|
3880
|
+
)
|
|
3910
3881
|
}
|
|
3911
3882
|
```
|
|
3912
3883
|
|
|
@@ -3917,11 +3888,7 @@
|
|
|
3917
3888
|
To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`:
|
|
3918
3889
|
|
|
3919
3890
|
```js
|
|
3920
|
-
import {
|
|
3921
|
-
FormGroup,
|
|
3922
|
-
ChoiceInputField,
|
|
3923
|
-
InputField,
|
|
3924
|
-
} from "@primer/react/deprecated";
|
|
3891
|
+
import {FormGroup, ChoiceInputField, InputField} from '@primer/react/deprecated'
|
|
3925
3892
|
```
|
|
3926
3893
|
|
|
3927
3894
|
You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically.
|
|
@@ -3992,25 +3959,23 @@
|
|
|
3992
3959
|
|
|
3993
3960
|
```jsx
|
|
3994
3961
|
const fieldTypes = [
|
|
3995
|
-
{
|
|
3996
|
-
{
|
|
3997
|
-
]
|
|
3962
|
+
{leadingVisual: TypographyIcon, text: 'Text'},
|
|
3963
|
+
{leadingVisual: NumberIcon, text: 'Number'},
|
|
3964
|
+
]
|
|
3998
3965
|
|
|
3999
3966
|
const Example = () => {
|
|
4000
|
-
const [selectedItem, setSelectedItem] = React.useState()
|
|
3967
|
+
const [selectedItem, setSelectedItem] = React.useState()
|
|
4001
3968
|
|
|
4002
3969
|
return (
|
|
4003
3970
|
<DropdownMenu
|
|
4004
|
-
renderAnchor={({
|
|
4005
|
-
<ButtonInvisible {...anchorProps}>{children}</ButtonInvisible>
|
|
4006
|
-
)}
|
|
3971
|
+
renderAnchor={({children, ...anchorProps}) => <ButtonInvisible {...anchorProps}>{children}</ButtonInvisible>}
|
|
4007
3972
|
placeholder="Select a field type"
|
|
4008
3973
|
items={fieldTypes}
|
|
4009
3974
|
selectedItem={selectedItem}
|
|
4010
3975
|
onChange={() => setSelectedIndex(index)}
|
|
4011
3976
|
/>
|
|
4012
|
-
)
|
|
4013
|
-
}
|
|
3977
|
+
)
|
|
3978
|
+
}
|
|
4014
3979
|
```
|
|
4015
3980
|
|
|
4016
3981
|
</td>
|
|
@@ -4018,36 +3983,29 @@
|
|
|
4018
3983
|
|
|
4019
3984
|
```jsx
|
|
4020
3985
|
const fieldTypes = [
|
|
4021
|
-
{
|
|
4022
|
-
{
|
|
4023
|
-
]
|
|
3986
|
+
{icon: <TypographyIcon />, name: 'Text'},
|
|
3987
|
+
{icon: <NumberIcon />, name: 'Number'},
|
|
3988
|
+
]
|
|
4024
3989
|
|
|
4025
3990
|
const Example = () => {
|
|
4026
|
-
const [selectedItem, setSelectedItem] = React.useState()
|
|
3991
|
+
const [selectedItem, setSelectedItem] = React.useState()
|
|
4027
3992
|
|
|
4028
3993
|
return (
|
|
4029
3994
|
<ActionMenu>
|
|
4030
|
-
<ActionMenu.Button>
|
|
4031
|
-
{selectedItem ? selectedItem.name : "Select a field type"}
|
|
4032
|
-
</ActionMenu.Button>
|
|
3995
|
+
<ActionMenu.Button>{selectedItem ? selectedItem.name : 'Select a field type'}</ActionMenu.Button>
|
|
4033
3996
|
<ActionMenu.Overlay>
|
|
4034
3997
|
<ActionList selectionVariant="single">
|
|
4035
|
-
{fieldTypes.map(
|
|
4036
|
-
<ActionList.Item
|
|
4037
|
-
|
|
4038
|
-
key={field.name}
|
|
4039
|
-
>
|
|
4040
|
-
<ActionList.LeadingVisual>
|
|
4041
|
-
{field.icon}
|
|
4042
|
-
</ActionList.LeadingVisual>
|
|
3998
|
+
{fieldTypes.map(field => (
|
|
3999
|
+
<ActionList.Item onSelect={() => setSelectedItem(field)} key={field.name}>
|
|
4000
|
+
<ActionList.LeadingVisual>{field.icon}</ActionList.LeadingVisual>
|
|
4043
4001
|
{field.name}
|
|
4044
4002
|
</ActionList.Item>
|
|
4045
4003
|
))}
|
|
4046
4004
|
</ActionList>
|
|
4047
4005
|
</ActionMenu.Overlay>
|
|
4048
4006
|
</ActionMenu>
|
|
4049
|
-
)
|
|
4050
|
-
}
|
|
4007
|
+
)
|
|
4008
|
+
}
|
|
4051
4009
|
```
|
|
4052
4010
|
|
|
4053
4011
|
</td>
|
|
@@ -4149,12 +4107,7 @@
|
|
|
4149
4107
|
<td valign="top">
|
|
4150
4108
|
|
|
4151
4109
|
```jsx
|
|
4152
|
-
<Box
|
|
4153
|
-
borderWidth="1px"
|
|
4154
|
-
borderStyle="solid"
|
|
4155
|
-
borderColor="border.default"
|
|
4156
|
-
borderRadius={2}
|
|
4157
|
-
>
|
|
4110
|
+
<Box borderWidth="1px" borderStyle="solid" borderColor="border.default" borderRadius={2}>
|
|
4158
4111
|
Item 1
|
|
4159
4112
|
</Box>
|
|
4160
4113
|
```
|
|
@@ -5198,8 +5151,8 @@
|
|
|
5198
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:
|
|
5199
5152
|
|
|
5200
5153
|
```jsx
|
|
5201
|
-
import {
|
|
5202
|
-
import {
|
|
5154
|
+
import {ThemeProvider} from 'styled-components'
|
|
5155
|
+
import {theme} from '@primer/react'
|
|
5203
5156
|
|
|
5204
5157
|
function App(props) {
|
|
5205
5158
|
return (
|
|
@@ -5208,7 +5161,7 @@
|
|
|
5208
5161
|
<div>your app here</div>
|
|
5209
5162
|
</ThemeProvider>
|
|
5210
5163
|
</div>
|
|
5211
|
-
)
|
|
5164
|
+
)
|
|
5212
5165
|
}
|
|
5213
5166
|
```
|
|
5214
5167
|
|