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

[Emotion] Convert EuiDatePicker #7937

Merged
merged 21 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
09101af
Delete unused CSS
cee-chen Jul 31, 2024
2191e37
Convert inline SVG CSS to direct EuiButtonIcon use
cee-chen Jul 30, 2024
46e0b54
Convert `datePickerCaret` inline SVG to direct EuiIcon usage
cee-chen Jul 30, 2024
b0154c7
Convert `display: none` css to simply deleting the rendered JSX entirely
cee-chen Jul 31, 2024
98aae1e
Convert form control/`EuiDatePicker` wrapper styles
cee-chen Jul 31, 2024
0ba20df
Convert `react-datepicker` styles to vanilla Emotion
cee-chen Jul 31, 2024
f86783e
Set up date picker variables + convert absolutely positioned header e…
cee-chen Jul 31, 2024
639e839
Convert time select styles
cee-chen Jul 31, 2024
1d13e92
Convert day calendar styles
cee-chen Aug 1, 2024
9724407
Convert month/year dropdown styles
cee-chen Aug 1, 2024
c1853d6
Final VRT update
cee-chen Aug 1, 2024
c7d71cd
Delete last Sass variable
cee-chen Aug 1, 2024
26b178b
Delete all date picker Sass files
cee-chen Aug 1, 2024
a802a2b
stylelint shenanigans
cee-chen Aug 1, 2024
cd5a188
changelog
cee-chen Aug 1, 2024
1947d05
[tests] `shouldRenderCustomStyles` + remove Enzyme
cee-chen Aug 1, 2024
32b03ab
Fix EuiDatePickerRange arrow not getting correct responsive styles on…
cee-chen Aug 1, 2024
25b80b3
Fix failing Cypress tests due to removed modifier classes
cee-chen Aug 1, 2024
48480f1
Fix bug with time select height on mobile
cee-chen Aug 1, 2024
e5d56b2
Fix time select to correctly scroll to the selected/pre-selected opti…
cee-chen Aug 1, 2024
8ec68e3
Merge branch 'main' into emotion/react-date-picker
cee-chen Aug 1, 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
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,30 @@ exports[`EuiDatePicker localization accepts the locale prop 1`] = `
class="react-datepicker__triangle"
/>
<button
class="react-datepicker__navigation react-datepicker__navigation--previous"
aria-label="Previous Month"
class="euiButtonIcon react-datepicker__navigation react-datepicker__navigation--previous emotion-euiButtonIcon-s-empty-text"
title="Previous Month"
type="button"
>
Previous Month
<span
aria-hidden="true"
class="euiButtonIcon__icon"
color="inherit"
data-euiicon-type="sortLeft"
/>
</button>
<button
class="react-datepicker__navigation react-datepicker__navigation--next"
aria-label="Next month"
class="euiButtonIcon react-datepicker__navigation react-datepicker__navigation--next emotion-euiButtonIcon-s-empty-text"
title="Next month"
type="button"
>
Next month
<span
aria-hidden="true"
class="euiButtonIcon__icon"
color="inherit"
data-euiicon-type="sortRight"
/>
</button>
<div
class="react-datepicker__month-container"
Expand Down Expand Up @@ -483,16 +497,30 @@ exports[`EuiDatePicker localization inherits locale from context 1`] = `
class="react-datepicker__triangle"
/>
<button
class="react-datepicker__navigation react-datepicker__navigation--previous"
aria-label="Previous Month"
class="euiButtonIcon react-datepicker__navigation react-datepicker__navigation--previous emotion-euiButtonIcon-s-empty-text"
title="Previous Month"
type="button"
>
Previous Month
<span
aria-hidden="true"
class="euiButtonIcon__icon"
color="inherit"
data-euiicon-type="sortLeft"
/>
</button>
<button
class="react-datepicker__navigation react-datepicker__navigation--next"
aria-label="Next month"
class="euiButtonIcon react-datepicker__navigation react-datepicker__navigation--next emotion-euiButtonIcon-s-empty-text"
title="Next month"
type="button"
>
Next month
<span
aria-hidden="true"
class="euiButtonIcon__icon"
color="inherit"
data-euiicon-type="sortRight"
/>
</button>
<div
class="react-datepicker__month-container"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,16 +281,30 @@ exports[`EuiDatePickerRange props inline renders 1`] = `
class="react-datepicker__triangle"
/>
<button
class="react-datepicker__navigation react-datepicker__navigation--previous"
aria-label="Previous Month"
class="euiButtonIcon react-datepicker__navigation react-datepicker__navigation--previous emotion-euiButtonIcon-s-empty-text"
title="Previous Month"
type="button"
>
Previous Month
<span
aria-hidden="true"
class="euiButtonIcon__icon"
color="inherit"
data-euiicon-type="sortLeft"
/>
</button>
<button
class="react-datepicker__navigation react-datepicker__navigation--next"
aria-label="Next month"
class="euiButtonIcon react-datepicker__navigation react-datepicker__navigation--next emotion-euiButtonIcon-s-empty-text"
title="Next month"
type="button"
>
Next month
<span
aria-hidden="true"
class="euiButtonIcon__icon"
color="inherit"
data-euiicon-type="sortRight"
/>
</button>
<div
class="react-datepicker__month-container"
Expand Down Expand Up @@ -794,16 +808,30 @@ exports[`EuiDatePickerRange props inline renders 1`] = `
class="react-datepicker__triangle"
/>
<button
class="react-datepicker__navigation react-datepicker__navigation--previous"
aria-label="Previous Month"
class="euiButtonIcon react-datepicker__navigation react-datepicker__navigation--previous emotion-euiButtonIcon-s-empty-text"
title="Previous Month"
type="button"
>
Previous Month
<span
aria-hidden="true"
class="euiButtonIcon__icon"
color="inherit"
data-euiicon-type="sortLeft"
/>
</button>
<button
class="react-datepicker__navigation react-datepicker__navigation--next"
aria-label="Next month"
class="euiButtonIcon react-datepicker__navigation react-datepicker__navigation--next emotion-euiButtonIcon-s-empty-text"
title="Next month"
type="button"
>
Next month
<span
aria-hidden="true"
class="euiButtonIcon__icon"
color="inherit"
data-euiicon-type="sortRight"
/>
</button>
<div
class="react-datepicker__month-container"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import CalendarContainer from "./calendar_container";

