v31.0.0
Major Changes
-
BraidTestProvider: Move to separate entry (#1031)
By moving
BraidTestProviderto it’s own entry, we can prevent importing all the themes at dev-time. This improves the developer experience when debugging the stylesheet that is output by the development server.MIGRATION GUIDE
Migration can largely be automated by running the Braid upgrade command. You must provide a glob to target your project’s source files. For example:
yarn braid-upgrade v31 "**/*.{ts,tsx}"
It may be necessary to manually migrate code in some cases, here are the affected use cases:
- import { BraidTestProvider } from 'braid-design-system'; + import { BraidTestProvider } from 'braid-design-system/test';
-
BackgroundProvider Removed in favour of setting a
backgroundofcustomDark/customLightdirectly on theBoxthat has the custom background color. (#1031)MIGRATION GUIDE
-<Box style={{ backgroundColor: 'purple' }}> +<Box background="customDark" style={{ backgroundColor: 'purple' }}> - <BackgroundProvider value="UNKNOWN_DARK"> <Text>Inverted text given dark context</Text> - </BackgroundProvider> </Box>
-
Remove previously deprecated
ButtonRenderercomponent in favour ofButtonandButtonLink. (#1031)MIGRATION GUIDE
If you were using this to render an
aelement that visually looks like a button, you should be usingButtonLink- <ButtonRenderer> - {(ButtonChildren, buttonProps) => ( - <a to="#" {...buttonProps}> - Visually a button - </a> - )} - </ButtonRenderer> + <ButtonLink> + Visually a button + </ButtonLink>
-
Button, ButtonLink: Add
neutraltone (#1031)Introduces a
neutraltone for cases where actions need to be de-emphasised. As a result, there is a breaking change to the contextual design rules that invert buttons in dark containers.BREAKING CHANGE:
A
Buttonwith avariantofghost,soft, ortransparentand no specifiedtonewould previously invert when inside a dark container. Now, instead of inverting the foreground colour, these cases will use a lighter version of the default tone, i.e.formAccent.MIGRATION GUIDE:
To maintain previous behaviour, consumers should opt into the
neutraltone.<Box background="brand" padding="gutter"> - <Button variant="ghost">Click</Button> + <Button variant="ghost" tone="neutral">Click</Button> </Box>
-
Remove legacy seekAsia themes (#1031)
Since the rebrand went live earlier this year, all consumers of
jobsDb,jobStreet,jobStreetClassicandseekUnifiedBetathemes should now be using theapactheme in production.MIGRATION GUIDE
-import jobStreet from 'braid-design-system/themes/jobStreet'; +import apac from 'braid-design-system/themes/apac'; -<BraidProvider theme={jobStreet}> +<BraidProvider theme={apac}> ... </BraidProvider>
-
BulletList Remove deprecated component (#1031)
MIGRATION GUIDE
-<BulletList> - <Bullet large>Bullet</Bullet> - <Bullet large>Bullet</Bullet> - <Bullet large>Bullet</Bullet> -</BulletList> +<List size="large"> + <Text>Bullet</Text> + <Text>Bullet</Text> + <Text>Bullet</Text> +</List>
-
Remove previously deprecated
TextLinkRenderercomponent in favour ofTextLinkandTextLinkButton. (#1031)MIGRATION GUIDE
If you were using this to render a
buttonelement that visually looks like a link, you should be usingTextLinkButton<Text> - <TextLinkRenderer reset={false}> - {(textLinkProps) => ( - <Box component="button" {...textLinkProps}> - Visually a link - </Box> - )} - </TextLinkRenderer> + <TextLinkButton> + Visually a link + </TextLinkButton> , rendered as a button. </Text>
If you were using this to render an
aelement or using a client side router link component you should ensure you have configured thelinkComponent on BraidProviderin your app. Once handled, migrating toTextLinkshould be straight forward.<Text> - <TextLinkRenderer reset={false}> - {(textLinkProps) => ( - <Link {...textLinkProps}> - ... - </Link> - )} - </TextLinkRenderer> + <TextLink> + ... + </TextLink> </Text>
-
Button, ButtonLink: Remove weight prop (#1031)
Removing support for the
weightprop. This was deprecated back in v29.26.0 in favour of using thevariantprop. -
TextLink, TextLinkButton: Remove support inside
Actionscomponent (#1031)Removing support for
TextLinkandTextLinkButtoncomponents inside ofActions. This was previously deprecated back in v29.26.0 in favour of using thetransparentvariantofButtonLink.MIGRATION GUIDE
<Actions> <Button>...</Button> - <TextLink href="...">...</TextLink> + <ButtonLink href="..." variant="transparent">...</ButtonLink> </Actions> -
Remove
BraidLoadableProvider(#1031)As most Apps should run the
apactheme across all brands, it no longer makes sense to centralise a loadable version of theBraidProvider. This should simplify builds across the board and may result in a small build-speed increase.MIGRATION GUIDE
If you are only using a single theme, then you should migrate your
BraidLoadableProviderusage toBraidProvider.+import apac from 'braid-design-system/themes/apac'; +import { BraidProvider } from 'braid-design-system'; -import { BraidLoadableProvider } from 'braid-design-system'; export const App = () => ( - <BraidLoadableProvider themeName="apac"> + <BraidProvider theme={apac}> ... - </BraidLoadableProvider> + </BraidProvider> );
If your app still needs to render different themes then you can replicate the
BraidLoadableProviderfunctionality locally using theloadable.libAPI.import { BraidProvider } from 'braid-design-system'; import React, { ReactNode } from 'react'; import loadable from 'sku/@loadable/component'; type ThemeName = 'apac' | 'catho'; const BraidTheme = loadable.lib((props: { themeName: ThemeName }) => import(`braid-design-system/themes/${props.themeName}`), ); interface AppProps { themeName: ThemeName; children: ReactNode; } export const App = ({ themeName, children }: AppProps) => ( <BraidTheme themeName={themeName}> {({ default: theme }) => ( <BraidProvider theme={theme}>{children}</BraidProvider> )} </BraidTheme> );
-
Box, atoms, vars: Update theme colour tokens with improved semantics. (#1031)
Simplifies the semantics of the colour-based tokens to support upcoming colour mode work. Changes to the property values on
backgroundColorandborderColorhas flow on affects to the apis onBoxandatoms.TOKEN CHANGES
New
- backgroundColor:
surface,neutralSoft - borderColor:
neutral,neutralInverted,neutralLight
Removed
- backgroundColor:
card,formAccentDisabled,input,inputDisabled,selection - borderColor:
formHover,standard,standardInverted
MIGRATION GUIDE
Migration can largely be automated by running the Braid upgrade command. You must provide a glob to target your project’s source files. For example:
yarn braid-upgrade v31 "**/*.{ts,tsx}"
It may be necessary to manually migrate code in some cases, here are the affected use cases:
Boxbackgrounds- <Box background="card" /> + <Box background="surface" /> - <Box background="formAccentDisabled" /> + <Box background="neutralLight" /> - <Box background="input" /> + <Box background="surface" /> - <Box background="inputDisabled" /> + <Box background="neutralSoft" /> - <Box background="selection" /> + <Box background="formAccentSoft" />
BoxboxShadows- <Box boxShadow="borderStandard" /> + <Box boxShadow="borderNeutralLight" /> - <Box boxShadow="borderStandardInverted" /> + <Box boxShadow="borderNeutralInverted" /> - <Box boxShadow="borderStandardInvertedLarge" /> + <Box boxShadow="borderNeutralInvertedLarge" /> - <Box boxShadow="borderFormHover" /> + <Box boxShadow="borderFormAccent" />
vars- vars.borderColor.standard + vars.borderColor.neutralLight - vars.borderColor.standardInverted + vars.borderColor.neutralInverted - vars.borderColor.formHover + vars.borderColor.formAccent
atomsatoms({ - boxShadow: 'borderStandard', + boxShadow: 'borderNeutralLight', }); atoms({ - boxShadow: 'borderStandardInverted', + boxShadow: 'borderNeutralInverted', }); atoms({ - boxShadow: 'borderStandardInvertedLarge', + boxShadow: 'borderNeutralInvertedLarge', }); atoms({ - boxShadow: 'borderFormHover', + boxShadow: 'borderFormAccent', }); - backgroundColor:
Minor Changes
-
Box: Add neutral background variants and new boxShadow border variants (#1031)
New backgrounds
The following backgrounds are now available:neutralActiveneutralHoverneutralSoftActiveneutralSoftHover
New boxShadows
The following box shadows are now available:borderBrandAccentLightLargeborderCriticalLightLargeborderFormAccentLightborderFormAccentLightLarge
-
atoms: Add boxShadow border variants (#1031)
New boxShadows
The following box shadows are now available:borderBrandAccentLightLargeborderCriticalLightLargeborderFormAccentLightborderFormAccentLightLarge
-
vars: Darken neutral background for the
occtheme. (#1031)A
neutralbackground should be able to hold tone-based text. Moving fromgrey700togrey800as per the Atomic Design System color palette -
vars: Add new backgrounds and light variant border colors (#1031)
New backgrounds
The following backgrounds are now available on thevars.backgroundColortheme object:neutralActiveneutralHoverneutralSoftActiveneutralSoftHover
New borderColors
The following border colors are now available on thevars.borderColortheme object:brandAccentLightcriticalLightformAccentLight
-
vars: Darken neutral background for the
seekAnztheme. (#1031)A
neutralbackground should be able to hold tone-based text. Moving fromsk-mid-gray-darktosk-charcoalas per the Seek Style Guide color palette
Patch Changes
-
Text: Improve contrast of
brandAccent,criticalandformAccenttones (#1031)When using any of the above tones in a dark container, a lighter colour will be used to improve the text contrast against the background.