From ff6c17e15f3d13689c113ede57b288b71f4ebd6f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 5 Nov 2024 23:22:04 +0000 Subject: [PATCH 1/2] Version Packages --- .changeset/odd-singers-hammer.md | 5 - .changeset/silent-cherries-behave.md | 5 - .changeset/sixty-onions-share.md | 5 - .changeset/tender-dodos-walk.md | 5 - .changeset/thirty-worms-accept.md | 5 - examples/app-router/package.json | 2 +- examples/codesandbox/package.json | 2 +- examples/consumer-test/package.json | 2 +- examples/theming/package.json | 2 +- packages/react/CHANGELOG.md | 285 +++++++++++++++++---------- packages/react/package.json | 2 +- 11 files changed, 184 insertions(+), 136 deletions(-) delete mode 100644 .changeset/odd-singers-hammer.md delete mode 100644 .changeset/silent-cherries-behave.md delete mode 100644 .changeset/sixty-onions-share.md delete mode 100644 .changeset/tender-dodos-walk.md delete mode 100644 .changeset/thirty-worms-accept.md diff --git a/.changeset/odd-singers-hammer.md b/.changeset/odd-singers-hammer.md deleted file mode 100644 index 487fa8e0cdb..00000000000 --- a/.changeset/odd-singers-hammer.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@primer/react": patch ---- - -Update Blankslate description text to always be centered diff --git a/.changeset/silent-cherries-behave.md b/.changeset/silent-cherries-behave.md deleted file mode 100644 index ee09a911a13..00000000000 --- a/.changeset/silent-cherries-behave.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@primer/react": minor ---- - -Migrate 'InlineMessage' component to use CSS modules diff --git a/.changeset/sixty-onions-share.md b/.changeset/sixty-onions-share.md deleted file mode 100644 index 10c54dc457a..00000000000 --- a/.changeset/sixty-onions-share.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@primer/react': patch ---- - -fix: hover background in ActionList.Item diff --git a/.changeset/tender-dodos-walk.md b/.changeset/tender-dodos-walk.md deleted file mode 100644 index 3ba0bcc752b..00000000000 --- a/.changeset/tender-dodos-walk.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@primer/react": patch ---- - -fix(Treevieew):do not add aria-describedby attribute when empty leading/trailing visual diff --git a/.changeset/thirty-worms-accept.md b/.changeset/thirty-worms-accept.md deleted file mode 100644 index ecb267ba39f..00000000000 --- a/.changeset/thirty-worms-accept.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@primer/react": patch ---- - -Move ButtonGroup css module feature flag to staff diff --git a/examples/app-router/package.json b/examples/app-router/package.json index faa75d603b7..4938f9b5012 100644 --- a/examples/app-router/package.json +++ b/examples/app-router/package.json @@ -10,7 +10,7 @@ "type-check": "tsc --noEmit" }, "dependencies": { - "@primer/react": "37.2.0", + "@primer/react": "37.3.0", "next": "^14.2.10", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/examples/codesandbox/package.json b/examples/codesandbox/package.json index 92be01382f1..35a575f7d44 100644 --- a/examples/codesandbox/package.json +++ b/examples/codesandbox/package.json @@ -20,7 +20,7 @@ "@typescript-eslint/eslint-plugin": "^7.11.0", "@typescript-eslint/parser": "^7.3.1", "@vitejs/plugin-react": "^4.2.1", - "@primer/react": "37.2.0", + "@primer/react": "37.3.0", "eslint": "^8.56.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.7", diff --git a/examples/consumer-test/package.json b/examples/consumer-test/package.json index 802eb212402..b1bad64ec15 100644 --- a/examples/consumer-test/package.json +++ b/examples/consumer-test/package.json @@ -9,7 +9,7 @@ "@types/react": "^18.3.11", "@types/react-dom": "^18.2.19", "@types/styled-components": "^5.1.11", - "@primer/react": "37.2.0", + "@primer/react": "37.3.0", "react": "^18.0.0", "react-dom": "^18.0.0", "styled-components": "^5.3.11", diff --git a/examples/theming/package.json b/examples/theming/package.json index 4e8df949a62..66baf650461 100644 --- a/examples/theming/package.json +++ b/examples/theming/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "@primer/octicons-react": "^19.9.0", - "@primer/react": "37.2.0", + "@primer/react": "37.3.0", "clsx": "^1.2.1", "next": "^14.2.10", "react": "^18.3.1", diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index 7de84c6b740..5c16ff812e7 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,5 +1,21 @@ # @primer/react +## 37.3.0 + +### Minor Changes + +- [#5204](https://github.com/primer/react/pull/5204) [`209c9b0`](https://github.com/primer/react/commit/209c9b0f92a7e1006db8e5752ace247168268340) Thanks [@randall-krauskopf](https://github.com/randall-krauskopf)! - Migrate 'InlineMessage' component to use CSS modules + +### Patch Changes + +- [#5229](https://github.com/primer/react/pull/5229) [`33c5086`](https://github.com/primer/react/commit/33c5086f24cb42a1b2bf7447021520467cb54af6) Thanks [@joshblack](https://github.com/joshblack)! - Update Blankslate description text to always be centered + +- [#4693](https://github.com/primer/react/pull/4693) [`570d4b3`](https://github.com/primer/react/commit/570d4b3f3e14f58c134a1716cec6b8bbe79e4f48) Thanks [@renbaoshuo](https://github.com/renbaoshuo)! - fix: hover background in ActionList.Item + +- [#5196](https://github.com/primer/react/pull/5196) [`49cbff2`](https://github.com/primer/react/commit/49cbff223459b3805dc6160c771529b7752a9042) Thanks [@francinelucca](https://github.com/francinelucca)! - fix(Treevieew):do not add aria-describedby attribute when empty leading/trailing visual + +- [#5144](https://github.com/primer/react/pull/5144) [`271d063`](https://github.com/primer/react/commit/271d063813f3e623bcced3bf949e5c31ba0e3fd9) Thanks [@jonrohan](https://github.com/jonrohan)! - Move ButtonGroup css module feature flag to staff + ## 37.2.0 ### Minor Changes @@ -2445,7 +2461,7 @@ ```jsx // Hide pane on narrow viewports - + ``` - [#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. @@ -2606,7 +2622,7 @@ - [#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: ```js - import {NavList} from '@primer/react' + import { NavList } from "@primer/react"; ``` ### Patch Changes @@ -2747,11 +2763,11 @@ ```jsx ``` @@ -2779,21 +2795,21 @@ showItemDividers items={[ { - key: '0', + key: "0", leadingVisual: LinkIcon, - text: 'github/primer', + text: "github/primer", }, { - key: '1', + key: "1", leadingVisual: () => , - text: 'mona', - description: 'Monalisa Octocat', - descriptionVariant: 'block', + text: "mona", + description: "Monalisa Octocat", + descriptionVariant: "block", }, { - key: '2', + key: "2", leadingVisual: GearIcon, - text: 'View Settings', + text: "View Settings", trailingVisual: ArrowRightIcon, }, ]} @@ -2816,7 +2832,9 @@ mona - Monalisa Octocat + + Monalisa Octocat + @@ -2838,14 +2856,14 @@ ```jsx ``` @@ -2877,7 +2895,7 @@ To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`: ```js - import {ActionList} from '@primer/react/deprecated' + 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. @@ -2928,13 +2946,13 @@ anchorContent="Menu" onAction={fn} items={[ - {text: 'New file'}, - {text: 'Copy link'}, - {text: 'Edit file'}, + { text: "New file" }, + { text: "Copy link" }, + { text: "Edit file" }, ActionMenu.Divider, - {text: 'Delete file', variant: 'danger'}, + { text: "Delete file", variant: "danger" }, ]} - overlayProps={{width: 'small'}} + overlayProps={{ width: "small" }} /> ``` @@ -2963,7 +2981,7 @@ To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`: ```js - import {ActionMenu} from '@primer/react/deprecated' + import { ActionMenu } from "@primer/react/deprecated"; ``` You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically. @@ -2995,19 +3013,19 @@ ```js const fieldTypes = [ - {key: 0, text: 'Text'}, - {key: 1, text: 'Number'}, - {key: 3, text: 'Date'}, - {key: 4, text: 'Single select'}, - {key: 5, text: 'Iteration'}, - ] + { key: 0, text: "Text" }, + { key: 1, text: "Number" }, + { key: 3, text: "Date" }, + { key: 4, text: "Single select" }, + { key: 5, text: "Iteration" }, + ]; const Example = () => { - const [selectedType, setSelectedType] = React.useState() + const [selectedType, setSelectedType] = React.useState(); return ( ( + renderAnchor={({ children, ...anchorProps }) => ( {children} @@ -3016,10 +3034,10 @@ items={fieldTypes} selectedItem={selectedType} onChange={setSelectedType} - overlayProps={{width: 'medium'}} + overlayProps={{ width: "medium" }} /> - ) - } + ); + }; ``` @@ -3027,22 +3045,24 @@ ```jsx const fieldTypes = [ - {id: 0, text: 'Text'}, - {id: 1, text: 'Number'}, - {id: 3, text: 'Date'}, - {id: 4, text: 'Single select'}, - {id: 5, text: 'Iteration'}, - ] + { id: 0, text: "Text" }, + { id: 1, text: "Number" }, + { id: 3, text: "Date" }, + { id: 4, text: "Single select" }, + { id: 5, text: "Iteration" }, + ]; const Example = () => { - const [selectedType, setSelectedType] = React.useState() + const [selectedType, setSelectedType] = React.useState(); render( - {selectedType.name || 'Field type'} + + {selectedType.name || "Field type"} + - {fieldTypes.map(type => ( + {fieldTypes.map((type) => ( , - ) - } + ); + }; ``` @@ -3065,7 +3085,7 @@ To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`: ```js - import {DropdownMenu} from '@primer/react/deprecated' + import { DropdownMenu } from "@primer/react/deprecated"; ``` You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically. @@ -3096,17 +3116,21 @@ ```jsx - import {Label} from '@primer/react' + import { Label } from "@primer/react"; function Example() { return ( <> - - ) + ); } ``` @@ -3135,7 +3159,7 @@ To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`: ```js - import {Label} from '@primer/react/deprecated' + import { Label } from "@primer/react/deprecated"; ``` You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically. @@ -3158,7 +3182,12 @@ ```jsx - import {ButtonPrimary, ButtonInvisible, ButtonOutline, ButtonDanger} from '@primer/react' + import { + ButtonPrimary, + ButtonInvisible, + ButtonOutline, + ButtonDanger, + } from "@primer/react"; function Example() { return ( @@ -3168,7 +3197,7 @@ Outline Button Danger Button - ) + ); } ``` @@ -3176,7 +3205,7 @@ ```jsx - import {Button} from '@primer/react' + import { Button } from "@primer/react"; function Example() { return ( @@ -3186,7 +3215,7 @@ - ) + ); } ``` @@ -3293,34 +3322,50 @@ ```jsx - import {ChoiceFieldset} from '@primer/react' + import { ChoiceFieldset } from "@primer/react"; function Example() { return ( <> {/* Multi-select */} - Preferred Primer component interface + + Preferred Primer component interface + - Figma library + + Figma library + Primer CSS - Primer React components - Primer ViewComponents + + Primer React components + + + Primer ViewComponents + {/* Single select */} - Preferred Primer component interface + + Preferred Primer component interface + - Figma library + + Figma library + Primer CSS - Primer React components - Primer ViewComponents + + Primer React components + + + Primer ViewComponents + - ) + ); } ``` @@ -3328,14 +3373,22 @@ ```jsx - import {CheckboxGroup, RadioGroup, FormControl, Checkbox, Radio} from '@primer/react' + import { + CheckboxGroup, + RadioGroup, + FormControl, + Checkbox, + Radio, + } from "@primer/react"; function Example() { return ( <> {/* Multi-select */} - Preferred Primer component interface + + Preferred Primer component interface + Figma @@ -3356,7 +3409,9 @@ {/* Single select */} - Preferred Primer component interface + + Preferred Primer component interface + Figma @@ -3375,7 +3430,7 @@ - ) + ); } ``` @@ -3386,7 +3441,7 @@ To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`: ```js - import {ChoiceFieldset} from '@primer/react/deprecated' + import { ChoiceFieldset } from "@primer/react/deprecated"; ``` You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically. @@ -3418,7 +3473,7 @@ ```jsx - import {FormControl, Checkbox, TextInput} from '@primer/react' + import { FormControl, Checkbox, TextInput } from "@primer/react"; function Example() { return ( @@ -3438,7 +3493,7 @@ - ) + ); } ``` @@ -3446,7 +3501,7 @@ ```jsx - import {FormGroup, TextInput} from '@primer/react' + import { FormGroup, TextInput } from "@primer/react"; function Example() { return ( @@ -3461,7 +3516,7 @@ - ) + ); } ``` @@ -3471,7 +3526,7 @@ ```jsx - import {InputField, TextInput} from '@primer/react' + import { InputField, TextInput } from "@primer/react"; function Example() { return ( @@ -3479,7 +3534,7 @@ Example text - ) + ); } ``` @@ -3487,7 +3542,7 @@ ```jsx - import {FormControl, TextInput} from '@primer/react' + import { FormControl, TextInput } from "@primer/react"; function Example() { return ( @@ -3495,7 +3550,7 @@ Example text - ) + ); } ``` @@ -3506,7 +3561,11 @@ To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`: ```js - import {FormGroup, ChoiceInputField, InputField} from '@primer/react/deprecated' + import { + FormGroup, + ChoiceInputField, + InputField, + } from "@primer/react/deprecated"; ``` You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically. @@ -3577,23 +3636,25 @@ ```jsx const fieldTypes = [ - {leadingVisual: TypographyIcon, text: 'Text'}, - {leadingVisual: NumberIcon, text: 'Number'}, - ] + { leadingVisual: TypographyIcon, text: "Text" }, + { leadingVisual: NumberIcon, text: "Number" }, + ]; const Example = () => { - const [selectedItem, setSelectedItem] = React.useState() + const [selectedItem, setSelectedItem] = React.useState(); return ( {children}} + renderAnchor={({ children, ...anchorProps }) => ( + {children} + )} placeholder="Select a field type" items={fieldTypes} selectedItem={selectedItem} onChange={() => setSelectedIndex(index)} /> - ) - } + ); + }; ``` @@ -3601,29 +3662,36 @@ ```jsx const fieldTypes = [ - {icon: , name: 'Text'}, - {icon: , name: 'Number'}, - ] + { icon: , name: "Text" }, + { icon: , name: "Number" }, + ]; const Example = () => { - const [selectedItem, setSelectedItem] = React.useState() + const [selectedItem, setSelectedItem] = React.useState(); return ( - {selectedItem ? selectedItem.name : 'Select a field type'} + + {selectedItem ? selectedItem.name : "Select a field type"} + - {fieldTypes.map(field => ( - setSelectedItem(field)} key={field.name}> - {field.icon} + {fieldTypes.map((field) => ( + setSelectedItem(field)} + key={field.name} + > + + {field.icon} + {field.name} ))} - ) - } + ); + }; ``` @@ -3725,7 +3793,12 @@ ```jsx - + Item 1 ``` @@ -4769,8 +4842,8 @@ * [`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/) `` at the root of your application: ```jsx - import {ThemeProvider} from 'styled-components' - import {theme} from '@primer/react' + import { ThemeProvider } from "styled-components"; + import { theme } from "@primer/react"; function App(props) { return ( @@ -4779,7 +4852,7 @@
your app here
- ) + ); } ``` diff --git a/packages/react/package.json b/packages/react/package.json index f84e01dba94..6f761d83304 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@primer/react", - "version": "37.2.0", + "version": "37.3.0", "description": "An implementation of GitHub's Primer Design System using React", "main": "lib/index.js", "module": "lib-esm/index.js", From cc63039caa495ca7dbd36d49d12e4c09b47fe059 Mon Sep 17 00:00:00 2001 From: Siddharth Kshetrapal Date: Wed, 6 Nov 2024 14:34:57 +0100 Subject: [PATCH 2/2] run prettier on changelog.md --- packages/react/CHANGELOG.md | 269 ++++++++++++++---------------------- 1 file changed, 106 insertions(+), 163 deletions(-) diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index 5c16ff812e7..91a35640f8f 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -2461,7 +2461,7 @@ ```jsx // Hide pane on narrow viewports - + ``` - [#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. @@ -2622,7 +2622,7 @@ - [#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: ```js - import { NavList } from "@primer/react"; + import {NavList} from '@primer/react' ``` ### Patch Changes @@ -2763,11 +2763,11 @@ ```jsx ``` @@ -2795,21 +2795,21 @@ showItemDividers items={[ { - key: "0", + key: '0', leadingVisual: LinkIcon, - text: "github/primer", + text: 'github/primer', }, { - key: "1", + key: '1', leadingVisual: () => , - text: "mona", - description: "Monalisa Octocat", - descriptionVariant: "block", + text: 'mona', + description: 'Monalisa Octocat', + descriptionVariant: 'block', }, { - key: "2", + key: '2', leadingVisual: GearIcon, - text: "View Settings", + text: 'View Settings', trailingVisual: ArrowRightIcon, }, ]} @@ -2832,9 +2832,7 @@
mona - - Monalisa Octocat - + Monalisa Octocat
@@ -2856,14 +2854,14 @@ ```jsx ``` @@ -2895,7 +2893,7 @@ To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`: ```js - import { ActionList } from "@primer/react/deprecated"; + 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. @@ -2946,13 +2944,13 @@ anchorContent="Menu" onAction={fn} items={[ - { text: "New file" }, - { text: "Copy link" }, - { text: "Edit file" }, + {text: 'New file'}, + {text: 'Copy link'}, + {text: 'Edit file'}, ActionMenu.Divider, - { text: "Delete file", variant: "danger" }, + {text: 'Delete file', variant: 'danger'}, ]} - overlayProps={{ width: "small" }} + overlayProps={{width: 'small'}} /> ``` @@ -2981,7 +2979,7 @@ To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`: ```js - import { ActionMenu } from "@primer/react/deprecated"; + import {ActionMenu} from '@primer/react/deprecated' ``` You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically. @@ -3013,19 +3011,19 @@ ```js const fieldTypes = [ - { key: 0, text: "Text" }, - { key: 1, text: "Number" }, - { key: 3, text: "Date" }, - { key: 4, text: "Single select" }, - { key: 5, text: "Iteration" }, - ]; + {key: 0, text: 'Text'}, + {key: 1, text: 'Number'}, + {key: 3, text: 'Date'}, + {key: 4, text: 'Single select'}, + {key: 5, text: 'Iteration'}, + ] const Example = () => { - const [selectedType, setSelectedType] = React.useState(); + const [selectedType, setSelectedType] = React.useState() return ( ( + renderAnchor={({children, ...anchorProps}) => ( {children} @@ -3034,10 +3032,10 @@ items={fieldTypes} selectedItem={selectedType} onChange={setSelectedType} - overlayProps={{ width: "medium" }} + overlayProps={{width: 'medium'}} /> - ); - }; + ) + } ``` @@ -3045,24 +3043,22 @@ ```jsx const fieldTypes = [ - { id: 0, text: "Text" }, - { id: 1, text: "Number" }, - { id: 3, text: "Date" }, - { id: 4, text: "Single select" }, - { id: 5, text: "Iteration" }, - ]; + {id: 0, text: 'Text'}, + {id: 1, text: 'Number'}, + {id: 3, text: 'Date'}, + {id: 4, text: 'Single select'}, + {id: 5, text: 'Iteration'}, + ] const Example = () => { - const [selectedType, setSelectedType] = React.useState(); + const [selectedType, setSelectedType] = React.useState() render( - - {selectedType.name || "Field type"} - + {selectedType.name || 'Field type'} - {fieldTypes.map((type) => ( + {fieldTypes.map(type => ( , - ); - }; + ) + } ``` @@ -3085,7 +3081,7 @@ To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`: ```js - import { DropdownMenu } from "@primer/react/deprecated"; + import {DropdownMenu} from '@primer/react/deprecated' ``` You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically. @@ -3116,21 +3112,17 @@ ```jsx - import { Label } from "@primer/react"; + import {Label} from '@primer/react' function Example() { return ( <> - - ); + ) } ``` @@ -3159,7 +3151,7 @@ To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`: ```js - import { Label } from "@primer/react/deprecated"; + import {Label} from '@primer/react/deprecated' ``` You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically. @@ -3182,12 +3174,7 @@ ```jsx - import { - ButtonPrimary, - ButtonInvisible, - ButtonOutline, - ButtonDanger, - } from "@primer/react"; + import {ButtonPrimary, ButtonInvisible, ButtonOutline, ButtonDanger} from '@primer/react' function Example() { return ( @@ -3197,7 +3184,7 @@ Outline Button Danger Button - ); + ) } ``` @@ -3205,7 +3192,7 @@ ```jsx - import { Button } from "@primer/react"; + import {Button} from '@primer/react' function Example() { return ( @@ -3215,7 +3202,7 @@ - ); + ) } ``` @@ -3322,50 +3309,34 @@ ```jsx - import { ChoiceFieldset } from "@primer/react"; + import {ChoiceFieldset} from '@primer/react' function Example() { return ( <> {/* Multi-select */} - - Preferred Primer component interface - + Preferred Primer component interface - - Figma library - + Figma library Primer CSS - - Primer React components - - - Primer ViewComponents - + Primer React components + Primer ViewComponents {/* Single select */} - - Preferred Primer component interface - + Preferred Primer component interface - - Figma library - + Figma library Primer CSS - - Primer React components - - - Primer ViewComponents - + Primer React components + Primer ViewComponents - ); + ) } ``` @@ -3373,22 +3344,14 @@ ```jsx - import { - CheckboxGroup, - RadioGroup, - FormControl, - Checkbox, - Radio, - } from "@primer/react"; + import {CheckboxGroup, RadioGroup, FormControl, Checkbox, Radio} from '@primer/react' function Example() { return ( <> {/* Multi-select */} - - Preferred Primer component interface - + Preferred Primer component interface Figma @@ -3409,9 +3372,7 @@ {/* Single select */} - - Preferred Primer component interface - + Preferred Primer component interface Figma @@ -3430,7 +3391,7 @@ - ); + ) } ``` @@ -3441,7 +3402,7 @@ To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`: ```js - import { ChoiceFieldset } from "@primer/react/deprecated"; + import {ChoiceFieldset} from '@primer/react/deprecated' ``` You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically. @@ -3473,7 +3434,7 @@ ```jsx - import { FormControl, Checkbox, TextInput } from "@primer/react"; + import {FormControl, Checkbox, TextInput} from '@primer/react' function Example() { return ( @@ -3493,7 +3454,7 @@ - ); + ) } ``` @@ -3501,7 +3462,7 @@ ```jsx - import { FormGroup, TextInput } from "@primer/react"; + import {FormGroup, TextInput} from '@primer/react' function Example() { return ( @@ -3516,7 +3477,7 @@ - ); + ) } ``` @@ -3526,7 +3487,7 @@ ```jsx - import { InputField, TextInput } from "@primer/react"; + import {InputField, TextInput} from '@primer/react' function Example() { return ( @@ -3534,7 +3495,7 @@ Example text - ); + ) } ``` @@ -3542,7 +3503,7 @@ ```jsx - import { FormControl, TextInput } from "@primer/react"; + import {FormControl, TextInput} from '@primer/react' function Example() { return ( @@ -3550,7 +3511,7 @@ Example text - ); + ) } ``` @@ -3561,11 +3522,7 @@ To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`: ```js - import { - FormGroup, - ChoiceInputField, - InputField, - } from "@primer/react/deprecated"; + import {FormGroup, ChoiceInputField, InputField} from '@primer/react/deprecated' ``` You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically. @@ -3636,25 +3593,23 @@ ```jsx const fieldTypes = [ - { leadingVisual: TypographyIcon, text: "Text" }, - { leadingVisual: NumberIcon, text: "Number" }, - ]; + {leadingVisual: TypographyIcon, text: 'Text'}, + {leadingVisual: NumberIcon, text: 'Number'}, + ] const Example = () => { - const [selectedItem, setSelectedItem] = React.useState(); + const [selectedItem, setSelectedItem] = React.useState() return ( ( - {children} - )} + renderAnchor={({children, ...anchorProps}) => {children}} placeholder="Select a field type" items={fieldTypes} selectedItem={selectedItem} onChange={() => setSelectedIndex(index)} /> - ); - }; + ) + } ``` @@ -3662,36 +3617,29 @@ ```jsx const fieldTypes = [ - { icon: , name: "Text" }, - { icon: , name: "Number" }, - ]; + {icon: , name: 'Text'}, + {icon: , name: 'Number'}, + ] const Example = () => { - const [selectedItem, setSelectedItem] = React.useState(); + const [selectedItem, setSelectedItem] = React.useState() return ( - - {selectedItem ? selectedItem.name : "Select a field type"} - + {selectedItem ? selectedItem.name : 'Select a field type'} - {fieldTypes.map((field) => ( - setSelectedItem(field)} - key={field.name} - > - - {field.icon} - + {fieldTypes.map(field => ( + setSelectedItem(field)} key={field.name}> + {field.icon} {field.name} ))} - ); - }; + ) + } ``` @@ -3793,12 +3741,7 @@ ```jsx - + Item 1 ``` @@ -4842,8 +4785,8 @@ * [`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/) `` at the root of your application: ```jsx - import { ThemeProvider } from "styled-components"; - import { theme } from "@primer/react"; + import {ThemeProvider} from 'styled-components' + import {theme} from '@primer/react' function App(props) { return ( @@ -4852,7 +4795,7 @@
your app here
- ); + ) } ```