@particle-academy/react-fancy 5.10.0 → 5.11.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.
- package/dist/index.cjs +17 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +17 -8
- package/dist/index.js.map +1 -1
- package/dist/styles.css +12 -0
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -980,7 +980,15 @@ interface ProgressProps {
|
|
|
980
980
|
value?: number;
|
|
981
981
|
max?: number;
|
|
982
982
|
variant?: "bar" | "circular";
|
|
983
|
-
|
|
983
|
+
/**
|
|
984
|
+
* Named scale, or an explicit pixel diameter for `variant="circular"`.
|
|
985
|
+
*
|
|
986
|
+
* The scale topped out at 64px and was written inline, so a larger ring was
|
|
987
|
+
* impossible rather than merely awkward.
|
|
988
|
+
*/
|
|
989
|
+
size?: "sm" | "md" | "lg" | number;
|
|
990
|
+
/** Ring thickness in px (circular only). Derived from the diameter if unset. */
|
|
991
|
+
strokeWidth?: number;
|
|
984
992
|
color?: Color;
|
|
985
993
|
indeterminate?: boolean;
|
|
986
994
|
showValue?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -980,7 +980,15 @@ interface ProgressProps {
|
|
|
980
980
|
value?: number;
|
|
981
981
|
max?: number;
|
|
982
982
|
variant?: "bar" | "circular";
|
|
983
|
-
|
|
983
|
+
/**
|
|
984
|
+
* Named scale, or an explicit pixel diameter for `variant="circular"`.
|
|
985
|
+
*
|
|
986
|
+
* The scale topped out at 64px and was written inline, so a larger ring was
|
|
987
|
+
* impossible rather than merely awkward.
|
|
988
|
+
*/
|
|
989
|
+
size?: "sm" | "md" | "lg" | number;
|
|
990
|
+
/** Ring thickness in px (circular only). Derived from the diameter if unset. */
|
|
991
|
+
strokeWidth?: number;
|
|
984
992
|
color?: Color;
|
|
985
993
|
indeterminate?: boolean;
|
|
986
994
|
showValue?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -6737,6 +6737,7 @@ var circularSizeMap = {
|
|
|
6737
6737
|
md: 48,
|
|
6738
6738
|
lg: 64
|
|
6739
6739
|
};
|
|
6740
|
+
var namedStrokeWidth = { sm: 3, md: 4, lg: 5 };
|
|
6740
6741
|
var textSizeClasses = {
|
|
6741
6742
|
sm: "text-[8px]",
|
|
6742
6743
|
md: "text-[10px]",
|
|
@@ -6748,15 +6749,18 @@ var Progress = forwardRef(
|
|
|
6748
6749
|
max = 100,
|
|
6749
6750
|
variant = "bar",
|
|
6750
6751
|
size = "md",
|
|
6752
|
+
strokeWidth: strokeWidthProp,
|
|
6751
6753
|
color = "blue",
|
|
6752
6754
|
indeterminate = false,
|
|
6753
6755
|
showValue = false,
|
|
6754
6756
|
className
|
|
6755
6757
|
}, ref) => {
|
|
6758
|
+
const named = typeof size === "number" ? "md" : size;
|
|
6756
6759
|
const percentage = Math.min(100, Math.max(0, value / max * 100));
|
|
6757
6760
|
if (variant === "circular") {
|
|
6758
|
-
const
|
|
6759
|
-
const
|
|
6761
|
+
const pixelSize = typeof size === "number" ? size : null;
|
|
6762
|
+
const diameter = pixelSize ?? circularSizeMap[named];
|
|
6763
|
+
const strokeWidth = strokeWidthProp ?? (pixelSize === null ? namedStrokeWidth[named] : Math.max(3, Math.round(diameter * 0.075)));
|
|
6760
6764
|
const radius = (diameter - strokeWidth) / 2;
|
|
6761
6765
|
const circumference = 2 * Math.PI * radius;
|
|
6762
6766
|
const offset = indeterminate ? circumference * 0.75 : circumference - percentage / 100 * circumference;
|
|
@@ -6769,14 +6773,19 @@ var Progress = forwardRef(
|
|
|
6769
6773
|
"aria-valuemin": 0,
|
|
6770
6774
|
"aria-valuemax": max,
|
|
6771
6775
|
"data-react-fancy-progress": "",
|
|
6772
|
-
|
|
6773
|
-
|
|
6776
|
+
"data-size": pixelSize === null ? named : void 0,
|
|
6777
|
+
className: cn(
|
|
6778
|
+
"relative inline-flex items-center justify-center",
|
|
6779
|
+
className
|
|
6780
|
+
),
|
|
6781
|
+
style: pixelSize === null ? void 0 : { width: pixelSize, height: pixelSize },
|
|
6774
6782
|
children: [
|
|
6775
6783
|
/* @__PURE__ */ jsxs(
|
|
6776
6784
|
"svg",
|
|
6777
6785
|
{
|
|
6778
|
-
|
|
6779
|
-
|
|
6786
|
+
viewBox: `0 0 ${diameter} ${diameter}`,
|
|
6787
|
+
width: "100%",
|
|
6788
|
+
height: "100%",
|
|
6780
6789
|
className: cn(indeterminate && "animate-spin"),
|
|
6781
6790
|
children: [
|
|
6782
6791
|
/* @__PURE__ */ jsx(
|
|
@@ -6814,7 +6823,7 @@ var Progress = forwardRef(
|
|
|
6814
6823
|
className: cn(
|
|
6815
6824
|
"absolute font-medium",
|
|
6816
6825
|
progressText[color],
|
|
6817
|
-
textSizeClasses[
|
|
6826
|
+
textSizeClasses[named]
|
|
6818
6827
|
),
|
|
6819
6828
|
children: [
|
|
6820
6829
|
Math.round(percentage),
|
|
@@ -6842,7 +6851,7 @@ var Progress = forwardRef(
|
|
|
6842
6851
|
{
|
|
6843
6852
|
className: cn(
|
|
6844
6853
|
"w-full overflow-hidden rounded-full bg-zinc-200 dark:bg-zinc-700",
|
|
6845
|
-
barHeightClasses[
|
|
6854
|
+
barHeightClasses[named]
|
|
6846
6855
|
),
|
|
6847
6856
|
children: /* @__PURE__ */ jsx(
|
|
6848
6857
|
"div",
|