|
| 1 | +--- |
| 2 | +"@spectrum-css/stepper": major |
| 3 | +--- |
| 4 | + |
| 5 | +### Number field S2 Migration |
| 6 | + |
| 7 | +This work migrations the stepper/number field component to Spectrum 2! 🎉 The S1 stepper was very minimal, and didn't align with SWC or React's implementation. This migration should bring parity to the CSS component. New features include: |
| 8 | + |
| 9 | +- the display name for this component has changed from `stepper` to `number field` (based on design's, React's and SWC's naming conventions.) |
| 10 | + - _**Note:**_ The NPM package name has remained as "stepper," and hasn't yet changed to "number field."" |
| 11 | +- an error state with alert icon |
| 12 | +- optional help text |
| 13 | +- embedded field label & optional positions |
| 14 | + |
| 15 | +#### Quick overview |
| 16 | + |
| 17 | +Because of all the new features and to align more with design, SWC and React, below is a quick recap of the following tokens & classes that have been renamed in the CSS: |
| 18 | + |
| 19 | +- All `.spectrum-Stepper*` class names have been converted to `.spectrum-NumberField*` |
| 20 | +- The `.hide-stepper` class has been converted to `.spectrum-NumberField--hiddenStepper` |
| 21 | +- Custom properties have been renamed from `--spectrum-stepper*` to `--spectrum-numberfield*` |
| 22 | +- Modifiable custom properties have been renamed from `--mod-stepper*` to `--mod-numberfield*` |
| 23 | +- Markup has changed |
| 24 | +- Styling lives on different elements |
| 25 | +- Lots more Chromatic test coverage |
| 26 | + |
| 27 | +#### Markup |
| 28 | + |
| 29 | +Following React's lead, the markup of the number field has changed. More obviously, help text and field label components are embedded into `.spectrum-NumberField`, instead of necessitating separate components. The number field now incorporates an error state that better reflects the embedded textfield's error state, so there is now an alert icon within the markup in an invalid number field. Additionally, a new `.spectrum-NumberField-inputs` containing wrapper was introduced to encapsulate the textfield element and infield button elements. This container allowed for some extra alignment styles for those 2 elements and then freed up the opportunity to introduced an "unstyled" `input` (as described more below). Custom classes were also added to the nested textfield and input elements to ensure styles for number field were passed correctly to the correct elements (`.spectrum-NumberField-textfield` and `.spectrum-NumberField-input`). |
| 30 | + |
| 31 | +Stemming from the infield button S2 migration, there is also an extra container for the inline (previously "stacked") stepper buttons. |
| 32 | + |
| 33 | +#### Styling |
| 34 | + |
| 35 | +The `.spectrum-NumberField-textfield` div is where the S2 design language lives (instead of on the input element), while the actual `input` (`.spectrum-NumberField-input`) is unstyled and incorporated more subtly. Breaking changes were introduced in all previous custom properties, where any `--spectrum-stepper-*` or `--mod-stepper-*` properties were renamed to `--spectrum-numberfield-*`or `--mod-numberfield-*`. This also applied to class names, where `.spectrum-Stepper` changed to `.spectrum-NumberField`. The `hide-stepper` class has also been updated to match our class naming conventions (`.spectrum-NumberField--hiddenStepper`). |
| 36 | + |
| 37 | +#### Mods |
| 38 | + |
| 39 | +Modifiable custom properties have been renamed from `--mod-stepper*` to `--mod-numberfield`. |
| 40 | + |
| 41 | +##### Removed custom properties include |
| 42 | + |
| 43 | +--mod-stepper-animation-duration |
| 44 | +--mod-stepper-button-border-width |
| 45 | +--mod-stepper-button-width |
| 46 | +--mod-stepper-button-width-quiet |
| 47 | +--mod-stepper-buttons-background-color |
| 48 | +--mod-stepper-buttons-border-color |
| 49 | +--mod-stepper-buttons-border-color-focus |
| 50 | +--mod-stepper-buttons-border-color-focus-hover |
| 51 | +--mod-stepper-buttons-border-color-hover |
| 52 | +--mod-stepper-buttons-border-color-keyboard-focus |
| 53 | +--mod-stepper-buttons-border-style |
| 54 | +--mod-stepper-buttons-border-width |
| 55 | +--mod-stepper-focus-indicator-visibility |
| 56 | +--mod-stepper-height (renamed to --mod-numberfield-block-size) |
| 57 | +--mod-stepper-width (renamed to --mod-numberfield-inline-size) |
| 58 | + |
| 59 | +##### New custom properties include |
| 60 | + |
| 61 | +--mod-numberfield-background-color |
| 62 | +--mod-numberfield-background-color-disabled |
| 63 | +--mod-numberfield-block-size (renamed from --mod-stepper-height) |
| 64 | +--mod-numberfield-border-color-disabled |
| 65 | +--mod-numberfield-border-color-invalid-default |
| 66 | +--mod-numberfield-border-color-invalid-focus |
| 67 | +--mod-numberfield-border-color-invalid-focus-hover |
| 68 | +--mod-numberfield-border-color-invalid-hover |
| 69 | +--mod-numberfield-border-color-invalid-keyboard-focus |
| 70 | +--mod-numberfield-button-inline-offset |
| 71 | +--mod-numberfield-font-family |
| 72 | +--mod-numberfield-font-size |
| 73 | +--mod-numberfield-font-style |
| 74 | +--mod-numberfield-font-weight |
| 75 | +--mod-numberfield-hidden-stepper-min-inline-size |
| 76 | +--mod-numberfield-inline-size (renamed from --mod-stepper-width) |
| 77 | +--mod-numberfield-label-to-field |
| 78 | +--mod-numberfield-line-height |
| 79 | +--mod-numberfield-min-inline-size |
| 80 | +--mod-numberfield-spacing-block-end-edge-to-text |
| 81 | +--mod-numberfield-spacing-block-start-edge-to-text |
| 82 | +--mod-numberfield-spacing-field-to-helptext |
0 commit comments