UNPKG

@progress/kendo-react-indicators

Version:

React Indicators offer an interface to represent a visual indication for their UI elements. KendoReact Indicators package

54 lines (53 loc) 1.69 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import * as e from "react"; import n from "prop-types"; import { classNames as p } from "@progress/kendo-react-common"; const r = e.forwardRef((t, m) => { const { className: l, style: i } = t, a = e.useRef(null), u = e.useCallback(() => { a.current && a.current.focus(); }, []); e.useImperativeHandle( m, () => ({ element: a.current, focus: u }) ); const o = e.useMemo(() => t.shape || c.shape, [t.shape]), s = e.useMemo(() => t.animation === !1 ? !1 : t.animation || c.animation, [t.animation]), f = e.useMemo( () => p( "k-skeleton", { "k-skeleton-circle": o === "circle", "k-skeleton-rect": o === "rectangle", "k-skeleton-text": o === "text", "k-skeleton-pulse": typeof s == "object" && s.type === "pulse", "k-skeleton-wave": typeof s == "object" && s.type === "wave" || s === !0 }, l ), [o, s, l] ); return /* @__PURE__ */ e.createElement("span", { ref: a, className: f, style: i }); }); r.propTypes = { className: n.string, style: n.object, animation: n.shape({ type: n.oneOf(["wave", "pulse"]) }), shape: n.oneOf(["circle", "rectangle", "text"]) }; const c = { shape: "text", animation: { type: "pulse" } }; r.displayName = "KendoSkeleton"; export { r as Skeleton };