-
Notifications
You must be signed in to change notification settings - Fork 464
refactor(ui): Mosaic input component #9309
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
97efb64
refactor(ui): migrate Mosaic Input to StyleX
austincalvelage a317211
test(ui): cover Mosaic Input behavior
austincalvelage 5751227
chore(repo): add Input migration changeset
austincalvelage 11086f3
fix(ui): align Mosaic Input with Figma
austincalvelage fb4ad8e
fix(ui): use placeholder color token
austincalvelage 6d3249d
fix(ui): theme Input focus ring
austincalvelage 4ec5b34
fix(ui): preserve Input focus when invalid
austincalvelage 496b0e7
fix(ui): align Mosaic Input interaction states
austincalvelage bc2244c
fix(ui): refine Mosaic Input interaction states
austincalvelage f75dab1
Update --cl-color-border token
austincalvelage 38e7618
feat(ui): add Mosaic font family token
austincalvelage 4c2cf4b
fix(ui): prevent iOS zoom on Mosaic inputs
austincalvelage 47eca0a
feat(ui): add Mosaic input color token
austincalvelage c7c16b0
fix(ui): apply Mosaic reset to Input
austincalvelage 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,2 @@ | ||
| --- | ||
| --- |
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
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
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
This file was deleted.
Oops, something went wrong.
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,2 @@ | ||
| export { Input } from './input'; | ||
| export type { InputProps } from './input'; |
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,99 @@ | ||
| import * as stylex from '@stylexjs/stylex'; | ||
|
|
||
| import { | ||
| colorVars, | ||
| durationVars, | ||
| fontFamilyVars, | ||
| fontWeightVars, | ||
| radiusVars, | ||
| space, | ||
| typeScaleVars, | ||
| } from '../../tokens.stylex'; | ||
|
|
||
| const disabledBackgroundColor = `color-mix(in oklab, ${colorVars['--cl-color-primary']} 5%, transparent)`; | ||
| const interactionBorderColor = `color-mix(in oklab, ${colorVars['--cl-color-neutral']} 20%, transparent)`; | ||
|
|
||
| export const styles = stylex.create({ | ||
| base: { | ||
| borderColor: { | ||
| default: colorVars['--cl-color-border'], | ||
| ':focus-visible': interactionBorderColor, | ||
| ':focus-visible:where([aria-invalid="true"])': colorVars['--cl-color-negative'], | ||
| ':where([aria-invalid="true"])': colorVars['--cl-color-negative'], | ||
| '@media (hover: hover)': { | ||
| ':hover:not([aria-invalid="true"])': interactionBorderColor, | ||
| }, | ||
| }, | ||
| borderStyle: 'solid', | ||
| borderWidth: { | ||
| default: '1px', | ||
| ':where([aria-invalid="true"])': '2px', | ||
| }, | ||
| outline: { | ||
| default: 'none', | ||
| ':focus-visible': `2px solid ${colorVars['--cl-color-primary']}`, | ||
| ':focus-visible:where([aria-invalid="true"])': 'none', | ||
| }, | ||
| backgroundColor: colorVars['--cl-color-input'], | ||
| display: 'block', | ||
| fontFamily: fontFamilyVars['--cl-font-family-sans'], | ||
| outlineOffset: '2px', | ||
| transitionDuration: durationVars['--cl-duration-base'], | ||
| transitionProperty: 'color, background-color, border-color', | ||
| minWidth: 0, | ||
| width: '100%', | ||
| '::file-selector-button': { | ||
| borderStyle: 'none', | ||
| borderWidth: 0, | ||
| backgroundColor: 'transparent', | ||
| color: 'inherit', | ||
| display: 'inline-flex', | ||
| fontSize: typeScaleVars['--cl-text-sm-size'], | ||
| fontWeight: fontWeightVars['--cl-font-medium'], | ||
| lineHeight: typeScaleVars['--cl-text-sm-leading'], | ||
| height: space['6'], | ||
| }, | ||
| '::placeholder': { | ||
| color: colorVars['--cl-color-input-placeholder'], | ||
| }, | ||
| }, | ||
| disabled: { | ||
| backgroundColor: disabledBackgroundColor, | ||
| cursor: 'not-allowed', | ||
| opacity: 0.5, | ||
| pointerEvents: 'none', | ||
| }, | ||
| }); | ||
|
|
||
| export const sizes = stylex.create({ | ||
| sm: { | ||
| borderRadius: radiusVars['--cl-radius-control'], | ||
| paddingInline: space['3'], | ||
| fontSize: { | ||
| default: typeScaleVars['--cl-text-xs-size'], | ||
| '@media (pointer: coarse)': `max(1rem, ${typeScaleVars['--cl-text-xs-size']})`, | ||
| }, | ||
| lineHeight: typeScaleVars['--cl-text-xs-leading'], | ||
| height: space['7'], | ||
| }, | ||
| md: { | ||
| borderRadius: radiusVars['--cl-radius-control'], | ||
| paddingInline: space['3'], | ||
| fontSize: { | ||
| default: typeScaleVars['--cl-text-sm-size'], | ||
| '@media (pointer: coarse)': `max(1rem, ${typeScaleVars['--cl-text-sm-size']})`, | ||
| }, | ||
| lineHeight: typeScaleVars['--cl-text-sm-leading'], | ||
| height: space['8'], | ||
| }, | ||
| lg: { | ||
| borderRadius: radiusVars['--cl-radius-element'], | ||
| paddingInline: space['3'], | ||
| fontSize: { | ||
| default: typeScaleVars['--cl-text-base-size'], | ||
| '@media (pointer: coarse)': `max(1rem, ${typeScaleVars['--cl-text-base-size']})`, | ||
| }, | ||
| lineHeight: 1.375, | ||
| height: space['9'], | ||
| }, | ||
|
austincalvelage marked this conversation as resolved.
|
||
| }); | ||
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.
💭 we maybe need a reset helper that just resets margin, padding, and box-sizing. we can follow up with it.