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

Stepper/InputStepper Transform

Converts a v6 Stepper/InputStepper component to a v7 Stepper component.

Automatic Changes

  • Adds id prop if not present. The id prop is required. Update prop value to an appropriate value.
  • If transforming a v6 Stepper, adds readOnly={true}. If the input should be editable, set to false or remove this prop.
  • Renames the labels.increaseButton to labelOverrides.increaseScreenReaderLabel.
  • Renames the labels.decreaseButton to labelOverrides.decreaseScreenReaderLabel.
  • Deletes the onIncrease prop which is deprecated. Use the onChange prop to get the updated value.
  • Deletes the onDecrease prop which is deprecated. Use the onChange prop to get the updated value.
  • Attempts to transform the deprecated theme prop to the className prop. If it cannot, deletes the theme prop.

For example:

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

export default function Page() {

return (

<Stepper

labels={{ increaseButton: 'Increase', decreaseButton: 'Decrease' }}

onIncrease={onIncrease}

onDecrease={onDecrease}

onChange={onChange}

theme={{ color: 'red' }}

{...otherProps}

/>

);

}

Transforms into:

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

export default function Page() {

return (

<Stepper

labelOverrides={{

increaseScreenReaderLabel: 'Increase',

decreaseScreenReaderLabel: 'Decrease',

}}

onChange={onChange}

readOnly={true}

id="unique-id-for-stepper"

{...otherProps}

/>

);

}

Manual Changes

onChange

The onChange signature has been updated from (newValue: number) => void to (event: ChangeEvent<HTMLInputElement> | MouseEvent<HTMLButtonElement>, newValue: number | null) => void. The onChange is now triggered from editing the input, clicking the increase button, or clicking the decrease button.

Questions?

Connect with the DLS Team on Slack or by email.

Resources

Check out additional resources.