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