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/index14.js CHANGED
@@ -1,28 +1,25 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
3
+ import { Skeleton } from "./index7.js";
4
+ import { SkeletonText } from "./index8.js";
5
+ import { SkeletonAvatar } from "./index9.js";
6
+ import { useLoaderVisibility } from "./index32.js";
4
7
  import { cn } from "./index3.js";
5
- import { normalizeSize } from "./index4.js";
6
- const SpinnerCircle = forwardRef(
8
+ const SkeletonPage = forwardRef(
7
9
  ({
8
- size = "md",
9
- color = "#3b82f6",
10
- thickness = 4,
11
- speed = "normal",
12
- reverse = false,
13
- respectMotionPreference = true,
10
+ variant = "default",
11
+ animate = true,
12
+ baseColor = "#e0e0e0",
13
+ highlightColor = "#f5f5f5",
14
14
  delay = 0,
15
15
  minDuration = 0,
16
16
  transition,
17
17
  className,
18
18
  style,
19
- testId = "spinner-circle",
19
+ testId = "skeleton-page",
20
20
  visible = true,
21
- ariaLabel = "Loading...",
22
21
  ...rest
23
22
  }, ref) => {
24
- const prefersReducedMotion = useReducedMotion();
25
- const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
26
23
  const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
27
24
  visible,
28
25
  delay,
@@ -30,53 +27,139 @@ const SpinnerCircle = forwardRef(
30
27
  transition
31
28
  );
32
29
  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
+ };
33
142
  return /* @__PURE__ */ jsx(
34
143
  "div",
35
144
  {
36
145
  ref,
37
146
  "data-testid": testId,
38
- className: cn("inline-flex items-center justify-center", className),
147
+ className: cn("w-full p-6", className),
39
148
  style: {
40
149
  ...style,
41
150
  opacity,
42
151
  transition: transitionStyle
43
152
  },
44
153
  role: "status",
45
- "aria-label": ariaLabel,
154
+ "aria-label": "Loading page...",
46
155
  "aria-busy": "true",
47
156
  ...rest,
48
- children: /* @__PURE__ */ jsx(
49
- "svg",
50
- {
51
- className: "animate-spinner-rotate",
52
- style: {
53
- width: normalizeSize(size),
54
- height: normalizeSize(size),
55
- animationDuration: effectiveDuration,
56
- animationDirection: reverse ? "reverse" : "normal"
57
- },
58
- viewBox: "0 0 50 50",
59
- children: /* @__PURE__ */ jsx(
60
- "circle",
61
- {
62
- cx: "25",
63
- cy: "25",
64
- r: 25 - thickness * 2,
65
- fill: "none",
66
- stroke: color,
67
- strokeWidth: thickness,
68
- strokeDasharray: "80, 200",
69
- strokeLinecap: "round"
70
- }
71
- )
72
- }
73
- )
157
+ children: renderContent()
74
158
  }
75
159
  );
76
160
  }
77
161
  );
78
- SpinnerCircle.displayName = "SpinnerCircle";
162
+ SkeletonPage.displayName = "SkeletonPage";
79
163
  export {
80
- SpinnerCircle
164
+ SkeletonPage
81
165
  };
82
- //# sourceMappingURL=index14.js.map
package/dist/index15.cjs CHANGED
@@ -2,30 +2,30 @@
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");
6
- const classNames = require("./index3.cjs");
5
+ const Skeleton = require("./index7.cjs");
6
+ const hooks = require("./index32.cjs");
7
7
  const colors = require("./index4.cjs");
