@kubit-ui-web/react-components
Version:
Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience
24 lines • 1.29 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import React from 'react';
import { useStyles } from '../../hooks/useStyles/useStyles';
import { ErrorBoundary } from '../../provider/errorBoundary/errorBoundary';
import { FallbackComponent } from '../../provider/errorBoundary/fallbackComponent';
import { SkeletonStandAlone } from './skeletonStandAlone';
const SKELETON_STYLES = 'SKELETON_STYLES';
const SkeletonComponent = React.forwardRef((props, ref) => {
const shapeStyles = useStyles(SKELETON_STYLES, props.shapeVariant, props.ctv);
const styles = shapeStyles?.[props.variant];
return _jsx(SkeletonStandAlone, { ...props, ref: ref, styles: styles });
});
SkeletonComponent.displayName = 'SkeletonComponent';
const SkeletonBoundary = (props, ref) => (_jsx(ErrorBoundary, { fallBackComponent: _jsx(FallbackComponent, { children: _jsx(SkeletonStandAlone, { ...props, ref: ref }) }), children: _jsx(SkeletonComponent, { ...props, ref: ref }) }));
/**
* @description
* Skeleton coponents is a loading component that can be used to show a loading state of a component.
* @param {React.PropsWithChildren<ISkeleton<V>>} props
* @returns {JSX.Element}
* @constructor
*/
const Skeleton = React.forwardRef(SkeletonBoundary);
export { Skeleton };
//# sourceMappingURL=skeleton.js.map