From 33da103de5c205c95658b7e77556c5417ef96bf7 Mon Sep 17 00:00:00 2001 From: Cee Chen Date: Tue, 8 Aug 2023 11:21:06 -0700 Subject: [PATCH 1/4] [EuiDatePickerRange] Support `compressed` prop - Because `EuiSuperDatePicker` supports `compressed` behavior, `EuiDatePickerRange` needs to as well --- src/components/date_picker/date_picker_range.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/date_picker/date_picker_range.tsx b/src/components/date_picker/date_picker_range.tsx index c44ff5fd883..f246fb36905 100644 --- a/src/components/date_picker/date_picker_range.tsx +++ b/src/components/date_picker/date_picker_range.tsx @@ -35,7 +35,13 @@ import { EuiDatePickerProps } from './date_picker'; export type EuiDatePickerRangeProps = CommonProps & Pick< EuiFormControlLayoutDelimitedProps, - 'isLoading' | 'isInvalid' | 'readOnly' | 'fullWidth' | 'prepend' | 'append' + | 'isLoading' + | 'isInvalid' + | 'readOnly' + | 'fullWidth' + | 'compressed' + | 'prepend' + | 'append' > & { /** * Including any children will replace all innards with the provided children @@ -100,6 +106,7 @@ export const EuiDatePickerRange: FunctionComponent = ({ inline, shadow = true, fullWidth: _fullWidth, + compressed: _compressed, isCustom, readOnly, isLoading, @@ -111,8 +118,9 @@ export const EuiDatePickerRange: FunctionComponent = ({ prepend, ...rest }) => { - // `fullWidth` should not affect inline datepickers (matches non-range behavior) + // `fullWidth` and `compressed` should not affect inline datepickers (matches non-range behavior) const fullWidth = _fullWidth && !inline; + const compressed = _compressed && !inline; const classes = classNames('euiDatePickerRange', className); @@ -206,6 +214,7 @@ export const EuiDatePickerRange: FunctionComponent = ({ startControl={startControl} endControl={endControl} fullWidth={fullWidth} + compressed={compressed} readOnly={readOnly} isDisabled={disabled} isInvalid={isInvalid} From f566d89775db0893c8d66282f260c409737016b0 Mon Sep 17 00:00:00 2001 From: Cee Chen Date: Tue, 8 Aug 2023 11:21:14 -0700 Subject: [PATCH 2/4] Add test --- .../date_picker_range.test.tsx.snap | 73 +++++++++++++++++++ .../date_picker/date_picker_range.test.tsx | 12 +++ 2 files changed, 85 insertions(+) diff --git a/src/components/date_picker/__snapshots__/date_picker_range.test.tsx.snap b/src/components/date_picker/__snapshots__/date_picker_range.test.tsx.snap index 2b9f038c269..bf4a44442ee 100644 --- a/src/components/date_picker/__snapshots__/date_picker_range.test.tsx.snap +++ b/src/components/date_picker/__snapshots__/date_picker_range.test.tsx.snap @@ -75,6 +75,79 @@ exports[`EuiDatePickerRange is rendered 1`] = ` `; +exports[`EuiDatePickerRange props compressed 1`] = ` + +
+
+
+ + +
+
+
+
+ +
+
+
+
+ + to + +
+
+
+
+ +
+
+
+
+
+
+`; + exports[`EuiDatePickerRange props disabled 1`] = ` { expect(container.firstChild).toMatchSnapshot(); }); + test('compressed', () => { + const { container } = render( + } + endDateControl={} + compressed + /> + ); + + expect(container.firstChild).toMatchSnapshot(); + }); + test('readOnly', () => { const { container } = render( Date: Tue, 8 Aug 2023 11:21:20 -0700 Subject: [PATCH 3/4] Update docs --- src-docs/src/views/date_picker/range.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-docs/src/views/date_picker/range.tsx b/src-docs/src/views/date_picker/range.tsx index 87d1576bfd5..ea2a6957b07 100644 --- a/src-docs/src/views/date_picker/range.tsx +++ b/src-docs/src/views/date_picker/range.tsx @@ -10,7 +10,7 @@ export default () => { return ( /* DisplayToggles wrapper for Docs only */ - + Date: Tue, 8 Aug 2023 11:28:09 -0700 Subject: [PATCH 4/4] changelog --- upcoming_changelogs/7058.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 upcoming_changelogs/7058.md diff --git a/upcoming_changelogs/7058.md b/upcoming_changelogs/7058.md new file mode 100644 index 00000000000..e1e398b2e97 --- /dev/null +++ b/upcoming_changelogs/7058.md @@ -0,0 +1,5 @@ +- Updated `EuiDatePickerRange` to support `compressed` display + +**Bug fixes** + +- Fixed `EuiSuperDatePicker`'s `compressed` display