mtrl 0.8.0-next.47 → 0.8.0-next.49

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.
Files changed (77) hide show
  1. package/dist/components/extended-fab/config.js +10 -1
  2. package/dist/components/extended-fab/constants.d.ts +16 -4
  3. package/dist/components/extended-fab/constants.js +8 -0
  4. package/dist/components/extended-fab/extended-fab.js +6 -1
  5. package/dist/components/extended-fab/index.d.ts +1 -1
  6. package/dist/components/extended-fab/types.d.ts +13 -6
  7. package/dist/components/fab/config.js +6 -6
  8. package/dist/components/fab/constants.d.ts +18 -7
  9. package/dist/components/fab/constants.js +8 -2
  10. package/dist/components/fab/index.d.ts +1 -1
  11. package/dist/components/fab/types.d.ts +10 -9
  12. package/dist/components/index.d.ts +6 -0
  13. package/dist/components/segmented-button/config.d.ts +0 -7
  14. package/dist/components/segmented-button/config.js +0 -23
  15. package/dist/components/segmented-button/segment.d.ts +1 -0
  16. package/dist/components/segmented-button/segmented-button.d.ts +11 -0
  17. package/dist/components/segmented-button/segmented-button.js +1 -10
  18. package/dist/components/segmented-button/types.d.ts +11 -11
  19. package/dist/core/compose/features/text.js +1 -0
  20. package/dist/index.cjs +12 -12
  21. package/dist/package.json +1 -1
  22. package/dist/styles/badge.css +1 -1
  23. package/dist/styles/base.css +1 -1
  24. package/dist/styles/bottom-app-bar.css +1 -1
  25. package/dist/styles/bottom-sheet.css +1 -1
  26. package/dist/styles/button-group.css +1 -1
  27. package/dist/styles/button.css +1 -1
  28. package/dist/styles/card.css +1 -1
  29. package/dist/styles/carousel.css +1 -1
  30. package/dist/styles/checkbox.css +1 -1
  31. package/dist/styles/chips.css +1 -1
  32. package/dist/styles/dialog.css +1 -1
  33. package/dist/styles/divider.css +1 -1
  34. package/dist/styles/drawer.css +1 -1
  35. package/dist/styles/extended-fab.css +2 -2
  36. package/dist/styles/fab.css +2 -2
  37. package/dist/styles/icon-button.css +1 -1
  38. package/dist/styles/list.css +1 -1
  39. package/dist/styles/loading-indicator.css +1 -1
  40. package/dist/styles/menu.css +1 -1
  41. package/dist/styles/navigation-rail.css +1 -1
  42. package/dist/styles/navigation.css +1 -1
  43. package/dist/styles/progress.css +1 -1
  44. package/dist/styles/radios.css +1 -1
  45. package/dist/styles/search.css +1 -1
  46. package/dist/styles/segmented-button.css +1 -1
  47. package/dist/styles/select.css +1 -1
  48. package/dist/styles/side-sheet.css +1 -1
  49. package/dist/styles/slider.css +1 -1
  50. package/dist/styles/snackbar.css +1 -1
  51. package/dist/styles/split-button.css +1 -1
  52. package/dist/styles/switch.css +1 -1
  53. package/dist/styles/tabs.css +1 -1
  54. package/dist/styles/textfield.css +1 -1
  55. package/dist/styles/timepicker.css +1 -1
  56. package/dist/styles/top-app-bar.css +1 -1
  57. package/dist/styles/utilities.css +1 -1
  58. package/dist/styles.css +2 -2
  59. package/dist/themes/autumn.css +1 -1
  60. package/dist/themes/baseline.css +1 -1
  61. package/dist/themes/brownbeige.css +1 -1
  62. package/dist/themes/browngreen.css +1 -1
  63. package/dist/themes/desert.css +1 -1
  64. package/dist/themes/forest.css +1 -1
  65. package/dist/themes/highcontrast.css +1 -1
  66. package/dist/themes/legacy.css +1 -1
  67. package/dist/themes/material.css +1 -1
  68. package/dist/themes/ocean.css +1 -1
  69. package/dist/themes/sageivory.css +1 -1
  70. package/dist/themes/spring.css +1 -1
  71. package/dist/themes/summer.css +1 -1
  72. package/dist/themes/sunset.css +1 -1
  73. package/dist/themes/tealcaramel.css +1 -1
  74. package/dist/themes/winter.css +1 -1
  75. package/package.json +1 -1
  76. package/src/styles/components/_extended-fab.scss +95 -111
  77. 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
