Skip to content
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

[High Contrast Mode] Ranges, color pickers, and date pickers #8199

Merged
merged 18 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
33b1981
[Eui(Dual)Range] Increase track contrast + fix Windows forced rendering
cee-chen Dec 2, 2024
aaa0095
[Eui(Dual)Range] Misc syntax cleanup
cee-chen Dec 3, 2024
6d02877
[Eui(Dual)Range] Set up CSS variable for dynamic thumb colors
cee-chen Dec 3, 2024
bca189a
[Eui(Dual)Range] Improve the visibility of thumbs in high contrast mode
cee-chen Dec 3, 2024
ab074ed
[Eui(Dual)Range] Increase contrast of ticks + fix Win high contrast t…
cee-chen Dec 3, 2024
4d9497e
[Eui(Dual)Range] Fix tooltips in high contrast Windows + increase dar…
cee-chen Dec 3, 2024
1747af4
[EuiColorPalette] Add border + fix Windows high contrast theme display
cee-chen Dec 2, 2024
8f853e7
[EuiColorPalette] Misc optional perf improvements in subcomponents
cee-chen Dec 2, 2024
9538ee5
[EuiColorPicker] Add border + fix hue/saturation pickers in Win high …
cee-chen Dec 2, 2024
7856503
[EuiColorPicker] Fix unnecessary CSS workaround
cee-chen Dec 2, 2024
2c89304
[EuiColorPicker] (opinionated) Increase visible thumb contrast further
cee-chen Dec 2, 2024
859eb61
[EuiColorPicker] Fix alpha selection append display
cee-chen Dec 3, 2024
c016bc5
[react-datepicker] Fix Windows high contrast/forced color modes rende…
cee-chen Nov 27, 2024
d225ace
[EuiDatePicker][EuiDatePickerRange] Fix inline shadows
cee-chen Nov 27, 2024
1011d27
[EuiSuperDatePicker] Fix duplicate high contrast borders
cee-chen Nov 11, 2024
543f22b
[EuiSuperDatePicker] Improve Windows high contrast state indication
cee-chen Dec 3, 2024
9331f5a
[PR feedback] Fix border-radius issues with saturation picker
cee-chen Dec 3, 2024
c7e35b0
[PR feedback] Standardize hue/saturation indicator focus outline on l…
cee-chen Dec 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
4 changes: 2 additions & 2 deletions packages/eui/src/components/form/range/dual_range.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -579,13 +579,13 @@ export class EuiDualRangeClass extends Component<
const leftThumbStyles = leftThumbColor
? {
...leftThumbPosition,
backgroundColor: euiRangeLevelColor(leftThumbColor, theme.euiTheme),
backgroundColor: euiRangeLevelColor(leftThumbColor, theme),
}
: leftThumbPosition;
const rightThumbStyles = rightThumbColor
? {
...rightThumbPosition,
backgroundColor: euiRangeLevelColor(rightThumbColor, theme.euiTheme),
backgroundColor: euiRangeLevelColor(rightThumbColor, theme),
}
: rightThumbPosition;

Expand Down
10 changes: 7 additions & 3 deletions packages/eui/src/components/form/range/range.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ export const euiRangeVariables = (euiThemeContext: UseEuiTheme) => {
thumbWidth: thumbWidth,
thumbBorderWidth: euiTheme.border.width.thick,
thumbBorderColor: euiTheme.colors.emptyShade,
thumbBackgroundColor: euiTheme.colors.darkShade, // same as highlightColor
get thumbBackgroundColor() {
cee-chen marked this conversation as resolved.
Show resolved Hide resolved
return this.highlightColor;
},

trackWidth: '100%',
trackHeight: trackHeight,
trackBorderWidth: '0px',
trackBorderColor: euiTheme.colors.lightShade, // same as trackColor
get trackBorderColor() {
return this.trackColor;
},
trackBorderRadius: euiTheme.border.radius.medium,

tickHeight: trackHeight,
Expand Down Expand Up @@ -83,7 +87,7 @@ export const euiRangeThumbBorder = (euiThemeContext: UseEuiTheme) => {
};

export const euiRangeThumbBoxShadow = (euiThemeContext: UseEuiTheme) => {
const euiTheme = euiThemeContext.euiTheme;
const { euiTheme } = euiThemeContext;
const shadowColor = `rgba(${hexToRgb(euiTheme.colors.shadow)}, .2)`;

const range = euiRangeVariables(euiThemeContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export const euiRangeLevelsStyles = (euiThemeContext: UseEuiTheme) => {
};

export const euiRangeLevelStyles = (euiThemeContext: UseEuiTheme) => {
const { euiTheme } = euiThemeContext;
const range = euiRangeVariables(euiThemeContext);

return {
Expand All @@ -78,16 +77,16 @@ export const euiRangeLevelStyles = (euiThemeContext: UseEuiTheme) => {
}
`,
primary: css`
background-color: ${euiRangeLevelColor('primary', euiTheme)};
background-color: ${euiRangeLevelColor('primary', euiThemeContext)};
`,
success: css`
background-color: ${euiRangeLevelColor('success', euiTheme)};
background-color: ${euiRangeLevelColor('success', euiThemeContext)};
`,
warning: css`
background-color: ${euiRangeLevelColor('warning', euiTheme)};
background-color: ${euiRangeLevelColor('warning', euiThemeContext)};
`,
danger: css`
background-color: ${euiRangeLevelColor('danger', euiTheme)};
background-color: ${euiRangeLevelColor('danger', euiThemeContext)};
`,
customColor: css``,
};
Expand Down
10 changes: 5 additions & 5 deletions packages/eui/src/components/form/range/range_levels_colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ export const LEVEL_COLORS = [
] as const;
export type EuiRangeLevelColor = (typeof LEVEL_COLORS)[number];

export const isNamedLevelColor = (color?: EuiRangeLevelColor | string) =>
export const isNamedLevelColor = (
color?: EuiRangeLevelColor | string
): color is EuiRangeLevelColor =>
LEVEL_COLORS.includes(color as EuiRangeLevelColor);

export const euiRangeLevelColor = (
color: EuiRangeLevelColor | string,
euiTheme: UseEuiTheme['euiTheme']
{ euiTheme }: UseEuiTheme
) => {
return isNamedLevelColor(color)
? euiTheme.colors[color as EuiRangeLevelColor]
: color;
return isNamedLevelColor(color) ? euiTheme.colors[color] : color;
mgadewoll marked this conversation as resolved.
Show resolved Hide resolved
};

export const getLevelColor = (levels: EuiRangeLevel[], value: number) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/eui/src/components/form/range/range_slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const EuiRangeSlider: FunctionComponent<EuiRangeSliderProps> = ({

const sliderStyle = useMemo(() => {
return logicalStyles({
color: thumbColor && euiRangeLevelColor(thumbColor, euiTheme.euiTheme),
color: thumbColor && euiRangeLevelColor(thumbColor, euiTheme),
...style,
});
}, [thumbColor, euiTheme, style]);
Expand Down