@tinybigui/react 0.21.0 → 0.21.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
@@ -6796,13 +6796,19 @@ interface TooltipTriggerStyledProps {
6796
6796
  * machine so that tooltips fade/scale in on open and fade/scale out before
6797
6797
  * unmounting from the DOM, per MD3 motion specs.
6798
6798
  *
6799
- * Animation state machine:
6799
+ * When `prefers-reduced-motion: reduce` is active the overlay is unmounted
6800
+ * immediately on close — no exit animation, no `animationend` dependency.
6801
+ * This prevents the stuck-mount bug that occurs when the global CSS reset
6802
+ * collapses animations and `animationend` never fires.
6803
+ *
6804
+ * Animation state machine (standard motion):
6800
6805
  * 1. RA fires `onOpenChange(true)` → mount overlay, play entry animation
6801
6806
  * 2. RA fires `onOpenChange(false)` → keep mounted, play exit animation
6802
6807
  * 3. `animationend` fires → unmount overlay
6803
6808
  *
6804
- * The controlled `isOpen={isMounted}` prop passed to `TooltipTriggerHeadless`
6805
- * is what keeps the overlay alive during the exit animation phase.
6809
+ * Animation state machine (reduced motion):
6810
+ * 1. RA fires `onOpenChange(true)` → mount overlay, no animation
6811
+ * 2. RA fires `onOpenChange(false)` → unmount overlay immediately
6806
6812
  *
6807
6813
  * @example
6808
6814
  * ```tsx
@@ -6971,15 +6977,18 @@ interface TooltipHeadlessProps {
6971
6977
  * Renders a single-line text label with MD3 inverse-surface styling.
6972
6978
  * Animation is driven by the `TooltipAnimationContext` provided by
6973
6979
  * `TooltipTrigger`:
6974
- * - Entry: `animate-md-scale-in` (scale 0.85 + fade → natural)
6975
- * - Exit: `animate-md-scale-out` (natural scale 0.85 + fade)
6980
+ * - Entry: `animate-md-scale-in` (expressive-fast-spatial: 350ms, scale 0.85 → 1 + fade)
6981
+ * - Exit: `animate-md-scale-out` (emphasized-accelerate: 200ms, scale 1 → 0.85 + fade)
6982
+ * - None: no animation class when `prefers-reduced-motion: reduce` is active
6976
6983
  *
6977
6984
  * MD3 Tokens applied:
6978
- * - `bg-inverse-surface` — inverted surface for max contrast
6979
- * - `text-inverse-on-surface` — content color on inverted surface
6980
- * - `rounded-xs` — 4dp corner radius
6981
- * - `max-w-50` 200dp maximum width
6982
- * - `text-body-small` MD3 body-small typography
6985
+ * - `bg-inverse-surface` — inverted surface for maximum contrast
6986
+ * - `text-inverse-on-surface` — content colour on inverted surface
6987
+ * - `rounded-xs` — 4dp corner radius (CornerExtraSmall)
6988
+ * - `text-body-small` BodySmall typescale (12sp)
6989
+ * - `min-h-6` 24dp minimum height
6990
+ * - `max-w-50` — 200dp maximum width
6991
+ * - `px-2 py-1` — 8dp × 4dp padding
6983
6992
  *
6984
6993
  * Must be used as the second child of `TooltipTrigger`.
6985
6994
  *
@@ -6996,19 +7005,29 @@ declare const Tooltip: React$1.ForwardRefExoticComponent<TooltipProps & React$1.
6996
7005
  /**
6997
7006
  * `RichTooltip` — Layer 3 MD3 Rich Tooltip styled component.
6998
7007
  *
6999
- * Supports an optional title, multi-line supporting text, and an optional
7000
- * action button per MD3 Rich Tooltip specification.
7008
+ * Supports an optional title (subhead), multi-line supporting text, and an
7009
+ * optional action button per MD3 Rich Tooltip specification.
7001
7010
  * Animation is driven by the `TooltipAnimationContext` provided by
7002
7011
  * `TooltipTrigger`:
7003
- * - Entry: `animate-md-scale-in` (scale 0.85 + fade → natural)
7004
- * - Exit: `animate-md-scale-out` (natural → scale 0.85 + fade)
7005
- *
7006
- * MD3 Tokens applied:
7007
- * - `bg-surface-container` surface container background
7008
- * - `text-on-surface` content color on surface
7009
- * - `shadow-elevation-2` MD3 elevation level 2
7010
- * - `rounded-md` medium corner radius
7011
- * - `max-w-80` 320dp maximum width
7012
+ * - Entry: `animate-md-scale-in` (expressive-fast-spatial: 350ms)
7013
+ * - Exit: `animate-md-scale-out` (emphasized-accelerate: 200ms)
7014
+ * - None: no animation class when `prefers-reduced-motion: reduce` is active
7015
+ *
7016
+ * MD3 Tokens applied — container:
7017
+ * - `bg-surface-container` surface container background
7018
+ * - `text-on-surface` base content colour
7019
+ * - `shadow-elevation-2` MD3 elevation level 2
7020
+ * - `rounded-md` 12dp corner radius (CornerMedium)
7021
+ * - `max-w-80` — 320dp maximum width
7022
+ * - `px-4 py-3` — 16dp × 12dp padding
7023
+ *
7024
+ * MD3 Tokens applied — subhead (title):
7025
+ * - `text-title-small` — TitleSmall typescale
7026
+ * - `text-on-surface-variant` — subhead colour role per MD3 spec
7027
+ *
7028
+ * MD3 Tokens applied — supporting text:
7029
+ * - `text-body-medium` — BodyMedium typescale
7030
+ * - `text-on-surface-variant` — same colour role as subhead
7012
7031
  *
7013
7032
  * Must be used as the second child of `TooltipTrigger`.
7014
7033
  *
@@ -7091,46 +7110,50 @@ declare function TooltipTriggerHeadless({ children, delay, isDisabled, isOpen, d
7091
7110
  declare function TooltipOverlayHeadless({ tooltipProps: incomingTooltipProps, triggerRef, placement, offset, className, children, onPointerEnter, onPointerLeave, }: TooltipHeadlessProps): JSX$1.Element | null;
7092
7111
 
7093
7112
  /**
7094
- * Material Design 3 Plain Tooltip Variants (CVA)
7113
+ * Plain tooltip container.
7095
7114
  *
7096
- * Base tokens per MD3 spec:
7097
- * - bg-inverse-surface / text-inverse-on-surface — inverted surface for contrast
7098
- * - rounded-xs — 4dp corner radius (CornerExtraSmall)
7099
- * - min-h-6 — 24dp minimum height
7100
- * - max-w-50 — 200dp maximum width
7101
- * - w-fit — shrink-wrap to content width
7102
- * - px-2 py-1 — 8dp horizontal, 4dp vertical padding
7103
- * - text-body-small — MD3 BodySmall typography (12px)
7115
+ * Renders an inline-flex pill that vertically centres a single-line text label
7116
+ * against the 24dp minimum height.
7104
7117
  *
7105
- * `isVisible` drives the entry/exit animation class:
7106
- * - true → animate-md-scale-in (component entering with scale+fade)
7107
- * - false → animate-md-scale-out (component exiting with scale+fade)
7118
+ * MD3 Tokens:
7119
+ * - `bg-inverse-surface` — inverted surface for maximum contrast
7120
+ * - `text-inverse-on-surface` — content colour on inverted surface
7121
+ * - `rounded-xs` — 4dp corner radius (CornerExtraSmall)
7122
+ * - `text-body-small` — BodySmall typescale (12sp)
7123
+ * - `min-h-6` — 24dp minimum height
7124
+ * - `max-w-50` — 200dp maximum width
7125
+ * - `px-2 py-1` — 8dp × 4dp padding
7126
+ * - `z-50` — above all page content
7127
+ *
7128
+ * Motion:
7129
+ * - `enter` → `animate-md-scale-in` (expressive-fast-spatial: 350ms, scale 0.85 → 1 + fade)
7130
+ * - `exit` → `animate-md-scale-out` (emphasized-accelerate: 200ms, scale 1 → 0.85 + fade)
7131
+ * - `none` → no animation class (prefers-reduced-motion guard)
7108
7132
  */
7109
7133
  declare const tooltipVariants: (props?: ({
7110
- isVisible?: boolean | null | undefined;
7134
+ animation?: "none" | "enter" | "exit" | null | undefined;
7111
7135
  } & class_variance_authority_types.ClassProp) | undefined) => string;
7112
7136
  /**
7113
- * Material Design 3 Rich Tooltip Variants (CVA)
7137
+ * Rich tooltip container.
7138
+ *
7139
+ * Wraps the title, supporting text, and optional action row in a flex column.
7114
7140
  *
7115
- * Base tokens per MD3 spec:
7116
- * - bg-surface-container / text-on-surface — surface container background
7117
- * - shadow-elevation-2 MD3 elevation level 2
7118
- * - rounded-md 12dp corner radius (CornerMedium)
7119
- * - min-h-624dp minimum height
7120
- * - max-w-80 320dp maximum width
7121
- * - w-fitshrink-wrap to content width
7122
- * - px-4 py-3 — 16dp horizontal, 12dp vertical padding
7141
+ * MD3 Tokens:
7142
+ * - `bg-surface-container` — surface container background
7143
+ * - `text-on-surface` content colour on surface
7144
+ * - `shadow-elevation-2` MD3 elevation level 2
7145
+ * - `rounded-md`12dp corner radius (CornerMedium)
7146
+ * - `min-h-6` 24dp minimum height
7147
+ * - `max-w-80`320dp maximum width
7148
+ * - `px-4 py-3` — 16dp × 12dp padding
7149
+ * - `z-50` — above all page content
7123
7150
  *
7124
- * `isVisible` drives the entry/exit animation class:
7125
- * - true → animate-md-scale-in (component entering with scale+fade)
7126
- * - false → animate-md-scale-out (component exiting with scale+fade)
7151
+ * Motion: same `animation` variant as plain tooltip.
7127
7152
  */
7128
7153
  declare const richTooltipVariants: (props?: ({
7129
- isVisible?: boolean | null | undefined;
7154
+ animation?: "none" | "enter" | "exit" | null | undefined;
7130
7155
  } & class_variance_authority_types.ClassProp) | undefined) => string;
7131
- /** Variant prop types inferred from `tooltipVariants`. */
7132
7156
  type TooltipVariants = VariantProps<typeof tooltipVariants>;
7133
- /** Variant prop types inferred from `richTooltipVariants`. */
7134
7157
  type RichTooltipVariants = VariantProps<typeof richTooltipVariants>;
7135
7158
 
7136
7159
  /**
package/dist/index.d.ts CHANGED
@@ -6796,13 +6796,19 @@ interface TooltipTriggerStyledProps {
6796
6796
  * machine so that tooltips fade/scale in on open and fade/scale out before
6797
6797
  * unmounting from the DOM, per MD3 motion specs.
6798
6798
  *
6799
- * Animation state machine:
6799
+ * When `prefers-reduced-motion: reduce` is active the overlay is unmounted
6800
+ * immediately on close — no exit animation, no `animationend` dependency.
6801
+ * This prevents the stuck-mount bug that occurs when the global CSS reset
6802
+ * collapses animations and `animationend` never fires.
6803
+ *
6804
+ * Animation state machine (standard motion):
6800
6805
  * 1. RA fires `onOpenChange(true)` → mount overlay, play entry animation
6801
6806
  * 2. RA fires `onOpenChange(false)` → keep mounted, play exit animation
6802
6807
  * 3. `animationend` fires → unmount overlay
6803
6808
  *
6804
- * The controlled `isOpen={isMounted}` prop passed to `TooltipTriggerHeadless`
6805
- * is what keeps the overlay alive during the exit animation phase.
6809
+ * Animation state machine (reduced motion):
6810
+ * 1. RA fires `onOpenChange(true)` → mount overlay, no animation
6811
+ * 2. RA fires `onOpenChange(false)` → unmount overlay immediately
6806
6812
  *
6807
6813
  * @example
6808
6814
  * ```tsx
@@ -6971,15 +6977,18 @@ interface TooltipHeadlessProps {
6971
6977
  * Renders a single-line text label with MD3 inverse-surface styling.
6972
6978
  * Animation is driven by the `TooltipAnimationContext` provided by
6973
6979
  * `TooltipTrigger`:
6974
- * - Entry: `animate-md-scale-in` (scale 0.85 + fade → natural)
6975
- * - Exit: `animate-md-scale-out` (natural scale 0.85 + fade)
6980
+ * - Entry: `animate-md-scale-in` (expressive-fast-spatial: 350ms, scale 0.85 → 1 + fade)
6981
+ * - Exit: `animate-md-scale-out` (emphasized-accelerate: 200ms, scale 1 → 0.85 + fade)
6982
+ * - None: no animation class when `prefers-reduced-motion: reduce` is active
6976
6983
  *
6977
6984
  * MD3 Tokens applied:
6978
- * - `bg-inverse-surface` — inverted surface for max contrast
6979
- * - `text-inverse-on-surface` — content color on inverted surface
6980
- * - `rounded-xs` — 4dp corner radius
6981
- * - `max-w-50` 200dp maximum width
6982
- * - `text-body-small` MD3 body-small typography
6985
+ * - `bg-inverse-surface` — inverted surface for maximum contrast
6986
+ * - `text-inverse-on-surface` — content colour on inverted surface
6987
+ * - `rounded-xs` — 4dp corner radius (CornerExtraSmall)
6988
+ * - `text-body-small` BodySmall typescale (12sp)
6989
+ * - `min-h-6` 24dp minimum height
6990
+ * - `max-w-50` — 200dp maximum width
6991
+ * - `px-2 py-1` — 8dp × 4dp padding
6983
6992
  *
6984
6993
  * Must be used as the second child of `TooltipTrigger`.
6985
6994
  *
@@ -6996,19 +7005,29 @@ declare const Tooltip: React$1.ForwardRefExoticComponent<TooltipProps & React$1.
6996
7005
  /**
6997
7006
  * `RichTooltip` — Layer 3 MD3 Rich Tooltip styled component.
6998
7007
  *
6999
- * Supports an optional title, multi-line supporting text, and an optional
7000
- * action button per MD3 Rich Tooltip specification.
7008
+ * Supports an optional title (subhead), multi-line supporting text, and an
7009
+ * optional action button per MD3 Rich Tooltip specification.
7001
7010
  * Animation is driven by the `TooltipAnimationContext` provided by
7002
7011
  * `TooltipTrigger`:
7003
- * - Entry: `animate-md-scale-in` (scale 0.85 + fade → natural)
7004
- * - Exit: `animate-md-scale-out` (natural → scale 0.85 + fade)
7005
- *
7006
- * MD3 Tokens applied:
7007
- * - `bg-surface-container` surface container background
7008
- * - `text-on-surface` content color on surface
7009
- * - `shadow-elevation-2` MD3 elevation level 2
7010
- * - `rounded-md` medium corner radius
7011
- * - `max-w-80` 320dp maximum width
7012
+ * - Entry: `animate-md-scale-in` (expressive-fast-spatial: 350ms)
7013
+ * - Exit: `animate-md-scale-out` (emphasized-accelerate: 200ms)
7014
+ * - None: no animation class when `prefers-reduced-motion: reduce` is active
7015
+ *
7016
+ * MD3 Tokens applied — container:
7017
+ * - `bg-surface-container` surface container background
7018
+ * - `text-on-surface` base content colour
7019
+ * - `shadow-elevation-2` MD3 elevation level 2
7020
+ * - `rounded-md` 12dp corner radius (CornerMedium)
7021
+ * - `max-w-80` — 320dp maximum width
7022
+ * - `px-4 py-3` — 16dp × 12dp padding
7023
+ *
7024
+ * MD3 Tokens applied — subhead (title):
7025
+ * - `text-title-small` — TitleSmall typescale
7026
+ * - `text-on-surface-variant` — subhead colour role per MD3 spec
7027
+ *
7028
+ * MD3 Tokens applied — supporting text:
7029
+ * - `text-body-medium` — BodyMedium typescale
7030
+ * - `text-on-surface-variant` — same colour role as subhead
7012
7031
  *
7013
7032
  * Must be used as the second child of `TooltipTrigger`.
7014
7033
  *
@@ -7091,46 +7110,50 @@ declare function TooltipTriggerHeadless({ children, delay, isDisabled, isOpen, d
7091
7110
  declare function TooltipOverlayHeadless({ tooltipProps: incomingTooltipProps, triggerRef, placement, offset, className, children, onPointerEnter, onPointerLeave, }: TooltipHeadlessProps): JSX$1.Element | null;
7092
7111
 
7093
7112
  /**
7094
- * Material Design 3 Plain Tooltip Variants (CVA)
7113
+ * Plain tooltip container.
7095
7114
  *
7096
- * Base tokens per MD3 spec:
7097
- * - bg-inverse-surface / text-inverse-on-surface — inverted surface for contrast
7098
- * - rounded-xs — 4dp corner radius (CornerExtraSmall)
7099
- * - min-h-6 — 24dp minimum height
7100
- * - max-w-50 — 200dp maximum width
7101
- * - w-fit — shrink-wrap to content width
7102
- * - px-2 py-1 — 8dp horizontal, 4dp vertical padding
7103
- * - text-body-small — MD3 BodySmall typography (12px)
7115
+ * Renders an inline-flex pill that vertically centres a single-line text label
7116
+ * against the 24dp minimum height.
7104
7117
  *
7105
- * `isVisible` drives the entry/exit animation class:
7106
- * - true → animate-md-scale-in (component entering with scale+fade)
7107
- * - false → animate-md-scale-out (component exiting with scale+fade)
7118
+ * MD3 Tokens:
7119
+ * - `bg-inverse-surface` — inverted surface for maximum contrast
7120
+ * - `text-inverse-on-surface` — content colour on inverted surface
7121
+ * - `rounded-xs` — 4dp corner radius (CornerExtraSmall)
7122
+ * - `text-body-small` — BodySmall typescale (12sp)
7123
+ * - `min-h-6` — 24dp minimum height
7124
+ * - `max-w-50` — 200dp maximum width
7125
+ * - `px-2 py-1` — 8dp × 4dp padding
7126
+ * - `z-50` — above all page content
7127
+ *
7128
+ * Motion:
7129
+ * - `enter` → `animate-md-scale-in` (expressive-fast-spatial: 350ms, scale 0.85 → 1 + fade)
7130
+ * - `exit` → `animate-md-scale-out` (emphasized-accelerate: 200ms, scale 1 → 0.85 + fade)
7131
+ * - `none` → no animation class (prefers-reduced-motion guard)
7108
7132
  */
7109
7133
  declare const tooltipVariants: (props?: ({
7110
- isVisible?: boolean | null | undefined;
7134
+ animation?: "none" | "enter" | "exit" | null | undefined;
7111
7135
  } & class_variance_authority_types.ClassProp) | undefined) => string;
7112
7136
  /**
7113
- * Material Design 3 Rich Tooltip Variants (CVA)
7137
+ * Rich tooltip container.
7138
+ *
7139
+ * Wraps the title, supporting text, and optional action row in a flex column.
7114
7140
  *
7115
- * Base tokens per MD3 spec:
7116
- * - bg-surface-container / text-on-surface — surface container background
7117
- * - shadow-elevation-2 MD3 elevation level 2
7118
- * - rounded-md 12dp corner radius (CornerMedium)
7119
- * - min-h-624dp minimum height
7120
- * - max-w-80 320dp maximum width
7121
- * - w-fitshrink-wrap to content width
7122
- * - px-4 py-3 — 16dp horizontal, 12dp vertical padding
7141
+ * MD3 Tokens:
7142
+ * - `bg-surface-container` — surface container background
7143
+ * - `text-on-surface` content colour on surface
7144
+ * - `shadow-elevation-2` MD3 elevation level 2
7145
+ * - `rounded-md`12dp corner radius (CornerMedium)
7146
+ * - `min-h-6` 24dp minimum height
7147
+ * - `max-w-80`320dp maximum width
7148
+ * - `px-4 py-3` — 16dp × 12dp padding
7149
+ * - `z-50` — above all page content
7123
7150
  *
7124
- * `isVisible` drives the entry/exit animation class:
7125
- * - true → animate-md-scale-in (component entering with scale+fade)
7126
- * - false → animate-md-scale-out (component exiting with scale+fade)
7151
+ * Motion: same `animation` variant as plain tooltip.
7127
7152
  */
7128
7153
  declare const richTooltipVariants: (props?: ({
7129
- isVisible?: boolean | null | undefined;
7154
+ animation?: "none" | "enter" | "exit" | null | undefined;
7130
7155
  } & class_variance_authority_types.ClassProp) | undefined) => string;
7131
- /** Variant prop types inferred from `tooltipVariants`. */
7132
7156
  type TooltipVariants = VariantProps<typeof tooltipVariants>;
7133
- /** Variant prop types inferred from `richTooltipVariants`. */
7134
7157
  type RichTooltipVariants = VariantProps<typeof richTooltipVariants>;
7135
7158
 
7136
7159
  /**
package/dist/index.js CHANGED
@@ -8208,7 +8208,8 @@ function TooltipOverlayHeadless({
8208
8208
  }
8209
8209
  var TooltipAnimationContext = createContext({
8210
8210
  isExiting: false,
8211
- onAnimationEnd: () => void 0
8211
+ onAnimationEnd: () => void 0,
8212
+ reducedMotion: false
8212
8213
  });
8213
8214
  function useTooltipAnimation() {
8214
8215
  return useContext(TooltipAnimationContext);
@@ -8218,46 +8219,60 @@ function TooltipTrigger({
8218
8219
  delay = 300,
8219
8220
  isDisabled
8220
8221
  }) {
8222
+ const reducedMotion = useReducedMotion();
8221
8223
  const [isMounted, setIsMounted] = useState(false);
8222
8224
  const [isExiting, setIsExiting] = useState(false);
8223
8225
  const isExitingRef = useRef(false);
8224
8226
  const isPointerOverTooltipRef = useRef(false);
8225
8227
  const pendingCloseRef = useRef(false);
8226
- const handleOpenChange = useCallback((open) => {
8227
- if (open) {
8228
- pendingCloseRef.current = false;
8229
- isExitingRef.current = false;
8230
- setIsMounted(true);
8231
- setIsExiting(false);
8232
- } else if (isPointerOverTooltipRef.current) {
8233
- pendingCloseRef.current = true;
8234
- } else if (!isExitingRef.current) {
8235
- isExitingRef.current = true;
8236
- setIsExiting(true);
8237
- }
8238
- }, []);
8239
- const handleAnimationEnd = useCallback(() => {
8240
- if (!isExitingRef.current) return;
8228
+ const unmountImmediately = useCallback(() => {
8241
8229
  isExitingRef.current = false;
8242
8230
  pendingCloseRef.current = false;
8243
8231
  setIsMounted(false);
8244
8232
  setIsExiting(false);
8245
8233
  }, []);
8234
+ const handleOpenChange = useCallback(
8235
+ (open) => {
8236
+ if (open) {
8237
+ pendingCloseRef.current = false;
8238
+ isExitingRef.current = false;
8239
+ setIsMounted(true);
8240
+ setIsExiting(false);
8241
+ } else if (isPointerOverTooltipRef.current) {
8242
+ pendingCloseRef.current = true;
8243
+ } else if (reducedMotion) {
8244
+ unmountImmediately();
8245
+ } else if (!isExitingRef.current) {
8246
+ isExitingRef.current = true;
8247
+ setIsExiting(true);
8248
+ }
8249
+ },
8250
+ [reducedMotion, unmountImmediately]
8251
+ );
8252
+ const handleAnimationEnd = useCallback(() => {
8253
+ if (!isExitingRef.current) return;
8254
+ unmountImmediately();
8255
+ }, [unmountImmediately]);
8246
8256
  const handleOverlayPointerEnter = useCallback(() => {
8247
8257
  isPointerOverTooltipRef.current = true;
8248
8258
  pendingCloseRef.current = false;
8249
8259
  }, []);
8250
8260
  const handleOverlayPointerLeave = useCallback(() => {
8251
8261
  isPointerOverTooltipRef.current = false;
8252
- if (pendingCloseRef.current && !isExitingRef.current) {
8262
+ if (pendingCloseRef.current) {
8253
8263
  pendingCloseRef.current = false;
8254
- isExitingRef.current = true;
8255
- setIsExiting(true);
8264
+ if (reducedMotion) {
8265
+ unmountImmediately();
8266
+ } else if (!isExitingRef.current) {
8267
+ isExitingRef.current = true;
8268
+ setIsExiting(true);
8269
+ }
8256
8270
  }
8257
- }, []);
8271
+ }, [reducedMotion, unmountImmediately]);
8258
8272
  const contextValue = {
8259
8273
  isExiting,
8260
- onAnimationEnd: handleAnimationEnd
8274
+ onAnimationEnd: handleAnimationEnd,
8275
+ reducedMotion
8261
8276
  };
8262
8277
  const [triggerChild, tooltipChild] = children;
8263
8278
  const placement = isValidElement(tooltipChild) ? tooltipChild.props.placement ?? "top" : "top";
@@ -8286,51 +8301,69 @@ function TooltipTrigger({
8286
8301
  ) });
8287
8302
  }
8288
8303
  var tooltipVariants = cva(
8289
- "z-50 w-fit min-h-6 rounded-xs px-2 py-1 text-body-small bg-inverse-surface text-inverse-on-surface max-w-50",
8304
+ [
8305
+ "z-50 inline-flex items-center w-fit",
8306
+ "min-h-6 rounded-xs px-2 py-1",
8307
+ "text-body-small bg-inverse-surface text-inverse-on-surface",
8308
+ "max-w-50"
8309
+ ],
8290
8310
  {
8291
8311
  variants: {
8292
8312
  /**
8293
- * Drives the MD3 enter/exit animation class.
8313
+ * Controls the enter/exit animation class.
8294
8314
  * Managed by `TooltipTrigger`'s animation state machine.
8295
- * @default true
8315
+ * Set to `"none"` when `prefers-reduced-motion: reduce` is active.
8316
+ * @default "enter"
8296
8317
  */
8297
- isVisible: {
8298
- true: "animate-md-scale-in",
8299
- false: "animate-md-scale-out"
8318
+ animation: {
8319
+ enter: "animate-md-scale-in",
8320
+ exit: "animate-md-scale-out",
8321
+ none: ""
8300
8322
  }
8301
8323
  },
8302
8324
  defaultVariants: {
8303
- isVisible: true
8325
+ animation: "enter"
8304
8326
  }
8305
8327
  }
8306
8328
  );
