forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(web-components) Cleaned up shared styles for button and input for im…
…proved reuse and color updates (microsoft#24929) * Cleaned up shared styles for button and input for improved reuse and color updates * Change file * Remove underscore update on internals. * Fix lint issues
- Loading branch information
Showing
14 changed files
with
545 additions
and
708 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-web-components-4bde24b4-312c-47f7-bbd5-003938181433.json
This file contains 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,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Cleaned up shared styles for button and input for improved reuse and color updates", | ||
"packageName": "@fluentui/web-components", | ||
"email": "47367562+bheston@users.noreply.github.com", | ||
"dependentChangeType": "patch" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,32 +1,28 @@ | ||
import { css, ElementStyles } from '@microsoft/fast-element'; | ||
import { ElementStyles } from '@microsoft/fast-element'; | ||
import { ElementDefinitionContext, FoundationElementDefinition } from '@microsoft/fast-foundation'; | ||
import { | ||
AccentButtonStyles, | ||
baseButtonStyles, | ||
HypertextStyles, | ||
LightweightButtonStyles, | ||
NeutralButtonStyles, | ||
OutlineButtonStyles, | ||
StealthButtonStyles, | ||
} from '../styles/'; | ||
import { appearanceBehavior } from '../utilities/behaviors'; | ||
|
||
const interactivitySelector: string = '[href]'; | ||
const nonInteractivitySelector: string = ':not([href])'; | ||
|
||
export const anchorStyles: ( | ||
context: ElementDefinitionContext, | ||
definition: FoundationElementDefinition, | ||
) => ElementStyles = (context: ElementDefinitionContext, definition: FoundationElementDefinition) => | ||
css` | ||
:host .control:not([href]) { | ||
cursor: default; | ||
} | ||
${baseButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)} | ||
`.withBehaviors( | ||
appearanceBehavior('accent', AccentButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)), | ||
appearanceBehavior('hypertext', HypertextStyles(context, definition, interactivitySelector, nonInteractivitySelector)), | ||
appearanceBehavior('lightweight', LightweightButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)), | ||
appearanceBehavior('outline', OutlineButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)), | ||
appearanceBehavior('stealth', StealthButtonStyles(context, definition, interactivitySelector, nonInteractivitySelector)), | ||
baseButtonStyles(context, definition, interactivitySelector) | ||
.withBehaviors( | ||
appearanceBehavior('neutral', NeutralButtonStyles(context, definition, interactivitySelector)), | ||
appearanceBehavior('accent', AccentButtonStyles(context, definition, interactivitySelector)), | ||
appearanceBehavior('hypertext', HypertextStyles(context, definition, interactivitySelector)), | ||
appearanceBehavior('lightweight', LightweightButtonStyles(context, definition, interactivitySelector)), | ||
appearanceBehavior('outline', OutlineButtonStyles(context, definition, interactivitySelector)), | ||
appearanceBehavior('stealth', StealthButtonStyles(context, definition, interactivitySelector)), | ||
); |
This file contains 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 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 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 |
---|---|---|
@@ -1,56 +1,50 @@ | ||
import { css, ElementStyles } from '@microsoft/fast-element'; | ||
import { ComboboxOptions, disabledCursor, ElementDefinitionContext } from '@microsoft/fast-foundation'; | ||
import { selectFilledStyles, selectStyles } from '../select/select.styles'; | ||
import { ComboboxOptions, disabledCursor, ElementDefinitionContext, forcedColorsStylesheetBehavior } from '@microsoft/fast-foundation'; | ||
import { baseSelectStyles } from '../select/select.styles'; | ||
import { appearanceBehavior } from '../utilities/behaviors'; | ||
import { neutralFillInputActive, neutralFillInputHover, neutralFillInputRest, neutralStrokeInputActive, neutralStrokeInputHover, neutralStrokeInputRest, strokeWidth } from '../design-tokens'; | ||
import { strokeWidth } from '../design-tokens'; | ||
import { typeRampBase } from '../styles/patterns/type-ramp'; | ||
import { inputFilledStyles, inputForcedColorStyles, inputOutlineStyles, inputStateStyles } from '../styles'; | ||
|
||
const logicalControlSelector: string = '.control'; | ||
const interactivitySelector: string = ':not([disabled]):not([open])'; | ||
|
||
export const comboboxStyles: (context: ElementDefinitionContext, definition: ComboboxOptions) => ElementStyles = ( | ||
context: ElementDefinitionContext, | ||
definition: ComboboxOptions, | ||
) => | ||
css` | ||
${selectStyles(context, definition)} | ||
:host { | ||
background: padding-box linear-gradient(${neutralFillInputRest}, ${neutralFillInputRest}), | ||
border-box ${neutralStrokeInputRest}; | ||
} | ||
${baseSelectStyles(context, definition)} | ||
:host(:not([disabled]):not([open]):hover) { | ||
background: padding-box linear-gradient(${neutralFillInputHover}, ${neutralFillInputHover}), | ||
border-box ${neutralStrokeInputHover}; | ||
} | ||
:host(:not([disabled]):not([open]):active) { | ||
background: padding-box linear-gradient(${neutralFillInputActive}, ${neutralFillInputActive}), | ||
border-box ${neutralStrokeInputActive}; | ||
} | ||
${inputStateStyles(context, definition, logicalControlSelector)} | ||
:host(:empty) .listbox { | ||
display: none; | ||
display: none; | ||
} | ||
:host([disabled]) *, | ||
:host([disabled]) { | ||
cursor: ${disabledCursor}; | ||
user-select: none; | ||
cursor: ${disabledCursor}; | ||
user-select: none; | ||
} | ||
:host(:active) .selected-value { | ||
user-select: none; | ||
user-select: none; | ||
} | ||
.selected-value { | ||
-webkit-appearance: none; | ||
background: transparent; | ||
border: none; | ||
color: inherit; | ||
${typeRampBase} | ||
height: calc(100% - ${strokeWidth} * 1px)); | ||
margin: auto 0; | ||
width: 100%; | ||
outline: none; | ||
-webkit-appearance: none; | ||
background: transparent; | ||
border: none; | ||
color: inherit; | ||
${typeRampBase} | ||
height: calc(100% - ${strokeWidth} * 1px)); | ||
margin: auto 0; | ||
width: 100%; | ||
outline: none; | ||
} | ||
`.withBehaviors( | ||
appearanceBehavior('filled', selectFilledStyles(context, definition))); | ||
`.withBehaviors( | ||
appearanceBehavior('outline', inputOutlineStyles(context, definition, logicalControlSelector, interactivitySelector)), | ||
appearanceBehavior('filled', inputFilledStyles(context, definition, logicalControlSelector, interactivitySelector)), | ||
forcedColorsStylesheetBehavior(inputForcedColorStyles(context, definition, logicalControlSelector, interactivitySelector)), | ||
); |
This file contains 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.