- #1368
36f156a0
Thanks @dgreif! - AllowanchorRef
to be passed intoSelectPanel
if you want to use an external anchor
- #1355
3cc7be77
Thanks @colebemis! - Replace octoface icon with spinner in SelectMenu component
- #1315
85d0202b
Thanks @VanAnderson! -Box
now accepts all styled system props.
-
#1316
4c063317
Thanks @VanAnderson! - The following components have been deprecated in favor of theBox
component:Component Replacement Flex
<Box display="flex">
Grid
<Box display="grid">
Position
<Box>
Absolute
<Box position="absolute">
Fixed
<Box position="fixed">
Relative
<Box position="relative">
Sticky
<Box position="sticky">
BorderBox
<Box borderWidth="1px" borderStyle="solid" borderColor="border.primary" borderRadius={2}>
There is a codemod available to upgrade these components:
-
TypeScript example:
npx jscodeshift -t node_modules/@primer/react/codemods/deprecateUtilityComponents.js --parser=tsx path/to/workspace/src/*.tsx
-
Babel example:
npx jscodeshift -t node_modules/@primer/react/codemods/deprecateUtilityComponents.js --parser=babel path/to/workspace/src/*.tsx
-
-
#1336
489a718b
Thanks @VanAnderson! - System props are deprecated in all components exceptBox
. Move all system props into thesx
prop instead. Example:- <Button mr={2}>...</Button> + <Button sx={{mr: 2}}>...</Button>
There is a codemod available to migrate from system props to the
sx
prop:-
TypeScript example:
npx jscodeshift -t node_modules/@primer/react/codemods/removeSystemProps.js --parser=tsx path/to/workspace/src/*.tsx
-
Babel example:
npx jscodeshift -t node_modules/@primer/react/codemods/removeSystemProps.js --parser=babel path/to/workspace/src/*.tsx
-
- #1332
ec11d7b8
Thanks @mattcosta7! - Side effects are properly declared in package.json
- #1308
a8f3ca6d
Thanks @dgreif! - Focus zones will now update active-descendant onmousemove
over focusable elements. ActionList has been updated to handle direct (key press) vs indirect (mousemove
, DOM change, etc.) changes to active-descendant, and will use a distinct background color for the directly activated items.
- #1309
dc17a49e
Thanks @colebemis! - Include all shadow variables in theme object
- #1251
528e9a41
Thanks @VanAnderson! - CalluseOnOutsideClick
handlers in reverse order that they are registered, and allow propagation to stop if default is prevented or an non-outside click is detected.
- #1312
76a38432
Thanks @smockle! - Ensure clicking anAnchoredOverlay
’s trigger allows it to close without immediately reopening.
- #1293
1148a718
Thanks @smockle! - Restore "fix: Don’t focus first 'Item' of 'DropdownMenu' and 'SelectMenu' on open" by deferring the removal of a temporarytabIndex
until focus moves within the container.
- #1279
bb38754f
Thanks @VanAnderson! - Update overlay shadows
- #1297
5fb3683d
Thanks @VanAnderson! - Bump @primer/primitives to 4.4.0
- #1288
15207119
Thanks @dgreif! - Focus zones with anactiveDescendantControl
will now activate the first descendant as soon as the control element is focused, rather than waiting for an up/down arrow press. Descendants stay active until the control element is blurred. This is a breaking change touseFocusZone
, but this behavior is still considered to be inalpha
.
- #1279
bb38754f
Thanks @VanAnderson! - Update TextInput border color
0ffc381c
#1294 Thanks @VanAnderson! - Revert first item focus fix for ActionList components.
68877076
#1275 Thanks @VanAnderson! - data props can be used in overlayProps.
2793ef48
#1286 Thanks @colebemis! -ThemeProvider
now uses the first defined color scheme if passed an invalid color scheme name
321b9a3d
#1266 Thanks @VanAnderson! - Anchored overlay can take an external anchorRef.
f793ed00
#1280 Thanks @VanAnderson! - Export TexContainer from of ActionList/Item.
8368a83e
#1238 Thanks @dgreif! - New sizes for Overlay and Dialog. Sizes have been changed from abbreviations to full words.xs
->xsmall
,sm
->small
,md
->medium
,lg
->large
,xl
->xlarge
. The sizing forOverlay
has also been updated to provide a wider range of options. The original values for Overlay were based on the needs of Dialog, but Dialog is not reliant on Overlay so they don't need to have similar sizing. This is technically a breaking change, but is being released as a minor because these components are both still inalpha
status.
25d88c49
#1253 Thanks @dgreif! - Correct font size and truncate for description within ActionList Items
9cb715cd
#1258 Thanks @dgreif! - prevent focusTrap from causing ablur
if trap container is not in DOM
aa7d80fc
#1246 Thanks @dgreif! - Fix border radius on buttons and titlefont-weight
in ConfirmationDialog
c1991318
#1158 Thanks @dgreif! - Add background styles for focused action list items, instead of using defaultoutline
0d26d2b0
#1240 Thanks @VanAnderson! - Fix check Spacing on selected items for ActionList components.
e009e321
#1235 Thanks @VanAnderson! - Dialog properly auto-focuses cancel button by default when originating from a FocusZone/FocusTrap.
e1bde42b
#1228 Thanks @VanAnderson! - Action Menu correctly fires onAction callback after close.
961c07eb
#1227 Thanks @stephenotalora! - Change focus state style ofSideNav.Link
c63fa4b5
#1215 Thanks @dgreif! - AddselectionVariant: 'multiple'
forItem
s. These will use a checkbox input instead of a checkmark icon for selected state
d78af591
#1214 Thanks @VanAnderson! - renderMenuItem in ActionMenu checks preventDefault for conditionally calling onClose
4ab3d175
#1222 Thanks @dgreif! - Trap focus inAnchoredOverlay
as soon as it opens, regardless of the event that triggered it to open
ff9ce6f1
#1217 Thanks @VanAnderson! - overlayProps passthrough from ActionMenu and DropdownMenu to AnchoredOverlay.
d20a5996
#1209 Thanks @dgreif! - Allow Overlay height and width to be set through AnchoredOverlay Allow ActionList Items to supply anid
instead ofkey
Performance imporvements when ActionList is not given any groups Enable focus zone as soon as AnchoredOverlay opens
d29741ca
#1196 Thanks @dgreif! - Allow customchildren
inActionItem
.text
anddescription
can still be provided as a shortcut, butchildren
is now available if you need more control over the rending of the item, without sacrificing benefits fromItem
by usingrenderItem
.
4c2e1a2b
#1195 Thanks @VanAnderson! - Export useConfirm hook and ConfirmationDialog component from index.
c9b4db79
#1199 Thanks @VanAnderson! - Action Menu can have its open state be controlled externally.
3e759e59
#1211 Thanks @VanAnderson! - Use preventDefault on AnchoredOverlay instead of stopPropagation.
7aeb53fe
#1200 Thanks @dgreif! - Perform ActionMenu actions after overlay has closed. This allows the action to move focus if so desired, without the ActionMenu focus trap preventing focus from moving away.
bba66fdd
#1206 Thanks @VanAnderson! - stopPropagation for mousedown and click in AnchoredOverlay based components
b319ce43
#1197 Thanks @dmarcey! - Typescript declare files will now be published to the lib-esm directory, as well as lib
5f85394d
#1157 Thanks @dgreif! - RemoveduseMouseIntent
in favor of:focus-visible
. With the removal ofuseMouseIntent
, theintent-mouse
class will no longer be added to the<body>
. Since:focus-visible
is a relatively new psuedo-class, a polyfill is included. Any focused elements that meet the criteria for:focus-visible
will also have afocus-visible
class added to them by the polyfill.
-
db478205
#1147 Thanks @colebemis! - Type definitions are now being generated by TypeScript instead of manually maintained. These new type definitions may differ from the previous type definitions and cause breaking changes. If you experience any new TypeScript errors, feel free to create an issue or reach out in Slack (#design-systems).-
The following types are no longer exported:
BaseProps UseDetailsProps AnchoredPositionHookSettings AnchorAlignment AnchorSide PositionSettings PaginationHrefBuilder PaginationPageChangeCallback PositionComponentProps
-
Props are now defined with types instead of interfaces which means in some cases you may not be able to create interfaces that
extend
them. To work around this issue, you may need to convert your interfaces to types:import {BoxProps} from '@primer/react' - interface MyFancyBox extends BoxProps {...} + type MyFancyBox = BoxProps & {...}
-
Some components now expect more specific ref types. For example:
- const ref = React.useRef<HTMLElement>(null) + const ref = React.useRef<HTMLButtonElement>(null) return <Button ref={ref}>...</Button>
-
-
016a273f
#1115 Thanks @VanAnderson! - Removes deprecated presentational theme variables in favor of functional variables for styling components that are consistent across multiple themes.If you don't use any color-related system props (e.g.
color
,bg
,borderColor
), all components should work without changes. If you're using color-related system props, you'll need to update them to use the new functional variables. Reference the tables below to see how old variables map to new functional variables.If you have any questions, feel free to reach out in the #design-systems channel.
v25
v26
color="text.gray"
color="text.secondary"
color="text.grayLight"
color="text.tertiary"
color="text.grayDark"
color="text.primary"
color="text.red"
color="text.danger"
color="text.white"
color="text.inverse"
color="gray.6"
color="text.secondary"
color="gray.5"
color="text.tertiary"
color="gray.9"
color="text.primary"
color="red.6"
color="text.danger"
color="white"
color="text.inverse"
color="blue.5"
color="text.link"
color="gray.4"
color="text.disabled"
color="green.5"
color="text.success"
color="yellow.8"
color="text.warning"
v25
v25
color="gray.9"
color="icon.primary"
color="gray.6"
color="icon.secondary"
color="gray.4"
color="icon.tertiary"
color="blue.5"
color="icon.info"
color="red.5"
color="icon.danger"
color="green.6"
color="icon.success"
color="yellow.8"
color="icon.warning"
v25
v26
borderColor="border.blue"
borderColor="border.info"
borderColor="border.blueLight"
n/a borderColor="border.grayLight"
borderColor="border.primary"
borderColor="border.grayDark"
borderColor="border.tertiary"
borderColor="border.grayDarker"
n/a borderColor="border.green"
borderColor="border.success"
borderColor="border.greenLight"
n/a borderColor="border.purple"
n/a borderColor="border.red"
borderColor="border.danger"
borderColor="border.redLight"
n/a borderColor="border.white"
borderColor="border.inverse"
borderColor="border.whiteFace"
n/a borderColor="border.yellow"
borderColor="border.warning"
borderColor="border.blackFade"
borderColor="fade.fg15"
borderColor="border.whiteFade"
borderCOlor="fade.white15"
borderColor="blue.5"
borderColor="border.info"
borderColor="gray.2"
borderColor="border.primary"
borderColor="gray.3"
borderColor="border.tertiary"
borderColor="green.4"
borderColor="border.success"
borderColor="red.5"
borderColor="border.danger"
borderColor="white"
borderColor="border.inverse"
v25
v26
bg="white"
bg="bg.primary"
bg="bg.grayLight"
bg="bg.secondary"
bg="bg.gray"
bg="bg.tertiary"
bg="bg.grayDark"
bg="bg.canvasInverse"
bg="blue.0"
bg="bg.info"
bg="blue.5"
bg="bg.infoInverse"
bg="red.0"
bg="bg.danger"
bg="red.5"
bg="bg.dangerInverse"
bg="green.1"
bg="bg.success"
bg="green.5"
bg="bg.successInverse"
Note the change in pluralization from 'labels' to 'label'.
v25
v26
color="labels.grayDarkText"
color="label.primary.text
borderColor="labels.gray"
borderColor="label.primary.border
color="labels.grayText"
color="label.secondary.text
borderColor="labels.gray"
borderColor="label.secondary.border
color="labels.blueText"
color="label.info.text
borderColor="labels.blue"
borderColor="label.info.border
color="labels.greenText"
color="label.success.text
borderColor="labels.green"
borderColor="label.success.border
color="labels.yellowText"
color="label.warning.text
borderColor="labels.yellow"
borderColor="label.warning.border
color="labels.redText"
color="label.danger.text
borderColor="labels.red"
borderColor="label.danger.border
color="labels.orangeText"
color="label.primary.text
borderColor="labels.orange"
borderColor="label.primary.text
color="labels.pinkText"
n/a borderColor="labels.pink"
n/a color="labels.purpleText"
n/a borderColor="labels.purple"
n/a v25
v26
scheme="gray"
scheme="primary"
scheme="gray-light"
scheme="secondary"
v25
v26
bg="red.5"
bg="prState.closed.bg"
bg="green.5"
bg="prState.open.bg"
bg="purple.5"
bg="prState.merged.bg"
bg="gray.5"
bg="prState.draft.bg"
color="white"
(context: closed PR icon)color="prState.closed.text"
color="white"
(context: open PR icon)color="prState.open.text"
color="white"
(context: merged PR icon)color="prState.merged.text"
color="white"
(context: merged PR icon)color="prState.draft.text"
-
8799f74a
#1112 Thanks @colebemis! - Primer React now supports color modes! 🎉See the new Theming documentation for more details.
- You'll need to replace the
ThemeProvider
fromstyled-components
with the new Primer ReactThemeProvider
:
- import {ThemeProvider} from 'styled-components' - import {theme} from '@primer/react + import {ThemeProvider} from '@primer/react' function App() { return ( - <ThemeProvider theme={theme}> + <ThemeProvider> <div>your app here...</div> </ThemeProvider> ) }
- The structure of the theme object has changed to support color schemes:
const theme = { - colors, - shadows, + colorSchemes: { + light: { + colors, + shadows, + }, + dark: {...}, + dark_dimmed: {...}, + }, space, fonts, fontSizes, fontWeights, lineHeights, borderWidths, radii, breakpoints, sizes, }
- The
theme.colors
andtheme.shadows
objects are no longer available from thetheme
export. Use theuseTheme
hook instead:
- import {theme} from '@primer/react' + import {useTheme} from '@primer/react' function Example() { + const {theme} = useTheme() const myColor = theme.colors.text.primary ... }
- You'll need to replace the
360e3595
#1111 Thanks @VanAnderson! - Update color variable used in ProgressBar (state.success
→bg.successInverse
)
1b3d87d2
#1127 Thanks @VanAnderson! - Bump @primer/primitives from 0.0.0-20211167520 to 0.0.0-20212178221
b9d9d245
#1068 Thanks @colebemis! - Remove propTypes in favor of TypeScript types
-
beef075e
#1094 Thanks @colebemis! - Components no longer have a defaulttheme
prop. To ensure components still render correctly, you'll need pass the Primer theme to a styled-components<ThemeProvider>
at the root of your application:import {ThemeProvider} from 'styled-components' import {theme} from '@primer/react' funciton App(props) { return ( <div> <ThemeProvider theme={theme}> <div>your app here</div> </ThemeProvider> </div> ) }
397f3360
#1106 Thanks @VanAnderson! - Use functional color variables in Pagination
fa106ea9
#1090 Thanks @colebemis! - Use functional color variables in BaseStyles
fa106ea9
#1090 Thanks @colebemis! - Use functional color variables in BranchName
e93cf268
#1092 Thanks @bscofield! - Use functional color variables in Caret, CircleBadge, Pagehead, ProgressBar, and Popover
5a042778
#1099 Thanks @VanAnderson! - Use functional color variables in FilterList
a886bbcf
#1098 Thanks @bscofield! - Update SelectMenu and child components to use functional color variables
f2c57794
#1085 Thanks @VanAnderson! - Use functional color variables in SideNav
756191e7
#1100 Thanks @VanAnderson! - Use functional color variables in ButtonOutline
6b2dc95f
#1085 Thanks @VanAnderson! - Use functional color variables in TabNav
51d180ac
#1089 Thanks @colebemis! - Use functional color variables in Timeline
51d180ac
#1089 Thanks @colebemis! - Use functional color variables in TextInput
8f2b4d2e
#1100 Thanks @VanAnderson! - Use functional color variables in ButtonPrimary
51d180ac
#1089 Thanks @colebemis! - Use functional color variables in Link
fa106ea9
#1090 Thanks @colebemis! - Use functional color variables in BorderBox
51d180ac
#1089 Thanks @colebemis! - Use functional color variables in Tooltip
1fb750af
#1097 Thanks @VanAnderson! - Use functional color variables in ButtonTableList
ea21d8eb
#1102 Thanks @VanAnderson! - Use functional color variables in Flash
51d180ac
#1089 Thanks @colebemis! - Use functional color variables in UnderlineNav
d0f38c3d
#1102 Thanks @VanAnderson! - Use functional color variables in Header
5df7723a
#1099 Thanks @VanAnderson! - Use functional color variables in DropdownStyles
170876e6
#1097 Thanks @VanAnderson! - Use functional color variables in Button
c44ee363
#1085 Thanks @VanAnderson! - Use functional color variables in SubNav
198e24ad
#1100 Thanks @VanAnderson! - Use functional color variables in ButtonDanger
39371d98
#1099 Thanks @VanAnderson! - Use functional color variables in CounterLabel
92597504
#1100 Thanks @VanAnderson! - Use functional color variables in ButtonClose
fa106ea9
#1090 Thanks @colebemis! - Use functional color variables in AvatarPair
fa106ea9
#1090 Thanks @colebemis! - Use functional color variables in AvatarStack
565f1980
#1097 Thanks @VanAnderson! - Use functional color variables in Breadcrumb
4e19045e
#1085 Thanks @VanAnderson! - Use functional color variables in StateLabel
31025697
#1099 Thanks @VanAnderson! - Use functional color variables in Dialog
67cc5b23
#1097 Thanks @VanAnderson! - Use functional color variables in ButtonInvisible
a42162c0
#1087 Thanks @emplums! - Fix up styles in TabNav allowing for items positioned on the right end of TabNav
c50b9f93
#1059 Thanks @colebemis! - MigrateDropdown
to TypeScript
681799fd
#1066 Thanks @colebemis! - MigrateuseMouseIntent
to TypeScript
eaeb2389
#1055 Thanks @VanAnderson! - Migrateutils
to TypeScript
106eb85e
#1060 Thanks @VanAnderson! - MigrateDialog
to TypeScript
f11e6ac6
#1048 Thanks @colebemis! - MigrateSelectMenu
to TypeScript
bb635a50
#1058 Thanks @colebemis! - Migrate theme to TypeScript
fabca94e
#1047 Thanks @VanAnderson! - MigratePagination
to TypeScript
c868bc96
#1074 Thanks @VanAnderson! - Add functional color variables from Primer Primitives to theme object
e2c90dba
#1049 Thanks @eintxaurtieta! - Added font-family:inherit to TextInput
8de64e95
#1029 Thanks @VanAnderson! - MigrateTabNav
to TypeScript
16aeca6b
#1032 Thanks @colebemis! - MigrateAvatarStack
to TypeScript
4070310a
#1026 Thanks @VanAnderson! - MigrateDetails
to TypeScript
8f483bd9
#1042 Thanks @colebemis! - MigratePointerBox
to TypeScript
c5d2b657
#1035 Thanks @colebemis! - MigrateCircleBadge
to TypeScript
3fcdf25f
#1040 Thanks @VanAnderson! - MigrateSideNav
to TypeScript
ff02c038
#1033 Thanks @colebemis! - MigrateTooltip
to TypeScript
0d62f260
#1030 Thanks @colebemis! - MigrateCaret
to TypeScript
d1785f4c
#1038 Thanks @VanAnderson! - MigrateSubNav
to TypeScript
058e7919
#1036 Thanks @colebemis! - MigrateCircleOcticon
to TypeScript
9b71bf38
#998 Thanks @colebemis! - MigratePosition
to TypeScript
b2ac3010
#1037 Thanks @colebemis! - MigrateTimeline
to TypeScript
ef25d019
#1031 Thanks @colebemis! - MigrateAvatarPair
to TypeScript
62f45a12
#1028 Thanks @colebemis! - MigrateTextInput
to TypeScript
cc36e6b4
#1034 Thanks @colebemis! - MigratePopover
to TypeScript
11340814
#1020 Thanks @VanAnderson! - MigrateHeader
to TypeScript
3e0110bc
#995 Thanks @colebemis! - MigrateFlash
to TypeScript
b0cea82e
#1003 Thanks @colebemis! - MigrateTruncate
to TypeScript
f9a7e78a
#987 Thanks @colebemis! - MigrateProgressBar
to TypeScript
d848b9e0
#993 Thanks @colebemis! - MigrateStyledOcticon
to TypeScript
73bced4b
#1015 Thanks @colebemis! - MigrateFilterList
to TypeScript
b9671ca2
#1005 Thanks @colebemis! - MigrateCounterLabel
to TypeScript
1fb77ac3
#1012 Thanks @colebemis! - MigrateBreadcrumb
to TypeScript
91002078
#1008 Thanks @colebemis! - MigrateStateLabel
to TypeScript
3a3c81a4
#984 Thanks @bscofield! - MigrateAvatar
to TypeScript
df2920f5
#1014 Thanks @colebemis! - MigrateUnderlineNav
to TypeScript
b947aff2
#1006 Thanks @colebemis! - MigrateFilteredSearch
to TypeScript
2e71f70f
#1011 Thanks @VanAnderson! - MigrateLink
to TypeScript
7128403c
#979 Thanks @colebemis! - MigrateText
to TypeScript
fe16e21c
#982 Thanks @colebemis! - MigrateBaseStyles
to TypeScript
ee806857
#975 Thanks @colebemis! - MigrateHeading
to TypeScript
25315571
#976 Thanks @colebemis! - MigrateLabel
to TypeScript
4076bf4e
#986 Thanks @colebemis! - MigrateFlex
to TypeScript
397a46fe
#976 Thanks @colebemis! - MigrateLabelGroup
to TypeScript
dc0df4b2
#973 Thanks @colebemis! - MigrateBorderBox
to TypeScript
0cac0042
#974 Thanks @colebemis! - MigrateBranchName
to TypeScript
755a1a5c
#977 Thanks @colebemis! - MigratePagehead
to TypeScript
34ff4885
#989 Thanks @colebemis! - MigrateGrid
to TypeScript