@tinybigui/react 0.18.0 → 0.20.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
@@ -5477,10 +5477,19 @@ type SnackbarSeverity = "default" | "error";
5477
5477
  /**
5478
5478
  * Internal animation state machine for the Snackbar.
5479
5479
  *
5480
- * - `entering` → zoom-in start: scale-75 + opacity-0 (no duration, paints before transition)
5481
- * - `visible` → scale-100 + opacity-100 (medium1 / standard-decelerate = 250ms)
5482
- * - `exiting` → scale-75 + opacity-0 (short4 / standard-accelerate = 200ms)
5480
+ * - `entering` → initial paint: opacity-0 + directional translate offset (no duration)
5481
+ * - `visible` → slide in + fade in: translate-y-0 + opacity-100
5482
+ * (spring-standard-default-effects = 200ms, no overshoot)
5483
+ * - `exiting` → slide out + fade out: offset + opacity-0
5484
+ * (spring-standard-fast-effects = 150ms)
5483
5485
  * - `exited` → removed from DOM / stack updated
5486
+ *
5487
+ * The translate direction is position-aware:
5488
+ * bottom positions → slide up from below (translate-y-3 → translate-y-0)
5489
+ * top positions → slide down from above (-translate-y-3 → translate-y-0)
5490
+ *
5491
+ * When `prefers-reduced-motion` is active, the translate offset is suppressed
5492
+ * and only opacity transitions (fade-only).
5484
5493
  */
5485
5494
  type SnackbarAnimationState = "entering" | "visible" | "exiting" | "exited";
5486
5495
  /**
@@ -5679,14 +5688,23 @@ interface SnackbarProviderProps {
5679
5688
  * Renders one of four MD3 Snackbar content configurations:
5680
5689
  * 1. Single-line message only
5681
5690
  * 2. Two-line message + `supportingText`
5682
- * 3. Single-line with text `action` button (styled `Button variant="text"` with
5683
- * `inverse-primary` color per MD3 spec)
5691
+ * 3. Single-line with text `action` button (styled with `inverse-primary` per MD3 spec)
5684
5692
  * 4. Single-line with close icon (or combined with action)
5685
5693
  *
5686
5694
  * Uses `SnackbarHeadless` for all behavioral concerns (ARIA live region,
5687
5695
  * auto-dismiss timer with pause/resume, animation state machine) and CVA
5688
5696
  * variants for MD3-compliant visual styling.
5689
5697
  *
5698
+ * **Motion**: Position-aware slide + fade using spring-standard effects tokens.
5699
+ * Automatically respects `prefers-reduced-motion` (fade-only when reduced motion
5700
+ * is preferred — no translate offset).
5701
+ *
5702
+ * **State layers**: Dedicated slot components (`SnackbarActionButton`,
5703
+ * `SnackbarCloseButton`) replace the shared `Button`/`IconButton` components.
5704
+ * This ensures the state-layer colors are MD3-correct on an `inverse-surface`:
5705
+ * - Action button state layer: `bg-inverse-primary`
5706
+ * - Close button state layer: `bg-inverse-on-surface`
5707
+ *
5690
5708
  * For typical app usage, render inside `SnackbarProvider` and trigger via
5691
5709
  * the `useSnackbar` hook. For declarative/test usage, it can be rendered
5692
5710
  * standalone.
@@ -8845,6 +8863,26 @@ type SliderOrientation = "horizontal" | "vertical";
8845
8863
  * @example ['Min price', 'Max price']
8846
8864
  */
8847
8865
  type SliderRangeThumbLabels = [string, string];