8
- const SpinnerRing = react.forwardRef(
8
+ const classNames = require("./index3.cjs");
9
+ const SkeletonForm = react.forwardRef(
9
10
  ({
10
- size = "md",
11
- color = "#3b82f6",
12
- secondaryColor = "rgba(0, 0, 0, 0.1)",
13
- thickness = 4,
14
- speed = "normal",
15
- reverse = false,
16
- respectMotionPreference = true,
11
+ fields = 3,
12
+ showLabels = true,
13
+ showButton = true,
14
+ gap = 16,
15
+ buttonWidth = "120px",
16
+ buttonPosition = "left",
17
+ animate = true,
18
+ baseColor,
19
+ highlightColor,
17
20
  delay = 0,
18
21
  minDuration = 0,
19
22
  transition,
20
23
  className,
21
24
  style,
22
- testId = "spinner-ring",
25
+ testId = "skeleton-form",
23
26
  visible = true,
24
- ariaLabel = "Loading...",
25
27
  ...rest
26
28
  }, ref) => {
27
- const prefersReducedMotion = hooks.useReducedMotion();
28
- const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
29
29
  const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
30
30
  visible,
31
31
  delay,
@@ -33,39 +33,59 @@ const SpinnerRing = react.forwardRef(
33
33
  transition
34
34
  );
35
35
  if (!shouldRender) return null;
36
- return /* @__PURE__ */ jsxRuntime.jsx(
36
+ const gapValue = colors.normalizeSize(gap);
37
+ const buttonAlign = buttonPosition === "left" ? "justify-start" : buttonPosition === "right" ? "justify-end" : "justify-center";
38
+ return /* @__PURE__ */ jsxRuntime.jsxs(
37
39
  "div",
38
40
  {
39
41
  ref,
40
42
  "data-testid": testId,
41
- className: classNames.cn("inline-flex items-center justify-center", className),
42
- style: {
43
- ...style,
44
- opacity,
45
- transition: transitionStyle
46
- },
43
+ className: classNames.cn("w-full", className),
44
+ style: { ...style, display: "flex", flexDirection: "column", gap: gapValue, opacity, transition: transitionStyle },
47
45
  role: "status",
48
- "aria-label": ariaLabel,
46
+ "aria-label": "Loading form...",
49
47
  "aria-busy": "true",
50
48
  ...rest,
51
- children: /* @__PURE__ */ jsxRuntime.jsx(
52
- "div",
53
- {
54
- className: "rounded-full",
55
- style: {
56
- width: colors.normalizeSize(size),
57
- height: colors.normalizeSize(size),
58
- border: `${thickness}px solid ${secondaryColor}`,
59
- borderTopColor: color,
60
- animation: `spinner-rotate ${effectiveDuration} linear infinite`,
61
- animationDirection: reverse ? "reverse" : "normal"
49
+ 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
62
83
  }
63
- }
64
- )
84
+ ) })
85
+ ]
65
86
  }
66
87
  );
67
88
  }
68
89
  );
69
- SpinnerRing.displayName = "SpinnerRing";
70
- exports.SpinnerRing = SpinnerRing;
71
- //# sourceMappingURL=index15.cjs.map
90
+ SkeletonForm.displayName = "SkeletonForm";
91
+ exports.SkeletonForm = SkeletonForm;
package/dist/index15.js CHANGED
@@ -1,29 +1,29 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
4
- import { cn } from "./index3.js";
3
+ import { Skeleton } from "./index7.js";
4
+ import { useLoaderVisibility } from "./index32.js";
5
5
  import { normalizeSize } from "./index4.js";
6
- const SpinnerRing = forwardRef(
6
+ import { cn } from "./index3.js";
7
+ const SkeletonForm = forwardRef(
7
8
  ({
8
- size = "md",
9
- color = "#3b82f6",
10
- secondaryColor = "rgba(0, 0, 0, 0.1)",
11
- thickness = 4,
12
- speed = "normal",
13
- reverse = false,
14
- respectMotionPreference = true,
9
+ fields = 3,
10
+ showLabels = true,
11
+ showButton = true,
12
+ gap = 16,
13
+ buttonWidth = "120px",
14
+ buttonPosition = "left",
15
+ animate = true,
16
+ baseColor,
17
+ highlightColor,
15
18
  delay = 0,
16
19
  minDuration = 0,
17
20
  transition,
18
21
  className,
19
22
  style,
20
- testId = "spinner-ring",
23
+ testId = "skeleton-form",
21
24
  visible = true,
22
- ariaLabel = "Loading...",
23
25
  ...rest
24
26
  }, ref) => {
25
- const prefersReducedMotion = useReducedMotion();
26
- const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
27
27
  const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
28
28
  visible,
29
29
  delay,
@@ -31,41 +31,61 @@ const SpinnerRing = forwardRef(
31
31
  transition
32
32
  );
33
33
  if (!shouldRender) return null;
34
- return /* @__PURE__ */ jsx(
34
+ const gapValue = normalizeSize(gap);
35
+ const buttonAlign = buttonPosition === "left" ? "justify-start" : buttonPosition === "right" ? "justify-end" : "justify-center";
36
+ return /* @__PURE__ */ jsxs(
35
37
  "div",
36
38
  {
37
39
  ref,
38
40
  "data-testid": testId,
39
- className: cn("inline-flex items-center justify-center", className),
40
- style: {
41
- ...style,
42
- opacity,
43
- transition: transitionStyle
44
- },
41
+ className: cn("w-full", className),
42
+ style: { ...style, display: "flex", flexDirection: "column", gap: gapValue, opacity, transition: transitionStyle },
45
43
  role: "status",
46
- "aria-label": ariaLabel,
44
+ "aria-label": "Loading form...",
47
45
  "aria-busy": "true",
48
46
  ...rest,
49
- children: /* @__PURE__ */ jsx(
50
- "div",
51
- {
52
- className: "rounded-full",
53
- style: {
54
- width: normalizeSize(size),
55
- height: normalizeSize(size),
56
- border: `${thickness}px solid ${secondaryColor}`,
57
- borderTopColor: color,
58
- animation: `spinner-rotate ${effectiveDuration} linear infinite`,
59
- animationDirection: reverse ? "reverse" : "normal"
47
+ 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
60
81
  }
61
- }
62
- )
82
+ ) })
83
+ ]
63
84
  }
64
85
  );
