premium-react-loaders 1.3.0 → 2.1.0

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.
Files changed (138) hide show
  1. package/README.md +264 -30
  2. package/dist/components/pulse/TypingIndicator.d.ts.map +1 -1
  3. package/dist/context/ThemeContext.d.ts +84 -0
  4. package/dist/context/ThemeContext.d.ts.map +1 -0
  5. package/dist/context/index.d.ts +3 -0
  6. package/dist/context/index.d.ts.map +1 -0
  7. package/dist/hooks/index.d.ts +3 -0
  8. package/dist/hooks/index.d.ts.map +1 -0
  9. package/dist/hooks/useLoader.d.ts +56 -0
  10. package/dist/hooks/useLoader.d.ts.map +1 -0
  11. package/dist/index.cjs +31 -27
  12. package/dist/index.d.ts +5 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +31 -27
  15. package/dist/index10.cjs +20 -32
  16. package/dist/index10.js +20 -32
  17. package/dist/index11.cjs +47 -26
  18. package/dist/index11.js +47 -26
  19. package/dist/index12.cjs +30 -127
  20. package/dist/index12.js +31 -128
  21. package/dist/index13.cjs +30 -54
  22. package/dist/index13.js +30 -54
  23. package/dist/index14.cjs +127 -44
  24. package/dist/index14.js +128 -45
  25. package/dist/index15.cjs +58 -38
  26. package/dist/index15.js +59 -39
  27. package/dist/index16.cjs +24 -37
  28. package/dist/index16.js +24 -37
  29. package/dist/index17.cjs +19 -22
  30. package/dist/index17.js +19 -22
  31. package/dist/index18.cjs +25 -21
  32. package/dist/index18.js +25 -21
  33. package/dist/index19.cjs +22 -33
  34. package/dist/index19.js +22 -33
  35. package/dist/index20.cjs +26 -36
  36. package/dist/index20.js +28 -38
  37. package/dist/index21.cjs +40 -77
  38. package/dist/index21.js +42 -79
  39. package/dist/index22.cjs +53 -103
  40. package/dist/index22.js +54 -104
  41. package/dist/index23.cjs +46 -81
  42. package/dist/index23.js +47 -82
  43. package/dist/index24.cjs +105 -104
  44. package/dist/index24.js +107 -106
  45. package/dist/index25.cjs +108 -28
  46. package/dist/index25.js +111 -31
  47. package/dist/index26.cjs +104 -37
  48. package/dist/index26.js +106 -39
  49. package/dist/index27.cjs +22 -31
  50. package/dist/index27.js +23 -32
  51. package/dist/index28.cjs +30 -30
  52. package/dist/index28.js +31 -31
  53. package/dist/index29.cjs +49 -53
  54. package/dist/index29.js +50 -54
  55. package/dist/index3.cjs +11 -3
  56. package/dist/index3.js +11 -3
  57. package/dist/index30.cjs +77 -17
  58. package/dist/index30.js +76 -16
  59. package/dist/index31.cjs +77 -121
  60. package/dist/index31.js +78 -122
  61. package/dist/index32.cjs +125 -0
  62. package/dist/index32.js +125 -0
  63. package/dist/index4.cjs +0 -1
  64. package/dist/index4.js +0 -1
  65. package/dist/index5.cjs +11 -73
  66. package/dist/index5.js +12 -74
  67. package/dist/index6.cjs +86 -66
  68. package/dist/index6.js +87 -67
  69. package/dist/index7.cjs +40 -21
  70. package/dist/index7.js +40 -21
  71. package/dist/index8.cjs +34 -22
  72. package/dist/index8.js +34 -22
  73. package/dist/index9.cjs +21 -56
  74. package/dist/index9.js +22 -57
  75. package/dist/premium-react-loaders.css +250 -1073
  76. package/dist/utils/classNames.d.ts +3 -2
  77. package/dist/utils/classNames.d.ts.map +1 -1
  78. package/package.json +5 -8
  79. package/dist/index.cjs.map +0 -1
  80. package/dist/index.js.map +0 -1
  81. package/dist/index10.cjs.map +0 -1
  82. package/dist/index10.js.map +0 -1
  83. package/dist/index11.cjs.map +0 -1
  84. package/dist/index11.js.map +0 -1
  85. package/dist/index12.cjs.map +0 -1
  86. package/dist/index12.js.map +0 -1
  87. package/dist/index13.cjs.map +0 -1
  88. package/dist/index13.js.map +0 -1
  89. package/dist/index14.cjs.map +0 -1
  90. package/dist/index14.js.map +0 -1
  91. package/dist/index15.cjs.map +0 -1
  92. package/dist/index15.js.map +0 -1
  93. package/dist/index16.cjs.map +0 -1
  94. package/dist/index16.js.map +0 -1
  95. package/dist/index17.cjs.map +0 -1
  96. package/dist/index17.js.map +0 -1
  97. package/dist/index18.cjs.map +0 -1
  98. package/dist/index18.js.map +0 -1
  99. package/dist/index19.cjs.map +0 -1
  100. package/dist/index19.js.map +0 -1
  101. package/dist/index20.cjs.map +0 -1
  102. package/dist/index20.js.map +0 -1
  103. package/dist/index21.cjs.map +0 -1
  104. package/dist/index21.js.map +0 -1
  105. package/dist/index22.cjs.map +0 -1
  106. package/dist/index22.js.map +0 -1
  107. package/dist/index23.cjs.map +0 -1
  108. package/dist/index23.js.map +0 -1
  109. package/dist/index24.cjs.map +0 -1
  110. package/dist/index24.js.map +0 -1
  111. package/dist/index25.cjs.map +0 -1
  112. package/dist/index25.js.map +0 -1
  113. package/dist/index26.cjs.map +0 -1
  114. package/dist/index26.js.map +0 -1
  115. package/dist/index27.cjs.map +0 -1
  116. package/dist/index27.js.map +0 -1
  117. package/dist/index28.cjs.map +0 -1
  118. package/dist/index28.js.map +0 -1
  119. package/dist/index29.cjs.map +0 -1
  120. package/dist/index29.js.map +0 -1
  121. package/dist/index3.cjs.map +0 -1
  122. package/dist/index3.js.map +0 -1
  123. package/dist/index30.cjs.map +0 -1
  124. package/dist/index30.js.map +0 -1
  125. package/dist/index31.cjs.map +0 -1
  126. package/dist/index31.js.map +0 -1
  127. package/dist/index4.cjs.map +0 -1
  128. package/dist/index4.js.map +0 -1
  129. package/dist/index5.cjs.map +0 -1
  130. package/dist/index5.js.map +0 -1
  131. package/dist/index6.cjs.map +0 -1
  132. package/dist/index6.js.map +0 -1
  133. package/dist/index7.cjs.map +0 -1
  134. package/dist/index7.js.map +0 -1
  135. package/dist/index8.cjs.map +0 -1
  136. package/dist/index8.js.map +0 -1
  137. package/dist/index9.cjs.map +0 -1
  138. package/dist/index9.js.map +0 -1
