mtrl 0.8.0-next.46 → 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/components/icon-button/config.js +1 -1
- package/dist/components/icon-button/constants.d.ts +21 -21
- package/dist/components/icon-button/constants.js +8 -8
- package/dist/components/icon-button/features/toggle.js +2 -11
- package/dist/components/icon-button/icon-button.js +0 -6
- 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 +2 -2
- 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
- package/src/styles/components/_icon-button.scss +67 -103
|
@@ -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
|
|
@@ -38,7 +38,7 @@ export const getElementConfig = (config) => {
|
|
|
38
38
|
if (config.size && config.size !== "s") {
|
|
39
39
|
componentClasses.push(`icon-button--${config.size}`);
|
|
40
40
|
}
|
|
41
|
-
if (config.shape
|
|
41
|
+
if (config.shape) {
|
|
42
42
|
componentClasses.push(`icon-button--${config.shape}`);
|
|
43
43
|
}
|
|
44
44
|
if (config.width && config.width !== "default") {
|
|
@@ -26,22 +26,22 @@ export type IconButtonVariant = typeof ICON_BUTTON_VARIANTS[keyof typeof ICON_BU
|
|
|
26
26
|
*
|
|
27
27
|
* | Size | Container | Icon Size |
|
|
28
28
|
* |------|-----------|-----------|
|
|
29
|
-
* | XS | 32dp |
|
|
29
|
+
* | XS | 32dp | 20dp |
|
|
30
30
|
* | S | 40dp | 24dp |
|
|
31
31
|
* | M | 56dp | 24dp |
|
|
32
|
-
* | L | 96dp |
|
|
33
|
-
* | XL | 136dp |
|
|
32
|
+
* | L | 96dp | 32dp |
|
|
33
|
+
* | XL | 136dp | 40dp |
|
|
34
34
|
*/
|
|
35
35
|
export declare const ICON_BUTTON_SIZES: {
|
|
36
|
-
/** Extra small - 32px container,
|
|
36
|
+
/** Extra small - 32px container, 20px icon */
|
|
37
37
|
readonly XS: "xs";
|
|
38
38
|
/** Small - 40px container, 24px icon (default) */
|
|
39
39
|
readonly S: "s";
|
|
40
40
|
/** Medium - 56px container, 24px icon */
|
|
41
41
|
readonly M: "m";
|
|
42
|
-
/** Large - 96px container,
|
|
42
|
+
/** Large - 96px container, 32px icon */
|
|
43
43
|
readonly L: "l";
|
|
44
|
-
/** Extra large - 136px container,
|
|
44
|
+
/** Extra large - 136px container, 40px icon */
|
|
45
45
|
readonly XL: "xl";
|
|
46
46
|
};
|
|
47
47
|
/**
|
|
@@ -69,11 +69,11 @@ export type IconButtonShape = typeof ICON_BUTTON_SHAPES[keyof typeof ICON_BUTTON
|
|
|
69
69
|
*
|
|
70
70
|
* | Size | Narrow | Default | Wide |
|
|
71
71
|
* |------|--------|---------|--------|
|
|
72
|
-
* | XS | 28dp | 32dp |
|
|
73
|
-
* | S | 32dp | 40dp |
|
|
74
|
-
* | M | 48dp | 56dp |
|
|
75
|
-
* | L |
|
|
76
|
-
* | XL |
|
|
72
|
+
* | XS | 28dp | 32dp | 40dp |
|
|
73
|
+
* | S | 32dp | 40dp | 52dp |
|
|
74
|
+
* | M | 48dp | 56dp | 72dp |
|
|
75
|
+
* | L | 64dp | 96dp | 128dp |
|
|
76
|
+
* | XL | 104dp | 136dp | 184dp |
|
|
77
77
|
*/
|
|
78
78
|
export declare const ICON_BUTTON_WIDTHS: {
|
|
79
79
|
/** Narrow width */
|
|
@@ -148,11 +148,11 @@ export declare const ICON_BUTTON_CORNER_RADIUS: {
|
|
|
148
148
|
* Icon sizes per button size (in dp)
|
|
149
149
|
*/
|
|
150
150
|
export declare const ICON_BUTTON_ICON_SIZES: {
|
|
151
|
-
readonly XS:
|
|
151
|
+
readonly XS: 20;
|
|
152
152
|
readonly S: 24;
|
|
153
153
|
readonly M: 24;
|
|
154
|
-
readonly L:
|
|
155
|
-
readonly XL:
|
|
154
|
+
readonly L: 32;
|
|
155
|
+
readonly XL: 40;
|
|
156
156
|
};
|
|
157
157
|
/**
|
|
158
158
|
* Container sizes per button size (in dp)
|
|
@@ -171,26 +171,26 @@ export declare const ICON_BUTTON_WIDTH_VALUES: {
|
|
|
171
171
|
readonly XS: {
|
|
172
172
|
readonly narrow: 28;
|
|
173
173
|
readonly default: 32;
|
|
174
|
-
readonly wide:
|
|
174
|
+
readonly wide: 40;
|
|
175
175
|
};
|
|
176
176
|
readonly S: {
|
|
177
177
|
readonly narrow: 32;
|
|
178
178
|
readonly default: 40;
|
|
179
|
-
readonly wide:
|
|
179
|
+
readonly wide: 52;
|
|
180
180
|
};
|
|
181
181
|
readonly M: {
|
|
182
182
|
readonly narrow: 48;
|
|
183
183
|
readonly default: 56;
|
|
184
|
-
readonly wide:
|
|
184
|
+
readonly wide: 72;
|
|
185
185
|
};
|
|
186
186
|
readonly L: {
|
|
187
|
-
readonly narrow:
|
|
187
|
+
readonly narrow: 64;
|
|
188
188
|
readonly default: 96;
|
|
189
|
-
readonly wide:
|
|
189
|
+
readonly wide: 128;
|
|
190
190
|
};
|
|
191
191
|
readonly XL: {
|
|
192
|
-
readonly narrow:
|
|
192
|
+
readonly narrow: 104;
|
|
193
193
|
readonly default: 136;
|
|
194
|
-
readonly wide:
|
|
194
|
+
readonly wide: 184;
|
|
195
195
|
};
|
|
196
196
|
};
|
|
@@ -45,11 +45,11 @@ export const ICON_BUTTON_CORNER_RADIUS = {
|
|
|
45
45
|
XL: { square: 28, pressed: 16 }
|
|
46
46
|
};
|
|
47
47
|
export const ICON_BUTTON_ICON_SIZES = {
|
|
48
|
-
XS:
|
|
48
|
+
XS: 20,
|
|
49
49
|
S: 24,
|
|
50
50
|
M: 24,
|
|
51
|
-
L:
|
|
52
|
-
XL:
|
|
51
|
+
L: 32,
|
|
52
|
+
XL: 40
|
|
53
53
|
};
|
|
54
54
|
export const ICON_BUTTON_CONTAINER_SIZES = {
|
|
55
55
|
XS: 32,
|
|
@@ -59,9 +59,9 @@ export const ICON_BUTTON_CONTAINER_SIZES = {
|
|
|
59
59
|
XL: 136
|
|
60
60
|
};
|
|
61
61
|
export const ICON_BUTTON_WIDTH_VALUES = {
|
|
62
|
-
XS: { narrow: 28, default: 32, wide:
|
|
63
|
-
S: { narrow: 32, default: 40, wide:
|
|
64
|
-
M: { narrow: 48, default: 56, wide:
|
|
65
|
-
L: { narrow:
|
|
66
|
-
XL: { narrow:
|
|
62
|
+
XS: { narrow: 28, default: 32, wide: 40 },
|
|
63
|
+
S: { narrow: 32, default: 40, wide: 52 },
|
|
64
|
+
M: { narrow: 48, default: 56, wide: 72 },
|
|
65
|
+
L: { narrow: 64, default: 96, wide: 128 },
|
|
66
|
+
XL: { narrow: 104, default: 136, wide: 184 }
|
|
67
67
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getCleanup } from "../../../core/compose/cleanup.js";
|
|
1
2
|
export const withToggle = (config) => (component) => {
|
|
2
3
|
if (!config.toggle) {
|
|
3
4
|
return {
|
|
@@ -112,17 +113,7 @@ export const withToggle = (config) => (component) => {
|
|
|
112
113
|
};
|
|
113
114
|
if (toggleOnClick) {
|
|
114
115
|
component.element.addEventListener("click", handleClick);
|
|
115
|
-
|
|
116
|
-
const originalDestroy = component.lifecycle?.destroy;
|
|
117
|
-
if (component.lifecycle) {
|
|
118
|
-
component.lifecycle.destroy = () => {
|
|
119
|
-
if (toggleOnClick) {
|
|
120
|
-
component.element.removeEventListener("click", handleClick);
|
|
121
|
-
}
|
|
122
|
-
if (originalDestroy) {
|
|
123
|
-
originalDestroy();
|
|
124
|
-
}
|
|
125
|
-
};
|
|
116
|
+
getCleanup(component).add(() => component.element.removeEventListener("click", handleClick));
|
|
126
117
|
}
|
|
127
118
|
return {
|
|
128
119
|
...component,
|
|
@@ -8,12 +8,6 @@ const createIconButton = (config = {}) => {
|
|
|
8
8
|
const baseConfig = createBaseConfig(config);
|
|
9
9
|
try {
|
|
10
10
|
const iconButton = pipe(createBase, withEvents(), withElement(getElementConfig(baseConfig)), withVariant(baseConfig), withSize(baseConfig), withIcon(baseConfig), withDisabled(baseConfig), withToggle(baseConfig), withRipple(baseConfig), withLifecycle(), (component) => {
|
|
11
|
-
if (baseConfig.shape && baseConfig.shape !== 'round' && component.element) {
|
|
12
|
-
const className = `${baseConfig.prefix}-${baseConfig.componentName}--${baseConfig.shape}`;
|
|
13
|
-
component.element.classList.add(className);
|
|
14
|
-
}
|
|
15
|
-
return component;
|
|
16
|
-
}, (component) => {
|
|
17
11
|
if (baseConfig.width && baseConfig.width !== 'default' && component.element) {
|
|
18
12
|
const className = `${baseConfig.prefix}-${baseConfig.componentName}--${baseConfig.width}`;
|
|
19
13
|
component.element.classList.add(className);
|
|
@@ -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) {
|