@tinybigui/react 0.10.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.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)
4709
4719
  *
4710
- * ## Variants
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.
4711
4723
  *
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.
4724
+ * ## State layer (interactive only)
4725
+ *
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.
@@ -9192,6 +9236,22 @@ interface BottomSheetHandleProps {
9192
9236
  */
9193
9237
  declare const BottomSheet: React$1.ForwardRefExoticComponent<BottomSheetProps & React$1.RefAttributes<HTMLDivElement>>;
9194
9238
 
9239
+ /**
9240
+ * `BottomSheetHandle` — the draggable handle at the top of the Bottom Sheet.
9241
+ *
9242
+ * Implements the Variants-vs-States architecture used across TinyBigUI:
9243
+ * - Carries `group/handle` on its wrapper so child slots consume data-* selectors.
9244
+ * - Emits `getInteractionDataAttributes` for hover/focus/pressed states from React Aria.
9245
+ * - Emits `data-dragging` as a component-specific content flag (ternary encoding).
9246
+ * - Renders three slots inside the wrapper (stacked via absolute positioning):
9247
+ * 1. State layer — hover/focus/pressed/dragged opacity feedback (aria-hidden)
9248
+ * 2. Focus ring overlay — keyboard focus indicator (aria-hidden)
9249
+ * 3. Pill — the visible 32×4dp decoration (aria-hidden)
9250
+ *
9251
+ * Pointer and keyboard props are injected from `BottomSheetContext` (via `useBottomSheetDrag`).
9252
+ * React Aria `useHover` and `useFocusRing` are merged on top — they do not conflict with the
9253
+ * existing `onPointerDown`/`onPointerUp` drag handlers.
9254
+ */
9195
9255
  declare function BottomSheetHandle({ className, "aria-label": ariaLabelOverride, }: BottomSheetHandleProps): ReactElement;
9196
9256
  declare namespace BottomSheetHandle {
9197
9257
  var displayName: string;
@@ -9297,13 +9357,40 @@ interface UseBottomSheetDragReturn {
9297
9357
  */
9298
9358
  declare function useBottomSheetDrag({ snapPoints, onSnapChange, onClose, }: UseBottomSheetDragOptions): UseBottomSheetDragReturn;
9299
9359
 
9360
+ /**
9361
+ * Material Design 3 Bottom Sheet Variants
9362
+ *
9363
+ * Architecture: Variants vs States
9364
+ * - CVA holds design-time structure only (no state variants, no state compoundVariants).
9365
+ * - The drag handle's interaction states are driven by data-* attributes on its wrapper
9366
+ * via group-data-[x]/handle Tailwind selectors in each slot's base classes.
9367
+ * - Content flags (data-dragging) are set explicitly by the component, not via helper.
9368
+ *
9369
+ * Slot responsibilities:
9370
+ * bottomSheetVariants — fixed container; surface, shape, elevation, snap spring
9371
+ * bottomSheetScrimVariants — modal scrim overlay; opacity fade (screen-level token)
9372
+ * bottomSheetAnimationVariants — enter/exit animation state machine classes
9373
+ * bottomSheetHandleWrapperVariants — 48dp touch target; carries `group/handle`; data-* host
9374
+ * bottomSheetHandleStateLayerVariants — hover/focus/pressed/dragged opacity ring around pill
9375
+ * bottomSheetHandleFocusRingVariants — keyboard focus outline overlay (opacity-driven)
9376
+ * bottomSheetHandlePillVariants — 32×4dp pill decoration; pointer-events-none
9377
+ *
9378
+ * MD3 Spec:
9379
+ * Container surface: surface-container-low, elevation level-1
9380
+ * Shape: extra-large top corners (28dp), square bottom (attached to screen edge)
9381
+ * Width: full width up to 640dp; centered at max-width 640dp on wider viewports
9382
+ * Top margin: 72dp default, 56dp when viewport > 640dp
9383
+ * Drag handle: 32dp × 4dp, on-surface-variant, centered, 22dp top/bottom padding → 48dp target
9384
+ * Scrim: bg-scrim, 32% opacity
9385
+ * State-layer opacities: hover 8% | focus 10% | pressed 10% | dragged 16%
9386
+ */
9300
9387
  /**
9301
9388
  * CVA animation state variants for the Bottom Sheet panel.
9302
9389
  *
9303
9390
  * Motion decision rationale:
9304
9391
  * - Bottom sheet is a standard-size component → `default` speed tier
9305
9392
  * - Slides in/out of screen → composite `animate-md-*` utilities (not manual spring tokens)
9306
- * - Scrim opacity is an effects property → `duration-short4 ease-standard` (legacy screen-level token)
9393
+ * - Scrim opacity is an effects property → `duration-short4 ease-standard` (legacy screen-level)
9307
9394
  * - Snap spring is a spatial on-screen transition → `ease-spring-standard-default-spatial` +
9308
9395
  * `duration-spring-standard-default-spatial` (applied in bottomSheetVariants base)
9309
9396
  * - Standard personality (not expressive) — sheets are utility UI, not moments of delight
@@ -9313,53 +9400,64 @@ declare const bottomSheetAnimationVariants: (props?: ({
9313
9400
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9314
9401
  type BottomSheetAnimationVariants = VariantProps<typeof bottomSheetAnimationVariants>;
9315
9402
  /**
9316
- * CVA variants for the Bottom Sheet container panel.
9403
+ * Root container the bottom sheet panel.
9317
9404
  *
9318
9405
  * MD3 tokens applied:
9319
9406
  * - Surface: bg-surface-container-low
9320
9407
  * - Elevation: shadow-elevation-1
9321
- * - Shape: rounded-t-xl (top-left + top-right 28dp, bottom 0)
9322
- * - Width: full width up to 640dp; centered at max-width 640dp on wider viewports
9323
- * (`mx-auto + max-w-[640px]` at 752dp viewport this naturally produces the MD3-spec 56dp side margins)
9324
- * - Height: constrained by max-height (72dp top margin by default, 56dp on > 640dp viewport)
9325
- * The sheet is always anchored to `bottom-0`; "top margin" is expressed as max-height so
9326
- * the sheet cannot overlap the top portion of the screen.
9327
- * - Drag resize: height animates via `transition-[height]`; the sheet grows/shrinks from the
9328
- * bottom edge, always staying anchored — matching the MD3 spec "resize to another height" behaviour.
9408
+ * - Shape: extra-large top corners (28dp via rounded-t-xl), square bottom (attached to edge)
9409
+ * - Width: full width up to 640dp (mx-auto + w-[640px] max-w-full)
9410
+ * - Height: snap-point driven via inline style; constrained by max-height to enforce top margin
9411
+ * Default: 72dp top margin max-h-[calc(100vh-72px)]
9412
+ * Wide (> 640dp): 56dp top margin sm:max-h-[calc(100vh-56px)]
9413
+ * - Snap spring: spatial on-screen transition spring-standard default spatial pair
9414
+ * data-[dragging]:transition-none suppresses spring during active drag (1:1 pointer tracking)
9415
+ *
9416
+ * NOTE: overflow-hidden clips content during height transitions. The handle's state layer and
9417
+ * focus-ring overlay are sized/positioned to fit within the wrapper, so they are not clipped.
9329
9418
  */
9330
9419
  declare const bottomSheetVariants: (props?: ({
9331
9420
  variant?: "standard" | "modal" | null | undefined;
9332
9421
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9333
9422
  type BottomSheetVariants = VariantProps<typeof bottomSheetVariants>;
9334
9423
  /**
9335
- * CVA for the scrim overlay (modal variant only).
9424
+ * Scrim overlay (modal variant only).
9336
9425
  *
9337
9426
  * MD3 tokens applied:
9338
9427
  * - bg-scrim: scrim surface role
9339
9428
  * - opacity-32: 32% opacity per MD3 spec
9340
- * - Transition: opacity fade (scrim is an effects property legacy screen-level tokens)
9429
+ * - Transition: opacity fade (scrim is a screen-level effects property legacy duration tokens)
9341
9430
  */
9342
9431
  declare const bottomSheetScrimVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
9343
9432
  type BottomSheetScrimVariants = VariantProps<typeof bottomSheetScrimVariants>;
9344
9433
  /**
9345
- * CVA for the drag handle wrapper (touch/click target area).
9434
+ * Drag handle wrapper 48dp touch target area + group scope host.
9435
+ *
9436
+ * Carries `group/handle` so all handle child slots can consume data-* interaction
9437
+ * states via `group-data-[x]/handle:` Tailwind selectors without any CVA variant props.
9346
9438
  *
9347
- * MD3 spec: the top 48dp of the sheet is the interactive touch target area
9348
- * when the drag handle is present. The wrapper provides this touch target.
9439
+ * MD3 spec: 22dp top + 4dp handle + 22dp bottom = 48dp interaction zone.
9440
+ * NOTE: py-[22px] is a measurement-derived value from MD3 spec; permitted exception.
9441
+ *
9442
+ * `relative` provides positioning context for the state layer and focus ring overlays.
9443
+ * `focus-visible:outline-none` suppresses the browser default — the focus ring overlay
9444
+ * in `bottomSheetHandleFocusRingVariants` provides the MD3-spec visible indicator instead.
9349
9445
  */
9350
9446
  declare const bottomSheetHandleWrapperVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
9447
+ type BottomSheetHandleWrapperVariants = VariantProps<typeof bottomSheetHandleWrapperVariants>;
9351
9448
  /**
9352
- * CVA for the drag handle pill visual element.
9449
+ * Drag handle pill the visible 32×4dp decoration.
9353
9450
  *
9354
9451
  * MD3 tokens applied:
9355
- * - bg-on-surface-variant: handle color
9356
- * - w-8: 32dp width per MD3 spec
9357
- * - h-1: 4dp height per MD3 spec
9358
- * - rounded-full: fully rounded pill shape
9359
- * - opacity-40: per MD3 spec (token deprecated but value still in spec)
9452
+ * - bg-on-surface-variant: handle color (muted, low-emphasis by role — no opacity override needed)
9453
+ * - w-8 / h-1: 32dp × 4dp per MD3 spec (measurement-derived; permitted exception)
9454
+ * - rounded-full: fully-rounded pill shape
9455
+ *
9456
+ * `pointer-events-none` all interaction is handled by the wrapper.
9457
+ * `relative z-10` — renders above the state layer overlay.
9360
9458
  */
9361
9459
  declare const bottomSheetHandlePillVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
9362
- type BottomSheetHandleVariants = VariantProps<typeof bottomSheetHandleWrapperVariants>;
9460
+ type BottomSheetHandleVariants = BottomSheetHandleWrapperVariants;
9363
9461
 
9364
9462
  /**
9365
9463
  * Variant of the MD3 Time Picker.