import { EuiFocusTrap } from '../../../focus_trap';
import { EuiScreenReaderOnly } from '../../../accessibility/screen_reader_only';
import { EuiButtonIcon } from "../../../button";
import {
now,
setMonth,
Expand Down Expand Up @@ -421,14 +422,16 @@ export default class Calendar extends React.Component {
}

return (
<button
type="button"
<EuiButtonIcon
cee-chen marked this conversation as resolved.
Show resolved Hide resolved
iconType="sortLeft"
size="s"
color="text"
className={classes.join(" ")}
onClick={clickHandler}
disabled={!this.props.accessibleMode}
>
{this.props.previousMonthButtonLabel}
</button>
aria-label={this.props.previousMonthButtonLabel}
title={this.props.previousMonthButtonLabel}
/>
);
};

Expand Down Expand Up @@ -471,14 +474,16 @@ export default class Calendar extends React.Component {
}

return (
<button
type="button"
<EuiButtonIcon
iconType="sortRight"
size="s"
color="text"
className={classes.join(" ")}
onClick={clickHandler}
disabled={!this.props.accessibleMode}
>
{this.props.nextMonthButtonLabel}
</button>
aria-label={this.props.nextMonthButtonLabel}
title={this.props.nextMonthButtonLabel}
/>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
gap: $euiDatePickerGap;
position: absolute;
top: 0;
left: $euiDatePickerButtonSize + $euiDatePickerGap;
right: $euiDatePickerButtonSize + $euiDatePickerGap;
left: $euiSizeXL + $euiDatePickerGap;
right: $euiSizeXL + $euiDatePickerGap;
justify-content: center;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
.react-datepicker__navigation--next,
.react-datepicker__navigation--previous {
@include datePickerArrow;
cursor: pointer;
position: absolute;
top: $euiDatePickerGap * 2;
height: $euiDatePickerButtonSize;
width: $euiDatePickerButtonSize;
z-index: 1;
text-indent: -999em;
overflow: hidden;
background-repeat: no-repeat;
border-radius: $euiBorderRadiusSmall;
background-position: center;

// Remove default EuiButtonIcon translate-Y
&:hover,
&:focus {
background-color: $euiFocusBackgroundColor;
transform: none !important;
}
}

.react-datepicker__navigation--previous {
left: $euiDatePickerGap * 2;
transform: rotate(180deg);
transform-origin: center;
}

.react-datepicker__navigation--next {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,3 @@
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk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) > 50) {
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZmlsbD0iIzM0Mzc0MSIgZD0iTTExLjY5MiA3SDMuNTU2QzMuMjQ5IDcgMyA3LjIyNCAzIDcuNXMuMjQ5LjUuNTU2LjVoOC4xMzZsLTQuMDk2IDQuMDk2YS41LjUgMCAwMC43MDcuNzA3bDQuMjQzLTQuMjQyYy4yNTgtLjI1OS40MDMtLjU4Ny40MzMtLjkyNWEuNDU0LjQ1NCAwIDAwMC0uMjcyIDEuNDk0IDEuNDk0IDAgMDAtLjQzMy0uOTI1TDguMzAzIDIuMTk3YS41LjUgMCAxMC0uNzA3LjcwN0wxMS42OTIgN3oiLz48L3N2Zz4=);
} @else {
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZmlsbD0iI0ZGRiIgZD0iTTExLjY5MiA3SDMuNTU2QzMuMjQ5IDcgMyA3LjIyNCAzIDcuNXMuMjQ5LjUuNTU2LjVoOC4xMzZsLTQuMDk2IDQuMDk2YS41LjUgMCAwMC43MDcuNzA3bDQuMjQzLTQuMjQyYy4yNTgtLjI1OS40MDMtLjU4Ny40MzMtLjkyNWEuNDU0LjQ1NCAwIDAwMC0uMjcyIDEuNDk0IDEuNDk0IDAgMDAtLjQzMy0uOTI1TDguMzAzIDIuMTk3YS41LjUgMCAxMC0uNzA3LjcwN0wxMS42OTIgN3oiLz48L3N2Zz4=);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ $euiDatePickerCalendarWidth: 284px;

$euiDatePickerPadding: $euiSizeS;
$euiDatePickerGap: $euiSizeXS;
$euiDatePickerButtonSize: $euiSizeXL;

$euiDatePickerMinControlWidth: 100px;
$euiDatePickerMaxControlWidth: 140px;