UNPKG

@chakra-ui/react

Version:

Responsive and accessible React UI components built with React and Emotion

37 lines (34 loc) 1.34 kB
"use strict"; "use client"; import { jsx } from 'react/jsx-runtime'; import * as React from 'react'; import { Circle } from '../circle/index.js'; import { createRecipeContext } from '../../styled-system/create-recipe-context.js'; import { Stack } from '../stack/stack.js'; const { withContext, PropsProvider } = createRecipeContext({ key: "skeleton" }); const Skeleton = withContext("div"); Skeleton.displayName = "Skeleton"; const SkeletonPropsProvider = PropsProvider; const SkeletonCircle = React.forwardRef(function SkeletonCircle2(props, ref) { const { size, ...rest } = props; return /* @__PURE__ */ jsx(Circle, { size, asChild: true, ref, children: /* @__PURE__ */ jsx(Skeleton, { ...rest }) }); }); SkeletonCircle.displayName = "SkeletonCircle"; const SkeletonText = React.forwardRef( function SkeletonText2(props, ref) { const { noOfLines = 3, gap, rootProps, ...rest } = props; return /* @__PURE__ */ jsx(Stack, { gap, width: "full", ref, ...rootProps, children: Array.from({ length: noOfLines }).map((_, index) => /* @__PURE__ */ jsx( Skeleton, { height: "4", _last: { maxW: noOfLines === 1 ? "100%" : "80%" }, ...rest }, index )) }); } ); SkeletonText.displayName = "SkeletonText"; export { Skeleton, SkeletonCircle, SkeletonPropsProvider, SkeletonText };