8307
8329
  var richTooltipVariants = cva(
8308
- "z-50 w-fit min-h-6 rounded-md px-4 py-3 bg-surface-container text-on-surface shadow-elevation-2 max-w-80",
8330
+ [
8331
+ "z-50 flex flex-col w-fit",
8332
+ "min-h-6 rounded-md px-4 py-3",
8333
+ "bg-surface-container text-on-surface shadow-elevation-2",
8334
+ "max-w-80"
8335
+ ],
8309
8336
  {
8310
8337
  variants: {
8311
8338
  /**
8312
- * Drives the MD3 enter/exit animation class.
8339
+ * Controls the enter/exit animation class.
8313
8340
  * Managed by `TooltipTrigger`'s animation state machine.
8314
- * @default true
8341
+ * Set to `"none"` when `prefers-reduced-motion: reduce` is active.
8342
+ * @default "enter"
8315
8343
  */
8316
- isVisible: {
8317
- true: "animate-md-scale-in",
8318
- false: "animate-md-scale-out"
8344
+ animation: {
8345
+ enter: "animate-md-scale-in",
8346
+ exit: "animate-md-scale-out",
8347
+ none: ""
8319
8348
  }
8320
8349
  },
8321
8350
  defaultVariants: {
8322
- isVisible: true
8351
+ animation: "enter"
8323
8352
  }
8324
8353
  }
8325
8354
  );
8355
+ var richTooltipTitleVariants = cva(["text-title-small text-on-surface-variant mb-1"]);
8356
+ var richTooltipSupportingTextVariants = cva(["text-body-medium text-on-surface-variant"]);
8357
+ var richTooltipActionsVariants = cva(["flex items-center justify-start mt-3 -ml-2"]);
8326
8358
  var Tooltip = forwardRef(
8327
8359
  ({ children, className, placement: _placement }, ref) => {
8328
- const { isExiting, onAnimationEnd } = useTooltipAnimation();
8360
+ const { isExiting, onAnimationEnd, reducedMotion } = useTooltipAnimation();
8361
+ const animation = reducedMotion ? "none" : isExiting ? "exit" : "enter";
8329
8362
  return /* @__PURE__ */ jsx(
8330
8363
  "div",
8331
8364
  {
8332
8365
  ref,
8333
- className: cn(tooltipVariants({ isVisible: !isExiting }), className),
8366
+ className: cn(tooltipVariants({ animation }), className),
8334
8367
  onAnimationEnd,
8335
8368
  children
8336
8369
  }
@@ -8340,17 +8373,18 @@ var Tooltip = forwardRef(
8340
8373
  Tooltip.displayName = "Tooltip";
8341
8374
  var RichTooltip = forwardRef(
8342
8375
  ({ title, children, action, className, placement: _placement }, ref) => {
8343
- const { isExiting, onAnimationEnd } = useTooltipAnimation();
8376
+ const { isExiting, onAnimationEnd, reducedMotion } = useTooltipAnimation();
8377
+ const animation = reducedMotion ? "none" : isExiting ? "exit" : "enter";
8344
8378
  return /* @__PURE__ */ jsxs(
8345
8379
  "div",
8346
8380
  {
8347
8381
  ref,
8348
- className: cn(richTooltipVariants({ isVisible: !isExiting }), className),
8382
+ className: cn(richTooltipVariants({ animation }), className),
8349
8383
  onAnimationEnd,
8350
8384
  children: [
8351
- title && /* @__PURE__ */ jsx("p", { className: "text-on-surface text-title-small mb-1", children: title }),
8352
- /* @__PURE__ */ jsx("p", { className: "text-on-surface-variant text-body-medium", children }),
8353
- action
8385
+ title && /* @__PURE__ */ jsx("p", { className: richTooltipTitleVariants(), children: title }),
8386
+ /* @__PURE__ */ jsx("p", { className: richTooltipSupportingTextVariants(), children }),
8387
+ action && /* @__PURE__ */ jsx("div", { className: richTooltipActionsVariants(), children: action })
8354
8388
  ]
8355
8389
  }
8356
8390
  );