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

[Feature Branch] Add support for EuiRange in a dropdown with input #2179

Conversation

cchaos
Copy link
Contributor

@cchaos cchaos commented Jul 29, 2019

feature/compressed-editor-controls

Adds another option to the showInput prop for EuiRange and EuiDualRange

If you now pass showInput="only", then only the input will show like a normal form control but focusing on the form control will open a dropdown that contains the range slider. This will help compressed forms use the space better without the need for the slider to be inline.

Screen Shot 2019-08-14 at 16 39 22 PM

Other additions in this PR to get the above working

1. Fixes heights for compressed ranges
Before, the height would stay at 40px, now it compresses down.

2. Fixed z-indexing of range innards
By removing them altogether and relying on DOM order.

3. Added controlOnly prop to EuiFieldNumber
I'm tired of fighting with nested EuiFormControlLayout components. This was super easy to do and quickly got me to the state I needed without nested overrides.

4. Some fixes to EuiFormControLayoutDelimeter
For disabled state.

Checklist

  • Checked in dark mode
  • Checked in mobile
  • Checked in IE11 and Firefox
  • Props have proper autodocs
  • Added documentation examples
  • Added or updated jest tests
  • [ ] Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • [ ] A changelog entry exists and is marked appropriately Will make one in Feature PR

@cchaos
Copy link
Contributor Author

cchaos commented Jul 29, 2019

@thompsongl Could I get your help with this one?

I had brought up the idea of creating a service for the pattern of form inputs using custom popovers (to look like dropdowns not popovers). This is one of those use cases. Could we either go ahead and create that service (not that any other component needs to be updated to use it just yet) or could you help me fix the usage here to coincide with the others?

@thompsongl
Copy link
Contributor

@cchaos Yep, I can take a real look at it. I'd like to create the service now if the use cases are starting to arrive, but we'll see what's realistic.

@thompsongl
Copy link
Contributor

