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

[EuiSuperDatePicker] Fix broken EuiDatePickerRange styling; Add isDisabled object config #6821

Merged
merged 6 commits into from
May 31, 2023

Conversation

cee-chen
Copy link
Contributor

@cee-chen cee-chen commented May 31, 2023

Summary

This PR accomplishes two separate tasks:

  1. (first two commits) I added an extra opinionated <span> to EuiDatePickerRange in fa7bc44, totally forgetting that EuiSuperDatePicker dogfoods EuiDatePickerRange, and consequently broke range styling on our latest release.
    before/after screenshot

    • This PR fixes that and additionally cleans up the DOM around EuiSuperDatePicker by removing .euiSuperDatePicker__flexWrapper (and flex children wrappers), and instead placing the .euiSuperDatePicker CSS class directly on the topmost wrapper:
      screenshot of HTML
  2. (next two commits) closes [SuperDatePicker] Add a disabled state default text #6814

    • This PR adds a new isDisabled={{ display }} object configuration which allows consumers to customized the displayed disabled text (e.g., if they want to render text saying that no times are currently being filtered).
screenshot

QA

General checklist

  • Revert [REVERT ME] commit
  • Checked in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs (using @default if default values are missing) and playground toggles
  • Added or updated jest and cypress tests
  • A changelog entry exists and is marked appropriately

- [ ] Checked for breaking changes and labeled appropriately DOM/CSS changes are semi-breaking, but not part of the promised API, and I'll update various Kibana references accordingly
- [ ] Added documentation I'm skipping adding a new/specific documentation section for this behavior. TBH, I consider it kinda edge case and for a very specific Kibana usage, and I'd rather document/QA it only in Storybook rather than encourage usage.

cee-chen added 5 commits May 30, 2023 17:02
- fixes CSS that was broken by adding a `<span>` EuiDateRangePicker wrapper

- removes need for `.euiSuperDatePicker__flexWrapper` by simply adding 2 flex CSS properties, and setting `flex-grow: 1` on the date picker range

- convert various modifier classes to flatter Sass
- switch to RTL `render` instead of shallow/dive

- add a test to render the underlying `EuiDatePickerRange` component
@cee-chen cee-chen force-pushed the superdatepicker/disabled-text branch from 573140a to 153bdcd Compare May 31, 2023 01:12
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6821/

@tkajtoch tkajtoch self-requested a review May 31, 2023 12:19
@@ -195,77 +202,106 @@ describe('EuiSuperDatePicker', () => {

describe('showUpdateButton', () => {
test('can be false', () => {
const component = shallowAndDive(
const { container } = render(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Copy link
Member

@tkajtoch tkajtoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good; I tested the changes on the PR env and confirm they're working as intended.
Thanks for migrating some of the tests to RTL! 🎉

@cee-chen
Copy link
Contributor Author

Thanks Tomasz! 🎉

@cee-chen cee-chen enabled auto-merge (squash) May 31, 2023 16:06
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6821/

@cee-chen cee-chen merged commit 6fe86bc into elastic:main May 31, 2023
@cee-chen cee-chen deleted the superdatepicker/disabled-text branch May 31, 2023 16:30
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6821/

cee-chen added a commit to elastic/kibana that referenced this pull request Jun 5, 2023
## Summary

`eui@81.0.0` ⏩ `eui@81.2.0`

- Most changes to source code in this PR are CSS cleanups/deprecations
in `EuiSuperDatePicker`/`EuiDatePickerRange`
- One team (ML) had a `inline` specific usage of `EuiDatePickerRange`
that they reached out to us about via Slack, and that we have fixed in
this PR.
- All other usages of date picker components should have remained
working as-is with no changes, but please ping us if you see otherwise!

___

## [`81.2.0`](https://github.com/elastic/eui/tree/v81.2.0)

- Updated `EuiSuperDatePicker` to accept an object configuration for
`isDisabled` ([#6821](elastic/eui#6821))

**Bug fixes**

- Fixed broken `EuiSuperDatePicker` styles
([#6821](elastic/eui#6821))

## [`81.1.0`](https://github.com/elastic/eui/tree/v81.1.0)

- Added `EuiInlineEditText` and `EuiInlineEditTitle` components
([#6757](elastic/eui#6757))
- Updated `EuiDatePickerRange` to support `inline` display
([#6795](elastic/eui#6795))
- Added an `onError` callback prop to `EuiErrorBoundary`
([#6810](elastic/eui#6810))
- Updated `EuiDataGrid` to only render screen reader text announcing
cell position if the cell is currently focused. This should improve the
ability to copy and paste multiple cells without SR text.
([#6817](elastic/eui#6817))

**Bug fixes**

- Fixed `EuiDatePicker`'s `inline` display to correctly render and
prevent user interaction when `disabled` or `readOnly`
([#6795](elastic/eui#6795))
- Fixed `EuiDatePicker`'s `inline` display to correctly render
`isInvalid` and `isLoading` icons
([#6795](elastic/eui#6795))

**CSS-in-JS conversions**

- Converted `EuiDatePickerRange` to Emotion
([#6795](elastic/eui#6795))

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SuperDatePicker] Add a disabled state default text
3 participants