Skip to content

Commit

Permalink
[High Contrast Mode] Form controls (#8193)
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen authored Dec 2, 2024
1 parent ca9a01e commit 91f3f91
Show file tree
Hide file tree
Showing 48 changed files with 331 additions and 129 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports[`EuiCheckableCard is rendered 1`] = `
>
<span
class="emotion-euiRadio__icon"
data-euiicon-type="dot"
data-euiicon-type="empty"
/>
<input
class="euiRadio__input emotion-euiRadio__input"
Expand Down Expand Up @@ -96,7 +96,7 @@ exports[`EuiCheckableCard renders children 1`] = `
>
<span
class="emotion-euiRadio__icon"
data-euiicon-type="dot"
data-euiicon-type="empty"
/>
<input
class="euiRadio__input emotion-euiRadio__input"
Expand Down Expand Up @@ -142,7 +142,7 @@ exports[`EuiCheckableCard renders disabled 1`] = `
>
<span
class="emotion-euiRadio__icon"
data-euiicon-type="dot"
data-euiicon-type="empty"
/>
<input
class="euiRadio__input emotion-euiRadio__input"
Expand Down Expand Up @@ -182,7 +182,7 @@ exports[`EuiCheckableCard renders panel props 1`] = `
>
<span
class="emotion-euiRadio__icon"
data-euiicon-type="dot"
data-euiicon-type="empty"
/>
<input
class="euiRadio__input emotion-euiRadio__input"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export const euiFilterSelectItemStyles = (euiThemeContext: UseEuiTheme) => {
color: ${euiTheme.colors.text};
${logicalCSS(
'border-bottom',
`${euiTheme.border.width.thin} solid ${euiTheme.colors.lightestShade}`
`${euiTheme.border.width.thin} solid ${transparentize(
euiTheme.border.color,
0.4
)}`
)}
&:hover {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ export const Playground: Story = {
},
},
};

export const HighContrast: Story = {
...Playground,
tags: ['vrt-only'],
globals: { highContrastMode: true },
};
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const euiFilePickerStyles = (euiThemeContext: UseEuiTheme) => {
${euiTextTruncate()}
color: ${euiTheme.colors.text};
border: ${euiTheme.border.width.thick} dashed
var(--euiFormControlStateColor, ${euiTheme.colors.lightShade});
var(--euiFormControlStateColor, ${euiTheme.border.color});
${euiCanAnimate} {
transition: border-color ${euiTheme.animation.fast} ease-in,
Expand Down
54 changes: 36 additions & 18 deletions packages/eui/src/components/form/form.styles.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe('euiFormVariables', () => {
"iconAffordance": "24px",
"iconCompressedAffordance": "18px",
"maxWidth": "400px",
"stateUnderlineHeight": "2px",
"textColor": "#343741",
}
`);
Expand Down Expand Up @@ -123,11 +124,11 @@ describe('euiFormControlStyles', () => {
",
"focus": "
--euiFormControlStateColor: #07C;
background-color: #FFF;
background-size: 100% 100%;
outline: none; /* Remove all outlines and rely on our own bottom border gradient */
",
--euiFormControlStateColor: #07C;
background-color: #FFF;
background-size: 100% 100%;
outline: none; /* Remove all outlines and rely on our own bottom border gradient */
",
"formWidth": "
max-inline-size: 400px;
inline-size: 100%;
Expand All @@ -142,16 +143,17 @@ describe('euiFormControlStyles', () => {
border-radius: 0;
",
"invalid": "
--euiFormControlStateColor: #BD271E;
background-size: 100% 100%;
",
--euiFormControlStateColor: #BD271E;
background-size: 100% 100%;
",
"readOnly": "
cursor: default;
color: #343741;
-webkit-text-fill-color: #343741; /* Required for Safari */
background-color: #FFF;
--euiFormControlStateColor: transparent;
",
"shared": "
Expand Down Expand Up @@ -224,26 +226,40 @@ describe('euiFormCustomControlStyles', () => {
"input": {
"disabled": {
"selected": "
label: disabled;
color: #69707D;
background-color: #D3DAE6;
",
label: disabled;
cursor: not-allowed;
background-color: #D3DAE6;
border-color: #D3DAE6;
color: #69707D;
",
"shared": "
label: disabled;
cursor: not-allowed;
background-color: #D3DAE6;
border-color: #D3DAE6;
",
"unselected": "
label: disabled;
color: #D3DAE6;
background-color: #D3DAE6;
cursor: not-allowed;
",
label: disabled;
cursor: not-allowed;
background-color: #D3DAE6;
border-color: #D3DAE6;
color: #D3DAE6;
",
},
"enabled": {
"selected": "
color: #FFF;
background-color: #07C;
border-color: #07C;
",
"unselected": "
color: transparent;
background-color: #FFF;
border: 1px solid #919296;
border-color: #919296;
&:has(input:focus) {
border-color: #07C;
Expand All @@ -257,6 +273,8 @@ describe('euiFormCustomControlStyles', () => {
display: flex;
justify-content: center;
align-items: center;
/* For Windows high contrast themes, a border must always be rendered, not just a background */
border: 1px solid transparent;
&:has(input:focus-visible) {
outline: 2px solid #07C;
Expand Down
Loading

0 comments on commit 91f3f91

Please sign in to comment.