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