@tinybigui/react 0.11.0 → 0.11.1

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
@@ -4587,6 +4587,12 @@ interface CardHeadlessProps extends AriaButtonProps, Pick<HTMLAttributes<HTMLDiv
4587
4587
  * Card content.
4588
4588
  */
4589
4589
  children?: ReactNode;
4590
+ /**
4591
+ * Presence-based interaction/content `data-*` attributes forwarded onto the
4592
+ * root element (e.g. `data-hovered`, `data-pressed`, `data-interactive`,
4593
+ * `data-dragged`). Consumed by slot `group-data-[x]/card:` selectors.
4594
+ */
4595
+ [dataAttr: `data-${string}`]: unknown;
4590
4596
  }
4591
4597
  /**
4592
4598
  * Props for the `CardMedia` sub-component.
@@ -4695,29 +4701,37 @@ interface CardActionsProps {
4695
4701
  }
4696
4702
 
4697
4703
  /**
4698
- * `Card` Layer 3 MD3 Styled Card Component.
4704
+ * Material Design 3 Card Component (Layer 3: Styled).
4699
4705
  *
4700
- * Wraps `CardHeadless` with Material Design 3 visual styling: elevation shadows,
4701
- * state layer, ripple feedback, and all three card variants.
4706
+ * Wraps `CardHeadless` with MD3 visual styling using the Variants-vs-States
4707
+ * architecture: all interaction states are expressed as `data-*` attributes on
4708
+ * the root and consumed by each slot via `group-data-[x]/card` selectors — no
4709
+ * state variants live in CVA.
4702
4710
  *
4703
4711
  * ## Modes
4704
4712
  *
4705
- * | Condition | Rendered as | Ripple | State layer |
4706
- * |---|---|---|---|
4707
- * | `onPress` or `href` provided | `role="button"` | ✅ | ✅ |
4708
- * | Neither provided | `role="article"` | ❌ | ❌ |
4713
+ * | Condition | Rendered as | Ripple | State layer | Focus ring |
4714
+ * |---|---|---|---|---|
4715
+ * | `onPress` or `href` provided | `role="button"` | ✅ | ✅ | ✅ |
4716
+ * | Neither provided | `role="article"` | ❌ | ❌ | ❌ |
4717
+ *
4718
+ * ## Variants & elevation per state (MD3 comp tokens)
4719
+ *
4720
+ * - **elevated** — `surface-container-low`; 1 base → 2 hover → 1 focus/pressed → 4 dragged.
4721
+ * - **filled** — `surface-container-highest`; 0 base → 1 hover → 0 focus/pressed → 3 dragged.
4722
+ * - **outlined** — `surface` + `outline-variant` border; 0 base → 1 hover → 0 focus/pressed → 3 dragged.
4709
4723
  *
4710
- * ## Variants
4724
+ * ## State layer (interactive only)
4711
4725
  *
4712
- * - **elevated** `surface-container-low` background, elevation 1dp at rest (2dp on hover).
4713
- * - **filled** `surface-container-highest` background, no elevation.
4714
- * - **outlined** — `surface` background, `outline-variant` border, no elevation.
4726
+ * `on-surface` overlay: 8% hover, 10% focus/pressed, 16% dragged. Rendered below
4727
+ * the content (which carries `z-10`) so the surface is tinted without reducing
4728
+ * text legibility.
4715
4729
  *
4716
4730
  * ## Dragged state
4717
4731
  *
4718
- * When `isDraggable` is `true`, the card tracks its own drag state via mouse events.
4719
- * While dragging, the `elevated` variant jumps to elevation 4dp using a slower,
4720
- * decelerate transition curve per MD3 motion spec.
4732
+ * When `isDraggable` is `true`, the card tracks its own drag state via mouse
4733
+ * events and exposes it as `data-dragged`. While dragging, elevation rises to
4734
+ * its MD3 dragged level and the state layer reaches 16% opacity.
4721
4735
  *
4722
4736
  * @example
4723
4737
  * ```tsx
@@ -4824,64 +4838,94 @@ declare const CardActions: React$1.ForwardRefExoticComponent<CardActionsProps &
4824
4838
  /**
4825
4839
  * `CardHeadless` — Layer 2 headless primitive.
4826
4840
  *
4827
- * Provides all MD3 Card interaction semantics without any visual styling.
4841
+ * Provides MD3 Card interaction semantics (press, keyboard activation, link
4842
+ * behavior) without any visual styling. Pure behavior — all interaction-state
4843
+ * styling is driven by the Layer 3 `Card` via forwarded `data-*` attributes.
4828
4844
  *
4829
4845
  * ## Dual-mode behavior
4830
4846
  *
4831
- * | Condition | Role | Keyboard | Focus ring |
4832
- * |---|---|---|---|
4833
- * | `onPress` or `href` present | `role="button"` | Enter / Space activate | `data-focus-visible="true"` on keyboard focus |
4834
- * | Neither present | `role="article"` | No activation | Not applicable |
4847
+ * | Condition | Role | Keyboard |
4848
+ * |---|---|---|
4849
+ * | `onPress` or `href` present | `role="button"` | Enter / Space activate |
4850
+ * | Neither present | `role="article"` | No activation, not a tab stop |
4835
4851
  *
4836
- * Both `useButton` and `useFocusRing` are **always** called (React Rules of Hooks).
4837
- * When the card is non-interactive, `buttonProps` are not spread onto the element
4838
- * so no keyboard interaction or tab-stop is added.
4852
+ * `useButton` is always called (Rules of Hooks); its `buttonProps` are only
4853
+ * applied to the element when the card is interactive, so a static card adds
4854
+ * no tab stop or keyboard handlers.
4839
4855
  *
4840
- * ## Focus ring
4856
+ * ## Prop passthrough
4841
4857
  *
4842
- * The `data-focus-visible` attribute is set to `"true"` only when focus was
4843
- * triggered by keyboard navigation (`useFocusRing` `isFocusVisible`).
4844
- * Mouse/touch focus leaves the attribute unset. The styled Card layer reads
4845
- * this attribute to conditionally render the MD3 focus ring.
4858
+ * Any `data-*` attributes (e.g. `data-hovered`, `data-pressed`, `data-dragged`,
4859
+ * `data-interactive`) and DOM event handlers (`onMouseDown`, `onFocus`, …) are
4860
+ * spread onto the root element so the styled layer can drive `group-data-[x]/card`
4861
+ * selectors and ripple/drag tracking.
4846
4862
  *
4847
4863
  * @example
4848
4864
  * ```tsx
4849
4865
  * // Interactive
4850
- * <CardHeadless
4851
- * onPress={handlePress}
4852
- * aria-label="View details"
4853
- * className="rounded-xl p-4"
4854
- * >
4866
+ * <CardHeadless onPress={handlePress} aria-label="View details" className="rounded-xl p-4">
4855
4867
  * Card content
4856
4868
  * </CardHeadless>
4857
4869
  *
4858
4870
  * // Static
4859
- * <CardHeadless className="rounded-xl p-4">
4860
- * Card content
4861
- * </CardHeadless>
4871
+ * <CardHeadless className="rounded-xl p-4">Card content</CardHeadless>
4862
4872
  * ```
4863
4873
  */
