@tinybigui/react 0.5.0 → 0.6.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/dist/index.cjs +278 -219
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +181 -82
- package/dist/index.d.ts +181 -82
- package/dist/index.js +278 -219
- package/dist/index.js.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
|
);
|