@bug-on/m3-expressive 1.3.6 → 1.3.7
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/CHANGELOG.md +6 -0
- package/dist/buttons.d.mts +3 -3
- package/dist/buttons.d.ts +3 -3
- package/dist/buttons.js +110 -91
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +110 -91
- package/dist/buttons.mjs.map +1 -1
- package/dist/{core-Cckt8qEm.d.ts → core-DamhB5Yd.d.ts} +1 -1
- package/dist/{core-DDfG4pym.d.mts → core-Wsfqn9_N.d.mts} +1 -1
- package/dist/core.d.mts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +1 -1
- package/dist/core.mjs.map +1 -1
- package/dist/{fading-blur-mask--uZbBKLj.d.ts → fading-blur-mask-CX-bwjNU.d.mts} +6 -1
- package/dist/{fading-blur-mask--uZbBKLj.d.mts → fading-blur-mask-D57UMguz.d.ts} +6 -1
- package/dist/feedback.d.mts +17 -5
- package/dist/feedback.d.ts +17 -5
- package/dist/feedback.js +1 -1
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +1 -1
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +3 -3
- package/dist/forms.d.ts +3 -3
- package/dist/{icon-button-CxyJv7UV.d.mts → icon-button-BpX9_fwZ.d.mts} +1 -1
- package/dist/{icon-button-Di8VX6ou.d.ts → icon-button-DFXp9hze.d.ts} +1 -1
- package/dist/index.d.mts +9 -8
- package/dist/index.d.ts +9 -8
- package/dist/index.js +1098 -976
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +924 -802
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +92 -23
- package/dist/layout.d.ts +92 -23
- package/dist/layout.js +118 -13
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +118 -15
- package/dist/layout.mjs.map +1 -1
- package/dist/md3-xBl4wgND.d.mts +44 -0
- package/dist/md3-xBl4wgND.d.ts +44 -0
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.js +1 -1
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +1 -1
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.d.mts +4 -4
- package/dist/overlays.d.ts +4 -4
- package/dist/overlays.js +1 -1
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +1 -1
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +1 -1
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +1 -1
- package/dist/pickers.mjs.map +1 -1
- package/dist/shapes.d.mts +9 -2
- package/dist/shapes.d.ts +9 -2
- package/dist/{side-sheet-modal-Cw4vemKx.d.ts → side-sheet-modal-BfdgYjd3.d.ts} +1 -1
- package/dist/{side-sheet-modal-BycxrabB.d.mts → side-sheet-modal-kLfHINFZ.d.mts} +1 -1
- package/dist/{split-button-trailing-uncheckable-CGzk7KcG.d.ts → split-button-trailing-uncheckable-BpyIlOdn.d.ts} +7 -3
- package/dist/{split-button-trailing-uncheckable-gAz6OAIi.d.mts → split-button-trailing-uncheckable-CpT8iPpr.d.mts} +7 -3
- package/dist/{text-field-C0VQLp8Y.d.ts → text-field-Ct-LT_2T.d.ts} +1 -1
- package/dist/{text-field-B1fLh5Sh.d.mts → text-field-D5xiGn-q.d.mts} +1 -1
- package/llms-full.txt +18 -3
- package/llms.txt +4 -1
- package/package.json +1 -1
- package/dist/md3-BQhRygSi.d.mts +0 -31
- package/dist/md3-BQhRygSi.d.ts +0 -31
package/dist/layout.d.mts
CHANGED
|
@@ -2,33 +2,16 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
|
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import React__default, { HTMLAttributes, ReactNode } from 'react';
|
|
4
4
|
import { HTMLMotionProps } from 'motion/react';
|
|
5
|
+
import * as _bug_on_m3_tokens from '@bug-on/m3-tokens';
|
|
5
6
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
7
|
import { b as ScrollAreaProps } from './scroll-area-CVS6HyLl.mjs';
|
|
7
8
|
export { S as ScrollArea, a as ScrollAreaOrientation, c as ScrollAreaScrollbar, d as ScrollAreaType } from './scroll-area-CVS6HyLl.mjs';
|
|
8
|
-
export { F as FadingBlurDirection, a as FadingBlurMask, b as FadingBlurMaskProps, c as FadingBlurProps } from './fading-blur-mask
|
|
9
|
+
export { F as FadingBlurDirection, a as FadingBlurMask, b as FadingBlurMaskProps, c as FadingBlurProps } from './fading-blur-mask-CX-bwjNU.mjs';
|
|
9
10
|
import { VariantProps } from 'class-variance-authority';
|
|
11
|
+
import { a as MD3ColorToken } from './md3-xBl4wgND.mjs';
|
|
10
12
|
export { D as DEFAULT_FONT_VARIATION_AXES, F as FontVariationAxes, M as MD3_EXPRESSIVE_FONT_VARIATION, T as TextStyle, a as Typography, b as TypographyContext, c as TypographyKeyTokens, d as TypographyProvider, e as TypographyProviderProps, f as TypographyTokens, g as TypographyTokensOptions, s as serializeFontVariationAxes, u as useTypography } from './typography-CKTjvlZ4.mjs';
|
|
11
13
|
import '@radix-ui/react-scroll-area';
|
|
12
14
|
|
|
13
|
-
/**
|
|
14
|
-
* @file card-tokens.ts
|
|
15
|
-
*
|
|
16
|
-
* MD3 Expressive Card Elevation & Motion Tokens.
|
|
17
|
-
*
|
|
18
|
-
* Elevation levels translated from:
|
|
19
|
-
* - ElevatedCardTokens.kt
|
|
20
|
-
* - FilledCardTokens.kt
|
|
21
|
-
* - OutlinedCardTokens.kt
|
|
22
|
-
* - Elevation.kt
|
|
23
|
-
*
|
|
24
|
-
* Elevation Levels:
|
|
25
|
-
* - Level 0: 0dp (Flat - "none")
|
|
26
|
-
* - Level 1: 1dp (Slight elevation - Elevated rest)
|
|
27
|
-
* - Level 2: 3dp (Hover / Focus elevation for Elevated, Hover for Filled/Outlined)
|
|
28
|
-
* - Level 3: 6dp (Dragged state elevation)
|
|
29
|
-
* - Level 4: 8dp (Pickers/Popups elevation)
|
|
30
|
-
* - Level 5: 12dp (Modals/Dialogs elevation)
|
|
31
|
-
*/
|
|
32
15
|
declare const SHADOW: {
|
|
33
16
|
readonly level0: "none";
|
|
34
17
|
readonly level1: "0px 1px 2px 0px rgba(0,0,0,.3), 0px 1px 3px 1px rgba(0,0,0,.15)";
|
|
@@ -114,6 +97,45 @@ declare function useCardElevation({ variant, disabled, draggable, elevation, dis
|
|
|
114
97
|
};
|
|
115
98
|
};
|
|
116
99
|
};
|
|
100
|
+
/**
|
|
101
|
+
* Resolves a `MorphRadiusLevel` key or raw number to a pixel CSS string.
|
|
102
|
+
* When `level === "full"`, optionally caps at `maxPillRadius` (half of element dimension)
|
|
103
|
+
* to avoid spring animation visual dead-zones caused by the generic 9999px token.
|
|
104
|
+
*/
|
|
105
|
+
declare function resolveCornerRadius(level: MorphRadiusLevel | number | undefined, fallback: number, maxPillRadius?: number): string;
|
|
106
|
+
interface CardMorphRadiusOptions {
|
|
107
|
+
morphRadius?: boolean | MorphRadiusConfig;
|
|
108
|
+
disabled?: boolean;
|
|
109
|
+
isInteractive?: boolean;
|
|
110
|
+
isForceMotion?: boolean;
|
|
111
|
+
hoverEffect?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Measured radius (px) that perfectly forms a pill shape for this container.
|
|
114
|
+
* Eliminates visual delay when unhovering cards with `full` radius.
|
|
115
|
+
*/
|
|
116
|
+
maxPillRadius?: number;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Hook: Card Morphing Border Radius Animation
|
|
120
|
+
* Calculates spring-animated border-radius states based on interaction flags and MD3 spatial spring physics.
|
|
121
|
+
*/
|
|
122
|
+
declare function useCardMorphRadius({ morphRadius, disabled, isInteractive, isForceMotion, hoverEffect, maxPillRadius, }: CardMorphRadiusOptions): {
|
|
123
|
+
animate: {
|
|
124
|
+
borderRadius: string;
|
|
125
|
+
};
|
|
126
|
+
whileHover: {
|
|
127
|
+
borderRadius: string;
|
|
128
|
+
} | undefined;
|
|
129
|
+
whileTap: {
|
|
130
|
+
borderRadius: string;
|
|
131
|
+
} | undefined;
|
|
132
|
+
whileFocus: {
|
|
133
|
+
borderRadius: string;
|
|
134
|
+
} | undefined;
|
|
135
|
+
transition: {
|
|
136
|
+
borderRadius: _bug_on_m3_tokens.FramerSpring;
|
|
137
|
+
};
|
|
138
|
+
} | null;
|
|
117
139
|
|
|
118
140
|
/**
|
|
119
141
|
* @file types.ts
|
|
@@ -121,6 +143,33 @@ declare function useCardElevation({ variant, disabled, draggable, elevation, dis
|
|
|
121
143
|
* Types and interfaces for the MD3 Expressive Card system.
|
|
122
144
|
*/
|
|
123
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Valid corner radius scale levels defined in MD3 Expressive.
|
|
148
|
+
*/
|
|
149
|
+
type MorphRadiusLevel = "none" | "extraSmall" | "small" | "medium" | "large" | "largeIncreased" | "extraLarge" | "extraLargeIncreased" | "extraExtraLarge" | "full";
|
|
150
|
+
/**
|
|
151
|
+
* Granular configuration for interactive border-radius morphing.
|
|
152
|
+
*/
|
|
153
|
+
interface MorphRadiusConfig {
|
|
154
|
+
/**
|
|
155
|
+
* Resting border radius.
|
|
156
|
+
* Can be a preset `MorphRadiusLevel` key or a raw pixel number.
|
|
157
|
+
* @default "large" (16px)
|
|
158
|
+
*/
|
|
159
|
+
rest?: MorphRadiusLevel | number;
|
|
160
|
+
/**
|
|
161
|
+
* Hover border radius.
|
|
162
|
+
* Can be a preset `MorphRadiusLevel` key or a raw pixel number.
|
|
163
|
+
* @default "extraLarge" (28px)
|
|
164
|
+
*/
|
|
165
|
+
hover?: MorphRadiusLevel | number;
|
|
166
|
+
/**
|
|
167
|
+
* Pressed / tap border radius.
|
|
168
|
+
* Can be a preset `MorphRadiusLevel` key or a raw pixel number.
|
|
169
|
+
* @default same as rest
|
|
170
|
+
*/
|
|
171
|
+
pressed?: MorphRadiusLevel | number;
|
|
172
|
+
}
|
|
124
173
|
type MotionDivProps = Omit<HTMLMotionProps<"button">, "children" | "color">;
|
|
125
174
|
interface CardProps extends MotionDivProps {
|
|
126
175
|
/**
|
|
@@ -207,6 +256,22 @@ interface CardProps extends MotionDivProps {
|
|
|
207
256
|
* @default false
|
|
208
257
|
*/
|
|
209
258
|
asChild?: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Enables expressive spring-animated border-radius morphing on interaction.
|
|
261
|
+
* - `true`: Defaults to `large` (16px) at rest morphing to `extraLarge` (28px) on hover.
|
|
262
|
+
* - `MorphRadiusConfig`: Granular config for `rest`, `hover`, and `pressed` states.
|
|
263
|
+
*
|
|
264
|
+
* Note: Active by default only on interactive cards (`onClick`, `href`, `interactive`).
|
|
265
|
+
* To enable on static cards, also set `forceMotion={true}`.
|
|
266
|
+
* @default false
|
|
267
|
+
*/
|
|
268
|
+
morphRadius?: boolean | MorphRadiusConfig;
|
|
269
|
+
/**
|
|
270
|
+
* Forces static cards (cards without `onClick` or `href`) to use Framer Motion `<m.div>`,
|
|
271
|
+
* enabling interactive hover animations like `morphRadius` and custom `whileHover`.
|
|
272
|
+
* @default false
|
|
273
|
+
*/
|
|
274
|
+
forceMotion?: boolean;
|
|
210
275
|
}
|
|
211
276
|
interface CardHeaderProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
212
277
|
/** Leading avatar or icon node. */
|
|
@@ -837,9 +902,13 @@ interface TextProps extends React$1.HTMLAttributes<HTMLElement>, VariantProps<ty
|
|
|
837
902
|
*/
|
|
838
903
|
as?: React$1.ElementType;
|
|
839
904
|
/**
|
|
840
|
-
* Text color override (CSS color value or Tailwind color class).
|
|
905
|
+
* Text color override (CSS color value, MD3 system color token, or Tailwind color class).
|
|
906
|
+
*
|
|
907
|
+
* @example
|
|
908
|
+
* color="var(--md-sys-color-primary)"
|
|
909
|
+
* color="var(--md-sys-color-on-surface-variant)"
|
|
841
910
|
*/
|
|
842
|
-
color?:
|
|
911
|
+
color?: MD3ColorToken;
|
|
843
912
|
/**
|
|
844
913
|
* Font weight override.
|
|
845
914
|
*/
|
|
@@ -1085,4 +1154,4 @@ declare const TypeScaleTokens: {
|
|
|
1085
1154
|
};
|
|
1086
1155
|
type TypeScaleTokensType = typeof TypeScaleTokens;
|
|
1087
1156
|
|
|
1088
|
-
export { Card, CardContent, type CardContentProps, type CardElevationConfig, type CardElevationOptions, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, CardMedia, type CardMediaProps, type CardProps, type CardVariant, Carousel, CarouselGrid, CarouselItem, type CarouselItemScope, type CarouselKeyline, type CarouselKeylineResult, type CarouselLayout, type CarouselProps, CarouselScrollClient, CarouselTokens, CodeBlock, type CodeBlockProps, Divider, type DividerProps, type ElevationLevel, type KeylineType, LIST_TOKENS, List, ListContext, ListDivider, type ListDividerProps, ListItem, type ListItemLeadingType, type ListItemProps, type ListItemTrailingType, type ListProps, type ListSelectionMode, type ListStyle, type ListVariant, type MotionDivProps, SHADOW, ScrollAreaProps, type ShadowLevel, TableOfContents, type TableOfContentsProps, Text, type TextProps, type ToCItem, TypeScaleTokens, type TypeScaleTokensType, VARIANT_ELEVATION, buildWavePath, cardVariants, getExpressiveShape, getListItemHeight, resolveElevationShadow, shouldTopAlign, typographyVariants, useCardElevation, useCarouselA11y, useCarouselKeylines, useListContext };
|
|
1157
|
+
export { Card, CardContent, type CardContentProps, type CardElevationConfig, type CardElevationOptions, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, CardMedia, type CardMediaProps, type CardMorphRadiusOptions, type CardProps, type CardVariant, Carousel, CarouselGrid, CarouselItem, type CarouselItemScope, type CarouselKeyline, type CarouselKeylineResult, type CarouselLayout, type CarouselProps, CarouselScrollClient, CarouselTokens, CodeBlock, type CodeBlockProps, Divider, type DividerProps, type ElevationLevel, type KeylineType, LIST_TOKENS, List, ListContext, ListDivider, type ListDividerProps, ListItem, type ListItemLeadingType, type ListItemProps, type ListItemTrailingType, type ListProps, type ListSelectionMode, type ListStyle, type ListVariant, type MorphRadiusConfig, type MorphRadiusLevel, type MotionDivProps, SHADOW, ScrollAreaProps, type ShadowLevel, TableOfContents, type TableOfContentsProps, Text, type TextProps, type ToCItem, TypeScaleTokens, type TypeScaleTokensType, VARIANT_ELEVATION, buildWavePath, cardVariants, getExpressiveShape, getListItemHeight, resolveCornerRadius, resolveElevationShadow, shouldTopAlign, typographyVariants, useCardElevation, useCardMorphRadius, useCarouselA11y, useCarouselKeylines, useListContext };
|
package/dist/layout.d.ts
CHANGED
|
@@ -2,33 +2,16 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
|
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import React__default, { HTMLAttributes, ReactNode } from 'react';
|
|
4
4
|
import { HTMLMotionProps } from 'motion/react';
|
|
5
|
+
import * as _bug_on_m3_tokens from '@bug-on/m3-tokens';
|
|
5
6
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
7
|
import { b as ScrollAreaProps } from './scroll-area-CVS6HyLl.js';
|
|
7
8
|
export { S as ScrollArea, a as ScrollAreaOrientation, c as ScrollAreaScrollbar, d as ScrollAreaType } from './scroll-area-CVS6HyLl.js';
|
|
8
|
-
export { F as FadingBlurDirection, a as FadingBlurMask, b as FadingBlurMaskProps, c as FadingBlurProps } from './fading-blur-mask
|
|
9
|
+
export { F as FadingBlurDirection, a as FadingBlurMask, b as FadingBlurMaskProps, c as FadingBlurProps } from './fading-blur-mask-D57UMguz.js';
|
|
9
10
|
import { VariantProps } from 'class-variance-authority';
|
|
11
|
+
import { a as MD3ColorToken } from './md3-xBl4wgND.js';
|
|
10
12
|
export { D as DEFAULT_FONT_VARIATION_AXES, F as FontVariationAxes, M as MD3_EXPRESSIVE_FONT_VARIATION, T as TextStyle, a as Typography, b as TypographyContext, c as TypographyKeyTokens, d as TypographyProvider, e as TypographyProviderProps, f as TypographyTokens, g as TypographyTokensOptions, s as serializeFontVariationAxes, u as useTypography } from './typography-CKTjvlZ4.js';
|
|
11
13
|
import '@radix-ui/react-scroll-area';
|
|
12
14
|
|
|
13
|
-
/**
|
|
14
|
-
* @file card-tokens.ts
|
|
15
|
-
*
|
|
16
|
-
* MD3 Expressive Card Elevation & Motion Tokens.
|
|
17
|
-
*
|
|
18
|
-
* Elevation levels translated from:
|
|
19
|
-
* - ElevatedCardTokens.kt
|
|
20
|
-
* - FilledCardTokens.kt
|
|
21
|
-
* - OutlinedCardTokens.kt
|
|
22
|
-
* - Elevation.kt
|
|
23
|
-
*
|
|
24
|
-
* Elevation Levels:
|
|
25
|
-
* - Level 0: 0dp (Flat - "none")
|
|
26
|
-
* - Level 1: 1dp (Slight elevation - Elevated rest)
|
|
27
|
-
* - Level 2: 3dp (Hover / Focus elevation for Elevated, Hover for Filled/Outlined)
|
|
28
|
-
* - Level 3: 6dp (Dragged state elevation)
|
|
29
|
-
* - Level 4: 8dp (Pickers/Popups elevation)
|
|
30
|
-
* - Level 5: 12dp (Modals/Dialogs elevation)
|
|
31
|
-
*/
|
|
32
15
|
declare const SHADOW: {
|
|
33
16
|
readonly level0: "none";
|
|
34
17
|
readonly level1: "0px 1px 2px 0px rgba(0,0,0,.3), 0px 1px 3px 1px rgba(0,0,0,.15)";
|
|
@@ -114,6 +97,45 @@ declare function useCardElevation({ variant, disabled, draggable, elevation, dis
|
|
|
114
97
|
};
|
|
115
98
|
};
|
|
116
99
|
};
|
|
100
|
+
/**
|
|
101
|
+
* Resolves a `MorphRadiusLevel` key or raw number to a pixel CSS string.
|
|
102
|
+
* When `level === "full"`, optionally caps at `maxPillRadius` (half of element dimension)
|
|
103
|
+
* to avoid spring animation visual dead-zones caused by the generic 9999px token.
|
|
104
|
+
*/
|
|
105
|
+
declare function resolveCornerRadius(level: MorphRadiusLevel | number | undefined, fallback: number, maxPillRadius?: number): string;
|
|
106
|
+
interface CardMorphRadiusOptions {
|
|
107
|
+
morphRadius?: boolean | MorphRadiusConfig;
|
|
108
|
+
disabled?: boolean;
|
|
109
|
+
isInteractive?: boolean;
|
|
110
|
+
isForceMotion?: boolean;
|
|
111
|
+
hoverEffect?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Measured radius (px) that perfectly forms a pill shape for this container.
|
|
114
|
+
* Eliminates visual delay when unhovering cards with `full` radius.
|
|
115
|
+
*/
|
|
116
|
+
maxPillRadius?: number;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Hook: Card Morphing Border Radius Animation
|
|
120
|
+
* Calculates spring-animated border-radius states based on interaction flags and MD3 spatial spring physics.
|
|
121
|
+
*/
|
|
122
|
+
declare function useCardMorphRadius({ morphRadius, disabled, isInteractive, isForceMotion, hoverEffect, maxPillRadius, }: CardMorphRadiusOptions): {
|
|
123
|
+
animate: {
|
|
124
|
+
borderRadius: string;
|
|
125
|
+
};
|
|
126
|
+
whileHover: {
|
|
127
|
+
borderRadius: string;
|
|
128
|
+
} | undefined;
|
|
129
|
+
whileTap: {
|
|
130
|
+
borderRadius: string;
|
|
131
|
+
} | undefined;
|
|
132
|
+
whileFocus: {
|
|
133
|
+
borderRadius: string;
|
|
134
|
+
} | undefined;
|
|
135
|
+
transition: {
|
|
136
|
+
borderRadius: _bug_on_m3_tokens.FramerSpring;
|
|
137
|
+
};
|
|
138
|
+
} | null;
|
|
117
139
|
|
|
118
140
|
/**
|
|
119
141
|
* @file types.ts
|
|
@@ -121,6 +143,33 @@ declare function useCardElevation({ variant, disabled, draggable, elevation, dis
|
|
|
121
143
|
* Types and interfaces for the MD3 Expressive Card system.
|
|
122
144
|
*/
|
|
123
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Valid corner radius scale levels defined in MD3 Expressive.
|
|
148
|
+
*/
|
|
149
|
+
type MorphRadiusLevel = "none" | "extraSmall" | "small" | "medium" | "large" | "largeIncreased" | "extraLarge" | "extraLargeIncreased" | "extraExtraLarge" | "full";
|
|
150
|
+
/**
|
|
151
|
+
* Granular configuration for interactive border-radius morphing.
|
|
152
|
+
*/
|
|
153
|
+
interface MorphRadiusConfig {
|
|
154
|
+
/**
|
|
155
|
+
* Resting border radius.
|
|
156
|
+
* Can be a preset `MorphRadiusLevel` key or a raw pixel number.
|
|
157
|
+
* @default "large" (16px)
|
|
158
|
+
*/
|
|
159
|
+
rest?: MorphRadiusLevel | number;
|
|
160
|
+
/**
|
|
161
|
+
* Hover border radius.
|
|
162
|
+
* Can be a preset `MorphRadiusLevel` key or a raw pixel number.
|
|
163
|
+
* @default "extraLarge" (28px)
|
|
164
|
+
*/
|
|
165
|
+
hover?: MorphRadiusLevel | number;
|
|
166
|
+
/**
|
|
167
|
+
* Pressed / tap border radius.
|
|
168
|
+
* Can be a preset `MorphRadiusLevel` key or a raw pixel number.
|
|
169
|
+
* @default same as rest
|
|
170
|
+
*/
|
|
171
|
+
pressed?: MorphRadiusLevel | number;
|
|
172
|
+
}
|
|
124
173
|
type MotionDivProps = Omit<HTMLMotionProps<"button">, "children" | "color">;
|
|
125
174
|
interface CardProps extends MotionDivProps {
|
|
126
175
|
/**
|
|
@@ -207,6 +256,22 @@ interface CardProps extends MotionDivProps {
|
|
|
207
256
|
* @default false
|
|
208
257
|
*/
|
|
209
258
|
asChild?: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Enables expressive spring-animated border-radius morphing on interaction.
|
|
261
|
+
* - `true`: Defaults to `large` (16px) at rest morphing to `extraLarge` (28px) on hover.
|
|
262
|
+
* - `MorphRadiusConfig`: Granular config for `rest`, `hover`, and `pressed` states.
|
|
263
|
+
*
|
|
264
|
+
* Note: Active by default only on interactive cards (`onClick`, `href`, `interactive`).
|
|
265
|
+
* To enable on static cards, also set `forceMotion={true}`.
|
|
266
|
+
* @default false
|
|
267
|
+
*/
|
|
268
|
+
morphRadius?: boolean | MorphRadiusConfig;
|
|
269
|
+
/**
|
|
270
|
+
* Forces static cards (cards without `onClick` or `href`) to use Framer Motion `<m.div>`,
|
|
271
|
+
* enabling interactive hover animations like `morphRadius` and custom `whileHover`.
|
|
272
|
+
* @default false
|
|
273
|
+
*/
|
|
274
|
+
forceMotion?: boolean;
|
|
210
275
|
}
|
|
211
276
|
interface CardHeaderProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
212
277
|
/** Leading avatar or icon node. */
|
|
@@ -837,9 +902,13 @@ interface TextProps extends React$1.HTMLAttributes<HTMLElement>, VariantProps<ty
|
|
|
837
902
|
*/
|
|
838
903
|
as?: React$1.ElementType;
|
|
839
904
|
/**
|
|
840
|
-
* Text color override (CSS color value or Tailwind color class).
|
|
905
|
+
* Text color override (CSS color value, MD3 system color token, or Tailwind color class).
|
|
906
|
+
*
|
|
907
|
+
* @example
|
|
908
|
+
* color="var(--md-sys-color-primary)"
|
|
909
|
+
* color="var(--md-sys-color-on-surface-variant)"
|
|
841
910
|
*/
|
|
842
|
-
color?:
|
|
911
|
+
color?: MD3ColorToken;
|
|
843
912
|
/**
|
|
844
913
|
* Font weight override.
|
|
845
914
|
*/
|
|
@@ -1085,4 +1154,4 @@ declare const TypeScaleTokens: {
|
|
|
1085
1154
|
};
|
|
1086
1155
|
type TypeScaleTokensType = typeof TypeScaleTokens;
|
|
1087
1156
|
|
|
1088
|
-
export { Card, CardContent, type CardContentProps, type CardElevationConfig, type CardElevationOptions, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, CardMedia, type CardMediaProps, type CardProps, type CardVariant, Carousel, CarouselGrid, CarouselItem, type CarouselItemScope, type CarouselKeyline, type CarouselKeylineResult, type CarouselLayout, type CarouselProps, CarouselScrollClient, CarouselTokens, CodeBlock, type CodeBlockProps, Divider, type DividerProps, type ElevationLevel, type KeylineType, LIST_TOKENS, List, ListContext, ListDivider, type ListDividerProps, ListItem, type ListItemLeadingType, type ListItemProps, type ListItemTrailingType, type ListProps, type ListSelectionMode, type ListStyle, type ListVariant, type MotionDivProps, SHADOW, ScrollAreaProps, type ShadowLevel, TableOfContents, type TableOfContentsProps, Text, type TextProps, type ToCItem, TypeScaleTokens, type TypeScaleTokensType, VARIANT_ELEVATION, buildWavePath, cardVariants, getExpressiveShape, getListItemHeight, resolveElevationShadow, shouldTopAlign, typographyVariants, useCardElevation, useCarouselA11y, useCarouselKeylines, useListContext };
|
|
1157
|
+
export { Card, CardContent, type CardContentProps, type CardElevationConfig, type CardElevationOptions, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, CardMedia, type CardMediaProps, type CardMorphRadiusOptions, type CardProps, type CardVariant, Carousel, CarouselGrid, CarouselItem, type CarouselItemScope, type CarouselKeyline, type CarouselKeylineResult, type CarouselLayout, type CarouselProps, CarouselScrollClient, CarouselTokens, CodeBlock, type CodeBlockProps, Divider, type DividerProps, type ElevationLevel, type KeylineType, LIST_TOKENS, List, ListContext, ListDivider, type ListDividerProps, ListItem, type ListItemLeadingType, type ListItemProps, type ListItemTrailingType, type ListProps, type ListSelectionMode, type ListStyle, type ListVariant, type MorphRadiusConfig, type MorphRadiusLevel, type MotionDivProps, SHADOW, ScrollAreaProps, type ShadowLevel, TableOfContents, type TableOfContentsProps, Text, type TextProps, type ToCItem, TypeScaleTokens, type TypeScaleTokensType, VARIANT_ELEVATION, buildWavePath, cardVariants, getExpressiveShape, getListItemHeight, resolveCornerRadius, resolveElevationShadow, shouldTopAlign, typographyVariants, useCardElevation, useCardMorphRadius, useCarouselA11y, useCarouselKeylines, useListContext };
|
package/dist/layout.js
CHANGED
|
@@ -144,8 +144,6 @@ function useRippleState(options = {}) {
|
|
|
144
144
|
}, []);
|
|
145
145
|
return { ripples, onPointerDown, removeRipple };
|
|
146
146
|
}
|
|
147
|
-
|
|
148
|
-
// src/ui/cards/card/card-tokens.ts
|
|
149
147
|
var SHADOW = {
|
|
150
148
|
level0: "none",
|
|
151
149
|
level1: "0px 1px 2px 0px rgba(0,0,0,.3), 0px 1px 3px 1px rgba(0,0,0,.15)",
|
|
@@ -248,6 +246,45 @@ function useCardElevation({
|
|
|
248
246
|
}
|
|
249
247
|
};
|
|
250
248
|
}
|
|
249
|
+
function resolveCornerRadius(level, fallback, maxPillRadius) {
|
|
250
|
+
if (level === void 0) return `${fallback}px`;
|
|
251
|
+
if (typeof level === "number") return `${level}px`;
|
|
252
|
+
if (level === "full" && maxPillRadius !== void 0 && maxPillRadius > 0) {
|
|
253
|
+
return `${maxPillRadius}px`;
|
|
254
|
+
}
|
|
255
|
+
if (level in m3Tokens.cornerRadius) {
|
|
256
|
+
return `${m3Tokens.cornerRadius[level]}px`;
|
|
257
|
+
}
|
|
258
|
+
return `${fallback}px`;
|
|
259
|
+
}
|
|
260
|
+
function useCardMorphRadius({
|
|
261
|
+
morphRadius,
|
|
262
|
+
disabled = false,
|
|
263
|
+
isInteractive = false,
|
|
264
|
+
isForceMotion = false,
|
|
265
|
+
hoverEffect = true,
|
|
266
|
+
maxPillRadius
|
|
267
|
+
}) {
|
|
268
|
+
if (!morphRadius) return null;
|
|
269
|
+
if (!isInteractive && !isForceMotion) return null;
|
|
270
|
+
const config = typeof morphRadius === "object" ? morphRadius : {};
|
|
271
|
+
const restRadius = resolveCornerRadius(
|
|
272
|
+
config.rest,
|
|
273
|
+
m3Tokens.cornerRadius.large,
|
|
274
|
+
maxPillRadius
|
|
275
|
+
);
|
|
276
|
+
const hoverRadius = hoverEffect ? resolveCornerRadius(config.hover, m3Tokens.cornerRadius.extraLarge, maxPillRadius) : restRadius;
|
|
277
|
+
const pressedRadius = config.pressed !== void 0 ? resolveCornerRadius(config.pressed, m3Tokens.cornerRadius.large, maxPillRadius) : restRadius;
|
|
278
|
+
return {
|
|
279
|
+
animate: { borderRadius: restRadius },
|
|
280
|
+
whileHover: disabled || !hoverEffect ? void 0 : { borderRadius: hoverRadius },
|
|
281
|
+
whileTap: disabled ? void 0 : { borderRadius: pressedRadius },
|
|
282
|
+
whileFocus: disabled || !hoverEffect ? void 0 : { borderRadius: hoverRadius },
|
|
283
|
+
transition: {
|
|
284
|
+
borderRadius: m3Tokens.framerSprings.fast.spatial
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
}
|
|
251
288
|
var cardVariants = classVarianceAuthority.cva(
|
|
252
289
|
"rounded-m3-lg flex flex-col relative overflow-hidden transition-all duration-200",
|
|
253
290
|
{
|
|
@@ -291,6 +328,8 @@ var CardImpl = React23__namespace.forwardRef(
|
|
|
291
328
|
whileDrag,
|
|
292
329
|
transition,
|
|
293
330
|
asChild = false,
|
|
331
|
+
morphRadius = false,
|
|
332
|
+
forceMotion = false,
|
|
294
333
|
children
|
|
295
334
|
} = _b, props = __objRest(_b, [
|
|
296
335
|
"className",
|
|
@@ -317,6 +356,8 @@ var CardImpl = React23__namespace.forwardRef(
|
|
|
317
356
|
"whileDrag",
|
|
318
357
|
"transition",
|
|
319
358
|
"asChild",
|
|
359
|
+
"morphRadius",
|
|
360
|
+
"forceMotion",
|
|
320
361
|
"children"
|
|
321
362
|
]);
|
|
322
363
|
const safeVariant = variant || "elevated";
|
|
@@ -324,6 +365,39 @@ var CardImpl = React23__namespace.forwardRef(
|
|
|
324
365
|
const isHoverEnabled = hoverEffect !== false && !disableHoverEffect;
|
|
325
366
|
const isRippleEnabled = ripple !== false && !disableRipple && isInteractive && !disabled;
|
|
326
367
|
const isStateLayerEnabled = stateLayer !== false && !disableStateLayer && isInteractive && !disabled;
|
|
368
|
+
const containerRef = React23__namespace.useRef(null);
|
|
369
|
+
const setRefs = React23__namespace.useCallback(
|
|
370
|
+
(node) => {
|
|
371
|
+
containerRef.current = node;
|
|
372
|
+
if (typeof ref === "function") {
|
|
373
|
+
ref(node);
|
|
374
|
+
} else if (ref) {
|
|
375
|
+
ref.current = node;
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
[ref]
|
|
379
|
+
);
|
|
380
|
+
const hasFullRadius = typeof morphRadius === "object" && (morphRadius.rest === "full" || morphRadius.hover === "full" || morphRadius.pressed === "full");
|
|
381
|
+
const [pillRadius, setPillRadius] = React23__namespace.useState(
|
|
382
|
+
void 0
|
|
383
|
+
);
|
|
384
|
+
React23__namespace.useEffect(() => {
|
|
385
|
+
if (!hasFullRadius || !containerRef.current) return;
|
|
386
|
+
const el = containerRef.current;
|
|
387
|
+
const updateRadius = () => {
|
|
388
|
+
const h = el.offsetHeight;
|
|
389
|
+
const w = el.offsetWidth;
|
|
390
|
+
if (h > 0 && w > 0) {
|
|
391
|
+
setPillRadius(Math.ceil(Math.min(h, w) / 2));
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
updateRadius();
|
|
395
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
396
|
+
const ro = new ResizeObserver(updateRadius);
|
|
397
|
+
ro.observe(el);
|
|
398
|
+
return () => ro.disconnect();
|
|
399
|
+
}
|
|
400
|
+
}, [hasFullRadius]);
|
|
327
401
|
const elevationProps = useCardElevation({
|
|
328
402
|
variant: safeVariant,
|
|
329
403
|
disabled,
|
|
@@ -332,6 +406,14 @@ var CardImpl = React23__namespace.forwardRef(
|
|
|
332
406
|
disableElevation,
|
|
333
407
|
hoverEffect: isHoverEnabled
|
|
334
408
|
});
|
|
409
|
+
const morphRadiusProps = useCardMorphRadius({
|
|
410
|
+
morphRadius,
|
|
411
|
+
disabled,
|
|
412
|
+
isInteractive,
|
|
413
|
+
isForceMotion: forceMotion,
|
|
414
|
+
hoverEffect: isHoverEnabled,
|
|
415
|
+
maxPillRadius: pillRadius
|
|
416
|
+
});
|
|
335
417
|
const {
|
|
336
418
|
ripples,
|
|
337
419
|
onPointerDown: rippleOnPointerDown,
|
|
@@ -345,8 +427,10 @@ var CardImpl = React23__namespace.forwardRef(
|
|
|
345
427
|
event
|
|
346
428
|
);
|
|
347
429
|
};
|
|
430
|
+
const rawVariants = cardVariants({ variant: safeVariant });
|
|
431
|
+
const variantClass = morphRadiusProps ? rawVariants.replace("rounded-m3-lg", "").replace("transition-all", "") : rawVariants;
|
|
348
432
|
const baseClass = cn(
|
|
349
|
-
|
|
433
|
+
variantClass,
|
|
350
434
|
// Disabled state:
|
|
351
435
|
// - pointer-events-none → disable interactions completely
|
|
352
436
|
// - opacity-[0.38] → MD3 DisabledContainerOpacity
|
|
@@ -366,11 +450,12 @@ var CardImpl = React23__namespace.forwardRef(
|
|
|
366
450
|
// Outlined interactive card: smooth transition of border color to m3-outline on hover/focus/press
|
|
367
451
|
safeVariant === "outlined" && "transition-colors duration-200 hover:border-m3-outline focus-visible:border-m3-outline active:border-m3-outline"
|
|
368
452
|
);
|
|
369
|
-
const
|
|
370
|
-
const
|
|
371
|
-
const
|
|
453
|
+
const mergedAnimate = __spreadValues(__spreadValues({}, elevationProps.animate), (morphRadiusProps == null ? void 0 : morphRadiusProps.animate) || {});
|
|
454
|
+
const mergedWhileHover = elevationProps.whileHover || (morphRadiusProps == null ? void 0 : morphRadiusProps.whileHover) || whileHover ? __spreadValues(__spreadValues(__spreadValues({}, elevationProps.whileHover), morphRadiusProps == null ? void 0 : morphRadiusProps.whileHover), typeof whileHover === "object" ? whileHover : {}) : void 0;
|
|
455
|
+
const mergedWhileTap = elevationProps.whileTap || (morphRadiusProps == null ? void 0 : morphRadiusProps.whileTap) || whileTap ? __spreadValues(__spreadValues(__spreadValues({}, elevationProps.whileTap), morphRadiusProps == null ? void 0 : morphRadiusProps.whileTap), typeof whileTap === "object" ? whileTap : {}) : void 0;
|
|
456
|
+
const mergedWhileFocus = elevationProps.whileFocus || (morphRadiusProps == null ? void 0 : morphRadiusProps.whileFocus) || whileFocus ? __spreadValues(__spreadValues(__spreadValues({}, elevationProps.whileFocus), morphRadiusProps == null ? void 0 : morphRadiusProps.whileFocus), typeof whileFocus === "object" ? whileFocus : {}) : void 0;
|
|
372
457
|
const mergedWhileDrag = elevationProps.whileDrag || whileDrag ? __spreadValues(__spreadValues({}, elevationProps.whileDrag), typeof whileDrag === "object" ? whileDrag : {}) : void 0;
|
|
373
|
-
const mergedTransition = elevationProps.transition || transition ? __spreadValues(__spreadValues({}, elevationProps.transition), typeof transition === "object" ? transition : {}) : void 0;
|
|
458
|
+
const mergedTransition = elevationProps.transition || (morphRadiusProps == null ? void 0 : morphRadiusProps.transition) || transition ? __spreadValues(__spreadValues(__spreadValues({}, elevationProps.transition), morphRadiusProps == null ? void 0 : morphRadiusProps.transition), typeof transition === "object" ? transition : {}) : void 0;
|
|
374
459
|
if (asChild) {
|
|
375
460
|
const child = React23__namespace.Children.only(children);
|
|
376
461
|
const innerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -380,7 +465,7 @@ var CardImpl = React23__namespace.forwardRef(
|
|
|
380
465
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
381
466
|
reactSlot.Slot,
|
|
382
467
|
__spreadProps(__spreadValues({
|
|
383
|
-
ref,
|
|
468
|
+
ref: setRefs,
|
|
384
469
|
className: cn(baseClass, interactiveClass),
|
|
385
470
|
"aria-disabled": disabled ? true : void 0,
|
|
386
471
|
tabIndex: disabled ? -1 : 0,
|
|
@@ -392,10 +477,28 @@ var CardImpl = React23__namespace.forwardRef(
|
|
|
392
477
|
) });
|
|
393
478
|
}
|
|
394
479
|
if (!isInteractive) {
|
|
480
|
+
if (forceMotion && morphRadiusProps) {
|
|
481
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
482
|
+
react.m.div,
|
|
483
|
+
__spreadProps(__spreadValues({
|
|
484
|
+
ref: setRefs,
|
|
485
|
+
className: baseClass,
|
|
486
|
+
"aria-disabled": disabled ? true : void 0,
|
|
487
|
+
animate: mergedAnimate,
|
|
488
|
+
whileHover: mergedWhileHover,
|
|
489
|
+
whileTap: mergedWhileTap,
|
|
490
|
+
whileFocus: mergedWhileFocus,
|
|
491
|
+
whileDrag: mergedWhileDrag,
|
|
492
|
+
transition: mergedTransition
|
|
493
|
+
}, props), {
|
|
494
|
+
children
|
|
495
|
+
})
|
|
496
|
+
) });
|
|
497
|
+
}
|
|
395
498
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
396
499
|
"div",
|
|
397
500
|
__spreadProps(__spreadValues({
|
|
398
|
-
ref,
|
|
501
|
+
ref: setRefs,
|
|
399
502
|
className: baseClass,
|
|
400
503
|
style: __spreadValues({
|
|
401
504
|
boxShadow: elevationProps.animate.boxShadow
|
|
@@ -411,7 +514,7 @@ var CardImpl = React23__namespace.forwardRef(
|
|
|
411
514
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
412
515
|
react.m.a,
|
|
413
516
|
__spreadProps(__spreadValues({
|
|
414
|
-
ref,
|
|
517
|
+
ref: setRefs,
|
|
415
518
|
href: disabled ? void 0 : href,
|
|
416
519
|
target,
|
|
417
520
|
rel: safeRel,
|
|
@@ -419,7 +522,7 @@ var CardImpl = React23__namespace.forwardRef(
|
|
|
419
522
|
"aria-disabled": disabled ? true : void 0,
|
|
420
523
|
tabIndex: disabled ? -1 : 0,
|
|
421
524
|
onPointerDown: handlePointerDown,
|
|
422
|
-
animate:
|
|
525
|
+
animate: mergedAnimate,
|
|
423
526
|
whileHover: mergedWhileHover,
|
|
424
527
|
whileTap: mergedWhileTap,
|
|
425
528
|
whileFocus: mergedWhileFocus,
|
|
@@ -436,7 +539,7 @@ var CardImpl = React23__namespace.forwardRef(
|
|
|
436
539
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
437
540
|
react.m.button,
|
|
438
541
|
__spreadProps(__spreadValues({
|
|
439
|
-
ref,
|
|
542
|
+
ref: setRefs,
|
|
440
543
|
type: "button",
|
|
441
544
|
disabled,
|
|
442
545
|
onClick,
|
|
@@ -444,7 +547,7 @@ var CardImpl = React23__namespace.forwardRef(
|
|
|
444
547
|
"aria-disabled": disabled ? true : void 0,
|
|
445
548
|
tabIndex: disabled ? -1 : 0,
|
|
446
549
|
onPointerDown: handlePointerDown,
|
|
447
|
-
animate:
|
|
550
|
+
animate: mergedAnimate,
|
|
448
551
|
whileHover: mergedWhileHover,
|
|
449
552
|
whileTap: mergedWhileTap,
|
|
450
553
|
whileFocus: mergedWhileFocus,
|
|
@@ -6790,11 +6893,13 @@ exports.buildWavePath = buildWavePath;
|
|
|
6790
6893
|
exports.cardVariants = cardVariants;
|
|
6791
6894
|
exports.getExpressiveShape = getExpressiveShape;
|
|
6792
6895
|
exports.getListItemHeight = getListItemHeight;
|
|
6896
|
+
exports.resolveCornerRadius = resolveCornerRadius;
|
|
6793
6897
|
exports.resolveElevationShadow = resolveElevationShadow;
|
|
6794
6898
|
exports.serializeFontVariationAxes = serializeFontVariationAxes;
|
|
6795
6899
|
exports.shouldTopAlign = shouldTopAlign;
|
|
6796
6900
|
exports.typographyVariants = typographyVariants;
|
|
6797
6901
|
exports.useCardElevation = useCardElevation;
|
|
6902
|
+
exports.useCardMorphRadius = useCardMorphRadius;
|
|
6798
6903
|
exports.useCarouselA11y = useCarouselA11y;
|
|
6799
6904
|
exports.useCarouselKeylines = useCarouselKeylines;
|
|
6800
6905
|
exports.useListContext = useListContext;
|