UNPKG

@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

30 lines 1.79 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Skeleton = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = __importDefault(require("react")); const useStyles_1 = require("../../hooks/useStyles/useStyles"); const errorBoundary_1 = require("../../provider/errorBoundary/errorBoundary"); const fallbackComponent_1 = require("../../provider/errorBoundary/fallbackComponent"); const skeletonStandAlone_1 = require("./skeletonStandAlone"); const SKELETON_STYLES = 'SKELETON_STYLES'; const SkeletonComponent = react_1.default.forwardRef((props, ref) => { const shapeStyles = (0, useStyles_1.useStyles)(SKELETON_STYLES, props.shapeVariant, props.ctv); const styles = shapeStyles?.[props.variant]; return (0, jsx_runtime_1.jsx)(skeletonStandAlone_1.SkeletonStandAlone, { ...props, ref: ref, styles: styles }); }); SkeletonComponent.displayName = 'SkeletonComponent'; const SkeletonBoundary = (props, ref) => ((0, jsx_runtime_1.jsx)(errorBoundary_1.ErrorBoundary, { fallBackComponent: (0, jsx_runtime_1.jsx)(fallbackComponent_1.FallbackComponent, { children: (0, jsx_runtime_1.jsx)(skeletonStandAlone_1.SkeletonStandAlone, { ...props, ref: ref }) }), children: (0, jsx_runtime_1.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_1.default.forwardRef(SkeletonBoundary); exports.Skeleton = Skeleton; //# sourceMappingURL=skeleton.js.map