4864
4874
  declare const CardHeadless: React__default.ForwardRefExoticComponent<CardHeadlessProps & React__default.RefAttributes<HTMLDivElement>>;
4865
4875
 
4866
4876
  /**
4867
- * Material Design 3 Card Variants (CVA)
4877
+ * Material Design 3 Card Variants
4868
4878
  *
4869
- * Type-safe variant management for the Card component.
4870
- * Uses Tailwind CSS classes mapped to MD3 design tokens.
4879
+ * Architecture: Variants vs States
4880
+ * - CVA holds design-time structure only (the `variant` axis). No interaction
4881
+ * state variants (hovered/pressed/focused/dragged/disabled) live in CVA.
4882
+ * - All interaction states are driven by data-* attributes on the root via
4883
+ * `data-[x]:` (self-targeting) on the root and `group-data-[x]/card:` selectors
4884
+ * in each slot's base classes.
4885
+ * - Content flags (`data-interactive`) are set explicitly by the component.
4871
4886
  *
4872
- * MD3 Specifications:
4873
- * - Shape: medium (12dp) `rounded-md`
4874
- * - Elevated: surface-container-low + elevation-1 (resting), elevation-2 (hover/interactive)
4875
- * - Filled: surface-container-highest + elevation-0
4876
- * - Outlined: surface + outline-variant border + elevation-0
4877
- * - Dragged state (elevated only): elevation-4, slower shadow transition
4878
- * - Disabled: on-surface at 12% opacity (`opacity-38`) + no pointer events
4887
+ * Slot responsibilities:
4888
+ * cardVariants — root container; shape, color, per-state elevation
4889
+ * cardStateLayerVariants hover/focus/press/drag opacity ring (absolute overlay)
4890
+ * cardFocusRingVariants — keyboard focus outline (inset so overflow-hidden never clips it)
4891
+ *
4892
+ * MD3 Spec (https://m3.material.io/components/cards/specs):
4893
+ * Shape: medium corner (12dp) `rounded-md`
4894
+ * State-layer color: on-surface (all variants)
4895
+ * State-layer opacities: hover 8% | focus 10% | pressed 10% | dragged 16%
4896
+ * Disabled: container 38% opacity, no pointer events
4897
+ *
4898
+ * Elevation per state (MD3 comp tokens):
4899
+ * Elevated enabled=1 hover=2 focus=1 pressed=1 dragged=4
4900
+ * Filled enabled=0 hover=1 focus=0 pressed=0 dragged=3
4901
+ * Outlined enabled=0 hover=1 focus=0 pressed=0 dragged=3
4902
+ *
4903
+ * Motion tier: Standard **default** (cards are standard-size components alongside
4904
+ * dialogs/menus — not the fast tier used for small <48dp controls like buttons).
4905
+ * All effect transitions use `duration-spring-standard-default-effects` (200ms) +
4906
+ * `ease-spring-standard-default-effects`.
4907
+ *
4908
+ * Specificity strategy (self-targeting `data-[x]:` on the root):
4909
+ * base → hover (single) → focus (single) → pressed (doubled) → dragged (tripled)
4910
+ * Doubling/tripling the attribute selector guarantees the later state wins
4911
+ * regardless of Tailwind's emitted class order. `pressed` (and `dragged`,
4912
+ * which co-occurs with a held pointer) therefore beat `hover` deterministically.
4913
+ */
4914
+ /**
4915
+ * Root container element.
4916
+ *
4917
+ * `overflow-hidden` clips full-bleed media (CardMedia), the ripple, and the
4918
+ * state layer to the card's rounded shape. Because the root clips, the focus
4919
+ * ring is rendered as an INSET overlay (see `cardFocusRingVariants`) rather than
4920
+ * an outset ring, so it is never cut off.
4921
+ *
4922
+ * Elevation responds to the root's own `data-*` state attributes via
4923
+ * self-targeting selectors (the root carries both `group/card` and the state
4924
+ * attributes). The shadow, opacity, and border-color changes are effects, so
4925
+ * they use the standard-default-effects spring (200ms, no overshoot).
4879
4926
  */
