@tinybigui/react 0.4.2 → 0.5.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.ts CHANGED
@@ -1411,53 +1411,48 @@ declare function useOptionalButtonGroup(): ButtonGroupContextValue | null;
1411
1411
  declare function getConnectedRadiusClasses(ctx: ButtonGroupContextValue, value?: string): readonly string[];
1412
1412
 
1413
1413
  /**
1414
- * Material Design 3 IconButton Variants (CVA)
1415
- *
1416
- * Type-safe variant management for IconButton component.
1417
- * Uses Tailwind CSS classes mapped to MD3 design tokens.
1418
- *
1419
- * Key differences from Button:
1420
- * - Circular shape (not pill-shaped)
1421
- * - Fixed square dimensions
1422
- * - No text content support
1423
- * - 'standard' variant instead of 'elevated'
1414
+ * IconButton variant types (MD3 specification)
1424
1415
  */
1425
- declare const iconButtonVariants: (props?: ({
1426
- variant?: "filled" | "outlined" | "tonal" | "standard" | null | undefined;
1427
- color?: "primary" | "secondary" | "tertiary" | "error" | null | undefined;
1428
- size?: "small" | "large" | "medium" | null | undefined;
1429
- selected?: boolean | null | undefined;
1430
- isDisabled?: boolean | null | undefined;
1431
- } & class_variance_authority_types.ClassProp) | undefined) => string;
1416
+ type IconButtonVariant = "standard" | "filled" | "tonal" | "outlined";
1432
1417
  /**
1433
- * Extract variant prop types from CVA
1418
+ * Color scheme (MD3 color roles)
1434
1419
  */
1435
- type IconButtonVariants = VariantProps<typeof iconButtonVariants>;
1436
-
1420
+ type IconButtonColor = "primary" | "secondary" | "tertiary" | "error";
1437
1421
  /**
1438
- * IconButton variant types (MD3 specification)
1422
+ * Icon button sizes M3 Expressive 5-tier system.
1423
+ *
1424
+ * Container heights (dp → px):
1425
+ * - xsmall: 32dp
1426
+ * - small: 40dp
1427
+ * - medium: 56dp (default)
1428
+ * - large: 96dp
1429
+ * - xlarge: 136dp
1439
1430
  */
1440
- type IconButtonVariant = "standard" | "filled" | "tonal" | "outlined";
1431
+ type IconButtonSize = "xsmall" | "small" | "medium" | "large" | "xlarge";
1441
1432
  /**
1442
- * Color scheme
1433
+ * Width variant — adjusts container width relative to height.
1434
+ * - narrow: narrower than height
1435
+ * - default: same width as height (square container)
1436
+ * - wide: wider than height
1443
1437
  */
1444
- type IconButtonColor = "primary" | "secondary" | "tertiary" | "error";
1438
+ type IconButtonWidth = "narrow" | "default" | "wide";
1445
1439
  /**
1446
- * IconButton sizes (square dimensions)
1440
+ * Shape variant controls corner rounding.
1441
+ * - round: fully circular (rounded-full)
1442
+ * - square: size-tiered corner radius (MD3 shape scale)
1447
1443
  */
1448
- type IconButtonSize = "small" | "medium" | "large";
1444
+ type IconButtonShape = "round" | "square";
1449
1445
  /**
1450
- * Material Design 3 IconButton Component Props
1451
- *
1452
- * Icon-only button component with 4 variants and mandatory accessibility.
1446
+ * Material Design 3 Expressive IconButton Component Props
1453
1447
  *
1454
- * **Key Features:**
1448
+ * Icon-only button component following the M3 Expressive spec with:
1449
+ * - 5 sizes: xsmall, small, medium (default), large, xlarge
1450
+ * - 3 width options: narrow, default, wide
1451
+ * - 2 shapes: round (circular), square (corner-radius scale)
1452
+ * - Press shape-morph: corners tighten on press when `shape="round"`
1453
+ * - Toggle support: `selected` + `selectedIcon`
1455
1454
  * - 4 variants: standard, filled, tonal, outlined
1456
- * - Icon only (no text content)
1457
- * - Circular shape (MD3 specification)
1458
1455
  * - Mandatory `aria-label` for accessibility
1459
- * - Toggle support with `selected` prop
1460
- * - 48×48px minimum touch target
1461
1456
  *
1462
1457
  * @example
1463
1458
  * ```tsx
@@ -1471,13 +1466,19 @@ type IconButtonSize = "small" | "medium" | "large";
1471
1466
  * <IconHeart />
1472
1467
  * </IconButton>
1473
1468
  *
1474
- * // Toggle button
1469
+ * // Toggle button with selectedIcon
1475
1470
  * <IconButton
1476
1471
  * aria-label={isFavorite ? "Remove from favorites" : "Add to favorites"}
1477
1472
  * selected={isFavorite}
1478
1473
  * onPress={() => setIsFavorite(!isFavorite)}
1474
+ * selectedIcon={<IconStarFilled />}
1479
1475
  * >
1480
- * {isFavorite ? <IconStarFilled /> : <IconStarOutline />}
1476
+ * <IconStarOutline />
1477
+ * </IconButton>
1478
+ *
1479
+ * // Large square shape
1480
+ * <IconButton aria-label="Settings" size="large" shape="square">
1481
+ * <IconSettings />
1481
1482
  * </IconButton>
1482
1483
  *
1483
1484
  * // Disabled
@@ -1498,21 +1499,48 @@ interface IconButtonProps extends AriaButtonProps {
1498
1499
  */
