analytica-frontend-lib 1.0.58 → 1.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/Skeleton/Skeleton.tsx
21
+ var Skeleton_exports = {};
22
+ __export(Skeleton_exports, {
23
+ Skeleton: () => Skeleton,
24
+ SkeletonCard: () => SkeletonCard,
25
+ SkeletonCircle: () => SkeletonCircle,
26
+ SkeletonList: () => SkeletonList,
27
+ SkeletonRectangle: () => SkeletonRectangle,
28
+ SkeletonRounded: () => SkeletonRounded,
29
+ SkeletonTable: () => SkeletonTable,
30
+ SkeletonText: () => SkeletonText
31
+ });
32
+ module.exports = __toCommonJS(Skeleton_exports);
33
+ var import_react = require("react");
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ var SKELETON_ANIMATION_CLASSES = {
36
+ pulse: "animate-pulse",
37
+ none: ""
38
+ };
39
+ var SKELETON_VARIANT_CLASSES = {
40
+ text: "h-4 bg-background-200 rounded",
41
+ circular: "bg-background-200 rounded-full",
42
+ rectangular: "bg-background-200",
43
+ rounded: "bg-background-200 rounded-lg"
44
+ };
45
+ var SPACING_CLASSES = {
46
+ none: "",
47
+ small: "space-y-1",
48
+ medium: "space-y-2",
49
+ large: "space-y-3"
50
+ };
51
+ var Skeleton = (0, import_react.forwardRef)(
52
+ ({
53
+ variant = "text",
54
+ width,
55
+ height,
56
+ animation = "pulse",
57
+ lines = 1,
58
+ spacing = "none",
59
+ className = "",
60
+ children,
61
+ ...props
62
+ }, ref) => {
63
+ const animationClass = SKELETON_ANIMATION_CLASSES[animation];
64
+ const variantClass = SKELETON_VARIANT_CLASSES[variant];
65
+ const spacingClass = SPACING_CLASSES[spacing];
66
+ const style = {
67
+ width: typeof width === "number" ? `${width}px` : width,
68
+ height: typeof height === "number" ? `${height}px` : height
69
+ };
70
+ if (variant === "text" && lines > 1) {
71
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
72
+ "div",
73
+ {
74
+ ref,
75
+ className: `flex flex-col ${spacingClass} ${className}`,
76
+ ...props,
77
+ children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
78
+ "div",
79
+ {
80
+ className: `${variantClass} ${animationClass}`,
81
+ style: index === lines - 1 ? { width: "60%" } : void 0
82
+ },
83
+ index
84
+ ))
85
+ }
86
+ );
87
+ }
88
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
89
+ "div",
90
+ {
91
+ ref,
92
+ className: `${variantClass} ${animationClass} ${className}`,
93
+ style,
94
+ ...props,
95
+ children
96
+ }
97
+ );
98
+ }
99
+ );
100
+ var SkeletonText = (0, import_react.forwardRef)(
101
+ (props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { ref, variant: "text", ...props })
102
+ );
103
+ var SkeletonCircle = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { ref, variant: "circular", ...props }));
104
+ var SkeletonRectangle = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { ref, variant: "rectangular", ...props }));
105
+ var SkeletonRounded = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { ref, variant: "rounded", ...props }));
106
+ var SkeletonCard = (0, import_react.forwardRef)(
107
+ ({
108
+ showAvatar = true,
109
+ showTitle = true,
110
+ showDescription = true,
111
+ showActions = true,
112
+ lines = 2,
113
+ className = "",
114
+ ...props
115
+ }, ref) => {
116
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
117
+ "div",
118
+ {
119
+ ref,
120
+ className: `w-full p-4 bg-background border border-border-200 rounded-lg ${className}`,
121
+ ...props,
122
+ children: [
123
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-start space-x-3", children: [
124
+ showAvatar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkeletonCircle, { width: 40, height: 40 }),
125
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex-1 space-y-2", children: [
126
+ showTitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkeletonText, { width: "60%", height: 20 }),
127
+ showDescription && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkeletonText, { lines, spacing: "small" })
128
+ ] })
129
+ ] }),
130
+ showActions && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex justify-end space-x-2 mt-4", children: [
131
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkeletonRectangle, { width: 80, height: 32 }),
132
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkeletonRectangle, { width: 80, height: 32 })
133
+ ] })
134
+ ]
135
+ }
136
+ );
137
+ }
138
+ );
139
+ var SkeletonList = (0, import_react.forwardRef)(
140
+ ({
141
+ items = 3,
142
+ showAvatar = true,
143
+ showTitle = true,
144
+ showDescription = true,
145
+ lines = 1,
146
+ className = "",
147
+ ...props
148
+ }, ref) => {
149
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: `space-y-3 ${className}`, ...props, children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-start space-x-3 p-3", children: [
150
+ showAvatar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkeletonCircle, { width: 32, height: 32 }),
151
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex-1 space-y-2", children: [
152
+ showTitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkeletonText, { width: "40%", height: 16 }),
153
+ showDescription && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkeletonText, { lines, spacing: "small" })
154
+ ] })
155
+ ] }, index)) });
156
+ }
157
+ );
158
+ var SkeletonTable = (0, import_react.forwardRef)(
159
+ ({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
160
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref, className: `w-full ${className}`, ...props, children: [
161
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
162
+ SkeletonText,
163
+ {
164
+ width: `${100 / columns}%`,
165
+ height: 20
166
+ },
167
+ index
168
+ )) }),
169
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "space-y-2", children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex space-x-2", children: Array.from({ length: columns }, (_2, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
170
+ SkeletonText,
171
+ {
172
+ width: `${100 / columns}%`,
173
+ height: 16
174
+ },
175
+ colIndex
176
+ )) }, rowIndex)) })
177
+ ] });
178
+ }
179
+ );
180
+ // Annotate the CommonJS export names for ESM import in node:
181
+ 0 && (module.exports = {
182
+ Skeleton,
183
+ SkeletonCard,
184
+ SkeletonCircle,
185
+ SkeletonList,
186
+ SkeletonRectangle,
187
+ SkeletonRounded,
188
+ SkeletonTable,
189
+ SkeletonText
190
+ });
191
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import React, { forwardRef, HTMLAttributes } from 'react';\n\ninterface SkeletonProps extends HTMLAttributes<HTMLDivElement> {\n variant?: 'text' | 'circular' | 'rectangular' | 'rounded';\n width?: string | number;\n height?: string | number;\n animation?: 'pulse' | 'none';\n lines?: number;\n spacing?: 'none' | 'small' | 'medium' | 'large';\n}\n\nconst SKELETON_ANIMATION_CLASSES = {\n pulse: 'animate-pulse',\n none: '',\n};\n\nconst SKELETON_VARIANT_CLASSES = {\n text: 'h-4 bg-background-200 rounded',\n circular: 'bg-background-200 rounded-full',\n rectangular: 'bg-background-200',\n rounded: 'bg-background-200 rounded-lg',\n};\n\nconst SPACING_CLASSES = {\n none: '',\n small: 'space-y-1',\n medium: 'space-y-2',\n large: 'space-y-3',\n};\n\nconst Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(\n (\n {\n variant = 'text',\n width,\n height,\n animation = 'pulse',\n lines = 1,\n spacing = 'none',\n className = '',\n children,\n ...props\n },\n ref\n ) => {\n const animationClass = SKELETON_ANIMATION_CLASSES[animation];\n const variantClass = SKELETON_VARIANT_CLASSES[variant];\n const spacingClass = SPACING_CLASSES[spacing];\n\n const style: React.CSSProperties = {\n width: typeof width === 'number' ? `${width}px` : width,\n height: typeof height === 'number' ? `${height}px` : height,\n };\n\n // Se for múltiplas linhas de texto\n if (variant === 'text' && lines > 1) {\n return (\n <div\n ref={ref}\n className={`flex flex-col ${spacingClass} ${className}`}\n {...props}\n >\n {Array.from({ length: lines }, (_, index) => (\n <div\n key={index}\n className={`${variantClass} ${animationClass}`}\n style={index === lines - 1 ? { width: '60%' } : undefined}\n />\n ))}\n </div>\n );\n }\n\n // Se for um único elemento\n return (\n <div\n ref={ref}\n className={`${variantClass} ${animationClass} ${className}`}\n style={style}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\n\n// Componentes específicos para casos comuns\nconst SkeletonText = forwardRef<HTMLDivElement, Omit<SkeletonProps, 'variant'>>(\n (props, ref) => <Skeleton ref={ref} variant=\"text\" {...props} />\n);\n\nconst SkeletonCircle = forwardRef<\n HTMLDivElement,\n Omit<SkeletonProps, 'variant'>\n>((props, ref) => <Skeleton ref={ref} variant=\"circular\" {...props} />);\n\nconst SkeletonRectangle = forwardRef<\n HTMLDivElement,\n Omit<SkeletonProps, 'variant'>\n>((props, ref) => <Skeleton ref={ref} variant=\"rectangular\" {...props} />);\n\nconst SkeletonRounded = forwardRef<\n HTMLDivElement,\n Omit<SkeletonProps, 'variant'>\n>((props, ref) => <Skeleton ref={ref} variant=\"rounded\" {...props} />);\n\n// Componente para card skeleton\ninterface SkeletonCardProps extends HTMLAttributes<HTMLDivElement> {\n showAvatar?: boolean;\n showTitle?: boolean;\n showDescription?: boolean;\n showActions?: boolean;\n lines?: number;\n}\n\nconst SkeletonCard = forwardRef<HTMLDivElement, SkeletonCardProps>(\n (\n {\n showAvatar = true,\n showTitle = true,\n showDescription = true,\n showActions = true,\n lines = 2,\n className = '',\n ...props\n },\n ref\n ) => {\n return (\n <div\n ref={ref}\n className={`w-full p-4 bg-background border border-border-200 rounded-lg ${className}`}\n {...props}\n >\n <div className=\"flex items-start space-x-3\">\n {showAvatar && <SkeletonCircle width={40} height={40} />}\n\n <div className=\"flex-1 space-y-2\">\n {showTitle && <SkeletonText width=\"60%\" height={20} />}\n\n {showDescription && <SkeletonText lines={lines} spacing=\"small\" />}\n </div>\n </div>\n\n {showActions && (\n <div className=\"flex justify-end space-x-2 mt-4\">\n <SkeletonRectangle width={80} height={32} />\n <SkeletonRectangle width={80} height={32} />\n </div>\n )}\n </div>\n );\n }\n);\n\n// Componente para lista skeleton\ninterface SkeletonListProps extends HTMLAttributes<HTMLDivElement> {\n items?: number;\n showAvatar?: boolean;\n showTitle?: boolean;\n showDescription?: boolean;\n lines?: number;\n}\n\nconst SkeletonList = forwardRef<HTMLDivElement, SkeletonListProps>(\n (\n {\n items = 3,\n showAvatar = true,\n showTitle = true,\n showDescription = true,\n lines = 1,\n className = '',\n ...props\n },\n ref\n ) => {\n return (\n <div ref={ref} className={`space-y-3 ${className}`} {...props}>\n {Array.from({ length: items }, (_, index) => (\n <div key={index} className=\"flex items-start space-x-3 p-3\">\n {showAvatar && <SkeletonCircle width={32} height={32} />}\n\n <div className=\"flex-1 space-y-2\">\n {showTitle && <SkeletonText width=\"40%\" height={16} />}\n\n {showDescription && (\n <SkeletonText lines={lines} spacing=\"small\" />\n )}\n </div>\n </div>\n ))}\n </div>\n );\n }\n);\n\n// Componente para tabela skeleton\ninterface SkeletonTableProps extends HTMLAttributes<HTMLDivElement> {\n rows?: number;\n columns?: number;\n showHeader?: boolean;\n}\n\nconst SkeletonTable = forwardRef<HTMLDivElement, SkeletonTableProps>(\n (\n { rows = 5, columns = 4, showHeader = true, className = '', ...props },\n ref\n ) => {\n return (\n <div ref={ref} className={`w-full ${className}`} {...props}>\n {showHeader && (\n <div className=\"flex space-x-2 mb-3\">\n {Array.from({ length: columns }, (_, index) => (\n <SkeletonText\n key={index}\n width={`${100 / columns}%`}\n height={20}\n />\n ))}\n </div>\n )}\n\n <div className=\"space-y-2\">\n {Array.from({ length: rows }, (_, rowIndex) => (\n <div key={rowIndex} className=\"flex space-x-2\">\n {Array.from({ length: columns }, (_, colIndex) => (\n <SkeletonText\n key={colIndex}\n width={`${100 / columns}%`}\n height={16}\n />\n ))}\n </div>\n ))}\n </div>\n </div>\n );\n }\n);\n\nexport {\n Skeleton,\n SkeletonText,\n SkeletonCircle,\n SkeletonRectangle,\n SkeletonRounded,\n SkeletonCard,\n SkeletonList,\n SkeletonTable,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkD;AA+DtC;AApDZ,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AACF;","names":["_"]}
@@ -0,0 +1,159 @@
1
+ // src/components/Skeleton/Skeleton.tsx
2
+ import { forwardRef } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ var SKELETON_ANIMATION_CLASSES = {
5
+ pulse: "animate-pulse",
6
+ none: ""
7
+ };
8
+ var SKELETON_VARIANT_CLASSES = {
9
+ text: "h-4 bg-background-200 rounded",
10
+ circular: "bg-background-200 rounded-full",
11
+ rectangular: "bg-background-200",
12
+ rounded: "bg-background-200 rounded-lg"
13
+ };
14
+ var SPACING_CLASSES = {
15
+ none: "",
16
+ small: "space-y-1",
17
+ medium: "space-y-2",
18
+ large: "space-y-3"
19
+ };
20
+ var Skeleton = forwardRef(
21
+ ({
22
+ variant = "text",
23
+ width,
24
+ height,
25
+ animation = "pulse",
26
+ lines = 1,
27
+ spacing = "none",
28
+ className = "",
29
+ children,
30
+ ...props
31
+ }, ref) => {
32
+ const animationClass = SKELETON_ANIMATION_CLASSES[animation];
33
+ const variantClass = SKELETON_VARIANT_CLASSES[variant];
34
+ const spacingClass = SPACING_CLASSES[spacing];
35
+ const style = {
36
+ width: typeof width === "number" ? `${width}px` : width,
37
+ height: typeof height === "number" ? `${height}px` : height
38
+ };
39
+ if (variant === "text" && lines > 1) {
40
+ return /* @__PURE__ */ jsx(
41
+ "div",
42
+ {
43
+ ref,
44
+ className: `flex flex-col ${spacingClass} ${className}`,
45
+ ...props,
46
+ children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx(
47
+ "div",
48
+ {
49
+ className: `${variantClass} ${animationClass}`,
50
+ style: index === lines - 1 ? { width: "60%" } : void 0
51
+ },
52
+ index
53
+ ))
54
+ }
55
+ );
56
+ }
57
+ return /* @__PURE__ */ jsx(
58
+ "div",
59
+ {
60
+ ref,
61
+ className: `${variantClass} ${animationClass} ${className}`,
62
+ style,
63
+ ...props,
64
+ children
65
+ }
66
+ );
67
+ }
68
+ );
69
+ var SkeletonText = forwardRef(
70
+ (props, ref) => /* @__PURE__ */ jsx(Skeleton, { ref, variant: "text", ...props })
71
+ );
72
+ var SkeletonCircle = forwardRef((props, ref) => /* @__PURE__ */ jsx(Skeleton, { ref, variant: "circular", ...props }));
73
+ var SkeletonRectangle = forwardRef((props, ref) => /* @__PURE__ */ jsx(Skeleton, { ref, variant: "rectangular", ...props }));
74
+ var SkeletonRounded = forwardRef((props, ref) => /* @__PURE__ */ jsx(Skeleton, { ref, variant: "rounded", ...props }));
75
+ var SkeletonCard = forwardRef(
76
+ ({
77
+ showAvatar = true,
78
+ showTitle = true,
79
+ showDescription = true,
80
+ showActions = true,
81
+ lines = 2,
82
+ className = "",
83
+ ...props
84
+ }, ref) => {
85
+ return /* @__PURE__ */ jsxs(
86
+ "div",
87
+ {
88
+ ref,
89
+ className: `w-full p-4 bg-background border border-border-200 rounded-lg ${className}`,
90
+ ...props,
91
+ children: [
92
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start space-x-3", children: [
93
+ showAvatar && /* @__PURE__ */ jsx(SkeletonCircle, { width: 40, height: 40 }),
94
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2", children: [
95
+ showTitle && /* @__PURE__ */ jsx(SkeletonText, { width: "60%", height: 20 }),
96
+ showDescription && /* @__PURE__ */ jsx(SkeletonText, { lines, spacing: "small" })
97
+ ] })
98
+ ] }),
99
+ showActions && /* @__PURE__ */ jsxs("div", { className: "flex justify-end space-x-2 mt-4", children: [
100
+ /* @__PURE__ */ jsx(SkeletonRectangle, { width: 80, height: 32 }),
101
+ /* @__PURE__ */ jsx(SkeletonRectangle, { width: 80, height: 32 })
102
+ ] })
103
+ ]
104
+ }
105
+ );
106
+ }
107
+ );
108
+ var SkeletonList = forwardRef(
109
+ ({
110
+ items = 3,
111
+ showAvatar = true,
112
+ showTitle = true,
113
+ showDescription = true,
114
+ lines = 1,
115
+ className = "",
116
+ ...props
117
+ }, ref) => {
118
+ return /* @__PURE__ */ jsx("div", { ref, className: `space-y-3 ${className}`, ...props, children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ jsxs("div", { className: "flex items-start space-x-3 p-3", children: [
119
+ showAvatar && /* @__PURE__ */ jsx(SkeletonCircle, { width: 32, height: 32 }),
120
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2", children: [
121
+ showTitle && /* @__PURE__ */ jsx(SkeletonText, { width: "40%", height: 16 }),
122
+ showDescription && /* @__PURE__ */ jsx(SkeletonText, { lines, spacing: "small" })
123
+ ] })
124
+ ] }, index)) });
125
+ }
126
+ );
127
+ var SkeletonTable = forwardRef(
128
+ ({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
129
+ return /* @__PURE__ */ jsxs("div", { ref, className: `w-full ${className}`, ...props, children: [
130
+ showHeader && /* @__PURE__ */ jsx("div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ jsx(
131
+ SkeletonText,
132
+ {
133
+ width: `${100 / columns}%`,
134
+ height: 20
135
+ },
136
+ index
137
+ )) }),
138
+ /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ jsx("div", { className: "flex space-x-2", children: Array.from({ length: columns }, (_2, colIndex) => /* @__PURE__ */ jsx(
139
+ SkeletonText,
140
+ {
141
+ width: `${100 / columns}%`,
142
+ height: 16
143
+ },
144
+ colIndex
145
+ )) }, rowIndex)) })
146
+ ] });
147
+ }
148
+ );
149
+ export {
150
+ Skeleton,
151
+ SkeletonCard,
152
+ SkeletonCircle,
153
+ SkeletonList,
154
+ SkeletonRectangle,
155
+ SkeletonRounded,
156
+ SkeletonTable,
157
+ SkeletonText
158
+ };
159
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import React, { forwardRef, HTMLAttributes } from 'react';\n\ninterface SkeletonProps extends HTMLAttributes<HTMLDivElement> {\n variant?: 'text' | 'circular' | 'rectangular' | 'rounded';\n width?: string | number;\n height?: string | number;\n animation?: 'pulse' | 'none';\n lines?: number;\n spacing?: 'none' | 'small' | 'medium' | 'large';\n}\n\nconst SKELETON_ANIMATION_CLASSES = {\n pulse: 'animate-pulse',\n none: '',\n};\n\nconst SKELETON_VARIANT_CLASSES = {\n text: 'h-4 bg-background-200 rounded',\n circular: 'bg-background-200 rounded-full',\n rectangular: 'bg-background-200',\n rounded: 'bg-background-200 rounded-lg',\n};\n\nconst SPACING_CLASSES = {\n none: '',\n small: 'space-y-1',\n medium: 'space-y-2',\n large: 'space-y-3',\n};\n\nconst Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(\n (\n {\n variant = 'text',\n width,\n height,\n animation = 'pulse',\n lines = 1,\n spacing = 'none',\n className = '',\n children,\n ...props\n },\n ref\n ) => {\n const animationClass = SKELETON_ANIMATION_CLASSES[animation];\n const variantClass = SKELETON_VARIANT_CLASSES[variant];\n const spacingClass = SPACING_CLASSES[spacing];\n\n const style: React.CSSProperties = {\n width: typeof width === 'number' ? `${width}px` : width,\n height: typeof height === 'number' ? `${height}px` : height,\n };\n\n // Se for múltiplas linhas de texto\n if (variant === 'text' && lines > 1) {\n return (\n <div\n ref={ref}\n className={`flex flex-col ${spacingClass} ${className}`}\n {...props}\n >\n {Array.from({ length: lines }, (_, index) => (\n <div\n key={index}\n className={`${variantClass} ${animationClass}`}\n style={index === lines - 1 ? { width: '60%' } : undefined}\n />\n ))}\n </div>\n );\n }\n\n // Se for um único elemento\n return (\n <div\n ref={ref}\n className={`${variantClass} ${animationClass} ${className}`}\n style={style}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\n\n// Componentes específicos para casos comuns\nconst SkeletonText = forwardRef<HTMLDivElement, Omit<SkeletonProps, 'variant'>>(\n (props, ref) => <Skeleton ref={ref} variant=\"text\" {...props} />\n);\n\nconst SkeletonCircle = forwardRef<\n HTMLDivElement,\n Omit<SkeletonProps, 'variant'>\n>((props, ref) => <Skeleton ref={ref} variant=\"circular\" {...props} />);\n\nconst SkeletonRectangle = forwardRef<\n HTMLDivElement,\n Omit<SkeletonProps, 'variant'>\n>((props, ref) => <Skeleton ref={ref} variant=\"rectangular\" {...props} />);\n\nconst SkeletonRounded = forwardRef<\n HTMLDivElement,\n Omit<SkeletonProps, 'variant'>\n>((props, ref) => <Skeleton ref={ref} variant=\"rounded\" {...props} />);\n\n// Componente para card skeleton\ninterface SkeletonCardProps extends HTMLAttributes<HTMLDivElement> {\n showAvatar?: boolean;\n showTitle?: boolean;\n showDescription?: boolean;\n showActions?: boolean;\n lines?: number;\n}\n\nconst SkeletonCard = forwardRef<HTMLDivElement, SkeletonCardProps>(\n (\n {\n showAvatar = true,\n showTitle = true,\n showDescription = true,\n showActions = true,\n lines = 2,\n className = '',\n ...props\n },\n ref\n ) => {\n return (\n <div\n ref={ref}\n className={`w-full p-4 bg-background border border-border-200 rounded-lg ${className}`}\n {...props}\n >\n <div className=\"flex items-start space-x-3\">\n {showAvatar && <SkeletonCircle width={40} height={40} />}\n\n <div className=\"flex-1 space-y-2\">\n {showTitle && <SkeletonText width=\"60%\" height={20} />}\n\n {showDescription && <SkeletonText lines={lines} spacing=\"small\" />}\n </div>\n </div>\n\n {showActions && (\n <div className=\"flex justify-end space-x-2 mt-4\">\n <SkeletonRectangle width={80} height={32} />\n <SkeletonRectangle width={80} height={32} />\n </div>\n )}\n </div>\n );\n }\n);\n\n// Componente para lista skeleton\ninterface SkeletonListProps extends HTMLAttributes<HTMLDivElement> {\n items?: number;\n showAvatar?: boolean;\n showTitle?: boolean;\n showDescription?: boolean;\n lines?: number;\n}\n\nconst SkeletonList = forwardRef<HTMLDivElement, SkeletonListProps>(\n (\n {\n items = 3,\n showAvatar = true,\n showTitle = true,\n showDescription = true,\n lines = 1,\n className = '',\n ...props\n },\n ref\n ) => {\n return (\n <div ref={ref} className={`space-y-3 ${className}`} {...props}>\n {Array.from({ length: items }, (_, index) => (\n <div key={index} className=\"flex items-start space-x-3 p-3\">\n {showAvatar && <SkeletonCircle width={32} height={32} />}\n\n <div className=\"flex-1 space-y-2\">\n {showTitle && <SkeletonText width=\"40%\" height={16} />}\n\n {showDescription && (\n <SkeletonText lines={lines} spacing=\"small\" />\n )}\n </div>\n </div>\n ))}\n </div>\n );\n }\n);\n\n// Componente para tabela skeleton\ninterface SkeletonTableProps extends HTMLAttributes<HTMLDivElement> {\n rows?: number;\n columns?: number;\n showHeader?: boolean;\n}\n\nconst SkeletonTable = forwardRef<HTMLDivElement, SkeletonTableProps>(\n (\n { rows = 5, columns = 4, showHeader = true, className = '', ...props },\n ref\n ) => {\n return (\n <div ref={ref} className={`w-full ${className}`} {...props}>\n {showHeader && (\n <div className=\"flex space-x-2 mb-3\">\n {Array.from({ length: columns }, (_, index) => (\n <SkeletonText\n key={index}\n width={`${100 / columns}%`}\n height={20}\n />\n ))}\n </div>\n )}\n\n <div className=\"space-y-2\">\n {Array.from({ length: rows }, (_, rowIndex) => (\n <div key={rowIndex} className=\"flex space-x-2\">\n {Array.from({ length: columns }, (_, colIndex) => (\n <SkeletonText\n key={colIndex}\n width={`${100 / columns}%`}\n height={16}\n />\n ))}\n </div>\n ))}\n </div>\n </div>\n );\n }\n);\n\nexport {\n Skeleton,\n SkeletonText,\n SkeletonCircle,\n SkeletonRectangle,\n SkeletonRounded,\n SkeletonCard,\n SkeletonList,\n SkeletonTable,\n};\n"],"mappings":";AAAA,SAAgB,kBAAkC;AA+DtC,cA2EF,YA3EE;AApDZ,IAAM,6BAA6B;AAAA,EACjC,OAAO;AAAA,EACP,MAAM;AACR;AAEA,IAAM,2BAA2B;AAAA,EAC/B,MAAM;AAAA,EACN,UAAU;AAAA,EACV,aAAa;AAAA,EACb,SAAS;AACX;AAEA,IAAM,kBAAkB;AAAA,EACtB,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACT;AAEA,IAAM,WAAW;AAAA,EACf,CACE;AAAA,IACE,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,Y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