65
86
  }
66
87
  );
67
- SpinnerRing.displayName = "SpinnerRing";
88
+ SkeletonForm.displayName = "SkeletonForm";
68
89
  export {
69
- SpinnerRing
90
+ SkeletonForm
70
91
  };
71
- //# sourceMappingURL=index15.js.map
package/dist/index16.cjs CHANGED
@@ -2,15 +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 colors = require("./index4.cjs");
6
- const hooks = require("./index31.cjs");
5
+ const hooks = require("./index32.cjs");
7
6
  const classNames = require("./index3.cjs");
8
- const SpinnerDots = react.forwardRef(
7
+ const colors = require("./index4.cjs");
8
+ const SpinnerCircle = react.forwardRef(
9
9
  ({
10
10
  size = "md",
11
11
  color = "#3b82f6",
12
- dotCount = 8,
13
- dotSize = 4,
12
+ thickness = 4,
14
13
  speed = "normal",
15
14
  reverse = false,
16
15
  respectMotionPreference = true,
@@ -19,7 +18,7 @@ const SpinnerDots = react.forwardRef(
19
18
  transition,
20
19
  className,
21
20
  style,
22
- testId = "spinner-dots",
21
+ testId = "spinner-circle",
23
22
  visible = true,
24
23
  ariaLabel = "Loading...",
25
24
  ...rest
@@ -33,9 +32,6 @@ const SpinnerDots = react.forwardRef(
33
32
  transition
34
33
  );
35
34
  if (!shouldRender) return null;
36
- const sizeValue = colors.parseSizeToNumber(size, 40);
37
- const dotSizeValue = colors.parseSizeToNumber(dotSize, 4);
38
- const radius = (sizeValue - dotSizeValue) / 2;
39
35
  return /* @__PURE__ */ jsxRuntime.jsx(
40
36
  "div",
41
37
  {
@@ -52,43 +48,34 @@ const SpinnerDots = react.forwardRef(
52
48
  "aria-busy": "true",
53
49
  ...rest,
54
50
  children: /* @__PURE__ */ jsxRuntime.jsx(
55
- "div",
51
+ "svg",
56
52
  {
57
- className: "relative",
53
+ className: "animate-spinner-rotate",
58
54
  style: {
59
55
  width: colors.normalizeSize(size),
60
56
  height: colors.normalizeSize(size),
61
- animation: `spinner-rotate ${effectiveDuration} linear infinite`,
57
+ animationDuration: effectiveDuration,
62
58
  animationDirection: reverse ? "reverse" : "normal"
63
59
  },
64
- children: Array.from({ length: dotCount }).map((_, index) => {
65
- const angle = 360 / dotCount * index;
66
- const radian = angle * Math.PI / 180;
67
- const x = radius * Math.cos(radian) + radius;
68
- const y = radius * Math.sin(radian) + radius;
69
- return /* @__PURE__ */ jsxRuntime.jsx(
70
- "div",
71
- {
72
- className: "absolute rounded-full",
73
- style: {
74
- width: colors.normalizeSize(dotSize),
75
- height: colors.normalizeSize(dotSize),
76
- backgroundColor: color,
77
- left: `${x}px`,
78
- top: `${y}px`,
79
- opacity: 1 - index / dotCount * 0.7
80
- // Fade effect
81
- }
82
- },
83
- index
84
- );
85
- })
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
+ )
86
74
  }
87
75
  )
88
76
  }
89
77
  );
90
78
  }
91
79
  );
92
- SpinnerDots.displayName = "SpinnerDots";
93
- exports.SpinnerDots = SpinnerDots;
94
- //# sourceMappingURL=index16.cjs.map
80
+ SpinnerCircle.displayName = "SpinnerCircle";
81
+ exports.SpinnerCircle = SpinnerCircle;