1- import { BusyIndicator } from '@ui5/webcomponents-react/BusyIndicator' ;
2- import { Label } from '@ui5/webcomponents-react/Label' ;
31import { useStylesheet } from '@ui5/webcomponents-react-base/internal/hooks' ;
42import type { CommonProps } from '@ui5/webcomponents-react-base/internal/types' ;
5- import { addCustomCSSWithScoping } from '@ui5/webcomponents-react-base/internal/utils' ;
63import { clsx } from 'clsx' ;
74import type { ComponentType , ReactElement , ReactNode } from 'react' ;
85import { Component , forwardRef } from 'react' ;
96import { ResponsiveContainer } from 'recharts' ;
7+ import { ChartBusyIndicator } from './ChartBusyIndicator.js' ;
108import { classNames , styleData } from './ChartContainer.module.css.js' ;
119
12- addCustomCSSWithScoping (
13- 'ui5-busy-indicator' ,
14- `
15- :host([data-component-name="ChartContainerBusyIndicator"]) .ui5-busy-indicator-busy-area{
16- background:unset;
17- },
18- :host([data-component-name="ChartContainerBusyIndicator"]) .ui5-busy-indicator-busy-area:focus {
19- border-radius: 0;
20- }
21- ` ,
22- ) ;
23-
2410export interface ContainerProps extends CommonProps {
2511 children : ReactElement ;
2612 Placeholder : ComponentType ;
@@ -43,7 +29,7 @@ class ErrorBoundary extends Component<{ children: ReactNode }, { errorCount: num
4329
4430 render ( ) {
4531 if ( this . state . errorCount >= 3 ) {
46- return < Label > Sorry, something went wrong while rendering this chart!</ Label > ;
32+ return < span className = { classNames . errorMessage } > Sorry, something went wrong while rendering this chart!</ span > ;
4733 }
4834 return this . props . children ;
4935 }
@@ -58,7 +44,7 @@ const ChartContainer = forwardRef<HTMLDivElement, ContainerProps>((props, ref) =
5844 slot,
5945 children,
6046 resizeDebounce,
61- loadingDelay,
47+ loadingDelay = 1000 ,
6248 ...rest
6349 } = props ;
6450
@@ -68,14 +54,7 @@ const ChartContainer = forwardRef<HTMLDivElement, ContainerProps>((props, ref) =
6854 < div ref = { ref } className = { clsx ( classNames . container , className ) } slot = { slot } { ...rest } >
6955 { dataset ?. length > 0 ? (
7056 < >
71- { loading && (
72- < BusyIndicator
73- active
74- delay = { loadingDelay }
75- className = { classNames . busyIndicator }
76- data-component-name = "ChartContainerBusyIndicator"
77- />
78- ) }
57+ { loading && < ChartBusyIndicator delay = { loadingDelay } className = { classNames . busyIndicator } /> }
7958 < ErrorBoundary >
8059 < ResponsiveContainer debounce = { resizeDebounce } > { children } </ ResponsiveContainer >
8160 </ ErrorBoundary >
0 commit comments