1499
1500
  color?: IconButtonColor;
1500
1501
  /**
1501
- * Size variant
1502
+ * Size tier (M3 Expressive 5-tier system)
1502
1503
  * @default 'medium'
1503
1504
  */
1504
1505
  size?: IconButtonSize;
1505
1506
  /**
1506
- * Icon content (React node). Recommended size:
1507
- * - small: 20×20px
1508
- * - medium: 24×24px
1509
- * - large: 28×28px
1507
+ * Container width relative to height.
1508
+ * - `narrow`: slimmer than the container height
1509
+ * - `default`: square container (width = height)
1510
+ * - `wide`: wider than the container height
1511
+ *
1512
+ * @default 'default'
1513
+ */
1514
+ width?: IconButtonWidth;
1515
+ /**
1516
+ * Corner shape.
1517
+ * - `round`: fully circular (pill-shaped)
1518
+ * - `square`: size-tiered corner radius from the MD3 shape scale
1519
+ *
1520
+ * Applies a press shape-morph (corners tighten on press, spring back on release).
1521
+ *
1522
+ * @default 'round'
1523
+ */
1524
+ shape?: IconButtonShape;
1525
+ /**
1526
+ * Icon content. Recommended icon sizes per container size:
1527
+ * - xsmall: 20×20px
1528
+ * - small / medium: 24×24px
1529
+ * - large: 32×32px
1530
+ * - xlarge: 40×40px
1510
1531
  */
1511
1532
  children: React__default.ReactNode;
1512
1533
  /**
1513
- * Toggle state (for toggle buttons)
1514
- * When true, button shows selected state
1515
- * @default false
1534
+ * Icon to display when `selected` is `true`.
1535
+ * When provided with a `selected` prop the button becomes a toggle button.
1536
+ * If omitted, `children` is shown in both states.
1537
+ */
1538
+ selectedIcon?: React__default.ReactNode;
1539
+ /**
1540
+ * Toggle state.
1541
+ * When defined (even as `false`) the button behaves as a toggle button and
1542
+ * `aria-pressed` is set.
1543
+ * @default undefined
1516
1544
  */
1517
1545
  selected?: boolean;
1518
1546
  /**
@@ -1531,8 +1559,8 @@ interface IconButtonProps extends AriaButtonProps {
1531
1559
  */
1532
1560
  value?: string;
1533
1561
  /**
1534
- * HTML title attribute for tooltip
1535
- * Recommended for better UX on desktop
1562
+ * HTML title attribute for tooltip.
1563
+ * Recommended for better UX on desktop.
1536
1564
  */
1537
1565
  title?: string;
1538
1566
  /**
@@ -1540,8 +1568,8 @@ interface IconButtonProps extends AriaButtonProps {
1540
1568
  */
1541
1569
  onMouseDown?: (e: React__default.MouseEvent<HTMLButtonElement>) => void;
