@patternfly/react-core 5.1.1-prerelease.16 → 5.1.1-prerelease.17
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 +6 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/Chip/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/DragDrop/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/Text/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/Tile/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/ApplicationLauncher/package.json +1 -1
- package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Dropdown/package.json +1 -1
- package/dist/dynamic/deprecated/components/OptionsMenu/package.json +1 -1
- package/dist/dynamic/deprecated/components/PageHeader/package.json +1 -1
- package/dist/dynamic/deprecated/components/Select/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
- package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
- package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
- package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
- package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
- package/dist/dynamic/helpers/constants/package.json +1 -1
- package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
- package/dist/dynamic/helpers/favorites/package.json +1 -1
- package/dist/dynamic/helpers/fileUtils/package.json +1 -1
- package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
- package/dist/dynamic/helpers/package.json +1 -1
- package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
- package/dist/dynamic/helpers/typeUtils/package.json +1 -1
- package/dist/dynamic/helpers/useInterval/package.json +1 -1
- package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/next/components/package.json +1 -1
- package/dist/esm/components/Slider/Slider.d.ts +8 -4
- package/dist/esm/components/Slider/Slider.d.ts.map +1 -1
- package/dist/esm/components/Slider/Slider.js +62 -16
- package/dist/esm/components/Slider/Slider.js.map +1 -1
- package/dist/js/components/Slider/Slider.d.ts +8 -4
- package/dist/js/components/Slider/Slider.d.ts.map +1 -1
- package/dist/js/components/Slider/Slider.js +62 -16
- package/dist/js/components/Slider/Slider.js.map +1 -1
- package/dist/umd/react-core.min.js +2 -2
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +2 -2
- package/src/components/Slider/Slider.tsx +69 -20
- package/src/components/Slider/_tests_/Slider.test.tsx +3 -3
- package/src/components/Slider/examples/SliderActions.tsx +3 -3
- package/src/components/Tabs/examples/Tabs.md +1 -3
- package/src/components/Toolbar/examples/Toolbar.md +0 -6
- package/src/components/Toolbar/examples/Test.tsx +0 -258
package/helpers/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"5.1.1-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"5.1.1-prerelease.16","private":true}
|
package/layouts/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"5.1.1-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"5.1.1-prerelease.16","private":true}
|
package/next/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"5.1.1-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"5.1.1-prerelease.16","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "5.1.1-prerelease.
|
|
3
|
+
"version": "5.1.1-prerelease.17",
|
|
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",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react": "^17 || ^18",
|
|
71
71
|
"react-dom": "^17 || ^18"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "026096f9f505bb31b24bb25b551ec81a743ef1fa"
|
|
74
74
|
}
|
|
@@ -46,16 +46,18 @@ export interface SliderProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onCh
|
|
|
46
46
|
inputAriaLabel?: string;
|
|
47
47
|
/** Text label that is place after the input field. */
|
|
48
48
|
inputLabel?: string | number;
|
|
49
|
-
/** Position of the input. */
|
|
50
|
-
inputPosition?: 'aboveThumb' | 'right';
|
|
49
|
+
/** Position of the input. Note "right" is deprecated. Use "end" instead*/
|
|
50
|
+
inputPosition?: 'aboveThumb' | 'right' | 'end';
|
|
51
51
|
/** Value displayed in the input field. */
|
|
52
52
|
inputValue?: number;
|
|
53
53
|
/** Adds disabled styling, and disables the slider and the input component if present. */
|
|
54
54
|
isDisabled?: boolean;
|
|
55
55
|
/** Flag to show value input field. */
|
|
56
56
|
isInputVisible?: boolean;
|
|
57
|
-
/** Actions placed
|
|
57
|
+
/** @deprecated Use startActions instead. Actions placed at the start of the slider. */
|
|
58
58
|
leftActions?: React.ReactNode;
|
|
59
|
+
/** Actions placed at the start of the slider. */
|
|
60
|
+
startActions?: React.ReactNode;
|
|
59
61
|
/** The maximum permitted value. */
|
|
60
62
|
max?: number;
|
|
61
63
|
/** The minimum permitted value. */
|
|
@@ -67,8 +69,10 @@ export interface SliderProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onCh
|
|
|
67
69
|
inputValue?: number,
|
|
68
70
|
setLocalInputValue?: React.Dispatch<React.SetStateAction<number>>
|
|
69
71
|
) => void;
|
|
70
|
-
/** Actions placed to the right of the slider. */
|
|
72
|
+
/** @deprecated Use endActions instead. Actions placed to the right of the slider. */
|
|
71
73
|
rightActions?: React.ReactNode;
|
|
74
|
+
/** Actions placed at the end of the slider. */
|
|
75
|
+
endActions?: React.ReactNode;
|
|
72
76
|
/** Flag to indicate if boundaries should be shown for slider that does not have custom steps. */
|
|
73
77
|
showBoundaries?: boolean;
|
|
74
78
|
/** Flag to indicate if ticks should be shown for slider that does not have custom steps. */
|
|
@@ -95,10 +99,12 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
95
99
|
inputAriaLabel = 'Slider value input',
|
|
96
100
|
thumbAriaLabel = 'Value',
|
|
97
101
|
hasTooltipOverThumb = false,
|
|
98
|
-
inputPosition = '
|
|
102
|
+
inputPosition = 'end',
|
|
99
103
|
onChange,
|
|
100
104
|
leftActions,
|
|
105
|
+
startActions,
|
|
101
106
|
rightActions,
|
|
107
|
+
endActions,
|
|
102
108
|
step = 1,
|
|
103
109
|
min = 0,
|
|
104
110
|
max = 100,
|
|
@@ -114,6 +120,12 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
114
120
|
const [localValue, setValue] = useState(value);
|
|
115
121
|
const [localInputValue, setLocalInputValue] = useState(inputValue);
|
|
116
122
|
|
|
123
|
+
let isRTL: boolean;
|
|
124
|
+
|
|
125
|
+
React.useEffect(() => {
|
|
126
|
+
isRTL = window.getComputedStyle(sliderRailRef.current).getPropertyValue('direction') === 'rtl';
|
|
127
|
+
});
|
|
128
|
+
|
|
117
129
|
React.useEffect(() => {
|
|
118
130
|
setValue(value);
|
|
119
131
|
}, [value]);
|
|
@@ -182,7 +194,11 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
182
194
|
e.stopPropagation();
|
|
183
195
|
e.preventDefault();
|
|
184
196
|
|
|
185
|
-
|
|
197
|
+
if (isRTL) {
|
|
198
|
+
diff = thumbRef.current.getBoundingClientRect().right - e.clientX;
|
|
199
|
+
} else {
|
|
200
|
+
diff = e.clientX - thumbRef.current.getBoundingClientRect().left;
|
|
201
|
+
}
|
|
186
202
|
|
|
187
203
|
document.addEventListener('mousemove', callbackThumbMove);
|
|
188
204
|
document.addEventListener('mouseup', callbackThumbUp);
|
|
@@ -191,7 +207,11 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
191
207
|
const handleTouchStart = (e: React.TouchEvent) => {
|
|
192
208
|
e.stopPropagation();
|
|
193
209
|
|
|
194
|
-
|
|
210
|
+
if (isRTL) {
|
|
211
|
+
diff = thumbRef.current.getBoundingClientRect().right - e.touches[0].clientX;
|
|
212
|
+
} else {
|
|
213
|
+
diff = e.touches[0].clientX - thumbRef.current.getBoundingClientRect().left;
|
|
214
|
+
}
|
|
195
215
|
|
|
196
216
|
document.addEventListener('touchmove', callbackThumbMove, { passive: false });
|
|
197
217
|
document.addEventListener('touchend', callbackThumbUp);
|
|
@@ -216,8 +236,13 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
216
236
|
}
|
|
217
237
|
|
|
218
238
|
const clientPosition = e.touches && e.touches.length ? e.touches[0].clientX : e.clientX;
|
|
239
|
+
let newPosition;
|
|
219
240
|
|
|
220
|
-
|
|
241
|
+
if (isRTL) {
|
|
242
|
+
newPosition = sliderRailRef.current.getBoundingClientRect().right - clientPosition - diff;
|
|
243
|
+
} else {
|
|
244
|
+
newPosition = clientPosition - diff - sliderRailRef.current.getBoundingClientRect().left;
|
|
245
|
+
}
|
|
221
246
|
|
|
222
247
|
const end = sliderRailRef.current.offsetWidth - thumbRef.current.offsetWidth;
|
|
223
248
|
|
|
@@ -288,21 +313,43 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
288
313
|
if (!areCustomStepsContinuous && customSteps) {
|
|
289
314
|
const stepIndex = customSteps.findIndex((stepObj) => stepObj.value === localValue);
|
|
290
315
|
if (key === 'ArrowRight') {
|
|
291
|
-
if (
|
|
292
|
-
{
|
|
293
|
-
newValue = customSteps[stepIndex
|
|
316
|
+
if (isRTL) {
|
|
317
|
+
if (stepIndex - 1 >= 0) {
|
|
318
|
+
newValue = customSteps[stepIndex - 1].value;
|
|
319
|
+
}
|
|
320
|
+
} else {
|
|
321
|
+
if (stepIndex + 1 < customSteps.length) {
|
|
322
|
+
{
|
|
323
|
+
newValue = customSteps[stepIndex + 1].value;
|
|
324
|
+
}
|
|
294
325
|
}
|
|
295
326
|
}
|
|
296
327
|
} else if (key === 'ArrowLeft') {
|
|
297
|
-
if (
|
|
298
|
-
|
|
328
|
+
if (isRTL) {
|
|
329
|
+
if (stepIndex + 1 < customSteps.length) {
|
|
330
|
+
{
|
|
331
|
+
newValue = customSteps[stepIndex + 1].value;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
} else {
|
|
335
|
+
if (stepIndex - 1 >= 0) {
|
|
336
|
+
newValue = customSteps[stepIndex - 1].value;
|
|
337
|
+
}
|
|
299
338
|
}
|
|
300
339
|
}
|
|
301
340
|
} else {
|
|
302
341
|
if (key === 'ArrowRight') {
|
|
303
|
-
|
|
342
|
+
if (isRTL) {
|
|
343
|
+
newValue = localValue - step >= min ? localValue - step : min;
|
|
344
|
+
} else {
|
|
345
|
+
newValue = localValue + step <= max ? localValue + step : max;
|
|
346
|
+
}
|
|
304
347
|
} else if (key === 'ArrowLeft') {
|
|
305
|
-
|
|
348
|
+
if (isRTL) {
|
|
349
|
+
newValue = localValue + step <= max ? localValue + step : max;
|
|
350
|
+
} else {
|
|
351
|
+
newValue = localValue - step >= min ? localValue - step : min;
|
|
352
|
+
}
|
|
306
353
|
}
|
|
307
354
|
}
|
|
308
355
|
|
|
@@ -347,8 +394,8 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
347
394
|
for (let i = min; i <= max; i = i + step) {
|
|
348
395
|
const stepValue = getStepValue(i, min, max);
|
|
349
396
|
|
|
350
|
-
// If
|
|
351
|
-
// so that we don't
|
|
397
|
+
// If boundaries but not ticks just generate the needed steps
|
|
398
|
+
// so that we don't pollute them DOM with empty divs
|
|
352
399
|
if (!showTicks && showBoundaries && i !== min && i !== max) {
|
|
353
400
|
continue;
|
|
354
401
|
}
|
|
@@ -394,7 +441,7 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
394
441
|
style={{ ...style, ...inputStyle }}
|
|
395
442
|
{...props}
|
|
396
443
|
>
|
|
397
|
-
{leftActions && <div className={css(styles.sliderActions)}>{leftActions}</div>}
|
|
444
|
+
{(leftActions || startActions) && <div className={css(styles.sliderActions)}>{leftActions || startActions}</div>}
|
|
398
445
|
<div className={css(styles.sliderMain)}>
|
|
399
446
|
<div className={css(styles.sliderRail)} ref={sliderRailRef} onClick={!isDisabled ? onSliderRailClick : null}>
|
|
400
447
|
<div className={css(styles.sliderRailTrack)} />
|
|
@@ -434,8 +481,10 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
434
481
|
<div className={css(styles.sliderValue, styles.modifiers.floating)}>{displayInput()}</div>
|
|
435
482
|
)}
|
|
436
483
|
</div>
|
|
437
|
-
{isInputVisible && inputPosition === 'right'
|
|
438
|
-
|
|
484
|
+
{isInputVisible && (inputPosition === 'right' || inputPosition === 'end') && (
|
|
485
|
+
<div className={css(styles.sliderValue)}>{displayInput()}</div>
|
|
486
|
+
)}
|
|
487
|
+
{(rightActions || endActions) && <div className={css(styles.sliderActions)}>{rightActions || endActions}</div>}
|
|
439
488
|
</div>
|
|
440
489
|
);
|
|
441
490
|
};
|
|
@@ -46,7 +46,7 @@ describe('slider', () => {
|
|
|
46
46
|
|
|
47
47
|
test('renders slider with input', () => {
|
|
48
48
|
const { asFragment } = render(
|
|
49
|
-
<Slider value={50} isInputVisible inputValue={50} inputLabel="%" inputPosition="
|
|
49
|
+
<Slider value={50} isInputVisible inputValue={50} inputLabel="%" inputPosition="end" />
|
|
50
50
|
);
|
|
51
51
|
expect(asFragment()).toMatchSnapshot();
|
|
52
52
|
});
|
|
@@ -62,8 +62,8 @@ describe('slider', () => {
|
|
|
62
62
|
const { asFragment } = render(
|
|
63
63
|
<Slider
|
|
64
64
|
value={50}
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
startActions={<Button variant="plain" aria-label="Minus" />}
|
|
66
|
+
endActions={<Button variant="plain" aria-label="Plus" />}
|
|
67
67
|
/>
|
|
68
68
|
);
|
|
69
69
|
expect(asFragment()).toMatchSnapshot();
|
|
@@ -65,12 +65,12 @@ export const SliderActions: React.FunctionComponent = () => {
|
|
|
65
65
|
<Slider
|
|
66
66
|
value={value1}
|
|
67
67
|
onChange={onChange1}
|
|
68
|
-
|
|
68
|
+
startActions={
|
|
69
69
|
<Button variant="plain" aria-label="Minus" onClick={onMinusClick}>
|
|
70
70
|
<MinusIcon />
|
|
71
71
|
</Button>
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
endActions={
|
|
74
74
|
<Button variant="plain" aria-label="Plus" onClick={onPlusClick}>
|
|
75
75
|
<PlusIcon />
|
|
76
76
|
</Button>
|
|
@@ -85,7 +85,7 @@ export const SliderActions: React.FunctionComponent = () => {
|
|
|
85
85
|
inputLabel="%"
|
|
86
86
|
isInputVisible
|
|
87
87
|
isDisabled={isDisabled}
|
|
88
|
-
|
|
88
|
+
endActions={buildAction(isDisabled)}
|
|
89
89
|
/>
|
|
90
90
|
</>
|
|
91
91
|
);
|
|
@@ -28,7 +28,7 @@ You can adjust a tab in the following ways:
|
|
|
28
28
|
- To disable a tab, but keep it perceivable to assistive technology users, use the `isAriaDisabled` property. If a disabled tab has a tooltip, use this property instead of `isDisabled`.
|
|
29
29
|
- To add a tooltip to an aria-disabled tab, use the `tooltip` property.
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Tabs can be styled as 'default' or 'boxed':
|
|
32
32
|
|
|
33
33
|
- Default tabs do not have any borders and use a bottom line to distinguish between a selected tab, a hovered tab, and an inactive tab.
|
|
34
34
|
- Boxed tabs are outlined to emphasize the area that a tab spans. To preview boxed tabs in the following examples, select the 'isBox' checkbox, which sets the `isBox` property to true.
|
|
@@ -207,8 +207,6 @@ The tab its content should only be mounted when the tab is visible.
|
|
|
207
207
|
|
|
208
208
|
To enable closeable tabs, pass the `onClose` property to the `<Tabs>` component. To enable a button that adds new tabs, pass the `onAdd` property to `<Tabs>`.
|
|
209
209
|
|
|
210
|
-
Aria labels may be controlled manually by passing the `closeButtonAriaLabel` property to a `<Tab>` and the `addButtonAriaLabel` property to `<Tabs>`.
|
|
211
|
-
|
|
212
210
|
```ts file="./TabsDynamic.tsx"
|
|
213
211
|
```
|
|
214
212
|
|
|
@@ -14,12 +14,6 @@ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-ico
|
|
|
14
14
|
|
|
15
15
|
## Examples
|
|
16
16
|
|
|
17
|
-
### TEST - remove before merging
|
|
18
|
-
|
|
19
|
-
```ts file="./Test.tsx"
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
|
|
23
17
|
### Toolbar items
|
|
24
18
|
|
|
25
19
|
A toolbar can contain multiple toolbar items, like filters and buttons.
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
MenuToggle,
|
|
4
|
-
MenuToggleElement,
|
|
5
|
-
Toolbar,
|
|
6
|
-
ToolbarItem,
|
|
7
|
-
ToolbarContent,
|
|
8
|
-
ToolbarToggleGroup,
|
|
9
|
-
ToolbarGroup,
|
|
10
|
-
SearchInput,
|
|
11
|
-
Select,
|
|
12
|
-
SelectList,
|
|
13
|
-
SelectOption,
|
|
14
|
-
ToolbarFilter,
|
|
15
|
-
Badge
|
|
16
|
-
} from '@patternfly/react-core';
|
|
17
|
-
import FilterIcon from '@patternfly/react-icons/dist/esm/icons/filter-icon';
|
|
18
|
-
|
|
19
|
-
export const Test: React.FunctionComponent = () => {
|
|
20
|
-
const statusChipContainerRef = React.useRef<HTMLDivElement>();
|
|
21
|
-
const riskChipContainerRef = React.useRef<HTMLDivElement>();
|
|
22
|
-
|
|
23
|
-
const [isStatusGroupExpanded, setIsStatusGroupExpanded] = React.useState(false);
|
|
24
|
-
const [isRiskGroupExpanded, setIsRiskGroupExpanded] = React.useState(false);
|
|
25
|
-
|
|
26
|
-
const [isStatusMenuExpanded, setIsStatusExpanded] = React.useState(false);
|
|
27
|
-
const [isRiskMenuExpanded, setIsRiskExpanded] = React.useState(false);
|
|
28
|
-
const [inputValue, setInputValue] = React.useState('');
|
|
29
|
-
const [filters, setFilters] = React.useState({
|
|
30
|
-
risk: ['Low'],
|
|
31
|
-
status: ['New', 'Pending']
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const closeToggleGroups = () => {
|
|
35
|
-
setIsStatusGroupExpanded(false);
|
|
36
|
-
setIsRiskGroupExpanded(false);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
React.useEffect(() => {
|
|
40
|
-
window.addEventListener('resize', closeToggleGroups); // Resize observer to toggle off expand groups is required to properly reformat toolbar when growing
|
|
41
|
-
return () => {
|
|
42
|
-
window.removeEventListener('resize', closeToggleGroups);
|
|
43
|
-
};
|
|
44
|
-
}, []);
|
|
45
|
-
|
|
46
|
-
const onInputChange = (newValue: string) => {
|
|
47
|
-
setInputValue(newValue);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const onStatusToggle = () => {
|
|
51
|
-
setIsStatusExpanded(!isStatusMenuExpanded);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const onRiskToggle = () => {
|
|
55
|
-
setIsRiskExpanded(!isRiskMenuExpanded);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const onSelect = (type: string, event: React.MouseEvent | React.ChangeEvent | undefined, selection: string) => {
|
|
59
|
-
const checked = (event?.target as HTMLInputElement).checked;
|
|
60
|
-
setFilters((prev) => {
|
|
61
|
-
const prevSelections = prev[type];
|
|
62
|
-
return {
|
|
63
|
-
...prev,
|
|
64
|
-
[type]: checked ? [...prevSelections, selection] : prevSelections.filter((value) => value !== selection)
|
|
65
|
-
};
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const onStatusSelect = (event: React.MouseEvent | React.ChangeEvent | undefined, selection: string) => {
|
|
70
|
-
onSelect('status', event, selection);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const onRiskSelect = (event: React.MouseEvent | React.ChangeEvent | undefined, selection: string) => {
|
|
74
|
-
onSelect('risk', event, selection);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const onDelete = (type: string, id: string) => {
|
|
78
|
-
if (type === 'Risk') {
|
|
79
|
-
setFilters({ risk: filters.risk.filter((fil: string) => fil !== id), status: filters.status });
|
|
80
|
-
} else if (type === 'Status') {
|
|
81
|
-
setFilters({ risk: filters.risk, status: filters.status.filter((fil: string) => fil !== id) });
|
|
82
|
-
} else {
|
|
83
|
-
setFilters({ risk: [], status: [] });
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const onDeleteGroup = (type: string) => {
|
|
88
|
-
if (type === 'Risk') {
|
|
89
|
-
setFilters({ risk: [], status: filters.status });
|
|
90
|
-
} else if (type === 'Status') {
|
|
91
|
-
setFilters({ risk: filters.risk, status: [] });
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const statusToggleGroupItems = (
|
|
96
|
-
<React.Fragment>
|
|
97
|
-
<ToolbarItem variant="search-filter">
|
|
98
|
-
<SearchInput
|
|
99
|
-
aria-label="Consumer toggle groups example search input"
|
|
100
|
-
onChange={(_event, value) => onInputChange(value)}
|
|
101
|
-
value={inputValue}
|
|
102
|
-
onClear={() => {
|
|
103
|
-
onInputChange('');
|
|
104
|
-
}}
|
|
105
|
-
/>
|
|
106
|
-
</ToolbarItem>
|
|
107
|
-
<ToolbarGroup variant="filter-group">
|
|
108
|
-
<ToolbarFilter
|
|
109
|
-
chips={filters.status}
|
|
110
|
-
deleteChip={(category, chip) => onDelete(category as string, chip as string)}
|
|
111
|
-
deleteChipGroup={(category) => onDeleteGroup(category as string)}
|
|
112
|
-
categoryName="Status"
|
|
113
|
-
isExpanded={isStatusGroupExpanded}
|
|
114
|
-
expandableChipContainerRef={statusChipContainerRef} // Required to link the toolbar filter chip group to the custom expandable group
|
|
115
|
-
>
|
|
116
|
-
<Select
|
|
117
|
-
aria-label="Status"
|
|
118
|
-
role="menu"
|
|
119
|
-
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
120
|
-
<MenuToggle
|
|
121
|
-
ref={toggleRef}
|
|
122
|
-
onClick={onStatusToggle}
|
|
123
|
-
isExpanded={isStatusMenuExpanded}
|
|
124
|
-
style={
|
|
125
|
-
{
|
|
126
|
-
width: '140px'
|
|
127
|
-
} as React.CSSProperties
|
|
128
|
-
}
|
|
129
|
-
>
|
|
130
|
-
Status
|
|
131
|
-
{filters.status.length > 0 && <Badge isRead>{filters.status.length}</Badge>}
|
|
132
|
-
</MenuToggle>
|
|
133
|
-
)}
|
|
134
|
-
onSelect={(event, selection) => onStatusSelect(event, selection as string)}
|
|
135
|
-
selected={filters.status}
|
|
136
|
-
isOpen={isStatusMenuExpanded}
|
|
137
|
-
onOpenChange={(isOpen) => setIsStatusExpanded(isOpen)}
|
|
138
|
-
>
|
|
139
|
-
<SelectList>
|
|
140
|
-
<SelectOption hasCheckbox key="statusNew" value="New" isSelected={filters.status.includes('New')}>
|
|
141
|
-
New
|
|
142
|
-
</SelectOption>
|
|
143
|
-
<SelectOption
|
|
144
|
-
hasCheckbox
|
|
145
|
-
key="statusPending"
|
|
146
|
-
value="Pending"
|
|
147
|
-
isSelected={filters.status.includes('Pending')}
|
|
148
|
-
>
|
|
149
|
-
Pending
|
|
150
|
-
</SelectOption>
|
|
151
|
-
<SelectOption
|
|
152
|
-
hasCheckbox
|
|
153
|
-
key="statusRunning"
|
|
154
|
-
value="Running"
|
|
155
|
-
isSelected={filters.status.includes('Running')}
|
|
156
|
-
>
|
|
157
|
-
Running
|
|
158
|
-
</SelectOption>
|
|
159
|
-
<SelectOption
|
|
160
|
-
hasCheckbox
|
|
161
|
-
key="statusCancelled"
|
|
162
|
-
value="Cancelled"
|
|
163
|
-
isSelected={filters.status.includes('Cancelled')}
|
|
164
|
-
>
|
|
165
|
-
Cancelled
|
|
166
|
-
</SelectOption>
|
|
167
|
-
</SelectList>
|
|
168
|
-
</Select>
|
|
169
|
-
</ToolbarFilter>
|
|
170
|
-
</ToolbarGroup>
|
|
171
|
-
</React.Fragment>
|
|
172
|
-
);
|
|
173
|
-
|
|
174
|
-
const riskToggleGroupItems = (
|
|
175
|
-
<ToolbarGroup variant="filter-group">
|
|
176
|
-
<ToolbarFilter
|
|
177
|
-
chips={filters.risk}
|
|
178
|
-
deleteChip={(category, chip) => onDelete(category as string, chip as string)}
|
|
179
|
-
categoryName="Risk"
|
|
180
|
-
isExpanded={isRiskGroupExpanded}
|
|
181
|
-
expandableChipContainerRef={riskChipContainerRef} // Required to link the toolbar filter chip group to the custom expandable group
|
|
182
|
-
>
|
|
183
|
-
<Select
|
|
184
|
-
aria-label="Risk"
|
|
185
|
-
role="menu"
|
|
186
|
-
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
187
|
-
<MenuToggle
|
|
188
|
-
ref={toggleRef}
|
|
189
|
-
onClick={onRiskToggle}
|
|
190
|
-
isExpanded={isRiskMenuExpanded}
|
|
191
|
-
style={
|
|
192
|
-
{
|
|
193
|
-
width: '140px'
|
|
194
|
-
} as React.CSSProperties
|
|
195
|
-
}
|
|
196
|
-
>
|
|
197
|
-
Risk
|
|
198
|
-
{filters.risk.length > 0 && <Badge isRead>{filters.risk.length}</Badge>}
|
|
199
|
-
</MenuToggle>
|
|
200
|
-
)}
|
|
201
|
-
onSelect={(event, selection) => onRiskSelect(event, selection as string)}
|
|
202
|
-
selected={filters.risk}
|
|
203
|
-
isOpen={isRiskMenuExpanded}
|
|
204
|
-
onOpenChange={(isOpen) => setIsRiskExpanded(isOpen)}
|
|
205
|
-
>
|
|
206
|
-
<SelectList>
|
|
207
|
-
<SelectOption hasCheckbox key="riskLow" value="Low" isSelected={filters.risk.includes('Low')}>
|
|
208
|
-
Low
|
|
209
|
-
</SelectOption>
|
|
210
|
-
<SelectOption hasCheckbox key="riskMedium" value="Medium" isSelected={filters.risk.includes('Medium')}>
|
|
211
|
-
Medium
|
|
212
|
-
</SelectOption>
|
|
213
|
-
<SelectOption hasCheckbox key="riskHigh" value="High" isSelected={filters.risk.includes('High')}>
|
|
214
|
-
High
|
|
215
|
-
</SelectOption>
|
|
216
|
-
</SelectList>
|
|
217
|
-
</Select>
|
|
218
|
-
</ToolbarFilter>
|
|
219
|
-
</ToolbarGroup>
|
|
220
|
-
);
|
|
221
|
-
|
|
222
|
-
return (
|
|
223
|
-
<Toolbar id="toolbar-multiple-toggle-groups" className="pf-m-toggle-group-container">
|
|
224
|
-
<ToolbarContent>
|
|
225
|
-
<ToolbarToggleGroup
|
|
226
|
-
isExpanded={isStatusGroupExpanded} // Required to control expanded state
|
|
227
|
-
onToggle={() => {
|
|
228
|
-
setIsStatusGroupExpanded(!isStatusGroupExpanded);
|
|
229
|
-
setIsRiskGroupExpanded(false);
|
|
230
|
-
}} // Required to control expanded state
|
|
231
|
-
toggleIcon={<FilterIcon />}
|
|
232
|
-
breakpoint="md"
|
|
233
|
-
chipContainerRef={statusChipContainerRef}
|
|
234
|
-
showClearFiltersButton
|
|
235
|
-
clearAllFilters={() => onDeleteGroup('Status')}
|
|
236
|
-
clearFiltersButtonText="Clear status filter"
|
|
237
|
-
>
|
|
238
|
-
{statusToggleGroupItems}
|
|
239
|
-
</ToolbarToggleGroup>
|
|
240
|
-
<ToolbarToggleGroup
|
|
241
|
-
isExpanded={isRiskGroupExpanded} // Required to control expanded state
|
|
242
|
-
onToggle={() => {
|
|
243
|
-
setIsRiskGroupExpanded(!isRiskGroupExpanded);
|
|
244
|
-
setIsStatusGroupExpanded(false);
|
|
245
|
-
}} // Required to control expanded state
|
|
246
|
-
toggleIcon={<FilterIcon />}
|
|
247
|
-
breakpoint="xl"
|
|
248
|
-
chipContainerRef={riskChipContainerRef}
|
|
249
|
-
showClearFiltersButton
|
|
250
|
-
clearAllFilters={() => onDeleteGroup('Risk')}
|
|
251
|
-
clearFiltersButtonText={'Clear risk filter'}
|
|
252
|
-
>
|
|
253
|
-
{riskToggleGroupItems}
|
|
254
|
-
</ToolbarToggleGroup>
|
|
255
|
-
</ToolbarContent>
|
|
256
|
-
</Toolbar>
|
|
257
|
-
);
|
|
258
|
-
};
|