@tinybigui/react 0.16.0 → 0.18.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 +16 -16
- package/dist/index.cjs +454 -511
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +227 -70
- package/dist/index.d.ts +227 -70
- package/dist/index.js +440 -511
- 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
3228
|
}
|
|
3301
3229
|
},
|
|
3302
|
-
compoundVariants: [
|
|
3303
|
-
// Disabled + selected state overrides fill
|
|
3304
|
-
{
|
|
3305
|
-
state: "selected",
|
|
3306
|
-
disabled: true,
|
|
3307
|
-
className: "fill-current stroke-none"
|
|
3308
|
-
}
|
|
3309
|
-
],
|
|
3310
3230
|
defaultVariants: {
|
|
3311
|
-
|
|
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
|
-
}
|
|
3347
|
-
},
|
|
3348
|
-
defaultVariants: {
|
|
3349
|
-
disabled: false
|
|
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
|
|
@@ -8811,6 +8616,30 @@ var InteractiveStyledListItem = React.forwardRef(
|
|
|
8811
8616
|
}
|
|
8812
8617
|
);
|
|
8813
8618
|
InteractiveStyledListItem.displayName = "InteractiveStyledListItem";
|
|
8619
|
+
var ArrowBackIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8620
|
+
"svg",
|
|
8621
|
+
{
|
|
8622
|
+
width: "24",
|
|
8623
|
+
height: "24",
|
|
8624
|
+
viewBox: "0 0 24 24",
|
|
8625
|
+
fill: "currentColor",
|
|
8626
|
+
"aria-hidden": "true",
|
|
8627
|
+
focusable: "false",
|
|
8628
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" })
|
|
8629
|
+
}
|
|
8630
|
+
);
|
|
8631
|
+
var CloseIcon3 = () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8632
|
+
"svg",
|
|
8633
|
+
{
|
|
8634
|
+
width: "24",
|
|
8635
|
+
height: "24",
|
|
8636
|
+
viewBox: "0 0 24 24",
|
|
8637
|
+
fill: "currentColor",
|
|
8638
|
+
"aria-hidden": "true",
|
|
8639
|
+
focusable: "false",
|
|
8640
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })
|
|
8641
|
+
}
|
|
8642
|
+
);
|
|
8814
8643
|
var SearchBarHeadless = React.forwardRef(
|
|
8815
8644
|
({
|
|
8816
8645
|
value,
|
|
@@ -8826,7 +8655,9 @@ var SearchBarHeadless = React.forwardRef(
|
|
|
8826
8655
|
"aria-label": ariaLabel,
|
|
8827
8656
|
className,
|
|
8828
8657
|
onFocus,
|
|
8829
|
-
onBlur
|
|
8658
|
+
onBlur,
|
|
8659
|
+
inputClassName,
|
|
8660
|
+
trailingActionsClassName
|
|
8830
8661
|
}, forwardedRef) => {
|
|
8831
8662
|
const inputRef = React.useRef(null);
|
|
8832
8663
|
const internalFormRef = React.useRef(null);
|
|
@@ -8860,8 +8691,17 @@ var SearchBarHeadless = React.forwardRef(
|
|
|
8860
8691
|
);
|
|
8861
8692
|
return /* @__PURE__ */ jsxRuntime.jsxs("form", { ref: formRef, role: "search", className, onSubmit: handleFormSubmit, children: [
|
|
8862
8693
|
leadingIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "leading-icon", children: leadingIcon }),
|
|
8863
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8864
|
-
|
|
8694
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8695
|
+
"input",
|
|
8696
|
+
{
|
|
8697
|
+
...inputProps,
|
|
8698
|
+
ref: inputRef,
|
|
8699
|
+
role: "searchbox",
|
|
8700
|
+
"data-slot": "input",
|
|
8701
|
+
className: inputClassName
|
|
8702
|
+
}
|
|
8703
|
+
),
|
|
8704
|
+
trailingActions && trailingActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "trailing-actions", className: trailingActionsClassName, children: trailingActions }),
|
|
8865
8705
|
avatar && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "avatar", children: avatar })
|
|
8866
8706
|
] });
|
|
8867
8707
|
}
|
|
@@ -8881,32 +8721,45 @@ var SearchViewHeadless = React.forwardRef(
|
|
|
8881
8721
|
children,
|
|
8882
8722
|
leadingIcon,
|
|
8883
8723
|
trailingActions,
|
|
8884
|
-
showDivider
|
|
8724
|
+
showDivider,
|
|
8725
|
+
layout = "fullscreen",
|
|
8726
|
+
headerClassName,
|
|
8727
|
+
backButtonClassName,
|
|
8728
|
+
clearButtonClassName,
|
|
8729
|
+
inputClassName,
|
|
8730
|
+
trailingActionsClassName,
|
|
8731
|
+
dividerClassName,
|
|
8732
|
+
contentClassName
|
|
8885
8733
|
}, forwardedRef) => {
|
|
8886
8734
|
if (!isOpen) {
|
|
8887
8735
|
return null;
|
|
8888
8736
|
}
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8737
|
+
const panelProps = {
|
|
8738
|
+
onClose,
|
|
8739
|
+
ariaLabel,
|
|
8740
|
+
layout,
|
|
8741
|
+
children,
|
|
8742
|
+
...className !== void 0 ? { className } : {},
|
|
8743
|
+
...leadingIcon !== void 0 ? { leadingIcon } : {},
|
|
8744
|
+
...trailingActions !== void 0 ? { trailingActions } : {},
|
|
8745
|
+
...showDivider !== void 0 ? { showDivider } : {},
|
|
8746
|
+
...value !== void 0 ? { value } : {},
|
|
8747
|
+
...defaultValue !== void 0 ? { defaultValue } : {},
|
|
8748
|
+
...onChange !== void 0 ? { onChange } : {},
|
|
8749
|
+
...onSubmit !== void 0 ? { onSubmit } : {},
|
|
8750
|
+
...placeholder !== void 0 ? { placeholder } : {},
|
|
8751
|
+
headerClassName,
|
|
8752
|
+
backButtonClassName,
|
|
8753
|
+
clearButtonClassName,
|
|
8754
|
+
inputClassName,
|
|
8755
|
+
trailingActionsClassName,
|
|
8756
|
+
dividerClassName,
|
|
8757
|
+
contentClassName
|
|
8758
|
+
};
|
|
8759
|
+
if (layout === "docked") {
|
|
8760
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SearchViewPanel, { ref: forwardedRef, ...panelProps });
|
|
8761
|
+
}
|
|
8762
|
+
return reactDom.createPortal(/* @__PURE__ */ jsxRuntime.jsx(SearchViewPanel, { ref: forwardedRef, ...panelProps }), document.body);
|
|
8910
8763
|
}
|
|
8911
8764
|
);
|
|
8912
8765
|
SearchViewHeadless.displayName = "SearchViewHeadless";
|
|
@@ -8923,12 +8776,21 @@ var SearchViewPanel = React.forwardRef(
|
|
|
8923
8776
|
children,
|
|
8924
8777
|
leadingIcon,
|
|
8925
8778
|
trailingActions,
|
|
8926
|
-
showDivider
|
|
8779
|
+
showDivider,
|
|
8780
|
+
layout,
|
|
8781
|
+
headerClassName,
|
|
8782
|
+
backButtonClassName,
|
|
8783
|
+
clearButtonClassName,
|
|
8784
|
+
inputClassName,
|
|
8785
|
+
trailingActionsClassName,
|
|
8786
|
+
dividerClassName,
|
|
8787
|
+
contentClassName
|
|
8927
8788
|
}, forwardedRef) => {
|
|
8928
8789
|
const panelRef = React.useRef(null);
|
|
8929
8790
|
const inputRef = React.useRef(null);
|
|
8930
8791
|
const ref = forwardedRef ?? panelRef;
|
|
8931
|
-
|
|
8792
|
+
const isFullscreen = layout === "fullscreen";
|
|
8793
|
+
reactAria.usePreventScroll({ isDisabled: !isFullscreen });
|
|
8932
8794
|
const { overlayProps } = reactAria.useOverlay(
|
|
8933
8795
|
{
|
|
8934
8796
|
isOpen: true,
|
|
@@ -8961,7 +8823,17 @@ var SearchViewPanel = React.forwardRef(
|
|
|
8961
8823
|
const handleBackClick = React.useCallback(() => {
|
|
8962
8824
|
onClose();
|
|
8963
8825
|
}, [onClose]);
|
|
8964
|
-
const
|
|
8826
|
+
const defaultBackButton = /* @__PURE__ */ jsxRuntime.jsx(
|
|
8827
|
+
"button",
|
|
8828
|
+
{
|
|
8829
|
+
type: "button",
|
|
8830
|
+
"aria-label": "Back",
|
|
8831
|
+
onClick: handleBackClick,
|
|
8832
|
+
"data-slot": "back-button",
|
|
8833
|
+
className: backButtonClassName,
|
|
8834
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ArrowBackIcon, {})
|
|
8835
|
+
}
|
|
8836
|
+
);
|
|
8965
8837
|
const clearButton = state.value ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8966
8838
|
"button",
|
|
8967
8839
|
{
|
|
@@ -8970,66 +8842,109 @@ var SearchViewPanel = React.forwardRef(
|
|
|
8970
8842
|
type: "button",
|
|
8971
8843
|
"aria-label": "Clear search",
|
|
8972
8844
|
"data-slot": "clear-button",
|
|
8973
|
-
|
|
8845
|
+
className: clearButtonClassName,
|
|
8846
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon3, {})
|
|
8974
8847
|
}
|
|
8975
8848
|
) : null;
|
|
8976
|
-
return
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8849
|
+
return (
|
|
8850
|
+
// Focus containment only for fullscreen — docked uses restoreFocus + autoFocus only
|
|
8851
|
+
// so tabbing can naturally leave the widget.
|
|
8852
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactAria.FocusScope, { contain: isFullscreen, restoreFocus: true, autoFocus: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ...overlayProps, ref, role: "search", "aria-label": ariaLabel, className, children: [
|
|
8853
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "header", className: headerClassName, children: [
|
|
8854
|
+
leadingIcon ?? defaultBackButton,
|
|
8855
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8856
|
+
"input",
|
|
8857
|
+
{
|
|
8858
|
+
...inputProps,
|
|
8859
|
+
ref: inputRef,
|
|
8860
|
+
role: "searchbox",
|
|
8861
|
+
"data-slot": "input",
|
|
8862
|
+
className: inputClassName
|
|
8863
|
+
}
|
|
8864
|
+
),
|
|
8865
|
+
clearButton,
|
|
8866
|
+
trailingActions && trailingActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "trailing-actions", className: trailingActionsClassName, children: trailingActions })
|
|
8867
|
+
] }),
|
|
8868
|
+
showDivider && /* @__PURE__ */ jsxRuntime.jsx("hr", { "data-slot": "divider", className: dividerClassName }),
|
|
8869
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "content", "aria-live": "polite", className: contentClassName, children })
|
|
8870
|
+
] }) })
|
|
8871
|
+
);
|
|
8986
8872
|
}
|
|
8987
8873
|
);
|
|
8988
8874
|
SearchViewPanel.displayName = "SearchViewPanel";
|
|
8989
|
-
var
|
|
8875
|
+
var searchBarRootVariants = classVarianceAuthority.cva(
|
|
8990
8876
|
[
|
|
8991
|
-
"relative flex items-center h-14 rounded-full
|
|
8992
|
-
"
|
|
8877
|
+
"relative flex items-center h-14 rounded-full",
|
|
8878
|
+
"bg-surface-container-high shadow-elevation-3",
|
|
8879
|
+
"w-full text-body-large cursor-text",
|
|
8880
|
+
// Disabled — self-targeting; pointer-events lets ripple/hover stop cleanly
|
|
8881
|
+
"data-[disabled]:opacity-38 data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed"
|
|
8993
8882
|
],
|
|
8994
8883
|
{
|
|
8995
8884
|
variants: {
|
|
8885
|
+
/**
|
|
8886
|
+
* Visual style of the search bar.
|
|
8887
|
+
* - contained: M3 Expressive — fills container, expressive motion, adjustable spacing
|
|
8888
|
+
* - divided: Baseline — 16dp fixed spacing, no expressive motion
|
|
8889
|
+
*/
|
|
8996
8890
|
style: {
|
|
8997
|
-
|
|
8891
|
+
/**
|
|
8892
|
+
* Contained (Expressive): spacing governed by data-[with-actions] content flag.
|
|
8893
|
+
* With actions: px-1 gap-1 (4dp each)
|
|
8894
|
+
* Without actions: px-4 (16dp each)
|
|
8895
|
+
*/
|
|
8896
|
+
contained: [
|
|
8897
|
+
"px-4",
|
|
8898
|
+
// default: no-actions 16dp
|
|
8899
|
+
"data-[with-actions]:px-1 data-[with-actions]:gap-1"
|
|
8900
|
+
// with-actions: 4dp
|
|
8901
|
+
],
|
|
8902
|
+
/**
|
|
8903
|
+
* Divided (Baseline): fixed 16dp side padding, 16dp icon-label gap.
|
|
8904
|
+
*/
|
|
8998
8905
|
divided: "px-4 gap-4"
|
|
8999
|
-
},
|
|
9000
|
-
noActions: {
|
|
9001
|
-
true: "",
|
|
9002
|
-
false: ""
|
|
9003
|
-
},
|
|
9004
|
-
focused: {
|
|
9005
|
-
true: "",
|
|
9006
|
-
false: ""
|
|
9007
|
-
},
|
|
9008
|
-
disabled: {
|
|
9009
|
-
true: "opacity-38 pointer-events-none",
|
|
9010
|
-
false: ""
|
|
9011
8906
|
}
|
|
9012
8907
|
},
|
|
9013
|
-
|
|
9014
|
-
{
|
|
9015
|
-
style: "contained",
|
|
9016
|
-
noActions: false,
|
|
9017
|
-
class: "px-1 gap-1"
|
|
9018
|
-
},
|
|
9019
|
-
{
|
|
9020
|
-
style: "contained",
|
|
9021
|
-
noActions: true,
|
|
9022
|
-
class: "px-4"
|
|
9023
|
-
}
|
|
9024
|
-
],
|
|
9025
|
-
defaultVariants: {
|
|
9026
|
-
style: "contained",
|
|
9027
|
-
noActions: false,
|
|
9028
|
-
focused: false,
|
|
9029
|
-
disabled: false
|
|
9030
|
-
}
|
|
8908
|
+
defaultVariants: { style: "contained" }
|
|
9031
8909
|
}
|
|
9032
8910
|
);
|
|
8911
|
+
var searchBarStateLayerVariants = classVarianceAuthority.cva([
|
|
8912
|
+
"absolute inset-0 rounded-full pointer-events-none opacity-0",
|
|
8913
|
+
"bg-on-surface",
|
|
8914
|
+
// Effects transition — no overshoot on opacity
|
|
8915
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
8916
|
+
// Hover: 8%
|
|
8917
|
+
"group-data-[hovered]/search:opacity-8",
|
|
8918
|
+
// Pressed: 10%, doubled selector wins over hover at equal cascade position
|
|
8919
|
+
"group-data-[pressed]/search:group-data-[pressed]/search:opacity-10",
|
|
8920
|
+
// No state layer when disabled
|
|
8921
|
+
"group-data-[disabled]/search:hidden"
|
|
8922
|
+
]);
|
|
8923
|
+
var searchBarFocusRingVariants = classVarianceAuthority.cva([
|
|
8924
|
+
"pointer-events-none absolute inset-[-3px] rounded-full",
|
|
8925
|
+
"outline outline-[3px] outline-offset-0 outline-secondary",
|
|
8926
|
+
// Effects transition
|
|
8927
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
8928
|
+
"opacity-0",
|
|
8929
|
+
"group-data-[focus-visible]/search:opacity-100"
|
|
8930
|
+
]);
|
|
8931
|
+
var searchBarLeadingIconVariants = classVarianceAuthority.cva([
|
|
8932
|
+
"flex size-12 shrink-0 items-center justify-center text-on-surface"
|
|
8933
|
+
]);
|
|
8934
|
+
var searchBarTrailingActionVariants = classVarianceAuthority.cva([
|
|
8935
|
+
"flex size-12 shrink-0 items-center justify-center text-on-surface-variant"
|
|
8936
|
+
]);
|
|
8937
|
+
var searchBarAvatarVariants = classVarianceAuthority.cva(["flex size-12 shrink-0 items-center justify-center"]);
|
|
8938
|
+
var searchBarTrailingActionsVariants = classVarianceAuthority.cva(["flex items-center"]);
|
|
8939
|
+
var searchBarInputVariants = classVarianceAuthority.cva([
|
|
8940
|
+
"flex-1 min-w-0 bg-transparent outline-none",
|
|
8941
|
+
"text-body-large text-on-surface",
|
|
8942
|
+
"placeholder:text-on-surface-variant",
|
|
8943
|
+
"focus-visible:outline-none",
|
|
8944
|
+
// Hide native browser search affordances — our MD3 clear button handles clearing
|
|
8945
|
+
"[&::-webkit-search-cancel-button]:appearance-none",
|
|
8946
|
+
"[&::-webkit-search-decoration]:appearance-none"
|
|
8947
|
+
]);
|
|
9033
8948
|
var searchViewVariants = classVarianceAuthority.cva(["flex flex-col shadow-elevation-3 z-50 overflow-hidden"], {
|
|
9034
8949
|
variants: {
|
|
9035
8950
|
style: {
|
|
@@ -9042,31 +8957,32 @@ var searchViewVariants = classVarianceAuthority.cva(["flex flex-col shadow-eleva
|
|
|
9042
8957
|
}
|
|
9043
8958
|
},
|
|
9044
8959
|
compoundVariants: [
|
|
8960
|
+
// Contained + fullscreen: surface-container-low, square corners
|
|
9045
8961
|
{
|
|
9046
8962
|
style: "contained",
|
|
9047
8963
|
layout: "fullscreen",
|
|
9048
8964
|
class: "bg-surface-container-low rounded-none"
|
|
9049
8965
|
},
|
|
8966
|
+
// Contained + docked: surface-container-high, 12dp results rounding, 2dp gap
|
|
9050
8967
|
{
|
|
9051
8968
|
style: "contained",
|
|
9052
8969
|
layout: "docked",
|
|
9053
8970
|
class: "bg-surface-container-high rounded-xl gap-0.5"
|
|
9054
8971
|
},
|
|
8972
|
+
// Divided + fullscreen: surface-container-high, square corners
|
|
9055
8973
|
{
|
|
9056
8974
|
style: "divided",
|
|
9057
8975
|
layout: "fullscreen",
|
|
9058
8976
|
class: "bg-surface-container-high rounded-none"
|
|
9059
8977
|
},
|
|
8978
|
+
// Divided + docked: surface-container-high, extra-large rounding (28dp)
|
|
9060
8979
|
{
|
|
9061
8980
|
style: "divided",
|
|
9062
8981
|
layout: "docked",
|
|
9063
8982
|
class: "bg-surface-container-high rounded-[28px]"
|
|
9064
8983
|
}
|
|
9065
8984
|
],
|
|
9066
|
-
defaultVariants: {
|
|
9067
|
-
style: "contained",
|
|
9068
|
-
layout: "fullscreen"
|
|
9069
|
-
}
|
|
8985
|
+
defaultVariants: { style: "contained", layout: "fullscreen" }
|
|
9070
8986
|
});
|
|
9071
8987
|
var searchViewHeaderVariants = classVarianceAuthority.cva(
|
|
9072
8988
|
["flex items-center w-full bg-surface-container-high gap-1"],
|
|
@@ -9077,14 +8993,50 @@ var searchViewHeaderVariants = classVarianceAuthority.cva(
|
|
|
9077
8993
|
divided: "h-[72px] px-4"
|
|
9078
8994
|
},
|
|
9079
8995
|
layout: {
|
|
8996
|
+
// Docked overrides height to 56dp regardless of style
|
|
9080
8997
|
docked: "h-14",
|
|
9081
8998
|
fullscreen: ""
|
|
9082
8999
|
}
|
|
9083
9000
|
},
|
|
9084
|
-
defaultVariants: {
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9001
|
+
defaultVariants: { style: "contained", layout: "fullscreen" }
|
|
9002
|
+
}
|
|
9003
|
+
);
|
|
9004
|
+
var searchViewBackButtonVariants = classVarianceAuthority.cva([
|
|
9005
|
+
"flex size-12 shrink-0 items-center justify-center",
|
|
9006
|
+
"text-on-surface rounded-full",
|
|
9007
|
+
"cursor-pointer"
|
|
9008
|
+
]);
|
|
9009
|
+
var searchViewClearButtonVariants = classVarianceAuthority.cva([
|
|
9010
|
+
"flex size-12 shrink-0 items-center justify-center",
|
|
9011
|
+
"text-on-surface-variant rounded-full",
|
|
9012
|
+
"cursor-pointer",
|
|
9013
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects"
|
|
9014
|
+
]);
|
|
9015
|
+
var searchViewTrailingActionVariants = classVarianceAuthority.cva([
|
|
9016
|
+
"flex size-12 shrink-0 items-center justify-center text-on-surface-variant"
|
|
9017
|
+
]);
|
|
9018
|
+
var searchViewTrailingActionsVariants = classVarianceAuthority.cva(["flex items-center"]);
|
|
9019
|
+
var searchViewInputVariants = classVarianceAuthority.cva([
|
|
9020
|
+
"flex-1 min-w-0 bg-transparent outline-none",
|
|
9021
|
+
"text-body-large text-on-surface",
|
|
9022
|
+
"placeholder:text-on-surface-variant",
|
|
9023
|
+
"focus-visible:outline-none",
|
|
9024
|
+
// Hide native browser search affordances
|
|
9025
|
+
"[&::-webkit-search-cancel-button]:appearance-none",
|
|
9026
|
+
"[&::-webkit-search-decoration]:appearance-none"
|
|
9027
|
+
]);
|
|
9028
|
+
var searchViewDividerVariants = classVarianceAuthority.cva(["border-t border-outline w-full"]);
|
|
9029
|
+
var searchViewContentVariants = classVarianceAuthority.cva(["flex-1 overflow-y-auto"]);
|
|
9030
|
+
var DefaultSearchIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9031
|
+
"svg",
|
|
9032
|
+
{
|
|
9033
|
+
width: "24",
|
|
9034
|
+
height: "24",
|
|
9035
|
+
viewBox: "0 0 24 24",
|
|
9036
|
+
fill: "currentColor",
|
|
9037
|
+
"aria-hidden": "true",
|
|
9038
|
+
focusable: "false",
|
|
9039
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" })
|
|
9088
9040
|
}
|
|
9089
9041
|
);
|
|
9090
9042
|
var SearchBar = React.forwardRef(
|
|
@@ -9105,7 +9057,7 @@ var SearchBar = React.forwardRef(
|
|
|
9105
9057
|
onFocus,
|
|
9106
9058
|
onBlur
|
|
9107
9059
|
}, ref) => {
|
|
9108
|
-
const
|
|
9060
|
+
const hasActions = trailingActions != null && trailingActions.length > 0 || !!avatar;
|
|
9109
9061
|
const reducedMotion = useReducedMotion();
|
|
9110
9062
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
9111
9063
|
const handleFocusInternal = React.useCallback(() => {
|
|
@@ -9116,83 +9068,85 @@ var SearchBar = React.forwardRef(
|
|
|
9116
9068
|
setIsFocused(false);
|
|
9117
9069
|
onBlur?.();
|
|
9118
9070
|
}, [onBlur]);
|
|
9119
|
-
const {
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
const
|
|
9123
|
-
const
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
children: action
|
|
9071
|
+
const { isHovered, hoverProps } = reactAria.useHover({ isDisabled });
|
|
9072
|
+
const { isFocusVisible, focusProps } = reactAria.useFocusRing({ within: true });
|
|
9073
|
+
const [isPressed, setIsPressed] = React.useState(false);
|
|
9074
|
+
const { onMouseDown: handleRipple, ripples } = useRipple({ disabled: isDisabled });
|
|
9075
|
+
const handleMouseDown = React.useCallback(
|
|
9076
|
+
(e) => {
|
|
9077
|
+
setIsPressed(true);
|
|
9078
|
+
handleRipple(e);
|
|
9128
9079
|
},
|
|
9129
|
-
|
|
9130
|
-
)
|
|
9131
|
-
const
|
|
9080
|
+
[handleRipple]
|
|
9081
|
+
);
|
|
9082
|
+
const handleMouseUp = React.useCallback(() => setIsPressed(false), []);
|
|
9083
|
+
const styledLeadingIcon = /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(searchBarLeadingIconVariants()), children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-6", children: leadingIcon ?? /* @__PURE__ */ jsxRuntime.jsx(DefaultSearchIcon, {}) }) });
|
|
9084
|
+
const styledTrailingActions = trailingActions?.map((action, index) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(searchBarTrailingActionVariants()), children: action }, index));
|
|
9085
|
+
const styledAvatar = avatar ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(searchBarAvatarVariants()), children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-[30px] overflow-hidden rounded-full", children: avatar }) }) : void 0;
|
|
9086
|
+
const paneMarginClass = searchStyle === "contained" ? isFocused ? "mx-3" : "mx-6" : "";
|
|
9087
|
+
const paneTransitionClass = searchStyle === "contained" && !reducedMotion ? "transition-[margin] duration-expressive-fast-spatial ease-expressive-fast-spatial" : "";
|
|
9132
9088
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9133
9089
|
"div",
|
|
9134
9090
|
{
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9140
|
-
"
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
|
|
9091
|
+
role: "presentation",
|
|
9092
|
+
...reactAria.mergeProps(hoverProps, focusProps),
|
|
9093
|
+
className: cn(paneTransitionClass, paneMarginClass),
|
|
9094
|
+
onMouseUp: handleMouseUp,
|
|
9095
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "presentation", className: "relative", children: [
|
|
9096
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(searchBarFocusRingVariants()), "aria-hidden": "true" }),
|
|
9097
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
9098
|
+
"div",
|
|
9099
|
+
{
|
|
9100
|
+
role: "presentation",
|
|
9101
|
+
...getInteractionDataAttributes({
|
|
9102
|
+
isHovered,
|
|
9103
|
+
isFocusVisible,
|
|
9104
|
+
isPressed,
|
|
9105
|
+
isDisabled
|
|
9150
9106
|
}),
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
"span",
|
|
9157
|
-
{
|
|
9158
|
-
"data-slot": "state-layer",
|
|
9159
|
-
className: cn(
|
|
9160
|
-
"bg-on-surface pointer-events-none absolute inset-0 rounded-full opacity-0",
|
|
9161
|
-
"group-hover:opacity-8 group-active:opacity-10",
|
|
9162
|
-
"duration-spring-standard-fast-effects ease-spring-standard-fast-effects transition-opacity"
|
|
9163
|
-
)
|
|
9164
|
-
}
|
|
9165
|
-
),
|
|
9166
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9167
|
-
SearchBarHeadless,
|
|
9168
|
-
{
|
|
9169
|
-
ref,
|
|
9170
|
-
...value !== void 0 ? { value } : {},
|
|
9171
|
-
...defaultValue !== void 0 ? { defaultValue } : {},
|
|
9172
|
-
...onChange !== void 0 ? { onChange } : {},
|
|
9173
|
-
...onSubmit !== void 0 ? { onSubmit } : {},
|
|
9174
|
-
...onClear !== void 0 ? { onClear } : {},
|
|
9175
|
-
...placeholder !== void 0 ? { placeholder } : {},
|
|
9176
|
-
...styledLeadingIcon !== void 0 ? { leadingIcon: styledLeadingIcon } : {},
|
|
9177
|
-
...styledTrailingActions !== void 0 ? { trailingActions: styledTrailingActions } : {},
|
|
9178
|
-
...styledAvatar !== void 0 ? { avatar: styledAvatar } : {},
|
|
9179
|
-
...isDisabled !== void 0 ? { isDisabled } : {},
|
|
9180
|
-
...ariaLabel !== void 0 ? { "aria-label": ariaLabel } : {},
|
|
9181
|
-
onFocus: handleFocusInternal,
|
|
9182
|
-
onBlur: handleBlurInternal,
|
|
9183
|
-
className: cn(
|
|
9184
|
-
"relative z-0 flex h-full w-full items-center",
|
|
9185
|
-
"[&_input]:flex-1 [&_input]:bg-transparent [&_input]:outline-none",
|
|
9186
|
-
"[&_input]:text-body-large [&_input]:text-on-surface",
|
|
9187
|
-
"[&_input]:placeholder:text-on-surface-variant",
|
|
9188
|
-
"[&_input]:focus-visible:outline-none"
|
|
9189
|
-
)
|
|
9190
|
-
}
|
|
9107
|
+
"data-with-actions": hasActions ? "" : void 0,
|
|
9108
|
+
className: cn(
|
|
9109
|
+
"group/search overflow-hidden",
|
|
9110
|
+
searchBarRootVariants({ style: searchStyle }),
|
|
9111
|
+
className
|
|
9191
9112
|
),
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9113
|
+
onMouseDown: (e) => handleMouseDown(e),
|
|
9114
|
+
children: [
|
|
9115
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9116
|
+
"span",
|
|
9117
|
+
{
|
|
9118
|
+
"data-slot": "state-layer",
|
|
9119
|
+
className: cn(searchBarStateLayerVariants()),
|
|
9120
|
+
"aria-hidden": "true"
|
|
9121
|
+
}
|
|
9122
|
+
),
|
|
9123
|
+
ripples,
|
|
9124
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9125
|
+
SearchBarHeadless,
|
|
9126
|
+
{
|
|
9127
|
+
ref,
|
|
9128
|
+
...value !== void 0 ? { value } : {},
|
|
9129
|
+
...defaultValue !== void 0 ? { defaultValue } : {},
|
|
9130
|
+
...onChange !== void 0 ? { onChange } : {},
|
|
9131
|
+
...onSubmit !== void 0 ? { onSubmit } : {},
|
|
9132
|
+
...onClear !== void 0 ? { onClear } : {},
|
|
9133
|
+
...placeholder !== void 0 ? { placeholder } : {},
|
|
9134
|
+
leadingIcon: styledLeadingIcon,
|
|
9135
|
+
...styledTrailingActions !== void 0 ? { trailingActions: styledTrailingActions } : {},
|
|
9136
|
+
...styledAvatar !== void 0 ? { avatar: styledAvatar } : {},
|
|
9137
|
+
isDisabled,
|
|
9138
|
+
...ariaLabel !== void 0 ? { "aria-label": ariaLabel } : {},
|
|
9139
|
+
onFocus: handleFocusInternal,
|
|
9140
|
+
onBlur: handleBlurInternal,
|
|
9141
|
+
className: "relative z-0 flex h-full w-full items-center",
|
|
9142
|
+
inputClassName: cn(searchBarInputVariants()),
|
|
9143
|
+
trailingActionsClassName: cn(searchBarTrailingActionsVariants())
|
|
9144
|
+
}
|
|
9145
|
+
)
|
|
9146
|
+
]
|
|
9147
|
+
}
|
|
9148
|
+
)
|
|
9149
|
+
] })
|
|
9196
9150
|
}
|
|
9197
9151
|
);
|
|
9198
9152
|
}
|
|
@@ -9217,21 +9171,29 @@ var SearchView = React.forwardRef(
|
|
|
9217
9171
|
showDivider
|
|
9218
9172
|
}, ref) => {
|
|
9219
9173
|
const resolvedShowDivider = showDivider ?? searchStyle === "divided";
|
|
9174
|
+
const enterMotionClass = layout === "docked" ? "animate-md-scale-in" : "animate-md-fade-in";
|
|
9175
|
+
const containerClass = cn(
|
|
9176
|
+
searchViewVariants({ style: searchStyle, layout }),
|
|
9177
|
+
enterMotionClass,
|
|
9178
|
+
className
|
|
9179
|
+
);
|
|
9180
|
+
const headerClass = cn(searchViewHeaderVariants({ style: searchStyle, layout }));
|
|
9181
|
+
const backButtonClass = cn(searchViewBackButtonVariants());
|
|
9182
|
+
const clearButtonClass = cn(searchViewClearButtonVariants());
|
|
9183
|
+
const trailingActionClass = cn(searchViewTrailingActionVariants());
|
|
9184
|
+
const trailingActionsGroupClass = cn(searchViewTrailingActionsVariants());
|
|
9185
|
+
const inputClass = cn(searchViewInputVariants());
|
|
9186
|
+
const dividerClass = cn(searchViewDividerVariants());
|
|
9187
|
+
const contentClass = cn(searchViewContentVariants());
|
|
9220
9188
|
const styledLeadingIcon = leadingIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-on-surface flex size-12 shrink-0 items-center justify-center", children: leadingIcon }) : void 0;
|
|
9221
|
-
const styledTrailingActions = trailingActions?.map((action, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9222
|
-
"span",
|
|
9223
|
-
{
|
|
9224
|
-
className: "text-on-surface-variant flex size-12 shrink-0 items-center justify-center",
|
|
9225
|
-
children: action
|
|
9226
|
-
},
|
|
9227
|
-
index
|
|
9228
|
-
));
|
|
9189
|
+
const styledTrailingActions = trailingActions?.map((action, index) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: trailingActionClass, children: action }, index));
|
|
9229
9190
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9230
9191
|
SearchViewHeadless,
|
|
9231
9192
|
{
|
|
9232
9193
|
ref,
|
|
9233
9194
|
isOpen,
|
|
9234
9195
|
onClose,
|
|
9196
|
+
layout,
|
|
9235
9197
|
...value !== void 0 ? { value } : {},
|
|
9236
9198
|
...defaultValue !== void 0 ? { defaultValue } : {},
|
|
9237
9199
|
...onChange !== void 0 ? { onChange } : {},
|
|
@@ -9241,53 +9203,20 @@ var SearchView = React.forwardRef(
|
|
|
9241
9203
|
...styledLeadingIcon !== void 0 ? { leadingIcon: styledLeadingIcon } : {},
|
|
9242
9204
|
...styledTrailingActions !== void 0 ? { trailingActions: styledTrailingActions } : {},
|
|
9243
9205
|
showDivider: resolvedShowDivider,
|
|
9244
|
-
className:
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9206
|
+
className: containerClass,
|
|
9207
|
+
headerClassName: headerClass,
|
|
9208
|
+
backButtonClassName: backButtonClass,
|
|
9209
|
+
clearButtonClassName: clearButtonClass,
|
|
9210
|
+
inputClassName: inputClass,
|
|
9211
|
+
trailingActionsClassName: trailingActionsGroupClass,
|
|
9212
|
+
dividerClassName: dividerClass,
|
|
9213
|
+
contentClassName: contentClass,
|
|
9251
9214
|
children
|
|
9252
9215
|
}
|
|
9253
9216
|
);
|
|
9254
9217
|
}
|
|
9255
9218
|
);
|
|
9256
9219
|
SearchView.displayName = "SearchView";
|
|
9257
|
-
var slotClasses = cn(
|
|
9258
|
-
// Input styling
|
|
9259
|
-
"[&_input]:flex-1 [&_input]:bg-transparent [&_input]:outline-none",
|
|
9260
|
-
"[&_input]:text-body-large [&_input]:text-on-surface",
|
|
9261
|
-
"[&_input]:placeholder:text-on-surface-variant",
|
|
9262
|
-
// Divider
|
|
9263
|
-
"[&>[data-slot=divider]]:border-outline",
|
|
9264
|
-
// Content area
|
|
9265
|
-
"[&>[data-slot=content]]:flex-1 [&>[data-slot=content]]:overflow-y-auto",
|
|
9266
|
-
// Clear button
|
|
9267
|
-
"[&_[data-slot=clear-button]]:size-12 [&_[data-slot=clear-button]]:flex",
|
|
9268
|
-
"[&_[data-slot=clear-button]]:items-center [&_[data-slot=clear-button]]:justify-center",
|
|
9269
|
-
"[&_[data-slot=clear-button]]:text-on-surface-variant",
|
|
9270
|
-
"[&_[data-slot=clear-button]]:transition-opacity [&_[data-slot=clear-button]]:duration-short4",
|
|
9271
|
-
"[&_[data-slot=clear-button]]:ease-standard",
|
|
9272
|
-
// Back button
|
|
9273
|
-
"[&_[data-slot=back-button]]:size-12 [&_[data-slot=back-button]]:flex",
|
|
9274
|
-
"[&_[data-slot=back-button]]:items-center [&_[data-slot=back-button]]:justify-center",
|
|
9275
|
-
"[&_[data-slot=back-button]]:text-on-surface"
|
|
9276
|
-
);
|
|
9277
|
-
function getHeaderClasses(style, layout) {
|
|
9278
|
-
const base = "[&>[data-slot=header]]:flex [&>[data-slot=header]]:items-center [&>[data-slot=header]]:w-full [&>[data-slot=header]]:bg-surface-container-high [&>[data-slot=header]]:gap-1";
|
|
9279
|
-
if (layout === "docked") {
|
|
9280
|
-
return cn(
|
|
9281
|
-
base,
|
|
9282
|
-
"[&>[data-slot=header]]:h-14",
|
|
9283
|
-
style === "contained" ? "[&>[data-slot=header]]:px-3" : "[&>[data-slot=header]]:px-4"
|
|
9284
|
-
);
|
|
9285
|
-
}
|
|
9286
|
-
if (style === "contained") {
|
|
9287
|
-
return cn(base, "[&>[data-slot=header]]:h-14 [&>[data-slot=header]]:px-3");
|
|
9288
|
-
}
|
|
9289
|
-
return cn(base, "[&>[data-slot=header]]:h-[72px] [&>[data-slot=header]]:px-4");
|
|
9290
|
-
}
|
|
9291
9220
|
var Search = React.forwardRef(
|
|
9292
9221
|
({
|
|
9293
9222
|
isOpen: controlledIsOpen,
|
|
@@ -16316,8 +16245,22 @@ exports.remToPx = remToPx;
|
|
|
16316
16245
|
exports.rgbToHex = rgbToHex;
|
|
16317
16246
|
exports.richTooltipVariants = richTooltipVariants;
|
|
16318
16247
|
exports.scrimVariants = scrimVariants2;
|
|
16319
|
-
exports.
|
|
16248
|
+
exports.searchBarAvatarVariants = searchBarAvatarVariants;
|
|
16249
|
+
exports.searchBarFocusRingVariants = searchBarFocusRingVariants;
|
|
16250
|
+
exports.searchBarInputVariants = searchBarInputVariants;
|
|
16251
|
+
exports.searchBarLeadingIconVariants = searchBarLeadingIconVariants;
|
|
16252
|
+
exports.searchBarRootVariants = searchBarRootVariants;
|
|
16253
|
+
exports.searchBarStateLayerVariants = searchBarStateLayerVariants;
|
|
16254
|
+
exports.searchBarTrailingActionVariants = searchBarTrailingActionVariants;
|
|
16255
|
+
exports.searchBarTrailingActionsVariants = searchBarTrailingActionsVariants;
|
|
16256
|
+
exports.searchViewBackButtonVariants = searchViewBackButtonVariants;
|
|
16257
|
+
exports.searchViewClearButtonVariants = searchViewClearButtonVariants;
|
|
16258
|
+
exports.searchViewContentVariants = searchViewContentVariants;
|
|
16259
|
+
exports.searchViewDividerVariants = searchViewDividerVariants;
|
|
16320
16260
|
exports.searchViewHeaderVariants = searchViewHeaderVariants;
|
|
16261
|
+
exports.searchViewInputVariants = searchViewInputVariants;
|
|
16262
|
+
exports.searchViewTrailingActionVariants = searchViewTrailingActionVariants;
|
|
16263
|
+
exports.searchViewTrailingActionsVariants = searchViewTrailingActionsVariants;
|
|
16321
16264
|
exports.searchViewVariants = searchViewVariants;
|
|
16322
16265
|
exports.sliderActiveTrackVariants = sliderActiveTrackVariants;
|
|
16323
16266
|
exports.sliderContainerVariants = sliderContainerVariants;
|