mtrl 0.7.1 → 0.8.0-next.4
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/components/button/api.d.ts +4 -0
- package/dist/components/button/features/toggle.d.ts +42 -0
- package/dist/components/button/types.d.ts +30 -0
- package/dist/components/button-group/button-group.d.ts +6 -4
- package/dist/components/button-group/config.d.ts +15 -7
- package/dist/components/button-group/constants.d.ts +85 -17
- package/dist/components/button-group/index.d.ts +1 -1
- package/dist/components/button-group/types.d.ts +68 -4
- package/dist/components/carousel/api.d.ts +11 -30
- package/dist/components/carousel/arrangement.d.ts +23 -0
- package/dist/components/carousel/carousel.d.ts +13 -63
- package/dist/components/carousel/config.d.ts +2 -31
- package/dist/components/carousel/constants.d.ts +25 -151
- package/dist/components/carousel/features/index.d.ts +2 -5
- package/dist/components/carousel/features/scroll.d.ts +19 -0
- package/dist/components/carousel/features/slides.d.ts +18 -8
- package/dist/components/carousel/index.d.ts +3 -37
- package/dist/components/carousel/keylines.d.ts +65 -0
- package/dist/components/carousel/strategy.d.ts +36 -0
- package/dist/components/carousel/types.d.ts +36 -242
- package/dist/components/dialog/api.d.ts +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/slider/constants.d.ts +8 -8
- package/dist/components/slider/types.d.ts +4 -1
- package/dist/index.cjs +20 -10
- package/dist/index.cjs.map +41 -24
- package/dist/index.js +20 -10
- package/dist/index.js.map +41 -24
- package/dist/package.json +1 -1
- package/dist/styles.css +2 -2
- package/package.json +1 -1
- package/src/styles/abstract/_theme.scss +4 -2
- package/src/styles/abstract/_variables.scss +59 -12
- package/src/styles/components/_button-group.scss +122 -349
- package/src/styles/components/_button.scss +333 -591
- package/src/styles/components/_carousel.scss +131 -611
- package/src/styles/components/_icon-button.scss +23 -23
- package/src/styles/components/_slider.scss +10 -9
- package/src/styles/themes/_index.scss +1 -0
- package/src/styles/themes/_legacy.scss +73 -0
- package/dist/components/carousel/features/drag.d.ts +0 -8
|
@@ -1,276 +1,70 @@
|
|
|
1
|
+
export type CarouselVariant = "multi-browse" | "uncontained" | "hero" | "hero-center" | "full-screen";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*/
|
|
5
|
-
export type CarouselLayout =
|
|
6
|
-
/** Best for browsing many visual items at once (photos, event feeds) */
|
|
7
|
-
'multi-browse'
|
|
8
|
-
/** For highly customized or text-heavy carousels (traditional behavior) */
|
|
9
|
-
| 'uncontained'
|
|
10
|
-
/** For spotlighting very large visual items (featured content) */
|
|
11
|
-
| 'hero'
|
|
12
|
-
/** For immersive vertical-scrolling experiences */
|
|
13
|
-
| 'full-screen';
|
|
14
|
-
/**
|
|
15
|
-
* Carousel Scrolling Behaviors
|
|
16
|
-
* @category Components
|
|
17
|
-
*/
|
|
18
|
-
export type CarouselScrollBehavior =
|
|
19
|
-
/** Standard scrolling without snapping, recommended for uncontained layouts */
|
|
20
|
-
'default'
|
|
21
|
-
/** Items snap to carousel layout, recommended for multi-browse, hero, and full-screen layouts */
|
|
22
|
-
| 'snap';
|
|
23
|
-
/**
|
|
24
|
-
* Slide data interface
|
|
25
|
-
* @category Components
|
|
3
|
+
* Content of one carousel item. Either an image with optional text and a
|
|
4
|
+
* call to action, or arbitrary content.
|
|
26
5
|
*/
|
|
27
6
|
export interface CarouselSlide {
|
|
28
|
-
|
|
29
|
-
image
|
|
30
|
-
|
|
7
|
+
image?: string;
|
|
8
|
+
/** Alternative text for the image; empty when the image is decorative */
|
|
9
|
+
alt?: string;
|
|
31
10
|
title?: string;
|
|
32
|
-
/** Optional accent color in hexadecimal or RGB format */
|
|
33
|
-
accent?: string;
|
|
34
|
-
/** Optional description text */
|
|
35
11
|
description?: string;
|
|
36
|
-
/** Optional action button text */
|
|
37
12
|
buttonText?: string;
|
|
38
|
-
/** Optional action button URL */
|
|
39
13
|
buttonUrl?: string;
|
|
40
|
-
/**
|
|
41
|
-
|
|
14
|
+
/** Custom content, replaces the image and text */
|
|
15
|
+
content?: HTMLElement | string;
|
|
42
16
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Configuration interface for the Carousel component
|
|
45
|
-
* @category Components
|
|
46
|
-
*/
|
|
47
17
|
export interface CarouselConfig {
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
* @default 0
|
|
51
|
-
*/
|
|
52
|
-
initialSlide?: number;
|
|
53
|
-
/**
|
|
54
|
-
* Whether to loop the carousel
|
|
55
|
-
* @default true
|
|
56
|
-
*/
|
|
57
|
-
loop?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Transition effect for slide changes
|
|
60
|
-
* @default 'slide'
|
|
61
|
-
*/
|
|
62
|
-
transition?: 'slide' | 'fade' | 'none';
|
|
63
|
-
/**
|
|
64
|
-
* Transition duration in milliseconds
|
|
65
|
-
* @default 300
|
|
66
|
-
*/
|
|
67
|
-
transitionDuration?: number;
|
|
68
|
-
/**
|
|
69
|
-
* Slides configuration for the carousel
|
|
70
|
-
* @example [{ image: 'image1.jpg', title: 'Title', accent: '#E6E1E5' }]
|
|
71
|
-
*/
|
|
18
|
+
/** Layout, "multi-browse" by default */
|
|
19
|
+
variant?: CarouselVariant;
|
|
72
20
|
slides?: CarouselSlide[];
|
|
73
21
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
|
|
77
|
-
borderRadius?: number;
|
|
78
|
-
/**
|
|
79
|
-
* Gap between slides in pixels
|
|
80
|
-
* @default 8
|
|
22
|
+
* Width of a large item in px. Multi-browse and uncontained layouts
|
|
23
|
+
* treat it as the preferred width, hero layouts as a maximum (the
|
|
24
|
+
* container width by default).
|
|
81
25
|
*/
|
|
26
|
+
itemWidth?: number;
|
|
27
|
+
/** Space between items, 8 by default (16 for full-screen) */
|
|
82
28
|
gap?: number;
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
29
|
+
/** Space between the container edges and the items, 16 by default (0 for full-screen) */
|
|
30
|
+
padding?: number;
|
|
31
|
+
/** Corner radius of the items, 28 by default */
|
|
32
|
+
cornerRadius?: number;
|
|
33
|
+
/** Snap to items after scrolling; on by default except for uncontained layouts */
|
|
34
|
+
snap?: boolean;
|
|
35
|
+
initialSlide?: number;
|
|
36
|
+
minSmallItemWidth?: number;
|
|
37
|
+
maxSmallItemWidth?: number;
|
|
38
|
+
/** Accessible name of the carousel */
|
|
39
|
+
ariaLabel?: string;
|
|
92
40
|
prefix?: string;
|
|
93
|
-
/**
|
|
94
|
-
* Component name used in class generation
|
|
95
|
-
* @default 'carousel'
|
|
96
|
-
*/
|
|
97
41
|
componentName?: string;
|
|
98
|
-
|
|
99
|
-
* Callback for "Show all" action when present
|
|
100
|
-
*/
|
|
101
|
-
onShowAll?: () => void;
|
|
102
|
-
/**
|
|
103
|
-
* Whether to show a "Show all" link at the end
|
|
104
|
-
* MD3 recommends adding this for accessibility on vertical scrolling pages
|
|
105
|
-
* @default true
|
|
106
|
-
*/
|
|
107
|
-
showAllLink?: boolean;
|
|
108
|
-
/**
|
|
109
|
-
* MD3 carousel layout type
|
|
110
|
-
* @default 'multi-browse'
|
|
111
|
-
*/
|
|
112
|
-
layout?: CarouselLayout;
|
|
113
|
-
/**
|
|
114
|
-
* Scrolling behavior for the carousel
|
|
115
|
-
* @default depends on layout (snap for multi-browse, hero, full-screen; default for uncontained)
|
|
116
|
-
*/
|
|
117
|
-
scrollBehavior?: CarouselScrollBehavior;
|
|
118
|
-
/**
|
|
119
|
-
* Whether to center the carousel items (applies to hero layout)
|
|
120
|
-
* @default false
|
|
121
|
-
*/
|
|
122
|
-
centered?: boolean;
|
|
123
|
-
/**
|
|
124
|
-
* Maximum width of large items (affects how many items fit on screen)
|
|
125
|
-
* Large items should remain big enough to be easily recognizable
|
|
126
|
-
*/
|
|
127
|
-
largeItemMaxWidth?: number;
|
|
128
|
-
/**
|
|
129
|
-
* Width for small items in pixels
|
|
130
|
-
* @default 40-56dp range as per MD3 guidelines
|
|
131
|
-
*/
|
|
132
|
-
smallItemWidth?: number;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Slides API interface for carousel
|
|
136
|
-
* @category Components
|
|
137
|
-
*/
|
|
138
|
-
export interface SlidesAPI {
|
|
139
|
-
/**
|
|
140
|
-
* Adds a new slide to the carousel
|
|
141
|
-
* @param slide - CarouselSlide object with slide data
|
|
142
|
-
* @param index - Optional position to insert the slide
|
|
143
|
-
* @returns The slides API for chaining
|
|
144
|
-
*/
|
|
145
|
-
addSlide: (slide: CarouselSlide, index?: number) => SlidesAPI;
|
|
146
|
-
/**
|
|
147
|
-
* Removes a slide at the specified index
|
|
148
|
-
* @param index - Index of the slide to remove
|
|
149
|
-
* @returns The slides API for chaining
|
|
150
|
-
*/
|
|
151
|
-
removeSlide: (index: number) => SlidesAPI;
|
|
152
|
-
/**
|
|
153
|
-
* Updates an existing slide
|
|
154
|
-
* @param index - Index of the slide to update
|
|
155
|
-
* @param slide - Updated CarouselSlide object
|
|
156
|
-
* @returns The slides API for chaining
|
|
157
|
-
*/
|
|
158
|
-
updateSlide: (index: number, slide: CarouselSlide) => SlidesAPI;
|
|
159
|
-
/**
|
|
160
|
-
* Gets a slide at the specified index
|
|
161
|
-
* @param index - Index of the slide
|
|
162
|
-
* @returns CarouselSlide object or null if not found
|
|
163
|
-
*/
|
|
164
|
-
getSlide: (index: number) => CarouselSlide | null;
|
|
165
|
-
/**
|
|
166
|
-
* Gets the total number of slides
|
|
167
|
-
* @returns Number of slides
|
|
168
|
-
*/
|
|
169
|
-
getCount: () => number;
|
|
170
|
-
/**
|
|
171
|
-
* Gets all slide elements
|
|
172
|
-
* @returns Array of slide elements
|
|
173
|
-
*/
|
|
174
|
-
getElements: () => HTMLElement[];
|
|
42
|
+
class?: string;
|
|
175
43
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Carousel component interface
|
|
178
|
-
* @category Components
|
|
179
|
-
*/
|
|
180
44
|
export interface CarouselComponent {
|
|
181
|
-
/** The carousel's root DOM element */
|
|
182
45
|
element: HTMLElement;
|
|
183
|
-
/** API for managing carousel slides */
|
|
184
46
|
slides: SlidesAPI;
|
|
185
|
-
/** API for managing component lifecycle */
|
|
186
47
|
lifecycle: {
|
|
187
|
-
/** Destroys the component and cleans up resources */
|
|
188
48
|
destroy: () => void;
|
|
189
49
|
};
|
|
190
|
-
/**
|
|
191
|
-
* Gets a class name with the component's prefix
|
|
192
|
-
* @param name - Base class name
|
|
193
|
-
* @returns Prefixed class name
|
|
194
|
-
*/
|
|
195
50
|
getClass: (name: string) => string;
|
|
196
|
-
/**
|
|
197
|
-
* Goes to the next slide
|
|
198
|
-
* @returns The carousel component for chaining
|
|
199
|
-
*/
|
|
200
51
|
next: () => CarouselComponent;
|
|
201
|
-
/**
|
|
202
|
-
* Goes to the previous slide
|
|
203
|
-
* @returns The carousel component for chaining
|
|
204
|
-
*/
|
|
205
52
|
prev: () => CarouselComponent;
|
|
206
|
-
/**
|
|
207
|
-
* Goes to a specific slide
|
|
208
|
-
* @param index - Slide index
|
|
209
|
-
* @returns The carousel component for chaining
|
|
210
|
-
*/
|
|
211
53
|
goTo: (index: number) => CarouselComponent;
|
|
212
|
-
/**
|
|
213
|
-
* Gets the current slide index
|
|
214
|
-
* @returns Current slide index
|
|
215
|
-
*/
|
|
216
54
|
getCurrentSlide: () => number;
|
|
217
|
-
|
|
218
|
-
* Adds a new slide
|
|
219
|
-
* @param slide - CarouselSlide object with slide data
|
|
220
|
-
* @param index - Optional position to insert the slide
|
|
221
|
-
* @returns The carousel component for chaining
|
|
222
|
-
*/
|
|
55
|
+
getVariant: () => CarouselVariant;
|
|
223
56
|
addSlide: (slide: CarouselSlide, index?: number) => CarouselComponent;
|
|
224
|
-
/**
|
|
225
|
-
* Removes a slide
|
|
226
|
-
* @param index - Index of the slide to remove
|
|
227
|
-
* @returns The carousel component for chaining
|
|
228
|
-
*/
|
|
229
57
|
removeSlide: (index: number) => CarouselComponent;
|
|
230
|
-
/**
|
|
231
|
-
* Enables the loop mode
|
|
232
|
-
* @returns The carousel component for chaining
|
|
233
|
-
*/
|
|
234
|
-
enableLoop: () => CarouselComponent;
|
|
235
|
-
/**
|
|
236
|
-
* Disables the loop mode
|
|
237
|
-
* @returns The carousel component for chaining
|
|
238
|
-
*/
|
|
239
|
-
disableLoop: () => CarouselComponent;
|
|
240
|
-
/**
|
|
241
|
-
* Sets the carousel border radius
|
|
242
|
-
* @param radius - Border radius in pixels
|
|
243
|
-
* @returns The carousel component for chaining
|
|
244
|
-
*/
|
|
245
|
-
setBorderRadius: (radius: number) => CarouselComponent;
|
|
246
|
-
/**
|
|
247
|
-
* Sets the gap between slides
|
|
248
|
-
* @param gap - Gap size in pixels
|
|
249
|
-
* @returns The carousel component for chaining
|
|
250
|
-
*/
|
|
251
|
-
setGap: (gap: number) => CarouselComponent;
|
|
252
|
-
/**
|
|
253
|
-
* Destroys the carousel component and cleans up resources
|
|
254
|
-
*/
|
|
255
58
|
destroy: () => void;
|
|
256
|
-
/**
|
|
257
|
-
* Adds an event listener to the carousel
|
|
258
|
-
* @param event - Event name
|
|
259
|
-
* @param handler - Event handler function
|
|
260
|
-
* @returns The carousel component for chaining
|
|
261
|
-
*/
|
|
262
59
|
on: (event: string, handler: Function) => CarouselComponent;
|
|
263
|
-
/**
|
|
264
|
-
* Removes an event listener from the carousel
|
|
265
|
-
* @param event - Event name
|
|
266
|
-
* @param handler - Event handler function
|
|
267
|
-
* @returns The carousel component for chaining
|
|
268
|
-
*/
|
|
269
60
|
off: (event: string, handler: Function) => CarouselComponent;
|
|
270
|
-
/**
|
|
271
|
-
* Adds CSS classes to the carousel element
|
|
272
|
-
* @param classes - One or more class names to add
|
|
273
|
-
* @returns The carousel component for chaining
|
|
274
|
-
*/
|
|
275
61
|
addClass: (...classes: string[]) => CarouselComponent;
|
|
276
62
|
}
|
|
63
|
+
export interface SlidesAPI {
|
|
64
|
+
addSlide: (slide: CarouselSlide, index?: number) => SlidesAPI;
|
|
65
|
+
removeSlide: (index: number) => SlidesAPI;
|
|
66
|
+
updateSlide: (index: number, slide: CarouselSlide) => SlidesAPI;
|
|
67
|
+
getSlide: (index: number) => CarouselSlide | null;
|
|
68
|
+
getCount: () => number;
|
|
69
|
+
getElements: () => HTMLElement[];
|
|
70
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DialogComponent, DialogButton, DialogConfirmOptions, DialogFooterAlignment, DialogSize } from
|
|
1
|
+
import { DialogComponent, DialogButton, DialogConfirmOptions, DialogFooterAlignment, DialogSize } from "./types";
|
|
2
2
|
interface ApiOptions {
|
|
3
3
|
visibility: {
|
|
4
4
|
open: () => void;
|
|
@@ -24,6 +24,8 @@ export { default as createExtendedFab } from "./extended-fab";
|
|
|
24
24
|
export { default as createIconButton } from "./icon-button";
|
|
25
25
|
export { default as createList } from "./list";
|
|
26
26
|
export { default as createMenu } from "./menu";
|
|
27
|
+
export { default as createNavigation } from "./navigation";
|
|
28
|
+
export { default as createNavigationSystem } from "./navigation/system";
|
|
27
29
|
export { default as createProgress } from "./progress";
|
|
28
30
|
export { default as createRadios } from "./radios";
|
|
29
31
|
export { default as createSearch } from "./search";
|
|
@@ -26,7 +26,7 @@ export declare const SLIDER_SIZES: {
|
|
|
26
26
|
/** Large size - 56px track height */
|
|
27
27
|
readonly L: 56;
|
|
28
28
|
/** Extra large size - 96px track height */
|
|
29
|
-
readonly XL:
|
|
29
|
+
readonly XL: 96;
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
32
|
* Slider component size type
|
|
@@ -40,12 +40,12 @@ export type SliderSize = keyof typeof SLIDER_SIZES | number;
|
|
|
40
40
|
export declare const SLIDER_MEASUREMENTS: {
|
|
41
41
|
/** Handle size in pixels */
|
|
42
42
|
readonly HANDLE_SIZE: 16;
|
|
43
|
-
/** Handle height for XS and S sizes in pixels */
|
|
44
|
-
readonly SMALL_HANDLE_HEIGHT:
|
|
45
|
-
/** Handle height offset for M, L, XL sizes (added to track height) */
|
|
46
|
-
readonly HANDLE_HEIGHT_OFFSET:
|
|
47
|
-
/** Minimum container height in pixels */
|
|
48
|
-
readonly MIN_HEIGHT:
|
|
43
|
+
/** Handle height for XS and S sizes in pixels (M3: 44dp) */
|
|
44
|
+
readonly SMALL_HANDLE_HEIGHT: 44;
|
|
45
|
+
/** Handle height offset for M, L, XL sizes (added to track height: 52, 68, 108dp) */
|
|
46
|
+
readonly HANDLE_HEIGHT_OFFSET: 12;
|
|
47
|
+
/** Minimum container height in pixels (M3 minimum touch target) */
|
|
48
|
+
readonly MIN_HEIGHT: 48;
|
|
49
49
|
/** Track border radius in pixels */
|
|
50
50
|
readonly TRACK_RADIUS: 3;
|
|
51
51
|
/** External track radius for XS and S sizes in pixels */
|
|
@@ -57,7 +57,7 @@ export declare const SLIDER_MEASUREMENTS: {
|
|
|
57
57
|
/** Dot size in pixels */
|
|
58
58
|
readonly DOT_SIZE: 4;
|
|
59
59
|
/** Handle gap pixels */
|
|
60
|
-
readonly HANDLE_GAP:
|
|
60
|
+
readonly HANDLE_GAP: 6;
|
|
61
61
|
/** Handle gap reduction when pressed in pixels */
|
|
62
62
|
readonly HANDLE_GAP_PRESSED_REDUCTION: 2;
|
|
63
63
|
/** Center gap pixels for centered sliders */
|
|
@@ -26,7 +26,10 @@ export interface SliderConfig extends BaseComponentConfig {
|
|
|
26
26
|
step?: number;
|
|
27
27
|
/** Whether the slider is disabled */
|
|
28
28
|
disabled?: boolean;
|
|
29
|
-
/** Color variant of the slider
|
|
29
|
+
/** Color variant of the slider *
|
|
30
|
+
* A stylesheet can override the drawn colours per slider with the custom
|
|
31
|
+
* properties --mtrl-slider-color and --mtrl-slider-on-color.
|
|
32
|
+
*/
|
|
30
33
|
color?: SliderColor;
|
|
31
34
|
/** Size variant of the slider */
|
|
32
35
|
size?: SliderSize;
|