package/dist/index12.js CHANGED
@@ -1,22 +1,25 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { Skeleton } from "./index5.js";
4
- import { SkeletonText } from "./index6.js";
5
- import { SkeletonAvatar } from "./index7.js";
6
- import { useLoaderVisibility } from "./index31.js";
3
+ import { Skeleton } from "./index7.js";
4
+ import { useLoaderVisibility } from "./index32.js";
5
+ import { normalizeSize } from "./index4.js";
7
6
  import { cn } from "./index3.js";
8
- const SkeletonPage = forwardRef(
7
+ const SkeletonList = forwardRef(
9
8
  ({
10
- variant = "default",
9
+ items = 3,
10
+ itemHeight = "3rem",
11
+ gap = "0.75rem",
12
+ width = "100%",
11
13
  animate = true,
12
- baseColor = "#e0e0e0",
13
- highlightColor = "#f5f5f5",
14
+ baseColor,
15
+ highlightColor,
16
+ borderRadius = "0.5rem",
14
17
  delay = 0,
15
18
  minDuration = 0,
16
19
  transition,
17
20
  className,
18
21
  style,
19
- testId = "skeleton-page",
22
+ testId = "skeleton-list",
20
23
  visible = true,
21
24
  ...rest
22
25
  }, ref) => {
@@ -27,140 +30,40 @@ const SkeletonPage = forwardRef(
27
30
  transition
28
31
  );
29
32
  if (!shouldRender) return null;
30
- const commonProps = {
31
- animate,
32
- baseColor,
33
- highlightColor
34
- };
35
- const renderDefault = () => /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
36
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b pb-4", children: [
37
- /* @__PURE__ */ jsx(Skeleton, { width: 200, height: 32, ...commonProps }),
38
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
39
- /* @__PURE__ */ jsx(Skeleton, { width: 100, height: 36, borderRadius: 6, ...commonProps }),
40
- /* @__PURE__ */ jsx(SkeletonAvatar, { size: 40, ...commonProps })
41
- ] })
42
- ] }),
43
- /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
44
- /* @__PURE__ */ jsx(SkeletonText, { lines: 3, ...commonProps }),
45
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-4", children: [
46
- /* @__PURE__ */ jsx(Skeleton, { height: 120, borderRadius: 8, ...commonProps }),
47
- /* @__PURE__ */ jsx(Skeleton, { height: 120, borderRadius: 8, ...commonProps }),
48
- /* @__PURE__ */ jsx(Skeleton, { height: 120, borderRadius: 8, ...commonProps })
49
- ] }),
50
- /* @__PURE__ */ jsx(SkeletonText, { lines: 5, ...commonProps })
51
- ] })
52
- ] });
53
- const renderDashboard = () => /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
54
- /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
55
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
56
- /* @__PURE__ */ jsx(Skeleton, { width: 180, height: 28, ...commonProps }),
57
- /* @__PURE__ */ jsx(Skeleton, { width: 120, height: 36, borderRadius: 6, ...commonProps })
58
- ] }),
59
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-4 gap-4", children: [...Array(4)].map((_, i) => /* @__PURE__ */ jsxs("div", { className: "p-4 border rounded-lg space-y-2", children: [
60
- /* @__PURE__ */ jsx(Skeleton, { width: 100, height: 16, ...commonProps }),
61
- /* @__PURE__ */ jsx(Skeleton, { width: 80, height: 32, ...commonProps }),
62
- /* @__PURE__ */ jsx(Skeleton, { width: 60, height: 12, ...commonProps })
63
- ] }, i)) })
64
- ] }),
65
- /* @__PURE__ */ jsx(Skeleton, { height: 300, borderRadius: 8, ...commonProps }),
66
- /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
67
- /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
68
- /* @__PURE__ */ jsx(Skeleton, { width: 150, height: 20, ...commonProps }),
69
- /* @__PURE__ */ jsx(Skeleton, { width: 150, height: 20, ...commonProps }),
70
- /* @__PURE__ */ jsx(Skeleton, { width: 150, height: 20, ...commonProps })
71
- ] }),
72
- [...Array(5)].map((_, i) => /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
73
- /* @__PURE__ */ jsx(Skeleton, { width: 150, height: 16, ...commonProps }),
74
- /* @__PURE__ */ jsx(Skeleton, { width: 150, height: 16, ...commonProps }),
75
- /* @__PURE__ */ jsx(Skeleton, { width: 150, height: 16, ...commonProps })
76
- ] }, i))
77
- ] })
78
- ] });
79
- const renderArticle = () => /* @__PURE__ */ jsxs("div", { className: "max-w-3xl mx-auto space-y-6", children: [
80
- /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
81
- /* @__PURE__ */ jsx(Skeleton, { width: "80%", height: 40, ...commonProps }),
82
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
83
- /* @__PURE__ */ jsx(SkeletonAvatar, { size: 48, ...commonProps }),
84
- /* @__PURE__ */ jsxs("div", { className: "space-y-2 flex-1", children: [
85
- /* @__PURE__ */ jsx(Skeleton, { width: 120, height: 16, ...commonProps }),
86
- /* @__PURE__ */ jsx(Skeleton, { width: 180, height: 14, ...commonProps })
87
- ] })
88
- ] })
89
- ] }),
90
- /* @__PURE__ */ jsx(Skeleton, { height: 400, borderRadius: 8, ...commonProps }),
91
- /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
92
- /* @__PURE__ */ jsx(SkeletonText, { lines: 4, ...commonProps }),
93
- /* @__PURE__ */ jsx(Skeleton, { height: 200, borderRadius: 8, ...commonProps }),
94
- /* @__PURE__ */ jsx(SkeletonText, { lines: 6, ...commonProps }),
95
- /* @__PURE__ */ jsx(Skeleton, { height: 250, borderRadius: 8, ...commonProps }),
96
- /* @__PURE__ */ jsx(SkeletonText, { lines: 4, ...commonProps })
97
- ] })
98
- ] });
99
- const renderProfile = () => /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
100
- /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-6 border-b pb-6", children: [
101
- /* @__PURE__ */ jsx(SkeletonAvatar, { size: 120, ...commonProps }),
102
- /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-3", children: [
103
- /* @__PURE__ */ jsx(Skeleton, { width: 200, height: 32, ...commonProps }),
104
- /* @__PURE__ */ jsx(Skeleton, { width: 150, height: 20, ...commonProps }),
105
- /* @__PURE__ */ jsx(SkeletonText, { lines: 2, ...commonProps }),
106
- /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
107
- /* @__PURE__ */ jsx(Skeleton, { width: 100, height: 36, borderRadius: 6, ...commonProps }),
108
- /* @__PURE__ */ jsx(Skeleton, { width: 100, height: 36, borderRadius: 6, ...commonProps })
109
- ] })
110
- ] })
111
- ] }),
112
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-6", children: [
113
- /* @__PURE__ */ jsx("div", { className: "space-y-4", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
114
- /* @__PURE__ */ jsx(Skeleton, { width: 100, height: 20, ...commonProps }),
115
- [...Array(4)].map((_, i) => /* @__PURE__ */ jsx(Skeleton, { height: 16, ...commonProps }, i))
116
- ] }) }),
117
- /* @__PURE__ */ jsx("div", { className: "col-span-2 space-y-4", children: [...Array(3)].map((_, i) => /* @__PURE__ */ jsxs("div", { className: "p-4 border rounded-lg space-y-3", children: [
118
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
119
- /* @__PURE__ */ jsx(SkeletonAvatar, { size: 40, ...commonProps }),
120
- /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2", children: [
121
- /* @__PURE__ */ jsx(Skeleton, { width: 150, height: 16, ...commonProps }),
122
- /* @__PURE__ */ jsx(Skeleton, { width: 100, height: 12, ...commonProps })
123
- ] })
124
- ] }),
125
- /* @__PURE__ */ jsx(SkeletonText, { lines: 2, ...commonProps }),
126
- /* @__PURE__ */ jsx(Skeleton, { height: 200, borderRadius: 6, ...commonProps })
127
- ] }, i)) })
128
- ] })
129
- ] });
130
- const renderContent = () => {
131
- switch (variant) {
132
- case "dashboard":
133
- return renderDashboard();
134
- case "article":
135
- return renderArticle();
136
- case "profile":
137
- return renderProfile();
138
- default:
139
- return renderDefault();
140
- }
141
- };
142
33
  return /* @__PURE__ */ jsx(
143
34
  "div",
144
35
  {
145
36
  ref,
146
37
  "data-testid": testId,
147
- className: cn("w-full p-6", className),
38
+ className: cn("flex flex-col", className),
148
39
  style: {
40
+ gap: normalizeSize(gap),
149
41
  ...style,
150
42
  opacity,
151
43
  transition: transitionStyle
152
44
  },
153
45
  role: "status",
154
- "aria-label": "Loading page...",
46
+ "aria-label": "Loading list...",
155
47
  "aria-busy": "true",
156
48
  ...rest,
157
- children: renderContent()
49
+ children: Array.from({ length: items }).map((_, index) => /* @__PURE__ */ jsx(
50
+ Skeleton,
51
+ {
52
+ width,
53
+ height: itemHeight,
54
+ variant: "rounded",
55
+ borderRadius,
56
+ animate,
57
+ baseColor,
58
+ highlightColor
59
+ },
60
+ index
61
+ ))
158
62
  }
159
63
  );
