@tinybigui/react 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/dist/index.cjs +334 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -5
- package/dist/index.d.ts +23 -5
- package/dist/index.js +334 -69
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ A modern, accessible React component library implementing Google's Material Desi
|
|
|
12
12
|
|
|
13
13
|
## ✅ Status
|
|
14
14
|
|
|
15
|
-
> **Latest Release: v0.
|
|
15
|
+
> **Latest Release: v0.20.0** (2026-06-10)
|
|
16
16
|
>
|
|
17
17
|
> **29 MD3 components** published to npm with full TypeScript support and WCAG 2.1 AA accessibility.
|
|
18
18
|
>
|
|
@@ -159,14 +159,14 @@ See [THEMING.md](./THEMING.md) for the full customization guide.
|
|
|
159
159
|
|
|
160
160
|
### Phase 3: Feedback ✅
|
|
161
161
|
|
|
162
|
-
| Component | Status | Description
|
|
163
|
-
| ------------- | ------ |
|
|
164
|
-
| `Dialog` | ✅ | Basic and fullscreen modal dialogs
|
|
165
|
-
| `Snackbar` | ✅ |
|
|
166
|
-
| `Menu` | ✅ | Dropdown, context menu, submenus
|
|
167
|
-
| `Progress` | ✅ | MD3 expressive slot CVA, colorful tokens, wavy shape, thick track (v0.16.0)
|
|
168
|
-
| `BottomSheet` | ✅ | MD3 expressive handle, variants-vs-states architecture (v0.11.0)
|
|
169
|
-
| `Tooltip` | ✅ | Plain and rich tooltip with positioning
|
|
162
|
+
| Component | Status | Description |
|
|
163
|
+
| ------------- | ------ | ---------------------------------------------------------------------------------- |
|
|
164
|
+
| `Dialog` | ✅ | Basic and fullscreen modal dialogs |
|
|
165
|
+
| `Snackbar` | ✅ | MD3 slot-based architecture, inverse-surface state layers, spring motion (v0.20.0) |
|
|
166
|
+
| `Menu` | ✅ | Dropdown, context menu, submenus |
|
|
167
|
+
| `Progress` | ✅ | MD3 expressive slot CVA, colorful tokens, wavy shape, thick track (v0.16.0) |
|
|
168
|
+
| `BottomSheet` | ✅ | MD3 expressive handle, variants-vs-states architecture (v0.11.0) |
|
|
169
|
+
| `Tooltip` | ✅ | Plain and rich tooltip with positioning |
|
|
170
170
|
|
|
171
171
|
### Phase 4: Data Display ✅
|
|
172
172
|
|
package/dist/index.cjs
CHANGED
|
@@ -6560,7 +6560,6 @@ var snackbarBaseVariants = classVarianceAuthority.cva(
|
|
|
6560
6560
|
"min-w-72",
|
|
6561
6561
|
"max-w-snackbar-max",
|
|
6562
6562
|
"w-max",
|
|
6563
|
-
"min-h-12",
|
|
6564
6563
|
// Restore pointer events so hover/focus timer pause works
|
|
6565
6564
|
"pointer-events-auto",
|
|
6566
6565
|
// Surface
|
|
@@ -6571,25 +6570,27 @@ var snackbarBaseVariants = classVarianceAuthority.cva(
|
|
|
6571
6570
|
"shadow-elevation-3",
|
|
6572
6571
|
// Layout
|
|
6573
6572
|
"flex",
|
|
6574
|
-
"items-center",
|
|
6575
6573
|
"gap-x-1",
|
|
6576
|
-
"pl-4
|
|
6577
|
-
// Typography
|
|
6574
|
+
"pl-4",
|
|
6575
|
+
// Typography base (inherited by message/supporting-text slots)
|
|
6578
6576
|
"text-body-medium",
|
|
6579
6577
|
"text-inverse-on-surface",
|
|
6580
|
-
//
|
|
6578
|
+
// Slide + fade transition — spring-standard effects tokens (no overshoot).
|
|
6579
|
+
// The translate offset is small (12px), so using the effects token pair for
|
|
6580
|
+
// BOTH opacity AND transform is safe: no visible overshoot at this scale.
|
|
6581
6581
|
"transition-[opacity,transform]",
|
|
6582
6582
|
"will-change-[opacity,transform]"
|
|
6583
6583
|
],
|
|
6584
6584
|
{
|
|
6585
6585
|
variants: {
|
|
6586
6586
|
/**
|
|
6587
|
-
*
|
|
6588
|
-
*
|
|
6587
|
+
* Two-line density mode.
|
|
6588
|
+
* false — 48dp, items centered (single-line message)
|
|
6589
|
+
* true — 68dp, items top-aligned (message + supporting text)
|
|
6589
6590
|
*/
|
|
6590
6591
|
twoLine: {
|
|
6591
|
-
|
|
6592
|
-
|
|
6592
|
+
false: ["min-h-12", "items-center", "pr-1"],
|
|
6593
|
+
true: ["min-h-[4.25rem]", "items-start", "pr-1"]
|
|
6593
6594
|
}
|
|
6594
6595
|
},
|
|
6595
6596
|
defaultVariants: {
|
|
@@ -6615,53 +6616,211 @@ classVarianceAuthority.cva("", {
|
|
|
6615
6616
|
var snackbarAnimationVariants = classVarianceAuthority.cva("", {
|
|
6616
6617
|
variants: {
|
|
6617
6618
|
animationState: {
|
|
6618
|
-
entering: [
|
|
6619
|
-
visible: [
|
|
6620
|
-
exiting: [
|
|
6621
|
-
exited: [
|
|
6619
|
+
entering: [],
|
|
6620
|
+
visible: [],
|
|
6621
|
+
exiting: [],
|
|
6622
|
+
exited: []
|
|
6622
6623
|
},
|
|
6623
6624
|
enterDirection: {
|
|
6624
|
-
up: [
|
|
6625
|
-
down: [
|
|
6625
|
+
up: [],
|
|
6626
|
+
down: []
|
|
6626
6627
|
}
|
|
6627
6628
|
},
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
animationState: {
|
|
6636
|
-
entering: ["opacity-0", "scale-75"],
|
|
6637
|
-
visible: ["scale-100", "opacity-100", "duration-medium1", "ease-emphasized-decelerate"],
|
|
6638
|
-
exiting: ["scale-75", "opacity-0", "duration-short4", "ease-standard-accelerate"],
|
|
6639
|
-
exited: ["scale-75", "opacity-0", "duration-short4", "ease-standard-accelerate"]
|
|
6629
|
+
compoundVariants: [
|
|
6630
|
+
// ── entering ──────────────────────────────────────────────────────────────
|
|
6631
|
+
// No transition duration — instant jump to offset state before first paint.
|
|
6632
|
+
{
|
|
6633
|
+
animationState: "entering",
|
|
6634
|
+
enterDirection: "up",
|
|
6635
|
+
className: ["opacity-0", "translate-y-3"]
|
|
6640
6636
|
},
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6637
|
+
{
|
|
6638
|
+
animationState: "entering",
|
|
6639
|
+
enterDirection: "down",
|
|
6640
|
+
className: ["opacity-0", "-translate-y-3"]
|
|
6644
6641
|
},
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6642
|
+
// ── visible ───────────────────────────────────────────────────────────────
|
|
6643
|
+
// spring-standard default effects = 200ms, no overshoot.
|
|
6644
|
+
{
|
|
6645
|
+
animationState: "visible",
|
|
6646
|
+
enterDirection: "up",
|
|
6647
|
+
className: [
|
|
6648
|
+
"opacity-100",
|
|
6649
|
+
"translate-y-0",
|
|
6650
|
+
"duration-spring-standard-default-effects",
|
|
6651
|
+
"ease-spring-standard-default-effects"
|
|
6652
|
+
]
|
|
6653
|
+
},
|
|
6654
|
+
{
|
|
6655
|
+
animationState: "visible",
|
|
6656
|
+
enterDirection: "down",
|
|
6657
|
+
className: [
|
|
6658
|
+
"opacity-100",
|
|
6659
|
+
"translate-y-0",
|
|
6660
|
+
"duration-spring-standard-default-effects",
|
|
6661
|
+
"ease-spring-standard-default-effects"
|
|
6662
|
+
]
|
|
6663
|
+
},
|
|
6664
|
+
// ── exiting ───────────────────────────────────────────────────────────────
|
|
6665
|
+
// spring-standard fast effects = 150ms (quicker exit).
|
|
6666
|
+
{
|
|
6667
|
+
animationState: "exiting",
|
|
6668
|
+
enterDirection: "up",
|
|
6669
|
+
className: [
|
|
6670
|
+
"opacity-0",
|
|
6671
|
+
"translate-y-3",
|
|
6672
|
+
"duration-spring-standard-fast-effects",
|
|
6673
|
+
"ease-spring-standard-fast-effects"
|
|
6674
|
+
]
|
|
6652
6675
|
},
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6676
|
+
{
|
|
6677
|
+
animationState: "exiting",
|
|
6678
|
+
enterDirection: "down",
|
|
6679
|
+
className: [
|
|
6680
|
+
"opacity-0",
|
|
6681
|
+
"-translate-y-3",
|
|
6682
|
+
"duration-spring-standard-fast-effects",
|
|
6683
|
+
"ease-spring-standard-fast-effects"
|
|
6684
|
+
]
|
|
6685
|
+
},
|
|
6686
|
+
// ── exited ────────────────────────────────────────────────────────────────
|
|
6687
|
+
// Hold final position — element is removed from DOM shortly after.
|
|
6688
|
+
{
|
|
6689
|
+
animationState: "exited",
|
|
6690
|
+
enterDirection: "up",
|
|
6691
|
+
className: ["opacity-0", "translate-y-3"]
|
|
6692
|
+
},
|
|
6693
|
+
{
|
|
6694
|
+
animationState: "exited",
|
|
6695
|
+
enterDirection: "down",
|
|
6696
|
+
className: ["opacity-0", "-translate-y-3"]
|
|
6656
6697
|
}
|
|
6657
|
-
|
|
6698
|
+
],
|
|
6658
6699
|
defaultVariants: {
|
|
6659
6700
|
animationState: "entering",
|
|
6660
|
-
enterDirection: "up"
|
|
6661
|
-
position: "bottom-center",
|
|
6662
|
-
twoLine: false
|
|
6701
|
+
enterDirection: "up"
|
|
6663
6702
|
}
|
|
6664
6703
|
});
|
|
6704
|
+
classVarianceAuthority.cva(
|
|
6705
|
+
[
|
|
6706
|
+
"min-w-72",
|
|
6707
|
+
"max-w-snackbar-max",
|
|
6708
|
+
"w-max",
|
|
6709
|
+
"pointer-events-auto",
|
|
6710
|
+
"bg-inverse-surface",
|
|
6711
|
+
"rounded-xs",
|
|
6712
|
+
"shadow-elevation-3",
|
|
6713
|
+
"flex",
|
|
6714
|
+
"gap-x-1",
|
|
6715
|
+
"pl-4",
|
|
6716
|
+
"text-body-medium",
|
|
6717
|
+
"text-inverse-on-surface",
|
|
6718
|
+
"transition-[opacity,transform]",
|
|
6719
|
+
"will-change-[opacity,transform]"
|
|
6720
|
+
],
|
|
6721
|
+
{
|
|
6722
|
+
variants: {
|
|
6723
|
+
twoLine: {
|
|
6724
|
+
false: ["min-h-12", "items-center", "pr-1"],
|
|
6725
|
+
true: ["min-h-[4.25rem]", "items-start", "pr-1"]
|
|
6726
|
+
},
|
|
6727
|
+
animationState: {
|
|
6728
|
+
entering: [],
|
|
6729
|
+
visible: [],
|
|
6730
|
+
exiting: [],
|
|
6731
|
+
exited: []
|
|
6732
|
+
},
|
|
6733
|
+
enterDirection: {
|
|
6734
|
+
up: [],
|
|
6735
|
+
down: []
|
|
6736
|
+
},
|
|
6737
|
+
position: {
|
|
6738
|
+
"bottom-center": ["bottom-4", "left-1/2", "-translate-x-1/2"],
|
|
6739
|
+
"bottom-left": ["bottom-4", "left-4"],
|
|
6740
|
+
"bottom-right": ["bottom-4", "right-4"],
|
|
6741
|
+
"top-center": ["top-4", "left-1/2", "-translate-x-1/2"],
|
|
6742
|
+
"top-left": ["top-4", "left-4"],
|
|
6743
|
+
"top-right": ["top-4", "right-4"]
|
|
6744
|
+
}
|
|
6745
|
+
},
|
|
6746
|
+
compoundVariants: [
|
|
6747
|
+
{
|
|
6748
|
+
animationState: "entering",
|
|
6749
|
+
enterDirection: "up",
|
|
6750
|
+
className: ["opacity-0", "translate-y-3"]
|
|
6751
|
+
},
|
|
6752
|
+
{
|
|
6753
|
+
animationState: "entering",
|
|
6754
|
+
enterDirection: "down",
|
|
6755
|
+
className: ["opacity-0", "-translate-y-3"]
|
|
6756
|
+
},
|
|
6757
|
+
{
|
|
6758
|
+
animationState: "visible",
|
|
6759
|
+
enterDirection: "up",
|
|
6760
|
+
className: [
|
|
6761
|
+
"opacity-100",
|
|
6762
|
+
"translate-y-0",
|
|
6763
|
+
"duration-spring-standard-default-effects",
|
|
6764
|
+
"ease-spring-standard-default-effects"
|
|
6765
|
+
]
|
|
6766
|
+
},
|
|
6767
|
+
{
|
|
6768
|
+
animationState: "visible",
|
|
6769
|
+
enterDirection: "down",
|
|
6770
|
+
className: [
|
|
6771
|
+
"opacity-100",
|
|
6772
|
+
"translate-y-0",
|
|
6773
|
+
"duration-spring-standard-default-effects",
|
|
6774
|
+
"ease-spring-standard-default-effects"
|
|
6775
|
+
]
|
|
6776
|
+
},
|
|
6777
|
+
{
|
|
6778
|
+
animationState: "exiting",
|
|
6779
|
+
enterDirection: "up",
|
|
6780
|
+
className: [
|
|
6781
|
+
"opacity-0",
|
|
6782
|
+
"translate-y-3",
|
|
6783
|
+
"duration-spring-standard-fast-effects",
|
|
6784
|
+
"ease-spring-standard-fast-effects"
|
|
6785
|
+
]
|
|
6786
|
+
},
|
|
6787
|
+
{
|
|
6788
|
+
animationState: "exiting",
|
|
6789
|
+
enterDirection: "down",
|
|
6790
|
+
className: [
|
|
6791
|
+
"opacity-0",
|
|
6792
|
+
"-translate-y-3",
|
|
6793
|
+
"duration-spring-standard-fast-effects",
|
|
6794
|
+
"ease-spring-standard-fast-effects"
|
|
6795
|
+
]
|
|
6796
|
+
},
|
|
6797
|
+
{
|
|
6798
|
+
animationState: "exited",
|
|
6799
|
+
enterDirection: "up",
|
|
6800
|
+
className: ["opacity-0", "translate-y-3"]
|
|
6801
|
+
},
|
|
6802
|
+
{
|
|
6803
|
+
animationState: "exited",
|
|
6804
|
+
enterDirection: "down",
|
|
6805
|
+
className: ["opacity-0", "-translate-y-3"]
|
|
6806
|
+
}
|
|
6807
|
+
],
|
|
6808
|
+
defaultVariants: {
|
|
6809
|
+
animationState: "entering",
|
|
6810
|
+
enterDirection: "up",
|
|
6811
|
+
position: "bottom-center",
|
|
6812
|
+
twoLine: false
|
|
6813
|
+
}
|
|
6814
|
+
}
|
|
6815
|
+
);
|
|
6816
|
+
var snackbarContentVariants = classVarianceAuthority.cva([
|
|
6817
|
+
"flex",
|
|
6818
|
+
"flex-col",
|
|
6819
|
+
"flex-1",
|
|
6820
|
+
"min-w-0",
|
|
6821
|
+
"py-3",
|
|
6822
|
+
"pr-2"
|
|
6823
|
+
]);
|
|
6665
6824
|
var snackbarMessageVariants = classVarianceAuthority.cva([
|
|
6666
6825
|
"flex-1",
|
|
6667
6826
|
"text-body-medium",
|
|
@@ -6670,15 +6829,83 @@ var snackbarMessageVariants = classVarianceAuthority.cva([
|
|
|
6670
6829
|
var snackbarSupportingTextVariants = classVarianceAuthority.cva([
|
|
6671
6830
|
"text-body-medium",
|
|
6672
6831
|
"text-inverse-on-surface",
|
|
6673
|
-
"
|
|
6832
|
+
"mt-1"
|
|
6674
6833
|
]);
|
|
6675
|
-
|
|
6676
|
-
var snackbarCloseVariants = classVarianceAuthority.cva(["shrink-0", "text-inverse-on-surface"]);
|
|
6677
|
-
var snackbarContentVariants = classVarianceAuthority.cva(["flex", "flex-col", "flex-1", "min-w-0 py-2 pr-2"]);
|
|
6678
|
-
classVarianceAuthority.cva(["scale-75", "opacity-0"]);
|
|
6834
|
+
classVarianceAuthority.cva(["opacity-0"]);
|
|
6679
6835
|
function getEnterDirection(position) {
|
|
6680
6836
|
return position.startsWith("top") ? "down" : "up";
|
|
6681
6837
|
}
|
|
6838
|
+
var snackbarActionVariants = classVarianceAuthority.cva([
|
|
6839
|
+
// Layout
|
|
6840
|
+
"relative inline-flex items-center justify-center shrink-0",
|
|
6841
|
+
"h-9 px-3",
|
|
6842
|
+
"rounded-full cursor-pointer select-none",
|
|
6843
|
+
// Typography (MD3 text button: label-large)
|
|
6844
|
+
"text-label-large",
|
|
6845
|
+
"text-inverse-primary",
|
|
6846
|
+
// Effects transition (color)
|
|
6847
|
+
"transition-colors duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
6848
|
+
// Disabled
|
|
6849
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none",
|
|
6850
|
+
"data-[disabled]:text-on-surface/38"
|
|
6851
|
+
]);
|
|
6852
|
+
var snackbarActionStateLayerVariants = classVarianceAuthority.cva([
|
|
6853
|
+
"absolute inset-0 rounded-[inherit] overflow-hidden pointer-events-none opacity-0",
|
|
6854
|
+
"bg-inverse-primary",
|
|
6855
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
6856
|
+
// Hover: 8%
|
|
6857
|
+
"group-data-[hovered]/snackbar-action:opacity-8",
|
|
6858
|
+
// Focus: 10%
|
|
6859
|
+
"group-data-[focus-visible]/snackbar-action:opacity-10",
|
|
6860
|
+
// Pressed: 10%, doubled selector wins over hover
|
|
6861
|
+
"group-data-[pressed]/snackbar-action:group-data-[pressed]/snackbar-action:opacity-10",
|
|
6862
|
+
// No state layer when disabled
|
|
6863
|
+
"group-data-[disabled]/snackbar-action:hidden"
|
|
6864
|
+
]);
|
|
6865
|
+
var snackbarActionFocusRingVariants = classVarianceAuthority.cva([
|
|
6866
|
+
"pointer-events-none absolute inset-[-3px] rounded-full",
|
|
6867
|
+
"outline outline-2 outline-offset-0 outline-inverse-primary",
|
|
6868
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
6869
|
+
"opacity-0",
|
|
6870
|
+
"group-data-[focus-visible]/snackbar-action:opacity-100"
|
|
6871
|
+
]);
|
|
6872
|
+
var snackbarCloseVariants = classVarianceAuthority.cva([
|
|
6873
|
+
// Layout
|
|
6874
|
+
"relative inline-flex items-center justify-center shrink-0",
|
|
6875
|
+
"size-8",
|
|
6876
|
+
"rounded-full cursor-pointer select-none",
|
|
6877
|
+
// Color
|
|
6878
|
+
"text-inverse-on-surface",
|
|
6879
|
+
// Effects transition (color)
|
|
6880
|
+
"transition-colors duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
6881
|
+
// Disabled
|
|
6882
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none",
|
|
6883
|
+
"data-[disabled]:text-on-surface/38"
|
|
6884
|
+
]);
|
|
6885
|
+
var snackbarCloseStateLayerVariants = classVarianceAuthority.cva([
|
|
6886
|
+
"absolute inset-0 rounded-[inherit] overflow-hidden pointer-events-none opacity-0",
|
|
6887
|
+
"bg-inverse-on-surface",
|
|
6888
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
6889
|
+
// Hover: 8%
|
|
6890
|
+
"group-data-[hovered]/snackbar-close:opacity-8",
|
|
6891
|
+
// Focus: 10%
|
|
6892
|
+
"group-data-[focus-visible]/snackbar-close:opacity-10",
|
|
6893
|
+
// Pressed: 10%, doubled selector wins over hover
|
|
6894
|
+
"group-data-[pressed]/snackbar-close:group-data-[pressed]/snackbar-close:opacity-10",
|
|
6895
|
+
// No state layer when disabled
|
|
6896
|
+
"group-data-[disabled]/snackbar-close:hidden"
|
|
6897
|
+
]);
|
|
6898
|
+
var snackbarCloseFocusRingVariants = classVarianceAuthority.cva([
|
|
6899
|
+
"pointer-events-none absolute inset-[-3px] rounded-full",
|
|
6900
|
+
"outline outline-2 outline-offset-0 outline-inverse-on-surface",
|
|
6901
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
6902
|
+
"opacity-0",
|
|
6903
|
+
"group-data-[focus-visible]/snackbar-close:opacity-100"
|
|
6904
|
+
]);
|
|
6905
|
+
var snackbarCloseIconVariants = classVarianceAuthority.cva([
|
|
6906
|
+
"relative z-10 inline-flex shrink-0 items-center justify-center",
|
|
6907
|
+
"size-6"
|
|
6908
|
+
]);
|
|
6682
6909
|
function CloseIcon() {
|
|
6683
6910
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6684
6911
|
"svg",
|
|
@@ -6693,6 +6920,52 @@ function CloseIcon() {
|
|
|
6693
6920
|
}
|
|
6694
6921
|
);
|
|
6695
6922
|
}
|
|
6923
|
+
function SnackbarActionButton({ label, onAction }) {
|
|
6924
|
+
const ref = React.useRef(null);
|
|
6925
|
+
const { buttonProps, isPressed } = reactAria.useButton({ onPress: onAction }, ref);
|
|
6926
|
+
const { isHovered, hoverProps } = reactAria.useHover({});
|
|
6927
|
+
const { isFocusVisible, focusProps } = reactAria.useFocusRing();
|
|
6928
|
+
const { onMouseDown, ripples } = useRipple();
|
|
6929
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6930
|
+
"button",
|
|
6931
|
+
{
|
|
6932
|
+
type: "button",
|
|
6933
|
+
...reactAria.mergeProps(buttonProps, hoverProps, focusProps, { onMouseDown }),
|
|
6934
|
+
ref,
|
|
6935
|
+
className: cn(snackbarActionVariants(), "group/snackbar-action"),
|
|
6936
|
+
...getInteractionDataAttributes({ isHovered, isFocusVisible, isPressed }),
|
|
6937
|
+
children: [
|
|
6938
|
+
ripples,
|
|
6939
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarActionStateLayerVariants(), "aria-hidden": "true" }),
|
|
6940
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarActionFocusRingVariants(), "aria-hidden": "true" }),
|
|
6941
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative z-10", children: label })
|
|
6942
|
+
]
|
|
6943
|
+
}
|
|
6944
|
+
);
|
|
6945
|
+
}
|
|
6946
|
+
function SnackbarCloseButton({ onPress }) {
|
|
6947
|
+
const ref = React.useRef(null);
|
|
6948
|
+
const { buttonProps, isPressed } = reactAria.useButton({ onPress, "aria-label": "Close" }, ref);
|
|
6949
|
+
const { isHovered, hoverProps } = reactAria.useHover({});
|
|
6950
|
+
const { isFocusVisible, focusProps } = reactAria.useFocusRing();
|
|
6951
|
+
const { onMouseDown, ripples } = useRipple();
|
|
6952
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6953
|
+
"button",
|
|
6954
|
+
{
|
|
6955
|
+
type: "button",
|
|
6956
|
+
...reactAria.mergeProps(buttonProps, hoverProps, focusProps, { onMouseDown }),
|
|
6957
|
+
ref,
|
|
6958
|
+
className: cn(snackbarCloseVariants(), "group/snackbar-close"),
|
|
6959
|
+
...getInteractionDataAttributes({ isHovered, isFocusVisible, isPressed }),
|
|
6960
|
+
children: [
|
|
6961
|
+
ripples,
|
|
6962
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarCloseStateLayerVariants(), "aria-hidden": "true" }),
|
|
6963
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarCloseFocusRingVariants(), "aria-hidden": "true" }),
|
|
6964
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarCloseIconVariants(), "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {}) })
|
|
6965
|
+
]
|
|
6966
|
+
}
|
|
6967
|
+
);
|
|
6968
|
+
}
|
|
6696
6969
|
var Snackbar = React.forwardRef(function Snackbar2({
|
|
6697
6970
|
message,
|
|
6698
6971
|
supportingText,
|
|
@@ -6705,6 +6978,7 @@ var Snackbar = React.forwardRef(function Snackbar2({
|
|
|
6705
6978
|
className
|
|
6706
6979
|
}, ref) {
|
|
6707
6980
|
const isTwoLine = Boolean(supportingText);
|
|
6981
|
+
const reducedMotion = useReducedMotion();
|
|
6708
6982
|
const baseClassName = cn(snackbarBaseVariants({ twoLine: isTwoLine }), className);
|
|
6709
6983
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6710
6984
|
SnackbarHeadless,
|
|
@@ -6719,31 +6993,22 @@ var Snackbar = React.forwardRef(function Snackbar2({
|
|
|
6719
6993
|
position,
|
|
6720
6994
|
...onClose !== void 0 && { onClose },
|
|
6721
6995
|
className: baseClassName,
|
|
6722
|
-
getAnimationClassName: (state, pos) =>
|
|
6996
|
+
getAnimationClassName: (state, pos) => {
|
|
6997
|
+
if (reducedMotion) {
|
|
6998
|
+
return state === "visible" ? "opacity-100 duration-spring-standard-default-effects ease-spring-standard-default-effects" : "opacity-0";
|
|
6999
|
+
}
|
|
7000
|
+
return snackbarAnimationVariants({
|
|
7001
|
+
animationState: state,
|
|
7002
|
+
enterDirection: getEnterDirection(pos)
|
|
7003
|
+
});
|
|
7004
|
+
},
|
|
6723
7005
|
children: ({ onClose: triggerClose }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6724
7006
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: snackbarContentVariants(), children: [
|
|
6725
7007
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarMessageVariants(), children: message }),
|
|
6726
7008
|
supportingText && /* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarSupportingTextVariants(), children: supportingText })
|
|
6727
7009
|
] }),
|
|
6728
|
-
action && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6729
|
-
|
|
6730
|
-
{
|
|
6731
|
-
variant: "text",
|
|
6732
|
-
onPress: action.onAction,
|
|
6733
|
-
className: "text-inverse-primary hover:text-inverse-primary px-3",
|
|
6734
|
-
children: action.label
|
|
6735
|
-
}
|
|
6736
|
-
) }),
|
|
6737
|
-
showClose && /* @__PURE__ */ jsxRuntime.jsx("span", { className: snackbarCloseVariants(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6738
|
-
IconButton,
|
|
6739
|
-
{
|
|
6740
|
-
variant: "standard",
|
|
6741
|
-
"aria-label": "Close",
|
|
6742
|
-
onPress: triggerClose,
|
|
6743
|
-
className: "text-inverse-on-surface hover:text-inverse-on-surface",
|
|
6744
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {})
|
|
6745
|
-
}
|
|
6746
|
-
) })
|
|
7010
|
+
action && /* @__PURE__ */ jsxRuntime.jsx(SnackbarActionButton, { label: action.label, onAction: action.onAction }),
|
|
7011
|
+
showClose && /* @__PURE__ */ jsxRuntime.jsx(SnackbarCloseButton, { onPress: triggerClose })
|
|
6747
7012
|
] })
|
|
6748
7013
|
}
|
|
6749
7014
|
);
|