premium-react-loaders 1.0.2 → 1.2.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 (143) hide show
  1. package/README.md +55 -6
  2. package/dist/components/progress/ProgressBar.d.ts.map +1 -1
  3. package/dist/components/progress/ProgressCircle.d.ts.map +1 -1
  4. package/dist/components/progress/ProgressRing.d.ts.map +1 -1
  5. package/dist/components/progress/ProgressSteps.d.ts +16 -0
  6. package/dist/components/progress/ProgressSteps.d.ts.map +1 -0
  7. package/dist/components/progress/index.d.ts +1 -0
  8. package/dist/components/progress/index.d.ts.map +1 -1
  9. package/dist/components/pulse/PulseBars.d.ts +2 -2
  10. package/dist/components/pulse/PulseBars.d.ts.map +1 -1
  11. package/dist/components/pulse/PulseDots.d.ts +2 -2
  12. package/dist/components/pulse/PulseDots.d.ts.map +1 -1
  13. package/dist/components/pulse/PulseWave.d.ts +2 -2
  14. package/dist/components/pulse/PulseWave.d.ts.map +1 -1
  15. package/dist/components/pulse/TypingIndicator.d.ts +16 -0
  16. package/dist/components/pulse/TypingIndicator.d.ts.map +1 -0
  17. package/dist/components/pulse/index.d.ts +1 -0
  18. package/dist/components/pulse/index.d.ts.map +1 -1
  19. package/dist/components/skeleton/SkeletonForm.d.ts +16 -0
  20. package/dist/components/skeleton/SkeletonForm.d.ts.map +1 -0
  21. package/dist/components/skeleton/index.d.ts +1 -0
  22. package/dist/components/skeleton/index.d.ts.map +1 -1
  23. package/dist/components/spinner/SpinnerBars.d.ts +2 -2
  24. package/dist/components/spinner/SpinnerBars.d.ts.map +1 -1
  25. package/dist/components/spinner/SpinnerCircle.d.ts +2 -1
  26. package/dist/components/spinner/SpinnerCircle.d.ts.map +1 -1
  27. package/dist/components/spinner/SpinnerDots.d.ts +2 -2
  28. package/dist/components/spinner/SpinnerDots.d.ts.map +1 -1
  29. package/dist/components/spinner/SpinnerGrid.d.ts +2 -2
  30. package/dist/components/spinner/SpinnerGrid.d.ts.map +1 -1
  31. package/dist/components/spinner/SpinnerPulse.d.ts +15 -0
  32. package/dist/components/spinner/SpinnerPulse.d.ts.map +1 -0
  33. package/dist/components/spinner/SpinnerRing.d.ts +3 -3
  34. package/dist/components/spinner/SpinnerRing.d.ts.map +1 -1
  35. package/dist/components/spinner/SpinnerWave.d.ts +15 -0
  36. package/dist/components/spinner/SpinnerWave.d.ts.map +1 -0
  37. package/dist/components/spinner/index.d.ts +2 -0
  38. package/dist/components/spinner/index.d.ts.map +1 -1
  39. package/dist/index.cjs +23 -13
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.js +23 -13
  43. package/dist/index.js.map +1 -1
  44. package/dist/index13.cjs +54 -35
  45. package/dist/index13.cjs.map +1 -1
  46. package/dist/index13.js +56 -37
  47. package/dist/index13.js.map +1 -1
  48. package/dist/index14.cjs +29 -12
  49. package/dist/index14.cjs.map +1 -1
  50. package/dist/index14.js +30 -13
  51. package/dist/index14.js.map +1 -1
  52. package/dist/index15.cjs +19 -36
  53. package/dist/index15.cjs.map +1 -1
  54. package/dist/index15.js +19 -36
  55. package/dist/index15.js.map +1 -1
  56. package/dist/index16.cjs +47 -24
  57. package/dist/index16.cjs.map +1 -1
  58. package/dist/index16.js +48 -25
  59. package/dist/index16.js.map +1 -1
  60. package/dist/index17.cjs +29 -38
  61. package/dist/index17.cjs.map +1 -1
  62. package/dist/index17.js +29 -38
  63. package/dist/index17.js.map +1 -1
  64. package/dist/index18.cjs +52 -79
  65. package/dist/index18.cjs.map +1 -1
  66. package/dist/index18.js +54 -81
  67. package/dist/index18.js.map +1 -1
  68. package/dist/index19.cjs +45 -104
  69. package/dist/index19.cjs.map +1 -1
  70. package/dist/index19.js +46 -105
  71. package/dist/index19.js.map +1 -1
  72. package/dist/index20.cjs +58 -108
  73. package/dist/index20.cjs.map +1 -1
  74. package/dist/index20.js +60 -110
  75. package/dist/index20.js.map +1 -1
  76. package/dist/index21.cjs +79 -28
  77. package/dist/index21.cjs.map +1 -1
  78. package/dist/index21.js +82 -31
  79. package/dist/index21.js.map +1 -1
  80. package/dist/index22.cjs +106 -32
  81. package/dist/index22.cjs.map +1 -1
  82. package/dist/index22.js +108 -34
  83. package/dist/index22.js.map +1 -1
  84. package/dist/index23.cjs +112 -34
  85. package/dist/index23.cjs.map +1 -1
  86. package/dist/index23.js +115 -37
  87. package/dist/index23.js.map +1 -1
  88. package/dist/index24.cjs +108 -48
  89. package/dist/index24.cjs.map +1 -1
  90. package/dist/index24.js +110 -50
  91. package/dist/index24.js.map +1 -1
  92. package/dist/index25.cjs +59 -16
  93. package/dist/index25.cjs.map +1 -1
  94. package/dist/index25.js +58 -15
  95. package/dist/index25.js.map +1 -1
  96. package/dist/index26.cjs +66 -0
  97. package/dist/index26.cjs.map +1 -0
  98. package/dist/index26.js +66 -0
  99. package/dist/index26.js.map +1 -0
  100. package/dist/index27.cjs +69 -0
  101. package/dist/index27.cjs.map +1 -0
  102. package/dist/index27.js +69 -0
  103. package/dist/index27.js.map +1 -0
  104. package/dist/index28.cjs +65 -0
  105. package/dist/index28.cjs.map +1 -0
  106. package/dist/index28.js +65 -0
  107. package/dist/index28.js.map +1 -0
  108. package/dist/index29.cjs +71 -0
  109. package/dist/index29.cjs.map +1 -0
  110. package/dist/index29.js +71 -0
  111. package/dist/index29.js.map +1 -0
  112. package/dist/index3.cjs +1 -1
  113. package/dist/index3.js +1 -1
  114. package/dist/index30.cjs +18 -0
  115. package/dist/index30.cjs.map +1 -0
  116. package/dist/index30.js +18 -0
  117. package/dist/index30.js.map +1 -0
  118. package/dist/index31.cjs +42 -0
  119. package/dist/index31.cjs.map +1 -0
  120. package/dist/index31.js +42 -0
  121. package/dist/index31.js.map +1 -0
  122. package/dist/index4.cjs +10 -0
  123. package/dist/index4.cjs.map +1 -1
  124. package/dist/index4.js +10 -0
  125. package/dist/index4.js.map +1 -1
  126. package/dist/premium-react-loaders.css +299 -3
  127. package/dist/types/common.d.ts +14 -2
  128. package/dist/types/common.d.ts.map +1 -1
  129. package/dist/types/progress.d.ts +24 -1
  130. package/dist/types/progress.d.ts.map +1 -1
  131. package/dist/types/pulse.d.ts +13 -0
  132. package/dist/types/pulse.d.ts.map +1 -1
  133. package/dist/types/skeleton.d.ts +17 -0
  134. package/dist/types/skeleton.d.ts.map +1 -1
  135. package/dist/types/spinner.d.ts +18 -0
  136. package/dist/types/spinner.d.ts.map +1 -1
  137. package/dist/utils/colors.d.ts +2 -1
  138. package/dist/utils/colors.d.ts.map +1 -1
  139. package/dist/utils/hooks.d.ts +10 -0
  140. package/dist/utils/hooks.d.ts.map +1 -0
  141. package/dist/utils/index.d.ts +1 -0
  142. package/dist/utils/index.d.ts.map +1 -1
  143. package/package.json +1 -1
