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

Helping with dual range input props #2

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added possibility to set `aria-label` for both `min` and `max` inputs of `EuiDualRange` ([#2738](https://github.com/elastic/eui/pull/2738))
- Added `minInputProps` and `maxInputProps` to supply more props to the inputs of `EuiDualRange` ([#2738](https://github.com/elastic/eui/pull/2738))
Copy link
Author

Choose a reason for hiding this comment

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

Just made this more generic since it's no longer just about aria-label

- Fixed bug in `EuiCard` where button text was not properly aligned ([#2741](https://github.com/elastic/eui/pull/2741))
- Converted `EuiRange` to TypeScript ([#2732](https://github.com/elastic/eui/pull/2732))
- Converted `EuiDualRange` to TypeScript ([#2732](https://github.com/elastic/eui/pull/2732))
Expand Down
370 changes: 74 additions & 296 deletions src/components/form/range/__snapshots__/dual_range.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,80 @@ exports[`EuiDualRange allows value prop to accept numbers 1`] = `
</div>
`;

exports[`EuiDualRange input props can be applied to min and max inputs 1`] = `
<div
class="euiRangeWrapper euiDualRange"
>
<div
class="euiFormControlLayout"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<input
aria-label="Min value"
class="euiFieldNumber euiRangeInput euiRangeInput--min"
max="8"
min="1"
name="name-minValue"
step="1"
style="width:3.6em"
type="number"
value="1"
/>
</div>
</div>
<div
class="euiRange__horizontalSpacer"
/>
<div
class="euiRangeTrack"
>
<div
class="euiRangeHighlight"
>
<div
class="euiRangeHighlight__progress"
style="margin-left:0%;width:77.77777777777779%"
/>
</div>
<input
aria-hidden="true"
class="euiRangeSlider euiRangeSlider--hasRange euiDualRange__slider"
id="id"
max="10"
min="1"
name="name"
step="1"
tabindex="-1"
type="range"
/>
</div>
<div
class="euiRange__horizontalSpacer"
/>
<div
class="euiFormControlLayout"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<input
aria-label="Max value"
class="euiFieldNumber euiRangeInput euiRangeInput--max"
max="10"
min="1"
name="name-maxValue"
step="1"
style="width:3.6em"
type="number"
value="8"
/>
</div>
</div>
</div>
`;

exports[`EuiDualRange is rendered 1`] = `
<div
class="euiRangeWrapper euiDualRange testClass1 testClass2"
Expand Down Expand Up @@ -613,299 +687,3 @@ exports[`EuiDualRange props ticks should render 1`] = `
/>
</div>
`;

exports[`EuiDualRange aria labels should be set for both min and max inputs 1`] = `
<div
class="euiRangeWrapper euiDualRange"
>
<div
class="euiFormControlLayout"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<input
aria-label="Min value"
class="euiFieldNumber euiRangeInput euiRangeInput--min"
max="8"
min="1"
name="name-minValue"
step="1"
style="width:3.6em"
type="number"
value="1"
/>
</div>
</div>
<div
class="euiRange__horizontalSpacer"
/>
<div
class="euiRangeTrack"
>
<div
class="euiRangeHighlight"
>
<div
class="euiRangeHighlight__progress"
style="margin-left:0%;width:77.77777777777779%"
/>
</div>
<input
aria-hidden="true"
class="euiRangeSlider euiRangeSlider--hasRange euiDualRange__slider"
id="id"
max="10"
min="1"
name="name"
step="1"
tabindex="-1"
type="range"
/>
</div>
<div
class="euiRange__horizontalSpacer"
/>
<div
class="euiFormControlLayout"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<input
aria-label="Max value"
class="euiFieldNumber euiRangeInput euiRangeInput--max"
max="10"
min="1"
name="name-maxValue"
step="1"
style="width:3.6em"
type="number"
value="8"
/>
</div>
</div>
</div>
`;

exports[`EuiDualRange aria labels should be set only for the min input 1`] = `
<div
class="euiRangeWrapper euiDualRange"
>
<div
class="euiFormControlLayout"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<input
aria-label="Min value"
class="euiFieldNumber euiRangeInput euiRangeInput--min"
max="8"
min="1"
name="name-minValue"
step="1"
style="width:3.6em"
type="number"
value="1"
/>
</div>
</div>
<div
class="euiRange__horizontalSpacer"
/>
<div
class="euiRangeTrack"
>
<div
class="euiRangeHighlight"
>
<div
class="euiRangeHighlight__progress"
style="margin-left:0%;width:77.77777777777779%"
/>
</div>
<input
aria-hidden="true"
class="euiRangeSlider euiRangeSlider--hasRange euiDualRange__slider"
id="id"
max="10"
min="1"
name="name"
step="1"
tabindex="-1"
type="range"
/>
</div>
<div
class="euiRange__horizontalSpacer"
/>
<div
class="euiFormControlLayout"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<input
class="euiFieldNumber euiRangeInput euiRangeInput--max"
max="10"
min="1"
name="name-maxValue"
step="1"
style="width:3.6em"
type="number"
value="8"
/>
</div>
</div>
</div>
`;

exports[`EuiDualRange aria labels should be set only for the max input 1`] = `
<div
class="euiRangeWrapper euiDualRange"
>
<div
class="euiFormControlLayout"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<input
class="euiFieldNumber euiRangeInput euiRangeInput--min"
max="8"
min="1"
name="name-minValue"
step="1"
style="width:3.6em"
type="number"
value="1"
/>
</div>
</div>
<div
class="euiRange__horizontalSpacer"
/>
<div
class="euiRangeTrack"
>
<div
class="euiRangeHighlight"
>
<div
class="euiRangeHighlight__progress"
style="margin-left:0%;width:77.77777777777779%"
/>
</div>
<input
aria-hidden="true"
class="euiRangeSlider euiRangeSlider--hasRange euiDualRange__slider"
id="id"
max="10"
min="1"
name="name"
step="1"
tabindex="-1"
type="range"
/>
</div>
<div
class="euiRange__horizontalSpacer"
/>
<div
class="euiFormControlLayout"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<input
aria-label="Max value"
class="euiFieldNumber euiRangeInput euiRangeInput--max"
max="10"
min="1"
name="name-maxValue"
step="1"
style="width:3.6em"
type="number"
value="8"
/>
</div>
</div>
</div>
`;

exports[`EuiDualRange aria labels defined for the whole component should be set only for both min and max input 1`] = `
<div
class="euiRangeWrapper euiDualRange"
>
<div
class="euiFormControlLayout"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<input
aria-label="aria-label"
class="euiFieldNumber euiRangeInput euiRangeInput--min"
max="8"
min="1"
name="name-minValue"
step="1"
style="width:3.6em"
type="number"
value="1"
/>
</div>
</div>
<div
class="euiRange__horizontalSpacer"
/>
<div
class="euiRangeTrack"
>
<div
class="euiRangeHighlight"
>
<div
class="euiRangeHighlight__progress"
style="margin-left:0%;width:77.77777777777779%"
/>
</div>
<input
aria-hidden="true"
aria-label="aria-label"
class="euiRangeSlider euiRangeSlider--hasRange euiDualRange__slider"
id="id"
max="10"
min="1"
name="name"
step="1"
tabindex="-1"
type="range"
/>
</div>
<div
class="euiRange__horizontalSpacer"
/>
<div
class="euiFormControlLayout"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<input
aria-label="aria-label"
class="euiFieldNumber euiRangeInput euiRangeInput--max"
max="10"
min="1"
name="name-maxValue"
step="1"
style="width:3.6em"
type="number"
value="8"
/>
</div>
</div>
</div>
`;

Loading