1542
1570
  /**
1543
- * REQUIRED: Accessible label for screen readers
1544
- * Since IconButton has no visible text, this is mandatory
1571
+ * REQUIRED: Accessible label for screen readers.
1572
+ * Since IconButton has no visible text, this is mandatory.
1545
1573
  *
1546
1574
  * @example
1547
1575
  * aria-label="Delete item"
@@ -1552,19 +1580,27 @@ interface IconButtonProps extends AriaButtonProps {
1552
1580
  }
1553
1581
 
1554
1582
  /**
1555
- * Material Design 3 IconButton Component
1583
+ * Material Design 3 Expressive — IconButton Component (Layer 3: Styled)
1556
1584
  *
1557
- * Icon-only button component following MD3 specifications.
1558
- * Supports 4 variants, toggle mode, and enforces accessibility.
1585
+ * Built on React Aria for world-class accessibility. Implements the
1586
+ * Variants-vs-States architecture: all interaction/selection states are
1587
+ * expressed as data-* attributes (emitted by IconButtonHeadless) and consumed
1588
+ * by each slot via group-data-[x]/icon-button Tailwind selectors — no state
1589
+ * variants in CVA.
1559
1590
  *
1560
- * **Key Features:**
1561
- * - 4 variants: standard, filled, tonal, outlined
1562
- * - Circular shape (MD3 specification)
1563
- * - Mandatory `aria-label` for accessibility
1564
- * - Toggle support with `selected` prop
1565
- * - Ripple effect on interaction
1566
- * - 48×48px minimum touch target
1567
- * - ButtonGroup-aware: applies connected corner radii and min-width when inside a group
1591
+ * Features:
1592
+ * - M3 Expressive 5-tier sizes: xsmall, small, medium, large, xlarge
1593
+ * - 3 width options: narrow, default, wide
1594
+ * - 2 shapes: round (circular), square (MD3 corner scale)
1595
+ * - Press shape-morph (round shape springs into square corner on press)
1596
+ * - 4 variants: standard, filled, tonal, outlined
1597
+ * - 4 color roles: primary, secondary, tertiary, error
1598
+ * - Toggle support (selected + selectedIcon)
1599
+ * - ✅ MD3-correct state layer: per-variant color, opacity-8/10/10
1600
+ * - ✅ MD3-correct disabled: content opacity-38 + container on-surface/12
1601
+ * - ✅ Ripple effect on press
1602
+ * - ✅ ButtonGroup-aware: connected corner radii + min-width
1603
+ * - ✅ Mandatory aria-label for accessibility
1568
1604
  *
1569
1605
  * @example
1570
1606
  * ```tsx
@@ -1573,86 +1609,94 @@ interface IconButtonProps extends AriaButtonProps {
1573
1609
  * <IconDelete />
1574
1610
  * </IconButton>
1575
1611
  *
1576
- * // Filled with color
1577
- * <IconButton aria-label="Favorite" variant="filled" color="error">
1612
+ * // Filled with color, large
1613
+ * <IconButton aria-label="Favorite" variant="filled" color="error" size="large">
1578
1614
  * <IconHeart />
1579
1615
  * </IconButton>
1580
1616
  *
1581
- * // Toggle button
1617
+ * // Toggle button with selectedIcon
1582
1618
  * <IconButton
1583
1619
  * aria-label={selected ? "Remove favorite" : "Add favorite"}
1584
1620
  * selected={selected}
1585
1621
  * onPress={() => setSelected(!selected)}
1622
+ * selectedIcon={<IconStarFilled />}
1586
1623
  * >
1587
- * {selected ? <IconStarFilled /> : <IconStarOutline />}
1624
+ * <IconStarOutline />
1588
1625
  * </IconButton>
1589
1626
  *
1590
- * // Inside a connected ButtonGroup (corner radii applied automatically)
1591
- * <ButtonGroup variant="connected" selectionMode="multi" aria-label="Quick settings">
1592
- * <IconButton aria-label="Bluetooth"><BluetoothIcon /></IconButton>
1593
- * <IconButton aria-label="Wi-Fi"><WifiIcon /></IconButton>
1594
- * </ButtonGroup>
1627
+ * // Square shape, wide width
1628
+ * <IconButton aria-label="Menu" shape="square" width="wide" size="medium">
1629
+ * <IconMenu />
1630
+ * </IconButton>
1595
1631
  * ```
1596
1632
  */
1597
- declare const IconButton: React__default.ForwardRefExoticComponent<IconButtonProps & Omit<IconButtonVariants, "isDisabled" | "selected"> & React__default.RefAttributes<HTMLButtonElement>>;
1633
+ declare const IconButton: React__default.ForwardRefExoticComponent<IconButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
1598
1634
 
