@tinybigui/react 0.15.0 → 0.16.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/README.md +9 -9
- package/dist/index.cjs +556 -100
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +9 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +48 -18
- package/dist/index.d.ts +48 -18
- package/dist/index.js +556 -100
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5159,9 +5159,6 @@ var DrawerItem = forwardRef(
|
|
|
5159
5159
|
DrawerItem.displayName = "DrawerItem";
|
|
5160
5160
|
var progressContainerVariants = cva(["inline-flex", "flex-col", "gap-1"], {
|
|
5161
5161
|
variants: {
|
|
5162
|
-
/**
|
|
5163
|
-
* The visual type of the indicator.
|
|
5164
|
-
*/
|
|
5165
5162
|
type: {
|
|
5166
5163
|
linear: "w-full",
|
|
5167
5164
|
circular: "items-center justify-center w-auto"
|
|
@@ -5171,41 +5168,60 @@ var progressContainerVariants = cva(["inline-flex", "flex-col", "gap-1"], {
|
|
|
5171
5168
|
type: "linear"
|
|
5172
5169
|
}
|
|
5173
5170
|
});
|
|
5174
|
-
var
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5171
|
+
var progressLabelVariants = cva(["text-body-small", "text-on-surface", "select-none"]);
|
|
5172
|
+
var progressTrackVariants = cva(
|
|
5173
|
+
[
|
|
5174
|
+
"relative",
|
|
5175
|
+
"w-full",
|
|
5176
|
+
"overflow-visible",
|
|
5177
|
+
// gap segments extend beyond clipping bounds
|
|
5178
|
+
"rounded-full"
|
|
5179
|
+
],
|
|
5180
|
+
{
|
|
5181
|
+
variants: {
|
|
5182
|
+
thickness: {
|
|
5183
|
+
default: "h-1",
|
|
5184
|
+
thick: "h-2"
|
|
5185
|
+
}
|
|
5186
|
+
},
|
|
5187
|
+
defaultVariants: {
|
|
5188
|
+
thickness: "default"
|
|
5189
|
+
}
|
|
5190
|
+
}
|
|
5191
|
+
);
|
|
5192
|
+
var progressActiveIndicatorVariants = cva([
|
|
5186
5193
|
"absolute",
|
|
5187
5194
|
"left-0",
|
|
5188
5195
|
"top-0",
|
|
5189
5196
|
"h-full",
|
|
5190
5197
|
"rounded-full",
|
|
5191
5198
|
"bg-primary",
|
|
5192
|
-
//
|
|
5199
|
+
// Spatial spring — width changes are spatial (bar growing)
|
|
5193
5200
|
"transition-[width]",
|
|
5194
|
-
"duration-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5201
|
+
"duration-spring-standard-default-spatial",
|
|
5202
|
+
"ease-spring-standard-default-spatial"
|
|
5203
|
+
]);
|
|
5204
|
+
var progressInactiveSegmentVariants = cva([
|
|
5205
|
+
"absolute",
|
|
5206
|
+
"top-0",
|
|
5207
|
+
"right-0",
|
|
5208
|
+
"h-full",
|
|
5209
|
+
"rounded-full",
|
|
5210
|
+
"bg-primary-container",
|
|
5211
|
+
// Spatial spring on left position (gap moves as progress moves)
|
|
5212
|
+
"transition-[left]",
|
|
5213
|
+
"duration-spring-standard-default-spatial",
|
|
5214
|
+
"ease-spring-standard-default-spatial"
|
|
5198
5215
|
]);
|
|
5199
5216
|
var progressStopIndicatorVariants = cva([
|
|
5200
5217
|
"absolute",
|
|
5201
5218
|
"right-0",
|
|
5202
5219
|
"top-1/2",
|
|
5203
5220
|
"-translate-y-1/2",
|
|
5204
|
-
"
|
|
5205
|
-
|
|
5221
|
+
"size-1",
|
|
5222
|
+
// 4dp
|
|
5206
5223
|
"rounded-full",
|
|
5207
5224
|
"bg-primary"
|
|
5208
|
-
// MD3: stop indicator uses primary color
|
|
5209
5225
|
]);
|
|
5210
5226
|
var progressCircularSizeVariants = cva(
|
|
5211
5227
|
["relative", "flex", "items-center", "justify-center", "flex-shrink-0"],
|
|
@@ -5213,11 +5229,8 @@ var progressCircularSizeVariants = cva(
|
|
|
5213
5229
|
variants: {
|
|
5214
5230
|
size: {
|
|
5215
5231
|
small: "h-6 w-6",
|
|
5216
|
-
// MD3: 24dp
|
|
5217
5232
|
medium: "h-12 w-12",
|
|
5218
|
-
// MD3: 48dp (default)
|
|
5219
5233
|
large: "h-16 w-16"
|
|
5220
|
-
// MD3: 64dp
|
|
5221
5234
|
}
|
|
5222
5235
|
},
|
|
5223
5236
|
defaultVariants: {
|
|
@@ -5225,33 +5238,85 @@ var progressCircularSizeVariants = cva(
|
|
|
5225
5238
|
}
|
|
5226
5239
|
}
|
|
5227
5240
|
);
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5241
|
+
function useReducedMotion2() {
|
|
5242
|
+
const [reduced, setReduced] = useState(() => {
|
|
5243
|
+
if (typeof window === "undefined") return false;
|
|
5244
|
+
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
5245
|
+
});
|
|
5246
|
+
useEffect(() => {
|
|
5247
|
+
if (typeof window === "undefined") return;
|
|
5248
|
+
const mql = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
5249
|
+
const handler = (e) => setReduced(e.matches);
|
|
5250
|
+
mql.addEventListener("change", handler);
|
|
5251
|
+
return () => mql.removeEventListener("change", handler);
|
|
5252
|
+
}, []);
|
|
5253
|
+
return reduced;
|
|
5254
|
+
}
|
|
5255
|
+
var STROKE_WIDTH_DEFAULT = 4;
|
|
5256
|
+
var STROKE_WIDTH_THICK = 8;
|
|
5257
|
+
var INDICATOR_TRACK_GAP = 4;
|
|
5236
5258
|
var CIRCULAR_SIZE_PX = {
|
|
5237
5259
|
small: 24,
|
|
5238
5260
|
medium: 48,
|
|
5239
5261
|
large: 64
|
|
5240
5262
|
};
|
|
5241
|
-
|
|
5263
|
+
var WAVE_AMPLITUDE_DEFAULT = 3;
|
|
5264
|
+
var WAVE_AMPLITUDE_THICK = 5;
|
|
5265
|
+
var LINEAR_WAVE_COUNT = 14;
|
|
5266
|
+
var VB_W = 100;
|
|
5267
|
+
var WAVE_WAVELENGTH_CIRCULAR = 30;
|
|
5268
|
+
function getStrokeWidth(thickness) {
|
|
5269
|
+
return thickness === "thick" ? STROKE_WIDTH_THICK : STROKE_WIDTH_DEFAULT;
|
|
5270
|
+
}
|
|
5271
|
+
function getCircularGeometry(size, thickness) {
|
|
5272
|
+
const strokeWidth = getStrokeWidth(thickness);
|
|
5242
5273
|
const diameter = CIRCULAR_SIZE_PX[size];
|
|
5243
|
-
const radius = (diameter -
|
|
5274
|
+
const radius = (diameter - strokeWidth) / 2;
|
|
5244
5275
|
const circumference = 2 * Math.PI * radius;
|
|
5245
5276
|
const viewBox = `0 0 ${diameter} ${diameter}`;
|
|
5246
5277
|
const cx = diameter / 2;
|
|
5247
5278
|
const cy = diameter / 2;
|
|
5248
|
-
return { diameter, radius, circumference, viewBox, cx, cy };
|
|
5279
|
+
return { diameter, radius, circumference, viewBox, cx, cy, strokeWidth };
|
|
5280
|
+
}
|
|
5281
|
+
function buildLinearWavePath(vbWidth, waveCount, amplitude, midY, padCycles = 0) {
|
|
5282
|
+
const wavelength = vbWidth / waveCount;
|
|
5283
|
+
const totalCycles = waveCount + padCycles;
|
|
5284
|
+
const cp = wavelength / 4;
|
|
5285
|
+
const segments = [`M 0 ${midY}`];
|
|
5286
|
+
for (let i = 0; i < totalCycles; i++) {
|
|
5287
|
+
const x = i * wavelength;
|
|
5288
|
+
segments.push(
|
|
5289
|
+
`C ${x + cp} ${midY - amplitude} ${x + wavelength / 2 - cp} ${midY - amplitude} ${x + wavelength / 2} ${midY}`
|
|
5290
|
+
);
|
|
5291
|
+
segments.push(
|
|
5292
|
+
`C ${x + wavelength / 2 + cp} ${midY + amplitude} ${x + wavelength - cp} ${midY + amplitude} ${x + wavelength} ${midY}`
|
|
5293
|
+
);
|
|
5294
|
+
}
|
|
5295
|
+
return segments.join(" ");
|
|
5296
|
+
}
|
|
5297
|
+
function buildCircularWavePath(cx, cy, radius, amplitude, waveCount, steps) {
|
|
5298
|
+
const actualSteps = waveCount * 12;
|
|
5299
|
+
const points = [];
|
|
5300
|
+
for (let i = 0; i <= actualSteps; i++) {
|
|
5301
|
+
const t = i / actualSteps;
|
|
5302
|
+
const angle = t * 2 * Math.PI;
|
|
5303
|
+
const radialOffset = amplitude * Math.sin(2 * Math.PI * waveCount * t);
|
|
5304
|
+
const r = radius + radialOffset;
|
|
5305
|
+
const x = cx + r * Math.cos(angle);
|
|
5306
|
+
const y = cy + r * Math.sin(angle);
|
|
5307
|
+
points.push(
|
|
5308
|
+
i === 0 ? `M ${x.toFixed(2)} ${y.toFixed(2)}` : `L ${x.toFixed(2)} ${y.toFixed(2)}`
|
|
5309
|
+
);
|
|
5310
|
+
}
|
|
5311
|
+
return points.join(" ") + " Z";
|
|
5249
5312
|
}
|
|
5250
5313
|
var Progress = forwardRef(
|
|
5251
5314
|
({
|
|
5252
5315
|
type = "linear",
|
|
5253
5316
|
indeterminate = false,
|
|
5254
5317
|
size = "medium",
|
|
5318
|
+
shape = "flat",
|
|
5319
|
+
thickness = "default",
|
|
5255
5320
|
className,
|
|
5256
5321
|
label,
|
|
5257
5322
|
value = 0,
|
|
@@ -5261,6 +5326,7 @@ var Progress = forwardRef(
|
|
|
5261
5326
|
}, forwardedRef) => {
|
|
5262
5327
|
const internalRef = useRef(null);
|
|
5263
5328
|
const ref = forwardedRef ?? internalRef;
|
|
5329
|
+
const reducedMotion = useReducedMotion2();
|
|
5264
5330
|
const { progressBarProps, labelProps } = useProgressBar({
|
|
5265
5331
|
label,
|
|
5266
5332
|
value,
|
|
@@ -5270,6 +5336,7 @@ var Progress = forwardRef(
|
|
|
5270
5336
|
...restProps
|
|
5271
5337
|
});
|
|
5272
5338
|
const percentage = indeterminate ? 0 : Math.min(100, Math.max(0, (value - minValue) / (maxValue - minValue) * 100));
|
|
5339
|
+
const effectiveShape = reducedMotion ? "flat" : shape;
|
|
5273
5340
|
if (process.env.NODE_ENV !== "production") {
|
|
5274
5341
|
const ariaProps = restProps;
|
|
5275
5342
|
if (!label && !ariaProps["aria-label"] && !ariaProps["aria-labelledby"]) {
|
|
@@ -5286,52 +5353,72 @@ var Progress = forwardRef(
|
|
|
5286
5353
|
className: cn(progressContainerVariants({ type }), className),
|
|
5287
5354
|
children: [
|
|
5288
5355
|
label && /* @__PURE__ */ jsx("span", { ...labelProps, className: cn(progressLabelVariants()), children: label }),
|
|
5289
|
-
type === "linear" ? /* @__PURE__ */ jsx(
|
|
5290
|
-
|
|
5291
|
-
}
|
|
5292
|
-
);
|
|
5293
|
-
}
|
|
5294
|
-
);
|
|
5295
|
-
Progress.displayName = "Progress";
|
|
5296
|
-
function LinearProgress({ percentage, indeterminate }) {
|
|
5297
|
-
if (indeterminate) {
|
|
5298
|
-
return /* @__PURE__ */ jsx("div", { "data-progress-track": "", className: cn(progressTrackVariants()), children: /* @__PURE__ */ jsxs(
|
|
5299
|
-
"div",
|
|
5300
|
-
{
|
|
5301
|
-
"data-progress-indeterminate": "",
|
|
5302
|
-
className: "absolute inset-0 overflow-hidden rounded-full",
|
|
5303
|
-
children: [
|
|
5304
|
-
/* @__PURE__ */ jsx(
|
|
5305
|
-
"div",
|
|
5356
|
+
type === "linear" ? /* @__PURE__ */ jsx(
|
|
5357
|
+
LinearProgress,
|
|
5306
5358
|
{
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5359
|
+
percentage,
|
|
5360
|
+
indeterminate,
|
|
5361
|
+
shape: effectiveShape,
|
|
5362
|
+
thickness,
|
|
5363
|
+
reducedMotion
|
|
5311
5364
|
}
|
|
5312
|
-
)
|
|
5313
|
-
|
|
5314
|
-
"div",
|
|
5365
|
+
) : /* @__PURE__ */ jsx(
|
|
5366
|
+
CircularProgress,
|
|
5315
5367
|
{
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5368
|
+
percentage,
|
|
5369
|
+
indeterminate,
|
|
5370
|
+
size,
|
|
5371
|
+
shape: effectiveShape,
|
|
5372
|
+
thickness,
|
|
5373
|
+
reducedMotion
|
|
5320
5374
|
}
|
|
5321
5375
|
)
|
|
5322
5376
|
]
|
|
5323
5377
|
}
|
|
5324
|
-
)
|
|
5378
|
+
);
|
|
5379
|
+
}
|
|
5380
|
+
);
|
|
5381
|
+
Progress.displayName = "Progress";
|
|
5382
|
+
function LinearProgress({
|
|
5383
|
+
percentage,
|
|
5384
|
+
indeterminate,
|
|
5385
|
+
shape,
|
|
5386
|
+
thickness,
|
|
5387
|
+
reducedMotion
|
|
5388
|
+
}) {
|
|
5389
|
+
if (indeterminate) {
|
|
5390
|
+
return shape === "wavy" ? /* @__PURE__ */ jsx(LinearWavyIndeterminate, { thickness }) : /* @__PURE__ */ jsx(LinearFlatIndeterminate, { thickness });
|
|
5325
5391
|
}
|
|
5326
|
-
return
|
|
5392
|
+
return shape === "wavy" ? /* @__PURE__ */ jsx(
|
|
5393
|
+
LinearWavyDeterminate,
|
|
5394
|
+
{
|
|
5395
|
+
percentage,
|
|
5396
|
+
thickness,
|
|
5397
|
+
reducedMotion
|
|
5398
|
+
}
|
|
5399
|
+
) : /* @__PURE__ */ jsx(LinearFlatDeterminate, { percentage, thickness });
|
|
5400
|
+
}
|
|
5401
|
+
function LinearFlatDeterminate({
|
|
5402
|
+
percentage,
|
|
5403
|
+
thickness
|
|
5404
|
+
}) {
|
|
5405
|
+
return /* @__PURE__ */ jsxs("div", { "data-progress-track": "", className: cn(progressTrackVariants({ thickness })), children: [
|
|
5327
5406
|
/* @__PURE__ */ jsx(
|
|
5328
5407
|
"div",
|
|
5329
5408
|
{
|
|
5330
5409
|
"data-progress-indicator": "",
|
|
5331
|
-
className: cn(
|
|
5410
|
+
className: cn(progressActiveIndicatorVariants()),
|
|
5332
5411
|
style: { width: `${percentage}%` }
|
|
5333
5412
|
}
|
|
5334
5413
|
),
|
|
5414
|
+
percentage < 100 && /* @__PURE__ */ jsx(
|
|
5415
|
+
"div",
|
|
5416
|
+
{
|
|
5417
|
+
"data-progress-inactive-segment": "",
|
|
5418
|
+
className: cn(progressInactiveSegmentVariants()),
|
|
5419
|
+
style: { left: `calc(${percentage}% + ${INDICATOR_TRACK_GAP}px)` }
|
|
5420
|
+
}
|
|
5421
|
+
),
|
|
5335
5422
|
/* @__PURE__ */ jsx(
|
|
5336
5423
|
"div",
|
|
5337
5424
|
{
|
|
@@ -5342,14 +5429,211 @@ function LinearProgress({ percentage, indeterminate }) {
|
|
|
5342
5429
|
)
|
|
5343
5430
|
] });
|
|
5344
5431
|
}
|
|
5432
|
+
function LinearFlatIndeterminate({
|
|
5433
|
+
thickness
|
|
5434
|
+
}) {
|
|
5435
|
+
return /* @__PURE__ */ jsx("div", { "data-progress-track": "", className: cn(progressTrackVariants({ thickness })), children: /* @__PURE__ */ jsxs("div", { "data-progress-indeterminate": "", className: "absolute inset-0 overflow-hidden rounded-full", children: [
|
|
5436
|
+
/* @__PURE__ */ jsx(
|
|
5437
|
+
"div",
|
|
5438
|
+
{
|
|
5439
|
+
className: cn(
|
|
5440
|
+
"bg-primary absolute top-0 h-full rounded-full",
|
|
5441
|
+
"animate-progress-linear-indeterminate-1"
|
|
5442
|
+
)
|
|
5443
|
+
}
|
|
5444
|
+
),
|
|
5445
|
+
/* @__PURE__ */ jsx(
|
|
5446
|
+
"div",
|
|
5447
|
+
{
|
|
5448
|
+
className: cn(
|
|
5449
|
+
"bg-primary absolute top-0 h-full rounded-full",
|
|
5450
|
+
"animate-progress-linear-indeterminate-2"
|
|
5451
|
+
)
|
|
5452
|
+
}
|
|
5453
|
+
)
|
|
5454
|
+
] }) });
|
|
5455
|
+
}
|
|
5456
|
+
function LinearWavyDeterminate({
|
|
5457
|
+
percentage,
|
|
5458
|
+
thickness,
|
|
5459
|
+
reducedMotion
|
|
5460
|
+
}) {
|
|
5461
|
+
const amplitude = thickness === "thick" ? WAVE_AMPLITUDE_THICK : WAVE_AMPLITUDE_DEFAULT;
|
|
5462
|
+
const containerHeight = (thickness === "thick" ? 8 : 4) + 2 * amplitude + 4;
|
|
5463
|
+
const midY = amplitude + 2;
|
|
5464
|
+
const trackHeightClass = thickness === "thick" ? "h-2" : "h-1";
|
|
5465
|
+
const trackPx = getStrokeWidth(thickness);
|
|
5466
|
+
const rampedAmplitude = reducedMotion || percentage <= 0 || percentage >= 100 ? 0 : amplitude * Math.min(
|
|
5467
|
+
(percentage - 10) / 10,
|
|
5468
|
+
// ramp up 10%→20%
|
|
5469
|
+
(90 - percentage) / 10,
|
|
5470
|
+
// ramp down 80%→90%
|
|
5471
|
+
1
|
|
5472
|
+
);
|
|
5473
|
+
const wavePath = buildLinearWavePath(VB_W, LINEAR_WAVE_COUNT, rampedAmplitude, midY);
|
|
5474
|
+
return /* @__PURE__ */ jsxs(
|
|
5475
|
+
"div",
|
|
5476
|
+
{
|
|
5477
|
+
"data-progress-track": "",
|
|
5478
|
+
className: cn("relative w-full overflow-hidden", trackHeightClass),
|
|
5479
|
+
style: { height: containerHeight },
|
|
5480
|
+
children: [
|
|
5481
|
+
/* @__PURE__ */ jsx(
|
|
5482
|
+
"svg",
|
|
5483
|
+
{
|
|
5484
|
+
viewBox: `0 0 ${VB_W} ${containerHeight}`,
|
|
5485
|
+
preserveAspectRatio: "none",
|
|
5486
|
+
className: cn(
|
|
5487
|
+
"absolute inset-0 w-full",
|
|
5488
|
+
"transition-[clip-path]",
|
|
5489
|
+
"duration-spring-standard-default-spatial",
|
|
5490
|
+
"ease-spring-standard-default-spatial"
|
|
5491
|
+
),
|
|
5492
|
+
style: {
|
|
5493
|
+
height: containerHeight,
|
|
5494
|
+
// clip-path applied in rendered-element space: keeps left `percentage`%
|
|
5495
|
+
clipPath: `inset(0 ${100 - percentage}% 0 0)`
|
|
5496
|
+
},
|
|
5497
|
+
"aria-hidden": "true",
|
|
5498
|
+
children: /* @__PURE__ */ jsx(
|
|
5499
|
+
"path",
|
|
5500
|
+
{
|
|
5501
|
+
"data-progress-indicator": "",
|
|
5502
|
+
d: wavePath,
|
|
5503
|
+
fill: "none",
|
|
5504
|
+
stroke: "currentColor",
|
|
5505
|
+
strokeWidth: getStrokeWidth(thickness),
|
|
5506
|
+
strokeLinecap: "round",
|
|
5507
|
+
vectorEffect: "non-scaling-stroke",
|
|
5508
|
+
className: "text-primary"
|
|
5509
|
+
}
|
|
5510
|
+
)
|
|
5511
|
+
}
|
|
5512
|
+
),
|
|
5513
|
+
percentage < 100 && /* @__PURE__ */ jsx(
|
|
5514
|
+
"div",
|
|
5515
|
+
{
|
|
5516
|
+
"data-progress-inactive-segment": "",
|
|
5517
|
+
className: cn(progressInactiveSegmentVariants()),
|
|
5518
|
+
style: {
|
|
5519
|
+
left: `calc(${percentage}% + ${INDICATOR_TRACK_GAP}px)`,
|
|
5520
|
+
height: trackPx,
|
|
5521
|
+
top: midY - trackPx / 2
|
|
5522
|
+
}
|
|
5523
|
+
}
|
|
5524
|
+
),
|
|
5525
|
+
/* @__PURE__ */ jsx(
|
|
5526
|
+
"div",
|
|
5527
|
+
{
|
|
5528
|
+
"data-stop-indicator": "",
|
|
5529
|
+
className: cn(progressStopIndicatorVariants()),
|
|
5530
|
+
style: { top: midY },
|
|
5531
|
+
"aria-hidden": "true"
|
|
5532
|
+
}
|
|
5533
|
+
)
|
|
5534
|
+
]
|
|
5535
|
+
}
|
|
5536
|
+
);
|
|
5537
|
+
}
|
|
5538
|
+
function LinearWavyIndeterminate({
|
|
5539
|
+
thickness
|
|
5540
|
+
}) {
|
|
5541
|
+
const amplitude = thickness === "thick" ? WAVE_AMPLITUDE_THICK : WAVE_AMPLITUDE_DEFAULT;
|
|
5542
|
+
const containerHeight = (thickness === "thick" ? 8 : 4) + 2 * amplitude + 4;
|
|
5543
|
+
const midY = amplitude + 2;
|
|
5544
|
+
const trackHeightClass = thickness === "thick" ? "h-2" : "h-1";
|
|
5545
|
+
const trackPx = getStrokeWidth(thickness);
|
|
5546
|
+
const wavePath = buildLinearWavePath(VB_W, LINEAR_WAVE_COUNT, amplitude, midY);
|
|
5547
|
+
return /* @__PURE__ */ jsxs(
|
|
5548
|
+
"div",
|
|
5549
|
+
{
|
|
5550
|
+
"data-progress-track": "",
|
|
5551
|
+
className: cn("relative w-full overflow-hidden", trackHeightClass),
|
|
5552
|
+
style: { height: containerHeight },
|
|
5553
|
+
children: [
|
|
5554
|
+
/* @__PURE__ */ jsx(
|
|
5555
|
+
"div",
|
|
5556
|
+
{
|
|
5557
|
+
className: "bg-primary-container absolute right-0 left-0 rounded-full",
|
|
5558
|
+
style: { height: trackPx, top: midY - trackPx / 2 }
|
|
5559
|
+
}
|
|
5560
|
+
),
|
|
5561
|
+
/* @__PURE__ */ jsxs("div", { "data-progress-indeterminate": "", className: "absolute inset-0", children: [
|
|
5562
|
+
/* @__PURE__ */ jsx(
|
|
5563
|
+
"svg",
|
|
5564
|
+
{
|
|
5565
|
+
viewBox: `0 0 ${VB_W} ${containerHeight}`,
|
|
5566
|
+
preserveAspectRatio: "none",
|
|
5567
|
+
className: "animate-progress-linear-indeterminate-1 absolute top-0 h-full",
|
|
5568
|
+
"aria-hidden": "true",
|
|
5569
|
+
children: /* @__PURE__ */ jsx(
|
|
5570
|
+
"path",
|
|
5571
|
+
{
|
|
5572
|
+
d: wavePath,
|
|
5573
|
+
fill: "none",
|
|
5574
|
+
stroke: "currentColor",
|
|
5575
|
+
strokeWidth: getStrokeWidth(thickness),
|
|
5576
|
+
strokeLinecap: "round",
|
|
5577
|
+
vectorEffect: "non-scaling-stroke",
|
|
5578
|
+
className: "text-primary"
|
|
5579
|
+
}
|
|
5580
|
+
)
|
|
5581
|
+
}
|
|
5582
|
+
),
|
|
5583
|
+
/* @__PURE__ */ jsx(
|
|
5584
|
+
"svg",
|
|
5585
|
+
{
|
|
5586
|
+
viewBox: `0 0 ${VB_W} ${containerHeight}`,
|
|
5587
|
+
preserveAspectRatio: "none",
|
|
5588
|
+
className: "animate-progress-linear-indeterminate-2 absolute top-0 h-full",
|
|
5589
|
+
"aria-hidden": "true",
|
|
5590
|
+
children: /* @__PURE__ */ jsx(
|
|
5591
|
+
"path",
|
|
5592
|
+
{
|
|
5593
|
+
d: wavePath,
|
|
5594
|
+
fill: "none",
|
|
5595
|
+
stroke: "currentColor",
|
|
5596
|
+
strokeWidth: getStrokeWidth(thickness),
|
|
5597
|
+
strokeLinecap: "round",
|
|
5598
|
+
vectorEffect: "non-scaling-stroke",
|
|
5599
|
+
className: "text-primary"
|
|
5600
|
+
}
|
|
5601
|
+
)
|
|
5602
|
+
}
|
|
5603
|
+
)
|
|
5604
|
+
] })
|
|
5605
|
+
]
|
|
5606
|
+
}
|
|
5607
|
+
);
|
|
5608
|
+
}
|
|
5345
5609
|
function CircularProgress({
|
|
5346
5610
|
percentage,
|
|
5347
5611
|
indeterminate,
|
|
5348
|
-
size
|
|
5612
|
+
size,
|
|
5613
|
+
shape,
|
|
5614
|
+
thickness,
|
|
5615
|
+
reducedMotion
|
|
5349
5616
|
}) {
|
|
5350
|
-
const { radius, circumference, viewBox, cx, cy } = getCircularGeometry(
|
|
5351
|
-
|
|
5617
|
+
const { radius, circumference, viewBox, cx, cy, strokeWidth, diameter } = getCircularGeometry(
|
|
5618
|
+
size,
|
|
5619
|
+
thickness
|
|
5620
|
+
);
|
|
5352
5621
|
if (indeterminate) {
|
|
5622
|
+
if (shape === "wavy") {
|
|
5623
|
+
return /* @__PURE__ */ jsx(
|
|
5624
|
+
CircularWavyIndeterminate,
|
|
5625
|
+
{
|
|
5626
|
+
size,
|
|
5627
|
+
cx,
|
|
5628
|
+
cy,
|
|
5629
|
+
radius,
|
|
5630
|
+
circumference,
|
|
5631
|
+
viewBox,
|
|
5632
|
+
strokeWidth,
|
|
5633
|
+
diameter
|
|
5634
|
+
}
|
|
5635
|
+
);
|
|
5636
|
+
}
|
|
5353
5637
|
return /* @__PURE__ */ jsx(
|
|
5354
5638
|
"div",
|
|
5355
5639
|
{
|
|
@@ -5371,8 +5655,8 @@ function CircularProgress({
|
|
|
5371
5655
|
r: radius,
|
|
5372
5656
|
fill: "none",
|
|
5373
5657
|
stroke: "currentColor",
|
|
5374
|
-
strokeWidth
|
|
5375
|
-
className: "text-
|
|
5658
|
+
strokeWidth,
|
|
5659
|
+
className: "text-primary-container"
|
|
5376
5660
|
}
|
|
5377
5661
|
),
|
|
5378
5662
|
/* @__PURE__ */ jsx(
|
|
@@ -5383,7 +5667,7 @@ function CircularProgress({
|
|
|
5383
5667
|
r: radius,
|
|
5384
5668
|
fill: "none",
|
|
5385
5669
|
stroke: "currentColor",
|
|
5386
|
-
strokeWidth
|
|
5670
|
+
strokeWidth,
|
|
5387
5671
|
className: "animate-progress-circular-dash text-primary",
|
|
5388
5672
|
strokeLinecap: "round"
|
|
5389
5673
|
}
|
|
@@ -5394,41 +5678,211 @@ function CircularProgress({
|
|
|
5394
5678
|
}
|
|
5395
5679
|
);
|
|
5396
5680
|
}
|
|
5397
|
-
|
|
5398
|
-
/* @__PURE__ */ jsx(
|
|
5399
|
-
|
|
5400
|
-
{
|
|
5401
|
-
cx,
|
|
5402
|
-
cy,
|
|
5403
|
-
r: radius,
|
|
5404
|
-
fill: "none",
|
|
5405
|
-
stroke: "currentColor",
|
|
5406
|
-
strokeWidth: STROKE_WIDTH,
|
|
5407
|
-
className: "text-surface-container-highest"
|
|
5408
|
-
}
|
|
5409
|
-
),
|
|
5410
|
-
/* @__PURE__ */ jsx(
|
|
5411
|
-
"circle",
|
|
5681
|
+
if (shape === "wavy") {
|
|
5682
|
+
return /* @__PURE__ */ jsx(
|
|
5683
|
+
CircularWavyDeterminate,
|
|
5412
5684
|
{
|
|
5685
|
+
size,
|
|
5686
|
+
percentage,
|
|
5413
5687
|
cx,
|
|
5414
5688
|
cy,
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
strokeWidth
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
strokeDasharray: circumference,
|
|
5422
|
-
strokeDashoffset
|
|
5689
|
+
radius,
|
|
5690
|
+
circumference,
|
|
5691
|
+
viewBox,
|
|
5692
|
+
strokeWidth,
|
|
5693
|
+
diameter,
|
|
5694
|
+
reducedMotion
|
|
5423
5695
|
}
|
|
5424
|
-
)
|
|
5425
|
-
|
|
5696
|
+
);
|
|
5697
|
+
}
|
|
5698
|
+
const activeArc = percentage / 100 * circumference;
|
|
5699
|
+
const activeArcGapped = Math.max(0, activeArc - INDICATOR_TRACK_GAP);
|
|
5700
|
+
const inactiveArcGapped = Math.max(0, circumference - activeArc - INDICATOR_TRACK_GAP);
|
|
5701
|
+
const activeOffset = 0;
|
|
5702
|
+
const inactiveOffset = -(activeArcGapped + INDICATOR_TRACK_GAP);
|
|
5703
|
+
return /* @__PURE__ */ jsxs("div", { "data-progress-size": size, className: cn(progressCircularSizeVariants({ size })), children: [
|
|
5704
|
+
/* @__PURE__ */ jsxs("svg", { viewBox, className: "h-full w-full -rotate-90", "aria-hidden": "true", children: [
|
|
5705
|
+
percentage < 100 && /* @__PURE__ */ jsx(
|
|
5706
|
+
"circle",
|
|
5707
|
+
{
|
|
5708
|
+
cx,
|
|
5709
|
+
cy,
|
|
5710
|
+
r: radius,
|
|
5711
|
+
fill: "none",
|
|
5712
|
+
stroke: "currentColor",
|
|
5713
|
+
strokeWidth,
|
|
5714
|
+
strokeLinecap: "round",
|
|
5715
|
+
strokeDasharray: `${inactiveArcGapped} ${circumference - inactiveArcGapped}`,
|
|
5716
|
+
strokeDashoffset: inactiveOffset,
|
|
5717
|
+
className: "text-primary-container duration-spring-standard-default-spatial ease-spring-standard-default-spatial transition-[stroke-dasharray,stroke-dashoffset]"
|
|
5718
|
+
}
|
|
5719
|
+
),
|
|
5720
|
+
percentage > 0 && /* @__PURE__ */ jsx(
|
|
5721
|
+
"circle",
|
|
5722
|
+
{
|
|
5723
|
+
cx,
|
|
5724
|
+
cy,
|
|
5725
|
+
r: radius,
|
|
5726
|
+
fill: "none",
|
|
5727
|
+
stroke: "currentColor",
|
|
5728
|
+
strokeWidth,
|
|
5729
|
+
strokeLinecap: "round",
|
|
5730
|
+
strokeDasharray: `${activeArcGapped} ${circumference - activeArcGapped}`,
|
|
5731
|
+
strokeDashoffset: activeOffset,
|
|
5732
|
+
className: "text-primary duration-spring-standard-default-spatial ease-spring-standard-default-spatial transition-[stroke-dasharray,stroke-dashoffset]"
|
|
5733
|
+
}
|
|
5734
|
+
),
|
|
5735
|
+
percentage === 0 && /* @__PURE__ */ jsx(
|
|
5736
|
+
"circle",
|
|
5737
|
+
{
|
|
5738
|
+
cx,
|
|
5739
|
+
cy,
|
|
5740
|
+
r: radius,
|
|
5741
|
+
fill: "none",
|
|
5742
|
+
stroke: "currentColor",
|
|
5743
|
+
strokeWidth,
|
|
5744
|
+
className: "text-primary-container"
|
|
5745
|
+
}
|
|
5746
|
+
)
|
|
5747
|
+
] }),
|
|
5748
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", "data-progress-diameter": diameter })
|
|
5749
|
+
] });
|
|
5750
|
+
}
|
|
5751
|
+
function CircularWavyIndeterminate({
|
|
5752
|
+
size,
|
|
5753
|
+
cx,
|
|
5754
|
+
cy,
|
|
5755
|
+
radius,
|
|
5756
|
+
circumference: _circumference,
|
|
5757
|
+
viewBox,
|
|
5758
|
+
strokeWidth
|
|
5759
|
+
}) {
|
|
5760
|
+
const circAmp = Math.min(WAVE_AMPLITUDE_DEFAULT, radius * 0.35);
|
|
5761
|
+
const meanRadius = radius - circAmp;
|
|
5762
|
+
const meanCircumference = 2 * Math.PI * meanRadius;
|
|
5763
|
+
const waveCount = Math.max(4, Math.round(meanCircumference / WAVE_WAVELENGTH_CIRCULAR));
|
|
5764
|
+
const wavePath = buildCircularWavePath(cx, cy, meanRadius, circAmp, waveCount);
|
|
5765
|
+
return /* @__PURE__ */ jsx(
|
|
5766
|
+
"div",
|
|
5767
|
+
{
|
|
5768
|
+
"data-progress-size": size,
|
|
5769
|
+
"data-progress-indeterminate": "",
|
|
5770
|
+
className: cn(progressCircularSizeVariants({ size })),
|
|
5771
|
+
children: /* @__PURE__ */ jsxs(
|
|
5772
|
+
"svg",
|
|
5773
|
+
{
|
|
5774
|
+
viewBox,
|
|
5775
|
+
className: "animate-progress-circular-rotate h-full w-full",
|
|
5776
|
+
"aria-hidden": "true",
|
|
5777
|
+
children: [
|
|
5778
|
+
/* @__PURE__ */ jsx(
|
|
5779
|
+
"circle",
|
|
5780
|
+
{
|
|
5781
|
+
cx,
|
|
5782
|
+
cy,
|
|
5783
|
+
r: meanRadius,
|
|
5784
|
+
fill: "none",
|
|
5785
|
+
stroke: "currentColor",
|
|
5786
|
+
strokeWidth,
|
|
5787
|
+
className: "text-primary-container"
|
|
5788
|
+
}
|
|
5789
|
+
),
|
|
5790
|
+
/* @__PURE__ */ jsx(
|
|
5791
|
+
"path",
|
|
5792
|
+
{
|
|
5793
|
+
d: wavePath,
|
|
5794
|
+
fill: "none",
|
|
5795
|
+
stroke: "currentColor",
|
|
5796
|
+
strokeWidth,
|
|
5797
|
+
strokeLinecap: "round",
|
|
5798
|
+
pathLength: 100,
|
|
5799
|
+
strokeDasharray: "28 72",
|
|
5800
|
+
className: "text-primary"
|
|
5801
|
+
}
|
|
5802
|
+
)
|
|
5803
|
+
]
|
|
5804
|
+
}
|
|
5805
|
+
)
|
|
5806
|
+
}
|
|
5807
|
+
);
|
|
5808
|
+
}
|
|
5809
|
+
function CircularWavyDeterminate({
|
|
5810
|
+
size,
|
|
5811
|
+
percentage,
|
|
5812
|
+
cx,
|
|
5813
|
+
cy,
|
|
5814
|
+
radius,
|
|
5815
|
+
circumference: _circumference,
|
|
5816
|
+
viewBox,
|
|
5817
|
+
strokeWidth,
|
|
5818
|
+
diameter,
|
|
5819
|
+
reducedMotion
|
|
5820
|
+
}) {
|
|
5821
|
+
const circAmp = reducedMotion ? 0 : Math.min(WAVE_AMPLITUDE_DEFAULT, radius * 0.35);
|
|
5822
|
+
const meanRadius = radius - circAmp;
|
|
5823
|
+
const meanCircumference = 2 * Math.PI * meanRadius;
|
|
5824
|
+
const waveCount = Math.max(4, Math.round(meanCircumference / WAVE_WAVELENGTH_CIRCULAR));
|
|
5825
|
+
const wavePath = buildCircularWavePath(cx, cy, meanRadius, circAmp, waveCount);
|
|
5826
|
+
const gapPct = INDICATOR_TRACK_GAP / meanCircumference * 100;
|
|
5827
|
+
const activeLen = Math.max(0, percentage - gapPct);
|
|
5828
|
+
const inactiveLen = Math.max(0, 100 - percentage - gapPct);
|
|
5829
|
+
const inactiveOffset = -(activeLen + gapPct);
|
|
5830
|
+
return /* @__PURE__ */ jsxs("div", { "data-progress-size": size, className: cn(progressCircularSizeVariants({ size })), children: [
|
|
5831
|
+
/* @__PURE__ */ jsxs("svg", { viewBox, className: "h-full w-full -rotate-90", "aria-hidden": "true", children: [
|
|
5832
|
+
percentage === 0 && /* @__PURE__ */ jsx(
|
|
5833
|
+
"circle",
|
|
5834
|
+
{
|
|
5835
|
+
cx,
|
|
5836
|
+
cy,
|
|
5837
|
+
r: meanRadius,
|
|
5838
|
+
fill: "none",
|
|
5839
|
+
stroke: "currentColor",
|
|
5840
|
+
strokeWidth,
|
|
5841
|
+
className: "text-primary-container"
|
|
5842
|
+
}
|
|
5843
|
+
),
|
|
5844
|
+
percentage > 0 && percentage < 100 && /* @__PURE__ */ jsx(
|
|
5845
|
+
"circle",
|
|
5846
|
+
{
|
|
5847
|
+
cx,
|
|
5848
|
+
cy,
|
|
5849
|
+
r: meanRadius,
|
|
5850
|
+
fill: "none",
|
|
5851
|
+
stroke: "currentColor",
|
|
5852
|
+
strokeWidth,
|
|
5853
|
+
strokeLinecap: "round",
|
|
5854
|
+
pathLength: 100,
|
|
5855
|
+
strokeDasharray: `${inactiveLen} ${100 - inactiveLen}`,
|
|
5856
|
+
strokeDashoffset: inactiveOffset,
|
|
5857
|
+
className: "text-primary-container duration-spring-standard-default-spatial ease-spring-standard-default-spatial transition-[stroke-dasharray,stroke-dashoffset]"
|
|
5858
|
+
}
|
|
5859
|
+
),
|
|
5860
|
+
percentage > 0 && /* @__PURE__ */ jsx(
|
|
5861
|
+
"path",
|
|
5862
|
+
{
|
|
5863
|
+
"data-progress-indicator": "",
|
|
5864
|
+
d: wavePath,
|
|
5865
|
+
fill: "none",
|
|
5866
|
+
stroke: "currentColor",
|
|
5867
|
+
strokeWidth,
|
|
5868
|
+
strokeLinecap: "round",
|
|
5869
|
+
pathLength: 100,
|
|
5870
|
+
strokeDasharray: percentage < 100 ? `${activeLen} ${100 - activeLen}` : void 0,
|
|
5871
|
+
strokeDashoffset: 0,
|
|
5872
|
+
className: "text-primary duration-spring-standard-default-spatial ease-spring-standard-default-spatial transition-[stroke-dasharray]"
|
|
5873
|
+
}
|
|
5874
|
+
)
|
|
5875
|
+
] }),
|
|
5876
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", "data-progress-diameter": diameter })
|
|
5877
|
+
] });
|
|
5426
5878
|
}
|
|
5427
5879
|
var ProgressHeadless = forwardRef(
|
|
5428
5880
|
({
|
|
5429
5881
|
type = "linear",
|
|
5430
5882
|
indeterminate = false,
|
|
5431
5883
|
size = "medium",
|
|
5884
|
+
shape = "flat",
|
|
5885
|
+
thickness = "default",
|
|
5432
5886
|
className,
|
|
5433
5887
|
children,
|
|
5434
5888
|
renderProgress,
|
|
@@ -5455,7 +5909,9 @@ var ProgressHeadless = forwardRef(
|
|
|
5455
5909
|
percentage,
|
|
5456
5910
|
isIndeterminate: indeterminate,
|
|
5457
5911
|
type,
|
|
5458
|
-
size
|
|
5912
|
+
size,
|
|
5913
|
+
shape,
|
|
5914
|
+
thickness
|
|
5459
5915
|
}),
|
|
5460
5916
|
children
|
|
5461
5917
|
] });
|