Migrating to V3
Migrating to V3
Introduction
ICDS V3 introduces one of our mostly highly anticipated features, dark mode, as well as general improvements. This is a comprehensive guide on how to upgrade your V2 app to V3. For a full list of the changes made in V3, please read the
Theming and dark mode
With V3's arrival comes an improvedic-theme
component. This component was initially responsible for managing the theme of the UI Kit. In addition to the existing functionality, you can now use theic-theme
component to set whether a component responds to changes in the system's light and dark theme or whether it always appears in a particular mode. Guidance on implementing theic-theme
component can be found in the
Codemod
To aid your migration from ICDS V2 to V3, we have created a codemod to automate the process of migrating your code. A codemod is a tool that can be used to make large-scale changes to codebases quickly and efficiently. Our ICDS V2 to V3 codemod is the simplest and easiest way to migrate your codebase to the latest version of the UI Kit.
How it works
Given a directory, it will scan over files and find any relevant ICDS components that require a change either by component name or props used.
How to run
This package works as an executable requiring a directory and optional test boolean argument to help migrate your tests from ICDS V2 to ICDS V3. Further information and examples can be found in the
- npm i @ukic/react
- npm i @ukic/web-components
- npx @ukic/codemod <dir> <test>
Breaking changes
1. Prop renaming
-
The
appearanceprop has been replaced with thethemeandmonochrome .props -
In
ic-text-field(IcTextField) theauto-focusprop has been renamed toautofocusand themax-length/maxLengthprop has been renamed tomax-characters/maxCharacters. -
The
colorprop inic-hero(IcHero),ic-top-navigation(IcTopNavigation),ic-side-navigation(IcSideNavigation),ic-footer(IcFooter) andic-theme(IcTheme) has been renamed tobrand-color/brandColor. -
The
group-title/groupTitleprop inic-accordion-group(IcAccordionGroup) andic-footer-link-group(IcFooterLinkGroup) has been renamed tolabel. -
The
text-label/textLabelprop inic-badge(IcBadge) has been renamed tolabel. -
The
body-max-lines/bodyMaxLinesprop inic-empty-state(IcEmptyState) has been renamed tomax-lines/maxLines. -
The
errorprop inic-input-label(IcInputLabel) has been renamed tostatuswitherroras an option. -
The
boundary-count/boundaryCountandadjacent-count/adjacentCountprops inic-pagination(IcPagination) have been renamed toboundary-page-count/boundaryPageCountandadjacent-page-count/adjacentPageCount. -
The
disable-filter/disableFilterprop inic-search-bar(IcSearchBar) andic-select(IcSelect) has been renamed todisable-auto-filtering/disableAutoFiltering. -
The
hint-text/hintTextprop inic-search-bar(IcSearchBar) has been renamed toassistive-hint-text/assistiveHintText. -
Some
ic-step(IcStep) props have had the prefix "step" removed, e.g.,step-status/stepStatushas been renamed tostatus,step-title/stepTitleandstep-subtitle/stepSubtitleprops have been renamed toheadingandsubheadingrespectively. -
The
toggle-checked/toggleCheckedprop inic-toggle-button(IcToggleButton) has been renamed tochecked. -
The
small=”true”prop has been replaced withsize=”small”inic-select(IcSelect). -
The
themeprop has been renamed tobrandinic-theme(IcTheme). -
The
keyboard-shortcut/keyboardShortcutprop has been renamed tokeyboard-shortcut-label/keyboardShortcutLabelinic-menu-item(IcMenuItem). -
The
buttonsprop inic-dialog, which defaulted totrue, has been renamed tohide-default-buttons/hideDefaultButtons, with a default value offalse.
2. Component renaming
-
ic-card(IcCard) has been renamed toic-card-vertical(IcCardVertical) . -
ic-data-entity(IcDataEntity) has been renamed toic-data-list(IcDataList).
3. Removed props/slots/events/methods
-
Deprecated props, slots, events, and methods have been removed entirely.
-
The
max-length/maxLengthandmax-length-message/maxLengthMessageprops have been removed fromic-text-field(IcTextField). Instead, use themax-characters/maxCharactersprop and thehide-char-count/hideCharCountprop to hide the character count visually. It is not possible for the input to exceed the number of characters provided via themax-characters/maxCharactersprop. -
The
smallprop has been removed. Please usesize="small"instead. -
The
size=”default”prop has been removed. Please usesize="medium"instead. -
The
buttonsprop foric-dialog(IcDialog) has been removed. Please use the newhide-default-controls/hideDefaultControlsprop (This new prop defaults tofalse). -
The
button-props/buttonPropsprop has been removed from theic-dialog(IcDialog) component and replaced with thedialog-controlsslot. -
The
show-state/showStateprop has been removed from theic-switch(IcSwitch) component. -
Form props (
formaction,formenctype,formmethod,formnovalidate, andformtarget) have been removed fromic-checkbox(IcCheckbox),ic-radio-option(IcRadioOption) andic-select(IcSelect).
4. Class name changes
-
Class names on the host for most components have been updated to include the component name in the class name. For example,
disabledhas been updated toic-select-disabled. -
Other class names have also changed and may affect current tests.
5. Event name changes
-
The
icThemeChangeevent has been renamed toicBrandChange. -
The events
sideNavExpandedandtopNavResizedare now calledicSideNavExpandedandicTopNavResized.
6. CSS token changes
-
Some existing CSS tokens have been renamed following the move towards primitive, semantic, and component tokens.
7. Component behaviour changes
-
The
ic-toast(IcToast) component now shows a dismiss button when the toast is hovered over or focused. -
The shadow DOM has been removed from
ic-radio(IcRadio) and may affect current tests. -
ic-select-with-multi(IcSelectWithMulti) is no longer a standalone component. The multi-select functionality can now be achieved using theic-select(IcSelect) component and itsmultipleprop. -
The
ic-select(IcSelect) component's searchable variant now clears the input field when it loses focus if the value does not match any of the items in the list of options. -
The
ic-select(IcSelect) component'sonIcChange/icChangeevent is no longer emitted on each keystroke or controlled by thedebounceprop. TheonIcInput/icInputevent should be used for handling changes based on keystrokes and is controlled by thedebounceprop. -
The
ic-select(IcSelect) component'sonIcChange/icChangeevent now emits a value of typestring | string[] | null. Previously the value was of typestring. -
The
ic-loading-indicator(IcLoadingIndicator) component'slabelprop now dynamically changes the label value by passing an array of strings, instead of a string separated by/. For example,["Loading", "Still loading"]. -
The
<a>used internally withinic-footer-link(IcFooterLink) has been replaced with<ic-link>and may affect current tests. -
The heading hierarchy within
ic-hero(IcHero) has been updated, which may affect accessiblity compliance. Theheadingprop is now semantically ah2element, and thesecondary-heading/secondaryHeadingprop is now semantically ah3element. -
The hidden input has been removed from
ic-radio-group(IcRadioGroup) and may affect current tests.
// v2
<ic-select-with-multi
id="select-default"
label="What are your favourite types of coffee?"
multiple="true"
></ic-select-with-multi>
// v3
<ic-select
id="select-default"
label="What are your favourite types of coffee?"
multiple="true"
></ic-select>
New features
1. Theme prop
-
A new
themeprop has been added to many components to enable light and dark mode.
2. Monochrome prop
-
A new
monochromeprop has been added to many components.
Manual migration steps
-
Update Prop Names : Replace all instances of the old prop names with the new ones.
-
Update Component Names : Rename components according to the new names.
-
Remove Deprecated Props/Slots/Events/Methods : Remove any usage of deprecated props, slots, events, and methods.
-
Update Class Names : If you use class names to reference elements in tests, then update class names to the new format.
-
Update Event Names : Replace old event names with the new ones.
-
Update CSS Tokens : Update any CSS tokens that have been renamed.
-
Test Your Application : Thoroughly test your application to ensure that all changes have been applied correctly and that there are no regressions.
By following these steps, you should be able to successfully migrate your project from version 2 to version 3 of the@ukic/web-components
or@ukic/react
package.