package/dist/index13.cjs CHANGED
@@ -2,62 +2,81 @@
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");
5
6
  const colors = require("./index4.cjs");
6
7
  const classNames = require("./index3.cjs");
7
- const SpinnerCircle = react.forwardRef(
8
+ const SkeletonForm = react.forwardRef(
8
9
  ({
9
- size = 40,
10
- color = "#3b82f6",
11
- thickness = 4,
12
- speed = "normal",
10
+ fields = 3,
11
+ showLabels = true,
12
+ showButton = true,
13
+ gap = 16,
14
+ buttonWidth = "120px",
15
+ buttonPosition = "left",
16
+ animate = true,
17
+ baseColor,
18
+ highlightColor,
13
19
  className,
14
20
  style,
15
- testId = "spinner-circle",
21
+ testId = "skeleton-form",
16
22
  visible = true,
17
- ariaLabel = "Loading...",
18
23
  ...rest
19
24
  }, ref) => {
20
25
  if (!visible) return null;
21
- return /* @__PURE__ */ jsxRuntime.jsx(
26
+ const gapValue = colors.normalizeSize(gap);
27
+ const buttonAlign = buttonPosition === "left" ? "justify-start" : buttonPosition === "right" ? "justify-end" : "justify-center";
28
+ return /* @__PURE__ */ jsxRuntime.jsxs(
22
29
  "div",
23
30
  {
24
31
  ref,
25
32
  "data-testid": testId,
26
- className: classNames.cn("inline-flex items-center justify-center", className),
27
- style,
33
+ className: classNames.cn("w-full", className),
34
+ style: { ...style, display: "flex", flexDirection: "column", gap: gapValue },
28
35
  role: "status",
29
- "aria-label": ariaLabel,
36
+ "aria-label": "Loading form...",
30
37
  "aria-busy": "true",
31
38
  ...rest,
32
- children: /* @__PURE__ */ jsxRuntime.jsx(
33
- "svg",
34
- {
35
- className: "animate-spinner-rotate",
36
- style: {
37
- width: colors.normalizeSize(size),
38
- height: colors.normalizeSize(size),
39
- animationDuration: colors.getAnimationDuration(speed)
40
- },
41
- viewBox: "0 0 50 50",
42
- children: /* @__PURE__ */ jsxRuntime.jsx(
43
- "circle",
39
+ children: [
40
+ Array.from({ length: fields }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full", style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
41
+ showLabels && /* @__PURE__ */ jsxRuntime.jsx(
42
+ Skeleton.Skeleton,
44
43
  {
45
- cx: "25",
46
- cy: "25",
47
- r: 25 - thickness * 2,
48
- fill: "none",
49
- stroke: color,
50
- strokeWidth: thickness,
51
- strokeDasharray: "80, 200",
52
- strokeLinecap: "round"
44
+ width: "30%",
45
+ height: "0.875rem",
46
+ variant: "text",
47
+ animate,
48
+ baseColor,
49
+ highlightColor
50
+ }
51
+ ),
52
+ /* @__PURE__ */ jsxRuntime.jsx(
53
+ Skeleton.Skeleton,
54
+ {
55
+ width: "100%",
56
+ height: "2.5rem",
57
+ variant: "rectangular",
58
+ animate,
59
+ baseColor,
60
+ highlightColor
53
61
  }
54
62
  )
55
- }
56
- )
63
+ ] }, index)),
64
+ showButton && /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames.cn("flex", buttonAlign), style: { marginTop: "8px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
65
+ Skeleton.Skeleton,
66
+ {
67
+ width: buttonWidth,
68
+ height: "2.5rem",
69
+ variant: "rounded",
70
+ animate,
71
+ baseColor,
72
+ highlightColor
73
+ }
74
+ ) })
75
+ ]
57
76
  }
58
77
  );
59
78
  }
60
79
  );
61
- SpinnerCircle.displayName = "SpinnerCircle";
62
- exports.SpinnerCircle = SpinnerCircle;
80
+ SkeletonForm.displayName = "SkeletonForm";
81
+ exports.SkeletonForm = SkeletonForm;
63
82
  //# sourceMappingURL=index13.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index13.cjs","sources":["../src/components/spinner/SpinnerCircle.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerCircleProps } from '../../types';\nimport { cn, normalizeSize, getAnimationDuration } from '../../utils';\n\n/**\n * SpinnerCircle - Basic rotating circle spinner\n *\n * A simple, elegant circular spinner with a partial arc that rotates continuously.\n *\n * @example\n * ```tsx\n * <SpinnerCircle size={40} color=\"#3b82f6\" />\n * <SpinnerCircle size={24} thickness={3} speed=\"fast\" />\n * ```\n */\nexport const SpinnerCircle = forwardRef<HTMLDivElement, SpinnerCircleProps>(\n (\n {\n size = 40,\n color = '#3b82f6',\n thickness = 4,\n speed = 'normal',\n className,\n style,\n testId = 'spinner-circle',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <svg\n className=\"animate-spinner-rotate\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n animationDuration: getAnimationDuration(speed),\n }}\n viewBox=\"0 0 50 50\"\n >\n <circle\n cx=\"25\"\n cy=\"25\"\n r={25 - thickness * 2}\n fill=\"none\"\n stroke={color}\n strokeWidth={thickness}\n strokeDasharray=\"80, 200\"\n strokeLinecap=\"round\"\n />\n </svg>\n </div>\n );\n }\n);\n\nSpinnerCircle.displayName = 'SpinnerCircle';\n"],"names":["forwardRef","jsx","cn","normalizeSize","getAnimationDuration"],"mappings":";;;;;;AAeO,MAAM,gBAAgBA,MAAAA;AAAAA,EAC3B,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAWC,WAAAA,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAAD,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAOE,OAAAA,cAAc,IAAI;AAAA,cACzB,QAAQA,OAAAA,cAAc,IAAI;AAAA,cAC1B,mBAAmBC,OAAAA,qBAAqB,KAAK;AAAA,YAAA;AAAA,YAE/C,SAAQ;AAAA,YAER,UAAAH,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,IAAG;AAAA,gBACH,IAAG;AAAA,gBACH,GAAG,KAAK,YAAY;AAAA,gBACpB,MAAK;AAAA,gBACL,QAAQ;AAAA,gBACR,aAAa;AAAA,gBACb,iBAAgB;AAAA,gBAChB,eAAc;AAAA,cAAA;AAAA,YAAA;AAAA,UAChB;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,cAAc,cAAc;;"}
