@sonardigital/carbon-ui 1.1.40 → 1.1.43
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/package.json
CHANGED
|
@@ -41,6 +41,9 @@ export function MultiselectAutocomplete(props: SelectAutocompleteProps): React.R
|
|
|
41
41
|
}
|
|
42
42
|
popupIcon={null}
|
|
43
43
|
defaultValue={[]}
|
|
44
|
+
onChange={(_, newValue) => {
|
|
45
|
+
onChange(newValue.map((item) => item.value));
|
|
46
|
+
}}
|
|
44
47
|
renderValue={(selected) => {
|
|
45
48
|
return (
|
|
46
49
|
<>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
export const Delay: React.FC<{
|
|
4
|
+
time: number;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
fallback: React.ReactNode;
|
|
7
|
+
}> = ({ time, children, fallback }) => {
|
|
8
|
+
const [shouldRender, setShouldRender] = useState(false);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const timer = setTimeout(() => {
|
|
12
|
+
setShouldRender(true);
|
|
13
|
+
}, time);
|
|
14
|
+
|
|
15
|
+
return () => clearTimeout(timer);
|
|
16
|
+
}, [time]);
|
|
17
|
+
|
|
18
|
+
return shouldRender ? children : fallback;
|
|
19
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { Component, Suspense } from 'react';
|
|
2
|
+
import { Delay } from '../delay';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
fallback?: React.ReactNode;
|
|
7
|
+
time?: number;
|
|
8
|
+
delay?: boolean;
|
|
9
|
+
isLoading?: boolean | (undefined | null | boolean)[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface State {
|
|
13
|
+
hasError: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class ErrorBoundary extends Component<Props, State> {
|
|
17
|
+
constructor(props: Props) {
|
|
18
|
+
super(props);
|
|
19
|
+
this.state = { hasError: false };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
componentDidCatch(): void {
|
|
23
|
+
this.setState({ hasError: true });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
render(): React.ReactElement | React.ReactNode {
|
|
27
|
+
const { isLoading, fallback, children, delay, time } = this.props;
|
|
28
|
+
|
|
29
|
+
// eslint-disable-next-line
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
if ([isLoading]?.flat()?.includes(true)) {
|
|
32
|
+
return fallback;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (this.state.hasError) {
|
|
36
|
+
return 'Error while rendering the section';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Suspense fallback={fallback}>
|
|
41
|
+
{delay && time !== 0 ? (
|
|
42
|
+
<Delay time={time ?? 0} fallback={fallback}>
|
|
43
|
+
{children}
|
|
44
|
+
</Delay>
|
|
45
|
+
) : (
|
|
46
|
+
children
|
|
47
|
+
)}
|
|
48
|
+
</Suspense>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -14,7 +14,7 @@ export const typography = {
|
|
|
14
14
|
fontWeight: 500,
|
|
15
15
|
},
|
|
16
16
|
h4: {
|
|
17
|
-
fontSize: '2.
|
|
17
|
+
fontSize: '2.2rem',
|
|
18
18
|
fontWeight: 500,
|
|
19
19
|
},
|
|
20
20
|
h5: {
|
|
@@ -27,7 +27,7 @@ export const typography = {
|
|
|
27
27
|
fontWeight: 350,
|
|
28
28
|
},
|
|
29
29
|
body2: {
|
|
30
|
-
fontSize: '1.
|
|
30
|
+
fontSize: '1.7rem',
|
|
31
31
|
fontWeight: 350,
|
|
32
32
|
lineHeight: 1.5,
|
|
33
33
|
},
|