analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
167 lines (155 loc) • 6.74 kB
JavaScript
;Object.defineProperty(exports, "__esModule", {value: true});
var _chunkTN3AYOMVjs = require('./chunk-TN3AYOMV.js');
// src/components/Skeleton/Skeleton.tsx
var _react = require('react');
var _jsxruntime = require('react/jsx-runtime');
var SKELETON_ANIMATION_CLASSES = {
pulse: "animate-pulse",
none: ""
};
var SKELETON_VARIANT_CLASSES = {
text: "h-4 bg-background-200 rounded",
circular: "bg-background-200 rounded-full",
rectangular: "bg-background-200",
rounded: "bg-background-200 rounded-lg"
};
var SPACING_CLASSES = {
none: "",
small: "space-y-1",
medium: "space-y-2",
large: "space-y-3"
};
var Skeleton = _react.forwardRef.call(void 0,
({
variant = "text",
width,
height,
animation = "pulse",
lines = 1,
spacing = "none",
className = "",
children,
...props
}, ref) => {
const animationClass = SKELETON_ANIMATION_CLASSES[animation];
const variantClass = SKELETON_VARIANT_CLASSES[variant];
const spacingClass = SPACING_CLASSES[spacing];
const style = {
width: typeof width === "number" ? `${width}px` : width,
height: typeof height === "number" ? `${height}px` : height
};
if (variant === "text" && lines > 1) {
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
"div",
{
ref,
className: _chunkTN3AYOMVjs.cn.call(void 0, "flex flex-col", spacingClass, className),
...props,
children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
"div",
{
className: _chunkTN3AYOMVjs.cn.call(void 0, variantClass, animationClass),
style: index === lines - 1 ? { width: "60%" } : void 0
},
index
))
}
);
}
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
"div",
{
ref,
className: _chunkTN3AYOMVjs.cn.call(void 0, variantClass, animationClass, className),
style,
...props,
children
}
);
}
);
var SkeletonText = _react.forwardRef.call(void 0,
(props, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { ref, variant: "text", ...props })
);
var SkeletonCircle = _react.forwardRef.call(void 0, (props, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { ref, variant: "circular", ...props }));
var SkeletonRectangle = _react.forwardRef.call(void 0, (props, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { ref, variant: "rectangular", ...props }));
var SkeletonRounded = _react.forwardRef.call(void 0, (props, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { ref, variant: "rounded", ...props }));
var SkeletonCard = _react.forwardRef.call(void 0,
({
showAvatar = true,
showTitle = true,
showDescription = true,
showActions = true,
lines = 2,
className = "",
...props
}, ref) => {
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
"div",
{
ref,
className: _chunkTN3AYOMVjs.cn.call(void 0,
"w-full p-4 bg-background border border-border-200 rounded-lg",
className
),
...props,
children: [
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start space-x-3", children: [
showAvatar && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SkeletonCircle, { width: 40, height: 40 }),
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 space-y-2", children: [
showTitle && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SkeletonText, { width: "60%", height: 20 }),
showDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SkeletonText, { lines, spacing: "small" })
] })
] }),
showActions && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end space-x-2 mt-4", children: [
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SkeletonRectangle, { width: 80, height: 32 }),
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SkeletonRectangle, { width: 80, height: 32 })
] })
]
}
);
}
);
var SkeletonList = _react.forwardRef.call(void 0,
({
items = 3,
showAvatar = true,
showTitle = true,
showDescription = true,
lines = 1,
className = "",
...props
}, ref) => {
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref, className: _chunkTN3AYOMVjs.cn.call(void 0, "space-y-3", className), ...props, children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start space-x-3 p-3", children: [
showAvatar && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SkeletonCircle, { width: 32, height: 32 }),
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 space-y-2", children: [
showTitle && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SkeletonText, { width: "40%", height: 16 }),
showDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SkeletonText, { lines, spacing: "small" })
] })
] }, index)) });
}
);
var SkeletonTable = _react.forwardRef.call(void 0,
({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref, className: _chunkTN3AYOMVjs.cn.call(void 0, "w-full", className), ...props, children: [
showHeader && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
SkeletonText,
{
width: `${100 / columns}%`,
height: 20
},
index
)) }),
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-2", children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex space-x-2", children: Array.from({ length: columns }, (_2, colIndex) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
SkeletonText,
{
width: `${100 / columns}%`,
height: 16
},
colIndex
)) }, rowIndex)) })
] });
}
);
exports.Skeleton = Skeleton; exports.SkeletonText = SkeletonText; exports.SkeletonCircle = SkeletonCircle; exports.SkeletonRectangle = SkeletonRectangle; exports.SkeletonRounded = SkeletonRounded; exports.SkeletonCard = SkeletonCard; exports.SkeletonList = SkeletonList; exports.SkeletonTable = SkeletonTable;
//# sourceMappingURL=chunk-NEDUOGWU.js.map