1
+ {"version":3,"file":"index13.cjs","sources":["../src/components/skeleton/SkeletonForm.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SkeletonFormProps } from '../../types';\nimport { cn, normalizeSize } from '../../utils';\nimport { Skeleton } from './Skeleton';\n\n/**\n * SkeletonForm - Form loading skeleton\n *\n * A skeleton loader for form layouts with configurable fields, labels, and submit button.\n *\n * @example\n * ```tsx\n * <SkeletonForm />\n * <SkeletonForm fields={5} showLabels={true} />\n * <SkeletonForm fields={3} showButton={false} />\n * <SkeletonForm fields={4} buttonPosition=\"right\" />\n * ```\n */\nexport const SkeletonForm = forwardRef<HTMLDivElement, SkeletonFormProps>(\n (\n {\n fields = 3,\n showLabels = true,\n showButton = true,\n gap = 16,\n buttonWidth = '120px',\n buttonPosition = 'left',\n animate = true,\n baseColor,\n highlightColor,\n className,\n style,\n testId = 'skeleton-form',\n visible = true,\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const gapValue = normalizeSize(gap);\n const buttonAlign =\n buttonPosition === 'left'\n ? 'justify-start'\n : buttonPosition === 'right'\n ? 'justify-end'\n : 'justify-center';\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('w-full', className)}\n style={{ ...style, display: 'flex', flexDirection: 'column', gap: gapValue }}\n role=\"status\"\n aria-label=\"Loading form...\"\n aria-busy=\"true\"\n {...rest}\n >\n {/* Form Fields */}\n {Array.from({ length: fields }).map((_, index) => (\n <div key={index} className=\"w-full\" style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>\n {/* Field Label */}\n {showLabels && (\n <Skeleton\n width=\"30%\"\n height=\"0.875rem\"\n variant=\"text\"\n animate={animate}\n baseColor={baseColor}\n highlightColor={highlightColor}\n />\n )}\n {/* Field Input */}\n <Skeleton\n width=\"100%\"\n height=\"2.5rem\"\n variant=\"rectangular\"\n animate={animate}\n baseColor={baseColor}\n highlightColor={highlightColor}\n />\n </div>\n ))}\n\n {/* Submit Button */}\n {showButton && (\n <div className={cn('flex', buttonAlign)} style={{ marginTop: '8px' }}>\n <Skeleton\n width={buttonWidth}\n height=\"2.5rem\"\n variant=\"rounded\"\n animate={animate}\n baseColor={baseColor}\n highlightColor={highlightColor}\n />\n </div>\n )}\n </div>\n );\n }\n);\n\nSkeletonForm.displayName = 'SkeletonForm';\n"],"names":["forwardRef","normalizeSize","jsxs","cn","jsx","Skeleton"],"mappings":";;;;;;;AAkBO,MAAM,eAAeA,MAAAA;AAAAA,EAC1B,CACE;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,IACb,aAAa;AAAA,IACb,MAAM;AAAA,IACN,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,UAAM,WAAWC,OAAAA,cAAc,GAAG;AAClC,UAAM,cACJ,mBAAmB,SACf,kBACA,mBAAmB,UACnB,gBACA;AAEN,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAWC,WAAAA,GAAG,UAAU,SAAS;AAAA,QACjC,OAAO,EAAE,GAAG,OAAO,SAAS,QAAQ,eAAe,UAAU,KAAK,SAAA;AAAA,QAClE,MAAK;AAAA,QACL,cAAW;AAAA,QACX,aAAU;AAAA,QACT,GAAG;AAAA,QAGH,UAAA;AAAA,UAAA,MAAM,KAAK,EAAE,QAAQ,OAAA,CAAQ,EAAE,IAAI,CAAC,GAAG,UACtCD,2BAAAA,KAAC,SAAgB,WAAU,UAAS,OAAO,EAAE,SAAS,QAAQ,eAAe,UAAU,KAAK,MAAA,GAEzF,UAAA;AAAA,YAAA,cACCE,2BAAAA;AAAAA,cAACC,SAAAA;AAAAA,cAAA;AAAA,gBACC,OAAM;AAAA,gBACN,QAAO;AAAA,gBACP,SAAQ;AAAA,gBACR;AAAA,gBACA;AAAA,gBACA;AAAA,cAAA;AAAA,YAAA;AAAA,YAIJD,2BAAAA;AAAAA,cAACC,SAAAA;AAAAA,cAAA;AAAA,gBACC,OAAM;AAAA,gBACN,QAAO;AAAA,gBACP,SAAQ;AAAA,gBACR;AAAA,gBACA;AAAA,gBACA;AAAA,cAAA;AAAA,YAAA;AAAA,UACF,EAAA,GApBQ,KAqBV,CACD;AAAA,UAGA,cACCD,2BAAAA,IAAC,OAAA,EAAI,WAAWD,WAAAA,GAAG,QAAQ,WAAW,GAAG,OAAO,EAAE,WAAW,MAAA,GAC3D,UAAAC,2BAAAA;AAAAA,YAACC,SAAAA;AAAAA,YAAA;AAAA,cACC,OAAO;AAAA,cACP,QAAO;AAAA,cACP,SAAQ;AAAA,cACR;AAAA,cACA;AAAA,cACA;AAAA,YAAA;AAAA,UAAA,EACF,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,aAAa,cAAc;;"}
package/dist/index13.js CHANGED
@@ -1,63 +1,82 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { getAnimationDuration, normalizeSize } from "./index4.js";
3
+ import { Skeleton } from "./index5.js";
4
+ import { normalizeSize } from "./index4.js";
4
5
  import { cn } from "./index3.js";
