@papernote/ui 1.10.9 → 1.10.10
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/components/Progress.d.ts +5 -1
- package/dist/components/Progress.d.ts.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.esm.js +72 -16
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +72 -16
- package/dist/index.js.map +1 -1
- package/dist/styles.css +13 -5
- package/package.json +1 -1
- package/src/components/Progress.stories.tsx +116 -0
- package/src/components/Progress.tsx +153 -26
|
@@ -15,8 +15,12 @@ export interface ProgressProps {
|
|
|
15
15
|
striped?: boolean;
|
|
16
16
|
/** Animated stripes (requires striped=true) */
|
|
17
17
|
animated?: boolean;
|
|
18
|
+
/** Milestone markers (array of values 0-100) */
|
|
19
|
+
milestones?: number[];
|
|
20
|
+
/** Show labels at milestone markers */
|
|
21
|
+
showMilestoneLabels?: boolean;
|
|
18
22
|
/** Class name for container */
|
|
19
23
|
className?: string;
|
|
20
24
|
}
|
|
21
|
-
export default function Progress({ value, variant, size, color, showLabel, label, striped, animated, className, }: ProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export default function Progress({ value, variant, size, color, showLabel, label, striped, animated, milestones, showMilestoneLabels, className, }: ProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
22
26
|
//# sourceMappingURL=Progress.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.d.ts","sourceRoot":"","sources":["../../src/components/Progress.tsx"],"names":[],"mappings":"AACA,MAAM,WAAW,aAAa;IAC5B,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;IACzC,mBAAmB;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,oBAAoB;IACpB,KAAK,CAAC,EA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,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,KAAK,EACL,OAAkB,EAClB,IAAW,EACX,KAAiB,EACjB,SAAiB,EACjB,KAAK,EACL,OAAe,EACf,QAAgB,EAChB,UAAU,EACV,mBAA2B,EAC3B,SAAc,GACf,EAAE,aAAa,2CAuPf"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3550,10 +3550,14 @@ interface ProgressProps {
|
|
|
3550
3550
|
striped?: boolean;
|
|
3551
3551
|
/** Animated stripes (requires striped=true) */
|
|
3552
3552
|
animated?: boolean;
|
|
3553
|
+
/** Milestone markers (array of values 0-100) */
|
|
3554
|
+
milestones?: number[];
|
|
3555
|
+
/** Show labels at milestone markers */
|
|
3556
|
+
showMilestoneLabels?: boolean;
|
|
3553
3557
|
/** Class name for container */
|
|
3554
3558
|
className?: string;
|
|
3555
3559
|
}
|
|
3556
|
-
declare function Progress({ value, variant, size, color, showLabel, label, striped, animated, className, }: ProgressProps): react_jsx_runtime.JSX.Element;
|
|
3560
|
+
declare function Progress({ value, variant, size, color, showLabel, label, striped, animated, milestones, showMilestoneLabels, className, }: ProgressProps): react_jsx_runtime.JSX.Element;
|
|
3557
3561
|
|
|
3558
3562
|
interface AccordionItem {
|
|
3559
3563
|
id: string;
|
package/dist/index.esm.js
CHANGED
|
@@ -9486,7 +9486,7 @@ function ComingSoon({ title, description, icon, features = [], estimatedDate })
|
|
|
9486
9486
|
return (jsx("div", { className: "p-6 max-w-4xl mx-auto", children: jsxs("div", { className: "bg-paper-50 dark:bg-paper-800 rounded-lg shadow-sm border border-paper-200 dark:border-paper-700 p-8", children: [jsxs("div", { className: "flex items-start gap-4 mb-6", children: [jsx("div", { className: "p-3 bg-primary-100 dark:bg-primary-900 rounded-lg", children: icon || jsx(FileText, { className: "h-8 w-8 text-primary-600 dark:text-primary-400" }) }), jsxs("div", { className: "flex-1", children: [jsx("h1", { className: "text-2xl font-bold text-ink-900 dark:text-ink-100 mb-2", children: title }), jsx("p", { className: "text-base text-ink-600 dark:text-ink-400", children: description })] })] }), jsx("div", { className: "mb-6", children: jsxs("div", { className: "inline-flex items-center gap-2 px-4 py-2 bg-warning-100 dark:bg-warning-900 rounded-full", children: [jsx(AlertCircle, { className: "h-4 w-4 text-warning-700 dark:text-warning-300" }), jsx("span", { className: "text-sm font-medium text-warning-700 dark:text-warning-300", children: "Coming Soon - Under Development" })] }) }), features.length > 0 && (jsxs("div", { className: "mb-6", children: [jsxs("h2", { className: "text-lg font-semibold text-ink-900 dark:text-ink-100 mb-3 flex items-center gap-2", children: [jsx(TrendingUp, { className: "h-5 w-5" }), "Planned Features"] }), jsx("ul", { className: "space-y-2", children: features.map((feature, index) => (jsxs("li", { className: "flex items-start gap-2 text-ink-600 dark:text-ink-400", children: [jsx("span", { className: "text-primary-500 mt-1", children: "\u2022" }), jsx("span", { children: feature })] }, index))) })] })), estimatedDate && (jsx("div", { className: "pt-6 border-t border-paper-300 dark:border-paper-600", children: jsxs("div", { className: "flex items-center gap-2 text-sm text-ink-600 dark:text-ink-400", children: [jsx(Calendar$1, { className: "h-4 w-4" }), jsxs("span", { children: [jsx("span", { className: "font-medium", children: "Estimated Release:" }), " ", estimatedDate] })] }) })), jsx("div", { className: "mt-6 p-4 bg-paper-100 dark:bg-paper-700 rounded", children: jsxs("p", { className: "text-sm text-ink-600 dark:text-ink-400", children: [jsx("span", { className: "font-medium", children: "Need this feature sooner?" }), " Contact your administrator to discuss prioritization."] }) })] }) }));
|
|
9487
9487
|
}
|
|
9488
9488
|
|
|
9489
|
-
function Progress({ value, variant = 'linear', size = 'md', color = 'primary', showLabel = false, label, striped = false, animated = false, className = '', }) {
|
|
9489
|
+
function Progress({ value, variant = 'linear', size = 'md', color = 'primary', showLabel = false, label, striped = false, animated = false, milestones, showMilestoneLabels = false, className = '', }) {
|
|
9490
9490
|
// Clamp value between 0 and 100
|
|
9491
9491
|
const clampedValue = Math.min(100, Math.max(0, value));
|
|
9492
9492
|
const colorClasses = {
|
|
@@ -9510,24 +9510,43 @@ function Progress({ value, variant = 'linear', size = 'md', color = 'primary', s
|
|
|
9510
9510
|
md: 'h-2',
|
|
9511
9511
|
lg: 'h-3',
|
|
9512
9512
|
};
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
|
|
9513
|
+
const tickSizes = {
|
|
9514
|
+
sm: { height: 8, width: 2 },
|
|
9515
|
+
md: { height: 12, width: 2 },
|
|
9516
|
+
lg: { height: 16, width: 3 },
|
|
9517
|
+
};
|
|
9518
|
+
// Sort and clamp milestones
|
|
9519
|
+
const sortedMilestones = milestones
|
|
9520
|
+
? [...milestones].map(m => Math.min(100, Math.max(0, m))).sort((a, b) => a - b)
|
|
9521
|
+
: [];
|
|
9522
|
+
return (jsxs("div", { className: `w-full ${className}`, children: [jsxs("div", { className: "relative", children: [jsx("div", { className: `relative w-full rounded-full overflow-hidden ${bgColorClasses[color]} ${heightClasses[size]}`, children: jsx("div", { className: `
|
|
9523
|
+
h-full transition-all duration-300 ease-out
|
|
9524
|
+
${colorClasses[color]}
|
|
9525
|
+
${striped ? 'bg-striped' : ''}
|
|
9526
|
+
${animated && striped ? 'animate-striped' : ''}
|
|
9527
|
+
`, style: {
|
|
9528
|
+
width: `${clampedValue}%`,
|
|
9529
|
+
backgroundImage: striped ? 'linear-gradient(45deg, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent)' : undefined,
|
|
9530
|
+
backgroundSize: striped ? '1rem 1rem' : undefined,
|
|
9531
|
+
}, role: "progressbar", "aria-valuenow": clampedValue, "aria-valuemin": 0, "aria-valuemax": 100 }) }), sortedMilestones.length > 0 && (jsx("div", { className: "absolute inset-0 pointer-events-none", children: sortedMilestones.map((milestone) => (jsx("div", { className: "absolute flex flex-col items-center", style: {
|
|
9532
|
+
left: `${milestone}%`,
|
|
9533
|
+
top: '50%',
|
|
9534
|
+
transform: 'translate(-50%, -50%)',
|
|
9535
|
+
}, children: jsx("div", { className: `rounded-full ${milestone <= clampedValue ? 'bg-ink-700' : 'bg-ink-400'}`, style: {
|
|
9536
|
+
width: tickSizes[size].width,
|
|
9537
|
+
height: tickSizes[size].height,
|
|
9538
|
+
} }) }, milestone))) }))] }), showMilestoneLabels && sortedMilestones.length > 0 && (jsx("div", { className: "relative w-full mt-1", style: { height: '1rem' }, children: sortedMilestones.map((milestone) => (jsxs("span", { className: "absolute text-xs text-ink-500", style: {
|
|
9539
|
+
left: `${milestone}%`,
|
|
9540
|
+
transform: 'translateX(-50%)',
|
|
9541
|
+
}, children: [milestone, "%"] }, milestone))) })), (showLabel || label) && !showMilestoneLabels && (jsx("p", { className: "text-xs text-ink-600 mt-1", children: label || `${Math.round(clampedValue)}%` }))] }));
|
|
9523
9542
|
}
|
|
9524
9543
|
// Circular progress
|
|
9525
9544
|
const sizeValues = {
|
|
9526
|
-
sm: { size: 40, stroke: 3, fontSize: 'text-xs' },
|
|
9527
|
-
md: { size: 60, stroke: 4, fontSize: 'text-sm' },
|
|
9528
|
-
lg: { size: 80, stroke: 5, fontSize: 'text-base' },
|
|
9545
|
+
sm: { size: 40, stroke: 3, fontSize: 'text-xs', dotSize: 4, labelOffset: 14 },
|
|
9546
|
+
md: { size: 60, stroke: 4, fontSize: 'text-sm', dotSize: 5, labelOffset: 18 },
|
|
9547
|
+
lg: { size: 80, stroke: 5, fontSize: 'text-base', dotSize: 6, labelOffset: 22 },
|
|
9529
9548
|
};
|
|
9530
|
-
const { size: svgSize, stroke: strokeWidth, fontSize } = sizeValues[size];
|
|
9549
|
+
const { size: svgSize, stroke: strokeWidth, fontSize, dotSize, labelOffset } = sizeValues[size];
|
|
9531
9550
|
const radius = (svgSize - strokeWidth) / 2;
|
|
9532
9551
|
const circumference = 2 * Math.PI * radius;
|
|
9533
9552
|
const offset = circumference - (clampedValue / 100) * circumference;
|
|
@@ -9543,7 +9562,44 @@ function Progress({ value, variant = 'linear', size = 'md', color = 'primary', s
|
|
|
9543
9562
|
warning: 'stroke-warning-100',
|
|
9544
9563
|
error: 'stroke-error-100',
|
|
9545
9564
|
};
|
|
9546
|
-
|
|
9565
|
+
// Sort and clamp milestones for circular
|
|
9566
|
+
const sortedMilestones = milestones
|
|
9567
|
+
? [...milestones].map(m => Math.min(100, Math.max(0, m))).sort((a, b) => a - b)
|
|
9568
|
+
: [];
|
|
9569
|
+
// Calculate position on circle for a given percentage
|
|
9570
|
+
// SVG is rotated -90deg so 0% is at top
|
|
9571
|
+
const getMilestonePosition = (percentage, r) => {
|
|
9572
|
+
const angle = (percentage / 100) * 2 * Math.PI - Math.PI / 2;
|
|
9573
|
+
return {
|
|
9574
|
+
x: svgSize / 2 + r * Math.cos(angle),
|
|
9575
|
+
y: svgSize / 2 + r * Math.sin(angle),
|
|
9576
|
+
};
|
|
9577
|
+
};
|
|
9578
|
+
// Size for the container when labels are shown
|
|
9579
|
+
const containerSize = showMilestoneLabels && sortedMilestones.length > 0
|
|
9580
|
+
? svgSize + labelOffset * 2
|
|
9581
|
+
: svgSize;
|
|
9582
|
+
return (jsx("div", { className: `inline-flex flex-col items-center ${className}`, children: jsxs("div", { className: "relative", style: { width: containerSize, height: containerSize }, children: [jsxs("svg", { width: svgSize, height: svgSize, style: {
|
|
9583
|
+
position: 'absolute',
|
|
9584
|
+
left: showMilestoneLabels && sortedMilestones.length > 0 ? labelOffset : 0,
|
|
9585
|
+
top: showMilestoneLabels && sortedMilestones.length > 0 ? labelOffset : 0,
|
|
9586
|
+
}, children: [jsx("circle", { cx: svgSize / 2, cy: svgSize / 2, r: radius, fill: "none", strokeWidth: strokeWidth, className: strokeBgColorClasses[color] }), jsx("circle", { cx: svgSize / 2, cy: svgSize / 2, r: radius, fill: "none", strokeWidth: strokeWidth, strokeDasharray: circumference, strokeDashoffset: offset, strokeLinecap: "round", className: `${strokeColorClasses[color]} transition-all duration-300 ease-out`, style: { transform: 'rotate(-90deg)', transformOrigin: 'center' } }), sortedMilestones.map((milestone) => {
|
|
9587
|
+
const pos = getMilestonePosition(milestone, radius);
|
|
9588
|
+
return (jsx("circle", { cx: pos.x, cy: pos.y, r: dotSize / 2, className: milestone <= clampedValue ? 'fill-ink-700' : 'fill-ink-400' }, milestone));
|
|
9589
|
+
})] }), (showLabel || label) && (jsx("div", { className: "absolute flex items-center justify-center", style: {
|
|
9590
|
+
left: showMilestoneLabels && sortedMilestones.length > 0 ? labelOffset : 0,
|
|
9591
|
+
top: showMilestoneLabels && sortedMilestones.length > 0 ? labelOffset : 0,
|
|
9592
|
+
width: svgSize,
|
|
9593
|
+
height: svgSize,
|
|
9594
|
+
}, children: jsx("span", { className: `font-medium text-ink-900 ${fontSize}`, children: label || `${Math.round(clampedValue)}%` }) })), showMilestoneLabels && sortedMilestones.map((milestone) => {
|
|
9595
|
+
const pos = getMilestonePosition(milestone, radius + labelOffset);
|
|
9596
|
+
return (jsxs("span", { className: "absolute text-xs text-ink-500", style: {
|
|
9597
|
+
left: pos.x + labelOffset - 12,
|
|
9598
|
+
top: pos.y + labelOffset - 6,
|
|
9599
|
+
width: 24,
|
|
9600
|
+
textAlign: 'center',
|
|
9601
|
+
}, children: [milestone, "%"] }, milestone));
|
|
9602
|
+
})] }) }));
|
|
9547
9603
|
}
|
|
9548
9604
|
|
|
9549
9605
|
function Accordion({ items, allowMultiple = false, defaultOpen = [], onChange, expandIcon, collapseIcon, showStepNumbers = false, }) {
|