Codemods

The American Express Design System provides a unified language for designing American Express websites and experiences. The design system provides design resources that match our coded components and are aligned with the American Express brand. Included are colors, components, icons and glyphs, type styles, and graphic assets to get you up and running quickly.

Back to All Codemods

PhoneInput Transform

Converts a v6 PhoneInput component to a v7 PhoneInput component.

Automatic Changes

  • Renames the disabled prop to aria-disabled.
  • Renames the inputLabel prop to label.
  • Renames the options prop to selectOptions.
  • Renames the selectLabel prop to labelOverrides.selectScreenReaderLabel.
  • Attempts to transform the deprecated theme prop to the className prop. If it cannot, deletes the theme prop.
  • If PhoneInput is being used as a multi-country phone input (if the selectOptions prop is supplied), renames locale to selectedLocale.

For example:

import { PhoneInput } from '@americanexpress/dls-react6';

export default function Page() {

return (

<PhoneInput

locale={locale}

options={options}

disabled={isDisabled}

inputLabel="Phone Number"

selectLabel="Country"

theme={{ color: 'red' }}

{...otherProps}

/>

);

}

Transforms into:

import { PhoneInput } from '@americanexpress/dls-react';

export default function Page() {

return (

<PhoneInput

selectOptions={options}

aria-disabled={isDisabled}

label="Phone Number"

selectedLocale={locale}

{...otherProps}

labelOverrides={{

selectScreenReaderLabel: 'Country',

}}

/>

);

}

Manual Changes

Single Country vs. Multi-Country

In v6, the locale prop was used for both single-country and multi-country variations. In v7, use the locale prop for single-country and the selectedLocale/defaultSelectedLocale props for multi-country.

Questions?

Connect with the DLS Team on Slack or by email.

Resources

Check out additional resources.