@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.d.cts CHANGED
@@ -1702,141 +1702,250 @@ interface IconButtonHeadlessProps extends AriaButtonProps {
1702
1702
  declare const IconButtonHeadless: React$1.ForwardRefExoticComponent<IconButtonHeadlessProps & React$1.RefAttributes<HTMLButtonElement>>;
1703
1703
 
1704
1704
  /**
1705
- * Material Design 3 FAB Variants (CVA)
1705
+ * Material Design 3 FAB Variants — Slot-based architecture
1706
1706
  *
1707
- * Type-safe variant management for FAB component.
1708
- * Uses Tailwind CSS classes mapped to MD3 design tokens.
1707
+ * Architecture: Variants vs States
1708
+ * - CVA holds design-time structure only (no disabled/loading state variants).
1709
+ * - All interaction states are driven by data-* attributes on the root via
1710
+ * group-data-[x]/fab Tailwind selectors in each slot's base classes.
1711
+ * - Content flags (data-with-icon, data-loading) are set explicitly by the component.
1712
+ * - Self-targeting data-[x]: selectors handle root-level disabled styling.
1709
1713
  *
1710
- * Key differences from Button/IconButton:
1711
- * - NOT fully rounded (uses specific corner radius: 12px/16px/28px)
1712
- * - Always has elevation (shadow-elevation-3)
1713
- * - Larger sizes (40px/56px/96px)
1714
- * - Extended variant with variable width
1714
+ * Slot responsibilities:
1715
+ * fabVariants — root <button>; shape per size, color per variant,
1716
+ * elevation (base 3 hover 4 → focus/pressed 3),
1717
+ * self data-[disabled] styling, group/fab scope.
1718
+ * fabStateLayerVariants absolute inset overlay, opacity 0/8%/10%/10%,
1719
+ * color = icon/on-color per MD3 spec.
1720
+ * fabFocusRingVariants — keyboard focus outline ring (inset-[-3px]).
1721
+ * MUST NOT sit inside overflow-hidden.
1722
+ * fabIconVariants — icon wrapper; size per FAB size variant.
1723
+ * fabLabelVariants — extended FAB text label slot.
1724
+ *
1725
+ * MD3 Expressive size scale:
1726
+ * fab → 56dp container, 16dp corner, 24dp icon (default)
1727
+ * medium → 80dp container, 20dp corner, 28dp icon (M3 Expressive)
1728
+ * large → 96dp container, 28dp corner, 36dp icon
1729
+ * extended → 56dp height, 16dp corner, 24dp icon (+ text label)
1730
+ * small → 40dp container, 12dp corner, 24dp icon (@deprecated)
1731
+ *
1732
+ * MD3 Expressive color roles:
1733
+ * primary-container → bg-primary-container / text-on-primary-container (default)
1734
+ * secondary-container → bg-secondary-container / text-on-secondary-container
1735
+ * tertiary-container → bg-tertiary-container / text-on-tertiary-container
1736
+ * primary → bg-primary / text-on-primary (solid, M3 Expressive)
1737
+ * secondary → bg-secondary / text-on-secondary (solid, M3 Expressive)
1738
+ * tertiary → bg-tertiary / text-on-tertiary (solid, M3 Expressive)
1739
+ * surface → bg-surface-container-high / text-primary (@deprecated)
1740
+ *
1741
+ * Elevation per state (MD3 spec):
1742
+ * base → elevation-3
1743
+ * hovered → elevation-4 (shadow-elevation-4)
1744
+ * focused → elevation-3 (doubled selector wins over hover)
1745
+ * pressed → elevation-3 (doubled selector wins over hover)
1746
+ * disabled → no shadow
1747
+ *
1748
+ * State-layer opacities (MD3):
1749
+ * hover → 8% (opacity-8)
1750
+ * focus → 10% (opacity-10)
1751
+ * pressed→ 10% (opacity-10, doubled selector wins over hover's 8%)
1752
+ *
1753
+ * Important — overflow-hidden is NOT on the root button.
1754
+ * The focus ring span has `inset-[-3px]` to extend outside the button boundary,
1755
+ * which requires the root to not clip overflow. Overflow clipping is delegated
1756
+ * to the state layer and ripple container (overflow-hidden + rounded-[inherit]).
1715
1757
  */
1716
1758
  declare const fabVariants: (props?: ({
1717
- size?: "small" | "large" | "medium" | "extended" | null | undefined;
1718
- color?: "primary" | "secondary" | "tertiary" | "surface" | null | undefined;
1719
- isDisabled?: boolean | null | undefined;
1759
+ size?: "small" | "large" | "medium" | "fab" | "extended" | null | undefined;
1760
+ color?: "primary" | "primary-container" | "secondary" | "secondary-container" | "tertiary" | "tertiary-container" | "surface" | null | undefined;
1720
1761
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1721
- /**
1722
- * Extract variant prop types from CVA
1723
- */
1724
1762
  type FABVariants = VariantProps<typeof fabVariants>;
1725
1763
 
1726
1764
  /**
1727
- * FAB size types
1765
+ * FAB size types — MD3 Expressive scale.
1766
+ *
1767
+ * | Value | Height | Icon | Corner | Notes |
1768
+ * |------------|--------|-------|--------|------------------------------|
1769
+ * | `fab` | 56dp | 24dp | 16dp | Default. Regular FAB. |
1770
+ * | `medium` | 80dp | 28dp | 20dp | Medium FAB (M3 Expressive). |
1771
+ * | `large` | 96dp | 36dp | 28dp | Large FAB. |
1772
+ * | `extended` | 56dp | 24dp | 16dp | Extended FAB with text label.|
1773
+ * | `small` | 40dp | 24dp | 12dp | @deprecated — Use `fab`. |
1774
+ *
1775
+ * @default 'fab'
1728
1776
  */
1729
- type FABSize = "small" | "medium" | "large" | "extended";
1777
+ type FABSize = "fab" | "medium" | "large" | "extended" | "small";
1730
1778
  /**
1731
- * FAB color scheme
1779
+ * FAB color styles — MD3 Expressive color roles.
1780
+ *
1781
+ * **Container styles (default set):**
1782
+ * - `primary-container` — bg-primary-container / text-on-primary-container (default)
1783
+ * - `secondary-container` — bg-secondary-container / text-on-secondary-container
1784
+ * - `tertiary-container` — bg-tertiary-container / text-on-tertiary-container
1785
+ *
1786
+ * **Solid styles (M3 Expressive):**
1787
+ * - `primary` — bg-primary / text-on-primary
1788
+ * - `secondary` — bg-secondary / text-on-secondary
1789
+ * - `tertiary` — bg-tertiary / text-on-tertiary
1790
+ *
1791
+ * **Deprecated:**
1792
+ * - `surface` — @deprecated Use `primary-container`. Maps to surface-container-high.
1793
+ *
1794
+ * @default 'primary-container'
1732
1795
  */
1733
- type FABColor = "primary" | "secondary" | "tertiary" | "surface";
1796
+ type FABColor = "primary-container" | "secondary-container" | "tertiary-container" | "primary" | "secondary" | "tertiary" | "surface";
1734
1797
  /**
1735
1798
  * Material Design 3 FAB (Floating Action Button) Component Props
1736
1799
  *
1737
- * High-emphasis button for primary screen action.
1738
- * Supports 4 sizes: small (40px), medium (56px), large (96px), extended (variable width with text)
1739
- *
1740
- * ⚠️ IMPORTANT:
1741
- * - Only ONE FAB per screen
1742
- * - aria-label is REQUIRED (even for extended FAB with text)
1743
- * - Use for primary constructive actions only (create, add, compose)
1744
- * - NOT for destructive (delete), navigation (back), or secondary actions
1800
+ * High-emphasis button for the primary screen action.
1801
+ * Implements the MD3 Expressive FAB spec with a slot-based architecture
1802
+ * matching Button and Switch for consistent interaction state handling.
1745
1803
  *
1746
1804
  * @example
1747
1805
  * ```tsx
1748
- * // Standard FAB (medium)
1749
- * <FAB aria-label="Create new item" icon={<IconAdd />} />
1806
+ * // Default FAB (56dp)
1807
+ * <FAB aria-label="Create" icon={<IconAdd />} />
1750
1808
  *
1751
- * // Small FAB
1752
- * <FAB aria-label="Add photo" icon={<IconCamera />} size="small" />
1809
+ * // Medium FAB (80dp, M3 Expressive)
1810
+ * <FAB aria-label="Create" icon={<IconAdd />} size="medium" />
1753
1811
  *
1754
- * // Large FAB
1812
+ * // Large FAB (96dp)
1755
1813
  * <FAB aria-label="Compose" icon={<IconEdit />} size="large" />
1756
1814
  *
1757
- * // Extended FAB (with text)
1758
- * <FAB aria-label="Create new document" icon={<IconAdd />} size="extended">
1815
+ * // Extended FAB (with text label)
1816
+ * <FAB aria-label="Create document" icon={<IconAdd />} size="extended">
1759
1817
  * Create
1760
1818
  * </FAB>
1761
1819
  *
1820
+ * // Solid primary color (M3 Expressive)
1821
+ * <FAB aria-label="Add" icon={<IconAdd />} color="primary" />
1822
+ *
1762
1823
  * // Loading state
1763
1824
  * <FAB aria-label="Creating" icon={<IconAdd />} loading />
1764
- *
1765
- * // Secondary color
1766
- * <FAB aria-label="Edit" icon={<IconEdit />} color="secondary" />
1767
1825
  * ```
1768
1826
  */
1769
1827
  interface FABProps extends AriaButtonProps {
1770
1828
  /**
1771
- * FAB size variant
1772
- * - small: 40×40px (24px icon)
1773
- * - medium: 56×56px (24px icon) - default
1774
- * - large: 96×96px (36px icon)
1775
- * - extended: Variable width with text (24px icon)
1776
- * @default 'medium'
1829
+ * FAB size variant.
1830
+ *
1831
+ * - `fab` (56dp) Default. Standard FAB.
1832
+ * - `medium` (80dp) — Medium FAB. M3 Expressive. Previously 56dp; now remapped.
1833
+ * - `large` (96dp) Large FAB.
1834
+ * - `extended` (56dp height) — Extended FAB with icon and text label.
1835
+ * - `small` (40dp) — @deprecated. Use `fab` instead.
1836
+ *
1837
+ * @default 'fab'
1777
1838
  */
1778
1839
  size?: FABSize;
1779
1840
  /**
1780
- * Color scheme
1781
- * @default 'primary'
1841
+ * Color style for the FAB.
1842
+ *
1843
+ * - `primary-container` — Default. bg-primary-container / text-on-primary-container.
1844
+ * - `secondary-container` — bg-secondary-container / text-on-secondary-container.
1845
+ * - `tertiary-container` — bg-tertiary-container / text-on-tertiary-container.
1846
+ * - `primary` — Solid. bg-primary / text-on-primary (M3 Expressive).
1847
+ * - `secondary` — Solid. bg-secondary / text-on-secondary (M3 Expressive).
1848
+ * - `tertiary` — Solid. bg-tertiary / text-on-tertiary (M3 Expressive).
1849
+ * - `surface` — @deprecated. Use `primary-container`.
1850
+ *
1851
+ * @default 'primary-container'
1782
1852
  */
1783
1853
  color?: FABColor;
1784
1854
  /**
1785
1855
  * Icon content (required).
1786
- * Recommended sizes:
1787
- * - small/medium/extended: 24x24px
1788
- * - large: 36x36px
1856
+ * Recommended icon sizes per variant:
1857
+ * - `fab` / `extended` / `small`: 24×24px
1858
+ * - `medium`: 28×28px
1859
+ * - `large`: 36×36px
1789
1860
  */
1790
1861
  icon: React__default.ReactNode;
1791
1862
  /**
1792
- * Text label (required for extended FAB, ignored for other sizes)
1863
+ * Text label only rendered for `size="extended"`.
1793
1864
  */
1794
1865
  children?: React__default.ReactNode;
1795
1866
  /**
1796
- * Mandatory accessible label for the FAB.
1797
- * This is crucial for screen readers as FAB is icon-based.
1798
- * Even extended FAB with text requires aria-label.
1867
+ * Mandatory accessible label for all FAB sizes.
1868
+ * Required even for extended FABs that have visible text.
1799
1869
  */
1800
1870
  "aria-label": string;
1801
1871
  /**
1802
- * Loading state - shows spinner, disables interaction
1872
+ * Shows a loading spinner and disables interaction.
1803
1873
  * @default false
1804
1874
  */
1805
1875
  loading?: boolean;
1806
1876
  /**
1807
- * Disable ripple effect
1877
+ * Disables the MD3 ripple press-feedback animation.
1808
1878
  * @default false
1809
1879
  */
1810
1880
  disableRipple?: boolean;
1811
1881
  /**
1812
- * Additional CSS classes (Tailwind)
1813
- * Can be used for positioning (e.g., "fixed bottom-4 right-4")
1882
+ * Additional Tailwind classes — commonly used for positioning
1883
+ * (e.g. `className="fixed bottom-4 right-4"`).
1814
1884
  */
1815
1885
  className?: string;
1816
1886
  /**
1817
- * HTML title attribute for tooltip
1887
+ * HTML title attribute for tooltip.
1818
1888
  */
1819
1889
  title?: string;
1820
1890
  /**
1821
- * Mouse down handler (for ripple effect and custom handling)
1891
+ * Mouse down handler (merged with the internal ripple handler).
1822
1892
  */
1823
1893
  onMouseDown?: (e: React__default.MouseEvent<HTMLButtonElement>) => void;
1894
+ /**
1895
+ * Tab index for keyboard navigation.
1896
+ * @default 0
1897
+ */
1898
+ tabIndex?: number | undefined;
1899
+ /**
1900
+ * Button type attribute.
1901
+ * @default 'button'
1902
+ */
1903
+ type?: "button" | "submit" | "reset";
1824
1904
  }
1825
1905
 
1826
1906
  /**
1827
- * Material Design 3 FAB (Floating Action Button) Component
1907
+ * Material Design 3 FAB (Floating Action Button) — M3 Expressive
1908
+ *
1909
+ * High-emphasis button for the primary screen action.
1910
+ * Implements the Variants-vs-States architecture: all interaction states are
1911
+ * expressed as data-* attributes on the root and consumed by each slot via
1912
+ * group-data-[x]/fab Tailwind selectors — no state variants in CVA.
1913
+ *
1914
+ * Features:
1915
+ * - ✅ MD3 Expressive size scale: fab (56dp), medium (80dp), large (96dp), extended, small (dep)
1916
+ * - ✅ Container + solid color styles (primary-container, primary, secondary*, tertiary*)
1917
+ * - ✅ Elevation 3 base → 4 hover → 3 focus/pressed per MD3 spec
1918
+ * - ✅ State-layer color = icon/on-color per MD3 spec
1919
+ * - ✅ Correct state-layer opacities: hover 8% / focus 10% / pressed 10%
1920
+ * - ✅ Dedicated focus ring slot (inset-[-3px], keyboard-only)
1921
+ * - ✅ Loading state with spinner
1922
+ * - ✅ Ripple effect (Material Design)
1923
+ * - ✅ Full keyboard accessibility via React Aria
1828
1924
  *
1829
- * High-emphasis button for primary screen action.
1830
- * Supports 4 sizes: small, medium, large, extended
1831
- * Implementation uses Tailwind CSS classes mapped to MD3 tokens.
1925
+ * @example
1926
+ * ```tsx
1927
+ * // Default FAB (56dp, primary-container)
1928
+ * <FAB aria-label="Create" icon={<IconAdd />} />
1929
+ *
1930
+ * // Medium FAB (80dp, M3 Expressive)
1931
+ * <FAB aria-label="Create" icon={<IconAdd />} size="medium" />
1932
+ *
1933
+ * // Solid primary color (M3 Expressive)
1934
+ * <FAB aria-label="Add" icon={<IconAdd />} color="primary" />
1935
+ *
1936
+ * // Extended FAB with text
1937
+ * <FAB aria-label="Create document" icon={<IconAdd />} size="extended">
1938
+ * Create
1939
+ * </FAB>
1940
+ * ```
1832
1941
  */
1833
- declare const FAB: React__default.ForwardRefExoticComponent<FABProps & Omit<FABVariants, "isDisabled"> & React__default.RefAttributes<HTMLButtonElement>>;
1942
+ declare const FAB: React__default.ForwardRefExoticComponent<FABProps & Omit<FABVariants, never> & React__default.RefAttributes<HTMLButtonElement>>;
1834
1943
 
1835
1944
  /**
1836
1945
  * Headless FAB Component (Layer 2)
1837
1946
  *
1838
1947
  * Unstyled FAB primitive using React Aria for accessibility.
1839
- * Provides behavior only - bring your own styles.
1948
+ * Provides behavior only bring your own styles.
1840
1949
  *
1841
1950
  * Features:
1842
1951
  * - Full keyboard navigation (Enter, Space)
@@ -1844,45 +1953,35 @@ declare const FAB: React__default.ForwardRefExoticComponent<FABProps & Omit<FABV
1844
1953
  * - Touch/pointer event handling
1845
1954
  * - Focus management
1846
1955
  * - Disabled state handling
1956
+ * - Press lifecycle callbacks (onPressStart/onPressEnd) for pressed state tracking
1847
1957
  *
1848
1958
  * @example
1849
1959
  * ```tsx
1850
- * // Use for custom styling
1851
- * <FABHeadless className="custom-fab-class" aria-label="Add">
1960
+ * <FABHeadless aria-label="Add" className="custom-fab">
1852
1961
  * <IconAdd />
1853
1962
  * </FABHeadless>
1854
1963
  * ```
1855
1964
  */
1856
1965
  interface FABHeadlessProps extends AriaButtonProps {
1857
- /**
1858
- * Additional CSS classes
1859
- */
1966
+ /** Additional CSS classes */
1860
1967
  className?: string;
1861
- /**
1862
- * FAB content (icon and optional text)
1863
- */
1968
+ /** FAB content (icon and optional text) */
1864
1969
  children: React.ReactNode;
1865
1970
  /**
1866
- * Tab index for keyboard navigation
1971
+ * Tab index for keyboard navigation.
1867
1972
  * @default 0
1868
1973
  */
1869
1974
  tabIndex?: number;
1870
- /**
1871
- * Mouse down handler (for ripple effect)
1872
- */
1975
+ /** Mouse down handler (for ripple effect) */
1873
1976
  onMouseDown?: (e: React.MouseEvent<HTMLButtonElement>) => void;
1874
1977
  /**
1875
- * Button type attribute
1978
+ * Button type attribute.
1876
1979
  * @default 'button'
1877
1980
  */
1878
1981
  type?: "button" | "submit" | "reset";
1879
- /**
1880
- * REQUIRED: Accessible label for screen readers
1881
- */
1982
+ /** REQUIRED: Accessible label for screen readers */
1882
1983
  "aria-label": string;
1883
- /**
1884
- * HTML title attribute for tooltip
1885
- */
1984
+ /** HTML title attribute for tooltip */
1886
1985
  title?: string;
1887
1986
  }
1888
1987
  declare const FABHeadless: React$1.ForwardRefExoticComponent<FABHeadlessProps & React$1.RefAttributes<HTMLButtonElement>>;