-
Notifications
You must be signed in to change notification settings - Fork 201
feat(stepper): s2 number field/stepper migration #3681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
marissahuysentruyt
wants to merge
10
commits into
spectrum-two
Choose a base branch
from
marissahuysentruyt/css-1022-s2-migration-number-field-stepper
base: spectrum-two
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
83764b4
chore(numberfield): update package.json rootClass to NumberField
marissahuysentruyt 3f9d0f6
docs(numberfield): update template.js
marissahuysentruyt aeaa529
docs(numberfield): update stories for docs page
marissahuysentruyt 80e00d5
docs(numberfield): adds more test coverage
marissahuysentruyt 3006ce5
feat(numberfield): s2 style migration
marissahuysentruyt da46b6e
fix(form): updates number field language in comments
marissahuysentruyt 3bd073d
chore(numberfield): updates metadata.json
marissahuysentruyt ec69a47
chore(form): add changeset
marissahuysentruyt 5b61f78
chore(numberfield): add changeset
marissahuysentruyt 785d2f9
fix(numberfield): linter fixes and update metadata
marissahuysentruyt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
"@spectrum-css/stepper": major | ||
--- | ||
|
||
### Number field S2 Migration | ||
|
||
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: | ||
|
||
- the display name for this component has changed from `stepper` to `number field` (based on design's, React's and SWC's naming conventions.) | ||
- _**Note:**_ The NPM package name has remained as "stepper," and hasn't yet changed to "number field."" | ||
- an error state with alert icon | ||
- optional help text | ||
- embedded field label & optional positions | ||
|
||
#### Quick overview | ||
|
||
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: | ||
|
||
- All `.spectrum-Stepper*` class names have been converted to `.spectrum-NumberField*` | ||
- The `.hide-stepper` class has been converted to `.spectrum-NumberField--hiddenStepper` | ||
- Custom properties have been renamed from `--spectrum-stepper*` to `--spectrum-numberfield*` | ||
- Modifiable custom properties have been renamed from `--mod-stepper*` to `--mod-numberfield*` | ||
- Markup has changed | ||
- Styling lives on different elements | ||
- Lots more Chromatic test coverage | ||
|
||
#### Markup | ||
|
||
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`). | ||
|
||
Stemming from the infield button S2 migration, there is also an extra container for the inline (previously "stacked") stepper buttons. | ||
|
||
#### Styling | ||
|
||
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`). | ||
|
||
#### Mods | ||
|
||
Modifiable custom properties have been renamed from `--mod-stepper*` to `--mod-numberfield`. | ||
|
||
##### Removed custom properties include | ||
|
||
--mod-stepper-animation-duration | ||
--mod-stepper-button-border-width | ||
--mod-stepper-button-width | ||
--mod-stepper-button-width-quiet | ||
--mod-stepper-buttons-background-color | ||
--mod-stepper-buttons-border-color | ||
--mod-stepper-buttons-border-color-focus | ||
--mod-stepper-buttons-border-color-focus-hover | ||
--mod-stepper-buttons-border-color-hover | ||
--mod-stepper-buttons-border-color-keyboard-focus | ||
--mod-stepper-buttons-border-style | ||
--mod-stepper-buttons-border-width | ||
--mod-stepper-focus-indicator-visibility | ||
--mod-stepper-height (renamed to --mod-numberfield-block-size) | ||
--mod-stepper-width (renamed to --mod-numberfield-inline-size) | ||
|
||
##### New custom properties include | ||
|
||
--mod-numberfield-background-color | ||
--mod-numberfield-background-color-disabled | ||
--mod-numberfield-block-size (renamed from --mod-stepper-height) | ||
--mod-numberfield-border-color-disabled | ||
--mod-numberfield-border-color-invalid-default | ||
--mod-numberfield-border-color-invalid-focus | ||
--mod-numberfield-border-color-invalid-focus-hover | ||
--mod-numberfield-border-color-invalid-hover | ||
--mod-numberfield-border-color-invalid-keyboard-focus | ||
--mod-numberfield-button-inline-offset | ||
--mod-numberfield-font-family | ||
--mod-numberfield-font-size | ||
--mod-numberfield-font-style | ||
--mod-numberfield-font-weight | ||
--mod-numberfield-hidden-stepper-min-inline-size | ||
--mod-numberfield-inline-size (renamed from --mod-stepper-width) | ||
--mod-numberfield-label-to-field | ||
--mod-numberfield-line-height | ||
--mod-numberfield-min-inline-size | ||
--mod-numberfield-spacing-block-end-edge-to-text | ||
--mod-numberfield-spacing-block-start-edge-to-text | ||
--mod-numberfield-spacing-field-to-helptext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@spectrum-css/form": patch | ||
--- | ||
|
||
Updates comment to reference number field instead of stepper. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to tell me to revert this- it's probably not necessary but I wanted to clarify the component's new name.