@tinybigui/react 0.11.0 → 0.11.1
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 +10 -10
- package/dist/index.cjs +114 -113
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +92 -48
- package/dist/index.d.ts +92 -48
- package/dist/index.js +114 -113
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5398,28 +5398,42 @@ var ProgressHeadless = forwardRef(
|
|
|
5398
5398
|
}
|
|
5399
5399
|
);
|
|
5400
5400
|
ProgressHeadless.displayName = "ProgressHeadless";
|
|
5401
|
-
var CardHeadless = forwardRef(function CardHeadless2({ className, children, ...
|
|
5401
|
+
var CardHeadless = forwardRef(function CardHeadless2({ className, children, onMouseDown, onMouseUp, onMouseLeave, ...rest }, forwardedRef) {
|
|
5402
5402
|
const internalRef = useRef(null);
|
|
5403
5403
|
const ref = forwardedRef ?? internalRef;
|
|
5404
|
-
const isInteractive = !!(
|
|
5405
|
-
const { buttonProps } = useButton({ elementType: "div", ...
|
|
5406
|
-
const {
|
|
5404
|
+
const isInteractive = !!(rest.onPress ?? rest.href);
|
|
5405
|
+
const { buttonProps } = useButton({ elementType: "div", ...rest }, ref);
|
|
5406
|
+
const {
|
|
5407
|
+
isDisabled: _isDisabled,
|
|
5408
|
+
onPress: _onPress,
|
|
5409
|
+
onPressStart: _onPressStart,
|
|
5410
|
+
onPressEnd: _onPressEnd,
|
|
5411
|
+
onPressChange: _onPressChange,
|
|
5412
|
+
onPressUp: _onPressUp,
|
|
5413
|
+
href: _href,
|
|
5414
|
+
target: _target,
|
|
5415
|
+
rel: _rel,
|
|
5416
|
+
...htmlAttrs
|
|
5417
|
+
} = rest;
|
|
5418
|
+
const mouseHandlers = { onMouseDown, onMouseUp, onMouseLeave };
|
|
5407
5419
|
if (isInteractive) {
|
|
5408
|
-
const interactiveProps = mergeProps(buttonProps,
|
|
5409
|
-
className,
|
|
5410
|
-
"data-focus-visible": isFocusVisible ? "true" : void 0
|
|
5411
|
-
});
|
|
5420
|
+
const interactiveProps = mergeProps(buttonProps, mouseHandlers, htmlAttrs, { className });
|
|
5412
5421
|
return /* @__PURE__ */ jsx("div", { ...interactiveProps, ref, children });
|
|
5413
5422
|
}
|
|
5414
|
-
return /* @__PURE__ */ jsx("div", { role: "article", className, ref, children });
|
|
5423
|
+
return /* @__PURE__ */ jsx("div", { role: "article", className, ref, ...mouseHandlers, ...htmlAttrs, children });
|
|
5415
5424
|
});
|
|
5416
5425
|
CardHeadless.displayName = "CardHeadless";
|
|
5417
5426
|
var cardVariants = cva(
|
|
5418
5427
|
[
|
|
5419
5428
|
// Shape: MD3 medium corner = 12dp
|
|
5420
|
-
"relative overflow-hidden rounded-md",
|
|
5421
|
-
//
|
|
5422
|
-
|
|
5429
|
+
"relative overflow-hidden rounded-md text-on-surface",
|
|
5430
|
+
// Transition: effects properties — standard default tier (cards are standard-size, not <48dp)
|
|
5431
|
+
// Covers shadow (elevation), opacity (disabled fade), border-color (outlined state)
|
|
5432
|
+
"transition-[box-shadow,opacity,border-color] duration-spring-standard-default-effects ease-spring-standard-default-effects",
|
|
5433
|
+
// Interactive affordance (content flag set by the component)
|
|
5434
|
+
"data-[interactive]:cursor-pointer",
|
|
5435
|
+
// Disabled — self-targeting selectors (38% container, no interaction)
|
|
5436
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none data-[disabled]:opacity-38"
|
|
5423
5437
|
],
|
|
5424
5438
|
{
|
|
5425
5439
|
variants: {
|
|
@@ -5427,92 +5441,74 @@ var cardVariants = cva(
|
|
|
5427
5441
|
* Card visual variant per MD3 specification.
|
|
5428
5442
|
*/
|
|
5429
5443
|
variant: {
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
"
|
|
5441
|
-
"
|
|
5442
|
-
"
|
|
5443
|
-
"focus-visible:outline-offset-2"
|
|
5444
|
+
/**
|
|
5445
|
+
* Elevated — separation via shadow.
|
|
5446
|
+
* MD3: container=surface-container-low.
|
|
5447
|
+
* Elevation: 1 base → 2 hover → 1 focus → 1 pressed → 4 dragged.
|
|
5448
|
+
*/
|
|
5449
|
+
elevated: [
|
|
5450
|
+
"bg-surface-container-low",
|
|
5451
|
+
"shadow-elevation-1",
|
|
5452
|
+
"data-[hovered]:shadow-elevation-2",
|
|
5453
|
+
"data-[focus-visible]:shadow-elevation-1",
|
|
5454
|
+
"data-[pressed]:data-[pressed]:shadow-elevation-1",
|
|
5455
|
+
"data-[dragged]:data-[dragged]:data-[dragged]:shadow-elevation-4",
|
|
5456
|
+
"data-[disabled]:shadow-none"
|
|
5444
5457
|
],
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
"shadow-
|
|
5455
|
-
|
|
5456
|
-
"
|
|
5457
|
-
"
|
|
5458
|
+
/**
|
|
5459
|
+
* Filled — subtle container fill, no resting shadow.
|
|
5460
|
+
* MD3: container=surface-container-highest.
|
|
5461
|
+
* Elevation: 0 base → 1 hover → 0 focus → 0 pressed → 3 dragged.
|
|
5462
|
+
*/
|
|
5463
|
+
filled: [
|
|
5464
|
+
"bg-surface-container-highest",
|
|
5465
|
+
"shadow-none",
|
|
5466
|
+
"data-[hovered]:shadow-elevation-1",
|
|
5467
|
+
"data-[focus-visible]:shadow-none",
|
|
5468
|
+
"data-[pressed]:data-[pressed]:shadow-none",
|
|
5469
|
+
"data-[dragged]:data-[dragged]:data-[dragged]:shadow-elevation-3",
|
|
5470
|
+
"data-[disabled]:shadow-none"
|
|
5458
5471
|
],
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5472
|
+
/**
|
|
5473
|
+
* Outlined — visual boundary via border, no resting shadow.
|
|
5474
|
+
* MD3: container=surface, outline=outline-variant.
|
|
5475
|
+
* Elevation: 0 base → 1 hover → 0 focus → 0 pressed → 3 dragged.
|
|
5476
|
+
*/
|
|
5477
|
+
outlined: [
|
|
5478
|
+
"bg-surface border border-outline-variant",
|
|
5479
|
+
"shadow-none",
|
|
5480
|
+
"data-[hovered]:shadow-elevation-1",
|
|
5481
|
+
"data-[focus-visible]:shadow-none",
|
|
5482
|
+
"data-[pressed]:data-[pressed]:shadow-none",
|
|
5483
|
+
"data-[dragged]:data-[dragged]:data-[dragged]:shadow-elevation-3",
|
|
5484
|
+
"data-[disabled]:shadow-none"
|
|
5485
|
+
]
|
|
5468
5486
|
}
|
|
5469
5487
|
},
|
|
5470
|
-
compoundVariants: [
|
|
5471
|
-
// Filled + enabled
|
|
5472
|
-
{
|
|
5473
|
-
variant: "filled",
|
|
5474
|
-
isDisabled: false,
|
|
5475
|
-
class: "bg-surface-container-highest"
|
|
5476
|
-
},
|
|
5477
|
-
// Filled + disabled
|
|
5478
|
-
{
|
|
5479
|
-
variant: "filled",
|
|
5480
|
-
isDisabled: true,
|
|
5481
|
-
class: "bg-surface-container-variant"
|
|
5482
|
-
},
|
|
5483
|
-
// Elevated + enabled
|
|
5484
|
-
{
|
|
5485
|
-
variant: "elevated",
|
|
5486
|
-
isDisabled: true,
|
|
5487
|
-
class: "bg-surface"
|
|
5488
|
-
},
|
|
5489
|
-
// Elevated + disabled
|
|
5490
|
-
{
|
|
5491
|
-
variant: "elevated",
|
|
5492
|
-
isDisabled: false,
|
|
5493
|
-
class: "bg-surface-container-low"
|
|
5494
|
-
},
|
|
5495
|
-
// Outlined + enabled
|
|
5496
|
-
{
|
|
5497
|
-
variant: "outlined",
|
|
5498
|
-
isDisabled: true,
|
|
5499
|
-
class: "bg-surface"
|
|
5500
|
-
},
|
|
5501
|
-
// Outlined + disabled
|
|
5502
|
-
{
|
|
5503
|
-
variant: "outlined",
|
|
5504
|
-
isDisabled: false,
|
|
5505
|
-
class: "bg-surface"
|
|
5506
|
-
}
|
|
5507
|
-
],
|
|
5508
5488
|
defaultVariants: {
|
|
5509
|
-
variant: "elevated"
|
|
5510
|
-
isInteractive: false,
|
|
5511
|
-
isDragged: false,
|
|
5512
|
-
isDisabled: false
|
|
5489
|
+
variant: "elevated"
|
|
5513
5490
|
}
|
|
5514
5491
|
}
|
|
5515
5492
|
);
|
|
5493
|
+
var cardStateLayerVariants = cva([
|
|
5494
|
+
"pointer-events-none absolute inset-0 rounded-[inherit] opacity-0",
|
|
5495
|
+
"bg-on-surface",
|
|
5496
|
+
// Effects transition for opacity — standard default tier (200ms, no overshoot)
|
|
5497
|
+
"transition-opacity duration-spring-standard-default-effects ease-spring-standard-default-effects",
|
|
5498
|
+
"group-data-[hovered]/card:opacity-8",
|
|
5499
|
+
"group-data-[focus-visible]/card:opacity-10",
|
|
5500
|
+
"group-data-[pressed]/card:group-data-[pressed]/card:opacity-10",
|
|
5501
|
+
"group-data-[dragged]/card:group-data-[dragged]/card:group-data-[dragged]/card:opacity-16",
|
|
5502
|
+
"group-data-[disabled]/card:hidden"
|
|
5503
|
+
]);
|
|
5504
|
+
var cardFocusRingVariants = cva([
|
|
5505
|
+
"pointer-events-none absolute inset-0 z-20 rounded-[inherit]",
|
|
5506
|
+
"outline outline-2 -outline-offset-2 outline-secondary",
|
|
5507
|
+
// Effects transition — standard default tier, opacity must not overshoot
|
|
5508
|
+
"transition-opacity duration-spring-standard-default-effects ease-spring-standard-default-effects",
|
|
5509
|
+
"opacity-0",
|
|
5510
|
+
"group-data-[focus-visible]/card:opacity-100"
|
|
5511
|
+
]);
|
|
5516
5512
|
var Card = forwardRef(function Card2({
|
|
5517
5513
|
variant = "elevated",
|
|
5518
5514
|
onPress,
|
|
@@ -5523,9 +5519,15 @@ var Card = forwardRef(function Card2({
|
|
|
5523
5519
|
children,
|
|
5524
5520
|
"aria-label": ariaLabel
|
|
5525
5521
|
}, ref) {
|
|
5522
|
+
const internalRef = useRef(null);
|
|
5523
|
+
const resolvedRef = ref ?? internalRef;
|
|
5526
5524
|
const isInteractive = !!(onPress ?? href);
|
|
5527
5525
|
const [isDragged, setIsDragged] = useState(false);
|
|
5528
5526
|
const [isPressed, setIsPressed] = useState(false);
|
|
5527
|
+
const { isHovered, hoverProps } = useHover({ isDisabled: !isInteractive || isDisabled });
|
|
5528
|
+
const { isFocusVisible, focusProps } = useFocusRing();
|
|
5529
|
+
const handlePressStart = useCallback(() => setIsPressed(true), []);
|
|
5530
|
+
const handlePressEnd = useCallback(() => setIsPressed(false), []);
|
|
5529
5531
|
const { onMouseDown: handleRipple, ripples } = useRipple({
|
|
5530
5532
|
disabled: !isInteractive || isDisabled
|
|
5531
5533
|
});
|
|
@@ -5539,42 +5541,41 @@ var Card = forwardRef(function Card2({
|
|
|
5539
5541
|
const handleMouseLeave = () => {
|
|
5540
5542
|
if (isDraggable) setIsDragged(false);
|
|
5541
5543
|
};
|
|
5542
|
-
const
|
|
5543
|
-
const
|
|
5544
|
+
const interactionAttrs = isInteractive ? getInteractionDataAttributes({ isHovered, isFocusVisible, isPressed, isDisabled }) : {};
|
|
5545
|
+
const interactiveHandlers = isInteractive ? mergeProps$1(hoverProps, focusProps, {
|
|
5546
|
+
onPressStart: handlePressStart,
|
|
5547
|
+
onPressEnd: handlePressEnd
|
|
5548
|
+
}) : {};
|
|
5544
5549
|
return /* @__PURE__ */ jsxs(
|
|
5545
5550
|
CardHeadless,
|
|
5546
5551
|
{
|
|
5547
|
-
ref,
|
|
5552
|
+
ref: resolvedRef,
|
|
5548
5553
|
...onPress !== void 0 && { onPress },
|
|
5549
5554
|
...href !== void 0 && { href },
|
|
5550
5555
|
isDisabled,
|
|
5551
5556
|
...ariaLabel !== void 0 && { "aria-label": ariaLabel },
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
),
|
|
5557
|
+
...interactiveHandlers,
|
|
5558
|
+
...isInteractive && { onMouseDown: handleMouseDown },
|
|
5559
|
+
...isInteractive && isDraggable && {
|
|
5560
|
+
onMouseUp: handleMouseUp,
|
|
5561
|
+
onMouseLeave: handleMouseLeave
|
|
5562
|
+
},
|
|
5563
|
+
...interactionAttrs,
|
|
5564
|
+
"data-interactive": isInteractive ? "" : void 0,
|
|
5565
|
+
"data-dragged": isInteractive && isDragged ? "" : void 0,
|
|
5566
|
+
className: cn(cardVariants({ variant }), "group/card", className),
|
|
5562
5567
|
children: [
|
|
5563
5568
|
isInteractive && /* @__PURE__ */ jsx(
|
|
5564
|
-
"
|
|
5569
|
+
"span",
|
|
5565
5570
|
{
|
|
5566
5571
|
"data-testid": "card-state-layer",
|
|
5567
|
-
"data-pressed": isPressed ? "" : void 0,
|
|
5568
5572
|
"aria-hidden": "true",
|
|
5569
|
-
className: cn(
|
|
5570
|
-
"bg-on-surface pointer-events-none absolute inset-0 rounded-md",
|
|
5571
|
-
"opacity-0 group-hover:opacity-8 data-[pressed]:opacity-12",
|
|
5572
|
-
"duration-spring-standard-fast-effects ease-spring-standard-fast-effects transition-opacity"
|
|
5573
|
-
)
|
|
5573
|
+
className: cn(cardStateLayerVariants())
|
|
5574
5574
|
}
|
|
5575
5575
|
),
|
|
5576
5576
|
isInteractive && ripples,
|
|
5577
|
-
|
|
5577
|
+
isInteractive && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn(cardFocusRingVariants()) }),
|
|
5578
|
+
/* @__PURE__ */ jsx("div", { className: "relative z-10", children })
|
|
5578
5579
|
]
|
|
5579
5580
|
}
|
|
5580
5581
|
);
|
|
@@ -5584,7 +5585,7 @@ var cardMediaVariants = cva("w-full object-cover", {
|
|
|
5584
5585
|
variants: {
|
|
5585
5586
|
aspectRatio: {
|
|
5586
5587
|
"16/9": "aspect-video",
|
|
5587
|
-
"4/3": "aspect-
|
|
5588
|
+
"4/3": "aspect-[4/3]",
|
|
5588
5589
|
"1/1": "aspect-square",
|
|
5589
5590
|
auto: ""
|
|
5590
5591
|
}
|
|
@@ -5608,7 +5609,7 @@ var CardMedia = forwardRef(function CardMedia2({ src, alt, aspectRatio = "auto",
|
|
|
5608
5609
|
CardMedia.displayName = "CardMedia";
|
|
5609
5610
|
var CardHeader = forwardRef(function CardHeader2({ headline, subheader, className }, ref) {
|
|
5610
5611
|
return /* @__PURE__ */ jsxs("div", { ref, className: cn("p-4", className), children: [
|
|
5611
|
-
/* @__PURE__ */ jsx("h3", { className: "text-on-surface text-title-
|
|
5612
|
+
/* @__PURE__ */ jsx("h3", { className: "text-on-surface text-title-medium", children: headline }),
|
|
5612
5613
|
subheader !== void 0 && /* @__PURE__ */ jsx("p", { className: "text-on-surface-variant text-body-medium mt-1", children: subheader })
|
|
5613
5614
|
] });
|
|
5614
5615
|
});
|