v10
How to migrate
v10 of @dnb/eufemia contains breaking changes. As a migration process from v9, you should follow all of the guides below.
Install
To upgrade to @dnb/eufemia v10 with Yarn, run:
yarn workspace <your-workspace> add @dnb/eufemia@10# oryarn add @dnb/eufemia@10
Deprecations
- Helper class
.dnb-sr-only--inlineand SCSS mixinsrOnlyInlinewas removed. - Helper class
.dnb-not-sr-onlyand SCSS mixinnotSrOnlywas removed. import { SpacingHelper } from '@dnb/eufemia/shared'was removed due to low usage. Use one of the other exported helpers.- Stylis plugin,
import stylisPlugin from '@dnb/eufemia/style/stylis', has been removed.
TypeScript
- Updated multiple types from
string | booleantoboolean, as there was a lot of properties who should only support boolean values and not strings. Examples of changes to do would be to find Eufemia components using"false"or"true", and replace it with boolean values. i.e.,vertical="false"tovertical={false}orselectall="true"toselectall={true}. Following is a non-exhaustive list of affected properties:verticalprevent_selectionshow_labelstretchno_scroll_animationdisable_filtermore_menuinherit
import { LocaleProps, DataAttributeTypes, DynamicElement } from '@dnb/eufemia/shared/interfaces'was removed, and moved to@dnb/eufemia/shared/types.
Discontinued Internet Explorer (IE) support
The support for Internet Explorer (IE) was removed, as Microsoft formally ended support for IE in June, 2022. Have a look at the supported browsers and platforms.
With that change, Eufemia will support modern browsers that supports ES6.
- The helpers
isIE11andIS_IE11was removed.
Web Components support
The support for Web Components, Vue and Angular was discontinued and removed.
Breakpoints
Some breakpoints sizes have changed:
- xx-large:
1280is now1440– and80emis now90em - x-large:
1152is now1280– and72emis now80em - large:
960is now1152– and60emis now72em - medium:
800is now960– and50emis now60em
- Find
$layout-x-largeand replace with$layout-large - Find
$layout-xx-largeand replace with$layout-x-large - Find
--layout-x-largeand replace with--layout-large - Find
--layout-xx-largeand replace with--layout-x-large
NB: Import and use the Eufemia breakpoints directly in your code:
// breakpoints.scss@import '@dnb/eufemia/style/core/utilities';$layout-small: map-get($breakpoints, 'small');$layout-medium: map-get($breakpoints, 'medium');$layout-large: map-get($breakpoints, 'large');
Breaking changes to CSS packages and imports
Find the place where you import the Eufemia styles.
- If you did import them as so:
import '@dnb/eufemia/style'
then you don't need to make any changes.
- If you did import
/coreetc. – then you have to change it to the import above(see 1.):
import '@dnb/eufemia/style/core'import '@dnb/eufemia/style/themes/ui'
- If you did import the styles as CSS files, then you have to change it to the import above(see 1.):
import '@dnb/eufemia/style/dnb-ui-core.min.css'import '@dnb/eufemia/style/themes/theme-ui/ui-theme-components.min.css'import '@dnb/eufemia/style/themes/theme-ui/ui-theme-basis.min.css'
- If you did import
/basis,/components, andthemes/uilike so (commonly done inEufemiaStyleImporterfiles):
import '@dnb/eufemia/style/basis'import '@dnb/eufemia/style/components'import '@dnb/eufemia/style/themes/ui'
Change to:
import '@dnb/eufemia/style/basis'import '@dnb/eufemia/style/themes/ui'
More details about the change:
- The package
dnb-theme-uiwas renamed toui-theme-basis. - The package
dnb-ui-componentswas renamed and moved inside a theme/style/themes/theme-ui/ui-theme-components.*. dnb-ui-tagswas renamed and moved from/style/dnb-ui-tags.*to/style/themes/theme-ui/ui-theme-tags.*.- NB: When using the
eiendomtheme, the same applies as withui, just useeiendominstead.
Properties
The DNB properties.scss and properties.js files were moved inside a theme folder /style/themes/theme-ui/properties.*.
Packages such as:
dnb-ui-basisdnb-ui-core
do not contain the properties anymore. Properties are only a part of a theme file, such as: /style/themes/theme-ui/ui-theme-basis.*.
As long as you don't import them in your application, you don't need to make any changes in your codebase.
Following is a non-exhaustive list of examples of changes that could be relevant for your application:
-
Find references to
@dnb/eufemia/style/propertiesand replace it with@dnb/eufemia/style/themes/theme-ui/properties.From:
import properties from '@dnb/eufemia/style/properties'To:
import properties from '@dnb/eufemia/style/themes/theme-ui/properties' -
Find references to
@dnb/eufemia/cjs/style/propertiesand replace it with@dnb/eufemia/cjs/style/themes/theme-ui/properties.From:
import properties from '@dnb/eufemia/style/properties'To:
import properties from '@dnb/eufemia/cjs/style/themes/theme-ui/properties' -
Find references to
@dnb/eufemia/style/dnb-ui-properties.min.cssand replace it with@dnb/eufemia/style/themes/theme-ui/ui-theme-properties.min.css.
Removal of data-testid in components
You may use other methods to select and test the inner parts of Eufemia components. You could use e.g. screen.queryByRole, screen.queryByRole or document.querySelector. All of the following components are effected by the change:
SCSS mixins
Find the SCSS @mixin fakeFocus and replace it with focusRing.
Find the SCSS @mixin removeFakeFocus and replace it with removeFocusRing.
Fonts assets
The DNB font is moved inside a subfolder in /assets/fonts/dnb/....
The CSS package dnb-ui-fonts is moved inside a theme folder /themes/theme-ui.
CSS Packages such as:
dnb-ui-basisdnb-ui-core
do not contain the fonts anymore. Fonts are now only a part of a theme file, such as: /style/themes/theme-ui/ui-theme-basis.*.
As long as you don't import them manually, you don't need to make any changes in your codebase.
Find references to @dnb/eufemia/assets/fonts/ and replace it with @dnb/eufemia/assets/fonts/dnb/.
For instance, changing from:
import exampleFont from '@dnb/eufemia/assets/fonts/exampleFont.woff2'
To:
import exampleFont from '@dnb/eufemia/assets/fonts/dnb/exampleFont.woff2'
SVG assets
All svg icon files were moved inside a subfolder in /assets/icons/dnb/....
Browser assets
DNB browser assets (assets/browser) have been moved inside a subfolder: assets/browser/dnb.
Find references to assets/browser and replace it with assets/browser/dnb.
Component changes
StepIndicator
- Find the
active_itemproperty and replace it withcurrent_step. - Find
use_navigationand remove it or replace it withmode="strict"ormode="loose". - URL support has been removed – so properties like
active_url,url,url_future, andurl_passedare not supported anymore. You have to handle it by yourself from inside your application. Here is an example.
Table
- Find the
sticky_offsetproperty and replace it withstickyOffset. - Find the
/elements/Tableproperty and replace it with/components/Table. - Alignment classes are removed (
.dnb-table--left,.dnb-table--rightand.dnb-table--center). Use thealignattribute instead. - Font-sizing classes are removed (
.dnb-table--smalland.dnb-table--x-small). Use thesizeproperty instead. - Find and remove
Table.StickyHelper. - Consider to add a CSS Class to each sub element or import it from the package:
tr=>.dnb-table__trorimport { Tr } from '@dnb/eufemia'.th=>.dnb-table__thorimport { Th } from '@dnb/eufemia'.td=>.dnb-table__tdorimport { Td } from '@dnb/eufemia'.
Slider
- Find the
thump_titleproperty and replace it withthumbTitle. - Find the snake_case
add_titleproperty and replace it withaddTitle. - Find the snake_case
subtract_titleproperty and replace it withsubtractTitle. - Remove
@dnb/eufemia/components/slider/style/dnb-range.min.cssand use the Eufemia Slider component instead. use_scrollwheelandon_initproperties, as well as theraw_valueevent value from Slider was removed in order to support multiple buttons.
Timeline
- Find the
nameproperty in your Timeline JSX syntax and replace it withtitle. - Find the
dateproperty in your Timeline JSX syntax and replace it withsubtitle.
Anchor
The Anchor was moved from /elements to /components.
- Find imports like
from '@dnb/eufemia/elements'orfrom '@dnb/eufemia/elements/anchor', and change the import toimport { Anchor } from '@dnb/eufemia'. - Find the
target_blank_titleproperty and replace it withtargetBlankTitle.
NB: ESM and UMD packages: The Anchor is now also a part if dnb-ui-components instead of dnb-ui-elements.
Button
- The padding of the
tertiarybutton is removed. Please, check your application and add back the padding of0.5remif needed. - The property
global_status_idis deprecated, and replaced with the newglobalStatusproperty. Read more aboutglobalStatushere. Find occurrences ofglobal_status_id, likeglobal_status_id="my-id", and replace it withglobalStatus={{id: "my-id"}}.
Pagination and InfinityScroller
- Replace the deprecated event return parameter
pagewithpageNumber.
Tooltip
- Find the
target_elementproperty and replace it withtargetElement. - Find the
target_selectorproperty and replace it withtargetSelector. - Find the
fixed_positionproperty and replace it withfixedPosition. - Find the
skip_portalproperty and replace it withskipPortal. - Find the
no_animationproperty and replace it withnoAnimation. - Find the
show_delayproperty and replace it withshowDelay. - Find the
hide_delayproperty and replace it withhideDelay. - Find the
animate_positionproperty and remove it. - Find the
groupproperty and remove it.
Icon
- Find the
data-test-idproperty and replace it withdata-testid. The usage ofdata-test-idwill most likely be found in your tests.
Modal, Dialog and Drawer
-
closeButtonAttributesof Modal, Dialog, and Drawer is deprecated and no longer supported. -
Modal's
modeproperty is now deprecated and removed. In earlier versions, themodeproperty defaulted todialog. So if you've used<Modal />without themodeproperty, which would default tomode="dialog", please convert from<Modal />to<Dialog />as of v10.<Modal />now(as of v10) behaves as<Modal mode="custom" />did in previous versions of eufemia.When you convert from
<Modal mode="custom" />simply change to<Modal />.When you convert from
<Modal mode="drawer" />to<Drawer />– follow these steps:-
All
trigger_*properties are not supported for Drawer, usetriggerAttributesinstead to pass in properties for the trigger button.- Change property
trigger_hiddentoomitTriggerButtonto omit the default trigger button from Modal.
- Change property
-
Only camelCase properties are supported for Drawer, so you will need to update the property names.
-
Modal.InnerorModal.Contentconverts toDrawer.Body. -
Modal.Barconverts toDrawer.Navigation. -
Modalwas a class component andDraweris a functional component.
When you convert from
<Modal />or<Modal mode="dialog" />to<Dialog />– follow these steps:-
All
trigger_*properties are not supported for Dialog, usetriggerAttributesinstead to pass in properties for the trigger button.- Change property
trigger_hiddentoomitTriggerButtonto omit the default trigger button from Modal.
- Change property
-
Only camelCase properties are supported for Dialog, so you will need to update the property names.
-
Modal.InnerorModal.Contentconverts toDialog.Body. -
Modal.Barconverts toDialog.Navigation. -
Modalwas a class component andDialogis a functional component.
-
Lists
- New Definition List layout direction:
direction="horizontal"includingDl.Itemdemo.
InputMasked
- In v10, InputMasked allows leading zeros. To prevent that behavior, the property
allowLeadingZeroeshas changed todisallowLeadingZeroes.
FormRow
- The FormRow properties
indentandindent_offsetwere removed.
FormStatus
- The FormStatus property
statuswas renamed tostate. Find thestatusproperty and replace it withstate. - The property
global_status_idis deprecated, and replaced with the newglobalStatusproperty. Read more aboutglobalStatushere. Find occurrences ofglobal_status_id, likeglobal_status_id="my-id", and replace it withglobalStatus={{id: "my-id"}}.
Switch
- type
SwitchCheckedwas removed. Usebooleaninstead. - The property
global_status_idis deprecated, and replaced with the newglobalStatusproperty. Read more aboutglobalStatushere. Find occurrences ofglobal_status_id, likeglobal_status_id="my-id", and replace it withglobalStatus={{id: "my-id"}}.
HelpButton
- The properties
modal_propsandmodal_contentwas removed. You may replace these properties with the newrenderproperty. See this example.
Autocomplete
- The property
global_status_idis deprecated, and replaced with the newglobalStatusproperty. Read more aboutglobalStatushere. Find occurrences ofglobal_status_id, likeglobal_status_id="my-id", and replace it withglobalStatus={{id: "my-id"}}.
Checkbox
- The property
global_status_idis deprecated, and replaced with the newglobalStatusproperty. Read more aboutglobalStatushere. Find occurrences ofglobal_status_id, likeglobal_status_id="my-id", and replace it withglobalStatus={{id: "my-id"}}.
DatePicker
- The property
global_status_idis deprecated, and replaced with the newglobalStatusproperty. Read more aboutglobalStatushere. Find occurrences ofglobal_status_id, likeglobal_status_id="my-id", and replace it withglobalStatus={{id: "my-id"}}.
Dropdown
- The property
global_status_idis deprecated, and replaced with the newglobalStatusproperty. Read more aboutglobalStatushere. Find occurrences ofglobal_status_id, likeglobal_status_id="my-id", and replace it withglobalStatus={{id: "my-id"}}.
Input
- The property
global_status_idis deprecated, and replaced with the newglobalStatusproperty. Read more aboutglobalStatushere. Find occurrences ofglobal_status_id, likeglobal_status_id="my-id", and replace it withglobalStatus={{id: "my-id"}}.
Radio
- The property
global_status_idis deprecated, and replaced with the newglobalStatusproperty. Read more aboutglobalStatushere. Find occurrences ofglobal_status_id, likeglobal_status_id="my-id", and replace it withglobalStatus={{id: "my-id"}}.
Textarea
- The property
global_status_idis deprecated, and replaced with the newglobalStatusproperty. Read more aboutglobalStatushere. Find occurrences ofglobal_status_id, likeglobal_status_id="my-id", and replace it withglobalStatus={{id: "my-id"}}.
ToggleButton
- The property
global_status_idis deprecated, and replaced with the newglobalStatusproperty. Read more aboutglobalStatushere. Find occurrences ofglobal_status_id, likeglobal_status_id="my-id", and replace it withglobalStatus={{id: "my-id"}}.
GlobalError
- Removed the
href,back,status_contentproperties as well as the SVG illustrations.
Element changes
Paragraph
-
Removed
smallas property. Usesize="small"instead. -
Removed deprecated
style_typeproperty. Usemedium,boldormodifierinstead.
Img
Changed img_class property to be imgClass.
- Find all instances of
img_classand change it toimgClass
Extension changes
PaymentCard
PaymentCard's size(height & width), proportions, and unit(frommmtopx) was changed.Type'sDNBvalue/optionMetalicwas removed.Type'sSagavalue/optionVisaPlatinumwas removed.Type'sPBvalue/optionPlatinumwas removed.Type'sMastercardvalue/optionDefaultWhitewas removed.Type'sMastercardvalue/optionMetalicwas removed.Type'sMastercardvalue/optionBlackMetalicwas removed.Type'sVisavalue/optionMetalicwas removed.CardDesign's value/optionwhitewas removed. If used as a default design, consider replacing it withdefaultDesign.CardDesign's value/optionsilverwas removed.ProductType's value/optionBankAxeptwas removed.- For better TypeScript support, import
CardTypefrom/payment-cardinstead of from/payment-card/utils/Types.- Find
import { CardType } from '@dnb/eufemia/extensions/payment-card/utils/Types', and replace withimport { CardType } from '@dnb/eufemia/extensions/payment-card'
- Find
- For better TypeScript support, import
ProductTypefrom/payment-cardinstead of from/payment-card/utils/Types.- Find
import { ProductType } from '@dnb/eufemia/extensions/payment-card/utils/Types', and replace withimport { ProductType } from '@dnb/eufemia/extensions/payment-card'
- Find
May, 31. 2023