diff --git a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiRefreshInterval_Playground.png b/packages/eui/.loki/reference/chrome_desktop_Forms_EuiRefreshInterval_Playground.png index 90b57c8c021..b89d7fae227 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiRefreshInterval_Playground.png and b/packages/eui/.loki/reference/chrome_desktop_Forms_EuiRefreshInterval_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Custom_Quick_Select_Panel.png b/packages/eui/.loki/reference/chrome_desktop_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Custom_Quick_Select_Panel.png index 94a83b4771c..0ed7e06c6d5 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Custom_Quick_Select_Panel.png and b/packages/eui/.loki/reference/chrome_desktop_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Custom_Quick_Select_Panel.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Playground.png b/packages/eui/.loki/reference/chrome_desktop_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Playground.png index 94a83b4771c..0ed7e06c6d5 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Playground.png and b/packages/eui/.loki/reference/chrome_desktop_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiRefreshInterval_Playground.png b/packages/eui/.loki/reference/chrome_mobile_Forms_EuiRefreshInterval_Playground.png index 6f44f42f1ad..4eff6fb0bb5 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiRefreshInterval_Playground.png and b/packages/eui/.loki/reference/chrome_mobile_Forms_EuiRefreshInterval_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Custom_Quick_Select_Panel.png b/packages/eui/.loki/reference/chrome_mobile_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Custom_Quick_Select_Panel.png index 05460196756..fa3393a4c64 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Custom_Quick_Select_Panel.png and b/packages/eui/.loki/reference/chrome_mobile_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Custom_Quick_Select_Panel.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Playground.png b/packages/eui/.loki/reference/chrome_mobile_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Playground.png index 05460196756..fa3393a4c64 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Playground.png and b/packages/eui/.loki/reference/chrome_mobile_Forms_EuiSuperDatePicker_EuiSuperDatePicker_Playground.png differ diff --git a/packages/eui/changelogs/upcoming/7909.md b/packages/eui/changelogs/upcoming/7909.md new file mode 100644 index 00000000000..4856688794e --- /dev/null +++ b/packages/eui/changelogs/upcoming/7909.md @@ -0,0 +1,3 @@ +**CSS-in-JS conversions** + +- Converted `EuiSuperDatePicker`'s quick select to Emotion diff --git a/packages/eui/src/components/date_picker/_index.scss b/packages/eui/src/components/date_picker/_index.scss index 08789b2448c..8054cc5308d 100644 --- a/packages/eui/src/components/date_picker/_index.scss +++ b/packages/eui/src/components/date_picker/_index.scss @@ -1,3 +1,2 @@ // The react-date-picker overrides exists in the global_styling folder // to easily style differently between default and Amsterdam theme -@import 'super_date_picker/index'; diff --git a/packages/eui/src/components/date_picker/auto_refresh/refresh_interval.tsx b/packages/eui/src/components/date_picker/auto_refresh/refresh_interval.tsx index 9de28b0775e..9ace43ef5f0 100644 --- a/packages/eui/src/components/date_picker/auto_refresh/refresh_interval.tsx +++ b/packages/eui/src/components/date_picker/auto_refresh/refresh_interval.tsx @@ -11,15 +11,18 @@ import React, { ChangeEventHandler, KeyboardEventHandler, } from 'react'; + +import { htmlIdGenerator } from '../../../services'; import { EuiI18n } from '../../i18n'; import { EuiFlexGroup, EuiFlexItem } from '../../flex'; import { EuiSelect, EuiFieldNumber, EuiFormLabel, EuiSwitch } from '../../form'; -import { htmlIdGenerator } from '../../../services'; import { EuiScreenReaderOnly } from '../../accessibility'; + import { RenderI18nTimeOptions, TimeOptions, } from '../super_date_picker/time_options'; +import { EuiQuickSelectPanel } from '../super_date_picker/quick_select_popover/quick_select_panel'; import { Milliseconds, RefreshUnitsOptions, @@ -127,7 +130,6 @@ export class EuiRefreshInterval extends Component< }; generateId = htmlIdGenerator(); - legendId = this.generateId(); refreshSelectionId = this.generateId(); onValueChange: ChangeEventHandler = (event) => { @@ -247,66 +249,84 @@ export class EuiRefreshInterval extends Component< const { value, units, min } = this.state; return ( - - {({ refreshUnitsOptions }) => ( -
- - - - - - } - /> - - - - - - - - - {this.renderScreenReaderText(refreshUnitsOptions)} -
+ + {([ + toggleLabel, + toggleAriaLabel, + valueAriaLabel, + unitsAriaLabel, + ]: string[]) => ( + + {({ refreshUnitsOptions }) => ( + + + + {toggleLabel}} + aria-label={toggleAriaLabel} + aria-labelledby={undefined} + aria-describedby={this.refreshSelectionId} + /> + + + + + + + + + {this.renderScreenReaderText(refreshUnitsOptions)} + + )} + )} -
+ ); } } diff --git a/packages/eui/src/components/date_picker/super_date_picker/__snapshots__/super_date_picker.test.tsx.snap b/packages/eui/src/components/date_picker/super_date_picker/__snapshots__/super_date_picker.test.tsx.snap index 1abdff6c019..14166d5664d 100644 --- a/packages/eui/src/components/date_picker/super_date_picker/__snapshots__/super_date_picker.test.tsx.snap +++ b/packages/eui/src/components/date_picker/super_date_picker/__snapshots__/super_date_picker.test.tsx.snap @@ -13,13 +13,13 @@ exports[`EuiSuperDatePicker props accepts data-test-subj and passes to EuiFormCo > + + +
+ - - - - - - - - - - - +
+ +
+
- - - - - +
+ +
+ + +
+
+
+
+
- - - - - +
+ +
+
+ +
- - - - - +
+ +
+ + +
+
+
+ +
- - - - - + +
+

- + Currently set to last 15 Minutes.

- + `; exports[`EuiQuickSelect prevQuickSelect 1`] = `
- - - - +
- - - - - - - - - - - - -
+
+ - - - - - - - - - - - +
+ +
+
- - - - - +
+ +
+ + +
+
+
+
+
- - - - - +
+ +
+
+ +
- - - - - +
+ +
+ + +
+
+
+ +
- - - - - + +
+

- + Currently set to Next 32 Months.

- +
`; diff --git a/packages/eui/src/components/date_picker/super_date_picker/quick_select_popover/__snapshots__/quick_select_popover.test.tsx.snap b/packages/eui/src/components/date_picker/super_date_picker/quick_select_popover/__snapshots__/quick_select_popover.test.tsx.snap index 6b094158912..3a24fd3038c 100644 --- a/packages/eui/src/components/date_picker/super_date_picker/quick_select_popover/__snapshots__/quick_select_popover.test.tsx.snap +++ b/packages/eui/src/components/date_picker/super_date_picker/quick_select_popover/__snapshots__/quick_select_popover.test.tsx.snap @@ -2,249 +2,234 @@ exports[`EuiQuickSelectPanels customQuickSelectPanels should render custom panels 1`] = `
- Quick select a time range + Quick select
-
-
-
- - - -
-
- - - -
+
-
-
-
-
- + + + +
+ class="euiFormControlLayoutCustomIcon" + > + +
-
-
- +
+ +
-
-
-
- + + + + + + + + +
+ class="euiFormControlLayoutCustomIcon" + > + +
-
-
- + + Apply + + +
+

+ Currently set to last 15 Minutes. +

-

- Currently set to last 15 Minutes. -

Commonly used
Recently used date ranges
-
    +
-
- Refresh every - +
@@ -348,7 +334,7 @@ exports[`EuiQuickSelectPanels customQuickSelectPanels should render custom panel class="euiFormControlLayout__childrenWrapper" >