@patternfly/react-core 4.175.13 → 4.175.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 +38 -0
- package/dist/esm/components/ContextSelector/ContextSelector.d.ts +2 -0
- package/dist/esm/components/ContextSelector/ContextSelector.d.ts.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelector.js +3 -2
- package/dist/esm/components/ContextSelector/ContextSelector.js.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.d.ts +7 -1
- package/dist/esm/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.js +8 -2
- package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/Slider/Slider.d.ts.map +1 -1
- package/dist/esm/components/Slider/Slider.js +12 -7
- package/dist/esm/components/Slider/Slider.js.map +1 -1
- package/dist/esm/helpers/OUIA/ouia.d.ts.map +1 -1
- package/dist/esm/helpers/OUIA/ouia.js +9 -1
- package/dist/esm/helpers/OUIA/ouia.js.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelector.d.ts +2 -0
- package/dist/js/components/ContextSelector/ContextSelector.d.ts.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelector.js +3 -2
- package/dist/js/components/ContextSelector/ContextSelector.js.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.d.ts +7 -1
- package/dist/js/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.js +8 -3
- package/dist/js/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/js/components/Slider/Slider.d.ts.map +1 -1
- package/dist/js/components/Slider/Slider.js +12 -7
- package/dist/js/components/Slider/Slider.js.map +1 -1
- package/dist/js/helpers/OUIA/ouia.d.ts.map +1 -1
- package/dist/js/helpers/OUIA/ouia.js +9 -1
- package/dist/js/helpers/OUIA/ouia.js.map +1 -1
- package/dist/umd/react-core.js +31 -12
- package/dist/umd/react-core.min.js +3 -3
- package/package.json +5 -5
- package/src/components/Card/examples/Card.md +0 -16
- package/src/components/ContextSelector/ContextSelector.tsx +5 -1
- package/src/components/DatePicker/DatePicker.tsx +49 -27
- package/src/components/DatePicker/examples/DatePicker.md +25 -1
- package/src/components/Slider/Slider.tsx +16 -7
- package/src/components/Slider/_tests_/__snapshots__/Slider.test.tsx.snap +8 -0
- package/src/components/Slider/examples/Slider.md +28 -1
- package/src/demos/TileDemo.md +91 -116
- package/src/helpers/OUIA/ouia.ts +8 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.175.
|
|
3
|
+
"version": "4.175.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",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.26.
|
|
38
|
-
"@patternfly/react-styles": "^4.25.
|
|
39
|
-
"@patternfly/react-tokens": "^4.27.
|
|
37
|
+
"@patternfly/react-icons": "^4.26.17",
|
|
38
|
+
"@patternfly/react-styles": "^4.25.17",
|
|
39
|
+
"@patternfly/react-tokens": "^4.27.17",
|
|
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": "a090a90f5628375cca96aed412316b34a7f92e50"
|
|
64
64
|
}
|
|
@@ -77,7 +77,6 @@ import {
|
|
|
77
77
|
CardFooter,
|
|
78
78
|
Checkbox,
|
|
79
79
|
Dropdown,
|
|
80
|
-
DropdownToggle,
|
|
81
80
|
DropdownItem,
|
|
82
81
|
DropdownSeparator,
|
|
83
82
|
KebabToggle
|
|
@@ -192,7 +191,6 @@ import {
|
|
|
192
191
|
CardFooter,
|
|
193
192
|
Checkbox,
|
|
194
193
|
Dropdown,
|
|
195
|
-
DropdownToggle,
|
|
196
194
|
DropdownItem,
|
|
197
195
|
DropdownSeparator,
|
|
198
196
|
KebabToggle
|
|
@@ -281,14 +279,12 @@ import React from 'react';
|
|
|
281
279
|
import {
|
|
282
280
|
Checkbox,
|
|
283
281
|
Dropdown,
|
|
284
|
-
DropdownToggle,
|
|
285
282
|
DropdownItem,
|
|
286
283
|
DropdownSeparator,
|
|
287
284
|
KebabToggle,
|
|
288
285
|
Card,
|
|
289
286
|
CardHeader,
|
|
290
287
|
CardActions,
|
|
291
|
-
CardTitle,
|
|
292
288
|
CardBody
|
|
293
289
|
} from '@patternfly/react-core';
|
|
294
290
|
|
|
@@ -458,7 +454,6 @@ import {
|
|
|
458
454
|
CardTitle,
|
|
459
455
|
CardBody,
|
|
460
456
|
Dropdown,
|
|
461
|
-
DropdownToggle,
|
|
462
457
|
DropdownItem,
|
|
463
458
|
DropdownSeparator,
|
|
464
459
|
KebabToggle
|
|
@@ -589,14 +584,10 @@ import {
|
|
|
589
584
|
CardExpandableContent,
|
|
590
585
|
Checkbox,
|
|
591
586
|
Dropdown,
|
|
592
|
-
DropdownToggle,
|
|
593
587
|
DropdownItem,
|
|
594
588
|
DropdownSeparator,
|
|
595
|
-
DropdownPosition,
|
|
596
|
-
DropdownDirection,
|
|
597
589
|
KebabToggle
|
|
598
590
|
} from '@patternfly/react-core';
|
|
599
|
-
import pfLogo from './pfLogo.svg';
|
|
600
591
|
|
|
601
592
|
class ExpandableCard extends React.Component {
|
|
602
593
|
constructor(props) {
|
|
@@ -712,25 +703,19 @@ class ExpandableCard extends React.Component {
|
|
|
712
703
|
```js
|
|
713
704
|
import React from 'react';
|
|
714
705
|
import {
|
|
715
|
-
Brand,
|
|
716
706
|
Card,
|
|
717
707
|
CardHeader,
|
|
718
708
|
CardActions,
|
|
719
|
-
CardTitle,
|
|
720
709
|
CardBody,
|
|
721
710
|
CardFooter,
|
|
722
711
|
CardExpandableContent,
|
|
723
712
|
Checkbox,
|
|
724
713
|
Dropdown,
|
|
725
|
-
DropdownToggle,
|
|
726
714
|
DropdownItem,
|
|
727
715
|
DropdownSeparator,
|
|
728
|
-
DropdownPosition,
|
|
729
|
-
DropdownDirection,
|
|
730
716
|
KebabToggle
|
|
731
717
|
} from '@patternfly/react-core';
|
|
732
718
|
import pfLogoSmall from './pf-logo-small.svg';
|
|
733
|
-
import pfLogo from './pfLogo.svg';
|
|
734
719
|
|
|
735
720
|
class ExpandableIconCard extends React.Component {
|
|
736
721
|
constructor(props) {
|
|
@@ -833,7 +818,6 @@ import {
|
|
|
833
818
|
CardTitle,
|
|
834
819
|
CardBody,
|
|
835
820
|
Dropdown,
|
|
836
|
-
DropdownToggle,
|
|
837
821
|
DropdownItem,
|
|
838
822
|
DropdownSeparator,
|
|
839
823
|
KebabToggle
|
|
@@ -51,6 +51,8 @@ export interface ContextSelectorProps extends ToggleMenuBaseProps, OUIAProps {
|
|
|
51
51
|
isPlain?: boolean;
|
|
52
52
|
/** Flag to indicate if toggle is textual toggle */
|
|
53
53
|
isText?: boolean;
|
|
54
|
+
/** Flag to disable focus trap */
|
|
55
|
+
disableFocusTrap?: boolean;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
export class ContextSelector extends React.Component<ContextSelectorProps, { ouiaStateId: string }> {
|
|
@@ -70,6 +72,7 @@ export class ContextSelector extends React.Component<ContextSelectorProps, { oui
|
|
|
70
72
|
onSearchButtonClick: () => undefined as any,
|
|
71
73
|
menuAppendTo: 'inline',
|
|
72
74
|
ouiaSafe: true,
|
|
75
|
+
disableFocusTrap: false,
|
|
73
76
|
footer: null as React.ReactNode,
|
|
74
77
|
isPlain: false,
|
|
75
78
|
isText: false
|
|
@@ -113,12 +116,13 @@ export class ContextSelector extends React.Component<ContextSelectorProps, { oui
|
|
|
113
116
|
isPlain,
|
|
114
117
|
isText,
|
|
115
118
|
footer,
|
|
119
|
+
disableFocusTrap,
|
|
116
120
|
...props
|
|
117
121
|
} = this.props;
|
|
118
122
|
const menuContainer = (
|
|
119
123
|
<div className={css(styles.contextSelectorMenu)}>
|
|
120
124
|
{isOpen && (
|
|
121
|
-
<FocusTrap focusTrapOptions={{ clickOutsideDeactivates: true }}>
|
|
125
|
+
<FocusTrap active={!disableFocusTrap} focusTrapOptions={{ clickOutsideDeactivates: true }}>
|
|
122
126
|
<div className={css(styles.contextSelectorMenuSearch)}>
|
|
123
127
|
<InputGroup>
|
|
124
128
|
<TextInput
|
|
@@ -7,6 +7,7 @@ import { Popover, PopoverProps } from '../Popover/Popover';
|
|
|
7
7
|
import { InputGroup } from '../InputGroup/InputGroup';
|
|
8
8
|
import OutlinedCalendarAltIcon from '@patternfly/react-icons/dist/esm/icons/outlined-calendar-alt-icon';
|
|
9
9
|
import { CalendarMonth, CalendarFormat, isValidDate } from '../CalendarMonth';
|
|
10
|
+
import { useImperativeHandle } from 'react';
|
|
10
11
|
|
|
11
12
|
export interface DatePickerProps
|
|
12
13
|
extends CalendarFormat,
|
|
@@ -43,38 +44,48 @@ export interface DatePickerProps
|
|
|
43
44
|
inputProps?: TextInputProps;
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
export interface DatePickerRef {
|
|
48
|
+
/** Sets the calendar open status */
|
|
49
|
+
setCalendarOpen: (isOpen: boolean) => void;
|
|
50
|
+
/** Toggles the calendar open status */
|
|
51
|
+
toggleCalendar: () => void;
|
|
52
|
+
}
|
|
53
|
+
|
|
46
54
|
export const yyyyMMddFormat = (date: Date) =>
|
|
47
55
|
`${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date
|
|
48
56
|
.getDate()
|
|
49
57
|
.toString()
|
|
50
58
|
.padStart(2, '0')}`;
|
|
51
59
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
60
|
+
const DatePickerBase = (
|
|
61
|
+
{
|
|
62
|
+
className,
|
|
63
|
+
locale = undefined,
|
|
64
|
+
dateFormat = yyyyMMddFormat,
|
|
65
|
+
dateParse = (val: string) => val.split('-').length === 3 && new Date(`${val}T00:00:00`),
|
|
66
|
+
isDisabled = false,
|
|
67
|
+
placeholder = 'YYYY-MM-DD',
|
|
68
|
+
value: valueProp = '',
|
|
69
|
+
'aria-label': ariaLabel = 'Date picker',
|
|
70
|
+
buttonAriaLabel = 'Toggle date picker',
|
|
71
|
+
onChange = (): any => undefined,
|
|
72
|
+
invalidFormatText = 'Invalid date',
|
|
73
|
+
helperText,
|
|
74
|
+
appendTo,
|
|
75
|
+
popoverProps,
|
|
76
|
+
monthFormat,
|
|
77
|
+
weekdayFormat,
|
|
78
|
+
longWeekdayFormat,
|
|
79
|
+
dayFormat,
|
|
80
|
+
weekStart,
|
|
81
|
+
validators = [],
|
|
82
|
+
rangeStart,
|
|
83
|
+
style: styleProps = {},
|
|
84
|
+
inputProps = {},
|
|
85
|
+
...props
|
|
86
|
+
}: DatePickerProps,
|
|
87
|
+
ref: React.Ref<DatePickerRef>
|
|
88
|
+
) => {
|
|
78
89
|
const [value, setValue] = React.useState(valueProp);
|
|
79
90
|
const [valueDate, setValueDate] = React.useState(dateParse(value));
|
|
80
91
|
const [errorText, setErrorText] = React.useState('');
|
|
@@ -136,6 +147,15 @@ export const DatePicker: React.FunctionComponent<DatePickerProps> = ({
|
|
|
136
147
|
}
|
|
137
148
|
};
|
|
138
149
|
|
|
150
|
+
useImperativeHandle<DatePickerRef, DatePickerRef>(
|
|
151
|
+
ref,
|
|
152
|
+
() => ({
|
|
153
|
+
setCalendarOpen: (isOpen: boolean) => setPopoverOpen(isOpen),
|
|
154
|
+
toggleCalendar: () => setPopoverOpen(prev => !prev)
|
|
155
|
+
}),
|
|
156
|
+
[setPopoverOpen]
|
|
157
|
+
);
|
|
158
|
+
|
|
139
159
|
return (
|
|
140
160
|
<div className={css(styles.datePicker, className)} style={style} {...props}>
|
|
141
161
|
<Popover
|
|
@@ -208,4 +228,6 @@ export const DatePicker: React.FunctionComponent<DatePickerProps> = ({
|
|
|
208
228
|
</div>
|
|
209
229
|
);
|
|
210
230
|
};
|
|
211
|
-
|
|
231
|
+
|
|
232
|
+
export const DatePicker = React.forwardRef<DatePickerRef, DatePickerProps>(DatePickerBase);
|
|
233
|
+
DatePicker.displayName = 'DatePickerBase';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: Date picker
|
|
3
3
|
section: components
|
|
4
4
|
cssPrefix: pf-c-date-picker
|
|
5
|
-
propComponents: ['DatePicker', 'CalendarFormat']
|
|
5
|
+
propComponents: ['DatePicker', 'CalendarFormat', 'DatePickerRef']
|
|
6
6
|
beta: true
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -128,3 +128,27 @@ ControlledDate = () => {
|
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
130
|
```
|
|
131
|
+
|
|
132
|
+
### Controlling the date picker calendar state
|
|
133
|
+
|
|
134
|
+
```js
|
|
135
|
+
import React from 'react';
|
|
136
|
+
import { Button, DatePicker } from '@patternfly/react-core';
|
|
137
|
+
|
|
138
|
+
ControllingDatePicker = () => {
|
|
139
|
+
const dateRef = React.useRef(null);
|
|
140
|
+
const onClick = () => {
|
|
141
|
+
if (dateRef.current) {
|
|
142
|
+
dateRef.current.toggleCalendar()
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
return (
|
|
146
|
+
<React.Fragment>
|
|
147
|
+
<Button onClick={onClick}>
|
|
148
|
+
Toggle calendar
|
|
149
|
+
</Button>
|
|
150
|
+
<DatePicker ref={ dateRef } />
|
|
151
|
+
</React.Fragment>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
```
|
|
@@ -104,6 +104,8 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
104
104
|
// calculate style value percentage
|
|
105
105
|
const stylePercent = ((localValue - min) * 100) / (max - min);
|
|
106
106
|
const style = { '--pf-c-slider--value': `${stylePercent}%` } as React.CSSProperties;
|
|
107
|
+
const widthChars = React.useMemo(() => localInputValue.toString().length, [localInputValue]);
|
|
108
|
+
const inputStyle = { '--pf-c-slider__value--c-form-control--width-chars': widthChars } as React.CSSProperties;
|
|
107
109
|
|
|
108
110
|
const onChangeHandler = (value: string) => {
|
|
109
111
|
setLocalInputValue(Number(value));
|
|
@@ -219,15 +221,18 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
219
221
|
|
|
220
222
|
/* If custom steps are discrete, snap to closest step value */
|
|
221
223
|
if (!areCustomStepsContinuous && customSteps) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
let percentage = newPercentage;
|
|
225
|
+
if (customSteps[customSteps.length - 1].value !== 100) {
|
|
226
|
+
const numSteps = customSteps.length - 1;
|
|
227
|
+
const percentagePerStep = 100 / numSteps;
|
|
228
|
+
percentage = newPercentage / percentagePerStep;
|
|
229
|
+
}
|
|
230
|
+
const stepIndex = customSteps.findIndex(stepObj => stepObj.value >= percentage);
|
|
231
|
+
if (customSteps[stepIndex].value === percentage) {
|
|
227
232
|
snapValue = customSteps[stepIndex].value;
|
|
228
233
|
} else {
|
|
229
234
|
const midpoint = (customSteps[stepIndex].value + customSteps[stepIndex - 1].value) / 2;
|
|
230
|
-
if (midpoint >
|
|
235
|
+
if (midpoint > percentage) {
|
|
231
236
|
snapValue = customSteps[stepIndex - 1].value;
|
|
232
237
|
} else {
|
|
233
238
|
snapValue = customSteps[stepIndex].value;
|
|
@@ -340,7 +345,11 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
340
345
|
};
|
|
341
346
|
|
|
342
347
|
return (
|
|
343
|
-
<div
|
|
348
|
+
<div
|
|
349
|
+
className={css(styles.slider, className, isDisabled && styles.modifiers.disabled)}
|
|
350
|
+
style={{ ...style, ...inputStyle }}
|
|
351
|
+
{...props}
|
|
352
|
+
>
|
|
344
353
|
{leftActions && <div className={css(styles.sliderActions)}>{leftActions}</div>}
|
|
345
354
|
<div className={css(styles.sliderMain)}>
|
|
346
355
|
<div className={css(styles.sliderRail)} ref={sliderRailRef} onClick={!isDisabled ? onSliderRailClick : null}>
|
|
@@ -11,6 +11,7 @@ exports[`slider renders continuous slider 1`] = `
|
|
|
11
11
|
style={
|
|
12
12
|
Object {
|
|
13
13
|
"--pf-c-slider--value": "50%",
|
|
14
|
+
"--pf-c-slider__value--c-form-control--width-chars": 2,
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
>
|
|
@@ -172,6 +173,7 @@ exports[`slider renders continuous slider with custom steps 1`] = `
|
|
|
172
173
|
style={
|
|
173
174
|
Object {
|
|
174
175
|
"--pf-c-slider--value": "50%",
|
|
176
|
+
"--pf-c-slider__value--c-form-control--width-chars": 1,
|
|
175
177
|
}
|
|
176
178
|
}
|
|
177
179
|
>
|
|
@@ -269,6 +271,7 @@ exports[`slider renders disabled slider 1`] = `
|
|
|
269
271
|
style={
|
|
270
272
|
Object {
|
|
271
273
|
"--pf-c-slider--value": "50%",
|
|
274
|
+
"--pf-c-slider__value--c-form-control--width-chars": 1,
|
|
272
275
|
}
|
|
273
276
|
}
|
|
274
277
|
>
|
|
@@ -368,6 +371,7 @@ exports[`slider renders discrete slider 1`] = `
|
|
|
368
371
|
style={
|
|
369
372
|
Object {
|
|
370
373
|
"--pf-c-slider--value": "40%",
|
|
374
|
+
"--pf-c-slider__value--c-form-control--width-chars": 2,
|
|
371
375
|
}
|
|
372
376
|
}
|
|
373
377
|
>
|
|
@@ -542,6 +546,7 @@ exports[`slider renders discrete slider with custom steps 1`] = `
|
|
|
542
546
|
style={
|
|
543
547
|
Object {
|
|
544
548
|
"--pf-c-slider--value": "50%",
|
|
549
|
+
"--pf-c-slider__value--c-form-control--width-chars": 1,
|
|
545
550
|
}
|
|
546
551
|
}
|
|
547
552
|
>
|
|
@@ -706,6 +711,7 @@ exports[`slider renders slider with input 1`] = `
|
|
|
706
711
|
style={
|
|
707
712
|
Object {
|
|
708
713
|
"--pf-c-slider--value": "50%",
|
|
714
|
+
"--pf-c-slider__value--c-form-control--width-chars": 2,
|
|
709
715
|
}
|
|
710
716
|
}
|
|
711
717
|
>
|
|
@@ -874,6 +880,7 @@ exports[`slider renders slider with input above thumb 1`] = `
|
|
|
874
880
|
style={
|
|
875
881
|
Object {
|
|
876
882
|
"--pf-c-slider--value": "50%",
|
|
883
|
+
"--pf-c-slider__value--c-form-control--width-chars": 2,
|
|
877
884
|
}
|
|
878
885
|
}
|
|
879
886
|
>
|
|
@@ -1050,6 +1057,7 @@ exports[`slider renders slider with input actions 1`] = `
|
|
|
1050
1057
|
style={
|
|
1051
1058
|
Object {
|
|
1052
1059
|
"--pf-c-slider--value": "50%",
|
|
1060
|
+
"--pf-c-slider__value--c-form-control--width-chars": 1,
|
|
1053
1061
|
}
|
|
1054
1062
|
}
|
|
1055
1063
|
>
|
|
@@ -29,6 +29,7 @@ class DiscreteInput extends React.Component {
|
|
|
29
29
|
value3: 25,
|
|
30
30
|
value4: 50,
|
|
31
31
|
value5: 50,
|
|
32
|
+
value6: 3
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
this.steps = [
|
|
@@ -43,6 +44,15 @@ class DiscreteInput extends React.Component {
|
|
|
43
44
|
{ value: 100, label: '8' }
|
|
44
45
|
];
|
|
45
46
|
|
|
47
|
+
this.stepsDiscreteWithMax = [
|
|
48
|
+
{ value: 0, label: "A" },
|
|
49
|
+
{ value: 1, label: "B" },
|
|
50
|
+
{ value: 2, label: "C" },
|
|
51
|
+
{ value: 3, label: "D" },
|
|
52
|
+
{ value: 4, label: "E" },
|
|
53
|
+
{ value: 5, label: "F" }
|
|
54
|
+
];
|
|
55
|
+
|
|
46
56
|
this.onChange = value => {
|
|
47
57
|
this.setState({
|
|
48
58
|
value1: value
|
|
@@ -72,6 +82,12 @@ class DiscreteInput extends React.Component {
|
|
|
72
82
|
value5: value
|
|
73
83
|
});
|
|
74
84
|
};
|
|
85
|
+
|
|
86
|
+
this.onChange6 = value => {
|
|
87
|
+
this.setState({
|
|
88
|
+
value6: value
|
|
89
|
+
});
|
|
90
|
+
};
|
|
75
91
|
}
|
|
76
92
|
|
|
77
93
|
render() {
|
|
@@ -97,6 +113,17 @@ class DiscreteInput extends React.Component {
|
|
|
97
113
|
<Text component={TextVariants.h3}>Slider value is: {Math.floor(this.state.value5)}</Text>
|
|
98
114
|
<Text component={TextVariants.small}>(min = -25, max = 75, step = 10, boundaries shown, ticks not shown) </Text>
|
|
99
115
|
<Slider value={this.state.value5} onChange={this.onChange5} min={-25} max={75} step={10} />
|
|
116
|
+
<br />
|
|
117
|
+
<Text component={TextVariants.h3}>Slider value is: {Math.floor(this.state.value6)}</Text>
|
|
118
|
+
<Text component={TextVariants.small}>(max = 5, custom steps) </Text>
|
|
119
|
+
<Slider
|
|
120
|
+
value={this.state.value6}
|
|
121
|
+
showTicks
|
|
122
|
+
max={5}
|
|
123
|
+
customSteps={this.stepsDiscreteWithMax}
|
|
124
|
+
onChange={this.onChange6}
|
|
125
|
+
/>
|
|
126
|
+
<br />
|
|
100
127
|
</>
|
|
101
128
|
);
|
|
102
129
|
}
|
|
@@ -354,7 +381,7 @@ class ThumbValueInput extends React.Component {
|
|
|
354
381
|
this.onChange = (value, inputValue, setLocalInputValue) => {
|
|
355
382
|
let newValue;
|
|
356
383
|
if (inputValue === undefined) {
|
|
357
|
-
newValue = Number(value)
|
|
384
|
+
newValue = Number(value);
|
|
358
385
|
} else {
|
|
359
386
|
if (inputValue > 100) {
|
|
360
387
|
newValue = 100;
|