1599
1635
  /**
1600
1636
  * Headless IconButton Component (Layer 2)
1601
1637
  *
1602
1638
  * Unstyled icon button primitive using React Aria for accessibility.
1603
- * Provides behavior only - bring your own styles.
1639
+ * Provides behavior AND emits MD3-compliant data-* interaction attributes
1640
+ * so the styled Layer 3 can drive all visual states through CSS alone.
1641
+ *
1642
+ * Emitted data attributes (via getInteractionDataAttributes):
1643
+ * - `data-hovered` — pointer is over the button
1644
+ * - `data-focus-visible` — keyboard/programmatic focus is visible
1645
+ * - `data-pressed` — button is being pressed
1646
+ * - `data-selected` — toggle button is in the ON state
1647
+ * - `data-disabled` — button is non-interactive
1648
+ *
1649
+ * Content flags (set explicitly):
1650
+ * - `data-toggle` — button is a toggle (selected prop is defined)
1604
1651
  *
1605
1652
  * Features:
1606
1653
  * - Full keyboard navigation (Enter, Space)
1607
- * - Screen reader support
1654
+ * - Screen reader support (aria-pressed for toggle buttons)
1608
1655
  * - Touch/pointer event handling
1609
1656
  * - Focus management
1657
+ * - Hover detection (useHover — pointer-only, not keyboard)
1610
1658
  * - Disabled state handling
1611
- * - Toggle button support (aria-pressed)
1612
1659
  *
1613
1660
  * @example
1614
1661
  * ```tsx
1615
- * // Use for custom styling
1616
- * <IconButtonHeadless className="custom-icon-button-class" aria-label="Delete">
1662
+ * // Advanced custom styling
1663
+ * <IconButtonHeadless
1664
+ * aria-label="Delete"
1665
+ * className="group/icon-button my-custom-classes"
1666
+ * isSelected={false}
1667
+ * isToggle={false}
1668
+ * isDisabled={false}
1669
+ * >
1617
1670
  * <IconDelete />
1618
1671
  * </IconButtonHeadless>
1619
1672
  * ```
1620
1673
  */
1621
1674
  interface IconButtonHeadlessProps extends AriaButtonProps {
1622
- /**
1623
- * Additional CSS classes
1624
- */
1675
+ /** Additional CSS classes */
1625
1676
  className?: string;
1626
- /**
1627
- * Icon content (React node)
1628
- */
1677
+ /** Icon content */
1629
1678
  children: React.ReactNode;
1630
- /**
1631
- * Tab index for keyboard navigation
1632
- * @default 0
1633
- */
1679
+ /** Tab index for keyboard navigation @default 0 */
1634
1680
  tabIndex?: number;
1635
- /**
1636
- * Mouse down handler (for ripple effect)
1637
- */
1681
+ /** Mouse down handler (for ripple effect) */
1638
1682
  onMouseDown?: (e: React.MouseEvent<HTMLButtonElement>) => void;
1639
- /**
1640
- * Button type attribute
1641
- * @default 'button'
1642
- */
1683
+ /** Button type attribute @default 'button' */
1643
1684
  type?: "button" | "submit" | "reset";
1644
1685
  /**
1645
- * Toggle state (for toggle buttons)
1646
- * Sets aria-pressed attribute
1686
+ * Toggle selected state.
1687
+ * When defined, sets aria-pressed and emits data-selected / data-toggle.
1647
1688
  */
1648
- selected?: boolean;
1689
+ isSelected?: boolean;
1649
1690
  /**
1650
- * REQUIRED: Accessible label for screen readers
1691
+ * Whether this button behaves as a toggle (i.e. selected prop was passed).
1692
+ * Drives `data-toggle` attribute; determines whether aria-pressed is set.
1651
1693
  */
1694
+ isToggle?: boolean;
1695
+ /** Whether the button is disabled */
1696
+ isDisabled?: boolean;
1697
+ /** REQUIRED: Accessible label for screen readers */
1652
1698
  "aria-label": string;
1653
- /**
1654
- * HTML title attribute for tooltip
1655
- */
1699
+ /** HTML title attribute for tooltip */
1656
1700
  title?: string;
1657
1701
  }
1658
1702
  declare const IconButtonHeadless: React$1.ForwardRefExoticComponent<IconButtonHeadlessProps & React$1.RefAttributes<HTMLButtonElement>>;
@@ -10627,7 +10671,7 @@ type DatePickerContainerVariants = VariantProps<typeof datePickerContainerVarian
10627
10671
  * MD3 spec: 48x48dp circle, various states and types.
10628
10672
  */
10629
10673
  declare const calendarCellVariants: (props?: ({
10630
- cellType?: "disabled" | "selected" | "default" | "today" | "selected-range-middle" | "outside-month" | null | undefined;
10674
+ cellType?: "disabled" | "default" | "selected" | "today" | "selected-range-middle" | "outside-month" | null | undefined;
10631
10675
  state?: "focused" | "enabled" | "hovered" | "pressed" | null | undefined;
10632
10676
  } & class_variance_authority_types.ClassProp) | undefined) => string;
10633
10677
  type CalendarCellVariants = VariantProps<typeof calendarCellVariants>;