@cchaos I have a Draft PR (cchaos#20) that you can take a look at. Still working on the correct way to do focus management, but it'll give you a good feel for direction now.

@cchaos cchaos force-pushed the feature/compressed-editor-controls branch from 62dc3aa to 689d79b Compare August 13, 2019 13:30
@cchaos cchaos force-pushed the into-feature/range-dropdowns branch from 1ee7727 to 9895abf Compare August 13, 2019 13:47
@cchaos cchaos marked this pull request as ready for review August 14, 2019 20:49
@cchaos
Copy link
Contributor Author

cchaos commented Aug 14, 2019

This PR is now ready for review, though I do still have to go through the full checklist. Just figured I'd give ya'll a head start.

@thompsongl I do need your help working on EuiInputPopover and the focus state handling and readOnly state. I'll get with you next week on that.

Copy link
Contributor

@ryankeairns ryankeairns left a comment

Choose a reason for hiding this comment

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

👍 Looks and works as expected. The red/green level indicators are less clear without any associated text. Perhaps it's just a simple docs addition to place the Recommended size is 20kb and above. help text below the input as has been done in other examples.

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

The only other point of feedback is that you could add onFocus handlers to the inputs to have them open the popover. As I mentioned in cchaos#20 (comment), though, I don't think it's necessary for this particular use of EuiInputPopover.

src/components/form/range/_range.scss Outdated Show resolved Hide resolved
src/components/form/range/_range_tooltip.scss Outdated Show resolved Hide resolved
* Updated form control border color

* Slighly more transparent

* change sass var name to $euiFormBorderOpaqueColor
…ic#2117)

As a layout helper component to create date and number ranges

* Added Sass var for `$euiFormControlLayoutGroupInputHeight` and compressed version
- Added truncation example
- Added max-height
* Updated compressed visual style in mixin
* Compressed updates to from control groups
* Fix compressed state overrides
* Reduce horizontal padding for compressed
* Icons and button icons in input groups
* Added a compressed option for from` euiFormControlLayoutPadding`
* Added compressed padding for inputs with icons
* Fix readonly & compressed input groups
* Fix group heights
* Update file picker with new compressed styles
* Fix delimited compressed and fullwidth styles
* Fixed EuiComboBox
* Added reduced padding for EuiColorPicker
* Fixed date pickers
* Variables for border-radius
* Removed padding from compressed form row
* Create mixin for `euiTextBreakWord`
* Added option for horizontal compressed style

Breaking: `compressed` is no longer passed to children

* [Docs] Final compressed doc example changes
* Fix combobox height
* Fixed usages where spacers were needed
* Deprecated `displayOnly` for `display: center`
@cchaos cchaos force-pushed the feature/compressed-editor-controls branch from 689d79b to f917029 Compare August 29, 2019 16:02
cchaos added 11 commits August 29, 2019 12:03
Decrease overall height of the range when compressed

# Conflicts:
#	src/components/form/range/range_highlight.tsx
#	src/components/form/range/range_levels.tsx
#	src/components/form/range/range_slider.tsx
#	src/components/form/range/range_ticks.tsx
#	src/components/form/range/range_tooltip.tsx
#	src/components/form/range/range_track.tsx
#	src/components/form/range/range_wrapper.js
- Attempt at single range compressed input with popover
- Fixes z-indexes being too high
Dual range now supports dropdown style
- Needed some fixes to EuiFormControlLayoutDelimited
Can’t use mixin, too many overrides/differences
@cchaos
Copy link
Contributor Author

cchaos commented Sep 4, 2019

@thompsongl I'm good with that approach. It really is mainly just for quick slides at that point and sliders aren't good for accessibility when trying to get to a specific value.

@thompsongl
Copy link
Contributor

I'll open a PR to this branch and let you try it out.

@thompsongl
Copy link
Contributor

Keyboard management: cchaos#25

Still trying to figure out how to get the dual range thumbs to be correctly positioned on initial render

@snide snide mentioned this pull request Sep 5, 2019
13 tasks
@thompsongl
Copy link
Contributor

cchaos#26 will get the dual range thumbs correctly positioned. See what you think.

@cchaos
Copy link
Contributor Author

cchaos commented Sep 5, 2019

@thompsongl Can you actually checkout Firefox? I keep running into this long running script issue
Screen Shot 2019-09-05 at 13 28 34 PM

@thompsongl
Copy link
Contributor

Ugh I forgot ResizeObserver uses a fallback in Firefox that won't work for this case. I'll have to find another solution.

@thompsongl
Copy link
Contributor

cchaos#27 removes EuiResizeObserver in favor of using a callback that plugs into the originating change event.

@cchaos cchaos mentioned this pull request Sep 6, 2019
7 tasks
Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Small stuff. Approved on changes. Nice work.

src/components/form/range/dual_range.js Outdated Show resolved Hide resolved
src/components/form/range/_index.scss Outdated Show resolved Hide resolved
src/components/form/range/_range_highlight.scss Outdated Show resolved Hide resolved
@cchaos
Copy link
Contributor Author

cchaos commented Sep 9, 2019

Ok, all the focus stuff should be fixed across browsers now and PR comments addressed. @thompsongl can you do a final review?

@cchaos cchaos merged commit 7f88db7 into elastic:feature/compressed-editor-controls Sep 9, 2019
cchaos added a commit that referenced this pull request Sep 9, 2019
…2179)

* Compressed EuiRange step 1: Decrease overall height of the range when compressed
* Compressed EuiRange step 2:
- Attempt at single range compressed input with popover
- Fixes z-indexes being too high
- Fix up widths
* Compressed EuiRange step 3: Dual range now supports dropdown style
* Fix for delimited
* Fix full-width delimited
* Added `controlOnly` prop to EuiFieldNumber
* Finalize styles of input only ranges
- Needed some fixes to EuiFormControlLayoutDelimited
* Open popover on focus
* dual range respond to resize events when in showInputOnly mode
* use callback instead of resizeObserver
* ie11 focus fix
* use focusout instead of blur
thompsongl pushed a commit to thompsongl/eui that referenced this pull request Sep 10, 2019
…lastic#2179)

