@bug-on/md3-react 2.0.0 → 2.0.2
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 +4 -0
- package/dist/index.js +10563 -7543
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10495 -7499
- package/dist/index.mjs.map +1 -1
- package/dist/ui/app-bar/app-bar-column.d.ts +28 -0
- package/dist/ui/app-bar/app-bar-item-button.d.ts +16 -0
- package/dist/ui/app-bar/app-bar-overflow-indicator.d.ts +18 -0
- package/dist/ui/app-bar/app-bar-row.d.ts +36 -0
- package/dist/ui/app-bar/app-bar.tokens.d.ts +184 -0
- package/dist/ui/app-bar/app-bar.types.d.ts +392 -0
- package/dist/ui/app-bar/bottom-app-bar.d.ts +31 -0
- package/dist/ui/app-bar/docked-toolbar.d.ts +25 -0
- package/dist/ui/app-bar/hooks/use-app-bar-scroll.d.ts +42 -0
- package/dist/ui/app-bar/hooks/use-flexible-app-bar.d.ts +37 -0
- package/dist/ui/app-bar/index.d.ts +39 -0
- package/dist/ui/app-bar/large-flexible-app-bar.d.ts +26 -0
- package/dist/ui/app-bar/medium-flexible-app-bar.d.ts +28 -0
- package/dist/ui/app-bar/search-app-bar.d.ts +43 -0
- package/dist/ui/app-bar/search-view.d.ts +54 -0
- package/dist/ui/app-bar/small-app-bar.d.ts +37 -0
- package/dist/ui/slider/hooks/useSliderMath.d.ts +101 -0
- package/dist/ui/slider/index.d.ts +9 -0
- package/dist/ui/slider/range-slider.d.ts +47 -0
- package/dist/ui/slider/slider-thumb.d.ts +33 -0
- package/dist/ui/slider/slider-track.d.ts +25 -0
- package/dist/ui/slider/slider.d.ts +60 -0
- package/dist/ui/slider/slider.tokens.d.ts +151 -0
- package/dist/ui/slider/slider.types.d.ts +259 -0
- package/dist/ui/snackbar/snackbar.d.ts +1 -0
- package/dist/ui/theme-provider/index.d.ts +31 -1
- package/dist/ui/toc.d.ts +7 -1
- package/package.json +1 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file slider.tokens.ts
|
|
3
|
+
* MD3 Expressive Slider — Design tokens ported from:
|
|
4
|
+
* - SliderTokens.kt (Jetpack Compose M3 Expressive)
|
|
5
|
+
* - M3 Expressive visual spec (handle squeeze, gaps, asymmetric radii)
|
|
6
|
+
*
|
|
7
|
+
* All dimensional values are in px (dp equivalents for web).
|
|
8
|
+
* Colors reference CSS custom properties — do NOT hardcode hex.
|
|
9
|
+
* @see docs/m3/sliders/Slider.kt
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Core dimensional design tokens for the MD3 Expressive Slider.
|
|
13
|
+
* Maps directly from SliderTokens.kt to CSS/JS values.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SliderTokens: {
|
|
16
|
+
readonly trackSizes: {
|
|
17
|
+
xs: number;
|
|
18
|
+
s: number;
|
|
19
|
+
m: number;
|
|
20
|
+
l: number;
|
|
21
|
+
xl: number;
|
|
22
|
+
};
|
|
23
|
+
readonly trackShapes: {
|
|
24
|
+
xs: number;
|
|
25
|
+
s: number;
|
|
26
|
+
m: number;
|
|
27
|
+
l: number;
|
|
28
|
+
xl: number;
|
|
29
|
+
};
|
|
30
|
+
/** Thumb height grows with track size */
|
|
31
|
+
readonly thumbHeights: {
|
|
32
|
+
xs: number;
|
|
33
|
+
s: number;
|
|
34
|
+
m: number;
|
|
35
|
+
l: number;
|
|
36
|
+
xl: number;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Thumb width at rest and on hover.
|
|
40
|
+
* MD3 Expressive handle pill: 4dp wide.
|
|
41
|
+
*/
|
|
42
|
+
readonly thumbWidthDefault: 4;
|
|
43
|
+
/**
|
|
44
|
+
* Thumb width while pressed/dragging.
|
|
45
|
+
* "Squeeze" animation: 4dp → 2dp (M3 Expressive behavior).
|
|
46
|
+
*/
|
|
47
|
+
readonly thumbWidthPressed: 2;
|
|
48
|
+
/**
|
|
49
|
+
* Transparent gap between the active/inactive track segments and the thumb.
|
|
50
|
+
* Maps to ActiveHandleLeadingSpace / ActiveHandleTrailingSpace = 6dp.
|
|
51
|
+
*
|
|
52
|
+
* This gap is rendered by mathematically subtracting it from the track
|
|
53
|
+
* segment width — NOT using margin/padding.
|
|
54
|
+
*/
|
|
55
|
+
readonly thumbGap: 6;
|
|
56
|
+
/**
|
|
57
|
+
* Corner radius on the INNER ends of each track segment (facing the thumb).
|
|
58
|
+
* Fixed to 2px according to MD3 Expressive Slider specs (TrackInsideCornerSize).
|
|
59
|
+
* Outer ends use `trackSize / 2` (pill cap) — computed inline per component.
|
|
60
|
+
*/
|
|
61
|
+
readonly trackInnerRadius: 2;
|
|
62
|
+
/** Tick dot size (width and height). = 4dp. */
|
|
63
|
+
readonly tickSize: 4;
|
|
64
|
+
/**
|
|
65
|
+
* Minimum touch target for the thumb wrapper.
|
|
66
|
+
* MD3 requires 48dp minimum touch target for interactive elements.
|
|
67
|
+
*/
|
|
68
|
+
readonly thumbTouchTarget: 48;
|
|
69
|
+
/** Offset above the thumb center for the value indicator tooltip. */
|
|
70
|
+
readonly valueIndicatorOffset: 52;
|
|
71
|
+
/** Standard icon size map for inset icons inside the track. */
|
|
72
|
+
readonly insetIconSizes: {
|
|
73
|
+
xs: number;
|
|
74
|
+
s: number;
|
|
75
|
+
m: number;
|
|
76
|
+
l: number;
|
|
77
|
+
xl: number;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Padding between icon and track edge (horizontal).
|
|
81
|
+
* Keeps the icon visually centered within the pill track.
|
|
82
|
+
*/
|
|
83
|
+
readonly insetIconPadding: 4;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* CSS custom property references for Slider colors.
|
|
87
|
+
* Maps to --md-sys-color-* tokens in the MD3 theme system.
|
|
88
|
+
*
|
|
89
|
+
* DO NOT hardcode hex/rgba values — these references automatically
|
|
90
|
+
* adapt to light/dark theme.
|
|
91
|
+
*/
|
|
92
|
+
export declare const SliderColors: {
|
|
93
|
+
/** Active track color. Maps to ActiveTrackColor token. */
|
|
94
|
+
readonly activeTrack: "var(--md-sys-color-primary)";
|
|
95
|
+
/** Inactive track color. Maps to InactiveTrackColor token. */
|
|
96
|
+
readonly inactiveTrack: "var(--md-sys-color-secondary-container)";
|
|
97
|
+
/**
|
|
98
|
+
* Disabled track color.
|
|
99
|
+
* Uses opacity + on-surface per MD3 disabled state spec.
|
|
100
|
+
*/
|
|
101
|
+
readonly disabledActiveTrack: "var(--md-sys-color-on-surface)";
|
|
102
|
+
readonly disabledInactiveTrack: "var(--md-sys-color-on-surface)";
|
|
103
|
+
/** Thumb (handle) color. Maps to HandleColor token. */
|
|
104
|
+
readonly thumb: "var(--md-sys-color-primary)";
|
|
105
|
+
/** Disabled thumb color. */
|
|
106
|
+
readonly disabledThumb: "var(--md-sys-color-on-surface)";
|
|
107
|
+
/** Value indicator (tooltip) background. Maps to InverseSurface. */
|
|
108
|
+
readonly valueIndicatorBg: "var(--md-sys-color-inverse-surface)";
|
|
109
|
+
/** Value indicator (tooltip) text. Maps to InverseOnSurface. */
|
|
110
|
+
readonly valueIndicatorText: "var(--md-sys-color-inverse-on-surface)";
|
|
111
|
+
/**
|
|
112
|
+
* Tick on the INACTIVE portion of the track.
|
|
113
|
+
* Maps to TickMarkActiveContainerColor (in spec: primary color stands out).
|
|
114
|
+
*/
|
|
115
|
+
readonly tickOnInactive: "var(--md-sys-color-primary)";
|
|
116
|
+
/**
|
|
117
|
+
* Tick on the ACTIVE portion of the track.
|
|
118
|
+
* Maps to TickMarkInactiveContainerColor (secondary-container blends in).
|
|
119
|
+
*/
|
|
120
|
+
readonly tickOnActive: "var(--md-sys-color-secondary-container)";
|
|
121
|
+
readonly disabledTick: "var(--md-sys-color-on-surface)";
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* FastSpatial spring for thumb width squeeze animation.
|
|
125
|
+
* Equivalent to MotionSchemeKeyTokens.FastSpatial in Compose.
|
|
126
|
+
*/
|
|
127
|
+
export declare const SLIDER_THUMB_SPRING: {
|
|
128
|
+
readonly type: "spring";
|
|
129
|
+
readonly stiffness: 500;
|
|
130
|
+
readonly damping: 40;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* DefaultSpatial spring for thumb position/track updates.
|
|
134
|
+
* Slightly looser feel for position changes.
|
|
135
|
+
*/
|
|
136
|
+
export declare const SLIDER_POSITION_SPRING: {
|
|
137
|
+
readonly type: "spring";
|
|
138
|
+
readonly stiffness: 400;
|
|
139
|
+
readonly damping: 38;
|
|
140
|
+
};
|
|
141
|
+
/** Color crossfade for active/inactive track color transitions. */
|
|
142
|
+
export declare const SLIDER_COLOR_TRANSITION: {
|
|
143
|
+
readonly duration: 0.18;
|
|
144
|
+
readonly ease: "easeInOut";
|
|
145
|
+
};
|
|
146
|
+
/** Value indicator appear/disappear animation. */
|
|
147
|
+
export declare const SLIDER_INDICATOR_TRANSITION: {
|
|
148
|
+
readonly type: "spring";
|
|
149
|
+
readonly stiffness: 450;
|
|
150
|
+
readonly damping: 32;
|
|
151
|
+
};
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file slider.types.ts
|
|
3
|
+
* MD3 Expressive Slider — TypeScript prop definitions.
|
|
4
|
+
* Spec: https://m3.material.io/components/sliders/overview
|
|
5
|
+
* Reference: docs/m3/sliders/Slider.kt
|
|
6
|
+
*/
|
|
7
|
+
import type * as React from "react";
|
|
8
|
+
/** Track size variants mapping to physical px values. */
|
|
9
|
+
export type SliderTrackSize = "xs" | "s" | "m" | "l" | "xl";
|
|
10
|
+
export type SliderVariant = "primary" | "secondary" | "tertiary" | "error";
|
|
11
|
+
export type SliderTrackShape = "md3" | "full" | number;
|
|
12
|
+
/** Slider layout direction. */
|
|
13
|
+
export type SliderOrientation = "horizontal" | "vertical";
|
|
14
|
+
/**
|
|
15
|
+
* Internal context shared between Slider sub-components.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export interface SliderContextValue {
|
|
19
|
+
/** Minimum allowed value. */
|
|
20
|
+
min: number;
|
|
21
|
+
/** Maximum allowed value. */
|
|
22
|
+
max: number;
|
|
23
|
+
/**
|
|
24
|
+
* Step size. When > 0, slider is discrete and snaps to multiples of step.
|
|
25
|
+
* When 0, slider is continuous.
|
|
26
|
+
*/
|
|
27
|
+
step: number;
|
|
28
|
+
/** Whether the slider is interactive. */
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
/** Layout orientation. */
|
|
31
|
+
orientation: SliderOrientation;
|
|
32
|
+
/** Physical size of the track. */
|
|
33
|
+
trackSize: SliderTrackSize;
|
|
34
|
+
/** Color variant. */
|
|
35
|
+
variant: SliderVariant;
|
|
36
|
+
/**
|
|
37
|
+
* When true, active track originates from center (50%) instead of the min end.
|
|
38
|
+
* Mirrors Compose's `SliderDefaults.Track(drawCenteredTrack = true)`.
|
|
39
|
+
*/
|
|
40
|
+
isCentered: boolean;
|
|
41
|
+
/** Show the floating value tooltip on hover/drag. */
|
|
42
|
+
showValueIndicator: boolean;
|
|
43
|
+
/** Ref to the track DOM element — used for drag constraint. */
|
|
44
|
+
trackRef: React.RefObject<HTMLDivElement | null>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Props for the `<Slider>` component.
|
|
48
|
+
*
|
|
49
|
+
* Supports both controlled (`value` + `onValueChange`) and
|
|
50
|
+
* uncontrolled (`defaultValue`) usage patterns per React standards.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* // Controlled
|
|
55
|
+
* <Slider value={volume} onValueChange={setVolume} min={0} max={100} />
|
|
56
|
+
*
|
|
57
|
+
* // Uncontrolled
|
|
58
|
+
* <Slider defaultValue={50} />
|
|
59
|
+
*
|
|
60
|
+
* // Discrete (step snapping)
|
|
61
|
+
* <Slider defaultValue={0} step={10} />
|
|
62
|
+
*
|
|
63
|
+
* // Vertical orientation
|
|
64
|
+
* <Slider defaultValue={50} orientation="vertical" />
|
|
65
|
+
*
|
|
66
|
+
* // Centered active track
|
|
67
|
+
* <Slider defaultValue={0} isCentered />
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export interface SliderProps {
|
|
71
|
+
/** Controlled current value. Use with `onValueChange`. */
|
|
72
|
+
value?: number;
|
|
73
|
+
/** Initial value for uncontrolled usage. @default midpoint of min/max */
|
|
74
|
+
defaultValue?: number;
|
|
75
|
+
/** Called whenever the value changes during interaction. */
|
|
76
|
+
onValueChange?: (value: number) => void;
|
|
77
|
+
/** Called when the user finishes dragging / commits a keyboard change. */
|
|
78
|
+
onValueChangeEnd?: (value: number) => void;
|
|
79
|
+
/** Minimum value. @default 0 */
|
|
80
|
+
min?: number;
|
|
81
|
+
/** Maximum value. @default 100 */
|
|
82
|
+
max?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Step size. When > 0, slider snaps to multiples of `step` from `min`
|
|
85
|
+
* and renders tick marks. When 0, slider is continuous.
|
|
86
|
+
* @default 0
|
|
87
|
+
*/
|
|
88
|
+
step?: number;
|
|
89
|
+
/** Layout orientation. @default "horizontal" */
|
|
90
|
+
orientation?: SliderOrientation;
|
|
91
|
+
/**
|
|
92
|
+
* Physical track size.
|
|
93
|
+
* Horizontal: height. Vertical: width.
|
|
94
|
+
* @default "m"
|
|
95
|
+
*/
|
|
96
|
+
trackSize?: SliderTrackSize;
|
|
97
|
+
/**
|
|
98
|
+
* Color variant.
|
|
99
|
+
* @default "primary"
|
|
100
|
+
*/
|
|
101
|
+
variant?: SliderVariant;
|
|
102
|
+
/**
|
|
103
|
+
* When true, the active track segment grows from the center (50%)
|
|
104
|
+
* outward toward the thumb position.
|
|
105
|
+
* @default false
|
|
106
|
+
*/
|
|
107
|
+
isCentered?: boolean;
|
|
108
|
+
/** Disables all interaction. @default false */
|
|
109
|
+
disabled?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* When true, shows a floating value indicator tooltip above the thumb.
|
|
112
|
+
* @default false
|
|
113
|
+
*/
|
|
114
|
+
showValueIndicator?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* When true, shows tick marks along the track.
|
|
117
|
+
* Only applicable if `step` > 0.
|
|
118
|
+
* @default false
|
|
119
|
+
*/
|
|
120
|
+
showTicks?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Track shape configuration for border radius.
|
|
123
|
+
* - "md3": Default MD3 specific border radius per size
|
|
124
|
+
* - "full": Fully rounded ends (pill shape - size/2)
|
|
125
|
+
* - number: Custom border radius in px
|
|
126
|
+
* @default "md3"
|
|
127
|
+
*/
|
|
128
|
+
trackShape?: SliderTrackShape;
|
|
129
|
+
/**
|
|
130
|
+
* Icon rendered inside the track (inset icon).
|
|
131
|
+
* MD3 spec: only valid for M, L, XL track sizes.
|
|
132
|
+
* The icon moves from the active track to the inactive track
|
|
133
|
+
* when there's not enough space at low values.
|
|
134
|
+
* Do not use with `isCentered` or `RangeSlider`.
|
|
135
|
+
*/
|
|
136
|
+
insetIcon?: React.ReactNode;
|
|
137
|
+
/**
|
|
138
|
+
* Alternate icon shown when value equals `min`.
|
|
139
|
+
* Swaps with `insetIcon` at the minimum value
|
|
140
|
+
* (e.g., a mute icon replacing a volume icon when volume = 0).
|
|
141
|
+
*/
|
|
142
|
+
insetIconAtMin?: React.ReactNode;
|
|
143
|
+
/**
|
|
144
|
+
* Icon rendered inside the track at the trailing end (right side).
|
|
145
|
+
* Only valid for track sizes >= 40dp (e.g. XL).
|
|
146
|
+
*/
|
|
147
|
+
insetIconTrailing?: React.ReactNode;
|
|
148
|
+
/**
|
|
149
|
+
* Alternate icon shown when value equals `max`.
|
|
150
|
+
* Swaps with `insetIconTrailing` at the maximum value.
|
|
151
|
+
*/
|
|
152
|
+
insetIconAtMax?: React.ReactNode;
|
|
153
|
+
/** Additional CSS class applied to the outermost wrapper. */
|
|
154
|
+
className?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Accessible label for the slider when no visible label exists.
|
|
157
|
+
* Required if parent does not have a visible label.
|
|
158
|
+
*/
|
|
159
|
+
"aria-label"?: string;
|
|
160
|
+
/** ID of a visible label element. Required if `aria-label` is not provided. */
|
|
161
|
+
"aria-labelledby"?: string;
|
|
162
|
+
/**
|
|
163
|
+
* Format function for the displayed value in the value indicator tooltip.
|
|
164
|
+
* Defaults to `String(value)`.
|
|
165
|
+
*/
|
|
166
|
+
formatValue?: (value: number) => string;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Props for the `<RangeSlider>` component.
|
|
170
|
+
*
|
|
171
|
+
* Extends `SliderProps` with tuple-based value API.
|
|
172
|
+
* The two thumbs cannot cross each other.
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```tsx
|
|
176
|
+
* <RangeSlider
|
|
177
|
+
* value={[20, 80]}
|
|
178
|
+
* onValueChange={([start, end]) => setRange([start, end])}
|
|
179
|
+
* />
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
export interface RangeSliderProps extends Omit<SliderProps, "value" | "defaultValue" | "onValueChange" | "onValueChangeEnd" | "isCentered"> {
|
|
183
|
+
/** Controlled [start, end] tuple. Use with `onValueChange`. */
|
|
184
|
+
value?: [number, number];
|
|
185
|
+
/** Initial [start, end] tuple for uncontrolled usage. */
|
|
186
|
+
defaultValue?: [number, number];
|
|
187
|
+
/** Called whenever [start, end] changes during interaction. */
|
|
188
|
+
onValueChange?: (value: [number, number]) => void;
|
|
189
|
+
/** Called when the user finishes dragging either thumb. */
|
|
190
|
+
onValueChangeEnd?: (value: [number, number]) => void;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Props for `<SliderTrack>`.
|
|
194
|
+
* @internal
|
|
195
|
+
*/
|
|
196
|
+
export interface SliderTrackProps {
|
|
197
|
+
/** Current thumb position as 0–1 fraction. */
|
|
198
|
+
percent: number;
|
|
199
|
+
trackSize: SliderTrackSize;
|
|
200
|
+
orientation: SliderOrientation;
|
|
201
|
+
variant: SliderVariant;
|
|
202
|
+
isCentered: boolean;
|
|
203
|
+
/** For discrete mode: step size. 0 = no ticks. */
|
|
204
|
+
step: number;
|
|
205
|
+
min: number;
|
|
206
|
+
max: number;
|
|
207
|
+
disabled: boolean;
|
|
208
|
+
trackShape?: SliderTrackShape;
|
|
209
|
+
/** Ref forwarded to the root track element for drag constraint. */
|
|
210
|
+
trackRef: React.RefObject<HTMLDivElement | null>;
|
|
211
|
+
/** onClick handler on the track for click-to-jump. */
|
|
212
|
+
onTrackPointerDown?: (e: React.PointerEvent<HTMLDivElement>) => void;
|
|
213
|
+
/**
|
|
214
|
+
* Icon rendered inside the track (inset icon).
|
|
215
|
+
* @internal — passed down from Slider after guard check.
|
|
216
|
+
*/
|
|
217
|
+
insetIcon?: React.ReactNode;
|
|
218
|
+
/** Alternate icon swapped in when value === min. @internal */
|
|
219
|
+
insetIconAtMin?: React.ReactNode;
|
|
220
|
+
/** Icon rendered at the trailing end (right side). @internal */
|
|
221
|
+
insetIconTrailing?: React.ReactNode;
|
|
222
|
+
/** Alternate icon swapped in when value === max. @internal */
|
|
223
|
+
insetIconAtMax?: React.ReactNode;
|
|
224
|
+
/** Current slider value — used for inset icon swap at min/max. @internal */
|
|
225
|
+
value?: number;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Props for `<SliderThumb>`.
|
|
229
|
+
* @internal
|
|
230
|
+
*/
|
|
231
|
+
export interface SliderThumbProps {
|
|
232
|
+
/** Current value (for ARIA). */
|
|
233
|
+
value: number;
|
|
234
|
+
/** Current 0–1 fraction (for positioning). */
|
|
235
|
+
percent: number;
|
|
236
|
+
min: number;
|
|
237
|
+
max: number;
|
|
238
|
+
step: number;
|
|
239
|
+
disabled: boolean;
|
|
240
|
+
orientation: SliderOrientation;
|
|
241
|
+
showValueIndicator: boolean;
|
|
242
|
+
/** For the drag constraint ref. */
|
|
243
|
+
trackRef: React.RefObject<HTMLDivElement | null>;
|
|
244
|
+
trackSize: SliderTrackSize;
|
|
245
|
+
variant: SliderVariant;
|
|
246
|
+
/** Called during pointer drag with new value. */
|
|
247
|
+
onValueChange: (value: number) => void;
|
|
248
|
+
/** Called on drag end / keyboard commit. */
|
|
249
|
+
onValueChangeEnd?: (value: number) => void;
|
|
250
|
+
/** Value display formatter. */
|
|
251
|
+
formatValue?: (value: number) => string;
|
|
252
|
+
/** Unique ID for ARIA. */
|
|
253
|
+
thumbId?: string;
|
|
254
|
+
/** zIndex for RangeSlider layering. */
|
|
255
|
+
zIndex?: number;
|
|
256
|
+
/** Optional accessible label for this specific thumb. */
|
|
257
|
+
"aria-label"?: string;
|
|
258
|
+
"aria-labelledby"?: string;
|
|
259
|
+
}
|
|
@@ -146,6 +146,7 @@ export declare namespace SnackbarHost {
|
|
|
146
146
|
interface SnackbarContextValue {
|
|
147
147
|
showSnackbar: (visuals: SnackbarVisuals) => Promise<SnackbarResult>;
|
|
148
148
|
}
|
|
149
|
+
export declare const SnackbarContext: React.Context<SnackbarContextValue | null>;
|
|
149
150
|
/**
|
|
150
151
|
* MD3 SnackbarProvider — context provider for imperative snackbar API.
|
|
151
152
|
*
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type ThemeMode } from "../../lib/theme-utils";
|
|
3
|
+
import { Typography } from "../typography/typography";
|
|
4
|
+
import { type FontVariationAxes } from "../typography/typography-tokens";
|
|
3
5
|
interface ThemeContextValue {
|
|
4
6
|
sourceColor: string;
|
|
5
7
|
setSourceColor: (color: string) => void;
|
|
@@ -11,8 +13,36 @@ export interface MD3ThemeProviderProps {
|
|
|
11
13
|
sourceColor?: string;
|
|
12
14
|
defaultMode?: ThemeMode;
|
|
13
15
|
persistToLocalStorage?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* A fully custom `Typography` instance.
|
|
18
|
+
* When provided, `fontFamily` and `fontVariationAxes` are ignored.
|
|
19
|
+
*/
|
|
20
|
+
typography?: Typography;
|
|
21
|
+
/**
|
|
22
|
+
* Override the CSS `font-family` for all typography styles.
|
|
23
|
+
* Ignored when `typography` prop is provided.
|
|
24
|
+
* @example "'Inter', sans-serif"
|
|
25
|
+
*/
|
|
26
|
+
fontFamily?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Variable font axes applied globally via `font-variation-settings`.
|
|
29
|
+
* Merged on top of defaults (`ROND: 100`). Ignored when `typography` is provided.
|
|
30
|
+
* @example { ROND: 50 }
|
|
31
|
+
*/
|
|
32
|
+
fontVariationAxes?: FontVariationAxes;
|
|
33
|
+
/**
|
|
34
|
+
* When `true`, mounts `SnackbarHost` inside the provider and exposes
|
|
35
|
+
* `useSnackbar()` to all descendants — no separate `<SnackbarProvider>` needed.
|
|
36
|
+
*
|
|
37
|
+
* Opt-in, default `false`. For advanced usage (e.g., scoped snackbars or
|
|
38
|
+
* custom host positioning), keep this `false` and use `<SnackbarProvider>`
|
|
39
|
+
* or `<SnackbarHost>` directly.
|
|
40
|
+
*
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
enableSnackbar?: boolean;
|
|
14
44
|
}
|
|
15
|
-
export declare function MD3ThemeProvider({ children, sourceColor: initialSourceColor, defaultMode, persistToLocalStorage, }: MD3ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export declare function MD3ThemeProvider({ children, sourceColor: initialSourceColor, defaultMode, persistToLocalStorage, typography: typographyProp, fontFamily, fontVariationAxes, enableSnackbar, }: MD3ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
16
46
|
export declare function useTheme(): ThemeContextValue;
|
|
17
47
|
export declare function useThemeMode(): Pick<ThemeContextValue, "mode" | "setMode">;
|
|
18
48
|
export {};
|
package/dist/ui/toc.d.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* (~100px) and early deactivation (~80% from bottom) so the active item changes
|
|
15
15
|
* before the section scrolls off-screen.
|
|
16
16
|
*/
|
|
17
|
+
import { type ScrollAreaProps } from "./scroll-area";
|
|
17
18
|
/**
|
|
18
19
|
* A single entry in the Table of Contents.
|
|
19
20
|
*
|
|
@@ -45,6 +46,11 @@ export interface TableOfContentsProps {
|
|
|
45
46
|
* Use this to control positioning (e.g. sticky, fixed) from the consumer.
|
|
46
47
|
*/
|
|
47
48
|
className?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Configuration for the internal ScrollArea.
|
|
51
|
+
* @default { type: "hover" }
|
|
52
|
+
*/
|
|
53
|
+
scrollAreaProps?: Omit<ScrollAreaProps, "children">;
|
|
48
54
|
}
|
|
49
55
|
/**
|
|
50
56
|
* Table of Contents sidebar component.
|
|
@@ -71,4 +77,4 @@ export interface TableOfContentsProps {
|
|
|
71
77
|
*
|
|
72
78
|
* @see https://m3.material.io/foundations/content-design/navigation
|
|
73
79
|
*/
|
|
74
|
-
export declare function TableOfContents({ items, className }: TableOfContentsProps): import("react/jsx-runtime").JSX.Element;
|
|
80
|
+
export declare function TableOfContents({ items, className, scrollAreaProps, }: TableOfContentsProps): import("react/jsx-runtime").JSX.Element;
|