160
64
  }
161
65
  );
162
- SkeletonPage.displayName = "SkeletonPage";
66
+ SkeletonList.displayName = "SkeletonList";
163
67
  export {
164
- SkeletonPage
68
+ SkeletonList
165
69
  };
166
- //# sourceMappingURL=index12.js.map
package/dist/index13.cjs CHANGED
@@ -2,18 +2,14 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const react = require("react");
5
- const Skeleton = require("./index5.cjs");
6
- const hooks = require("./index31.cjs");
7
- const colors = require("./index4.cjs");
5
+ const Skeleton = require("./index7.cjs");
6
+ const hooks = require("./index32.cjs");
8
7
  const classNames = require("./index3.cjs");
9
- const SkeletonForm = react.forwardRef(
8
+ const SkeletonTable = react.forwardRef(
10
9
  ({
11
- fields = 3,
12
- showLabels = true,
13
- showButton = true,
14
- gap = 16,
15
- buttonWidth = "120px",
16
- buttonPosition = "left",
10
+ rows = 5,
11
+ columns = 3,
12
+ showHeader = true,
17
13
  animate = true,
18
14
  baseColor,
19
15
  highlightColor,
@@ -22,7 +18,7 @@ const SkeletonForm = react.forwardRef(
22
18
  transition,
23
19
  className,
24
20
  style,
25
- testId = "skeleton-form",
21
+ testId = "skeleton-table",
26
22
  visible = true,
27
23
  ...rest
28
24
  }, ref) => {
@@ -33,60 +29,40 @@ const SkeletonForm = react.forwardRef(
33
29
  transition
34
30
  );
35
31
  if (!shouldRender) return null;
36
- const gapValue = colors.normalizeSize(gap);
37
- const buttonAlign = buttonPosition === "left" ? "justify-start" : buttonPosition === "right" ? "justify-end" : "justify-center";
32
+ const renderRow = (isHeader = false) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-4", style: { gridTemplateColumns: `repeat(${columns}, 1fr)` }, children: Array.from({ length: columns }).map((_, colIndex) => /* @__PURE__ */ jsxRuntime.jsx(
33
+ Skeleton.Skeleton,
34
+ {
35
+ width: "100%",
36
+ height: isHeader ? "1.5rem" : "1.25rem",
37
+ variant: "text",
38
+ animate,
39
+ baseColor,
40
+ highlightColor
41
+ },
42
+ colIndex
43
+ )) });
38
44
  return /* @__PURE__ */ jsxRuntime.jsxs(
39
45
  "div",
40
46
  {
41
47
  ref,
42
48
  "data-testid": testId,
43
- className: classNames.cn("w-full", className),
44
- style: { ...style, display: "flex", flexDirection: "column", gap: gapValue, opacity, transition: transitionStyle },
49
+ className: classNames.cn("flex flex-col gap-3", className),
50
+ style: {
51
+ ...style,
52
+ opacity,
53
+ transition: transitionStyle
54
+ },
45
55
  role: "status",
46
- "aria-label": "Loading form...",
56
+ "aria-label": "Loading table...",
47
57
  "aria-busy": "true",
48
58
  ...rest,
49
59
  children: [
50
- Array.from({ length: fields }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full", style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
51
- showLabels && /* @__PURE__ */ jsxRuntime.jsx(
52
- Skeleton.Skeleton,
53
- {
54
- width: "30%",
55
- height: "0.875rem",
56
- variant: "text",
57
- animate,
58
- baseColor,
59
- highlightColor
60
- }
61
- ),
62
- /* @__PURE__ */ jsxRuntime.jsx(
63
- Skeleton.Skeleton,
64
- {
65
- width: "100%",
66
- height: "2.5rem",
67
- variant: "rectangular",
68
- animate,
69
- baseColor,
70
- highlightColor
71
- }
72
- )
73
- ] }, index)),
74
- showButton && /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames.cn("flex", buttonAlign), style: { marginTop: "8px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
75
- Skeleton.Skeleton,
76
- {
77
- width: buttonWidth,
78
- height: "2.5rem",
79
- variant: "rounded",
80
- animate,
81
- baseColor,
82
- highlightColor
83
- }
84
- ) })
60
+ showHeader && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-gray-200 pb-2", children: renderRow(true) }),
61
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: Array.from({ length: rows }).map((_, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: renderRow(false) }, rowIndex)) })
85
62
  ]