- /** Uses the primary color, highest emphasis (default) */
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
- /** Uses the secondary color, medium emphasis */
13
+ /** Secondary tone colour */
8
14
  readonly SECONDARY: "secondary";
9
- /** Uses the tertiary color, lower emphasis */
15
+ /** Tertiary tone colour */
10
16
  readonly TERTIARY: "tertiary";
11
- /** Uses the surface color with an outline, lowest emphasis */
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), withText(fabConfig), withDisabled(fabConfig), withRipple(fabConfig), withLifecycle(), comp => withAPI(getApiConfig(comp))(comp))(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: Uses the primary color, highest emphasis (default)
10
- * - secondary: Uses the secondary color, medium emphasis
11
- * - tertiary: Uses the tertiary color, lower emphasis
12
- * - surface: Uses the surface color with an outline, lowest emphasis
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
- const enhancedConfig = {
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
- /** Uses the primary color, highest emphasis (default) */
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
- /** Uses the secondary color, medium emphasis */
13
+ /** Secondary tone colour */
8
14
  readonly SECONDARY: "secondary";
9
- /** Uses the tertiary color, lower emphasis */
15
+ /** Tertiary tone colour */
10
16
  readonly TERTIARY: "tertiary";
11
- /** Uses the surface color with an outline, lowest emphasis */
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
- /** 40px diameter, for compact interfaces or secondary actions */
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: "20px";
75
+ readonly SMALL: "24px";
66
76
  readonly DEFAULT: "24px";
67
- readonly LARGE: "36px";
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: '20px',
36
+ SMALL: '24px',
32
37
  DEFAULT: '24px',
33
- LARGE: '36px'
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
- * - Three size options (small, default, large)
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: Uses the primary color, highest emphasis (default)
10
- * - secondary: Uses the secondary color, medium emphasis
11
- * - tertiary: Uses the tertiary color, lower emphasis
12
- * - surface: Uses the surface color with an outline, lowest emphasis
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 diameter, for compact interfaces or secondary actions
23
+ * - small: 40px container, 24px icon; deprecated in M3 Expressive
24
24
  * - default: 56px diameter, for standard primary actions (default)
25
- * - large: 96px diameter, for emphasis or touch-focused interfaces
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
@@ -36,7 +36,13 @@ export { default as createSplitButton } from "./split-button/index.js";
36
36
  export { default as createRadios } from "./radios/index.js";
37
37
  export { default as createSearch } from "./search/index.js";
38
38
  export { default as createSelect } from "./select/index.js";
39
+ /**
40
+ * @deprecated Since 0.8.0, M3 Expressive replaces segmented buttons with connected button groups. Use {@link createButtonGroup} with `kind: "connected"`.
41
+ */
39
42
  export { default as createSegmentedButton } from "./segmented-button/index.js";
43
+ /**
44
+ * @deprecated Since 0.8.0, M3 Expressive replaces segmented buttons with connected button groups. Use {@link createButtonGroup} with `kind: "connected"`.
45
+ */
40
46
  export { createSegment } from "./segmented-button/segment.js";
41
47
  /** @deprecated Since 0.8.0. Use createBottomSheet or createSideSheet. */
42
48
  export { default as createSheet } from "./sheet/index.js";
@@ -33,13 +33,6 @@ export declare const getContainerConfig: (config: SegmentedButtonConfig) => {
33
33
  className: string[];
34
34
  interactive: boolean;
35
35
  };
36
- /**
37
- * Gets density-specific sizing and spacing values
38
- * @param {string} density - The density level
39
- * @returns {Object} CSS variables with sizing values
40
- * @internal
41
- */
42
- export declare const getDensityStyles: (density: string) => Record<string, string>;
43
36
  /**
44
37
  * Generates configuration for a segment element
45
38
  * @param {Object} segment - Segment configuration
@@ -28,29 +28,6 @@ export const getContainerConfig = (config) => {
28
28
  interactive: true,
29
29
  };
30
30
  };
31
- export const getDensityStyles = (density) => {
32
- switch (density) {
33
- case Density.COMPACT:
34
- return {
35
- "--segment-padding": "4px 8px",
36
- "--segment-height": "28px",
37
- "--segment-font-size": "0.8125rem",
38
- };
39
- case Density.COMFORTABLE:
40
- return {
41
- "--segment-padding": "6px 12px",
42
- "--segment-height": "32px",
43
- "--segment-font-size": "0.875rem",
44
- };
45
- case Density.DEFAULT:
46
- default:
47
- return {
48
- "--segment-padding": "8px 16px",
49
- "--segment-height": "36px",
50
- "--segment-font-size": "0.875rem",
51
- };
52
- }
53
- };
54
31
  export const getSegmentConfig = (segment, prefix, groupDisabled = false) => {
55
32
  const isDisabled = groupDisabled || segment.disabled;
56
33
  return {
@@ -7,6 +7,7 @@ import { SegmentConfig, Segment } from "./types.js";
7
7
  * - Icon + text segments: Replace icon with checkmark when selected
8
8
  * - Icon-only segments: Do NOT show checkmark (icon remains unchanged)
9
9
  *
10
+ * @deprecated Since 0.8.0, M3 Expressive replaces segmented buttons with connected button groups. Use {@link createButtonGroup} with `kind: "connected"`.
10
11
  * @param {SegmentConfig} config - Segment configuration
11
12
  * @param {HTMLElement} container - Container element
12
13
  * @param {string} prefix - Component prefix
@@ -6,6 +6,17 @@ import { SegmentedButtonConfig, SegmentedButtonComponent } from "./types.js";
6
6
  * be used for selection and filtering. It supports single or multiple selection modes,
7
7
  * configurable density, disabled states, and event handling.
8
8
  *
9
+ * Migration to {@link createButtonGroup}:
10
+ * - Use `kind: "connected"`, rename `segments` to `buttons` and `mode` to `selection`.
11
+ * - For `selection: "single"`, set `required: true` and explicitly mark the first
12
+ * enabled button `selected: true` to preserve the old initial selection.
13
+ * - Replace `getValue()` with `getSelected()` and read change events from `values`.
14
+ * - Checkmarks and their animation are not automatic; supply `selectedIcon` as needed.
15
+ * - Density changes height only. Connected groups have 2dp gaps and separate
16
+ * selected pills instead of one outlined container.
17
+ *
18
+ * @deprecated Since 0.8.0, M3 Expressive replaces segmented buttons with connected button groups. Use {@link createButtonGroup} with `kind: "connected"`.
19
+ *
9
20
  * @param {SegmentedButtonConfig} config - Segmented Button configuration
10
21
  * @returns {SegmentedButtonComponent} Segmented Button component instance
11
22
  *
@@ -3,19 +3,14 @@ import { createBase, withElement } from "../../core/compose/component.js";
3
3
  import { withEvents, withLifecycle } from "../../core/compose/features/index.js";
4
4
  import { createEmitter } from "../../core/state/emitter.js";
5
5
  import { SelectionMode, Density } from "./types.js";
6
- import { createBaseConfig, getContainerConfig, getDensityStyles } from "./config.js";
6
+ import { createBaseConfig, getContainerConfig } from "./config.js";
7
7
  import { createSegment } from "./segment.js";
8
8
  const createSegmentedButton = (config = {}) => {
9
9
  const baseConfig = createBaseConfig(config);
10
10
  const mode = baseConfig.mode || SelectionMode.SINGLE;
11
- const density = baseConfig.density || Density.DEFAULT;
12
11
  const emitter = createEmitter();
13
12
  try {
14
13
  const component = pipe(createBase, withEvents(), withElement(getContainerConfig(baseConfig)), withLifecycle())(baseConfig);
15
- const densityStyles = getDensityStyles(density);
16
- Object.entries(densityStyles).forEach(([prop, value]) => {
17
- component.element.style.setProperty(prop, value);
18
- });
19
14
  const segments = [];
20
15
  if (baseConfig.segments && baseConfig.segments.length) {
21
16
  baseConfig.segments.forEach(segmentConfig => {
@@ -74,10 +69,6 @@ const createSegmentedButton = (config = {}) => {
74
69
  component.element.classList.add(`${baseConfig.prefix}-segmented-button--${newDensity}`);
75
70
  }
76
71
  component.element.setAttribute('data-density', newDensity);
77
- const densityStyles = getDensityStyles(newDensity);
78
- Object.entries(densityStyles).forEach(([prop, value]) => {
79
- component.element.style.setProperty(prop, value);
80
- });
81
72
  };
82
73
  const segmentedButton = {
83
74
  element: component.element,
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Segmented button selection mode
3
3
  * @category Components
4
+ * @deprecated Since 0.8.0, M3 Expressive replaces segmented buttons with connected button groups. Use {@link createButtonGroup} with `kind: "connected"`.
4
5
  */
5
6
  export declare enum SelectionMode {
6
7
  /** Only one segment can be selected at a time */
@@ -12,6 +13,7 @@ export declare enum SelectionMode {
12
13
  * Density options for segmented button
13
14
  * Controls the overall sizing and spacing of the component.
14
15
  * @category Components
16
+ * @deprecated Since 0.8.0, M3 Expressive replaces segmented buttons with connected button groups. Use {@link createButtonGroup} with `kind: "connected"`.
15
17
  */
16
18
  export declare enum Density {
17
19
  /** Default size with standard spacing */
@@ -29,22 +31,17 @@ export type SegmentedButtonEventType = 'change';
29
31
  * Event data for segmented button events
30
32
  */
31
33
  export interface SegmentedButtonEvent {
32
- /** The segmented button component that triggered the event */
33
- segmentedButton: SegmentedButtonComponent;
34
- /** The selected segments */
34
+ /** The selected segments after the change */
35
35
  selected: Segment[];
36
- /** Values of the selected segments */
37
- values: string[];
38
- /** Original DOM event if available */
39
- originalEvent: Event | null;
40
- /** Function to prevent default behavior */
41
- preventDefault: () => void;
42
- /** Whether default behavior was prevented */
43
- defaultPrevented: boolean;
36
+ /** Values of the selected segments after the change */
37
+ value: string[];
38
+ /** Values of the selected segments before the change */
39
+ oldValue: string[];
44
40
  }
45
41
  /**
46
42
  * Configuration for a single segment within a segmented button
47
43
  * @category Components
44
+ * @deprecated Since 0.8.0, M3 Expressive replaces segmented buttons with connected button groups. Use {@link createButtonGroup} with `kind: "connected"`.
48
45
  */
49
46
  export interface SegmentConfig {
50
47
  /**
@@ -83,6 +80,7 @@ export interface SegmentConfig {
83
80
  /**
84
81
  * Configuration interface for the Segmented Button component
85
82
  * @category Components
83
+ * @deprecated Since 0.8.0, M3 Expressive replaces segmented buttons with connected button groups. Use {@link createButtonGroup} with `kind: "connected"`.
86
84
  */
87
85
  export interface SegmentedButtonConfig {
88
86
  /**
@@ -143,6 +141,7 @@ export interface SegmentedButtonConfig {
143
141
  /**
144
142
  * Interface for a segment within a segmented button
145
143
  * @category Components
144
+ * @deprecated Since 0.8.0, M3 Expressive replaces segmented buttons with connected button groups. Use {@link createButtonGroup} with `kind: "connected"`.
146
145
  */
147
146
  export interface Segment {
148
147
  /** The segment's DOM element */
@@ -175,6 +174,7 @@ export interface Segment {
175
174
  /**
176
175
  * Segmented Button component interface
177
176
  * @category Components
177
+ * @deprecated Since 0.8.0, M3 Expressive replaces segmented buttons with connected button groups. Use {@link createButtonGroup} with `kind: "connected"`.
178
178
  */
179
179
  export interface SegmentedButtonComponent {
180
180
  /** The component's container DOM element */
@@ -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) {