* Compressed EuiRange step 1: Decrease overall height of the range when compressed
* Compressed EuiRange step 2:
- Attempt at single range compressed input with popover
- Fixes z-indexes being too high
- Fix up widths
* Compressed EuiRange step 3: Dual range now supports dropdown style
* Fix for delimited
* Fix full-width delimited
* Added `controlOnly` prop to EuiFieldNumber
* Finalize styles of input only ranges
- Needed some fixes to EuiFormControlLayoutDelimited
* Open popover on focus
* dual range respond to resize events when in showInputOnly mode
* use callback instead of resizeObserver
* ie11 focus fix
* use focusout instead of blur
cchaos added a commit that referenced this pull request Sep 11, 2019
* [Feature branch] Updated form control border color (#2114)

* Updated form control border color

* Slighly more transparent

* change sass var name to $euiFormBorderOpaqueColor

* [Feature branch]  Added EuiFormControlLayoutDelimited component (#2117)

As a layout helper component to create date and number ranges

* Added Sass var for `$euiFormControlLayoutGroupInputHeight` and compressed version

* [Feature branch] Compressed EuiSuperSelect dropdown (#2155)

- Added truncation example
- Added max-height

* [Feature Branch] Update compressed form control styles (#2174)

* Updated compressed visual style in mixin
* Compressed updates to from control groups
* Fix compressed state overrides
* Reduce horizontal padding for compressed
* Icons and button icons in input groups
* Added a compressed option for from` euiFormControlLayoutPadding`
* Added compressed padding for inputs with icons
* Fix readonly & compressed input groups
* Fix group heights
* Update file picker with new compressed styles
* Fix delimited compressed and fullwidth styles
* Fixed EuiComboBox
* Added reduced padding for EuiColorPicker
* Fixed date pickers
* Variables for border-radius

* [Feature branch] Compressed form rows (#2181)

* Removed padding from compressed form row
* Create mixin for `euiTextBreakWord`
* Added option for horizontal compressed style

Breaking: `compressed` is no longer passed to children

* [Docs] Final compressed doc example changes
* Fix combobox height
* Fixed usages where spacers were needed
* Deprecated `displayOnly` for `display: center`

* Fix snap

* Into feature/compressed editor docs (#2295)

* Adding a shared component for the different states of each form control
* New docs section for compressed
* Added `columnCompressedSwitch` to display type of EuiFormRow for better alignment of switch style controls
* Account for tooltips as pre/appends
* Allow passing a string as the pre/appends and it automatically wraps it in a form label
* Made all EuiSuperDatePicker form controls compressed (in popover)
* Connection prepend/appends with input via `htmlFor`
* Allowing passing of `style` to EuiColorPickerSwatch
* Allow an array of strings a pre/append

* [Feature Branch] Add support for EuiRange in a dropdown with input (#2179)

* Compressed EuiRange step 1: Decrease overall height of the range when compressed
* Compressed EuiRange step 2:
- Attempt at single range compressed input with popover
- Fixes z-indexes being too high
- Fix up widths
* Compressed EuiRange step 3: Dual range now supports dropdown style
* Fix for delimited
* Fix full-width delimited
* Added `controlOnly` prop to EuiFieldNumber
* Finalize styles of input only ranges
- Needed some fixes to EuiFormControlLayoutDelimited
* Open popover on focus
* dual range respond to resize events when in showInputOnly mode
* use callback instead of resizeObserver
* ie11 focus fix
* use focusout instead of blur

* Added some display toggles for ranges and ranges with dropdowns to the complex example

Has issues

* Fix console errors

* Some fixes

- Ranges use div spacers between slider and input instead of margin
- Pre/Appends are restrictred to 50% width and truncated

* [feature/compressed-editor-controls] EuiRange + EuiFormRow (#2321)

* focus management

* add euiformrow to some examples

* use prevention flag

* Add `controlOnly` prop to EuiFieldText

* Update TS defs

* Some docs fixes

* Fix inherit screen reader ability of EuiRange

By moving the id to the input if it exists

* Add dual range to complex example
@cchaos cchaos deleted the into-feature/range-dropdowns branch October 22, 2019 20:02
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.

4 participants