@tinybigui/react 0.15.0 → 0.17.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 +17 -17
- package/dist/index.cjs +669 -408
- 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 +59 -34
- package/dist/index.d.ts +59 -34
- package/dist/index.js +669 -408
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3139,224 +3139,102 @@ var RadioGroupHeadless = forwardRef(
|
|
|
3139
3139
|
}
|
|
3140
3140
|
);
|
|
3141
3141
|
RadioGroupHeadless.displayName = "RadioGroupHeadless";
|
|
3142
|
+
var radioRootVariants = cva([
|
|
3143
|
+
"relative inline-flex items-center cursor-pointer select-none",
|
|
3144
|
+
// Disabled state — self-targeting so children inherit via group
|
|
3145
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none",
|
|
3146
|
+
"data-[disabled]:opacity-38"
|
|
3147
|
+
]);
|
|
3148
|
+
var radioControlVariants = cva([
|
|
3149
|
+
"relative flex items-center justify-center flex-shrink-0",
|
|
3150
|
+
"size-10"
|
|
3151
|
+
// 40dp touch target (MD3 spec)
|
|
3152
|
+
]);
|
|
3153
|
+
var radioFocusRingVariants = cva([
|
|
3154
|
+
"pointer-events-none absolute inset-0 rounded-full",
|
|
3155
|
+
"outline outline-2 outline-offset-2 outline-secondary",
|
|
3156
|
+
// Effects transition for opacity
|
|
3157
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
3158
|
+
"opacity-0",
|
|
3159
|
+
"group-data-[focus-visible]/radio:opacity-100"
|
|
3160
|
+
]);
|
|
3161
|
+
var radioTargetVariants = cva([
|
|
3162
|
+
"absolute inset-0 rounded-full overflow-hidden",
|
|
3163
|
+
"flex items-center justify-center"
|
|
3164
|
+
]);
|
|
3165
|
+
var radioStateLayerVariants = cva([
|
|
3166
|
+
"absolute inset-0 rounded-full pointer-events-none opacity-0",
|
|
3167
|
+
// Base state-layer color (unselected)
|
|
3168
|
+
"bg-on-surface",
|
|
3169
|
+
// Effects transition for opacity + color
|
|
3170
|
+
"transition-[opacity,background-color] duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
3171
|
+
// Selected state-layer color
|
|
3172
|
+
"group-data-[selected]/radio:bg-primary",
|
|
3173
|
+
// Error state-layer color (overrides selected via cascade position)
|
|
3174
|
+
"group-data-[invalid]/radio:bg-error",
|
|
3175
|
+
// Interaction opacities (MD3: hover 8%, focus/pressed 10%)
|
|
3176
|
+
"group-data-[hovered]/radio:opacity-8",
|
|
3177
|
+
"group-data-[focus-visible]/radio:opacity-10",
|
|
3178
|
+
"group-data-[pressed]/radio:opacity-10",
|
|
3179
|
+
// No state layer when disabled
|
|
3180
|
+
"group-data-[disabled]/radio:hidden"
|
|
3181
|
+
]);
|
|
3182
|
+
var radioRingVariants = cva([
|
|
3183
|
+
"relative z-10 size-5 rounded-full border-2 flex items-center justify-center flex-shrink-0",
|
|
3184
|
+
// Base (unselected, enabled)
|
|
3185
|
+
"border-on-surface-variant",
|
|
3186
|
+
// Effects transition for border-color
|
|
3187
|
+
"transition-colors duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
3188
|
+
// Selected — border becomes primary
|
|
3189
|
+
"group-data-[selected]/radio:border-primary",
|
|
3190
|
+
// Error — placed after selected so it overrides by cascade order
|
|
3191
|
+
"group-data-[invalid]/radio:border-error",
|
|
3192
|
+
// Disabled — on-surface/38 opacity value
|
|
3193
|
+
"group-data-[disabled]/radio:border-on-surface/38"
|
|
3194
|
+
]);
|
|
3195
|
+
var radioDotVariants = cva([
|
|
3196
|
+
"size-2.5 rounded-full origin-center",
|
|
3197
|
+
// Spatial transition for scale — springs may overshoot (intentional)
|
|
3198
|
+
"transition-transform duration-spring-standard-fast-spatial ease-spring-standard-fast-spatial",
|
|
3199
|
+
// Base fill color (shown when selected)
|
|
3200
|
+
"bg-primary",
|
|
3201
|
+
// Hidden when unselected
|
|
3202
|
+
"scale-0",
|
|
3203
|
+
// Visible when selected
|
|
3204
|
+
"group-data-[selected]/radio:scale-100",
|
|
3205
|
+
// Error — error fill color (placed after selected by cascade)
|
|
3206
|
+
"group-data-[invalid]/radio:bg-error",
|
|
3207
|
+
// Disabled — use on-surface/38 opacity
|
|
3208
|
+
"group-data-[disabled]/radio:bg-on-surface/38"
|
|
3209
|
+
]);
|
|
3210
|
+
var radioLabelVariants = cva(["text-body-medium text-on-surface select-none ml-4"]);
|
|
3142
3211
|
var radioGroupVariants = cva(
|
|
3143
|
-
[
|
|
3144
|
-
|
|
3145
|
-
"flex",
|
|
3146
|
-
"gap-4"
|
|
3147
|
-
// 16px spacing between radios (MD3 standard)
|
|
3148
|
-
],
|
|
3212
|
+
["flex", "gap-1"],
|
|
3213
|
+
// 4dp gap — padding around each 40dp control handles visual spacing
|
|
3149
3214
|
{
|
|
3150
3215
|
variants: {
|
|
3151
3216
|
/**
|
|
3152
3217
|
* Layout orientation
|
|
3218
|
+
* @default "vertical"
|
|
3153
3219
|
*/
|
|
3154
3220
|
orientation: {
|
|
3155
3221
|
vertical: "flex-col",
|
|
3156
3222
|
horizontal: "flex-row flex-wrap"
|
|
3157
|
-
},
|
|
3158
|
-
/**
|
|
3159
|
-
* Disabled state
|
|
3160
|
-
*/
|
|
3161
|
-
disabled: {
|
|
3162
|
-
true: "",
|
|
3163
|
-
false: ""
|
|
3164
|
-
}
|
|
3165
|
-
},
|
|
3166
|
-
defaultVariants: {
|
|
3167
|
-
orientation: "vertical",
|
|
3168
|
-
disabled: false
|
|
3169
|
-
}
|
|
3170
|
-
}
|
|
3171
|
-
);
|
|
3172
|
-
var radioGroupLabelVariants = cva(
|
|
3173
|
-
[
|
|
3174
|
-
"text-sm font-medium",
|
|
3175
|
-
// MD3: Body Medium
|
|
3176
|
-
"text-on-surface",
|
|
3177
|
-
"mb-3"
|
|
3178
|
-
// Spacing below label (12px)
|
|
3179
|
-
],
|
|
3180
|
-
{
|
|
3181
|
-
variants: {
|
|
3182
|
-
disabled: {
|
|
3183
|
-
true: "opacity-38",
|
|
3184
|
-
false: ""
|
|
3185
|
-
}
|
|
3186
|
-
},
|
|
3187
|
-
defaultVariants: {
|
|
3188
|
-
disabled: false
|
|
3189
|
-
}
|
|
3190
|
-
}
|
|
3191
|
-
);
|
|
3192
|
-
var radioVariants = cva(
|
|
3193
|
-
[
|
|
3194
|
-
// Base classes (always applied to label wrapper)
|
|
3195
|
-
"relative inline-flex items-center cursor-pointer select-none",
|
|
3196
|
-
"transition-opacity duration-200"
|
|
3197
|
-
],
|
|
3198
|
-
{
|
|
3199
|
-
variants: {
|
|
3200
|
-
/**
|
|
3201
|
-
* Disabled state
|
|
3202
|
-
*/
|
|
3203
|
-
disabled: {
|
|
3204
|
-
true: "opacity-38 cursor-not-allowed pointer-events-none",
|
|
3205
|
-
false: ""
|
|
3206
|
-
}
|
|
3207
|
-
},
|
|
3208
|
-
defaultVariants: {
|
|
3209
|
-
disabled: false
|
|
3210
|
-
}
|
|
3211
|
-
}
|
|
3212
|
-
);
|
|
3213
|
-
var radioContainerVariants = cva(
|
|
3214
|
-
[
|
|
3215
|
-
// Base classes for radio visual container
|
|
3216
|
-
"relative inline-flex items-center justify-center",
|
|
3217
|
-
"w-10 h-10",
|
|
3218
|
-
// 40x40dp touch target (MD3 spec)
|
|
3219
|
-
"flex-shrink-0",
|
|
3220
|
-
"transition-all duration-200",
|
|
3221
|
-
"m-1",
|
|
3222
|
-
// 4px margin around radio for spacing (total 8px gap between radios)
|
|
3223
|
-
// State layer (hover, focus, active) - MD3 spec: 8%/12%/12% opacity
|
|
3224
|
-
"before:absolute before:inset-0 before:rounded-full before:transition-opacity before:duration-200",
|
|
3225
|
-
"before:bg-current before:opacity-0",
|
|
3226
|
-
"hover:before:opacity-8",
|
|
3227
|
-
"active:before:opacity-12"
|
|
3228
|
-
],
|
|
3229
|
-
{
|
|
3230
|
-
variants: {
|
|
3231
|
-
/**
|
|
3232
|
-
* Radio state (determines visual appearance)
|
|
3233
|
-
*/
|
|
3234
|
-
state: {
|
|
3235
|
-
unselected: "text-on-surface-variant",
|
|
3236
|
-
selected: "text-primary"
|
|
3237
|
-
},
|
|
3238
|
-
/**
|
|
3239
|
-
* Error/invalid state
|
|
3240
|
-
*/
|
|
3241
|
-
isInvalid: {
|
|
3242
|
-
true: "text-error",
|
|
3243
|
-
false: ""
|
|
3244
|
-
},
|
|
3245
|
-
/**
|
|
3246
|
-
* Disabled state
|
|
3247
|
-
*/
|
|
3248
|
-
disabled: {
|
|
3249
|
-
true: "text-on-surface pointer-events-none",
|
|
3250
|
-
false: ""
|
|
3251
|
-
}
|
|
3252
|
-
},
|
|
3253
|
-
compoundVariants: [
|
|
3254
|
-
// Error state overrides normal colors for all states
|
|
3255
|
-
{
|
|
3256
|
-
state: "unselected",
|
|
3257
|
-
isInvalid: true,
|
|
3258
|
-
disabled: false,
|
|
3259
|
-
className: "text-error"
|
|
3260
|
-
},
|
|
3261
|
-
{
|
|
3262
|
-
state: "selected",
|
|
3263
|
-
isInvalid: true,
|
|
3264
|
-
disabled: false,
|
|
3265
|
-
className: "text-error"
|
|
3266
|
-
}
|
|
3267
|
-
],
|
|
3268
|
-
defaultVariants: {
|
|
3269
|
-
state: "unselected",
|
|
3270
|
-
isInvalid: false,
|
|
3271
|
-
disabled: false
|
|
3272
|
-
}
|
|
3273
|
-
}
|
|
3274
|
-
);
|
|
3275
|
-
var radioIconOuterVariants = cva(
|
|
3276
|
-
[
|
|
3277
|
-
// Base classes for the radio outer circle
|
|
3278
|
-
"transition-all duration-200 stroke-current stroke-2 fill-transparent"
|
|
3279
|
-
],
|
|
3280
|
-
{
|
|
3281
|
-
variants: {
|
|
3282
|
-
/**
|
|
3283
|
-
* Radio state
|
|
3284
|
-
*/
|
|
3285
|
-
state: {
|
|
3286
|
-
unselected: [],
|
|
3287
|
-
selected: []
|
|
3288
|
-
},
|
|
3289
|
-
/**
|
|
3290
|
-
* Disabled state
|
|
3291
|
-
*/
|
|
3292
|
-
disabled: {
|
|
3293
|
-
true: ["fill-transparent", "stroke-current", "stroke-2"],
|
|
3294
|
-
false: ""
|
|
3295
|
-
}
|
|
3296
|
-
},
|
|
3297
|
-
compoundVariants: [
|
|
3298
|
-
// Disabled + selected state overrides fill
|
|
3299
|
-
{
|
|
3300
|
-
state: "selected",
|
|
3301
|
-
disabled: true,
|
|
3302
|
-
className: "fill-current stroke-none"
|
|
3303
|
-
}
|
|
3304
|
-
],
|
|
3305
|
-
defaultVariants: {
|
|
3306
|
-
state: "unselected",
|
|
3307
|
-
disabled: false
|
|
3308
|
-
}
|
|
3309
|
-
}
|
|
3310
|
-
);
|
|
3311
|
-
var radioIconInnerVariants = cva(["transition-all origin-center duration-200"], {
|
|
3312
|
-
variants: {
|
|
3313
|
-
/**
|
|
3314
|
-
* Visibility based on state
|
|
3315
|
-
*/
|
|
3316
|
-
state: {
|
|
3317
|
-
selected: ["fill-current"],
|
|
3318
|
-
unselected: ["fill-transparent"]
|
|
3319
|
-
},
|
|
3320
|
-
visible: {
|
|
3321
|
-
true: "opacity-100 scale-100 fill-current",
|
|
3322
|
-
false: "opacity-0 scale-0"
|
|
3323
|
-
}
|
|
3324
|
-
},
|
|
3325
|
-
defaultVariants: {
|
|
3326
|
-
visible: false
|
|
3327
|
-
}
|
|
3328
|
-
});
|
|
3329
|
-
var radioLabelVariants = cva(
|
|
3330
|
-
[
|
|
3331
|
-
"text-sm",
|
|
3332
|
-
// MD3: Body Medium (14px)
|
|
3333
|
-
"text-on-surface",
|
|
3334
|
-
"select-none"
|
|
3335
|
-
],
|
|
3336
|
-
{
|
|
3337
|
-
variants: {
|
|
3338
|
-
disabled: {
|
|
3339
|
-
true: "",
|
|
3340
|
-
false: ""
|
|
3341
3223
|
}
|
|
3342
3224
|
},
|
|
3343
3225
|
defaultVariants: {
|
|
3344
|
-
|
|
3226
|
+
orientation: "vertical"
|
|
3345
3227
|
}
|
|
3346
3228
|
}
|
|
3347
3229
|
);
|
|
3230
|
+
var radioGroupLabelVariants = cva([
|
|
3231
|
+
"text-body-medium font-medium",
|
|
3232
|
+
"text-on-surface",
|
|
3233
|
+
"mb-3",
|
|
3234
|
+
"data-[disabled]:opacity-38"
|
|
3235
|
+
]);
|
|
3348
3236
|
var Radio = forwardRef(
|
|
3349
|
-
({
|
|
3350
|
-
// Content props
|
|
3351
|
-
children,
|
|
3352
|
-
// State props
|
|
3353
|
-
disableRipple = false,
|
|
3354
|
-
isDisabled = false,
|
|
3355
|
-
// Styling
|
|
3356
|
-
className,
|
|
3357
|
-
// Other props
|
|
3358
|
-
...props
|
|
3359
|
-
}, forwardedRef) => {
|
|
3237
|
+
({ children, disableRipple = false, isDisabled = false, className, ...props }, forwardedRef) => {
|
|
3360
3238
|
const state = useContext(RadioGroupContext);
|
|
3361
3239
|
if (!state) {
|
|
3362
3240
|
throw new Error("Radio must be used within a RadioGroup");
|
|
@@ -3371,127 +3249,57 @@ var Radio = forwardRef(
|
|
|
3371
3249
|
"data-testid": _dataTestId,
|
|
3372
3250
|
id: _htmlId,
|
|
3373
3251
|
title: _htmlTitle,
|
|
3374
|
-
...
|
|
3252
|
+
...ariaProps
|
|
3375
3253
|
} = props;
|
|
3376
3254
|
const {
|
|
3377
3255
|
inputProps,
|
|
3378
3256
|
isSelected,
|
|
3379
|
-
isDisabled: radioIsDisabled
|
|
3257
|
+
isDisabled: radioIsDisabled,
|
|
3258
|
+
isPressed
|
|
3380
3259
|
} = useRadio(
|
|
3381
|
-
{
|
|
3382
|
-
...restPropsWithoutHtmlAttrs,
|
|
3383
|
-
value: props.value
|
|
3384
|
-
},
|
|
3260
|
+
{ ...ariaProps, value: props.value },
|
|
3385
3261
|
state,
|
|
3386
3262
|
ref
|
|
3387
3263
|
);
|
|
3388
3264
|
const { isFocusVisible, focusProps } = useFocusRing();
|
|
3389
3265
|
const finalIsDisabled = isDisabled || radioIsDisabled;
|
|
3390
|
-
const
|
|
3266
|
+
const { isHovered, hoverProps } = useHover({ isDisabled: finalIsDisabled });
|
|
3267
|
+
const isInvalid = state.validationState === "invalid";
|
|
3391
3268
|
const { onMouseDown: handleRipple, ripples } = useRipple({
|
|
3392
3269
|
disabled: finalIsDisabled || disableRipple
|
|
3393
3270
|
});
|
|
3394
3271
|
if (process.env.NODE_ENV === "development") {
|
|
3395
|
-
const
|
|
3396
|
-
if (!children && !
|
|
3397
|
-
console.warn(
|
|
3398
|
-
"[Radio] Radio should have a label (children) or aria-label for accessibility."
|
|
3399
|
-
);
|
|
3272
|
+
const a = ariaProps;
|
|
3273
|
+
if (!children && !a["aria-label"] && !a["aria-labelledby"]) {
|
|
3274
|
+
console.warn("[Radio] Provide a label via children or aria-label for accessibility.");
|
|
3400
3275
|
}
|
|
3401
3276
|
}
|
|
3402
|
-
const isInvalid = state.validationState === "invalid";
|
|
3403
3277
|
return /* @__PURE__ */ jsxs(
|
|
3404
3278
|
"label",
|
|
3405
3279
|
{
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
disabled: finalIsDisabled
|
|
3409
|
-
}),
|
|
3410
|
-
className
|
|
3411
|
-
),
|
|
3280
|
+
...mergeProps$1(hoverProps),
|
|
3281
|
+
className: cn(radioRootVariants(), "group/radio", className),
|
|
3412
3282
|
"data-testid": dataTestId,
|
|
3413
3283
|
title: htmlTitle,
|
|
3284
|
+
...getInteractionDataAttributes({
|
|
3285
|
+
isHovered,
|
|
3286
|
+
isFocusVisible,
|
|
3287
|
+
isPressed,
|
|
3288
|
+
isSelected,
|
|
3289
|
+
isDisabled: finalIsDisabled,
|
|
3290
|
+
isInvalid
|
|
3291
|
+
}),
|
|
3414
3292
|
children: [
|
|
3415
3293
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx("input", { ...mergeProps$1(inputProps, focusProps), ref, id: htmlId }) }),
|
|
3416
|
-
/* @__PURE__ */ jsxs(
|
|
3417
|
-
"div",
|
|
3418
|
-
{
|
|
3419
|
-
|
|
3420
|
-
className: cn(
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
})
|
|
3426
|
-
),
|
|
3427
|
-
onMouseDown: handleRipple,
|
|
3428
|
-
children: [
|
|
3429
|
-
ripples,
|
|
3430
|
-
/* @__PURE__ */ jsxs(
|
|
3431
|
-
"svg",
|
|
3432
|
-
{
|
|
3433
|
-
width: "20",
|
|
3434
|
-
height: "20",
|
|
3435
|
-
viewBox: "0 0 20 20",
|
|
3436
|
-
"aria-hidden": "true",
|
|
3437
|
-
className: "relative z-10",
|
|
3438
|
-
children: [
|
|
3439
|
-
/* @__PURE__ */ jsx(
|
|
3440
|
-
"circle",
|
|
3441
|
-
{
|
|
3442
|
-
cx: "10",
|
|
3443
|
-
cy: "10",
|
|
3444
|
-
r: "9",
|
|
3445
|
-
className: cn(
|
|
3446
|
-
radioIconOuterVariants({
|
|
3447
|
-
state: visualState,
|
|
3448
|
-
disabled: finalIsDisabled
|
|
3449
|
-
})
|
|
3450
|
-
)
|
|
3451
|
-
}
|
|
3452
|
-
),
|
|
3453
|
-
/* @__PURE__ */ jsx(
|
|
3454
|
-
"circle",
|
|
3455
|
-
{
|
|
3456
|
-
cx: "10",
|
|
3457
|
-
cy: "10",
|
|
3458
|
-
r: "5",
|
|
3459
|
-
className: cn(
|
|
3460
|
-
radioIconInnerVariants({
|
|
3461
|
-
visible: isSelected
|
|
3462
|
-
})
|
|
3463
|
-
)
|
|
3464
|
-
}
|
|
3465
|
-
),
|
|
3466
|
-
isFocusVisible && /* @__PURE__ */ jsx(
|
|
3467
|
-
"circle",
|
|
3468
|
-
{
|
|
3469
|
-
cx: "10",
|
|
3470
|
-
cy: "10",
|
|
3471
|
-
r: "13",
|
|
3472
|
-
fill: "none",
|
|
3473
|
-
stroke: "currentColor",
|
|
3474
|
-
strokeWidth: "2",
|
|
3475
|
-
className: "animate-pulse"
|
|
3476
|
-
}
|
|
3477
|
-
)
|
|
3478
|
-
]
|
|
3479
|
-
}
|
|
3480
|
-
)
|
|
3481
|
-
]
|
|
3482
|
-
}
|
|
3483
|
-
),
|
|
3484
|
-
children && /* @__PURE__ */ jsx(
|
|
3485
|
-
"span",
|
|
3486
|
-
{
|
|
3487
|
-
className: cn(
|
|
3488
|
-
radioLabelVariants({
|
|
3489
|
-
disabled: finalIsDisabled
|
|
3490
|
-
})
|
|
3491
|
-
),
|
|
3492
|
-
children
|
|
3493
|
-
}
|
|
3494
|
-
)
|
|
3294
|
+
/* @__PURE__ */ jsxs("div", { role: "presentation", className: cn(radioControlVariants()), children: [
|
|
3295
|
+
/* @__PURE__ */ jsx("div", { className: cn(radioFocusRingVariants()), "aria-hidden": "true" }),
|
|
3296
|
+
/* @__PURE__ */ jsxs("div", { role: "presentation", className: cn(radioTargetVariants()), onMouseDown: handleRipple, children: [
|
|
3297
|
+
ripples,
|
|
3298
|
+
/* @__PURE__ */ jsx("span", { className: cn(radioStateLayerVariants()), "aria-hidden": "true" }),
|
|
3299
|
+
/* @__PURE__ */ jsx("div", { className: cn(radioRingVariants()), "aria-hidden": "true", children: /* @__PURE__ */ jsx("div", { className: cn(radioDotVariants()), "aria-hidden": "true" }) })
|
|
3300
|
+
] })
|
|
3301
|
+
] }),
|
|
3302
|
+
children && /* @__PURE__ */ jsx("span", { className: cn(radioLabelVariants()), children })
|
|
3495
3303
|
]
|
|
3496
3304
|
}
|
|
3497
3305
|
);
|
|
@@ -3504,7 +3312,7 @@ var RadioGroup = forwardRef(
|
|
|
3504
3312
|
children,
|
|
3505
3313
|
// State props
|
|
3506
3314
|
orientation = "vertical",
|
|
3507
|
-
isInvalid
|
|
3315
|
+
isInvalid = false,
|
|
3508
3316
|
isDisabled = false,
|
|
3509
3317
|
// Styling
|
|
3510
3318
|
className,
|
|
@@ -3527,6 +3335,7 @@ var RadioGroup = forwardRef(
|
|
|
3527
3335
|
{
|
|
3528
3336
|
...restPropsWithoutHtmlAttrs,
|
|
3529
3337
|
isDisabled,
|
|
3338
|
+
isInvalid,
|
|
3530
3339
|
ref,
|
|
3531
3340
|
className: cn("flex flex-col", className),
|
|
3532
3341
|
"data-testid": dataTestId,
|
|
@@ -3534,11 +3343,8 @@ var RadioGroup = forwardRef(
|
|
|
3534
3343
|
"div",
|
|
3535
3344
|
{
|
|
3536
3345
|
...labelProps,
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
disabled: isDisabled
|
|
3540
|
-
})
|
|
3541
|
-
),
|
|
3346
|
+
"data-disabled": isDisabled ? "" : void 0,
|
|
3347
|
+
className: cn(radioGroupLabelVariants()),
|
|
3542
3348
|
children: props.label
|
|
3543
3349
|
}
|
|
3544
3350
|
),
|
|
@@ -3547,8 +3353,7 @@ var RadioGroup = forwardRef(
|
|
|
3547
3353
|
{
|
|
3548
3354
|
className: cn(
|
|
3549
3355
|
radioGroupVariants({
|
|
3550
|
-
orientation
|
|
3551
|
-
disabled: isDisabled
|
|
3356
|
+
orientation
|
|
3552
3357
|
})
|
|
3553
3358
|
),
|
|
3554
3359
|
children
|
|
@@ -5159,9 +4964,6 @@ var DrawerItem = forwardRef(
|
|
|
5159
4964
|
DrawerItem.displayName = "DrawerItem";
|
|
5160
4965
|
var progressContainerVariants = cva(["inline-flex", "flex-col", "gap-1"], {
|
|
5161
4966
|
variants: {
|
|
5162
|
-
/**
|
|
5163
|
-
* The visual type of the indicator.
|
|
5164
|
-
*/
|
|
5165
4967
|
type: {
|
|
5166
4968
|
linear: "w-full",
|
|
5167
4969
|
circular: "items-center justify-center w-auto"
|
|
@@ -5171,41 +4973,60 @@ var progressContainerVariants = cva(["inline-flex", "flex-col", "gap-1"], {
|
|
|
5171
4973
|
type: "linear"
|
|
5172
4974
|
}
|
|
5173
4975
|
});
|
|
5174
|
-
var
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
4976
|
+
var progressLabelVariants = cva(["text-body-small", "text-on-surface", "select-none"]);
|
|
4977
|
+
var progressTrackVariants = cva(
|
|
4978
|
+
[
|
|
4979
|
+
"relative",
|
|
4980
|
+
"w-full",
|
|
4981
|
+
"overflow-visible",
|
|
4982
|
+
// gap segments extend beyond clipping bounds
|
|
4983
|
+
"rounded-full"
|
|
4984
|
+
],
|
|
4985
|
+
{
|
|
4986
|
+
variants: {
|
|
4987
|
+
thickness: {
|
|
4988
|
+
default: "h-1",
|
|
4989
|
+
thick: "h-2"
|
|
4990
|
+
}
|
|
4991
|
+
},
|
|
4992
|
+
defaultVariants: {
|
|
4993
|
+
thickness: "default"
|
|
4994
|
+
}
|
|
4995
|
+
}
|
|
4996
|
+
);
|
|
4997
|
+
var progressActiveIndicatorVariants = cva([
|
|
5186
4998
|
"absolute",
|
|
5187
4999
|
"left-0",
|
|
5188
5000
|
"top-0",
|
|
5189
5001
|
"h-full",
|
|
5190
5002
|
"rounded-full",
|
|
5191
5003
|
"bg-primary",
|
|
5192
|
-
//
|
|
5004
|
+
// Spatial spring — width changes are spatial (bar growing)
|
|
5193
5005
|
"transition-[width]",
|
|
5194
|
-
"duration-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5006
|
+
"duration-spring-standard-default-spatial",
|
|
5007
|
+
"ease-spring-standard-default-spatial"
|
|
5008
|
+
]);
|
|
5009
|
+
var progressInactiveSegmentVariants = cva([
|
|
5010
|
+
"absolute",
|
|
5011
|
+
"top-0",
|
|
5012
|
+
"right-0",
|
|
5013
|
+
"h-full",
|
|
5014
|
+
"rounded-full",
|
|
5015
|
+
"bg-primary-container",
|
|
5016
|
+
// Spatial spring on left position (gap moves as progress moves)
|
|
5017
|
+
"transition-[left]",
|
|
5018
|
+
"duration-spring-standard-default-spatial",
|
|
5019
|
+
"ease-spring-standard-default-spatial"
|
|
5198
5020
|
]);
|
|
5199
5021
|
var progressStopIndicatorVariants = cva([
|
|
5200
5022
|
"absolute",
|
|
5201
5023
|
"right-0",
|
|
5202
5024
|
"top-1/2",
|
|
5203
5025
|
"-translate-y-1/2",
|
|
5204
|
-
"
|
|
5205
|
-
|
|
5026
|
+
"size-1",
|
|
5027
|
+
// 4dp
|
|
5206
5028
|
"rounded-full",
|
|
5207
5029
|
"bg-primary"
|
|
5208
|
-
// MD3: stop indicator uses primary color
|
|
5209
5030
|
]);
|
|
5210
5031
|
var progressCircularSizeVariants = cva(
|
|
5211
5032
|
["relative", "flex", "items-center", "justify-center", "flex-shrink-0"],
|
|
@@ -5213,11 +5034,8 @@ var progressCircularSizeVariants = cva(
|
|
|
5213
5034
|
variants: {
|
|
5214
5035
|
size: {
|
|
5215
5036
|
small: "h-6 w-6",
|
|
5216
|
-
// MD3: 24dp
|
|
5217
5037
|
medium: "h-12 w-12",
|
|
5218
|
-
// MD3: 48dp (default)
|
|
5219
5038
|
large: "h-16 w-16"
|
|
5220
|
-
// MD3: 64dp
|
|
5221
5039
|
}
|
|
5222
5040
|
},
|
|
5223
5041
|
defaultVariants: {
|
|
@@ -5225,33 +5043,85 @@ var progressCircularSizeVariants = cva(
|
|
|
5225
5043
|
}
|
|
5226
5044
|
}
|
|
5227
5045
|
);
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5046
|
+
function useReducedMotion2() {
|
|
5047
|
+
const [reduced, setReduced] = useState(() => {
|
|
5048
|
+
if (typeof window === "undefined") return false;
|
|
5049
|
+
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
5050
|
+
});
|
|
5051
|
+
useEffect(() => {
|
|
5052
|
+
if (typeof window === "undefined") return;
|
|
5053
|
+
const mql = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
5054
|
+
const handler = (e) => setReduced(e.matches);
|
|
5055
|
+
mql.addEventListener("change", handler);
|
|
5056
|
+
return () => mql.removeEventListener("change", handler);
|
|
5057
|
+
}, []);
|
|
5058
|
+
return reduced;
|
|
5059
|
+
}
|
|
5060
|
+
var STROKE_WIDTH_DEFAULT = 4;
|
|
5061
|
+
var STROKE_WIDTH_THICK = 8;
|
|
5062
|
+
var INDICATOR_TRACK_GAP = 4;
|
|
5236
5063
|
var CIRCULAR_SIZE_PX = {
|
|
5237
5064
|
small: 24,
|
|
5238
5065
|
medium: 48,
|
|
5239
5066
|
large: 64
|
|
5240
5067
|
};
|
|
5241
|
-
|
|
5068
|
+
var WAVE_AMPLITUDE_DEFAULT = 3;
|
|
5069
|
+
var WAVE_AMPLITUDE_THICK = 5;
|
|
5070
|
+
var LINEAR_WAVE_COUNT = 14;
|
|
5071
|
+
var VB_W = 100;
|
|
5072
|
+
var WAVE_WAVELENGTH_CIRCULAR = 30;
|
|
5073
|
+
function getStrokeWidth(thickness) {
|
|
5074
|
+
return thickness === "thick" ? STROKE_WIDTH_THICK : STROKE_WIDTH_DEFAULT;
|
|
5075
|
+
}
|
|
5076
|
+
function getCircularGeometry(size, thickness) {
|
|
5077
|
+
const strokeWidth = getStrokeWidth(thickness);
|
|
5242
5078
|
const diameter = CIRCULAR_SIZE_PX[size];
|
|
5243
|
-
const radius = (diameter -
|
|
5079
|
+
const radius = (diameter - strokeWidth) / 2;
|
|
5244
5080
|
const circumference = 2 * Math.PI * radius;
|
|
5245
5081
|
const viewBox = `0 0 ${diameter} ${diameter}`;
|
|
5246
5082
|
const cx = diameter / 2;
|
|
5247
5083
|
const cy = diameter / 2;
|
|
5248
|
-
return { diameter, radius, circumference, viewBox, cx, cy };
|
|
5084
|
+
return { diameter, radius, circumference, viewBox, cx, cy, strokeWidth };
|
|
5085
|
+
}
|
|
5086
|
+
function buildLinearWavePath(vbWidth, waveCount, amplitude, midY, padCycles = 0) {
|
|
5087
|
+
const wavelength = vbWidth / waveCount;
|
|
5088
|
+
const totalCycles = waveCount + padCycles;
|
|
5089
|
+
const cp = wavelength / 4;
|
|
5090
|
+
const segments = [`M 0 ${midY}`];
|
|
5091
|
+
for (let i = 0; i < totalCycles; i++) {
|
|
5092
|
+
const x = i * wavelength;
|
|
5093
|
+
segments.push(
|
|
5094
|
+
`C ${x + cp} ${midY - amplitude} ${x + wavelength / 2 - cp} ${midY - amplitude} ${x + wavelength / 2} ${midY}`
|
|
5095
|
+
);
|
|
5096
|
+
segments.push(
|
|
5097
|
+
`C ${x + wavelength / 2 + cp} ${midY + amplitude} ${x + wavelength - cp} ${midY + amplitude} ${x + wavelength} ${midY}`
|
|
5098
|
+
);
|
|
5099
|
+
}
|
|
5100
|
+
return segments.join(" ");
|
|
5101
|
+
}
|
|
5102
|
+
function buildCircularWavePath(cx, cy, radius, amplitude, waveCount, steps) {
|
|
5103
|
+
const actualSteps = waveCount * 12;
|
|
5104
|
+
const points = [];
|
|
5105
|
+
for (let i = 0; i <= actualSteps; i++) {
|
|
5106
|
+
const t = i / actualSteps;
|
|
5107
|
+
const angle = t * 2 * Math.PI;
|
|
5108
|
+
const radialOffset = amplitude * Math.sin(2 * Math.PI * waveCount * t);
|
|
5109
|
+
const r = radius + radialOffset;
|
|
5110
|
+
const x = cx + r * Math.cos(angle);
|
|
5111
|
+
const y = cy + r * Math.sin(angle);
|
|
5112
|
+
points.push(
|
|
5113
|
+
i === 0 ? `M ${x.toFixed(2)} ${y.toFixed(2)}` : `L ${x.toFixed(2)} ${y.toFixed(2)}`
|
|
5114
|
+
);
|
|
5115
|
+
}
|
|
5116
|
+
return points.join(" ") + " Z";
|
|
5249
5117
|
}
|
|
5250
5118
|
var Progress = forwardRef(
|
|
5251
5119
|
({
|
|
5252
5120
|
type = "linear",
|
|
5253
5121
|
indeterminate = false,
|
|
5254
5122
|
size = "medium",
|
|
5123
|
+
shape = "flat",
|
|
5124
|
+
thickness = "default",
|
|
5255
5125
|
className,
|
|
5256
5126
|
label,
|
|
5257
5127
|
value = 0,
|
|
@@ -5261,6 +5131,7 @@ var Progress = forwardRef(
|
|
|
5261
5131
|
}, forwardedRef) => {
|
|
5262
5132
|
const internalRef = useRef(null);
|
|
5263
5133
|
const ref = forwardedRef ?? internalRef;
|
|
5134
|
+
const reducedMotion = useReducedMotion2();
|
|
5264
5135
|
const { progressBarProps, labelProps } = useProgressBar({
|
|
5265
5136
|
label,
|
|
5266
5137
|
value,
|
|
@@ -5270,6 +5141,7 @@ var Progress = forwardRef(
|
|
|
5270
5141
|
...restProps
|
|
5271
5142
|
});
|
|
5272
5143
|
const percentage = indeterminate ? 0 : Math.min(100, Math.max(0, (value - minValue) / (maxValue - minValue) * 100));
|
|
5144
|
+
const effectiveShape = reducedMotion ? "flat" : shape;
|
|
5273
5145
|
if (process.env.NODE_ENV !== "production") {
|
|
5274
5146
|
const ariaProps = restProps;
|
|
5275
5147
|
if (!label && !ariaProps["aria-label"] && !ariaProps["aria-labelledby"]) {
|
|
@@ -5286,52 +5158,72 @@ var Progress = forwardRef(
|
|
|
5286
5158
|
className: cn(progressContainerVariants({ type }), className),
|
|
5287
5159
|
children: [
|
|
5288
5160
|
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",
|
|
5161
|
+
type === "linear" ? /* @__PURE__ */ jsx(
|
|
5162
|
+
LinearProgress,
|
|
5306
5163
|
{
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5164
|
+
percentage,
|
|
5165
|
+
indeterminate,
|
|
5166
|
+
shape: effectiveShape,
|
|
5167
|
+
thickness,
|
|
5168
|
+
reducedMotion
|
|
5311
5169
|
}
|
|
5312
|
-
)
|
|
5313
|
-
|
|
5314
|
-
"div",
|
|
5170
|
+
) : /* @__PURE__ */ jsx(
|
|
5171
|
+
CircularProgress,
|
|
5315
5172
|
{
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5173
|
+
percentage,
|
|
5174
|
+
indeterminate,
|
|
5175
|
+
size,
|
|
5176
|
+
shape: effectiveShape,
|
|
5177
|
+
thickness,
|
|
5178
|
+
reducedMotion
|
|
5320
5179
|
}
|
|
5321
5180
|
)
|
|
5322
5181
|
]
|
|
5323
5182
|
}
|
|
5324
|
-
)
|
|
5183
|
+
);
|
|
5184
|
+
}
|
|
5185
|
+
);
|
|
5186
|
+
Progress.displayName = "Progress";
|
|
5187
|
+
function LinearProgress({
|
|
5188
|
+
percentage,
|
|
5189
|
+
indeterminate,
|
|
5190
|
+
shape,
|
|
5191
|
+
thickness,
|
|
5192
|
+
reducedMotion
|
|
5193
|
+
}) {
|
|
5194
|
+
if (indeterminate) {
|
|
5195
|
+
return shape === "wavy" ? /* @__PURE__ */ jsx(LinearWavyIndeterminate, { thickness }) : /* @__PURE__ */ jsx(LinearFlatIndeterminate, { thickness });
|
|
5325
5196
|
}
|
|
5326
|
-
return
|
|
5197
|
+
return shape === "wavy" ? /* @__PURE__ */ jsx(
|
|
5198
|
+
LinearWavyDeterminate,
|
|
5199
|
+
{
|
|
5200
|
+
percentage,
|
|
5201
|
+
thickness,
|
|
5202
|
+
reducedMotion
|
|
5203
|
+
}
|
|
5204
|
+
) : /* @__PURE__ */ jsx(LinearFlatDeterminate, { percentage, thickness });
|
|
5205
|
+
}
|
|
5206
|
+
function LinearFlatDeterminate({
|
|
5207
|
+
percentage,
|
|
5208
|
+
thickness
|
|
5209
|
+
}) {
|
|
5210
|
+
return /* @__PURE__ */ jsxs("div", { "data-progress-track": "", className: cn(progressTrackVariants({ thickness })), children: [
|
|
5327
5211
|
/* @__PURE__ */ jsx(
|
|
5328
5212
|
"div",
|
|
5329
5213
|
{
|
|
5330
5214
|
"data-progress-indicator": "",
|
|
5331
|
-
className: cn(
|
|
5215
|
+
className: cn(progressActiveIndicatorVariants()),
|
|
5332
5216
|
style: { width: `${percentage}%` }
|
|
5333
5217
|
}
|
|
5334
5218
|
),
|
|
5219
|
+
percentage < 100 && /* @__PURE__ */ jsx(
|
|
5220
|
+
"div",
|
|
5221
|
+
{
|
|
5222
|
+
"data-progress-inactive-segment": "",
|
|
5223
|
+
className: cn(progressInactiveSegmentVariants()),
|
|
5224
|
+
style: { left: `calc(${percentage}% + ${INDICATOR_TRACK_GAP}px)` }
|
|
5225
|
+
}
|
|
5226
|
+
),
|
|
5335
5227
|
/* @__PURE__ */ jsx(
|
|
5336
5228
|
"div",
|
|
5337
5229
|
{
|
|
@@ -5342,14 +5234,211 @@ function LinearProgress({ percentage, indeterminate }) {
|
|
|
5342
5234
|
)
|
|
5343
5235
|
] });
|
|
5344
5236
|
}
|
|
5237
|
+
function LinearFlatIndeterminate({
|
|
5238
|
+
thickness
|
|
5239
|
+
}) {
|
|
5240
|
+
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: [
|
|
5241
|
+
/* @__PURE__ */ jsx(
|
|
5242
|
+
"div",
|
|
5243
|
+
{
|
|
5244
|
+
className: cn(
|
|
5245
|
+
"bg-primary absolute top-0 h-full rounded-full",
|
|
5246
|
+
"animate-progress-linear-indeterminate-1"
|
|
5247
|
+
)
|
|
5248
|
+
}
|
|
5249
|
+
),
|
|
5250
|
+
/* @__PURE__ */ jsx(
|
|
5251
|
+
"div",
|
|
5252
|
+
{
|
|
5253
|
+
className: cn(
|
|
5254
|
+
"bg-primary absolute top-0 h-full rounded-full",
|
|
5255
|
+
"animate-progress-linear-indeterminate-2"
|
|
5256
|
+
)
|
|
5257
|
+
}
|
|
5258
|
+
)
|
|
5259
|
+
] }) });
|
|
5260
|
+
}
|
|
5261
|
+
function LinearWavyDeterminate({
|
|
5262
|
+
percentage,
|
|
5263
|
+
thickness,
|
|
5264
|
+
reducedMotion
|
|
5265
|
+
}) {
|
|
5266
|
+
const amplitude = thickness === "thick" ? WAVE_AMPLITUDE_THICK : WAVE_AMPLITUDE_DEFAULT;
|
|
5267
|
+
const containerHeight = (thickness === "thick" ? 8 : 4) + 2 * amplitude + 4;
|
|
5268
|
+
const midY = amplitude + 2;
|
|
5269
|
+
const trackHeightClass = thickness === "thick" ? "h-2" : "h-1";
|
|
5270
|
+
const trackPx = getStrokeWidth(thickness);
|
|
5271
|
+
const rampedAmplitude = reducedMotion || percentage <= 0 || percentage >= 100 ? 0 : amplitude * Math.min(
|
|
5272
|
+
(percentage - 10) / 10,
|
|
5273
|
+
// ramp up 10%→20%
|
|
5274
|
+
(90 - percentage) / 10,
|
|
5275
|
+
// ramp down 80%→90%
|
|
5276
|
+
1
|
|
5277
|
+
);
|
|
5278
|
+
const wavePath = buildLinearWavePath(VB_W, LINEAR_WAVE_COUNT, rampedAmplitude, midY);
|
|
5279
|
+
return /* @__PURE__ */ jsxs(
|
|
5280
|
+
"div",
|
|
5281
|
+
{
|
|
5282
|
+
"data-progress-track": "",
|
|
5283
|
+
className: cn("relative w-full overflow-hidden", trackHeightClass),
|
|
5284
|
+
style: { height: containerHeight },
|
|
5285
|
+
children: [
|
|
5286
|
+
/* @__PURE__ */ jsx(
|
|
5287
|
+
"svg",
|
|
5288
|
+
{
|
|
5289
|
+
viewBox: `0 0 ${VB_W} ${containerHeight}`,
|
|
5290
|
+
preserveAspectRatio: "none",
|
|
5291
|
+
className: cn(
|
|
5292
|
+
"absolute inset-0 w-full",
|
|
5293
|
+
"transition-[clip-path]",
|
|
5294
|
+
"duration-spring-standard-default-spatial",
|
|
5295
|
+
"ease-spring-standard-default-spatial"
|
|
5296
|
+
),
|
|
5297
|
+
style: {
|
|
5298
|
+
height: containerHeight,
|
|
5299
|
+
// clip-path applied in rendered-element space: keeps left `percentage`%
|
|
5300
|
+
clipPath: `inset(0 ${100 - percentage}% 0 0)`
|
|
5301
|
+
},
|
|
5302
|
+
"aria-hidden": "true",
|
|
5303
|
+
children: /* @__PURE__ */ jsx(
|
|
5304
|
+
"path",
|
|
5305
|
+
{
|
|
5306
|
+
"data-progress-indicator": "",
|
|
5307
|
+
d: wavePath,
|
|
5308
|
+
fill: "none",
|
|
5309
|
+
stroke: "currentColor",
|
|
5310
|
+
strokeWidth: getStrokeWidth(thickness),
|
|
5311
|
+
strokeLinecap: "round",
|
|
5312
|
+
vectorEffect: "non-scaling-stroke",
|
|
5313
|
+
className: "text-primary"
|
|
5314
|
+
}
|
|
5315
|
+
)
|
|
5316
|
+
}
|
|
5317
|
+
),
|
|
5318
|
+
percentage < 100 && /* @__PURE__ */ jsx(
|
|
5319
|
+
"div",
|
|
5320
|
+
{
|
|
5321
|
+
"data-progress-inactive-segment": "",
|
|
5322
|
+
className: cn(progressInactiveSegmentVariants()),
|
|
5323
|
+
style: {
|
|
5324
|
+
left: `calc(${percentage}% + ${INDICATOR_TRACK_GAP}px)`,
|
|
5325
|
+
height: trackPx,
|
|
5326
|
+
top: midY - trackPx / 2
|
|
5327
|
+
}
|
|
5328
|
+
}
|
|
5329
|
+
),
|
|
5330
|
+
/* @__PURE__ */ jsx(
|
|
5331
|
+
"div",
|
|
5332
|
+
{
|
|
5333
|
+
"data-stop-indicator": "",
|
|
5334
|
+
className: cn(progressStopIndicatorVariants()),
|
|
5335
|
+
style: { top: midY },
|
|
5336
|
+
"aria-hidden": "true"
|
|
5337
|
+
}
|
|
5338
|
+
)
|
|
5339
|
+
]
|
|
5340
|
+
}
|
|
5341
|
+
);
|
|
5342
|
+
}
|
|
5343
|
+
function LinearWavyIndeterminate({
|
|
5344
|
+
thickness
|
|
5345
|
+
}) {
|
|
5346
|
+
const amplitude = thickness === "thick" ? WAVE_AMPLITUDE_THICK : WAVE_AMPLITUDE_DEFAULT;
|
|
5347
|
+
const containerHeight = (thickness === "thick" ? 8 : 4) + 2 * amplitude + 4;
|
|
5348
|
+
const midY = amplitude + 2;
|
|
5349
|
+
const trackHeightClass = thickness === "thick" ? "h-2" : "h-1";
|
|
5350
|
+
const trackPx = getStrokeWidth(thickness);
|
|
5351
|
+
const wavePath = buildLinearWavePath(VB_W, LINEAR_WAVE_COUNT, amplitude, midY);
|
|
5352
|
+
return /* @__PURE__ */ jsxs(
|
|
5353
|
+
"div",
|
|
5354
|
+
{
|
|
5355
|
+
"data-progress-track": "",
|
|
5356
|
+
className: cn("relative w-full overflow-hidden", trackHeightClass),
|
|
5357
|
+
style: { height: containerHeight },
|
|
5358
|
+
children: [
|
|
5359
|
+
/* @__PURE__ */ jsx(
|
|
5360
|
+
"div",
|
|
5361
|
+
{
|
|
5362
|
+
className: "bg-primary-container absolute right-0 left-0 rounded-full",
|
|
5363
|
+
style: { height: trackPx, top: midY - trackPx / 2 }
|
|
5364
|
+
}
|
|
5365
|
+
),
|
|
5366
|
+
/* @__PURE__ */ jsxs("div", { "data-progress-indeterminate": "", className: "absolute inset-0", children: [
|
|
5367
|
+
/* @__PURE__ */ jsx(
|
|
5368
|
+
"svg",
|
|
5369
|
+
{
|
|
5370
|
+
viewBox: `0 0 ${VB_W} ${containerHeight}`,
|
|
5371
|
+
preserveAspectRatio: "none",
|
|
5372
|
+
className: "animate-progress-linear-indeterminate-1 absolute top-0 h-full",
|
|
5373
|
+
"aria-hidden": "true",
|
|
5374
|
+
children: /* @__PURE__ */ jsx(
|
|
5375
|
+
"path",
|
|
5376
|
+
{
|
|
5377
|
+
d: wavePath,
|
|
5378
|
+
fill: "none",
|
|
5379
|
+
stroke: "currentColor",
|
|
5380
|
+
strokeWidth: getStrokeWidth(thickness),
|
|
5381
|
+
strokeLinecap: "round",
|
|
5382
|
+
vectorEffect: "non-scaling-stroke",
|
|
5383
|
+
className: "text-primary"
|
|
5384
|
+
}
|
|
5385
|
+
)
|
|
5386
|
+
}
|
|
5387
|
+
),
|
|
5388
|
+
/* @__PURE__ */ jsx(
|
|
5389
|
+
"svg",
|
|
5390
|
+
{
|
|
5391
|
+
viewBox: `0 0 ${VB_W} ${containerHeight}`,
|
|
5392
|
+
preserveAspectRatio: "none",
|
|
5393
|
+
className: "animate-progress-linear-indeterminate-2 absolute top-0 h-full",
|
|
5394
|
+
"aria-hidden": "true",
|
|
5395
|
+
children: /* @__PURE__ */ jsx(
|
|
5396
|
+
"path",
|
|
5397
|
+
{
|
|
5398
|
+
d: wavePath,
|
|
5399
|
+
fill: "none",
|
|
5400
|
+
stroke: "currentColor",
|
|
5401
|
+
strokeWidth: getStrokeWidth(thickness),
|
|
5402
|
+
strokeLinecap: "round",
|
|
5403
|
+
vectorEffect: "non-scaling-stroke",
|
|
5404
|
+
className: "text-primary"
|
|
5405
|
+
}
|
|
5406
|
+
)
|
|
5407
|
+
}
|
|
5408
|
+
)
|
|
5409
|
+
] })
|
|
5410
|
+
]
|
|
5411
|
+
}
|
|
5412
|
+
);
|
|
5413
|
+
}
|
|
5345
5414
|
function CircularProgress({
|
|
5346
5415
|
percentage,
|
|
5347
5416
|
indeterminate,
|
|
5348
|
-
size
|
|
5417
|
+
size,
|
|
5418
|
+
shape,
|
|
5419
|
+
thickness,
|
|
5420
|
+
reducedMotion
|
|
5349
5421
|
}) {
|
|
5350
|
-
const { radius, circumference, viewBox, cx, cy } = getCircularGeometry(
|
|
5351
|
-
|
|
5422
|
+
const { radius, circumference, viewBox, cx, cy, strokeWidth, diameter } = getCircularGeometry(
|
|
5423
|
+
size,
|
|
5424
|
+
thickness
|
|
5425
|
+
);
|
|
5352
5426
|
if (indeterminate) {
|
|
5427
|
+
if (shape === "wavy") {
|
|
5428
|
+
return /* @__PURE__ */ jsx(
|
|
5429
|
+
CircularWavyIndeterminate,
|
|
5430
|
+
{
|
|
5431
|
+
size,
|
|
5432
|
+
cx,
|
|
5433
|
+
cy,
|
|
5434
|
+
radius,
|
|
5435
|
+
circumference,
|
|
5436
|
+
viewBox,
|
|
5437
|
+
strokeWidth,
|
|
5438
|
+
diameter
|
|
5439
|
+
}
|
|
5440
|
+
);
|
|
5441
|
+
}
|
|
5353
5442
|
return /* @__PURE__ */ jsx(
|
|
5354
5443
|
"div",
|
|
5355
5444
|
{
|
|
@@ -5371,8 +5460,8 @@ function CircularProgress({
|
|
|
5371
5460
|
r: radius,
|
|
5372
5461
|
fill: "none",
|
|
5373
5462
|
stroke: "currentColor",
|
|
5374
|
-
strokeWidth
|
|
5375
|
-
className: "text-
|
|
5463
|
+
strokeWidth,
|
|
5464
|
+
className: "text-primary-container"
|
|
5376
5465
|
}
|
|
5377
5466
|
),
|
|
5378
5467
|
/* @__PURE__ */ jsx(
|
|
@@ -5383,7 +5472,7 @@ function CircularProgress({
|
|
|
5383
5472
|
r: radius,
|
|
5384
5473
|
fill: "none",
|
|
5385
5474
|
stroke: "currentColor",
|
|
5386
|
-
strokeWidth
|
|
5475
|
+
strokeWidth,
|
|
5387
5476
|
className: "animate-progress-circular-dash text-primary",
|
|
5388
5477
|
strokeLinecap: "round"
|
|
5389
5478
|
}
|
|
@@ -5394,41 +5483,211 @@ function CircularProgress({
|
|
|
5394
5483
|
}
|
|
5395
5484
|
);
|
|
5396
5485
|
}
|
|
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",
|
|
5486
|
+
if (shape === "wavy") {
|
|
5487
|
+
return /* @__PURE__ */ jsx(
|
|
5488
|
+
CircularWavyDeterminate,
|
|
5412
5489
|
{
|
|
5490
|
+
size,
|
|
5491
|
+
percentage,
|
|
5413
5492
|
cx,
|
|
5414
5493
|
cy,
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
strokeWidth
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
strokeDasharray: circumference,
|
|
5422
|
-
strokeDashoffset
|
|
5494
|
+
radius,
|
|
5495
|
+
circumference,
|
|
5496
|
+
viewBox,
|
|
5497
|
+
strokeWidth,
|
|
5498
|
+
diameter,
|
|
5499
|
+
reducedMotion
|
|
5423
5500
|
}
|
|
5424
|
-
)
|
|
5425
|
-
|
|
5501
|
+
);
|
|
5502
|
+
}
|
|
5503
|
+
const activeArc = percentage / 100 * circumference;
|
|
5504
|
+
const activeArcGapped = Math.max(0, activeArc - INDICATOR_TRACK_GAP);
|
|
5505
|
+
const inactiveArcGapped = Math.max(0, circumference - activeArc - INDICATOR_TRACK_GAP);
|
|
5506
|
+
const activeOffset = 0;
|
|
5507
|
+
const inactiveOffset = -(activeArcGapped + INDICATOR_TRACK_GAP);
|
|
5508
|
+
return /* @__PURE__ */ jsxs("div", { "data-progress-size": size, className: cn(progressCircularSizeVariants({ size })), children: [
|
|
5509
|
+
/* @__PURE__ */ jsxs("svg", { viewBox, className: "h-full w-full -rotate-90", "aria-hidden": "true", children: [
|
|
5510
|
+
percentage < 100 && /* @__PURE__ */ jsx(
|
|
5511
|
+
"circle",
|
|
5512
|
+
{
|
|
5513
|
+
cx,
|
|
5514
|
+
cy,
|
|
5515
|
+
r: radius,
|
|
5516
|
+
fill: "none",
|
|
5517
|
+
stroke: "currentColor",
|
|
5518
|
+
strokeWidth,
|
|
5519
|
+
strokeLinecap: "round",
|
|
5520
|
+
strokeDasharray: `${inactiveArcGapped} ${circumference - inactiveArcGapped}`,
|
|
5521
|
+
strokeDashoffset: inactiveOffset,
|
|
5522
|
+
className: "text-primary-container duration-spring-standard-default-spatial ease-spring-standard-default-spatial transition-[stroke-dasharray,stroke-dashoffset]"
|
|
5523
|
+
}
|
|
5524
|
+
),
|
|
5525
|
+
percentage > 0 && /* @__PURE__ */ jsx(
|
|
5526
|
+
"circle",
|
|
5527
|
+
{
|
|
5528
|
+
cx,
|
|
5529
|
+
cy,
|
|
5530
|
+
r: radius,
|
|
5531
|
+
fill: "none",
|
|
5532
|
+
stroke: "currentColor",
|
|
5533
|
+
strokeWidth,
|
|
5534
|
+
strokeLinecap: "round",
|
|
5535
|
+
strokeDasharray: `${activeArcGapped} ${circumference - activeArcGapped}`,
|
|
5536
|
+
strokeDashoffset: activeOffset,
|
|
5537
|
+
className: "text-primary duration-spring-standard-default-spatial ease-spring-standard-default-spatial transition-[stroke-dasharray,stroke-dashoffset]"
|
|
5538
|
+
}
|
|
5539
|
+
),
|
|
5540
|
+
percentage === 0 && /* @__PURE__ */ jsx(
|
|
5541
|
+
"circle",
|
|
5542
|
+
{
|
|
5543
|
+
cx,
|
|
5544
|
+
cy,
|
|
5545
|
+
r: radius,
|
|
5546
|
+
fill: "none",
|
|
5547
|
+
stroke: "currentColor",
|
|
5548
|
+
strokeWidth,
|
|
5549
|
+
className: "text-primary-container"
|
|
5550
|
+
}
|
|
5551
|
+
)
|
|
5552
|
+
] }),
|
|
5553
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", "data-progress-diameter": diameter })
|
|
5554
|
+
] });
|
|
5555
|
+
}
|
|
5556
|
+
function CircularWavyIndeterminate({
|
|
5557
|
+
size,
|
|
5558
|
+
cx,
|
|
5559
|
+
cy,
|
|
5560
|
+
radius,
|
|
5561
|
+
circumference: _circumference,
|
|
5562
|
+
viewBox,
|
|
5563
|
+
strokeWidth
|
|
5564
|
+
}) {
|
|
5565
|
+
const circAmp = Math.min(WAVE_AMPLITUDE_DEFAULT, radius * 0.35);
|
|
5566
|
+
const meanRadius = radius - circAmp;
|
|
5567
|
+
const meanCircumference = 2 * Math.PI * meanRadius;
|
|
5568
|
+
const waveCount = Math.max(4, Math.round(meanCircumference / WAVE_WAVELENGTH_CIRCULAR));
|
|
5569
|
+
const wavePath = buildCircularWavePath(cx, cy, meanRadius, circAmp, waveCount);
|
|
5570
|
+
return /* @__PURE__ */ jsx(
|
|
5571
|
+
"div",
|
|
5572
|
+
{
|
|
5573
|
+
"data-progress-size": size,
|
|
5574
|
+
"data-progress-indeterminate": "",
|
|
5575
|
+
className: cn(progressCircularSizeVariants({ size })),
|
|
5576
|
+
children: /* @__PURE__ */ jsxs(
|
|
5577
|
+
"svg",
|
|
5578
|
+
{
|
|
5579
|
+
viewBox,
|
|
5580
|
+
className: "animate-progress-circular-rotate h-full w-full",
|
|
5581
|
+
"aria-hidden": "true",
|
|
5582
|
+
children: [
|
|
5583
|
+
/* @__PURE__ */ jsx(
|
|
5584
|
+
"circle",
|
|
5585
|
+
{
|
|
5586
|
+
cx,
|
|
5587
|
+
cy,
|
|
5588
|
+
r: meanRadius,
|
|
5589
|
+
fill: "none",
|
|
5590
|
+
stroke: "currentColor",
|
|
5591
|
+
strokeWidth,
|
|
5592
|
+
className: "text-primary-container"
|
|
5593
|
+
}
|
|
5594
|
+
),
|
|
5595
|
+
/* @__PURE__ */ jsx(
|
|
5596
|
+
"path",
|
|
5597
|
+
{
|
|
5598
|
+
d: wavePath,
|
|
5599
|
+
fill: "none",
|
|
5600
|
+
stroke: "currentColor",
|
|
5601
|
+
strokeWidth,
|
|
5602
|
+
strokeLinecap: "round",
|
|
5603
|
+
pathLength: 100,
|
|
5604
|
+
strokeDasharray: "28 72",
|
|
5605
|
+
className: "text-primary"
|
|
5606
|
+
}
|
|
5607
|
+
)
|
|
5608
|
+
]
|
|
5609
|
+
}
|
|
5610
|
+
)
|
|
5611
|
+
}
|
|
5612
|
+
);
|
|
5613
|
+
}
|
|
5614
|
+
function CircularWavyDeterminate({
|
|
5615
|
+
size,
|
|
5616
|
+
percentage,
|
|
5617
|
+
cx,
|
|
5618
|
+
cy,
|
|
5619
|
+
radius,
|
|
5620
|
+
circumference: _circumference,
|
|
5621
|
+
viewBox,
|
|
5622
|
+
strokeWidth,
|
|
5623
|
+
diameter,
|
|
5624
|
+
reducedMotion
|
|
5625
|
+
}) {
|
|
5626
|
+
const circAmp = reducedMotion ? 0 : Math.min(WAVE_AMPLITUDE_DEFAULT, radius * 0.35);
|
|
5627
|
+
const meanRadius = radius - circAmp;
|
|
5628
|
+
const meanCircumference = 2 * Math.PI * meanRadius;
|
|
5629
|
+
const waveCount = Math.max(4, Math.round(meanCircumference / WAVE_WAVELENGTH_CIRCULAR));
|
|
5630
|
+
const wavePath = buildCircularWavePath(cx, cy, meanRadius, circAmp, waveCount);
|
|
5631
|
+
const gapPct = INDICATOR_TRACK_GAP / meanCircumference * 100;
|
|
5632
|
+
const activeLen = Math.max(0, percentage - gapPct);
|
|
5633
|
+
const inactiveLen = Math.max(0, 100 - percentage - gapPct);
|
|
5634
|
+
const inactiveOffset = -(activeLen + gapPct);
|
|
5635
|
+
return /* @__PURE__ */ jsxs("div", { "data-progress-size": size, className: cn(progressCircularSizeVariants({ size })), children: [
|
|
5636
|
+
/* @__PURE__ */ jsxs("svg", { viewBox, className: "h-full w-full -rotate-90", "aria-hidden": "true", children: [
|
|
5637
|
+
percentage === 0 && /* @__PURE__ */ jsx(
|
|
5638
|
+
"circle",
|
|
5639
|
+
{
|
|
5640
|
+
cx,
|
|
5641
|
+
cy,
|
|
5642
|
+
r: meanRadius,
|
|
5643
|
+
fill: "none",
|
|
5644
|
+
stroke: "currentColor",
|
|
5645
|
+
strokeWidth,
|
|
5646
|
+
className: "text-primary-container"
|
|
5647
|
+
}
|
|
5648
|
+
),
|
|
5649
|
+
percentage > 0 && percentage < 100 && /* @__PURE__ */ jsx(
|
|
5650
|
+
"circle",
|
|
5651
|
+
{
|
|
5652
|
+
cx,
|
|
5653
|
+
cy,
|
|
5654
|
+
r: meanRadius,
|
|
5655
|
+
fill: "none",
|
|
5656
|
+
stroke: "currentColor",
|
|
5657
|
+
strokeWidth,
|
|
5658
|
+
strokeLinecap: "round",
|
|
5659
|
+
pathLength: 100,
|
|
5660
|
+
strokeDasharray: `${inactiveLen} ${100 - inactiveLen}`,
|
|
5661
|
+
strokeDashoffset: inactiveOffset,
|
|
5662
|
+
className: "text-primary-container duration-spring-standard-default-spatial ease-spring-standard-default-spatial transition-[stroke-dasharray,stroke-dashoffset]"
|
|
5663
|
+
}
|
|
5664
|
+
),
|
|
5665
|
+
percentage > 0 && /* @__PURE__ */ jsx(
|
|
5666
|
+
"path",
|
|
5667
|
+
{
|
|
5668
|
+
"data-progress-indicator": "",
|
|
5669
|
+
d: wavePath,
|
|
5670
|
+
fill: "none",
|
|
5671
|
+
stroke: "currentColor",
|
|
5672
|
+
strokeWidth,
|
|
5673
|
+
strokeLinecap: "round",
|
|
5674
|
+
pathLength: 100,
|
|
5675
|
+
strokeDasharray: percentage < 100 ? `${activeLen} ${100 - activeLen}` : void 0,
|
|
5676
|
+
strokeDashoffset: 0,
|
|
5677
|
+
className: "text-primary duration-spring-standard-default-spatial ease-spring-standard-default-spatial transition-[stroke-dasharray]"
|
|
5678
|
+
}
|
|
5679
|
+
)
|
|
5680
|
+
] }),
|
|
5681
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", "data-progress-diameter": diameter })
|
|
5682
|
+
] });
|
|
5426
5683
|
}
|
|
5427
5684
|
var ProgressHeadless = forwardRef(
|
|
5428
5685
|
({
|
|
5429
5686
|
type = "linear",
|
|
5430
5687
|
indeterminate = false,
|
|
5431
5688
|
size = "medium",
|
|
5689
|
+
shape = "flat",
|
|
5690
|
+
thickness = "default",
|
|
5432
5691
|
className,
|
|
5433
5692
|
children,
|
|
5434
5693
|
renderProgress,
|
|
@@ -5455,7 +5714,9 @@ var ProgressHeadless = forwardRef(
|
|
|
5455
5714
|
percentage,
|
|
5456
5715
|
isIndeterminate: indeterminate,
|
|
5457
5716
|
type,
|
|
5458
|
-
size
|
|
5717
|
+
size,
|
|
5718
|
+
shape,
|
|
5719
|
+
thickness
|
|
5459
5720
|
}),
|
|
5460
5721
|
children
|
|
5461
5722
|
] });
|