5
- const SpinnerCircle = forwardRef(
6
+ const SkeletonForm = forwardRef(
6
7
  ({
7
- size = 40,
8
- color = "#3b82f6",
9
- thickness = 4,
10
- speed = "normal",
8
+ fields = 3,
9
+ showLabels = true,
10
+ showButton = true,
11
+ gap = 16,
12
+ buttonWidth = "120px",
13
+ buttonPosition = "left",
14
+ animate = true,
15
+ baseColor,
16
+ highlightColor,
11
17
  className,
12
18
  style,
13
- testId = "spinner-circle",
19
+ testId = "skeleton-form",
14
20
  visible = true,
15
- ariaLabel = "Loading...",
16
21
  ...rest
17
22
  }, ref) => {
18
23
  if (!visible) return null;
19
- return /* @__PURE__ */ jsx(
24
+ const gapValue = normalizeSize(gap);
25
+ const buttonAlign = buttonPosition === "left" ? "justify-start" : buttonPosition === "right" ? "justify-end" : "justify-center";
26
+ return /* @__PURE__ */ jsxs(
20
27
  "div",
21
28
  {
22
29
  ref,
23
30
  "data-testid": testId,
24
- className: cn("inline-flex items-center justify-center", className),
25
- style,
31
+ className: cn("w-full", className),
32
+ style: { ...style, display: "flex", flexDirection: "column", gap: gapValue },
26
33
  role: "status",
27
- "aria-label": ariaLabel,
34
+ "aria-label": "Loading form...",
28
35
  "aria-busy": "true",
29
36
  ...rest,
30
- children: /* @__PURE__ */ jsx(
31
- "svg",
32
- {
33
- className: "animate-spinner-rotate",
34
- style: {
35
- width: normalizeSize(size),
36
- height: normalizeSize(size),
37
- animationDuration: getAnimationDuration(speed)
38
- },
39
- viewBox: "0 0 50 50",
40
- children: /* @__PURE__ */ jsx(
41
- "circle",
37
+ children: [
38
+ Array.from({ length: fields }).map((_, index) => /* @__PURE__ */ jsxs("div", { className: "w-full", style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
39
+ showLabels && /* @__PURE__ */ jsx(
40
+ Skeleton,
42
41
  {
43
- cx: "25",
44
- cy: "25",
45
- r: 25 - thickness * 2,
46
- fill: "none",
47
- stroke: color,
48
- strokeWidth: thickness,
49
- strokeDasharray: "80, 200",
50
- strokeLinecap: "round"
42
+ width: "30%",
43
+ height: "0.875rem",
44
+ variant: "text",
45
+ animate,
46
+ baseColor,
47
+ highlightColor
48
+ }
49
+ ),
50
+ /* @__PURE__ */ jsx(
51
+ Skeleton,
52
+ {
53
+ width: "100%",
54
+ height: "2.5rem",
55
+ variant: "rectangular",
56
+ animate,
57
+ baseColor,
58
+ highlightColor
51
59
  }
52
60
  )
53
- }
54
- )
61
+ ] }, index)),
62
+ showButton && /* @__PURE__ */ jsx("div", { className: cn("flex", buttonAlign), style: { marginTop: "8px" }, children: /* @__PURE__ */ jsx(
63
+ Skeleton,
64
+ {
65
+ width: buttonWidth,
66
+ height: "2.5rem",
67
+ variant: "rounded",
68
+ animate,
69
+ baseColor,
70
+ highlightColor
71
+ }
72
+ ) })
73
+ ]
55
74
  }
56
75
  );
57
76
  }
58
77
  );
59
- SpinnerCircle.displayName = "SpinnerCircle";
78
+ SkeletonForm.displayName = "SkeletonForm";
60
79
  export {
61
- SpinnerCircle
80
+ SkeletonForm
62
81
  };
63
82
  //# sourceMappingURL=index13.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index13.js","sources":["../src/components/spinner/SpinnerCircle.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerCircleProps } from '../../types';\nimport { cn, normalizeSize, getAnimationDuration } from '../../utils';\n\n/**\n * SpinnerCircle - Basic rotating circle spinner\n *\n * A simple, elegant circular spinner with a partial arc that rotates continuously.\n *\n * @example\n * ```tsx\n * <SpinnerCircle size={40} color=\"#3b82f6\" />\n * <SpinnerCircle size={24} thickness={3} speed=\"fast\" />\n * ```\n */\nexport const SpinnerCircle = forwardRef<HTMLDivElement, SpinnerCircleProps>(\n (\n {\n size = 40,\n color = '#3b82f6',\n thickness = 4,\n speed = 'normal',\n className,\n style,\n testId = 'spinner-circle',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <svg\n className=\"animate-spinner-rotate\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n animationDuration: getAnimationDuration(speed),\n }}\n viewBox=\"0 0 50 50\"\n >\n <circle\n cx=\"25\"\n cy=\"25\"\n r={25 - thickness * 2}\n fill=\"none\"\n stroke={color}\n strokeWidth={thickness}\n strokeDasharray=\"80, 200\"\n strokeLinecap=\"round\"\n />\n </svg>\n </div>\n );\n }\n);\n\nSpinnerCircle.displayName = 'SpinnerCircle';\n"],"names":[],"mappings":";;;;AAeO,MAAM,gBAAgB;AAAA,EAC3B,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAW,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO,cAAc,IAAI;AAAA,cACzB,QAAQ,cAAc,IAAI;AAAA,cAC1B,mBAAmB,qBAAqB,KAAK;AAAA,YAAA;AAAA,YAE/C,SAAQ;AAAA,YAER,UAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,IAAG;AAAA,gBACH,IAAG;AAAA,gBACH,GAAG,KAAK,YAAY;AAAA,gBACpB,MAAK;AAAA,gBACL,QAAQ;AAAA,gBACR,aAAa;AAAA,gBACb,iBAAgB;AAAA,gBAChB,eAAc;AAAA,cAAA;AAAA,YAAA;AAAA,UAChB;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,cAAc,cAAc;"}
1
+ {"version":3,"file":"index13.js","sources":["../src/components/skeleton/SkeletonForm.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SkeletonFormProps } from '../../types';\nimport { cn, normalizeSize } from '../../utils';\nimport { Skeleton } from './Skeleton';\n\n/**\n * SkeletonForm - Form loading skeleton\n *\n * A skeleton loader for form layouts with configurable fields, labels, and submit button.\n *\n * @example\n * ```tsx\n * <SkeletonForm />\n * <SkeletonForm fields={5} showLabels={true} />\n * <SkeletonForm fields={3} showButton={false} />\n * <SkeletonForm fields={4} buttonPosition=\"right\" />\n * ```\n */\nexport const SkeletonForm = forwardRef<HTMLDivElement, SkeletonFormProps>(\n (\n {\n fields = 3,\n showLabels = true,\n showButton = true,\n gap = 16,\n buttonWidth = '120px',\n buttonPosition = 'left',\n animate = true,\n baseColor,\n highlightColor,\n className,\n style,\n testId = 'skeleton-form',\n visible = true,\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const gapValue = normalizeSize(gap);\n const buttonAlign =\n buttonPosition === 'left'\n ? 'justify-start'\n : buttonPosition === 'right'\n ? 'justify-end'\n : 'justify-center';\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('w-full', className)}\n style={{ ...style, display: 'flex', flexDirection: 'column', gap: gapValue }}\n role=\"status\"\n aria-label=\"Loading form...\"\n aria-busy=\"true\"\n {...rest}\n >\n {/* Form Fields */}\n {Array.from({ length: fields }).map((_, index) => (\n <div key={index} className=\"w-full\" style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>\n {/* Field Label */}\n {showLabels && (\n <Skeleton\n width=\"30%\"\n height=\"0.875rem\"\n variant=\"text\"\n animate={animate}\n baseColor={baseColor}\n highlightColor={highlightColor}\n />\n )}\n {/* Field Input */}\n <Skeleton\n width=\"100%\"\n height=\"2.5rem\"\n variant=\"rectangular\"\n animate={animate}\n baseColor={baseColor}\n highlightColor={highlightColor}\n />\n </div>\n ))}\n\n {/* Submit Button */}\n {showButton && (\n <div className={cn('flex', buttonAlign)} style={{ marginTop: '8px' }}>\n <Skeleton\n width={buttonWidth}\n height=\"2.5rem\"\n variant=\"rounded\"\n animate={animate}\n baseColor={baseColor}\n highlightColor={highlightColor}\n />\n </div>\n )}\n </div>\n );\n }\n);\n\nSkeletonForm.displayName = 'SkeletonForm';\n"],"names":[],"mappings":";;;;;AAkBO,MAAM,eAAe;AAAA,EAC1B,CACE;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,IACb,aAAa;AAAA,IACb,MAAM;AAAA,IACN,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,UAAM,WAAW,cAAc,GAAG;AAClC,UAAM,cACJ,mBAAmB,SACf,kBACA,mBAAmB,UACnB,gBACA;AAEN,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAW,GAAG,UAAU,SAAS;AAAA,QACjC,OAAO,EAAE,GAAG,OAAO,SAAS,QAAQ,eAAe,UAAU,KAAK,SAAA;AAAA,QAClE,MAAK;AAAA,QACL,cAAW;AAAA,QACX,aAAU;AAAA,QACT,GAAG;AAAA,QAGH,UAAA;AAAA,UAAA,MAAM,KAAK,EAAE,QAAQ,OAAA,CAAQ,EAAE,IAAI,CAAC,GAAG,UACtC,qBAAC,SAAgB,WAAU,UAAS,OAAO,EAAE,SAAS,QAAQ,eAAe,UAAU,KAAK,MAAA,GAEzF,UAAA;AAAA,YAAA,cACC;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,OAAM;AAAA,gBACN,QAAO;AAAA,gBACP,SAAQ;AAAA,gBACR;AAAA,gBACA;AAAA,gBACA;AAAA,cAAA;AAAA,YAAA;AAAA,YAIJ;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,OAAM;AAAA,gBACN,QAAO;AAAA,gBACP,SAAQ;AAAA,gBACR;AAAA,gBACA;AAAA,gBACA;AAAA,cAAA;AAAA,YAAA;AAAA,UACF,EAAA,GApBQ,KAqBV,CACD;AAAA,UAGA,cACC,oBAAC,OAAA,EAAI,WAAW,GAAG,QAAQ,WAAW,GAAG,OAAO,EAAE,WAAW,MAAA,GAC3D,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,OAAO;AAAA,cACP,QAAO;AAAA,cACP,SAAQ;AAAA,cACR;AAAA,cACA;AAAA,cACA;AAAA,YAAA;AAAA,UAAA,EACF,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,aAAa,cAAc;"}
package/dist/index14.cjs CHANGED
@@ -2,23 +2,27 @@
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
6
  const classNames = require("./index3.cjs");
6
7
  const colors = require("./index4.cjs");
7
- const SpinnerRing = react.forwardRef(
8
+ const SpinnerCircle = react.forwardRef(
8
9
  ({
9
- size = 40,
10
+ size = "md",
10
11
  color = "#3b82f6",
11
- secondaryColor = "rgba(0, 0, 0, 0.1)",
12
12
  thickness = 4,
13
13
  speed = "normal",
14
+ reverse = false,
15
+ respectMotionPreference = true,
14
16
  className,
15
17
  style,
16
- testId = "spinner-ring",
18
+ testId = "spinner-circle",
17
19
  visible = true,
18
20
  ariaLabel = "Loading...",
19
21
  ...rest
20
22
  }, ref) => {
21
23
  if (!visible) return null;
24
+ const prefersReducedMotion = hooks.useReducedMotion();
25
+ const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
22
26
  return /* @__PURE__ */ jsxRuntime.jsx(
23
27
  "div",
24
28
  {
@@ -31,22 +35,35 @@ const SpinnerRing = react.forwardRef(
31
35
  "aria-busy": "true",
32
36
  ...rest,
33
37
  children: /* @__PURE__ */ jsxRuntime.jsx(
34
- "div",
38
+ "svg",
35
39
  {
36
- className: "rounded-full",
40
+ className: "animate-spinner-rotate",
37
41
  style: {
38
42
  width: colors.normalizeSize(size),
39
43
  height: colors.normalizeSize(size),
40
- border: `${thickness}px solid ${secondaryColor}`,
41
- borderTopColor: color,
42
- animation: `spinner-rotate ${colors.getAnimationDuration(speed)} linear infinite`
43
- }
44
+ animationDuration: effectiveDuration,
45
+ animationDirection: reverse ? "reverse" : "normal"
46
+ },
47
+ viewBox: "0 0 50 50",
48
+ children: /* @__PURE__ */ jsxRuntime.jsx(
49
+ "circle",
50
+ {
51
+ cx: "25",
52
+ cy: "25",
53
+ r: 25 - thickness * 2,
54
+ fill: "none",
55
+ stroke: color,
56
+ strokeWidth: thickness,
57
+ strokeDasharray: "80, 200",
58
+ strokeLinecap: "round"
59
+ }
60
+ )
44
61
  }
45
62
  )
46
63
  }
47
64
  );
48
65
  }
49
66
  );
50
- SpinnerRing.displayName = "SpinnerRing";
51
- exports.SpinnerRing = SpinnerRing;
67
+ SpinnerCircle.displayName = "SpinnerCircle";
68
+ exports.SpinnerCircle = SpinnerCircle;
52
69
  //# sourceMappingURL=index14.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index14.cjs","sources":["../src/components/spinner/SpinnerRing.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerRingProps } from '../../types';\nimport { cn, normalizeSize, getAnimationDuration } from '../../utils';\n\n/**\n * SpinnerRing - Border-only rotating spinner\n *\n * A ring-style spinner with a transparent center and colored border.\n *\n * @example\n * ```tsx\n * <SpinnerRing size={40} color=\"#8b5cf6\" />\n * <SpinnerRing size={32} thickness={3} speed=\"slow\" />\n * <SpinnerRing size={40} color=\"#3b82f6\" secondaryColor=\"#e0e0e0\" />\n * ```\n */\nexport const SpinnerRing = forwardRef<HTMLDivElement, SpinnerRingProps>(\n (\n {\n size = 40,\n color = '#3b82f6',\n secondaryColor = 'rgba(0, 0, 0, 0.1)',\n thickness = 4,\n speed = 'normal',\n className,\n style,\n testId = 'spinner-ring',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"rounded-full\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n border: `${thickness}px solid ${secondaryColor}`,\n borderTopColor: color,\n animation: `spinner-rotate ${getAnimationDuration(speed)} linear infinite`,\n }}\n />\n </div>\n );\n }\n);\n\nSpinnerRing.displayName = 'SpinnerRing';\n"],"names":["forwardRef","jsx","cn","normalizeSize","getAnimationDuration"],"mappings":";;;;;;AAgBO,MAAM,cAAcA,MAAAA;AAAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAWC,WAAAA,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAAD,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAOE,OAAAA,cAAc,IAAI;AAAA,cACzB,QAAQA,OAAAA,cAAc,IAAI;AAAA,cAC1B,QAAQ,GAAG,SAAS,YAAY,cAAc;AAAA,cAC9C,gBAAgB;AAAA,cAChB,WAAW,kBAAkBC,4BAAqB,KAAK,CAAC;AAAA,YAAA;AAAA,UAC1D;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;;"}
1
+ {"version":3,"file":"index14.cjs","sources":["../src/components/spinner/SpinnerCircle.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerCircleProps } from '../../types';\nimport { cn, normalizeSize, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * SpinnerCircle - Basic rotating circle spinner\n *\n * A simple, elegant circular spinner with a partial arc that rotates continuously.\n *\n * @example\n * ```tsx\n * <SpinnerCircle size={40} color=\"#3b82f6\" />\n * <SpinnerCircle size=\"lg\" thickness={3} speed=\"fast\" />\n * <SpinnerCircle size=\"md\" reverse />\n * ```\n */\nexport const SpinnerCircle = forwardRef<HTMLDivElement, SpinnerCircleProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n thickness = 4,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'spinner-circle',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <svg\n className=\"animate-spinner-rotate\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n animationDuration: effectiveDuration,\n animationDirection: reverse ? 'reverse' : 'normal',\n }}\n viewBox=\"0 0 50 50\"\n >\n <circle\n cx=\"25\"\n cy=\"25\"\n r={25 - thickness * 2}\n fill=\"none\"\n stroke={color}\n strokeWidth={thickness}\n strokeDasharray=\"80, 200\"\n strokeLinecap=\"round\"\n />\n </svg>\n </div>\n );\n }\n);\n\nSpinnerCircle.displayName = 'SpinnerCircle';\n"],"names":["forwardRef","useReducedMotion","getEffectiveDuration","jsx","cn","normalizeSize"],"mappings":";;;;;;;AAgBO,MAAM,gBAAgBA,MAAAA;AAAAA,EAC3B,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,UAAM,uBAAuBC,MAAAA,iBAAA;AAC7B,UAAM,oBAAoBC,MAAAA,qBAAqB,OAAO,yBAAyB,oBAAoB;AAEnG,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAWC,WAAAA,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAAD,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAOE,OAAAA,cAAc,IAAI;AAAA,cACzB,QAAQA,OAAAA,cAAc,IAAI;AAAA,cAC1B,mBAAmB;AAAA,cACnB,oBAAoB,UAAU,YAAY;AAAA,YAAA;AAAA,YAE5C,SAAQ;AAAA,YAER,UAAAF,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,IAAG;AAAA,gBACH,IAAG;AAAA,gBACH,GAAG,KAAK,YAAY;AAAA,gBACpB,MAAK;AAAA,gBACL,QAAQ;AAAA,gBACR,aAAa;AAAA,gBACb,iBAAgB;AAAA,gBAChB,eAAc;AAAA,cAAA;AAAA,YAAA;AAAA,UAChB;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,cAAc,cAAc;;"}
package/dist/index14.js CHANGED
@@ -1,22 +1,26 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
+ import { useReducedMotion, getEffectiveDuration } from "./index31.js";
3
4
  import { cn } from "./index3.js";
4
- import { getAnimationDuration, normalizeSize } from "./index4.js";
5
- const SpinnerRing = forwardRef(
5
+ import { normalizeSize } from "./index4.js";
6
+ const SpinnerCircle = forwardRef(
6
7
  ({
7
- size = 40,
8
+ size = "md",
8
9
  color = "#3b82f6",
9
- secondaryColor = "rgba(0, 0, 0, 0.1)",
10
10
  thickness = 4,
11
11
  speed = "normal",
12
+ reverse = false,
13
+ respectMotionPreference = true,
12
14
  className,
13
15
  style,
14
- testId = "spinner-ring",
16
+ testId = "spinner-circle",
15
17
  visible = true,
16
18
  ariaLabel = "Loading...",
17
19
  ...rest
18
20
  }, ref) => {
19
21
  if (!visible) return null;
22
+ const prefersReducedMotion = useReducedMotion();
23
+ const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
20
24
  return /* @__PURE__ */ jsx(
21
25
  "div",
22
26
  {
@@ -29,24 +33,37 @@ const SpinnerRing = forwardRef(
29
33
  "aria-busy": "true",
30
34
  ...rest,
31
35
  children: /* @__PURE__ */ jsx(
32
- "div",
36
+ "svg",
33
37
  {
34
- className: "rounded-full",
38
+ className: "animate-spinner-rotate",
35
39
  style: {
36
40
  width: normalizeSize(size),
37
41
  height: normalizeSize(size),
38
- border: `${thickness}px solid ${secondaryColor}`,
39
- borderTopColor: color,
40
- animation: `spinner-rotate ${getAnimationDuration(speed)} linear infinite`
41
- }
42
+ animationDuration: effectiveDuration,
43
+ animationDirection: reverse ? "reverse" : "normal"
44
+ },
45
+ viewBox: "0 0 50 50",
46
+ children: /* @__PURE__ */ jsx(
47
+ "circle",
48
+ {
49
+ cx: "25",
50
+ cy: "25",
51
+ r: 25 - thickness * 2,
52
+ fill: "none",
53
+ stroke: color,
54
+ strokeWidth: thickness,
55
+ strokeDasharray: "80, 200",
56
+ strokeLinecap: "round"
57
+ }
58
+ )
42
59
  }
43
60
  )
44
61
  }
45
62
  );
46
63
  }
47
64
  );
48
- SpinnerRing.displayName = "SpinnerRing";
65
+ SpinnerCircle.displayName = "SpinnerCircle";
49
66
  export {
50
- SpinnerRing
67
+ SpinnerCircle
51
68
  };
52
69
  //# sourceMappingURL=index14.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index14.js","sources":["../src/components/spinner/SpinnerRing.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerRingProps } from '../../types';\nimport { cn, normalizeSize, getAnimationDuration } from '../../utils';\n\n/**\n * SpinnerRing - Border-only rotating spinner\n *\n * A ring-style spinner with a transparent center and colored border.\n *\n * @example\n * ```tsx\n * <SpinnerRing size={40} color=\"#8b5cf6\" />\n * <SpinnerRing size={32} thickness={3} speed=\"slow\" />\n * <SpinnerRing size={40} color=\"#3b82f6\" secondaryColor=\"#e0e0e0\" />\n * ```\n */\nexport const SpinnerRing = forwardRef<HTMLDivElement, SpinnerRingProps>(\n (\n {\n size = 40,\n color = '#3b82f6',\n secondaryColor = 'rgba(0, 0, 0, 0.1)',\n thickness = 4,\n speed = 'normal',\n className,\n style,\n testId = 'spinner-ring',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"rounded-full\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n border: `${thickness}px solid ${secondaryColor}`,\n borderTopColor: color,\n animation: `spinner-rotate ${getAnimationDuration(speed)} linear infinite`,\n }}\n />\n </div>\n );\n }\n);\n\nSpinnerRing.displayName = 'SpinnerRing';\n"],"names":[],"mappings":";;;;AAgBO,MAAM,cAAc;AAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAW,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO,cAAc,IAAI;AAAA,cACzB,QAAQ,cAAc,IAAI;AAAA,cAC1B,QAAQ,GAAG,SAAS,YAAY,cAAc;AAAA,cAC9C,gBAAgB;AAAA,cAChB,WAAW,kBAAkB,qBAAqB,KAAK,CAAC;AAAA,YAAA;AAAA,UAC1D;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;"}
1
+ {"version":3,"file":"index14.js","sources":["../src/components/spinner/SpinnerCircle.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerCircleProps } from '../../types';\nimport { cn, normalizeSize, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * SpinnerCircle - Basic rotating circle spinner\n *\n * A simple, elegant circular spinner with a partial arc that rotates continuously.\n *\n * @example\n * ```tsx\n * <SpinnerCircle size={40} color=\"#3b82f6\" />\n * <SpinnerCircle size=\"lg\" thickness={3} speed=\"fast\" />\n * <SpinnerCircle size=\"md\" reverse />\n * ```\n */\nexport const SpinnerCircle = forwardRef<HTMLDivElement, SpinnerCircleProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n thickness = 4,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'spinner-circle',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <svg\n className=\"animate-spinner-rotate\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n animationDuration: effectiveDuration,\n animationDirection: reverse ? 'reverse' : 'normal',\n }}\n viewBox=\"0 0 50 50\"\n >\n <circle\n cx=\"25\"\n cy=\"25\"\n r={25 - thickness * 2}\n fill=\"none\"\n stroke={color}\n strokeWidth={thickness}\n strokeDasharray=\"80, 200\"\n strokeLinecap=\"round\"\n />\n </svg>\n </div>\n );\n }\n);\n\nSpinnerCircle.displayName = 'SpinnerCircle';\n"],"names":[],"mappings":";;;;;AAgBO,MAAM,gBAAgB;AAAA,EAC3B,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,UAAM,uBAAuB,iBAAA;AAC7B,UAAM,oBAAoB,qBAAqB,OAAO,yBAAyB,oBAAoB;AAEnG,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAW,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAO,cAAc,IAAI;AAAA,cACzB,QAAQ,cAAc,IAAI;AAAA,cAC1B,mBAAmB;AAAA,cACnB,oBAAoB,UAAU,YAAY;AAAA,YAAA;AAAA,YAE5C,SAAQ;AAAA,YAER,UAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,IAAG;AAAA,gBACH,IAAG;AAAA,gBACH,GAAG,KAAK,YAAY;AAAA,gBACpB,MAAK;AAAA,gBACL,QAAQ;AAAA,gBACR,aAAa;AAAA,gBACb,iBAAgB;AAAA,gBAChB,eAAc;AAAA,cAAA;AAAA,YAAA;AAAA,UAChB;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,cAAc,cAAc;"}
package/dist/index15.cjs CHANGED
@@ -2,26 +2,28 @@
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");
5
+ const hooks = require("./index31.cjs");
6
6
  const classNames = require("./index3.cjs");
7
- const SpinnerDots = react.forwardRef(
7
+ const colors = require("./index4.cjs");
8
+ const SpinnerRing = react.forwardRef(
8
9
  ({
9
- size = 40,
10
+ size = "md",
10
11
  color = "#3b82f6",
11
- dotCount = 8,
12
- dotSize = 4,
12
+ secondaryColor = "rgba(0, 0, 0, 0.1)",
13
+ thickness = 4,
13
14
  speed = "normal",
15
+ reverse = false,
16
+ respectMotionPreference = true,
14
17
  className,
15
18
  style,
16
- testId = "spinner-dots",
19
+ testId = "spinner-ring",
17
20
  visible = true,
18
21
  ariaLabel = "Loading...",
19
22
  ...rest
20
23
  }, ref) => {
21
24
  if (!visible) return null;
22
- const sizeValue = colors.parseSizeToNumber(size, 40);
23
- const dotSizeValue = colors.parseSizeToNumber(dotSize, 4);
24
- const radius = (sizeValue - dotSizeValue) / 2;
25
+ const prefersReducedMotion = hooks.useReducedMotion();
26
+ const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
25
27
  return /* @__PURE__ */ jsxRuntime.jsx(
26
28
  "div",
27
29
  {
@@ -36,40 +38,21 @@ const SpinnerDots = react.forwardRef(
36
38
  children: /* @__PURE__ */ jsxRuntime.jsx(
37
39
  "div",
38
40
  {
39
- className: "relative",
41
+ className: "rounded-full",
40
42
  style: {
41
43
  width: colors.normalizeSize(size),
42
44
  height: colors.normalizeSize(size),
43
- animation: `spinner-rotate ${colors.getAnimationDuration(speed)} linear infinite`
44
- },
45
- children: Array.from({ length: dotCount }).map((_, index) => {
46
- const angle = 360 / dotCount * index;
47
- const radian = angle * Math.PI / 180;
48
- const x = radius * Math.cos(radian) + radius;
49
- const y = radius * Math.sin(radian) + radius;
50
- return /* @__PURE__ */ jsxRuntime.jsx(
51
- "div",
52
- {
53
- className: "absolute rounded-full",
54
- style: {
55
- width: colors.normalizeSize(dotSize),
56
- height: colors.normalizeSize(dotSize),
57
- backgroundColor: color,
58
- left: `${x}px`,
59
- top: `${y}px`,
60
- opacity: 1 - index / dotCount * 0.7
61
- // Fade effect
62
- }
63
- },
64
- index
65
- );
66
- })
45
+ border: `${thickness}px solid ${secondaryColor}`,
46
+ borderTopColor: color,
47
+ animation: `spinner-rotate ${effectiveDuration} linear infinite`,
48
+ animationDirection: reverse ? "reverse" : "normal"
49
+ }
67
50
  }
68
51
  )
69
52
  }
70
53
  );
71
54
  }
72
55
  );
73
- SpinnerDots.displayName = "SpinnerDots";
74
- exports.SpinnerDots = SpinnerDots;
56
+ SpinnerRing.displayName = "SpinnerRing";
57
+ exports.SpinnerRing = SpinnerRing;
75
58
  //# sourceMappingURL=index15.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index15.cjs","sources":["../src/components/spinner/SpinnerDots.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerDotsProps } from '../../types';\nimport { cn, normalizeSize, getAnimationDuration, parseSizeToNumber } from '../../utils';\n\n/**\n * SpinnerDots - Multiple dots rotating around center\n *\n * A spinner with multiple dots arranged in a circle that rotates continuously.\n *\n * @example\n * ```tsx\n * <SpinnerDots size={40} color=\"#3b82f6\" />\n * <SpinnerDots size={48} dotCount={8} dotSize={6} />\n * ```\n */\nexport const SpinnerDots = forwardRef<HTMLDivElement, SpinnerDotsProps>(\n (\n {\n size = 40,\n color = '#3b82f6',\n dotCount = 8,\n dotSize = 4,\n speed = 'normal',\n className,\n style,\n testId = 'spinner-dots',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const sizeValue = parseSizeToNumber(size, 40);\n const dotSizeValue = parseSizeToNumber(dotSize, 4);\n const radius = (sizeValue - dotSizeValue) / 2;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"relative\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n animation: `spinner-rotate ${getAnimationDuration(speed)} linear infinite`,\n }}\n >\n {Array.from({ length: dotCount }).map((_, index) => {\n const angle = (360 / dotCount) * index;\n const radian = (angle * Math.PI) / 180;\n const x = radius * Math.cos(radian) + radius;\n const y = radius * Math.sin(radian) + radius;\n\n return (\n <div\n key={index}\n className=\"absolute rounded-full\"\n style={{\n width: normalizeSize(dotSize),\n height: normalizeSize(dotSize),\n backgroundColor: color,\n left: `${x}px`,\n top: `${y}px`,\n opacity: 1 - (index / dotCount) * 0.7, // Fade effect\n }}\n />\n );\n })}\n </div>\n </div>\n );\n }\n);\n\nSpinnerDots.displayName = 'SpinnerDots';\n"],"names":["forwardRef","parseSizeToNumber","jsx","cn","normalizeSize","getAnimationDuration"],"mappings":";;;;;;AAeO,MAAM,cAAcA,MAAAA;AAAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,UAAU;AAAA,IACV,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,UAAM,YAAYC,OAAAA,kBAAkB,MAAM,EAAE;AAC5C,UAAM,eAAeA,OAAAA,kBAAkB,SAAS,CAAC;AACjD,UAAM,UAAU,YAAY,gBAAgB;AAE5C,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAWC,WAAAA,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAAD,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAOE,OAAAA,cAAc,IAAI;AAAA,cACzB,QAAQA,OAAAA,cAAc,IAAI;AAAA,cAC1B,WAAW,kBAAkBC,4BAAqB,KAAK,CAAC;AAAA,YAAA;AAAA,YAGzD,UAAA,MAAM,KAAK,EAAE,QAAQ,SAAA,CAAU,EAAE,IAAI,CAAC,GAAG,UAAU;AAClD,oBAAM,QAAS,MAAM,WAAY;AACjC,oBAAM,SAAU,QAAQ,KAAK,KAAM;AACnC,oBAAM,IAAI,SAAS,KAAK,IAAI,MAAM,IAAI;AACtC,oBAAM,IAAI,SAAS,KAAK,IAAI,MAAM,IAAI;AAEtC,qBACEH,2BAAAA;AAAAA,gBAAC;AAAA,gBAAA;AAAA,kBAEC,WAAU;AAAA,kBACV,OAAO;AAAA,oBACL,OAAOE,OAAAA,cAAc,OAAO;AAAA,oBAC5B,QAAQA,OAAAA,cAAc,OAAO;AAAA,oBAC7B,iBAAiB;AAAA,oBACjB,MAAM,GAAG,CAAC;AAAA,oBACV,KAAK,GAAG,CAAC;AAAA,oBACT,SAAS,IAAK,QAAQ,WAAY;AAAA;AAAA,kBAAA;AAAA,gBACpC;AAAA,gBATK;AAAA,cAAA;AAAA,YAYX,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;;"}
1
+ {"version":3,"file":"index15.cjs","sources":["../src/components/spinner/SpinnerRing.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { SpinnerRingProps } from '../../types';\nimport { cn, normalizeSize, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * SpinnerRing - Border-only rotating spinner\n *\n * A ring-style spinner with a transparent center and colored border.\n *\n * @example\n * ```tsx\n * <SpinnerRing size=\"lg\" color=\"#8b5cf6\" />\n * <SpinnerRing size=\"sm\" thickness={3} speed=\"slow\" />\n * <SpinnerRing size=\"md\" color=\"#3b82f6\" secondaryColor=\"#e0e0e0\" reverse />\n * ```\n */\nexport const SpinnerRing = forwardRef<HTMLDivElement, SpinnerRingProps>(\n (\n {\n size = 'md',\n color = '#3b82f6',\n secondaryColor = 'rgba(0, 0, 0, 0.1)',\n thickness = 4,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'spinner-ring',\n visible = true,\n ariaLabel = 'Loading...',\n ...rest\n },\n ref\n ) => {\n if (!visible) return null;\n\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center', className)}\n style={style}\n role=\"status\"\n aria-label={ariaLabel}\n aria-busy=\"true\"\n {...rest}\n >\n <div\n className=\"rounded-full\"\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n border: `${thickness}px solid ${secondaryColor}`,\n borderTopColor: color,\n animation: `spinner-rotate ${effectiveDuration} linear infinite`,\n animationDirection: reverse ? 'reverse' : 'normal',\n }}\n />\n </div>\n );\n }\n);\n\nSpinnerRing.displayName = 'SpinnerRing';\n"],"names":["forwardRef","useReducedMotion","getEffectiveDuration","jsx","cn","normalizeSize"],"mappings":";;;;;;;AAgBO,MAAM,cAAcA,MAAAA;AAAAA,EACzB,CACE;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,QAAS,QAAO;AAErB,UAAM,uBAAuBC,MAAAA,iBAAA;AAC7B,UAAM,oBAAoBC,MAAAA,qBAAqB,OAAO,yBAAyB,oBAAoB;AAEnG,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAa;AAAA,QACb,WAAWC,WAAAA,GAAG,2CAA2C,SAAS;AAAA,QAClE;AAAA,QACA,MAAK;AAAA,QACL,cAAY;AAAA,QACZ,aAAU;AAAA,QACT,GAAG;AAAA,QAEJ,UAAAD,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA,cACL,OAAOE,OAAAA,cAAc,IAAI;AAAA,cACzB,QAAQA,OAAAA,cAAc,IAAI;AAAA,cAC1B,QAAQ,GAAG,SAAS,YAAY,cAAc;AAAA,cAC9C,gBAAgB;AAAA,cAChB,WAAW,kBAAkB,iBAAiB;AAAA,cAC9C,oBAAoB,UAAU,YAAY;AAAA,YAAA;AAAA,UAC5C;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,YAAY,cAAc;;"}