4880
4927
  declare const cardVariants: (props?: ({
4881
4928
  variant?: "filled" | "outlined" | "elevated" | null | undefined;
4882
- isInteractive?: boolean | null | undefined;
4883
- isDragged?: boolean | null | undefined;
4884
- isDisabled?: boolean | null | undefined;
4885
4929
  } & class_variance_authority_types.ClassProp) | undefined) => string;
4886
4930
  /**
4887
4931
  * Extract variant prop types from CVA for typed usage.
package/dist/index.d.ts CHANGED
@@ -4587,6 +4587,12 @@ interface CardHeadlessProps extends AriaButtonProps, Pick<HTMLAttributes<HTMLDiv
4587
4587
  * Card content.
4588
4588
  */
4589
4589
  children?: ReactNode;
4590
+ /**
4591
+ * Presence-based interaction/content `data-*` attributes forwarded onto the
4592
+ * root element (e.g. `data-hovered`, `data-pressed`, `data-interactive`,
4593
+ * `data-dragged`). Consumed by slot `group-data-[x]/card:` selectors.
4594
+ */
4595
+ [dataAttr: `data-${string}`]: unknown;
4590
4596
  }
4591
4597
  /**
4592
4598
  * Props for the `CardMedia` sub-component.
@@ -4695,29 +4701,37 @@ interface CardActionsProps {
4695
4701
  }
4696
4702
 
4697
4703
  /**
4698
- * `Card` Layer 3 MD3 Styled Card Component.
4704
+ * Material Design 3 Card Component (Layer 3: Styled).
4699
4705
  *
4700
- * Wraps `CardHeadless` with Material Design 3 visual styling: elevation shadows,
4701
- * state layer, ripple feedback, and all three card variants.
4706
+ * Wraps `CardHeadless` with MD3 visual styling using the Variants-vs-States
4707
+ * architecture: all interaction states are expressed as `data-*` attributes on
4708
+ * the root and consumed by each slot via `group-data-[x]/card` selectors — no
4709
+ * state variants live in CVA.
4702
4710
  *
4703
4711
  * ## Modes
4704
4712
  *
4705
- * | Condition | Rendered as | Ripple | State layer |
4706
- * |---|---|---|---|
4707
- * | `onPress` or `href` provided | `role="button"` | ✅ | ✅ |
4708
- * | Neither provided | `role="article"` | ❌ | ❌ |
4713
+ * | Condition | Rendered as | Ripple | State layer | Focus ring |
4714
+ * |---|---|---|---|---|
4715
+ * | `onPress` or `href` provided | `role="button"` | ✅ | ✅ | ✅ |
4716
+ * | Neither provided | `role="article"` | ❌ | ❌ | ❌ |
4717
+ *
4718
+ * ## Variants & elevation per state (MD3 comp tokens)
4719
+ *
4720
+ * - **elevated** — `surface-container-low`; 1 base → 2 hover → 1 focus/pressed → 4 dragged.
4721
+ * - **filled** — `surface-container-highest`; 0 base → 1 hover → 0 focus/pressed → 3 dragged.
4722
+ * - **outlined** — `surface` + `outline-variant` border; 0 base → 1 hover → 0 focus/pressed → 3 dragged.
4709
4723
  *
4710
- * ## Variants
4724
+ * ## State layer (interactive only)
4711
4725
  *
4712
- * - **elevated** `surface-container-low` background, elevation 1dp at rest (2dp on hover).
4713
- * - **filled** `surface-container-highest` background, no elevation.
4714
- * - **outlined** — `surface` background, `outline-variant` border, no elevation.
4726
+ * `on-surface` overlay: 8% hover, 10% focus/pressed, 16% dragged. Rendered below
4727
+ * the content (which carries `z-10`) so the surface is tinted without reducing
4728
+ * text legibility.
4715
4729
  *
4716
4730
  * ## Dragged state
4717
4731
  *
4718
- * When `isDraggable` is `true`, the card tracks its own drag state via mouse events.
4719
- * While dragging, the `elevated` variant jumps to elevation 4dp using a slower,
4720
- * decelerate transition curve per MD3 motion spec.
4732
+ * When `isDraggable` is `true`, the card tracks its own drag state via mouse
4733
+ * events and exposes it as `data-dragged`. While dragging, elevation rises to
4734
+ * its MD3 dragged level and the state layer reaches 16% opacity.
4721
4735
  *
4722
4736
  * @example
4723
4737
  * ```tsx
@@ -4824,64 +4838,94 @@ declare const CardActions: React$1.ForwardRefExoticComponent<CardActionsProps &
4824
4838
  /**
4825
4839
  * `CardHeadless` — Layer 2 headless primitive.
4826
4840
  *
4827
- * Provides all MD3 Card interaction semantics without any visual styling.
4841
+ * Provides MD3 Card interaction semantics (press, keyboard activation, link
4842
+ * behavior) without any visual styling. Pure behavior — all interaction-state
4843
+ * styling is driven by the Layer 3 `Card` via forwarded `data-*` attributes.
4828
4844
  *
4829
4845
  * ## Dual-mode behavior
4830
4846
  *
4831
- * | Condition | Role | Keyboard | Focus ring |
4832
- * |---|---|---|---|
4833
- * | `onPress` or `href` present | `role="button"` | Enter / Space activate | `data-focus-visible="true"` on keyboard focus |
4834
- * | Neither present | `role="article"` | No activation | Not applicable |
4847
+ * | Condition | Role | Keyboard |
4848
+ * |---|---|---|
4849
+ * | `onPress` or `href` present | `role="button"` | Enter / Space activate |
4850
+ * | Neither present | `role="article"` | No activation, not a tab stop |
4835
4851
  *
4836
- * Both `useButton` and `useFocusRing` are **always** called (React Rules of Hooks).
4837
- * When the card is non-interactive, `buttonProps` are not spread onto the element
4838
- * so no keyboard interaction or tab-stop is added.
4852
+ * `useButton` is always called (Rules of Hooks); its `buttonProps` are only
4853
+ * applied to the element when the card is interactive, so a static card adds
4854
+ * no tab stop or keyboard handlers.
4839
4855
  *
4840
- * ## Focus ring
4856
+ * ## Prop passthrough
4841
4857
  *
4842
- * The `data-focus-visible` attribute is set to `"true"` only when focus was
4843
- * triggered by keyboard navigation (`useFocusRing` `isFocusVisible`).
4844
- * Mouse/touch focus leaves the attribute unset. The styled Card layer reads
4845
- * this attribute to conditionally render the MD3 focus ring.
4858
+ * Any `data-*` attributes (e.g. `data-hovered`, `data-pressed`, `data-dragged`,
4859
+ * `data-interactive`) and DOM event handlers (`onMouseDown`, `onFocus`, …) are
4860
+ * spread onto the root element so the styled layer can drive `group-data-[x]/card`
4861
+ * selectors and ripple/drag tracking.
4846
4862
  *
4847
4863
  * @example
4848
4864
  * ```tsx
4849
4865
  * // Interactive
4850
- * <CardHeadless
4851
- * onPress={handlePress}
4852
- * aria-label="View details"
4853
- * className="rounded-xl p-4"
4854
- * >
4866
+ * <CardHeadless onPress={handlePress} aria-label="View details" className="rounded-xl p-4">
4855
4867
  * Card content
4856
4868
  * </CardHeadless>
4857
4869
  *
4858
4870
  * // Static
4859
- * <CardHeadless className="rounded-xl p-4">
4860
- * Card content
4861
- * </CardHeadless>
4871
+ * <CardHeadless className="rounded-xl p-4">Card content</CardHeadless>
4862
4872
  * ```
4863
4873
  */
