@patternfly/react-core 4.214.4 → 4.214.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/esm/components/Slider/Slider.d.ts +4 -0
- package/dist/esm/components/Slider/Slider.d.ts.map +1 -1
- package/dist/esm/components/Slider/Slider.js +2 -2
- package/dist/esm/components/Slider/Slider.js.map +1 -1
- package/dist/js/components/Slider/Slider.d.ts +4 -0
- package/dist/js/components/Slider/Slider.d.ts.map +1 -1
- package/dist/js/components/Slider/Slider.js +2 -2
- package/dist/js/components/Slider/Slider.js.map +1 -1
- package/dist/umd/react-core.js +2 -2
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- package/src/components/Slider/Slider.tsx +8 -0
- package/src/components/Slider/_tests_/Slider.test.tsx +27 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.214.
|
|
3
|
+
"version": "4.214.5",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.65.
|
|
38
|
-
"@patternfly/react-styles": "^4.64.
|
|
39
|
-
"@patternfly/react-tokens": "^4.66.
|
|
37
|
+
"@patternfly/react-icons": "^4.65.5",
|
|
38
|
+
"@patternfly/react-styles": "^4.64.5",
|
|
39
|
+
"@patternfly/react-tokens": "^4.66.5",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "f5ee87ffe8b88ade3018d145fba33f0579c85c61"
|
|
64
64
|
}
|
|
@@ -61,6 +61,10 @@ export interface SliderProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onCh
|
|
|
61
61
|
leftActions?: React.ReactNode;
|
|
62
62
|
/** Actions placed to the right of the slider */
|
|
63
63
|
rightActions?: React.ReactNode;
|
|
64
|
+
/** One or more id's to use for the slider thumb description */
|
|
65
|
+
'aria-describedby'?: string;
|
|
66
|
+
/** One or more id's to use for the slider thumb label */
|
|
67
|
+
'aria-labelledby'?: string;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
const getPercentage = (current: number, max: number) => (100 * current) / max;
|
|
@@ -86,6 +90,8 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
86
90
|
max = 100,
|
|
87
91
|
showTicks = false,
|
|
88
92
|
showBoundaries = true,
|
|
93
|
+
'aria-describedby': ariaDescribedby,
|
|
94
|
+
'aria-labelledby': ariaLabelledby,
|
|
89
95
|
...props
|
|
90
96
|
}: SliderProps) => {
|
|
91
97
|
const sliderRailRef = React.useRef<HTMLDivElement>();
|
|
@@ -362,6 +368,8 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
362
368
|
aria-valuetext={findAriaTextValue()}
|
|
363
369
|
aria-label={thumbAriaLabel}
|
|
364
370
|
aria-disabled={isDisabled}
|
|
371
|
+
aria-describedby={ariaDescribedby}
|
|
372
|
+
aria-labelledby={ariaLabelledby}
|
|
365
373
|
onMouseDown={!isDisabled ? handleMouseDown : null}
|
|
366
374
|
onTouchStart={!isDisabled ? handleTouchStart : null}
|
|
367
375
|
onKeyDown={!isDisabled ? handleThumbKeys : null}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { Slider } from '../Slider';
|
|
4
4
|
import { Button } from '../../Button';
|
|
5
5
|
|
|
@@ -79,3 +79,29 @@ describe('slider', () => {
|
|
|
79
79
|
expect(asFragment()).toMatchSnapshot();
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
|
+
|
|
83
|
+
test('renders slider with aria-labelledby', () => {
|
|
84
|
+
render(
|
|
85
|
+
<>
|
|
86
|
+
<p id="test">label text</p>
|
|
87
|
+
<Slider value={50} aria-labelledby="test" />
|
|
88
|
+
</>
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const slider = screen.getByRole('slider', { name: 'label text' });
|
|
92
|
+
|
|
93
|
+
expect(slider).toBeVisible();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('renders slider with aria-describedby', () => {
|
|
97
|
+
render(
|
|
98
|
+
<>
|
|
99
|
+
<p id="test">descriptive text about the slider</p>
|
|
100
|
+
<Slider value={50} aria-describedby="test" />
|
|
101
|
+
</>
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const slider = screen.getByRole('slider', { description: 'descriptive text about the slider' });
|
|
105
|
+
|
|
106
|
+
expect(slider).toBeVisible();
|
|
107
|
+
});
|