86
63
  }
87
64
  );
88
65
  }
89
66
  );
90
- SkeletonForm.displayName = "SkeletonForm";
91
- exports.SkeletonForm = SkeletonForm;
92
- //# sourceMappingURL=index13.cjs.map
67
+ SkeletonTable.displayName = "SkeletonTable";
68
+ exports.SkeletonTable = SkeletonTable;
package/dist/index13.js CHANGED
@@ -1,17 +1,13 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { Skeleton } from "./index5.js";
4
- import { useLoaderVisibility } from "./index31.js";
5
- import { normalizeSize } from "./index4.js";
3
+ import { Skeleton } from "./index7.js";
4
+ import { useLoaderVisibility } from "./index32.js";
6
5
  import { cn } from "./index3.js";
7
- const SkeletonForm = forwardRef(
6
+ const SkeletonTable = forwardRef(
8
7
  ({
9
- fields = 3,
10
- showLabels = true,
11
- showButton = true,
12
- gap = 16,
13
- buttonWidth = "120px",
14
- buttonPosition = "left",
8
+ rows = 5,
9
+ columns = 3,
10
+ showHeader = true,
15
11
  animate = true,
16
12
  baseColor,
17
13
  highlightColor,
@@ -20,7 +16,7 @@ const SkeletonForm = forwardRef(
20
16
  transition,
21
17
  className,
22
18
  style,
23
- testId = "skeleton-form",
19
+ testId = "skeleton-table",
24
20
  visible = true,
25
21
  ...rest
26
22
  }, ref) => {
@@ -31,62 +27,42 @@ const SkeletonForm = forwardRef(
31
27
  transition
32
28
  );
33
29
  if (!shouldRender) return null;
34
- const gapValue = normalizeSize(gap);
35
- const buttonAlign = buttonPosition === "left" ? "justify-start" : buttonPosition === "right" ? "justify-end" : "justify-center";
30
+ const renderRow = (isHeader = false) => /* @__PURE__ */ jsx("div", { className: "grid gap-4", style: { gridTemplateColumns: `repeat(${columns}, 1fr)` }, children: Array.from({ length: columns }).map((_, colIndex) => /* @__PURE__ */ jsx(
31
+ Skeleton,
32
+ {
33
+ width: "100%",
34
+ height: isHeader ? "1.5rem" : "1.25rem",
35
+ variant: "text",
36
+ animate,
37
+ baseColor,
38
+ highlightColor
39
+ },
40
+ colIndex
41
+ )) });
36
42
  return /* @__PURE__ */ jsxs(
37
43
  "div",
38
44
  {
39
45
  ref,
40
46
  "data-testid": testId,
41
- className: cn("w-full", className),
42
- style: { ...style, display: "flex", flexDirection: "column", gap: gapValue, opacity, transition: transitionStyle },
47
+ className: cn("flex flex-col gap-3", className),
48
+ style: {
49
+ ...style,
50
+ opacity,
51
+ transition: transitionStyle
52
+ },
43
53
  role: "status",
44
- "aria-label": "Loading form...",
54
+ "aria-label": "Loading table...",
45
55
  "aria-busy": "true",
46
56
  ...rest,
47
57
  children: [
48
- Array.from({ length: fields }).map((_, index) => /* @__PURE__ */ jsxs("div", { className: "w-full", style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
49
- showLabels && /* @__PURE__ */ jsx(
50
- Skeleton,
51
- {
52
- width: "30%",
53
- height: "0.875rem",
54
- variant: "text",
55
- animate,
56
- baseColor,
57
- highlightColor
58
- }
59
- ),
60
- /* @__PURE__ */ jsx(
61
- Skeleton,
62
- {
63
- width: "100%",
64
- height: "2.5rem",
65
- variant: "rectangular",
66
- animate,
67
- baseColor,
68
- highlightColor
69
- }
70
- )
71
- ] }, index)),
72
- showButton && /* @__PURE__ */ jsx("div", { className: cn("flex", buttonAlign), style: { marginTop: "8px" }, children: /* @__PURE__ */ jsx(
73
- Skeleton,
74
- {
75
- width: buttonWidth,
76
- height: "2.5rem",
77
- variant: "rounded",
78
- animate,
79
- baseColor,
80
- highlightColor
81
- }
82
- ) })
58
+ showHeader && /* @__PURE__ */ jsx("div", { className: "border-b border-gray-200 pb-2", children: renderRow(true) }),
59
+ /* @__PURE__ */ jsx("div", { className: "space-y-3", children: Array.from({ length: rows }).map((_, rowIndex) => /* @__PURE__ */ jsx("div", { children: renderRow(false) }, rowIndex)) })
83
60
  ]
84
61
  }
85
62
  );
86
63
  }
87
64
  );
88
- SkeletonForm.displayName = "SkeletonForm";
65
+ SkeletonTable.displayName = "SkeletonTable";
89
66
  export {
90
- SkeletonForm
67
+ SkeletonTable
91
68
  };
92
- //# sourceMappingURL=index13.js.map
package/dist/index14.cjs CHANGED
@@ -2,29 +2,26 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const react = require("react");
5
- const hooks = require("./index31.cjs");
5
+ const Skeleton = require("./index7.cjs");
6
+ const SkeletonText = require("./index8.cjs");
7
+ const SkeletonAvatar = require("./index9.cjs");
8
+ const hooks = require("./index32.cjs");
6
9
  const classNames = require("./index3.cjs");
7
- const colors = require("./index4.cjs");
8
- const SpinnerCircle = react.forwardRef(
10
+ const SkeletonPage = react.forwardRef(
9
11
  ({
10
- size = "md",
11
- color = "#3b82f6",
12
- thickness = 4,
13
- speed = "normal",
14
- reverse = false,
15
- respectMotionPreference = true,
12
+ variant = "default",
13
+ animate = true,
14
+ baseColor = "#e0e0e0",
15
+ highlightColor = "#f5f5f5",
16
16
  delay = 0,
17
17
  minDuration = 0,
18
18
  transition,
19
19
  className,
20
20
  style,
21
- testId = "spinner-circle",
21
+ testId = "skeleton-page",
22
22
  visible = true,
23
- ariaLabel = "Loading...",
24
23
  ...rest
25
24
  }, ref) => {
26
- const prefersReducedMotion = hooks.useReducedMotion();
27
- const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
28
25
  const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
29
26
  visible,
30
27
  delay,
@@ -32,51 +29,137 @@ const SpinnerCircle = react.forwardRef(
32
29
  transition
33
30
  );
34
31
  if (!shouldRender) return null;
32
+ const commonProps = {
33
+ animate,
34
+ baseColor,
35
+ highlightColor
36
+ };
37
+ const renderDefault = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
38
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between border-b pb-4", children: [
39
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 200, height: 32, ...commonProps }),
40
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
41
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 100, height: 36, borderRadius: 6, ...commonProps }),
42
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonAvatar.SkeletonAvatar, { size: 40, ...commonProps })
43
+ ] })
44
+ ] }),
45
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
46
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonText.SkeletonText, { lines: 3, ...commonProps }),
47
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-3 gap-4", children: [
48
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { height: 120, borderRadius: 8, ...commonProps }),
49
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { height: 120, borderRadius: 8, ...commonProps }),
50
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { height: 120, borderRadius: 8, ...commonProps })
51
+ ] }),
52
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonText.SkeletonText, { lines: 5, ...commonProps })
53
+ ] })
54
+ ] });
55
+ const renderDashboard = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
56
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
57
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
58
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 180, height: 28, ...commonProps }),
59
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 120, height: 36, borderRadius: 6, ...commonProps })
60
+ ] }),
61
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-4 gap-4", children: [...Array(4)].map((_, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4 border rounded-lg space-y-2", children: [
62
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 100, height: 16, ...commonProps }),
63
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 80, height: 32, ...commonProps }),
64
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 60, height: 12, ...commonProps })
65
+ ] }, i)) })
66
+ ] }),
67
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { height: 300, borderRadius: 8, ...commonProps }),
68
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
69
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4", children: [
70
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 150, height: 20, ...commonProps }),
71
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 150, height: 20, ...commonProps }),
72
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 150, height: 20, ...commonProps })
73
+ ] }),
74
+ [...Array(5)].map((_, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4", children: [
75
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 150, height: 16, ...commonProps }),
76
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 150, height: 16, ...commonProps }),
77
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 150, height: 16, ...commonProps })
78
+ ] }, i))
79
+ ] })
80
+ ] });
81
+ const renderArticle = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-3xl mx-auto space-y-6", children: [
82
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
83
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: "80%", height: 40, ...commonProps }),
84
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
85
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonAvatar.SkeletonAvatar, { size: 48, ...commonProps }),
86
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 flex-1", children: [
87
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 120, height: 16, ...commonProps }),
88
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 180, height: 14, ...commonProps })
89
+ ] })
90
+ ] })
91
+ ] }),
92
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { height: 400, borderRadius: 8, ...commonProps }),
93
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
94
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonText.SkeletonText, { lines: 4, ...commonProps }),
95
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { height: 200, borderRadius: 8, ...commonProps }),
96
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonText.SkeletonText, { lines: 6, ...commonProps }),
97
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { height: 250, borderRadius: 8, ...commonProps }),
98
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonText.SkeletonText, { lines: 4, ...commonProps })
99
+ ] })
100
+ ] });
101
+ const renderProfile = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
102
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-6 border-b pb-6", children: [
103
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonAvatar.SkeletonAvatar, { size: 120, ...commonProps }),
104
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-3", children: [
105
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 200, height: 32, ...commonProps }),
106
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 150, height: 20, ...commonProps }),
107
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonText.SkeletonText, { lines: 2, ...commonProps }),
108
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
109
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 100, height: 36, borderRadius: 6, ...commonProps }),
110
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 100, height: 36, borderRadius: 6, ...commonProps })
111
+ ] })
112
+ ] })
113
+ ] }),
114
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-3 gap-6", children: [
115
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
116
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 100, height: 20, ...commonProps }),
117
+ [...Array(4)].map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { height: 16, ...commonProps }, i))
118
+ ] }) }),
119
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-2 space-y-4", children: [...Array(3)].map((_, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4 border rounded-lg space-y-3", children: [
120
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
121
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonAvatar.SkeletonAvatar, { size: 40, ...commonProps }),
122
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-2", children: [
123
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 150, height: 16, ...commonProps }),
124
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { width: 100, height: 12, ...commonProps })
125
+ ] })
126
+ ] }),
127
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonText.SkeletonText, { lines: 2, ...commonProps }),
128
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { height: 200, borderRadius: 6, ...commonProps })
129
+ ] }, i)) })
130
+ ] })
131
+ ] });
132
+ const renderContent = () => {
133
+ switch (variant) {
134
+ case "dashboard":
135
+ return renderDashboard();
136
+ case "article":
137
+ return renderArticle();
138
+ case "profile":
139
+ return renderProfile();
140
+ default:
141
+ return renderDefault();
142
+ }
143
+ };
35
144
  return /* @__PURE__ */ jsxRuntime.jsx(
36
145
  "div",
37
146
  {
38
147
  ref,
39
148
  "data-testid": testId,
40
- className: classNames.cn("inline-flex items-center justify-center", className),
149
+ className: classNames.cn("w-full p-6", className),
41
150
  style: {
42
151
  ...style,
43
152
  opacity,
44
153
  transition: transitionStyle
45
154
  },
46
155
  role: "status",
47
- "aria-label": ariaLabel,
156
+ "aria-label": "Loading page...",
48
157
  "aria-busy": "true",
49
158
  ...rest,
50
- children: /* @__PURE__ */ jsxRuntime.jsx(
51
- "svg",
52
- {
53
- className: "animate-spinner-rotate",
54
- style: {
55
- width: colors.normalizeSize(size),
56
- height: colors.normalizeSize(size),
57
- animationDuration: effectiveDuration,
58
- animationDirection: reverse ? "reverse" : "normal"
59
- },
60
- viewBox: "0 0 50 50",
61
- children: /* @__PURE__ */ jsxRuntime.jsx(
62
- "circle",
63
- {
64
- cx: "25",
65
- cy: "25",
66
- r: 25 - thickness * 2,
67
- fill: "none",
68
- stroke: color,
69
- strokeWidth: thickness,
70
- strokeDasharray: "80, 200",
71
- strokeLinecap: "round"
72
- }
73
- )
74
- }
75
- )
159
+ children: renderContent()
76
160
  }
77
161
  );
78
162
  }
79
163
  );
80
- SpinnerCircle.displayName = "SpinnerCircle";
81
- exports.SpinnerCircle = SpinnerCircle;
82
- //# sourceMappingURL=index14.cjs.map
164
+ SkeletonPage.displayName = "SkeletonPage";
165
+ exports.SkeletonPage = SkeletonPage;