@patternfly/react-core 4.262.0 → 4.263.0
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 +17 -0
- package/dist/esm/components/Button/Button.d.ts.map +1 -1
- package/dist/esm/components/Button/Button.js +1 -1
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/NumberInput/NumberInput.d.ts +1 -1
- package/dist/esm/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/esm/components/NumberInput/NumberInput.js +0 -1
- package/dist/esm/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/esm/components/Spinner/Spinner.d.ts +2 -0
- package/dist/esm/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/esm/components/Spinner/Spinner.js +2 -2
- package/dist/esm/components/Spinner/Spinner.js.map +1 -1
- package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/esm/helpers/Popper/Popper.js +6 -3
- package/dist/esm/helpers/Popper/Popper.js.map +1 -1
- package/dist/js/components/Button/Button.d.ts.map +1 -1
- package/dist/js/components/Button/Button.js +1 -1
- package/dist/js/components/Button/Button.js.map +1 -1
- package/dist/js/components/NumberInput/NumberInput.d.ts +1 -1
- package/dist/js/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/js/components/NumberInput/NumberInput.js +0 -1
- package/dist/js/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/js/components/Spinner/Spinner.d.ts +2 -0
- package/dist/js/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/js/components/Spinner/Spinner.js +2 -2
- package/dist/js/components/Spinner/Spinner.js.map +1 -1
- package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/js/helpers/Popper/Popper.js +6 -3
- package/dist/js/helpers/Popper/Popper.js.map +1 -1
- package/dist/umd/react-core.min.css +1815 -1815
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +2 -2
- package/src/components/Button/Button.tsx +1 -0
- package/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +1 -1
- package/src/components/NumberInput/NumberInput.tsx +1 -2
- package/src/components/NumberInput/__tests__/NumberInput.test.tsx +4 -4
- package/src/components/NumberInput/examples/NumberInput.md +2 -0
- package/src/components/NumberInput/examples/NumberInputCustomStep.tsx +4 -4
- package/src/components/NumberInput/examples/NumberInputCustomStepAndThreshold.tsx +4 -5
- package/src/components/NumberInput/examples/NumberInputDefault.tsx +5 -5
- package/src/components/NumberInput/examples/NumberInputDisabled.tsx +5 -5
- package/src/components/NumberInput/examples/NumberInputUnit.tsx +10 -10
- package/src/components/NumberInput/examples/NumberInputUnitThreshold.tsx +16 -6
- package/src/components/NumberInput/examples/NumberInputVaryingSizes.tsx +11 -11
- package/src/components/NumberInput/examples/NumberInputWithStatus.tsx +5 -6
- package/src/components/Popover/__tests__/__snapshots__/Popover.test.tsx.snap +3 -1
- package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +3 -1
- package/src/components/Spinner/Spinner.tsx +4 -1
- package/src/components/Spinner/examples/Spinner.md +4 -0
- package/src/components/Spinner/examples/SpinnerInline.tsx +29 -0
- package/src/components/Tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +3 -1
- package/src/helpers/Popper/Popper.tsx +13 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.263.0",
|
|
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": "^16.8 || ^17 || ^18",
|
|
71
71
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "a6cd98641632354c9e9765f4cff1303942123fb7"
|
|
74
74
|
}
|
|
@@ -172,6 +172,7 @@ const ButtonBase: React.FunctionComponent<ButtonProps> = ({
|
|
|
172
172
|
<span className={css(styles.buttonProgress)}>
|
|
173
173
|
<Spinner
|
|
174
174
|
size={spinnerSize.md}
|
|
175
|
+
isInline={isInline}
|
|
175
176
|
aria-valuetext={spinnerAriaValueText}
|
|
176
177
|
aria-label={spinnerAriaLabel}
|
|
177
178
|
aria-labelledby={spinnerAriaLabelledBy}
|
|
@@ -10,7 +10,7 @@ import { TextInput } from '../TextInput';
|
|
|
10
10
|
|
|
11
11
|
export interface NumberInputProps extends React.HTMLProps<HTMLDivElement> {
|
|
12
12
|
/** Value of the number input */
|
|
13
|
-
value?: number |
|
|
13
|
+
value?: number | '';
|
|
14
14
|
/** Additional classes added to the number input */
|
|
15
15
|
className?: string;
|
|
16
16
|
/** Sets the width of the number input to a number of characters */
|
|
@@ -89,7 +89,6 @@ export const NumberInput: React.FunctionComponent<NumberInputProps> = ({
|
|
|
89
89
|
plusBtnProps,
|
|
90
90
|
...props
|
|
91
91
|
}: NumberInputProps) => {
|
|
92
|
-
value = value || 0;
|
|
93
92
|
const numberInputUnit = <div className={css(styles.numberInputUnit)}>{unit}</div>;
|
|
94
93
|
const keyDownHandler =
|
|
95
94
|
inputProps && inputProps.onKeyDown ? inputProps.onKeyDown : defaultKeyDownHandler({ inputName, onMinus, onPlus });
|
|
@@ -195,22 +195,22 @@ describe('numberInput', () => {
|
|
|
195
195
|
expect(input).toHaveDisplayValue('47.01');
|
|
196
196
|
});
|
|
197
197
|
|
|
198
|
-
test('renders 0 if no value passed', () => {
|
|
198
|
+
test('renders 0 (default value) if no value passed', () => {
|
|
199
199
|
render(<NumberInput />);
|
|
200
200
|
const input = screen.getByRole('spinbutton');
|
|
201
201
|
expect(input).toHaveDisplayValue('0');
|
|
202
202
|
});
|
|
203
203
|
|
|
204
|
-
test('renders 0 if undefined value passed', () => {
|
|
204
|
+
test('renders 0 (default value) if undefined value passed', () => {
|
|
205
205
|
render(<NumberInput value={undefined} />);
|
|
206
206
|
const input = screen.getByRole('spinbutton');
|
|
207
207
|
expect(input).toHaveDisplayValue('0');
|
|
208
208
|
});
|
|
209
209
|
|
|
210
|
-
test('renders
|
|
210
|
+
test('renders nothing if null value passed', () => {
|
|
211
211
|
render(<NumberInput value={null} />);
|
|
212
212
|
const input = screen.getByRole('spinbutton');
|
|
213
|
-
expect(input).toHaveDisplayValue('
|
|
213
|
+
expect(input).toHaveDisplayValue('');
|
|
214
214
|
});
|
|
215
215
|
|
|
216
216
|
test('does not throw an error if onChange is passed via inputProps as well as the onChange prop', () => {
|
|
@@ -19,6 +19,8 @@ propComponents: ['NumberInput']
|
|
|
19
19
|
|
|
20
20
|
### With unit and thresholds
|
|
21
21
|
|
|
22
|
+
To enable a user entered value to snap to the nearest threshold if the entered input is out of bounds, define the blur event handler.
|
|
23
|
+
|
|
22
24
|
```ts file="./NumberInputUnitThreshold.tsx"
|
|
23
25
|
```
|
|
24
26
|
|
|
@@ -2,16 +2,16 @@ import React from 'react';
|
|
|
2
2
|
import { NumberInput } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const NumberInputCustomStep: React.FunctionComponent = () => {
|
|
5
|
-
const [value, setValue] = React.useState(90);
|
|
5
|
+
const [value, setValue] = React.useState<number | ''>(90);
|
|
6
6
|
const step = 3;
|
|
7
7
|
|
|
8
8
|
const stepper = (stepValue: number) => {
|
|
9
|
-
setValue(value + stepValue);
|
|
9
|
+
setValue((value || 0) + stepValue);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
const onChange = (event: React.FormEvent<HTMLInputElement>) => {
|
|
13
|
-
const
|
|
14
|
-
setValue(
|
|
13
|
+
const value = (event.target as HTMLInputElement).value;
|
|
14
|
+
setValue(value === '' ? value : +value);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
return (
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { NumberInput } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const NumberInputCustomStepAndThreshold: React.FunctionComponent = () => {
|
|
5
|
-
const [value, setValue] = React.useState(90);
|
|
5
|
+
const [value, setValue] = React.useState<number | ''>(90);
|
|
6
6
|
const minValue = 90;
|
|
7
7
|
const maxValue = 100;
|
|
8
8
|
const step = 3;
|
|
@@ -19,13 +19,12 @@ export const NumberInputCustomStepAndThreshold: React.FunctionComponent = () =>
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const stepper = (stepValue: number) => {
|
|
22
|
-
setValue(value + stepValue);
|
|
22
|
+
setValue((value || 0) + stepValue);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const onChange = (event: React.FormEvent<HTMLInputElement>) => {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
setValue(newValue);
|
|
26
|
+
const value = (event.target as HTMLInputElement).value;
|
|
27
|
+
setValue(value === '' ? value : +value);
|
|
29
28
|
};
|
|
30
29
|
|
|
31
30
|
const onBlur = (event: React.FormEvent<HTMLInputElement>) => {
|
|
@@ -2,20 +2,20 @@ import React from 'react';
|
|
|
2
2
|
import { NumberInput } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const NumberInputDefault: React.FunctionComponent = () => {
|
|
5
|
-
const [value, setValue] = React.useState(90);
|
|
5
|
+
const [value, setValue] = React.useState<number | ''>(90);
|
|
6
6
|
|
|
7
7
|
const onMinus = () => {
|
|
8
|
-
const newValue = value - 1;
|
|
8
|
+
const newValue = (value || 0) - 1;
|
|
9
9
|
setValue(newValue);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
const onChange = (event: React.FormEvent<HTMLInputElement>) => {
|
|
13
|
-
const
|
|
14
|
-
setValue(
|
|
13
|
+
const value = (event.target as HTMLInputElement).value;
|
|
14
|
+
setValue(value === '' ? value : +value);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const onPlus = () => {
|
|
18
|
-
const newValue = value + 1;
|
|
18
|
+
const newValue = (value || 0) + 1;
|
|
19
19
|
setValue(newValue);
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -2,22 +2,22 @@ import React from 'react';
|
|
|
2
2
|
import { NumberInput } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const NumberInputDisabled: React.FunctionComponent = () => {
|
|
5
|
-
const [value, setValue] = React.useState(100);
|
|
5
|
+
const [value, setValue] = React.useState<number | ''>(100);
|
|
6
6
|
const minValue = 0;
|
|
7
7
|
const maxValue = 100;
|
|
8
8
|
|
|
9
9
|
const onMinus = () => {
|
|
10
|
-
const newValue = value - 1;
|
|
10
|
+
const newValue = (value || 0) - 1;
|
|
11
11
|
setValue(newValue);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
const onChange = (event: React.FormEvent<HTMLInputElement>) => {
|
|
15
|
-
const
|
|
16
|
-
setValue(
|
|
15
|
+
const value = (event.target as HTMLInputElement).value;
|
|
16
|
+
setValue(value === '' ? value : +value);
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const onPlus = () => {
|
|
20
|
-
const newValue = value + 1;
|
|
20
|
+
const newValue = (value || 0) + 1;
|
|
21
21
|
setValue(newValue);
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -2,26 +2,26 @@ import React from 'react';
|
|
|
2
2
|
import { NumberInput } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const NumberInputUnit: React.FunctionComponent = () => {
|
|
5
|
-
const [value1, setValue1] = React.useState(90);
|
|
6
|
-
const [value2, setValue2] = React.useState(Number((1.0).toFixed(2)));
|
|
5
|
+
const [value1, setValue1] = React.useState<number | ''>(90);
|
|
6
|
+
const [value2, setValue2] = React.useState<number | ''>(Number((1.0).toFixed(2)));
|
|
7
7
|
|
|
8
|
-
const onMinus1 = () => setValue1(value1 - 1);
|
|
8
|
+
const onMinus1 = () => setValue1((value1 || 0) - 1);
|
|
9
9
|
const onChange1 = (event: React.FormEvent<HTMLInputElement>) => {
|
|
10
|
-
const
|
|
11
|
-
setValue1(
|
|
10
|
+
const value = (event.target as HTMLInputElement).value;
|
|
11
|
+
setValue1(value === '' ? value : +value);
|
|
12
12
|
};
|
|
13
|
-
const onPlus1 = () => setValue1(value1 + 1);
|
|
13
|
+
const onPlus1 = () => setValue1((value1 || 0) + 1);
|
|
14
14
|
|
|
15
15
|
const onMinus2 = () => {
|
|
16
|
-
const newValue = Number((value2 - 0.01).toFixed(2));
|
|
16
|
+
const newValue = Number(((value2 || 0) - 0.01).toFixed(2));
|
|
17
17
|
setValue2(newValue);
|
|
18
18
|
};
|
|
19
19
|
const onChange2 = (event: React.FormEvent<HTMLInputElement>) => {
|
|
20
|
-
const
|
|
21
|
-
setValue2(
|
|
20
|
+
const value = (event.target as HTMLInputElement).value;
|
|
21
|
+
setValue2(value === '' ? value : +value);
|
|
22
22
|
};
|
|
23
23
|
const onPlus2 = () => {
|
|
24
|
-
const newValue = Number((value2 + 0.01).toFixed(2));
|
|
24
|
+
const newValue = Number(((value2 || 0) + 0.01).toFixed(2));
|
|
25
25
|
setValue2(newValue);
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { NumberInput } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const NumberInputUnitThreshold: React.FunctionComponent = () => {
|
|
5
|
-
const [value, setValue] = React.useState(0);
|
|
5
|
+
const [value, setValue] = React.useState<number | ''>(0);
|
|
6
6
|
const minValue = 0;
|
|
7
7
|
const maxValue = 10;
|
|
8
8
|
|
|
@@ -18,18 +18,27 @@ export const NumberInputUnitThreshold: React.FunctionComponent = () => {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
const onMinus = () => {
|
|
21
|
-
const newValue = normalizeBetween(value - 1, minValue, maxValue);
|
|
21
|
+
const newValue = normalizeBetween((value as number) - 1, minValue, maxValue);
|
|
22
22
|
setValue(newValue);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const onChange = (event: React.FormEvent<HTMLInputElement>) => {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const value = (event.target as HTMLInputElement).value;
|
|
27
|
+
setValue(value === '' ? value : +value);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const onBlur = (event: React.FocusEvent<HTMLInputElement>) => {
|
|
31
|
+
const blurVal = +event.target.value;
|
|
32
|
+
|
|
33
|
+
if (blurVal < minValue) {
|
|
34
|
+
setValue(minValue);
|
|
35
|
+
} else if (blurVal > maxValue) {
|
|
36
|
+
setValue(maxValue);
|
|
37
|
+
}
|
|
29
38
|
};
|
|
30
39
|
|
|
31
40
|
const onPlus = () => {
|
|
32
|
-
const newValue = normalizeBetween(value + 1, minValue, maxValue);
|
|
41
|
+
const newValue = normalizeBetween((value as number) + 1, minValue, maxValue);
|
|
33
42
|
setValue(newValue);
|
|
34
43
|
};
|
|
35
44
|
|
|
@@ -43,6 +52,7 @@ export const NumberInputUnitThreshold: React.FunctionComponent = () => {
|
|
|
43
52
|
max={maxValue}
|
|
44
53
|
onMinus={onMinus}
|
|
45
54
|
onChange={onChange}
|
|
55
|
+
onBlur={onBlur}
|
|
46
56
|
onPlus={onPlus}
|
|
47
57
|
inputName="input"
|
|
48
58
|
inputAriaLabel="number input"
|
|
@@ -2,25 +2,25 @@ import React from 'react';
|
|
|
2
2
|
import { NumberInput } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const NumberInputVaryingSizes: React.FunctionComponent = () => {
|
|
5
|
-
const [input1Value, setInput1Value] = React.useState(1);
|
|
6
|
-
const [input2Value, setInput2Value] = React.useState(1234567890);
|
|
7
|
-
const [input3Value, setInput3Value] = React.useState(5);
|
|
8
|
-
const [input4Value, setInput4Value] = React.useState(12345);
|
|
5
|
+
const [input1Value, setInput1Value] = React.useState<number | ''>(1);
|
|
6
|
+
const [input2Value, setInput2Value] = React.useState<number | ''>(1234567890);
|
|
7
|
+
const [input3Value, setInput3Value] = React.useState<number | ''>(5);
|
|
8
|
+
const [input4Value, setInput4Value] = React.useState<number | ''>(12345);
|
|
9
9
|
|
|
10
10
|
const onChange = (
|
|
11
11
|
event: React.FormEvent<HTMLInputElement>,
|
|
12
|
-
updateFunction: React.Dispatch<React.SetStateAction<number>>
|
|
12
|
+
updateFunction: React.Dispatch<React.SetStateAction<number | ''>>
|
|
13
13
|
) => {
|
|
14
|
-
const
|
|
15
|
-
updateFunction(
|
|
14
|
+
const value = (event.target as HTMLInputElement).value;
|
|
15
|
+
updateFunction(value === '' ? value : +value);
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const onMinus = (value, updateFunction: React.Dispatch<React.SetStateAction<number>>) => {
|
|
19
|
-
updateFunction(value - 1);
|
|
18
|
+
const onMinus = (value: number | '', updateFunction: React.Dispatch<React.SetStateAction<number | ''>>) => {
|
|
19
|
+
updateFunction((value || 0) - 1);
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const onPlus = (value, updateFunction: React.Dispatch<React.SetStateAction<number>>) => {
|
|
23
|
-
updateFunction(value + 1);
|
|
22
|
+
const onPlus = (value: number | '', updateFunction: React.Dispatch<React.SetStateAction<number | ''>>) => {
|
|
23
|
+
updateFunction((value || 0) + 1);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
return (
|
|
@@ -9,22 +9,21 @@ export const NumberInputWithStatus: React.FunctionComponent = () => {
|
|
|
9
9
|
const [value, setValue] = React.useReducer((state, newVal) => Math.max(min, Math.min(max, Number(newVal))), 5);
|
|
10
10
|
|
|
11
11
|
const onPlus = () => {
|
|
12
|
-
const newVal = value + 1;
|
|
12
|
+
const newVal = (value || 0) + 1;
|
|
13
13
|
setValue(newVal);
|
|
14
14
|
validate(newVal);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const onMinus = () => {
|
|
18
|
-
const newVal = value - 1;
|
|
18
|
+
const newVal = (value || 0) - 1;
|
|
19
19
|
setValue(newVal);
|
|
20
20
|
validate(newVal);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const onChange = (event: React.FormEvent<HTMLInputElement>) => {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
validate(newVal);
|
|
24
|
+
const value = (event.target as HTMLInputElement).value;
|
|
25
|
+
setValue(value === '' ? value : +value);
|
|
26
|
+
validate(value);
|
|
28
27
|
};
|
|
29
28
|
|
|
30
29
|
const validate = newVal => {
|
|
@@ -20,6 +20,8 @@ export interface SpinnerProps extends Omit<React.HTMLProps<HTMLSpanElement>, 'si
|
|
|
20
20
|
isSVG?: boolean;
|
|
21
21
|
/** Diameter of spinner set as CSS variable */
|
|
22
22
|
diameter?: string;
|
|
23
|
+
/** @beta Indicates the spinner is inline and the size should inherit the text font size. This will override the size prop. */
|
|
24
|
+
isInline?: boolean;
|
|
23
25
|
/** Accessible label to describe what is loading */
|
|
24
26
|
'aria-label'?: string;
|
|
25
27
|
/** Id of element which describes what is being loaded */
|
|
@@ -33,6 +35,7 @@ export const Spinner: React.FunctionComponent<SpinnerProps> = ({
|
|
|
33
35
|
'aria-valuetext': ariaValueText = 'Loading...',
|
|
34
36
|
isSVG = false,
|
|
35
37
|
diameter,
|
|
38
|
+
isInline = false,
|
|
36
39
|
'aria-label': ariaLabel,
|
|
37
40
|
'aria-labelledBy': ariaLabelledBy,
|
|
38
41
|
...props
|
|
@@ -41,7 +44,7 @@ export const Spinner: React.FunctionComponent<SpinnerProps> = ({
|
|
|
41
44
|
|
|
42
45
|
return (
|
|
43
46
|
<Component
|
|
44
|
-
className={css(styles.spinner, styles.modifiers[size], className)}
|
|
47
|
+
className={css(styles.spinner, isInline ? styles.modifiers.inline : styles.modifiers[size], className)}
|
|
45
48
|
role="progressbar"
|
|
46
49
|
aria-valuetext={ariaValueText}
|
|
47
50
|
{...(isSVG && { viewBox: '0 0 100 100' })}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Spinner, Text, TextContent } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const SpinnerInline: React.FunctionComponent = () => (
|
|
5
|
+
<React.Fragment>
|
|
6
|
+
<TextContent>
|
|
7
|
+
<Text component="h1">
|
|
8
|
+
Heading
|
|
9
|
+
<Spinner isInline isSVG aria-label="Spinner in a heading" />
|
|
10
|
+
</Text>
|
|
11
|
+
<Text component="p">
|
|
12
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit Sed hendrerit nisi in cursus maximus.
|
|
13
|
+
</Text>
|
|
14
|
+
<Text component="h2">
|
|
15
|
+
Second level
|
|
16
|
+
<Spinner isInline isSVG aria-label="spinner in a subheading" />
|
|
17
|
+
</Text>
|
|
18
|
+
<Text component="p">
|
|
19
|
+
Curabitur accumsan turpis pharetra blandit. Quisque condimentum maximus mi,{' '}
|
|
20
|
+
<Spinner isInline isSVG aria-label="Spinner in a paragraph" /> sit amet commodo arcu rutrum id. Proin pretium
|
|
21
|
+
urna vel cursus venenatis. Suspendisse potenti.
|
|
22
|
+
</Text>
|
|
23
|
+
<small>
|
|
24
|
+
Sometimes you need small text
|
|
25
|
+
<Spinner isInline isSVG aria-label="Spinner in a small element" />
|
|
26
|
+
</small>
|
|
27
|
+
</TextContent>
|
|
28
|
+
</React.Fragment>
|
|
29
|
+
);
|
|
@@ -311,7 +311,7 @@ export const Popper: React.FunctionComponent<PopperProps> = ({
|
|
|
311
311
|
[popperMatchesTriggerWidth]
|
|
312
312
|
);
|
|
313
313
|
|
|
314
|
-
const { styles: popperStyles, attributes, update } = usePopper(refOrTrigger, popperElement, {
|
|
314
|
+
const { styles: popperStyles, attributes, update, forceUpdate } = usePopper(refOrTrigger, popperElement, {
|
|
315
315
|
placement: getPlacementMemo,
|
|
316
316
|
modifiers: [
|
|
317
317
|
{
|
|
@@ -340,6 +340,10 @@ export const Popper: React.FunctionComponent<PopperProps> = ({
|
|
|
340
340
|
]
|
|
341
341
|
});
|
|
342
342
|
|
|
343
|
+
React.useEffect(() => {
|
|
344
|
+
forceUpdate && forceUpdate();
|
|
345
|
+
}, [popper]);
|
|
346
|
+
|
|
343
347
|
// Returns the CSS modifier class in order to place the Popper's arrow properly
|
|
344
348
|
// Depends on the position of the Popper relative to the reference element
|
|
345
349
|
const modifierFromPopperPosition = () => {
|
|
@@ -383,7 +387,11 @@ export const Popper: React.FunctionComponent<PopperProps> = ({
|
|
|
383
387
|
let popperPortal;
|
|
384
388
|
if (removeFindDomNode) {
|
|
385
389
|
// If removeFindDomNode is passed, use the removeFindDomNode method of wrapping divs
|
|
386
|
-
popperPortal =
|
|
390
|
+
popperPortal = (
|
|
391
|
+
<div style={{ display: 'contents' }} ref={node => setPopperElement(node?.firstElementChild as HTMLElement)}>
|
|
392
|
+
{menuWithPopper}
|
|
393
|
+
</div>
|
|
394
|
+
);
|
|
387
395
|
} else if (popperRef) {
|
|
388
396
|
// If removeFindDomNode is not passed and popperRef is passed, use the popperRef method
|
|
389
397
|
popperPortal = menuWithPopper;
|
|
@@ -400,7 +408,9 @@ export const Popper: React.FunctionComponent<PopperProps> = ({
|
|
|
400
408
|
<FindRefWrapper onFoundRef={(foundRef: any) => setTriggerElement(foundRef)}>{trigger}</FindRefWrapper>
|
|
401
409
|
)}
|
|
402
410
|
{!reference && trigger && React.isValidElement(trigger) && removeFindDomNode && (
|
|
403
|
-
<div ref={node => setTriggerElement(node?.firstElementChild as HTMLElement)}>
|
|
411
|
+
<div style={{ display: 'contents' }} ref={node => setTriggerElement(node?.firstElementChild as HTMLElement)}>
|
|
412
|
+
{trigger}
|
|
413
|
+
</div>
|
|
404
414
|
)}
|
|
405
415
|
{ready && isVisible && ReactDOM.createPortal(popperPortal, getTarget())}
|
|
406
416
|
</>
|