8866
+ /**
8867
+ * Render state provided to `renderThumbContent` for each thumb slot.
8868
+ *
8869
+ * The styled layer (`Slider`) uses this to render the visual handle,
8870
+ * state layer, and value indicator inside the React Aria thumb element.
8871
+ */
8872
+ interface SliderThumbRenderState {
8873
+ /** Zero-based index of this thumb (0 for single-thumb, 0 or 1 for range). */
8874
+ index: number;
8875
+ /** Current numeric value of this thumb (from React Stately state). */
8876
+ value: number;
8877
+ /** Whether this thumb is currently being dragged (pointer down). */
8878
+ isDragging: boolean;
8879
+ /** Whether keyboard focus ring is visible on this thumb. */
8880
+ isFocusVisible: boolean;
8881
+ /** Whether pointer is hovering over this thumb. */
8882
+ isHovered: boolean;
8883
+ /** Whether the slider is disabled. */
8884
+ isDisabled: boolean;
8885
+ }
8848
8886
  /**
8849
8887
  * Props for the headless `SliderHeadless` primitive (Layer 2).
8850
8888
  *
@@ -8949,10 +8987,33 @@ interface SliderHeadlessProps {
8949
8987
  */
8950
8988
  isDisabled?: boolean;
8951
8989
  /**
8952
- * Content (children) rendered inside the slider container.
8953
- * Used by the styled layer to inject track, handle, stops, etc.
8990
+ * Content (children) rendered inside the slider track element.
8991
+ * Used by the styled layer to inject track layout.
8954
8992
  */
8955
8993
  children?: React__default.ReactNode;
8994
+ /**
8995
+ * CSS classes applied to the `data-track` region element.
8996
+ * The styled layer uses this to carry the size-based height/width and
8997
+ * `touch-none` on the element React Aria measures for pointer math.
8998
+ * When omitted, the track region defaults to `relative w-full`.
8999
+ */
9000
+ trackClassName?: string;
9001
+ /**
9002
+ * Render prop called for each thumb to produce visual thumb content
9003
+ * (handle, state layer, value indicator). Receives the thumb's current
9004
+ * render state. When provided, visual content is rendered inside the
9005
+ * React Aria thumb element (which is absolutely positioned at the value %).
9006
+ *
9007
+ * Used by the styled `Slider` layer; advanced users of `SliderHeadless`
9008
+ * may supply custom thumb visuals.
9009
+ */
9010
+ renderThumbContent?: (state: SliderThumbRenderState) => React__default.ReactNode;
9011
+ /**
9012
+ * Called when any thumb's dragging state changes.
9013
+ * Receives the thumb index and a boolean indicating whether it is dragging.
9014
+ * Used by the styled layer to suppress track animation during pointer drag.
9015
+ */
9016
+ onThumbDraggingChange?: (index: number, isDragging: boolean) => void;
8956
9017
  /**
8957
9018
  * Additional CSS classes applied to the slider root element.
8958
9019
  */
