-
Notifications
You must be signed in to change notification settings - Fork 461
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
Open
austincalvelage
wants to merge
16
commits into
main
Choose a base branch
from
austin/mosaic-input-component
base: main
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
16 commits
Select commit
Hold shift + click to select a range
22f0163
refactor(ui): migrate Mosaic Input to StyleX
austincalvelage 8fab4cd
test(ui): cover Mosaic Input behavior
austincalvelage 593d039
chore(repo): add Input migration changeset
austincalvelage 6523b84
fix(ui): align Mosaic Input with Figma
austincalvelage 4574510
Merge branch 'main' into austin/mosaic-input-component
austincalvelage 6bd077e
fix(ui): use placeholder color token
austincalvelage 5d6dd33
fix(ui): theme Input focus ring
austincalvelage d51691b
fix(ui): preserve Input focus when invalid
austincalvelage 541986b
fix(ui): align Mosaic Input interaction states
austincalvelage 4255318
Merge branch 'main' into austin/mosaic-input-component
austincalvelage 7295b52
Merge remote-tracking branch 'origin/main' into austin/mosaic-input-c…
austincalvelage 03ea785
fix(ui): refine Mosaic Input interaction states
austincalvelage 8ff649e
Update --cl-color-border token
austincalvelage 83a2527
feat(ui): add Mosaic font family token
austincalvelage 75a7158
fix(ui): prevent iOS zoom on Mosaic inputs
austincalvelage 0dae1e5
feat(ui): add Mosaic input color token
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'; |
101 changes: 101 additions & 0 deletions
101
packages/ui/src/mosaic/components/input/input.styles.ts
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,101 @@ | ||
| 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'], | ||
| boxSizing: 'border-box', | ||
| color: 'inherit', | ||
| 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.