4864
4874
  declare const CardHeadless: React__default.ForwardRefExoticComponent<CardHeadlessProps & React__default.RefAttributes<HTMLDivElement>>;
4865
4875
 
4866
4876
  /**
4867
- * Material Design 3 Card Variants (CVA)
4877
+ * Material Design 3 Card Variants
4868
4878
  *
4869
- * Type-safe variant management for the Card component.
4870
- * Uses Tailwind CSS classes mapped to MD3 design tokens.
4879
+ * Architecture: Variants vs States
4880
+ * - CVA holds design-time structure only (the `variant` axis). No interaction
4881
+ * state variants (hovered/pressed/focused/dragged/disabled) live in CVA.
4882
+ * - All interaction states are driven by data-* attributes on the root via
4883
+ * `data-[x]:` (self-targeting) on the root and `group-data-[x]/card:` selectors
4884
+ * in each slot's base classes.
4885
+ * - Content flags (`data-interactive`) are set explicitly by the component.
4871
4886
  *
4872
- * MD3 Specifications:
4873
- * - Shape: medium (12dp) `rounded-md`
4874
- * - Elevated: surface-container-low + elevation-1 (resting), elevation-2 (hover/interactive)
4875
- * - Filled: surface-container-highest + elevation-0
4876
- * - Outlined: surface + outline-variant border + elevation-0
4877
- * - Dragged state (elevated only): elevation-4, slower shadow transition
4878
- * - Disabled: on-surface at 12% opacity (`opacity-38`) + no pointer events
4887
+ * Slot responsibilities:
4888
+ * cardVariants — root container; shape, color, per-state elevation
4889
+ * cardStateLayerVariants hover/focus/press/drag opacity ring (absolute overlay)
4890
+ * cardFocusRingVariants — keyboard focus outline (inset so overflow-hidden never clips it)
4891
+ *
4892
+ * MD3 Spec (https://m3.material.io/components/cards/specs):
4893
+ * Shape: medium corner (12dp) `rounded-md`
4894
+ * State-layer color: on-surface (all variants)
4895
+ * State-layer opacities: hover 8% | focus 10% | pressed 10% | dragged 16%
4896
+ * Disabled: container 38% opacity, no pointer events
4897
+ *
4898
+ * Elevation per state (MD3 comp tokens):
4899
+ * Elevated enabled=1 hover=2 focus=1 pressed=1 dragged=4
4900
+ * Filled enabled=0 hover=1 focus=0 pressed=0 dragged=3
4901
+ * Outlined enabled=0 hover=1 focus=0 pressed=0 dragged=3
4902
+ *
4903
+ * Motion tier: Standard **default** (cards are standard-size components alongside
4904
+ * dialogs/menus — not the fast tier used for small <48dp controls like buttons).
4905
+ * All effect transitions use `duration-spring-standard-default-effects` (200ms) +
4906
+ * `ease-spring-standard-default-effects`.
4907
+ *
4908
+ * Specificity strategy (self-targeting `data-[x]:` on the root):
4909
+ * base → hover (single) → focus (single) → pressed (doubled) → dragged (tripled)
4910
+ * Doubling/tripling the attribute selector guarantees the later state wins
4911
+ * regardless of Tailwind's emitted class order. `pressed` (and `dragged`,
4912
+ * which co-occurs with a held pointer) therefore beat `hover` deterministically.
4913
+ */
4914
+ /**
4915
+ * Root container element.
4916
+ *
4917
+ * `overflow-hidden` clips full-bleed media (CardMedia), the ripple, and the
4918
+ * state layer to the card's rounded shape. Because the root clips, the focus
4919
+ * ring is rendered as an INSET overlay (see `cardFocusRingVariants`) rather than
4920
+ * an outset ring, so it is never cut off.
4921
+ *
4922
+ * Elevation responds to the root's own `data-*` state attributes via
4923
+ * self-targeting selectors (the root carries both `group/card` and the state
4924
+ * attributes). The shadow, opacity, and border-color changes are effects, so
4925
+ * they use the standard-default-effects spring (200ms, no overshoot).
4879
4926
  */
4880
4927
  declare const cardVariants: (props?: ({
4881
4928
  variant?: "filled" | "outlined" | "elevated" | null | undefined;
4882
- isInteractive?: boolean | null | undefined;
4883
- isDragged?: boolean | null | undefined;
4884
- isDisabled?: boolean | null | undefined;
4885
4929
  } & class_variance_authority_types.ClassProp) | undefined) => string;
4886
4930
  /**
4887
4931
  * Extract variant prop types from CVA for typed usage.