@@ -9046,7 +9107,7 @@ interface SliderThumbProps {
9046
9107
  * />
9047
9108
  * ```
9048
9109
  */
9049
- interface SliderProps extends Omit<SliderHeadlessProps, "children"> {
9110
+ interface SliderProps extends Omit<SliderHeadlessProps, "children" | "renderThumbContent" | "onThumbDraggingChange"> {
9050
9111
  /**
9051
9112
  * MD3 Expressive size preset.
9052
9113
  * Controls track height, handle height, corner radius, and icon size.
@@ -9077,7 +9138,11 @@ interface SliderProps extends Omit<SliderHeadlessProps, "children"> {
9077
9138
  }
9078
9139
  /**
9079
9140
  * Interactive state of a slider thumb.
9080
- * Used internally by the styled layer for state-dependent styling.
9141
+ *
9142
+ * @deprecated The styled Slider now drives interaction states via React Aria
9143
+ * hooks + `data-*` attributes (group-data-[x]/slider-thumb selectors) instead
9144
+ * of a manual state machine. This type is retained only for backwards
9145
+ * compatibility with existing usages of `SliderHeadlessProps`.
9081
9146
  *
9082
9147
  * @internal
9083
9148
  */
@@ -9085,6 +9150,10 @@ type SliderThumbState = "enabled" | "hovered" | "pressed" | "disabled";
9085
9150
  /**
9086
9151
  * Render state passed to internal sub-components for conditional styling.
9087
9152
  *
9153
+ * @deprecated The styled Slider now uses `SliderThumbRenderState` (per-thumb
9154
+ * render state) provided by the `renderThumbContent` render prop. This type
9155
+ * is retained only for backwards compatibility.
9156
+ *
9088
9157
  * @internal
9089
9158
  */
9090
9159
  interface SliderRenderState {
@@ -9103,15 +9172,31 @@ interface SliderRenderState {
9103
9172
  /**
9104
9173
  * Material Design 3 Slider Component (Layer 3: Styled)
9105
9174
  *
9106
- * Wraps SliderHeadless with CVA styling for all five MD3 Expressive sizes.
9107
- * Renders the visual track layout (active track → handle → inactive track) as
9108
- * children inside the headless track element.
9109
- *
9175
+ * Wraps `SliderHeadless` with CVA styling for all five MD3 Expressive sizes.
9176
+ * Renders the visual track layout (active/inactive tracks) as children inside
9177
+ * the headless track element. The visual handle, state layer, and value indicator
9178
+ * are rendered as children of the React Aria thumb element via `renderThumbContent`,
9179
+ * which positions them exactly at the value percentage.
9180
+ *
9181
+ * **Architecture (Variants-vs-States)**
9182
+ * - Interaction states (hover, pressed/dragging, disabled, focus) are driven by
9183
+ * React Aria hooks → `getInteractionDataAttributes` → `data-*` on the RA thumb
9184
+ * (`group/slider-thumb`) → `group-data-[x]/slider-thumb:*` CSS selectors.
9185
+ * - No manual pointer state machine — React Aria's `isDragging`, `isHovered`,
9186
+ * and `isFocusVisible` are the single source of truth.
9187
+ * - Disabled track/stop colors use `group-data-[disabled]/slider:*` selectors
9188
+ * from the root `group/slider` scope.
9189
+ *
9190
+ * **Geometry (documented inline-style exception)**
9110
9191
  * Track widths are driven by runtime values and use inline `flexBasis` styles —
9111
9192
  * a documented exception for geometry that cannot be expressed as design tokens.
9112
9193
  *
9113
- * Motion: MD3 Appendix E token pairings applied; JS-driven animations are
9114
- * guarded with `useReducedMotion()`.
9194
+ * **Motion**
9195
+ * - Track fill: spring-standard-fast-spatial (suppressed during drag + reduced motion)
9196
+ * - Handle width: spring-standard-fast-spatial (suppressed for reduced motion)
9197
+ * - State layer opacity: spring-standard-fast-effects (always present; CSS media
9198
+ * query handles `prefers-reduced-motion` for CSS-driven changes)
9199
+ * - Value indicator: spring-standard-fast-spatial (suppressed for reduced motion)
9115
9200
  *
9116
9201
  * @example
9117
9202
  * ```tsx
@@ -9143,6 +9228,8 @@ declare const Slider: React__default.ForwardRefExoticComponent<SliderProps & Rea
9143
9228
  * - Discrete stepping support
9144
9229
  * - Live value announcements via <output>
9145
9230
  * - data-* attributes for styled layer targeting
9231
+ * - `group/slider-thumb` scope on each thumb for group-data CSS selectors
9232
+ * - `renderThumbContent` render prop for injecting visual content inside RA thumb
9146
9233
  *
9147
9234
  * @example
9148
9235
  * ```tsx
@@ -9161,81 +9248,98 @@ declare const Slider: React__default.ForwardRefExoticComponent<SliderProps & Rea
9161
9248
  declare const SliderHeadless: React__default.ForwardRefExoticComponent<SliderHeadlessProps & React__default.RefAttributes<HTMLDivElement>>;
9162
9249
 
9163
9250
  /**
9164
- * CVA variants for the Slider container (root element — the `role="group"` div).
9251
+ * Slider root container variants.
9252
+ *
9253
+ * The root element carries:
9254
+ * - `group/slider` — scope for track/stop disabled-state selectors
9255
+ * (`group-data-[disabled]/slider:*`)
9165
9256
  *
9166
- * MD3 spec §4.2: Container height equals handle height for each size.
9167
- * MD3 spec §4.1, §10.9: In vertical orientation, container width = handle height (dimensions transposed).
9168
- * Applied via className on SliderHeadless so the groupProps div receives these classes.
9257
+ * Horizontal layout: CSS grid with label (col 1) + output (col 2) in the first
9258
+ * row, and the full-width track region spanning both columns in the second row.
9259
+ * This matches the canonical React Aria / MD3 layout and prevents the track
9260
+ * from collapsing when label + output are inline siblings.
9261
+ *
9262
+ * Vertical layout: flex-col so label is above the track.
9263
+ * The size-based HEIGHT lives on the track region, not here (the container is
9264
+ * auto-height in horizontal so it wraps the grid rows naturally).
9169
9265
  */
9170
9266
  declare const sliderContainerVariants: (props?: ({
9171
- size?: "small" | "large" | "medium" | "xsmall" | "xlarge" | null | undefined;
9172
9267
  orientation?: "vertical" | "horizontal" | null | undefined;
9173
- disabled?: boolean | null | undefined;
9268
+ size?: "small" | "large" | "medium" | "xsmall" | "xlarge" | null | undefined;
9174
9269
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9175
9270
  /**
9176
- * CVA for the active track (filled portion).
9271
+ * Absolute-fill container that holds the active and inactive track segments.
9272
+ *
9273
+ * Segments are `position: absolute` children sharing the same percentage
9274
+ * coordinate space as the React Aria thumbs, so fills always align with
9275
+ * handle positions regardless of value or orientation.
9276
+ *
9277
+ * The MD3 6dp thumb-track gap (`thumbTrackGapSize`) is applied as a symmetric
9278
+ * 3px offset on each side of the thumb in the parent's inline position styles.
9279
+ *
9280
+ * `pointer-events-none` lets React Aria's track click-to-seek events
9281
+ * reach the `data-track` region without interference.
9282
+ */
9283
+ declare const sliderTrackLayoutVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
9284
+ /**
9285
+ * The filled (active) portion of the slider track.
9286
+ *
9287
+ * **Color**: `bg-primary`
9288
+ * **Disabled**: driven by `group-data-[disabled]/slider:*` — no CVA disabled variant.
9289
+ * **Transition**: `flex-basis` spring (spatial) when not dragging/reduced-motion.
9177
9290
  *
9178
- * MD3 spec §6, §8.1, §10.2: `bg-primary`, size-dependent outer corners, 2dp inner corners.
9179
- * Inner corner (near handle) is always 2dp regardless of size.
9180
- * MD3 spec §10.9: In vertical orientation, track thickness becomes width (not height).
9181
- * Transition: flex-basis spatial spring (md3-motion spring-standard-fast-spatial).
9291
+ * MD3 §6, §10.2: outer corner = size corner token, inner corner (near handle) = 2dp.
9292
+ * NOTE: measurement-derived corner values from MD3 spec §6; permitted exception.
9182
9293
  */
9183
9294
  declare const sliderActiveTrackVariants: (props?: ({
9184
9295
  size?: "small" | "large" | "medium" | "xsmall" | "xlarge" | null | undefined;
9185
9296
  orientation?: "vertical" | "horizontal" | null | undefined;
9186
- disabled?: boolean | null | undefined;
9187
9297
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9188
9298
  /**
9189
- * CVA for the inactive track (unfilled portion).
9299
+ * The unfilled (inactive) portion of the slider track.
9300
+ *
9301
+ * **Color**: `bg-secondary-container`
9302
+ * **Disabled**: driven by `group-data-[disabled]/slider:*` — no CVA disabled variant.
9190
9303
  *
9191
- * MD3 spec §6, §8.1, §10.2: `bg-secondary-container`, 2dp inner corners, size-dependent outer corners.
9192
- * MD3 spec §10.9: In vertical orientation, track thickness becomes width (not height).
9193
- * Disabled: `bg-on-surface` at 10% opacity via Tailwind alpha modifier.
9304
+ * MD3 §6, §10.2: inner corner (near handle) = 2dp, outer corner = size corner token.
9305
+ * NOTE: measurement-derived corner values from MD3 spec §6; permitted exception.
9194
9306
  */
9195
9307
  declare const sliderInactiveTrackVariants: (props?: ({
9196
9308
  size?: "small" | "large" | "medium" | "xsmall" | "xlarge" | null | undefined;
9197
9309
  orientation?: "vertical" | "horizontal" | null | undefined;
9198
- disabled?: boolean | null | undefined;
9199
9310
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9200
9311
  /**
9201
- * CVA for the handle/thumb element.
9312
+ * Visual handle (thumb indicator) element inside the React Aria thumb container.
9202
9313
  *
9203
- * MD3 spec §6, §9, §10.3: 4dp wide, full container height, 2dp border-radius.
9204
- * MD3 spec §10.9: In vertical orientation, width and height are transposed
9205
- * handle becomes 4dp tall (main axis) × full width (cross axis).
9206
- * Width narrows to 2dp on press (md3 spec §9.3).
9207
- * Motion: transition-[width] with duration-short2 + ease-standard applied conditionally
9208
- * in Slider.tsx based on useReducedMotion() guard (MD3 Appendix E).
9314
+ * **Architecture**: This element lives inside the `group/slider-thumb` scope (the
9315
+ * RA-positioned thumb div). All interaction states are driven by
9316
+ * `group-data-[x]/slider-thumb:*` selectors no CVA interaction-state variants.
9317
+ *
9318
+ * **Pressed width**: `group-data-[pressed]/slider-thumb:w-[2px]` (4dp 2dp, MD3 spec)
9319
+ * **Motion**: `transition-[width]` with spring-standard-fast-spatial tokens.
9320
+ * Applied conditionally in `Slider.tsx` (suppressed for `useReducedMotion()`).
9209
9321
  */
9210
9322
  declare const sliderHandleVariants: (props?: ({
9211
9323
  size?: "small" | "large" | "medium" | "xsmall" | "xlarge" | null | undefined;
9212
9324
  orientation?: "vertical" | "horizontal" | null | undefined;
9213
- pressed?: boolean | null | undefined;
9214
- disabled?: boolean | null | undefined;
9215
9325
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9216
9326
  /**
9217
- * CVA for the handle's state layer overlay.
9327
+ * State layer overlay on the handle (hover ripple).
9218
9328
  *
9219
- * MD3 spec §8.3: Inset overlay within the handle.
9220
- * - Hover: on-primary at 8% opacity
9221
- * - Focus/Pressed: on-primary at 10% opacity
9222
- * Motion: transition-opacity with duration-short1 + ease-standard applied conditionally
9223
- * in Slider.tsx based on useReducedMotion() guard (MD3 Appendix E).
9224
- */
9225
- declare const sliderHandleStateLayerVariants: (props?: ({
9226
- state?: "disabled" | "enabled" | "hovered" | "pressed" | "focused" | null | undefined;
9227
- } & class_variance_authority_types.ClassProp) | undefined) => string;
9228
- /**
9229
- * CVA for the track layout container (holds active track + handle + inactive track).
9329
+ * **Architecture**: Lives inside `group/slider-thumb`; opacity driven entirely
9330
+ * by `group-data-[x]/slider-thumb:opacity-*` selectors no CVA state variant.
9331
+ *
9332
+ * State-layer opacities per MD3 spec:
9333
+ * - hover: 8% (`opacity-8`)
9334
+ * - focused: 10% (`opacity-10`)
9335
+ * - pressed: 10% (`opacity-10`)
9336
+ * - dragged: 16% (`opacity-16`) note: drag = pressed in RA isDragging data-pressed
9230
9337
  *
9231
- * MD3 spec §7, §10.2: Flex row with 6dp gap between handle and track segments.
9232
- * The 6dp gap is the `thumbTrackGapSize` token from MD3 spec.
9233
- * MD3 spec §10.9: Vertical orientation uses flex-col-reverse for bottom-to-top fill.
9234
- * `relative` is required so the absolute stops overlay is positioned within.
9338
+ * **Motion**: `transition-opacity` with spring-standard-fast-effects tokens.
9339
+ * Always present; `@media prefers-reduced-motion` suppresses the transition at
9340
+ * the CSS level.
9235
9341
  */
9236
- declare const sliderTrackLayoutVariants: (props?: ({
9237
- orientation?: "vertical" | "horizontal" | null | undefined;
9238
- } & class_variance_authority_types.ClassProp) | undefined) => string;
9342
+ declare const sliderHandleStateLayerVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
9239
9343
 
9240
9344
  /**
9241
9345
  * Structural variant of the MD3 Bottom Sheet.