@tinybigui/react 0.5.0 → 0.7.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 +60 -40
- package/dist/index.cjs +531 -316
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +365 -124
- package/dist/index.d.ts +365 -124
- package/dist/index.js +527 -317
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1710,232 +1710,273 @@ var FABHeadless = React.forwardRef(
|
|
|
1710
1710
|
type,
|
|
1711
1711
|
"aria-label": ariaLabel,
|
|
1712
1712
|
title,
|
|
1713
|
-
...
|
|
1713
|
+
...restProps
|
|
1714
1714
|
}, forwardedRef) => {
|
|
1715
1715
|
const internalRef = React.useRef(null);
|
|
1716
1716
|
const ref = forwardedRef ?? internalRef;
|
|
1717
1717
|
const { buttonProps } = reactAria.useButton(
|
|
1718
1718
|
{
|
|
1719
|
-
...
|
|
1719
|
+
...restProps,
|
|
1720
1720
|
elementType: "button"
|
|
1721
1721
|
},
|
|
1722
1722
|
ref
|
|
1723
1723
|
);
|
|
1724
|
-
const
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1724
|
+
const {
|
|
1725
|
+
isDisabled: _isDisabled,
|
|
1726
|
+
onPress: _onPress,
|
|
1727
|
+
onPressStart: _onPressStart,
|
|
1728
|
+
onPressEnd: _onPressEnd,
|
|
1729
|
+
onPressChange: _onPressChange,
|
|
1730
|
+
onPressUp: _onPressUp,
|
|
1731
|
+
...htmlAttrs
|
|
1732
|
+
} = restProps;
|
|
1733
|
+
const mergedProps = utils.mergeProps(
|
|
1734
|
+
buttonProps,
|
|
1735
|
+
{
|
|
1736
|
+
tabIndex,
|
|
1737
|
+
className,
|
|
1738
|
+
onMouseDown,
|
|
1739
|
+
"aria-label": ariaLabel,
|
|
1740
|
+
...title !== void 0 && { title }
|
|
1741
|
+
},
|
|
1742
|
+
htmlAttrs
|
|
1743
|
+
);
|
|
1735
1744
|
return (
|
|
1736
|
-
// eslint-disable-next-line react/button-has-type
|
|
1737
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { ...mergedProps, ref, children })
|
|
1745
|
+
// eslint-disable-next-line react/button-has-type -- type is dynamically passed from props
|
|
1746
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { ...mergedProps, ref, type: type ?? "button", children })
|
|
1738
1747
|
);
|
|
1739
1748
|
}
|
|
1740
1749
|
);
|
|
1741
1750
|
FABHeadless.displayName = "FABHeadless";
|
|
1742
1751
|
var fabVariants = classVarianceAuthority.cva(
|
|
1743
1752
|
[
|
|
1744
|
-
//
|
|
1745
|
-
"relative inline-flex items-center justify-center cursor-pointer",
|
|
1746
|
-
"overflow-hidden",
|
|
1747
|
-
"transition-all duration-200",
|
|
1748
|
-
"focus-visible:outline-primary focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
1753
|
+
// Layout — NO overflow-hidden here (focus ring must extend outside)
|
|
1754
|
+
"relative inline-flex items-center justify-center cursor-pointer select-none",
|
|
1749
1755
|
"shrink-0",
|
|
1750
|
-
//
|
|
1751
|
-
|
|
1752
|
-
"
|
|
1753
|
-
|
|
1754
|
-
"
|
|
1755
|
-
"
|
|
1756
|
-
"active:before:opacity-12",
|
|
1757
|
-
// Elevation (floating appearance)
|
|
1758
|
-
"shadow-elevation-3",
|
|
1759
|
-
// Default elevation
|
|
1760
|
-
"hover:shadow-elevation-4"
|
|
1761
|
-
// Hover elevation
|
|
1756
|
+
// Effects transition: color / bg / shadow — standard spring, no overshoot
|
|
1757
|
+
"transition-[color,background-color,box-shadow]",
|
|
1758
|
+
"duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
1759
|
+
// Disabled — self-targeting data-[x]: selectors (not group-data — these target the root itself)
|
|
1760
|
+
"data-[disabled]:bg-on-surface/12 data-[disabled]:text-on-surface/38",
|
|
1761
|
+
"data-[disabled]:shadow-none data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none"
|
|
1762
1762
|
],
|
|
1763
1763
|
{
|
|
1764
1764
|
variants: {
|
|
1765
1765
|
/**
|
|
1766
|
-
* FAB size
|
|
1766
|
+
* FAB size — controls container dimensions, corner radius, and icon slot size.
|
|
1767
1767
|
*/
|
|
1768
1768
|
size: {
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
"rounded-xl",
|
|
1775
|
-
// 12px corner radius (not fully rounded!)
|
|
1776
|
-
"m-1"
|
|
1777
|
-
// 4px margin for 48×48px touch target
|
|
1778
|
-
],
|
|
1779
|
-
medium: [
|
|
1769
|
+
/**
|
|
1770
|
+
* fab (default) — 56×56dp, 16dp corner radius.
|
|
1771
|
+
* MD3 standard FAB.
|
|
1772
|
+
*/
|
|
1773
|
+
fab: [
|
|
1780
1774
|
"h-14 w-14",
|
|
1781
|
-
//
|
|
1782
|
-
"p-4",
|
|
1783
|
-
// 16px padding for 24px icon
|
|
1775
|
+
// 56dp
|
|
1784
1776
|
"rounded-2xl"
|
|
1785
|
-
//
|
|
1777
|
+
// 16dp corner
|
|
1778
|
+
],
|
|
1779
|
+
/**
|
|
1780
|
+
* medium — 80×80dp, 20dp corner radius.
|
|
1781
|
+
* M3 Expressive Medium FAB. Previously this value mapped to 56dp;
|
|
1782
|
+
* it is now remapped to the Expressive 80dp Medium FAB.
|
|
1783
|
+
*/
|
|
1784
|
+
medium: [
|
|
1785
|
+
"h-20 w-20",
|
|
1786
|
+
// 80dp
|
|
1787
|
+
"rounded-[20px]"
|
|
1788
|
+
// 20dp corner (large-increased shape token)
|
|
1786
1789
|
],
|
|
1790
|
+
/**
|
|
1791
|
+
* large — 96×96dp, 28dp corner radius.
|
|
1792
|
+
*/
|
|
1787
1793
|
large: [
|
|
1788
1794
|
"h-24 w-24",
|
|
1789
|
-
//
|
|
1790
|
-
"p-[30px]",
|
|
1791
|
-
// 30px padding for 36px icon
|
|
1795
|
+
// 96dp
|
|
1792
1796
|
"rounded-[28px]"
|
|
1793
|
-
//
|
|
1797
|
+
// 28dp corner
|
|
1794
1798
|
],
|
|
1799
|
+
/**
|
|
1800
|
+
* extended — 56dp height, variable width, 16dp corner.
|
|
1801
|
+
* Icon + text label side by side.
|
|
1802
|
+
* Padding: 16dp leading (icon side), 20dp trailing (text side).
|
|
1803
|
+
* Gap: 12dp between icon and label (MD3 spec).
|
|
1804
|
+
*/
|
|
1795
1805
|
extended: [
|
|
1796
1806
|
"h-14",
|
|
1797
|
-
//
|
|
1807
|
+
// 56dp height
|
|
1798
1808
|
"rounded-2xl",
|
|
1799
|
-
//
|
|
1809
|
+
// 16dp corner
|
|
1800
1810
|
"pl-4 pr-5",
|
|
1801
|
-
//
|
|
1802
|
-
"gap-
|
|
1803
|
-
//
|
|
1811
|
+
// 16dp leading, 20dp trailing
|
|
1812
|
+
"gap-3"
|
|
1813
|
+
// 12dp gap between icon and label
|
|
1814
|
+
],
|
|
1815
|
+
/**
|
|
1816
|
+
* @deprecated Use `fab` (56dp) instead.
|
|
1817
|
+
* small — 40×40dp, 12dp corner radius. No longer recommended in M3 Expressive.
|
|
1818
|
+
* Kept functional for backward compatibility.
|
|
1819
|
+
*/
|
|
1820
|
+
small: [
|
|
1821
|
+
"h-10 w-10",
|
|
1822
|
+
// 40dp
|
|
1823
|
+
"rounded-xl",
|
|
1824
|
+
// 12dp corner
|
|
1825
|
+
"m-1"
|
|
1826
|
+
// 4dp margin for 48×48dp minimum touch target
|
|
1804
1827
|
]
|
|
1805
1828
|
},
|
|
1806
1829
|
/**
|
|
1807
|
-
*
|
|
1830
|
+
* FAB color — controls container + on-color.
|
|
1831
|
+
* State-layer color in fabStateLayerVariants must match icon/on-color.
|
|
1808
1832
|
*/
|
|
1809
1833
|
color: {
|
|
1810
|
-
primary:
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1834
|
+
"primary-container": [
|
|
1835
|
+
"bg-primary-container text-on-primary-container",
|
|
1836
|
+
// Elevation base=3, hover=4 (state driven), disabled handled by root data-[disabled]
|
|
1837
|
+
"shadow-elevation-3",
|
|
1838
|
+
"group-data-[hovered]/fab:shadow-elevation-4",
|
|
1839
|
+
// Focus / pressed: return to elevation-3
|
|
1840
|
+
// Doubled attribute selector gives higher specificity than single hover selector
|
|
1841
|
+
"group-data-[focus-visible]/fab:shadow-elevation-3",
|
|
1842
|
+
"group-data-[pressed]/fab:group-data-[pressed]/fab:shadow-elevation-3"
|
|
1843
|
+
],
|
|
1844
|
+
"secondary-container": [
|
|
1845
|
+
"bg-secondary-container text-on-secondary-container",
|
|
1846
|
+
"shadow-elevation-3",
|
|
1847
|
+
"group-data-[hovered]/fab:shadow-elevation-4",
|
|
1848
|
+
"group-data-[focus-visible]/fab:shadow-elevation-3",
|
|
1849
|
+
"group-data-[pressed]/fab:group-data-[pressed]/fab:shadow-elevation-3"
|
|
1850
|
+
],
|
|
1851
|
+
"tertiary-container": [
|
|
1852
|
+
"bg-tertiary-container text-on-tertiary-container",
|
|
1853
|
+
"shadow-elevation-3",
|
|
1854
|
+
"group-data-[hovered]/fab:shadow-elevation-4",
|
|
1855
|
+
"group-data-[focus-visible]/fab:shadow-elevation-3",
|
|
1856
|
+
"group-data-[pressed]/fab:group-data-[pressed]/fab:shadow-elevation-3"
|
|
1857
|
+
],
|
|
1858
|
+
primary: [
|
|
1859
|
+
"bg-primary text-on-primary",
|
|
1860
|
+
"shadow-elevation-3",
|
|
1861
|
+
"group-data-[hovered]/fab:shadow-elevation-4",
|
|
1862
|
+
"group-data-[focus-visible]/fab:shadow-elevation-3",
|
|
1863
|
+
"group-data-[pressed]/fab:group-data-[pressed]/fab:shadow-elevation-3"
|
|
1864
|
+
],
|
|
1865
|
+
secondary: [
|
|
1866
|
+
"bg-secondary text-on-secondary",
|
|
1867
|
+
"shadow-elevation-3",
|
|
1868
|
+
"group-data-[hovered]/fab:shadow-elevation-4",
|
|
1869
|
+
"group-data-[focus-visible]/fab:shadow-elevation-3",
|
|
1870
|
+
"group-data-[pressed]/fab:group-data-[pressed]/fab:shadow-elevation-3"
|
|
1871
|
+
],
|
|
1872
|
+
tertiary: [
|
|
1873
|
+
"bg-tertiary text-on-tertiary",
|
|
1874
|
+
"shadow-elevation-3",
|
|
1875
|
+
"group-data-[hovered]/fab:shadow-elevation-4",
|
|
1876
|
+
"group-data-[focus-visible]/fab:shadow-elevation-3",
|
|
1877
|
+
"group-data-[pressed]/fab:group-data-[pressed]/fab:shadow-elevation-3"
|
|
1878
|
+
],
|
|
1879
|
+
/** @deprecated Use `primary-container` instead. */
|
|
1880
|
+
surface: [
|
|
1881
|
+
"bg-surface-container-high text-primary",
|
|
1882
|
+
"shadow-elevation-3",
|
|
1883
|
+
"group-data-[hovered]/fab:shadow-elevation-4",
|
|
1884
|
+
"group-data-[focus-visible]/fab:shadow-elevation-3",
|
|
1885
|
+
"group-data-[pressed]/fab:group-data-[pressed]/fab:shadow-elevation-3"
|
|
1886
|
+
]
|
|
1821
1887
|
}
|
|
1822
1888
|
},
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
{
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
{
|
|
1887
|
-
color: "tertiary",
|
|
1888
|
-
size: "large",
|
|
1889
|
-
className: "bg-tertiary-container text-on-tertiary-container"
|
|
1890
|
-
},
|
|
1891
|
-
{
|
|
1892
|
-
color: "tertiary",
|
|
1893
|
-
size: "extended",
|
|
1894
|
-
className: "bg-tertiary-container text-on-tertiary-container"
|
|
1895
|
-
},
|
|
1896
|
-
// ====================
|
|
1897
|
-
// SURFACE COLOR
|
|
1898
|
-
// ====================
|
|
1899
|
-
{
|
|
1900
|
-
color: "surface",
|
|
1901
|
-
size: "small",
|
|
1902
|
-
className: "bg-surface text-primary"
|
|
1903
|
-
},
|
|
1904
|
-
{
|
|
1905
|
-
color: "surface",
|
|
1906
|
-
size: "medium",
|
|
1907
|
-
className: "bg-surface text-primary"
|
|
1908
|
-
},
|
|
1909
|
-
{
|
|
1910
|
-
color: "surface",
|
|
1911
|
-
size: "large",
|
|
1912
|
-
className: "bg-surface text-primary"
|
|
1889
|
+
defaultVariants: {
|
|
1890
|
+
size: "fab",
|
|
1891
|
+
color: "primary-container"
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
);
|
|
1895
|
+
var fabStateLayerVariants = classVarianceAuthority.cva(
|
|
1896
|
+
[
|
|
1897
|
+
"absolute inset-0 rounded-[inherit] overflow-hidden pointer-events-none opacity-0",
|
|
1898
|
+
// Effects transition — opacity must not overshoot
|
|
1899
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
1900
|
+
// Hover: 8%
|
|
1901
|
+
"group-data-[hovered]/fab:opacity-8",
|
|
1902
|
+
// Focus: 10%
|
|
1903
|
+
"group-data-[focus-visible]/fab:opacity-10",
|
|
1904
|
+
// Pressed: 10% — doubled selector wins over hover's 8%
|
|
1905
|
+
"group-data-[pressed]/fab:group-data-[pressed]/fab:opacity-10",
|
|
1906
|
+
// No state layer when disabled
|
|
1907
|
+
"group-data-[disabled]/fab:hidden"
|
|
1908
|
+
],
|
|
1909
|
+
{
|
|
1910
|
+
variants: {
|
|
1911
|
+
color: {
|
|
1912
|
+
"primary-container": "bg-on-primary-container",
|
|
1913
|
+
"secondary-container": "bg-on-secondary-container",
|
|
1914
|
+
"tertiary-container": "bg-on-tertiary-container",
|
|
1915
|
+
primary: "bg-on-primary",
|
|
1916
|
+
secondary: "bg-on-secondary",
|
|
1917
|
+
tertiary: "bg-on-tertiary",
|
|
1918
|
+
/** @deprecated */
|
|
1919
|
+
surface: "bg-primary"
|
|
1920
|
+
}
|
|
1921
|
+
},
|
|
1922
|
+
defaultVariants: { color: "primary-container" }
|
|
1923
|
+
}
|
|
1924
|
+
);
|
|
1925
|
+
var fabFocusRingVariants = classVarianceAuthority.cva([
|
|
1926
|
+
"pointer-events-none absolute inset-[-3px] rounded-[inherit]",
|
|
1927
|
+
"outline outline-2 outline-offset-0 outline-secondary",
|
|
1928
|
+
// Effects transition — opacity change must not overshoot
|
|
1929
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
1930
|
+
"opacity-0",
|
|
1931
|
+
"group-data-[focus-visible]/fab:opacity-100"
|
|
1932
|
+
]);
|
|
1933
|
+
var fabIconVariants = classVarianceAuthority.cva(
|
|
1934
|
+
[
|
|
1935
|
+
"relative z-10 inline-flex shrink-0 items-center justify-center",
|
|
1936
|
+
// Color transition uses effects token (no spatial overshoot on color)
|
|
1937
|
+
"transition-colors duration-spring-standard-fast-effects ease-spring-standard-fast-effects"
|
|
1938
|
+
],
|
|
1939
|
+
{
|
|
1940
|
+
variants: {
|
|
1941
|
+
size: {
|
|
1942
|
+
fab: "size-6",
|
|
1943
|
+
// 24dp
|
|
1944
|
+
medium: "size-7",
|
|
1945
|
+
// 28dp
|
|
1946
|
+
large: "size-9",
|
|
1947
|
+
// 36dp
|
|
1948
|
+
extended: "size-6",
|
|
1949
|
+
// 24dp
|
|
1950
|
+
small: "size-6"
|
|
1951
|
+
// 24dp
|
|
1913
1952
|
},
|
|
1914
|
-
{
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
className: "bg-surface text-primary"
|
|
1953
|
+
hidden: {
|
|
1954
|
+
true: "invisible",
|
|
1955
|
+
false: ""
|
|
1918
1956
|
}
|
|
1919
|
-
|
|
1920
|
-
/**
|
|
1921
|
-
* Default variants
|
|
1922
|
-
*/
|
|
1957
|
+
},
|
|
1923
1958
|
defaultVariants: {
|
|
1924
|
-
size: "
|
|
1925
|
-
|
|
1926
|
-
isDisabled: false
|
|
1959
|
+
size: "fab",
|
|
1960
|
+
hidden: false
|
|
1927
1961
|
}
|
|
1928
1962
|
}
|
|
1929
1963
|
);
|
|
1964
|
+
var fabLabelVariants = classVarianceAuthority.cva([
|
|
1965
|
+
"relative z-10 inline-flex items-center",
|
|
1966
|
+
"text-label-large tracking-[0.1px]"
|
|
1967
|
+
]);
|
|
1930
1968
|
var Spinner2 = () => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1931
1969
|
"svg",
|
|
1932
1970
|
{
|
|
1933
1971
|
role: "progressbar",
|
|
1934
1972
|
"aria-label": "Loading",
|
|
1935
|
-
className: "
|
|
1973
|
+
className: "relative z-10 animate-spin",
|
|
1936
1974
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1937
1975
|
fill: "none",
|
|
1938
1976
|
viewBox: "0 0 24 24",
|
|
1977
|
+
width: "1em",
|
|
1978
|
+
height: "1em",
|
|
1979
|
+
style: { fontSize: "inherit" },
|
|
1939
1980
|
children: [
|
|
1940
1981
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
1941
1982
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1951,80 +1992,98 @@ var Spinner2 = () => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
|
1951
1992
|
);
|
|
1952
1993
|
var FAB = React.forwardRef(
|
|
1953
1994
|
({
|
|
1954
|
-
// Variant props
|
|
1955
|
-
size = "
|
|
1956
|
-
color = "primary",
|
|
1957
|
-
//
|
|
1995
|
+
// Variant props
|
|
1996
|
+
size = "fab",
|
|
1997
|
+
color = "primary-container",
|
|
1998
|
+
// Content
|
|
1958
1999
|
icon,
|
|
1959
2000
|
children,
|
|
1960
|
-
|
|
2001
|
+
// State
|
|
1961
2002
|
loading = false,
|
|
1962
2003
|
disableRipple = false,
|
|
2004
|
+
isDisabled = false,
|
|
2005
|
+
// Styling
|
|
1963
2006
|
className,
|
|
1964
|
-
//
|
|
1965
|
-
|
|
1966
|
-
onPress,
|
|
1967
|
-
onMouseDown,
|
|
2007
|
+
// Accessibility
|
|
2008
|
+
"aria-label": ariaLabel,
|
|
1968
2009
|
title,
|
|
2010
|
+
// Passthrough — forwarded to FABHeadless
|
|
2011
|
+
tabIndex = 0,
|
|
2012
|
+
type = "button",
|
|
2013
|
+
// Passed through to FABHeadless → useButton
|
|
1969
2014
|
...props
|
|
1970
2015
|
}, ref) => {
|
|
2016
|
+
const fabRef = React.useRef(null);
|
|
2017
|
+
const resolvedRef = ref ?? fabRef;
|
|
2018
|
+
const isFABDisabled = isDisabled || loading;
|
|
2019
|
+
const [isPressed, setIsPressed] = React.useState(false);
|
|
2020
|
+
const handlePressStart = React.useCallback(() => setIsPressed(true), []);
|
|
2021
|
+
const handlePressEnd = React.useCallback(() => setIsPressed(false), []);
|
|
2022
|
+
const { isHovered, hoverProps } = reactAria.useHover({ isDisabled: isFABDisabled });
|
|
2023
|
+
const { isFocusVisible, focusProps } = reactAria.useFocusRing();
|
|
2024
|
+
const { onMouseDown: handleRipple, ripples } = useRipple({
|
|
2025
|
+
disabled: isFABDisabled || disableRipple
|
|
2026
|
+
});
|
|
1971
2027
|
if (process.env.NODE_ENV === "development") {
|
|
1972
2028
|
if (!icon) {
|
|
1973
|
-
console.warn("[FAB] FAB must have an icon. Please provide the icon prop.");
|
|
2029
|
+
console.warn("[FAB] FAB must have an icon. Please provide the `icon` prop.");
|
|
1974
2030
|
}
|
|
1975
2031
|
if (size === "extended" && !children) {
|
|
1976
|
-
console.warn("[FAB] Extended FAB requires text label as children
|
|
2032
|
+
console.warn("[FAB] Extended FAB requires a text label as `children`.");
|
|
1977
2033
|
}
|
|
1978
2034
|
if (size !== "extended" && children) {
|
|
1979
2035
|
console.warn(
|
|
1980
|
-
"[FAB]
|
|
2036
|
+
"[FAB] `children` (text label) is only rendered for `size='extended'`. For icon-only FABs, use the `icon` prop only."
|
|
2037
|
+
);
|
|
2038
|
+
}
|
|
2039
|
+
if (size === "small") {
|
|
2040
|
+
console.warn(
|
|
2041
|
+
"[FAB] `size='small'` is deprecated in M3 Expressive. Use `size='fab'` (56dp) instead."
|
|
2042
|
+
);
|
|
2043
|
+
}
|
|
2044
|
+
if (color === "surface") {
|
|
2045
|
+
console.warn(
|
|
2046
|
+
"[FAB] `color='surface'` is deprecated in M3 Expressive. Use `color='primary-container'` instead."
|
|
1981
2047
|
);
|
|
1982
2048
|
}
|
|
1983
2049
|
}
|
|
1984
|
-
const isDisabled = propIsDisabled || loading;
|
|
1985
|
-
const { onMouseDown: handleRipple, ripples } = useRipple({
|
|
1986
|
-
disabled: isDisabled || disableRipple
|
|
1987
|
-
});
|
|
1988
|
-
const mergedOnMouseDown = (e) => {
|
|
1989
|
-
onMouseDown?.(e);
|
|
1990
|
-
handleRipple(e);
|
|
1991
|
-
};
|
|
1992
|
-
const mergedPropsValue = utils.mergeProps(props, {
|
|
1993
|
-
...onPress && { onPress },
|
|
1994
|
-
onMouseDown: mergedOnMouseDown,
|
|
1995
|
-
isDisabled
|
|
1996
|
-
});
|
|
1997
2050
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1998
2051
|
FABHeadless,
|
|
1999
2052
|
{
|
|
2000
|
-
|
|
2053
|
+
...reactAria.mergeProps(
|
|
2054
|
+
hoverProps,
|
|
2055
|
+
focusProps,
|
|
2056
|
+
{ onPressStart: handlePressStart, onPressEnd: handlePressEnd },
|
|
2057
|
+
props
|
|
2058
|
+
),
|
|
2059
|
+
ref: resolvedRef,
|
|
2060
|
+
type,
|
|
2061
|
+
isDisabled: isFABDisabled,
|
|
2062
|
+
tabIndex,
|
|
2063
|
+
onMouseDown: handleRipple,
|
|
2064
|
+
"aria-label": ariaLabel,
|
|
2065
|
+
...title !== void 0 && { title },
|
|
2066
|
+
...getInteractionDataAttributes({
|
|
2067
|
+
isHovered,
|
|
2068
|
+
isFocusVisible,
|
|
2069
|
+
isPressed,
|
|
2070
|
+
isDisabled: isFABDisabled
|
|
2071
|
+
}),
|
|
2072
|
+
"data-with-icon": icon ? "" : void 0,
|
|
2073
|
+
"data-loading": loading ? "" : void 0,
|
|
2001
2074
|
className: cn(
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
"
|
|
2005
|
-
"focus-visible:outline-primary focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
2006
|
-
"shrink-0",
|
|
2007
|
-
// State layers (hover, focus, active)
|
|
2008
|
-
"before:absolute before:inset-0 before:rounded-[inherit] before:transition-opacity before:duration-200",
|
|
2009
|
-
"before:bg-current before:opacity-0",
|
|
2010
|
-
"hover:before:opacity-8",
|
|
2011
|
-
"focus-visible:before:opacity-12",
|
|
2012
|
-
"active:before:opacity-12",
|
|
2013
|
-
// Elevation
|
|
2014
|
-
"shadow-elevation-3 hover:shadow-elevation-4",
|
|
2015
|
-
// CVA variants
|
|
2016
|
-
fabVariants({ size, color, isDisabled }),
|
|
2017
|
-
// User custom classes
|
|
2075
|
+
fabVariants({ size, color }),
|
|
2076
|
+
// group/fab: enables group-data-[x]/fab child selectors in all slots
|
|
2077
|
+
"group/fab",
|
|
2018
2078
|
className
|
|
2019
2079
|
),
|
|
2020
|
-
"aria-label": ariaLabel,
|
|
2021
|
-
...title && { title },
|
|
2022
|
-
...mergedPropsValue,
|
|
2023
2080
|
children: [
|
|
2024
2081
|
ripples,
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2082
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(fabStateLayerVariants({ color })), "aria-hidden": "true" }),
|
|
2083
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(fabFocusRingVariants()), "aria-hidden": "true" }),
|
|
2084
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(fabIconVariants({ size, hidden: loading })), children: icon }),
|
|
2085
|
+
loading && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(fabIconVariants({ size })), children: /* @__PURE__ */ jsxRuntime.jsx(Spinner2, {}) }),
|
|
2086
|
+
size === "extended" && children && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(fabLabelVariants()), children })
|
|
2028
2087
|
]
|
|
2029
2088
|
}
|
|
2030
2089
|
);
|
|
@@ -9276,13 +9335,30 @@ var FABMenuHeadless = React.forwardRef(
|
|
|
9276
9335
|
}
|
|
9277
9336
|
);
|
|
9278
9337
|
FABMenuHeadless.displayName = "FABMenuHeadless";
|
|
9279
|
-
var fabMenuVariants = classVarianceAuthority.cva(["relative", "inline-flex"
|
|
9338
|
+
var fabMenuVariants = classVarianceAuthority.cva(["relative", "inline-flex"]);
|
|
9339
|
+
var fabMenuListVariants = classVarianceAuthority.cva(["absolute", "z-10", "flex", "gap-3"], {
|
|
9280
9340
|
variants: {
|
|
9281
9341
|
direction: {
|
|
9282
|
-
up: ["flex-col-reverse", "
|
|
9283
|
-
down: ["flex-col", "
|
|
9284
|
-
left: [
|
|
9285
|
-
|
|
9342
|
+
up: ["bottom-full", "mb-3", "end-0", "flex-col-reverse", "items-end", "origin-bottom"],
|
|
9343
|
+
down: ["top-full", "mt-3", "end-0", "flex-col", "items-end", "origin-top"],
|
|
9344
|
+
left: [
|
|
9345
|
+
"end-full",
|
|
9346
|
+
"me-3",
|
|
9347
|
+
"top-1/2",
|
|
9348
|
+
"-translate-y-1/2",
|
|
9349
|
+
"flex-row-reverse",
|
|
9350
|
+
"items-center",
|
|
9351
|
+
"origin-right"
|
|
9352
|
+
],
|
|
9353
|
+
right: [
|
|
9354
|
+
"start-full",
|
|
9355
|
+
"ms-3",
|
|
9356
|
+
"top-1/2",
|
|
9357
|
+
"-translate-y-1/2",
|
|
9358
|
+
"flex-row",
|
|
9359
|
+
"items-center",
|
|
9360
|
+
"origin-left"
|
|
9361
|
+
]
|
|
9286
9362
|
}
|
|
9287
9363
|
},
|
|
9288
9364
|
defaultVariants: {
|
|
@@ -9290,19 +9366,129 @@ var fabMenuVariants = classVarianceAuthority.cva(["relative", "inline-flex", "it
|
|
|
9290
9366
|
}
|
|
9291
9367
|
});
|
|
9292
9368
|
var fabMenuItemVariants = classVarianceAuthority.cva(
|
|
9293
|
-
[
|
|
9369
|
+
[
|
|
9370
|
+
// Layout — full-rounded pill, NO overflow-hidden (focus ring extends outside)
|
|
9371
|
+
"relative inline-flex items-center cursor-pointer select-none",
|
|
9372
|
+
"rounded-full",
|
|
9373
|
+
"h-14 pl-4 pr-5 gap-3",
|
|
9374
|
+
// 56dp height, 16dp leading, 20dp trailing, 12dp gap
|
|
9375
|
+
// Effects transition for color/bg/shadow
|
|
9376
|
+
"transition-[color,background-color,box-shadow]",
|
|
9377
|
+
"duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
9378
|
+
// Disabled — self-targeting data-[x]: selectors
|
|
9379
|
+
"data-[disabled]:bg-on-surface/12 data-[disabled]:text-on-surface/38",
|
|
9380
|
+
"data-[disabled]:shadow-none data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none"
|
|
9381
|
+
],
|
|
9294
9382
|
{
|
|
9295
9383
|
variants: {
|
|
9296
|
-
|
|
9297
|
-
|
|
9298
|
-
|
|
9384
|
+
/**
|
|
9385
|
+
* Color role — controls container background, text color, and elevation.
|
|
9386
|
+
* State-layer color must equal the on-color (see fabMenuItemStateLayerVariants).
|
|
9387
|
+
*
|
|
9388
|
+
* Elevation per state:
|
|
9389
|
+
* base → elevation-3
|
|
9390
|
+
* hover → elevation-4 (group-data-[hovered]/fab-menu-item)
|
|
9391
|
+
* focus → elevation-3 (doubled selector wins over hover)
|
|
9392
|
+
* pressed→ elevation-3 (doubled selector wins over hover)
|
|
9393
|
+
* disabled → shadow-none (self-targeting data-[disabled])
|
|
9394
|
+
*/
|
|
9395
|
+
color: {
|
|
9396
|
+
"primary-container": [
|
|
9397
|
+
"bg-primary-container text-on-primary-container",
|
|
9398
|
+
"shadow-elevation-3",
|
|
9399
|
+
"group-data-[hovered]/fab-menu-item:shadow-elevation-4",
|
|
9400
|
+
"group-data-[focus-visible]/fab-menu-item:shadow-elevation-3",
|
|
9401
|
+
"group-data-[pressed]/fab-menu-item:group-data-[pressed]/fab-menu-item:shadow-elevation-3"
|
|
9402
|
+
],
|
|
9403
|
+
"secondary-container": [
|
|
9404
|
+
"bg-secondary-container text-on-secondary-container",
|
|
9405
|
+
"shadow-elevation-3",
|
|
9406
|
+
"group-data-[hovered]/fab-menu-item:shadow-elevation-4",
|
|
9407
|
+
"group-data-[focus-visible]/fab-menu-item:shadow-elevation-3",
|
|
9408
|
+
"group-data-[pressed]/fab-menu-item:group-data-[pressed]/fab-menu-item:shadow-elevation-3"
|
|
9409
|
+
],
|
|
9410
|
+
"tertiary-container": [
|
|
9411
|
+
"bg-tertiary-container text-on-tertiary-container",
|
|
9412
|
+
"shadow-elevation-3",
|
|
9413
|
+
"group-data-[hovered]/fab-menu-item:shadow-elevation-4",
|
|
9414
|
+
"group-data-[focus-visible]/fab-menu-item:shadow-elevation-3",
|
|
9415
|
+
"group-data-[pressed]/fab-menu-item:group-data-[pressed]/fab-menu-item:shadow-elevation-3"
|
|
9416
|
+
],
|
|
9417
|
+
primary: [
|
|
9418
|
+
"bg-primary text-on-primary",
|
|
9419
|
+
"shadow-elevation-3",
|
|
9420
|
+
"group-data-[hovered]/fab-menu-item:shadow-elevation-4",
|
|
9421
|
+
"group-data-[focus-visible]/fab-menu-item:shadow-elevation-3",
|
|
9422
|
+
"group-data-[pressed]/fab-menu-item:group-data-[pressed]/fab-menu-item:shadow-elevation-3"
|
|
9423
|
+
],
|
|
9424
|
+
secondary: [
|
|
9425
|
+
"bg-secondary text-on-secondary",
|
|
9426
|
+
"shadow-elevation-3",
|
|
9427
|
+
"group-data-[hovered]/fab-menu-item:shadow-elevation-4",
|
|
9428
|
+
"group-data-[focus-visible]/fab-menu-item:shadow-elevation-3",
|
|
9429
|
+
"group-data-[pressed]/fab-menu-item:group-data-[pressed]/fab-menu-item:shadow-elevation-3"
|
|
9430
|
+
],
|
|
9431
|
+
tertiary: [
|
|
9432
|
+
"bg-tertiary text-on-tertiary",
|
|
9433
|
+
"shadow-elevation-3",
|
|
9434
|
+
"group-data-[hovered]/fab-menu-item:shadow-elevation-4",
|
|
9435
|
+
"group-data-[focus-visible]/fab-menu-item:shadow-elevation-3",
|
|
9436
|
+
"group-data-[pressed]/fab-menu-item:group-data-[pressed]/fab-menu-item:shadow-elevation-3"
|
|
9437
|
+
]
|
|
9299
9438
|
}
|
|
9300
9439
|
},
|
|
9301
9440
|
defaultVariants: {
|
|
9302
|
-
|
|
9441
|
+
color: "primary-container"
|
|
9303
9442
|
}
|
|
9304
9443
|
}
|
|
9305
9444
|
);
|
|
9445
|
+
var fabMenuItemStateLayerVariants = classVarianceAuthority.cva(
|
|
9446
|
+
[
|
|
9447
|
+
"absolute inset-0 rounded-[inherit] overflow-hidden pointer-events-none opacity-0",
|
|
9448
|
+
// Effects transition — opacity must not overshoot
|
|
9449
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
9450
|
+
// Hover: 8%
|
|
9451
|
+
"group-data-[hovered]/fab-menu-item:opacity-8",
|
|
9452
|
+
// Focus: 10%
|
|
9453
|
+
"group-data-[focus-visible]/fab-menu-item:opacity-10",
|
|
9454
|
+
// Pressed: 10% — doubled selector wins over hover's 8%
|
|
9455
|
+
"group-data-[pressed]/fab-menu-item:group-data-[pressed]/fab-menu-item:opacity-10",
|
|
9456
|
+
// No state layer when disabled
|
|
9457
|
+
"group-data-[disabled]/fab-menu-item:hidden"
|
|
9458
|
+
],
|
|
9459
|
+
{
|
|
9460
|
+
variants: {
|
|
9461
|
+
color: {
|
|
9462
|
+
"primary-container": "bg-on-primary-container",
|
|
9463
|
+
"secondary-container": "bg-on-secondary-container",
|
|
9464
|
+
"tertiary-container": "bg-on-tertiary-container",
|
|
9465
|
+
primary: "bg-on-primary",
|
|
9466
|
+
secondary: "bg-on-secondary",
|
|
9467
|
+
tertiary: "bg-on-tertiary"
|
|
9468
|
+
}
|
|
9469
|
+
},
|
|
9470
|
+
defaultVariants: { color: "primary-container" }
|
|
9471
|
+
}
|
|
9472
|
+
);
|
|
9473
|
+
var fabMenuItemFocusRingVariants = classVarianceAuthority.cva([
|
|
9474
|
+
"pointer-events-none absolute inset-[-3px] rounded-full",
|
|
9475
|
+
"outline outline-2 outline-offset-0 outline-secondary",
|
|
9476
|
+
// Effects transition — opacity change must not overshoot
|
|
9477
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
9478
|
+
"opacity-0",
|
|
9479
|
+
"group-data-[focus-visible]/fab-menu-item:opacity-100"
|
|
9480
|
+
]);
|
|
9481
|
+
var fabMenuItemIconVariants = classVarianceAuthority.cva([
|
|
9482
|
+
"relative z-10 inline-flex shrink-0 items-center justify-center",
|
|
9483
|
+
"size-6",
|
|
9484
|
+
// 24dp per MD3 spec
|
|
9485
|
+
// Color transition uses effects token (no spatial overshoot on color)
|
|
9486
|
+
"transition-colors duration-spring-standard-fast-effects ease-spring-standard-fast-effects"
|
|
9487
|
+
]);
|
|
9488
|
+
var fabMenuItemLabelVariants = classVarianceAuthority.cva([
|
|
9489
|
+
"relative z-10 inline-flex items-center",
|
|
9490
|
+
"text-title-medium"
|
|
9491
|
+
]);
|
|
9306
9492
|
var FABMenu = React.forwardRef(
|
|
9307
9493
|
({
|
|
9308
9494
|
open: controlledOpen,
|
|
@@ -9341,7 +9527,7 @@ var FABMenu = React.forwardRef(
|
|
|
9341
9527
|
setIsOpen(false);
|
|
9342
9528
|
}, [setIsOpen]);
|
|
9343
9529
|
const prevIsOpenRef = React.useRef(void 0);
|
|
9344
|
-
React.
|
|
9530
|
+
React.useLayoutEffect(() => {
|
|
9345
9531
|
if (prevIsOpenRef.current === void 0) {
|
|
9346
9532
|
prevIsOpenRef.current = isOpen;
|
|
9347
9533
|
return;
|
|
@@ -9404,119 +9590,143 @@ var FABMenu = React.forwardRef(
|
|
|
9404
9590
|
}
|
|
9405
9591
|
return child;
|
|
9406
9592
|
});
|
|
9407
|
-
return /* @__PURE__ */ jsxRuntime.jsx(FABMenuContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9408
|
-
|
|
9409
|
-
|
|
9410
|
-
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
|
|
9415
|
-
|
|
9593
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FABMenuContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: rootRef, className: cn(fabMenuVariants(), className), onKeyDown: handleKeyDown, children: [
|
|
9594
|
+
(isOpen || isExiting) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9595
|
+
"div",
|
|
9596
|
+
{
|
|
9597
|
+
className: cn(fabMenuListVariants({ direction })),
|
|
9598
|
+
role: "group",
|
|
9599
|
+
"aria-label": `${ariaLabel} actions`,
|
|
9600
|
+
children: indexedChildren
|
|
9601
|
+
}
|
|
9602
|
+
),
|
|
9603
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9604
|
+
FAB,
|
|
9605
|
+
{
|
|
9606
|
+
ref: triggerRef,
|
|
9607
|
+
onPress: toggle,
|
|
9608
|
+
"aria-label": ariaLabel,
|
|
9609
|
+
"aria-expanded": isOpen,
|
|
9610
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9611
|
+
"svg",
|
|
9416
9612
|
{
|
|
9613
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9614
|
+
viewBox: "0 0 24 24",
|
|
9615
|
+
fill: "currentColor",
|
|
9417
9616
|
className: cn(
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
direction === "right" && "flex-row"
|
|
9617
|
+
// Expressive fast-spatial: FAB icon is small, high-emphasis — matches FAB enter motion
|
|
9618
|
+
"h-6 w-6 transition-transform",
|
|
9619
|
+
reducedMotion ? "" : "duration-expressive-fast-spatial ease-expressive-fast-spatial",
|
|
9620
|
+
isOpen && "rotate-45"
|
|
9423
9621
|
),
|
|
9424
|
-
|
|
9425
|
-
"
|
|
9426
|
-
children: indexedChildren
|
|
9622
|
+
"aria-hidden": "true",
|
|
9623
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" })
|
|
9427
9624
|
}
|
|
9428
9625
|
),
|
|
9429
|
-
|
|
9430
|
-
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
onPress: toggle,
|
|
9434
|
-
"aria-label": ariaLabel,
|
|
9435
|
-
"aria-expanded": isOpen,
|
|
9436
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9437
|
-
"svg",
|
|
9438
|
-
{
|
|
9439
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
9440
|
-
viewBox: "0 0 24 24",
|
|
9441
|
-
fill: "currentColor",
|
|
9442
|
-
className: cn(
|
|
9443
|
-
"duration-short4 ease-standard h-6 w-6 transition-transform",
|
|
9444
|
-
isOpen && "rotate-45"
|
|
9445
|
-
),
|
|
9446
|
-
"aria-hidden": "true",
|
|
9447
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" })
|
|
9448
|
-
}
|
|
9449
|
-
),
|
|
9450
|
-
className: cn(isOpen && "shadow-elevation-4")
|
|
9451
|
-
}
|
|
9452
|
-
)
|
|
9453
|
-
]
|
|
9454
|
-
}
|
|
9455
|
-
) });
|
|
9626
|
+
className: cn(isOpen && "shadow-elevation-4")
|
|
9627
|
+
}
|
|
9628
|
+
)
|
|
9629
|
+
] }) });
|
|
9456
9630
|
}
|
|
9457
9631
|
);
|
|
9458
9632
|
FABMenu.displayName = "FABMenu";
|
|
9459
9633
|
var FABMenuItem = React.forwardRef(
|
|
9460
|
-
({
|
|
9634
|
+
({
|
|
9635
|
+
icon,
|
|
9636
|
+
label,
|
|
9637
|
+
"aria-label": ariaLabel,
|
|
9638
|
+
onPress,
|
|
9639
|
+
color = "primary-container",
|
|
9640
|
+
isDisabled = false,
|
|
9641
|
+
className,
|
|
9642
|
+
index = 0
|
|
9643
|
+
}, forwardedRef) => {
|
|
9461
9644
|
const internalRef = React.useRef(null);
|
|
9462
9645
|
const buttonRef = forwardedRef ?? internalRef;
|
|
9463
|
-
const { isOpen, isExiting,
|
|
9646
|
+
const { isOpen, isExiting, reducedMotion, itemCount, direction } = useFABMenuContext();
|
|
9647
|
+
if (process.env.NODE_ENV === "development") {
|
|
9648
|
+
if (!label && !ariaLabel) {
|
|
9649
|
+
console.warn(
|
|
9650
|
+
"[FABMenuItem] Either `label` or `aria-label` must be provided for accessibility."
|
|
9651
|
+
);
|
|
9652
|
+
}
|
|
9653
|
+
}
|
|
9654
|
+
const [isPressed, setIsPressed] = React.useState(false);
|
|
9655
|
+
const handlePressStart = React.useCallback(() => setIsPressed(true), []);
|
|
9656
|
+
const handlePressEnd = React.useCallback(() => setIsPressed(false), []);
|
|
9657
|
+
const { isHovered, hoverProps } = reactAria.useHover({ isDisabled });
|
|
9658
|
+
const { isFocusVisible, focusProps } = reactAria.useFocusRing();
|
|
9464
9659
|
const { buttonProps } = reactAria.useButton(
|
|
9465
9660
|
{
|
|
9466
|
-
...onPress
|
|
9467
|
-
|
|
9468
|
-
|
|
9661
|
+
...onPress ? { onPress } : {},
|
|
9662
|
+
isDisabled,
|
|
9663
|
+
onPressStart: handlePressStart,
|
|
9664
|
+
onPressEnd: handlePressEnd,
|
|
9665
|
+
...ariaLabel ? { "aria-label": ariaLabel } : {},
|
|
9666
|
+
elementType: "button"
|
|
9469
9667
|
},
|
|
9470
9668
|
buttonRef
|
|
9471
9669
|
);
|
|
9472
|
-
const { onMouseDown: handleRipple, ripples } = useRipple({
|
|
9473
|
-
disabled: isDisabled
|
|
9474
|
-
});
|
|
9475
|
-
const mergedProps = utils.mergeProps(buttonProps, {
|
|
9476
|
-
type: "button",
|
|
9477
|
-
onMouseDown: handleRipple
|
|
9478
|
-
});
|
|
9670
|
+
const { onMouseDown: handleRipple, ripples } = useRipple({ disabled: isDisabled });
|
|
9479
9671
|
const staggerDelay = reducedMotion ? 0 : isExiting ? Math.max(0, itemCount - 1 - index) * 30 : index * 30;
|
|
9672
|
+
const DIRECTION_ORIGIN = {
|
|
9673
|
+
up: "origin-bottom",
|
|
9674
|
+
down: "origin-top",
|
|
9675
|
+
left: "origin-right",
|
|
9676
|
+
right: "origin-left"
|
|
9677
|
+
};
|
|
9678
|
+
const originClass = reducedMotion ? void 0 : DIRECTION_ORIGIN[direction];
|
|
9480
9679
|
const animationClass = reducedMotion ? void 0 : isOpen ? "animate-md-scale-in" : isExiting ? "animate-md-scale-out" : void 0;
|
|
9481
|
-
const
|
|
9482
|
-
|
|
9483
|
-
|
|
9680
|
+
const mergedButtonProps = reactAria.mergeProps(buttonProps, hoverProps, focusProps, {
|
|
9681
|
+
onMouseDown: handleRipple
|
|
9682
|
+
});
|
|
9683
|
+
const {
|
|
9684
|
+
isDisabled: _isDisabled,
|
|
9685
|
+
onPress: _onPress,
|
|
9686
|
+
onPressStart: _onPressStart,
|
|
9687
|
+
onPressEnd: _onPressEnd,
|
|
9688
|
+
onPressChange: _onPressChange,
|
|
9689
|
+
onPressUp: _onPressUp,
|
|
9690
|
+
...htmlButtonProps
|
|
9691
|
+
} = mergedButtonProps;
|
|
9484
9692
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9485
|
-
"
|
|
9693
|
+
"button",
|
|
9486
9694
|
{
|
|
9695
|
+
...htmlButtonProps,
|
|
9696
|
+
ref: buttonRef,
|
|
9697
|
+
type: "button",
|
|
9698
|
+
...getInteractionDataAttributes({
|
|
9699
|
+
isHovered,
|
|
9700
|
+
isFocusVisible,
|
|
9701
|
+
isPressed,
|
|
9702
|
+
isDisabled
|
|
9703
|
+
}),
|
|
9704
|
+
"data-with-icon": icon ? "" : void 0,
|
|
9705
|
+
"data-with-label": label ? "" : void 0,
|
|
9487
9706
|
className: cn(
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
|
|
9707
|
+
fabMenuItemVariants({ color }),
|
|
9708
|
+
// group/fab-menu-item: enables group-data-[x]/fab-menu-item child selectors in all slots
|
|
9709
|
+
"group/fab-menu-item",
|
|
9710
|
+
// Scale pivot toward the FAB so items appear to emanate from the trigger
|
|
9711
|
+
originClass,
|
|
9712
|
+
// Stagger animation class (animate-md-scale-in / animate-md-scale-out)
|
|
9713
|
+
animationClass,
|
|
9491
9714
|
className
|
|
9492
9715
|
),
|
|
9716
|
+
style: staggerDelay > 0 ? { animationDelay: `${staggerDelay}ms` } : void 0,
|
|
9493
9717
|
children: [
|
|
9494
|
-
|
|
9495
|
-
/* @__PURE__ */ jsxRuntime.
|
|
9496
|
-
"
|
|
9718
|
+
ripples,
|
|
9719
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9720
|
+
"span",
|
|
9497
9721
|
{
|
|
9498
|
-
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
"relative flex size-10 items-center justify-center overflow-hidden rounded-xl",
|
|
9502
|
-
"bg-primary-container text-on-primary-container shadow-elevation-3",
|
|
9503
|
-
animationClass
|
|
9504
|
-
),
|
|
9505
|
-
style: staggerDelay > 0 ? { animationDelay: `${staggerDelay}ms` } : void 0,
|
|
9506
|
-
children: [
|
|
9507
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9508
|
-
"span",
|
|
9509
|
-
{
|
|
9510
|
-
"data-state-layer": true,
|
|
9511
|
-
className: "bg-on-primary-container duration-spring-standard-fast-effects ease-spring-standard-fast-effects pointer-events-none absolute inset-0 rounded-xl opacity-0 transition-opacity hover:opacity-8"
|
|
9512
|
-
}
|
|
9513
|
-
),
|
|
9514
|
-
ripples,
|
|
9515
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative z-10 inline-flex shrink-0", children: icon })
|
|
9516
|
-
]
|
|
9722
|
+
className: cn(fabMenuItemStateLayerVariants({ color })),
|
|
9723
|
+
"data-state-layer": true,
|
|
9724
|
+
"aria-hidden": "true"
|
|
9517
9725
|
}
|
|
9518
9726
|
),
|
|
9519
|
-
|
|
9727
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(fabMenuItemFocusRingVariants()), "aria-hidden": "true" }),
|
|
9728
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(fabMenuItemIconVariants()), "aria-hidden": "true", children: icon }),
|
|
9729
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(fabMenuItemLabelVariants()), children: label })
|
|
9520
9730
|
]
|
|
9521
9731
|
}
|
|
9522
9732
|
);
|
|
@@ -15223,7 +15433,12 @@ exports.datePickerScrimVariants = datePickerScrimVariants;
|
|
|
15223
15433
|
exports.datePickerSupportingTextVariants = datePickerSupportingTextVariants;
|
|
15224
15434
|
exports.datePickerWeekdayVariants = datePickerWeekdayVariants;
|
|
15225
15435
|
exports.dividerVariants = dividerVariants;
|
|
15436
|
+
exports.fabMenuItemFocusRingVariants = fabMenuItemFocusRingVariants;
|
|
15437
|
+
exports.fabMenuItemIconVariants = fabMenuItemIconVariants;
|
|
15438
|
+
exports.fabMenuItemLabelVariants = fabMenuItemLabelVariants;
|
|
15439
|
+
exports.fabMenuItemStateLayerVariants = fabMenuItemStateLayerVariants;
|
|
15226
15440
|
exports.fabMenuItemVariants = fabMenuItemVariants;
|
|
15441
|
+
exports.fabMenuListVariants = fabMenuListVariants;
|
|
15227
15442
|
exports.fabMenuVariants = fabMenuVariants;
|
|
15228
15443
|
exports.generateMD3Theme = generateMD3Theme;
|
|
15229
15444
|
exports.getColorValue = getColorValue;
|