mtrl 0.8.0-next.47 → 0.8.0-next.48
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/extended-fab/config.js +10 -1
- package/dist/components/extended-fab/constants.d.ts +16 -4
- package/dist/components/extended-fab/constants.js +8 -0
- package/dist/components/extended-fab/extended-fab.js +6 -1
- package/dist/components/extended-fab/index.d.ts +1 -1
- package/dist/components/extended-fab/types.d.ts +13 -6
- package/dist/components/fab/config.js +6 -6
- package/dist/components/fab/constants.d.ts +18 -7
- package/dist/components/fab/constants.js +8 -2
- package/dist/components/fab/index.d.ts +1 -1
- package/dist/components/fab/types.d.ts +10 -9
- package/dist/core/compose/features/text.js +1 -0
- package/dist/index.cjs +11 -11
- package/dist/package.json +1 -1
- package/dist/styles/badge.css +1 -1
- package/dist/styles/base.css +1 -1
- package/dist/styles/bottom-app-bar.css +1 -1
- package/dist/styles/bottom-sheet.css +1 -1
- package/dist/styles/button-group.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/chips.css +1 -1
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/divider.css +1 -1
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/extended-fab.css +2 -2
- package/dist/styles/fab.css +2 -2
- package/dist/styles/icon-button.css +1 -1
- package/dist/styles/list.css +1 -1
- package/dist/styles/loading-indicator.css +1 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/navigation-rail.css +1 -1
- package/dist/styles/navigation.css +1 -1
- package/dist/styles/progress.css +1 -1
- package/dist/styles/radios.css +1 -1
- package/dist/styles/search.css +1 -1
- package/dist/styles/segmented-button.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/side-sheet.css +1 -1
- package/dist/styles/slider.css +1 -1
- package/dist/styles/snackbar.css +1 -1
- package/dist/styles/split-button.css +1 -1
- package/dist/styles/switch.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/textfield.css +1 -1
- package/dist/styles/timepicker.css +1 -1
- package/dist/styles/top-app-bar.css +1 -1
- package/dist/styles/utilities.css +1 -1
- package/dist/styles.css +2 -2
- package/dist/themes/autumn.css +1 -1
- package/dist/themes/baseline.css +1 -1
- package/dist/themes/brownbeige.css +1 -1
- package/dist/themes/browngreen.css +1 -1
- package/dist/themes/desert.css +1 -1
- package/dist/themes/forest.css +1 -1
- package/dist/themes/highcontrast.css +1 -1
- package/dist/themes/legacy.css +1 -1
- package/dist/themes/material.css +1 -1
- package/dist/themes/ocean.css +1 -1
- package/dist/themes/sageivory.css +1 -1
- package/dist/themes/spring.css +1 -1
- package/dist/themes/summer.css +1 -1
- package/dist/themes/sunset.css +1 -1
- package/dist/themes/tealcaramel.css +1 -1
- package/dist/themes/winter.css +1 -1
- package/package.json +1 -1
- package/src/styles/components/_extended-fab.scss +95 -111
- package/src/styles/components/_fab.scss +70 -87
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { createComponentConfig, createElementConfig, } from "../../core/config/component.js";
|
|
2
|
+
import { EXTENDED_FAB_CLASSES } from "./constants.js";
|
|
2
3
|
export const defaultConfig = {
|
|
3
|
-
variant: "primary",
|
|
4
|
+
variant: "primary-container",
|
|
4
5
|
type: "button",
|
|
5
6
|
ripple: true,
|
|
6
7
|
iconPosition: "start",
|
|
7
8
|
width: "fixed",
|
|
9
|
+
size: "small",
|
|
8
10
|
};
|
|
9
11
|
export const createBaseConfig = (config = {}) => createComponentConfig(defaultConfig, config, "extended-fab");
|
|
10
12
|
export const getElementConfig = (config) => {
|
|
@@ -12,10 +14,17 @@ export const getElementConfig = (config) => {
|
|
|
12
14
|
type: config.type || "button",
|
|
13
15
|
"aria-label": config.ariaLabel || config.text || (config.icon ? "action" : undefined),
|
|
14
16
|
};
|
|
17
|
+
if (config.value !== undefined) {
|
|
18
|
+
attributes.value = config.value;
|
|
19
|
+
}
|
|
15
20
|
const classNames = [`${config.prefix}-extended-fab`];
|
|
16
21
|
if (config.variant) {
|
|
17
22
|
classNames.push(`${config.prefix}-extended-fab--${config.variant}`);
|
|
18
23
|
}
|
|
24
|
+
classNames.push(`${config.prefix}-extended-fab--${config.size || "small"}`);
|
|
25
|
+
if (config.iconPosition === "end") {
|
|
26
|
+
classNames.push(`${config.prefix}-${EXTENDED_FAB_CLASSES.ICON_END}`);
|
|
27
|
+
}
|
|
19
28
|
if (config.width) {
|
|
20
29
|
classNames.push(`${config.prefix}-extended-fab--${config.width}`);
|
|
21
30
|
}
|
|
@@ -2,15 +2,27 @@
|
|
|
2
2
|
* Extended FAB variants following Material Design 3 guidelines
|
|
3
3
|
*/
|
|
4
4
|
export declare const EXTENDED_FAB_VARIANTS: {
|
|
5
|
-
/**
|
|
5
|
+
/** Primary container colour (default) */
|
|
6
|
+
readonly PRIMARY_CONTAINER: "primary-container";
|
|
7
|
+
/** Secondary container colour */
|
|
8
|
+
readonly SECONDARY_CONTAINER: "secondary-container";
|
|
9
|
+
/** Tertiary container colour */
|
|
10
|
+
readonly TERTIARY_CONTAINER: "tertiary-container";
|
|
11
|
+
/** Primary tone colour */
|
|
6
12
|
readonly PRIMARY: "primary";
|
|
7
|
-
/**
|
|
13
|
+
/** Secondary tone colour */
|
|
8
14
|
readonly SECONDARY: "secondary";
|
|
9
|
-
/**
|
|
15
|
+
/** Tertiary tone colour */
|
|
10
16
|
readonly TERTIARY: "tertiary";
|
|
11
|
-
/**
|
|
17
|
+
/** @deprecated Use a container or tone style instead. */
|
|
12
18
|
readonly SURFACE: "surface";
|
|
13
19
|
};
|
|
20
|
+
/** Expressive extended FAB sizes. */
|
|
21
|
+
export declare const EXTENDED_FAB_SIZES: {
|
|
22
|
+
readonly SMALL: "small";
|
|
23
|
+
readonly MEDIUM: "medium";
|
|
24
|
+
readonly LARGE: "large";
|
|
25
|
+
};
|
|
14
26
|
/**
|
|
15
27
|
* Extended FAB width behavior
|
|
16
28
|
*/
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
export const EXTENDED_FAB_VARIANTS = {
|
|
2
|
+
PRIMARY_CONTAINER: 'primary-container',
|
|
3
|
+
SECONDARY_CONTAINER: 'secondary-container',
|
|
4
|
+
TERTIARY_CONTAINER: 'tertiary-container',
|
|
2
5
|
PRIMARY: 'primary',
|
|
3
6
|
SECONDARY: 'secondary',
|
|
4
7
|
TERTIARY: 'tertiary',
|
|
5
8
|
SURFACE: 'surface'
|
|
6
9
|
};
|
|
10
|
+
export const EXTENDED_FAB_SIZES = {
|
|
11
|
+
SMALL: 'small',
|
|
12
|
+
MEDIUM: 'medium',
|
|
13
|
+
LARGE: 'large'
|
|
14
|
+
};
|
|
7
15
|
export const EXTENDED_FAB_WIDTH = {
|
|
8
16
|
FIXED: 'fixed',
|
|
9
17
|
FLUID: 'fluid'
|
|
@@ -42,7 +42,12 @@ const createExtendedFab = (config = {}) => {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
try {
|
|
45
|
-
const extendedFab = pipe(createBase, withEvents(), withElement(getElementConfig(fabConfig)), withVariant(fabConfig), withIcon(fabConfig),
|
|
45
|
+
const extendedFab = pipe(createBase, withEvents(), withElement(getElementConfig(fabConfig)), withVariant(fabConfig), withIcon(fabConfig), component => withText({
|
|
46
|
+
...fabConfig,
|
|
47
|
+
beforeElement: fabConfig.iconPosition === 'end'
|
|
48
|
+
? component.icon.getElement() ?? undefined
|
|
49
|
+
: undefined,
|
|
50
|
+
})(component), withDisabled(fabConfig), withRipple(fabConfig), withLifecycle(), comp => withAPI(getApiConfig(comp))(comp))(fabConfig);
|
|
46
51
|
setupScrollCollapse(extendedFab);
|
|
47
52
|
return extendedFab;
|
|
48
53
|
}
|
|
@@ -33,4 +33,4 @@
|
|
|
33
33
|
* @category Components
|
|
34
34
|
*/
|
|
35
35
|
export { default, default as createExtendedFab } from "./extended-fab.js";
|
|
36
|
-
export type { ExtendedFabConfig, ExtendedFabComponent, ExtendedFabVariant, ExtendedFabWidth, ExtendedFabPosition } from "./types.js";
|
|
36
|
+
export type { ExtendedFabConfig, ExtendedFabComponent, ExtendedFabVariant, ExtendedFabSize, ExtendedFabWidth, ExtendedFabPosition } from "./types.js";
|
|
@@ -6,12 +6,17 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @category Components
|
|
8
8
|
* @remarks
|
|
9
|
-
* - primary
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
*
|
|
9
|
+
* - primary-container, secondary-container, tertiary-container: container styles
|
|
10
|
+
* - primary, secondary, tertiary: tone styles
|
|
11
|
+
* - surface: deprecated; use a container or tone style instead
|
|
12
|
+
* Default: primary-container.
|
|
13
13
|
*/
|
|
14
|
-
export type ExtendedFabVariant = "primary" | "secondary" | "tertiary" | "surface";
|
|
14
|
+
export type ExtendedFabVariant = "primary-container" | "secondary-container" | "tertiary-container" | "primary" | "secondary" | "tertiary" | "surface";
|
|
15
|
+
/**
|
|
16
|
+
* Expressive extended FAB size: small 56dp, medium 80dp, large 96dp.
|
|
17
|
+
* @category Components
|
|
18
|
+
*/
|
|
19
|
+
export type ExtendedFabSize = "small" | "medium" | "large";
|
|
15
20
|
/**
|
|
16
21
|
* Extended FAB width behavior
|
|
17
22
|
*
|
|
@@ -48,12 +53,14 @@ export type ExtendedFabPosition = "top-right" | "top-left" | "bottom-right" | "b
|
|
|
48
53
|
* @see https://m3.material.io/components/extended-fab/overview
|
|
49
54
|
*/
|
|
50
55
|
export interface ExtendedFabConfig {
|
|
56
|
+
/** Expressive container, icon and label size. @default 'small' */
|
|
57
|
+
size?: ExtendedFabSize;
|
|
51
58
|
/**
|
|
52
59
|
* Extended FAB variant that determines visual styling
|
|
53
60
|
*
|
|
54
61
|
* The color variant affects the Extended FAB's background color, text color, and elevation.
|
|
55
62
|
*
|
|
56
|
-
* @default 'primary'
|
|
63
|
+
* @default 'primary-container'
|
|
57
64
|
*
|
|
58
65
|
* @example
|
|
59
66
|
* ```typescript
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createComponentConfig, createElementConfig, } from "../../core/config/component.js";
|
|
2
2
|
export const defaultConfig = {
|
|
3
|
-
variant: "primary",
|
|
3
|
+
variant: "primary-container",
|
|
4
4
|
size: "default",
|
|
5
5
|
type: "button",
|
|
6
6
|
ripple: true,
|
|
@@ -11,6 +11,9 @@ export const getElementConfig = (config) => {
|
|
|
11
11
|
type: config.type || "button",
|
|
12
12
|
"aria-label": config.ariaLabel || (config.icon ? "action" : undefined),
|
|
13
13
|
};
|
|
14
|
+
if (config.value !== undefined) {
|
|
15
|
+
attributes.value = config.value;
|
|
16
|
+
}
|
|
14
17
|
if (config.disabled === true) {
|
|
15
18
|
attributes.disabled = true;
|
|
16
19
|
}
|
|
@@ -25,13 +28,10 @@ export const getElementConfig = (config) => {
|
|
|
25
28
|
if (config.disabled === true) {
|
|
26
29
|
componentClasses.push(`fab--disabled`);
|
|
27
30
|
}
|
|
28
|
-
|
|
29
|
-
...config,
|
|
30
|
-
className: componentClasses,
|
|
31
|
-
};
|
|
32
|
-
return createElementConfig(enhancedConfig, {
|
|
31
|
+
return createElementConfig(config, {
|
|
33
32
|
tag: "button",
|
|
34
33
|
attributes,
|
|
34
|
+
className: componentClasses,
|
|
35
35
|
forwardEvents: {
|
|
36
36
|
click: (component) => !component.element.disabled,
|
|
37
37
|
focus: true,
|
|
@@ -2,23 +2,31 @@
|
|
|
2
2
|
* FAB variants following Material Design 3 guidelines
|
|
3
3
|
*/
|
|
4
4
|
export declare const FAB_VARIANTS: {
|
|
5
|
-
/**
|
|
5
|
+
/** Primary container colour (default) */
|
|
6
|
+
readonly PRIMARY_CONTAINER: "primary-container";
|
|
7
|
+
/** Secondary container colour */
|
|
8
|
+
readonly SECONDARY_CONTAINER: "secondary-container";
|
|
9
|
+
/** Tertiary container colour */
|
|
10
|
+
readonly TERTIARY_CONTAINER: "tertiary-container";
|
|
11
|
+
/** Primary tone colour */
|
|
6
12
|
readonly PRIMARY: "primary";
|
|
7
|
-
/**
|
|
13
|
+
/** Secondary tone colour */
|
|
8
14
|
readonly SECONDARY: "secondary";
|
|
9
|
-
/**
|
|
15
|
+
/** Tertiary tone colour */
|
|
10
16
|
readonly TERTIARY: "tertiary";
|
|
11
|
-
/**
|
|
17
|
+
/** @deprecated Use a container or tone style instead. */
|
|
12
18
|
readonly SURFACE: "surface";
|
|
13
19
|
};
|
|
14
20
|
/**
|
|
15
21
|
* FAB size variants
|
|
16
22
|
*/
|
|
17
23
|
export declare const FAB_SIZES: {
|
|
18
|
-
/**
|
|
24
|
+
/** @deprecated Small FABs are no longer recommended in M3 Expressive. */
|
|
19
25
|
readonly SMALL: "small";
|
|
20
26
|
/** 56px diameter, for standard primary actions (default) */
|
|
21
27
|
readonly DEFAULT: "default";
|
|
28
|
+
/** 80px diameter with a 28px icon */
|
|
29
|
+
readonly MEDIUM: "medium";
|
|
22
30
|
/** 96px diameter, for emphasis or touch-focused interfaces */
|
|
23
31
|
readonly LARGE: "large";
|
|
24
32
|
};
|
|
@@ -47,6 +55,8 @@ export declare const FAB_CLASSES: {
|
|
|
47
55
|
readonly LOWERED: "fab--lowered";
|
|
48
56
|
/** Applied to small FABs */
|
|
49
57
|
readonly SMALL: "fab--small";
|
|
58
|
+
/** Applied to medium FABs */
|
|
59
|
+
readonly MEDIUM: "fab--medium";
|
|
50
60
|
/** Applied to large FABs */
|
|
51
61
|
readonly LARGE: "fab--large";
|
|
52
62
|
};
|
|
@@ -62,9 +72,10 @@ export declare const FAB_TYPES: {
|
|
|
62
72
|
* Default icon sizes based on FAB size
|
|
63
73
|
*/
|
|
64
74
|
export declare const FAB_ICON_SIZES: {
|
|
65
|
-
readonly SMALL: "
|
|
75
|
+
readonly SMALL: "24px";
|
|
66
76
|
readonly DEFAULT: "24px";
|
|
67
|
-
readonly
|
|
77
|
+
readonly MEDIUM: "28px";
|
|
78
|
+
readonly LARGE: "32px";
|
|
68
79
|
};
|
|
69
80
|
/**
|
|
70
81
|
* Default animations for FAB
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export const FAB_VARIANTS = {
|
|
2
|
+
PRIMARY_CONTAINER: 'primary-container',
|
|
3
|
+
SECONDARY_CONTAINER: 'secondary-container',
|
|
4
|
+
TERTIARY_CONTAINER: 'tertiary-container',
|
|
2
5
|
PRIMARY: 'primary',
|
|
3
6
|
SECONDARY: 'secondary',
|
|
4
7
|
TERTIARY: 'tertiary',
|
|
@@ -7,6 +10,7 @@ export const FAB_VARIANTS = {
|
|
|
7
10
|
export const FAB_SIZES = {
|
|
8
11
|
SMALL: 'small',
|
|
9
12
|
DEFAULT: 'default',
|
|
13
|
+
MEDIUM: 'medium',
|
|
10
14
|
LARGE: 'large'
|
|
11
15
|
};
|
|
12
16
|
export const FAB_POSITIONS = {
|
|
@@ -20,6 +24,7 @@ export const FAB_CLASSES = {
|
|
|
20
24
|
ICON: 'fab-icon',
|
|
21
25
|
LOWERED: 'fab--lowered',
|
|
22
26
|
SMALL: 'fab--small',
|
|
27
|
+
MEDIUM: 'fab--medium',
|
|
23
28
|
LARGE: 'fab--large'
|
|
24
29
|
};
|
|
25
30
|
export const FAB_TYPES = {
|
|
@@ -28,9 +33,10 @@ export const FAB_TYPES = {
|
|
|
28
33
|
RESET: 'reset'
|
|
29
34
|
};
|
|
30
35
|
export const FAB_ICON_SIZES = {
|
|
31
|
-
SMALL: '
|
|
36
|
+
SMALL: '24px',
|
|
32
37
|
DEFAULT: '24px',
|
|
33
|
-
|
|
38
|
+
MEDIUM: '28px',
|
|
39
|
+
LARGE: '32px'
|
|
34
40
|
};
|
|
35
41
|
export const FAB_ANIMATIONS = {
|
|
36
42
|
ENTRANCE_DURATION: 250
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Features:
|
|
9
9
|
* - Multiple variants (primary, secondary, tertiary, surface)
|
|
10
|
-
* -
|
|
10
|
+
* - Four size options (small, default, medium, large; small is deprecated)
|
|
11
11
|
* - Configurable positioning
|
|
12
12
|
* - Icon support with customization
|
|
13
13
|
* - Ripple effect on interaction
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @category Components
|
|
8
8
|
* @remarks
|
|
9
|
-
* - primary
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
*
|
|
9
|
+
* - primary-container, secondary-container, tertiary-container: container styles
|
|
10
|
+
* - primary, secondary, tertiary: tone styles
|
|
11
|
+
* - surface: deprecated; use a container or tone style instead
|
|
12
|
+
* Default: primary-container.
|
|
13
13
|
*/
|
|
14
|
-
export type FabVariant = "primary" | "secondary" | "tertiary" | "surface";
|
|
14
|
+
export type FabVariant = "primary-container" | "secondary-container" | "tertiary-container" | "primary" | "secondary" | "tertiary" | "surface";
|
|
15
15
|
/**
|
|
16
16
|
* FAB size variants
|
|
17
17
|
*
|
|
@@ -20,11 +20,12 @@ export type FabVariant = "primary" | "secondary" | "tertiary" | "surface";
|
|
|
20
20
|
*
|
|
21
21
|
* @category Components
|
|
22
22
|
* @remarks
|
|
23
|
-
* - small: 40px
|
|
23
|
+
* - small: 40px container, 24px icon; deprecated in M3 Expressive
|
|
24
24
|
* - default: 56px diameter, for standard primary actions (default)
|
|
25
|
-
* -
|
|
25
|
+
* - medium: 80px container, 28px icon
|
|
26
|
+
* - large: 96px container, 32px icon
|
|
26
27
|
*/
|
|
27
|
-
export type FabSize = "small" | "default" | "large";
|
|
28
|
+
export type FabSize = "small" | "default" | "medium" | "large";
|
|
28
29
|
/**
|
|
29
30
|
* FAB position options
|
|
30
31
|
*
|
|
@@ -55,7 +56,7 @@ export interface FabConfig {
|
|
|
55
56
|
*
|
|
56
57
|
* The color variant affects the FAB's background color, icon color, and elevation.
|
|
57
58
|
*
|
|
58
|
-
* @default 'primary'
|
|
59
|
+
* @default 'primary-container'
|
|
59
60
|
*
|
|
60
61
|
* @example
|
|
61
62
|
* ```typescript
|
|
@@ -34,6 +34,7 @@ const createText = (element, config = {}) => {
|
|
|
34
34
|
export const withText = (config) => (component) => {
|
|
35
35
|
const text = createText(component.element, {
|
|
36
36
|
prefix: config.prefix,
|
|
37
|
+
beforeElement: config.beforeElement,
|
|
37
38
|
componentName: config.componentName || 'component'
|
|
38
39
|
});
|
|
39
40
|
if (config.text) {
|