@m3e/split-button 1.0.0-rc.1 → 1.0.0-rc.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/README.md +1 -2
- package/dist/custom-elements.json +2549 -3
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +6 -6
- package/cem.config.mjs +0 -16
- package/demo/index.html +0 -179
- package/dist/src/SplitButtonElement.d.ts +0 -107
- package/dist/src/SplitButtonElement.d.ts.map +0 -1
- package/dist/src/SplitButtonVariant.d.ts +0 -3
- package/dist/src/SplitButtonVariant.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.d.ts.map +0 -1
- package/eslint.config.mjs +0 -13
- package/rollup.config.js +0 -32
- package/src/SplitButtonElement.ts +0 -488
- package/src/SplitButtonVariant.ts +0 -2
- package/src/index.ts +0 -2
- package/tsconfig.json +0 -9
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { CSSResultGroup, LitElement, PropertyValues } from "lit";
|
|
2
|
-
import { ButtonSize } from "@m3e/button";
|
|
3
|
-
import { SplitButtonVariant } from "./SplitButtonVariant";
|
|
4
|
-
declare const M3eSplitButtonElement_base: import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor & typeof LitElement;
|
|
5
|
-
/**
|
|
6
|
-
* @summary
|
|
7
|
-
* A button used to show an action with a menu of related actions.
|
|
8
|
-
*
|
|
9
|
-
* @description
|
|
10
|
-
* The `m3e-split-button` component presents a primary action alongside a menu of related actions,
|
|
11
|
-
* uniting two buttons in a single expressive surface. Designed for Material 3, it supports `elevated`,
|
|
12
|
-
* `filled`, `tonal`, and `outlined` variants, and adapts to all button sizes. The leading button triggers
|
|
13
|
-
* the main action, while the trailing icon button reveals additional options, enabling efficient workflows
|
|
14
|
-
* and clear visual hierarchy. The split button ensures accessible, adaptive, and visually harmonious
|
|
15
|
-
* interactions, reflecting Material 3’s principles of clarity, flexibility, and expressive design.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* The following example illustrates use of the `m3e-split-button` to combine the `m3e-button`,
|
|
19
|
-
* `m3e-icon-button`, and `m3e-menu` components into a split button.
|
|
20
|
-
*
|
|
21
|
-
* ```html
|
|
22
|
-
* <m3e-split-button>
|
|
23
|
-
* <m3e-button slot="leading-button">
|
|
24
|
-
* <m3e-icon slot="icon" name="edit"></m3e-icon>Edit
|
|
25
|
-
* </m3e-button>
|
|
26
|
-
* <m3e-icon-button slot="trailing-button">
|
|
27
|
-
* <m3e-icon name="keyboard_arrow_down"></m3e-icon>
|
|
28
|
-
* <m3e-menu-trigger for="menu1"></m3e-menu-trigger>
|
|
29
|
-
* </m3e-icon-button>
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @tag m3e-split-button
|
|
33
|
-
*
|
|
34
|
-
* @slot leading-button - The leading button used to perform the primary action.
|
|
35
|
-
* @slot trailing-button - The trailing icon button used to open a menu of related actions.
|
|
36
|
-
*
|
|
37
|
-
* @attr variant - The appearance variant of the button.
|
|
38
|
-
* @attr size - The size of the button.
|
|
39
|
-
*
|
|
40
|
-
* @cssprop --m3e-split-button-extra-small-trailing-button-unselected-leading-space - Leading space for the trailing button (extra-small, unselected).
|
|
41
|
-
* @cssprop --m3e-split-button-extra-small-trailing-button-unselected-trailing-space - Trailing space for the trailing button (extra-small, unselected).
|
|
42
|
-
* @cssprop --m3e-split-button-small-trailing-button-unselected-leading-space - Leading space for the trailing button (small, unselected).
|
|
43
|
-
* @cssprop --m3e-split-button-small-trailing-button-unselected-trailing-space - Trailing space for the trailing button (small, unselected).
|
|
44
|
-
* @cssprop --m3e-split-button-medium-trailing-button-unselected-leading-space - Leading space for the trailing button (medium, unselected).
|
|
45
|
-
* @cssprop --m3e-split-button-medium-trailing-button-unselected-trailing-space - Trailing space for the trailing button (medium, unselected).
|
|
46
|
-
* @cssprop --m3e-split-button-large-trailing-button-unselected-leading-space - Leading space for the trailing button (large, unselected).
|
|
47
|
-
* @cssprop --m3e-split-button-large-trailing-button-unselected-trailing-space - Trailing space for the trailing button (large, unselected).
|
|
48
|
-
* @cssprop --m3e-split-button-extra-large-trailing-button-unselected-leading-space - Leading space for the trailing button (extra-large, unselected).
|
|
49
|
-
* @cssprop --m3e-split-button-extra-large-trailing-button-unselected-trailing-space - Trailing space for the trailing button (extra-large, unselected).
|
|
50
|
-
* @cssprop --m3e-split-button-extra-small-trailing-button-selected-leading-space - Leading space for the trailing button (extra-small, selected).
|
|
51
|
-
* @cssprop --m3e-split-button-extra-small-trailing-button-selected-trailing-space - Trailing space for the trailing button (extra-small, selected).
|
|
52
|
-
* @cssprop --m3e-split-button-small-trailing-button-selected-leading-space - Leading space for the trailing button (small, selected).
|
|
53
|
-
* @cssprop --m3e-split-button-small-trailing-button-selected-trailing-space - Trailing space for the trailing button (small, selected).
|
|
54
|
-
* @cssprop --m3e-split-button-medium-trailing-button-selected-leading-space - Leading space for the trailing button (medium, selected).
|
|
55
|
-
* @cssprop --m3e-split-button-medium-trailing-button-selected-trailing-space - Trailing space for the trailing button (medium, selected).
|
|
56
|
-
* @cssprop --m3e-split-button-large-trailing-button-selected-leading-space - Leading space for the trailing button (large, selected).
|
|
57
|
-
* @cssprop --m3e-split-button-large-trailing-button-selected-trailing-space - Trailing space for the trailing button (large, selected).
|
|
58
|
-
* @cssprop --m3e-split-button-extra-large-trailing-button-selected-leading-space - Leading space for the trailing button (extra-large, selected).
|
|
59
|
-
* @cssprop --m3e-split-button-extra-large-trailing-button-selected-trailing-space - Trailing space for the trailing button (extra-large, selected).
|
|
60
|
-
* @cssprop --m3e-split-button-extra-small-inner-corner-size - Inner corner size for the leading/trailing button (extra-small).
|
|
61
|
-
* @cssprop --m3e-split-button-small-inner-corner-size - Inner corner size for the leading/trailing button (small).
|
|
62
|
-
* @cssprop --m3e-split-button-medium-inner-corner-size - Inner corner size for the leading/trailing button (medium).
|
|
63
|
-
* @cssprop --m3e-split-button-large-inner-corner-size - Inner corner size for the leading/trailing button (large).
|
|
64
|
-
* @cssprop --m3e-split-button-extra-large-inner-corner-size - Inner corner size for the leading/trailing button (extra-large).
|
|
65
|
-
* @cssprop --m3e-split-button-extra-small-inner-corner-hover-size - Inner corner size on hover (extra-small).
|
|
66
|
-
* @cssprop --m3e-split-button-small-inner-corner-hover-size - Inner corner size on hover (small).
|
|
67
|
-
* @cssprop --m3e-split-button-medium-inner-corner-hover-size - Inner corner size on hover (medium).
|
|
68
|
-
* @cssprop --m3e-split-button-large-inner-corner-hover-size - Inner corner size on hover (large).
|
|
69
|
-
* @cssprop --m3e-split-button-extra-large-inner-corner-hover-size - Inner corner size on hover (extra-large).
|
|
70
|
-
* @cssprop --m3e-split-button-extra-small-inner-corner-pressed-size - Inner corner size on press (extra-small).
|
|
71
|
-
* @cssprop --m3e-split-button-small-inner-corner-pressed-size - Inner corner size on press (small).
|
|
72
|
-
* @cssprop --m3e-split-button-medium-inner-corner-pressed-size - Inner corner size on press (medium).
|
|
73
|
-
* @cssprop --m3e-split-button-large-inner-corner-pressed-size - Inner corner size on press (large).
|
|
74
|
-
* @cssprop --m3e-split-button-extra-large-inner-corner-pressed-size - Inner corner size on press (extra-large).
|
|
75
|
-
* @cssprop --m3e-split-button-extra-small-between-spacing - Spacing between leading and trailing buttons (extra-small).
|
|
76
|
-
* @cssprop --m3e-split-button-small-between-spacing - Spacing between leading and trailing buttons (small).
|
|
77
|
-
* @cssprop --m3e-split-button-medium-between-spacing - Spacing between leading and trailing buttons (medium).
|
|
78
|
-
* @cssprop --m3e-split-button-large-between-spacing - Spacing between leading and trailing buttons (large).
|
|
79
|
-
* @cssprop --m3e-split-button-extra-large-between-spacing - Spacing between leading and trailing buttons (extra-large).
|
|
80
|
-
*/
|
|
81
|
-
export declare class M3eSplitButtonElement extends M3eSplitButtonElement_base {
|
|
82
|
-
#private;
|
|
83
|
-
/** The styles of the element. */
|
|
84
|
-
static styles: CSSResultGroup;
|
|
85
|
-
private readonly _base?;
|
|
86
|
-
/**
|
|
87
|
-
* The appearance variant of the button.
|
|
88
|
-
* @default "filled"
|
|
89
|
-
*/
|
|
90
|
-
variant: SplitButtonVariant;
|
|
91
|
-
/**
|
|
92
|
-
* The size of the button.
|
|
93
|
-
* @default "small"
|
|
94
|
-
*/
|
|
95
|
-
size: ButtonSize;
|
|
96
|
-
/** @inheritdoc */
|
|
97
|
-
protected update(changedProperties: PropertyValues<this>): void;
|
|
98
|
-
/** @inheritdoc */
|
|
99
|
-
protected render(): unknown;
|
|
100
|
-
}
|
|
101
|
-
declare global {
|
|
102
|
-
interface HTMLElementTagNameMap {
|
|
103
|
-
"m3e-split-button": M3eSplitButtonElement;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
export {};
|
|
107
|
-
//# sourceMappingURL=SplitButtonElement.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SplitButtonElement.d.ts","sourceRoot":"","sources":["../../src/SplitButtonElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAI5E,OAAO,EAAoB,UAAU,EAAE,MAAM,aAAa,CAAC;AAG3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AACH,qBACa,qBAAsB,SAAQ,0BAAyB;;IAClE,iCAAiC;IACjC,OAAgB,MAAM,EAAE,cAAc,CAyPpC;IAEc,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAc;IAoCrD;;;OAGG;IAC0B,OAAO,EAAE,kBAAkB,CAAY;IAEpE;;;OAGG;IAC0B,IAAI,EAAE,UAAU,CAAW;IAExD,kBAAkB;cACC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAQxE,kBAAkB;cACC,MAAM,IAAI,OAAO;CAoFrC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,kBAAkB,EAAE,qBAAqB,CAAC;KAC3C;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SplitButtonVariant.d.ts","sourceRoot":"","sources":["../../src/SplitButtonVariant.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC"}
|
package/dist/src/index.d.ts
DELETED
package/dist/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
|
package/eslint.config.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import eslint from "@eslint/js";
|
|
2
|
-
import tseslint from "typescript-eslint";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { dirname } from "path";
|
|
5
|
-
|
|
6
|
-
export default tseslint.config(eslint.configs.recommended, tseslint.configs.recommended, {
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parserOptions: {
|
|
9
|
-
project: true,
|
|
10
|
-
tsconfigRootDir: dirname(fileURLToPath(import.meta.url)),
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
});
|
package/rollup.config.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import resolve from "@rollup/plugin-node-resolve";
|
|
2
|
-
import terser from "@rollup/plugin-terser";
|
|
3
|
-
import typescript from "@rollup/plugin-typescript";
|
|
4
|
-
|
|
5
|
-
const banner = `/**
|
|
6
|
-
* @license MIT
|
|
7
|
-
* Copyright (c) 2025 matraic
|
|
8
|
-
* See LICENSE file in the project root for full license text.
|
|
9
|
-
*/`;
|
|
10
|
-
|
|
11
|
-
export default [
|
|
12
|
-
{
|
|
13
|
-
input: "src/index.ts",
|
|
14
|
-
output: [
|
|
15
|
-
{
|
|
16
|
-
file: "dist/index.js",
|
|
17
|
-
format: "esm",
|
|
18
|
-
sourcemap: true,
|
|
19
|
-
banner: banner,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
file: "dist/index.min.js",
|
|
23
|
-
format: "esm",
|
|
24
|
-
sourcemap: true,
|
|
25
|
-
banner: banner,
|
|
26
|
-
plugins: [terser({ mangle: true })],
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
external: ["@m3e/core", "@m3e/button", "@m3e/icon-button", "@m3e/button-group", "lit"],
|
|
30
|
-
plugins: [resolve(), typescript()],
|
|
31
|
-
},
|
|
32
|
-
];
|
|
@@ -1,488 +0,0 @@
|
|
|
1
|
-
import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
|
|
2
|
-
import { customElement, property, query } from "lit/decorators.js";
|
|
3
|
-
|
|
4
|
-
import { DesignToken, HoverController, PressedController, Role } from "@m3e/core";
|
|
5
|
-
import { M3eButtonElement, ButtonSize } from "@m3e/button";
|
|
6
|
-
import { M3eIconButtonElement } from "@m3e/icon-button";
|
|
7
|
-
|
|
8
|
-
import { SplitButtonVariant } from "./SplitButtonVariant";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @summary
|
|
12
|
-
* A button used to show an action with a menu of related actions.
|
|
13
|
-
*
|
|
14
|
-
* @description
|
|
15
|
-
* The `m3e-split-button` component presents a primary action alongside a menu of related actions,
|
|
16
|
-
* uniting two buttons in a single expressive surface. Designed for Material 3, it supports `elevated`,
|
|
17
|
-
* `filled`, `tonal`, and `outlined` variants, and adapts to all button sizes. The leading button triggers
|
|
18
|
-
* the main action, while the trailing icon button reveals additional options, enabling efficient workflows
|
|
19
|
-
* and clear visual hierarchy. The split button ensures accessible, adaptive, and visually harmonious
|
|
20
|
-
* interactions, reflecting Material 3’s principles of clarity, flexibility, and expressive design.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* The following example illustrates use of the `m3e-split-button` to combine the `m3e-button`,
|
|
24
|
-
* `m3e-icon-button`, and `m3e-menu` components into a split button.
|
|
25
|
-
*
|
|
26
|
-
* ```html
|
|
27
|
-
* <m3e-split-button>
|
|
28
|
-
* <m3e-button slot="leading-button">
|
|
29
|
-
* <m3e-icon slot="icon" name="edit"></m3e-icon>Edit
|
|
30
|
-
* </m3e-button>
|
|
31
|
-
* <m3e-icon-button slot="trailing-button">
|
|
32
|
-
* <m3e-icon name="keyboard_arrow_down"></m3e-icon>
|
|
33
|
-
* <m3e-menu-trigger for="menu1"></m3e-menu-trigger>
|
|
34
|
-
* </m3e-icon-button>
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* @tag m3e-split-button
|
|
38
|
-
*
|
|
39
|
-
* @slot leading-button - The leading button used to perform the primary action.
|
|
40
|
-
* @slot trailing-button - The trailing icon button used to open a menu of related actions.
|
|
41
|
-
*
|
|
42
|
-
* @attr variant - The appearance variant of the button.
|
|
43
|
-
* @attr size - The size of the button.
|
|
44
|
-
*
|
|
45
|
-
* @cssprop --m3e-split-button-extra-small-trailing-button-unselected-leading-space - Leading space for the trailing button (extra-small, unselected).
|
|
46
|
-
* @cssprop --m3e-split-button-extra-small-trailing-button-unselected-trailing-space - Trailing space for the trailing button (extra-small, unselected).
|
|
47
|
-
* @cssprop --m3e-split-button-small-trailing-button-unselected-leading-space - Leading space for the trailing button (small, unselected).
|
|
48
|
-
* @cssprop --m3e-split-button-small-trailing-button-unselected-trailing-space - Trailing space for the trailing button (small, unselected).
|
|
49
|
-
* @cssprop --m3e-split-button-medium-trailing-button-unselected-leading-space - Leading space for the trailing button (medium, unselected).
|
|
50
|
-
* @cssprop --m3e-split-button-medium-trailing-button-unselected-trailing-space - Trailing space for the trailing button (medium, unselected).
|
|
51
|
-
* @cssprop --m3e-split-button-large-trailing-button-unselected-leading-space - Leading space for the trailing button (large, unselected).
|
|
52
|
-
* @cssprop --m3e-split-button-large-trailing-button-unselected-trailing-space - Trailing space for the trailing button (large, unselected).
|
|
53
|
-
* @cssprop --m3e-split-button-extra-large-trailing-button-unselected-leading-space - Leading space for the trailing button (extra-large, unselected).
|
|
54
|
-
* @cssprop --m3e-split-button-extra-large-trailing-button-unselected-trailing-space - Trailing space for the trailing button (extra-large, unselected).
|
|
55
|
-
* @cssprop --m3e-split-button-extra-small-trailing-button-selected-leading-space - Leading space for the trailing button (extra-small, selected).
|
|
56
|
-
* @cssprop --m3e-split-button-extra-small-trailing-button-selected-trailing-space - Trailing space for the trailing button (extra-small, selected).
|
|
57
|
-
* @cssprop --m3e-split-button-small-trailing-button-selected-leading-space - Leading space for the trailing button (small, selected).
|
|
58
|
-
* @cssprop --m3e-split-button-small-trailing-button-selected-trailing-space - Trailing space for the trailing button (small, selected).
|
|
59
|
-
* @cssprop --m3e-split-button-medium-trailing-button-selected-leading-space - Leading space for the trailing button (medium, selected).
|
|
60
|
-
* @cssprop --m3e-split-button-medium-trailing-button-selected-trailing-space - Trailing space for the trailing button (medium, selected).
|
|
61
|
-
* @cssprop --m3e-split-button-large-trailing-button-selected-leading-space - Leading space for the trailing button (large, selected).
|
|
62
|
-
* @cssprop --m3e-split-button-large-trailing-button-selected-trailing-space - Trailing space for the trailing button (large, selected).
|
|
63
|
-
* @cssprop --m3e-split-button-extra-large-trailing-button-selected-leading-space - Leading space for the trailing button (extra-large, selected).
|
|
64
|
-
* @cssprop --m3e-split-button-extra-large-trailing-button-selected-trailing-space - Trailing space for the trailing button (extra-large, selected).
|
|
65
|
-
* @cssprop --m3e-split-button-extra-small-inner-corner-size - Inner corner size for the leading/trailing button (extra-small).
|
|
66
|
-
* @cssprop --m3e-split-button-small-inner-corner-size - Inner corner size for the leading/trailing button (small).
|
|
67
|
-
* @cssprop --m3e-split-button-medium-inner-corner-size - Inner corner size for the leading/trailing button (medium).
|
|
68
|
-
* @cssprop --m3e-split-button-large-inner-corner-size - Inner corner size for the leading/trailing button (large).
|
|
69
|
-
* @cssprop --m3e-split-button-extra-large-inner-corner-size - Inner corner size for the leading/trailing button (extra-large).
|
|
70
|
-
* @cssprop --m3e-split-button-extra-small-inner-corner-hover-size - Inner corner size on hover (extra-small).
|
|
71
|
-
* @cssprop --m3e-split-button-small-inner-corner-hover-size - Inner corner size on hover (small).
|
|
72
|
-
* @cssprop --m3e-split-button-medium-inner-corner-hover-size - Inner corner size on hover (medium).
|
|
73
|
-
* @cssprop --m3e-split-button-large-inner-corner-hover-size - Inner corner size on hover (large).
|
|
74
|
-
* @cssprop --m3e-split-button-extra-large-inner-corner-hover-size - Inner corner size on hover (extra-large).
|
|
75
|
-
* @cssprop --m3e-split-button-extra-small-inner-corner-pressed-size - Inner corner size on press (extra-small).
|
|
76
|
-
* @cssprop --m3e-split-button-small-inner-corner-pressed-size - Inner corner size on press (small).
|
|
77
|
-
* @cssprop --m3e-split-button-medium-inner-corner-pressed-size - Inner corner size on press (medium).
|
|
78
|
-
* @cssprop --m3e-split-button-large-inner-corner-pressed-size - Inner corner size on press (large).
|
|
79
|
-
* @cssprop --m3e-split-button-extra-large-inner-corner-pressed-size - Inner corner size on press (extra-large).
|
|
80
|
-
* @cssprop --m3e-split-button-extra-small-between-spacing - Spacing between leading and trailing buttons (extra-small).
|
|
81
|
-
* @cssprop --m3e-split-button-small-between-spacing - Spacing between leading and trailing buttons (small).
|
|
82
|
-
* @cssprop --m3e-split-button-medium-between-spacing - Spacing between leading and trailing buttons (medium).
|
|
83
|
-
* @cssprop --m3e-split-button-large-between-spacing - Spacing between leading and trailing buttons (large).
|
|
84
|
-
* @cssprop --m3e-split-button-extra-large-between-spacing - Spacing between leading and trailing buttons (extra-large).
|
|
85
|
-
*/
|
|
86
|
-
@customElement("m3e-split-button")
|
|
87
|
-
export class M3eSplitButtonElement extends Role(LitElement, "group") {
|
|
88
|
-
/** The styles of the element. */
|
|
89
|
-
static override styles: CSSResultGroup = css`
|
|
90
|
-
:host {
|
|
91
|
-
display: inline-flex;
|
|
92
|
-
vertical-align: middle;
|
|
93
|
-
}
|
|
94
|
-
::slotted([slot="leading-button"]) {
|
|
95
|
-
flex: 1 1 auto;
|
|
96
|
-
min-width: 0;
|
|
97
|
-
--_button-start-shape-pressed-morph: var(--_leading-button-shape, ${DesignToken.shape.corner.full});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
::slotted([slot="trailing-button"]:not([aria-expanded="true"])) {
|
|
101
|
-
--m3e-icon-button-extra-small-default-leading-space: var(
|
|
102
|
-
--m3e-split-button-extra-small-trailing-button-unselected-leading-space,
|
|
103
|
-
0.75rem
|
|
104
|
-
);
|
|
105
|
-
--m3e-icon-button-extra-small-default-trailing-space: var(
|
|
106
|
-
--m3e-split-button-extra-small-trailing-button-unselected-trailing-space,
|
|
107
|
-
0.875rem
|
|
108
|
-
);
|
|
109
|
-
--m3e-icon-button-small-default-leading-space: var(
|
|
110
|
-
--m3e-split-button-small-trailing-button-unselected-leading-space,
|
|
111
|
-
0.75rem
|
|
112
|
-
);
|
|
113
|
-
--m3e-icon-button-small-default-trailing-space: var(
|
|
114
|
-
--m3e-split-button-small-trailing-button-unselected-trailing-space,
|
|
115
|
-
0.875rem
|
|
116
|
-
);
|
|
117
|
-
--m3e-icon-button-medium-default-leading-space: var(
|
|
118
|
-
--m3e-split-button-medium-trailing-button-unselected-leading-space,
|
|
119
|
-
0.8125rem
|
|
120
|
-
);
|
|
121
|
-
--m3e-icon-button-medium-default-trailing-space: var(
|
|
122
|
-
--m3e-split-button-medium-trailing-button-unselected-trailing-space,
|
|
123
|
-
1.0625rem
|
|
124
|
-
);
|
|
125
|
-
--m3e-icon-button-large-default-leading-space: var(
|
|
126
|
-
--m3e-split-button-large-trailing-button-unselected-leading-space,
|
|
127
|
-
1.625rem
|
|
128
|
-
);
|
|
129
|
-
--m3e-icon-button-large-default-trailing-space: var(
|
|
130
|
-
--m3e-split-button-large-trailing-button-unselected-trailing-space,
|
|
131
|
-
2rem
|
|
132
|
-
);
|
|
133
|
-
--m3e-icon-button-extra-large-default-leading-space: var(
|
|
134
|
-
--m3e-split-button-extra-large-trailing-button-unselected-leading-space,
|
|
135
|
-
2.3125rem
|
|
136
|
-
);
|
|
137
|
-
--m3e-icon-button-extra-large-default-trailing-space: var(
|
|
138
|
-
--m3e-split-button-extra-large-trailing-button-unselected-trailing-space,
|
|
139
|
-
3.0625rem
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
::slotted([slot="trailing-button"][aria-expanded="true"]) {
|
|
144
|
-
--m3e-icon-button-extra-small-default-leading-space: var(
|
|
145
|
-
--m3e-split-button-extra-small-trailing-button-selected-leading-space,
|
|
146
|
-
0.8125rem
|
|
147
|
-
);
|
|
148
|
-
--m3e-icon-button-extra-small-default-trailing-space: var(
|
|
149
|
-
--m3e-split-button-extra-small-trailing-button-selected-trailing-space,
|
|
150
|
-
0.8125rem
|
|
151
|
-
);
|
|
152
|
-
--m3e-icon-button-small-default-leading-space: var(
|
|
153
|
-
--m3e-split-button-small-trailing-button-selected-leading-space,
|
|
154
|
-
0.8125rem
|
|
155
|
-
);
|
|
156
|
-
--m3e-icon-button-small-default-trailing-space: var(
|
|
157
|
-
--m3e-split-button-small-trailing-button-selected-trailing-space,
|
|
158
|
-
0.8125rem
|
|
159
|
-
);
|
|
160
|
-
--m3e-icon-button-medium-default-leading-space: var(
|
|
161
|
-
--m3e-split-button-medium-trailing-button-selected-leading-space,
|
|
162
|
-
0.9375rem
|
|
163
|
-
);
|
|
164
|
-
--m3e-icon-button-medium-default-trailing-space: var(
|
|
165
|
-
--m3e-split-button-medium-trailing-button-selected-trailing-space,
|
|
166
|
-
0.9375rem
|
|
167
|
-
);
|
|
168
|
-
--m3e-icon-button-large-default-leading-space: var(
|
|
169
|
-
--m3e-split-button-large-trailing-button-selected-leading-space,
|
|
170
|
-
1.8125rem
|
|
171
|
-
);
|
|
172
|
-
--m3e-icon-button-large-default-trailing-space: var(
|
|
173
|
-
--m3e-split-button-large-trailing-button-selected-trailing-space,
|
|
174
|
-
1.8125rem
|
|
175
|
-
);
|
|
176
|
-
--m3e-icon-button-extra-large-default-leading-space: var(
|
|
177
|
-
--m3e-split-button-extra-large-trailing-button-selected-leading-space,
|
|
178
|
-
2.6875rem
|
|
179
|
-
);
|
|
180
|
-
--m3e-icon-button-extra-large-default-trailing-space: var(
|
|
181
|
-
--m3e-split-button-extra-large-trailing-button-selected-trailing-space,
|
|
182
|
-
2.6875rem
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
::slotted([slot="leading-button"]:not(:hover)),
|
|
187
|
-
::slotted([slot="leading-button"]:disabled),
|
|
188
|
-
::slotted([slot="leading-button"][disabled-interactive]) {
|
|
189
|
-
--m3e-connected-button-group-extra-small-inner-shape: var(
|
|
190
|
-
--m3e-split-button-extra-small-inner-corner-size,
|
|
191
|
-
${DesignToken.shape.corner.extraSmall}
|
|
192
|
-
);
|
|
193
|
-
--m3e-connected-button-group-small-inner-shape: var(
|
|
194
|
-
--m3e-split-button-small-inner-corner-size,
|
|
195
|
-
${DesignToken.shape.corner.extraSmall}
|
|
196
|
-
);
|
|
197
|
-
--m3e-connected-button-group-medium-inner-shape: var(
|
|
198
|
-
--m3e-split-button-medium-inner-corner-size,
|
|
199
|
-
${DesignToken.shape.corner.extraSmall}
|
|
200
|
-
);
|
|
201
|
-
--m3e-connected-button-group-large-inner-shape: var(
|
|
202
|
-
--m3e-split-button-large-inner-corner-size,
|
|
203
|
-
${DesignToken.shape.corner.small}
|
|
204
|
-
);
|
|
205
|
-
--m3e-connected-button-group-extra-large-inner-shape: var(
|
|
206
|
-
--m3e-split-button-extra-large-inner-corner-size,
|
|
207
|
-
${DesignToken.shape.corner.medium}
|
|
208
|
-
);
|
|
209
|
-
}
|
|
210
|
-
::slotted([slot="leading-button"]:hover:not(:disabled):not([disabled-interactive])),
|
|
211
|
-
::slotted([slot="trailing-button"]:not([aria-expanded="true"]):hover:not(:disabled):not([disabled-interactive])) {
|
|
212
|
-
--m3e-connected-button-group-extra-small-inner-shape: var(
|
|
213
|
-
--m3e-split-button-extra-small-inner-corner-hover-size,
|
|
214
|
-
${DesignToken.shape.corner.small}
|
|
215
|
-
);
|
|
216
|
-
--m3e-connected-button-group-small-inner-shape: var(
|
|
217
|
-
--m3e-split-button-small-inner-corner-hover-size,
|
|
218
|
-
${DesignToken.shape.corner.medium}
|
|
219
|
-
);
|
|
220
|
-
--m3e-connected-button-group-medium-inner-shape: var(
|
|
221
|
-
--m3e-split-button-medium-inner-corner-hover-size,
|
|
222
|
-
${DesignToken.shape.corner.medium}
|
|
223
|
-
);
|
|
224
|
-
--m3e-connected-button-group-large-inner-shape: var(
|
|
225
|
-
--m3e-split-button-large-inner-corner-hover-size,
|
|
226
|
-
${DesignToken.shape.corner.largeIncreased}
|
|
227
|
-
);
|
|
228
|
-
--m3e-connected-button-group-extra-large-inner-shape: var(
|
|
229
|
-
--m3e-split-button-extra-large-inner-corner-hover-size,
|
|
230
|
-
${DesignToken.shape.corner.largeIncreased}
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
::slotted([slot="leading-button"]),
|
|
235
|
-
::slotted([slot="trailing-button"]) {
|
|
236
|
-
--m3e-connected-button-group-extra-small-inner-pressed-shape: var(
|
|
237
|
-
--m3e-split-button-extra-small-inner-corner-pressed-size,
|
|
238
|
-
${DesignToken.shape.corner.small}
|
|
239
|
-
);
|
|
240
|
-
--m3e-connected-button-group-small-inner-pressed-shape: var(
|
|
241
|
-
--m3e-split-button-small-inner-corner-pressed-size,
|
|
242
|
-
${DesignToken.shape.corner.medium}
|
|
243
|
-
);
|
|
244
|
-
--m3e-connected-button-group-medium-inner-pressed-shape: var(
|
|
245
|
-
--m3e-split-button-medium-inner-corner-pressed-size,
|
|
246
|
-
${DesignToken.shape.corner.medium}
|
|
247
|
-
);
|
|
248
|
-
--m3e-connected-button-group-large-inner-pressed-shape: var(
|
|
249
|
-
--m3e-split-button-large-inner-corner-pressed-size,
|
|
250
|
-
${DesignToken.shape.corner.largeIncreased}
|
|
251
|
-
);
|
|
252
|
-
--m3e-connected-button-group-extra-large-inner-pressed-shape: var(
|
|
253
|
-
--m3e-split-button-extra-large-inner-corner-pressed-size,
|
|
254
|
-
${DesignToken.shape.corner.largeIncreased}
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
::slotted([slot="trailing-button"]:not([aria-expanded="true"]):not(:hover)),
|
|
259
|
-
::slotted([slot="trailing-button"]:disabled),
|
|
260
|
-
::slotted([slot="trailing-button"][disabled-interactive]) {
|
|
261
|
-
--m3e-connected-button-group-extra-small-inner-shape: var(
|
|
262
|
-
--m3e-split-button-extra-small-inner-corner-size,
|
|
263
|
-
${DesignToken.shape.corner.extraSmall}
|
|
264
|
-
);
|
|
265
|
-
--m3e-connected-button-group-small-inner-shape: var(
|
|
266
|
-
--m3e-split-button-small-inner-corner-size,
|
|
267
|
-
${DesignToken.shape.corner.extraSmall}
|
|
268
|
-
);
|
|
269
|
-
--m3e-connected-button-group-medium-inner-shape: var(
|
|
270
|
-
--m3e-split-button-medium-inner-corner-size,
|
|
271
|
-
${DesignToken.shape.corner.extraSmall}
|
|
272
|
-
);
|
|
273
|
-
--m3e-connected-button-group-large-inner-shape: var(
|
|
274
|
-
--m3e-split-button-large-inner-corner-size,
|
|
275
|
-
${DesignToken.shape.corner.small}
|
|
276
|
-
);
|
|
277
|
-
--m3e-connected-button-group-extra-large-inner-shape: var(
|
|
278
|
-
--m3e-split-button-extra-large-inner-corner-size,
|
|
279
|
-
${DesignToken.shape.corner.medium}
|
|
280
|
-
);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
::slotted([slot="trailing-button"][aria-expanded="true"]) {
|
|
284
|
-
--_icon-button-icon-transform: rotate(180deg);
|
|
285
|
-
--_button-rounded-start-shape: var(--_trailing-button-shape, ${DesignToken.shape.corner.full});
|
|
286
|
-
--_button-rounded-end-shape: var(--_trailing-button-shape, ${DesignToken.shape.corner.full});
|
|
287
|
-
}
|
|
288
|
-
::slotted([slot="trailing-button"]) {
|
|
289
|
-
--_button-end-shape-pressed-morph: var(--_trailing-button-shape, ${DesignToken.shape.corner.full});
|
|
290
|
-
}
|
|
291
|
-
.base {
|
|
292
|
-
--m3e-icon-button-extra-small-icon-size: calc(
|
|
293
|
-
var(--m3e-spit-button-extra-small-trailing-button-icon-size, 1.375rem) + ${DesignToken.density.calc(0)}
|
|
294
|
-
);
|
|
295
|
-
--m3e-button-extra-small-icon-size: calc(
|
|
296
|
-
var(--m3e-spit-button-extra-small-trailing-button-icon-size, 1.375rem) + ${DesignToken.density.calc(0)}
|
|
297
|
-
);
|
|
298
|
-
--m3e-icon-button-small-icon-size: calc(
|
|
299
|
-
var(--m3e-spit-button-small-trailing-button-icon-size, 1.375rem) + ${DesignToken.density.calc(-1)}
|
|
300
|
-
);
|
|
301
|
-
--m3e-button-small-icon-size: calc(
|
|
302
|
-
var(--m3e-spit-button-small-trailing-button-icon-size, 1.375rem) + ${DesignToken.density.calc(-1)}
|
|
303
|
-
);
|
|
304
|
-
--m3e-icon-button-medium-icon-size: calc(
|
|
305
|
-
var(--m3e-spit-button-medium-trailing-button-icon-size, 1.625rem) + ${DesignToken.density.calc(-2)}
|
|
306
|
-
);
|
|
307
|
-
--m3e-button-medium-icon-size: calc(
|
|
308
|
-
var(--m3e-spit-button-medium-trailing-button-icon-size, 1.625rem) + ${DesignToken.density.calc(-2)}
|
|
309
|
-
);
|
|
310
|
-
--m3e-icon-button-large-icon-size: calc(
|
|
311
|
-
var(--m3e-spit-button-large-trailing-button-icon-size, 2.375rem) + ${DesignToken.density.calc(-3)}
|
|
312
|
-
);
|
|
313
|
-
--m3e-button-large-icon-size: calc(
|
|
314
|
-
var(--m3e-spit-button-large-trailing-button-icon-size, 2.375rem) + ${DesignToken.density.calc(-3)}
|
|
315
|
-
);
|
|
316
|
-
--m3e-icon-button-extra-large-icon-size: calc(
|
|
317
|
-
var(--m3e-spit-button-extra-large-trailing-button-icon-size, 3.125rem) + ${DesignToken.density.calc(-3)}
|
|
318
|
-
);
|
|
319
|
-
--m3e-button-extra-large-icon-size: calc(
|
|
320
|
-
var(--m3e-spit-button-extra-large-trailing-button-icon-size, 3.125rem) + ${DesignToken.density.calc(-3)}
|
|
321
|
-
);
|
|
322
|
-
}
|
|
323
|
-
:host([size="extra-small"]) .base {
|
|
324
|
-
--m3e-connected-button-group-spacing: var(--m3e-split-button-extra-small-between-spacing, 0.125rem);
|
|
325
|
-
}
|
|
326
|
-
:host([size="small"]) .base {
|
|
327
|
-
--m3e-connected-button-group-spacing: var(--m3e-split-button-small-between-spacing, 0.125rem);
|
|
328
|
-
}
|
|
329
|
-
:host([size="medium"]).base {
|
|
330
|
-
--m3e-connected-button-group-spacing: var(--m3e-split-button-medium-between-spacing, 0.125rem);
|
|
331
|
-
}
|
|
332
|
-
:host([size="large"]) .base {
|
|
333
|
-
--m3e-connected-button-group-spacing: var(--m3e-split-button-large-between-spacing, 0.125rem);
|
|
334
|
-
}
|
|
335
|
-
:host([size="extra-large"]) .base {
|
|
336
|
-
--m3e-connected-button-group-spacing: var(--m3e-split-button-extra-large-between-spacing, 0.125rem);
|
|
337
|
-
}
|
|
338
|
-
`;
|
|
339
|
-
|
|
340
|
-
@query(".base") private readonly _base?: HTMLElement;
|
|
341
|
-
|
|
342
|
-
/** @private */ #leadingButton?: M3eButtonElement;
|
|
343
|
-
/** @private */ #trailingButton?: M3eIconButtonElement;
|
|
344
|
-
/** @private */ #trailingButtonHover = false;
|
|
345
|
-
|
|
346
|
-
/** @private */ readonly #pressedController = new PressedController(this, {
|
|
347
|
-
target: null,
|
|
348
|
-
capture: true,
|
|
349
|
-
isPressedKey: (key) => key === " " || key === "Enter",
|
|
350
|
-
callback: (pressed, _, target) => {
|
|
351
|
-
switch (target) {
|
|
352
|
-
case this.#leadingButton:
|
|
353
|
-
this.#updateLeadingButtonShape(pressed);
|
|
354
|
-
break;
|
|
355
|
-
case this.#trailingButton:
|
|
356
|
-
this.#updateTrailingButtonShape(pressed || this.#trailingButtonHover);
|
|
357
|
-
break;
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
/** @private */ readonly #hoverController = new HoverController(this, {
|
|
363
|
-
target: null,
|
|
364
|
-
callback: (hovering, target) => {
|
|
365
|
-
switch (target) {
|
|
366
|
-
case this.#trailingButton:
|
|
367
|
-
if (!this.#trailingButton?.disabled && !this.#trailingButton?.disabledInteractive) {
|
|
368
|
-
this.#trailingButtonHover = hovering;
|
|
369
|
-
this.#updateTrailingButtonShape(hovering);
|
|
370
|
-
}
|
|
371
|
-
break;
|
|
372
|
-
}
|
|
373
|
-
},
|
|
374
|
-
});
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* The appearance variant of the button.
|
|
378
|
-
* @default "filled"
|
|
379
|
-
*/
|
|
380
|
-
@property({ reflect: true }) variant: SplitButtonVariant = "filled";
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* The size of the button.
|
|
384
|
-
* @default "small"
|
|
385
|
-
*/
|
|
386
|
-
@property({ reflect: true }) size: ButtonSize = "small";
|
|
387
|
-
|
|
388
|
-
/** @inheritdoc */
|
|
389
|
-
protected override update(changedProperties: PropertyValues<this>): void {
|
|
390
|
-
super.update(changedProperties);
|
|
391
|
-
|
|
392
|
-
if (changedProperties.has("variant")) {
|
|
393
|
-
this.#updateButtons();
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
/** @inheritdoc */
|
|
398
|
-
protected override render(): unknown {
|
|
399
|
-
return html`<m3e-button-group class="base" role="none" variant="connected" size="${this.size}">
|
|
400
|
-
<slot name="leading-button" @slotchange="${this.#handleLeadingSlotChange}"></slot>
|
|
401
|
-
<slot name="trailing-button" @slotchange="${this.#handleTrailingSlotChange}"></slot>
|
|
402
|
-
</m3e-button-group>`;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
/** @private */
|
|
406
|
-
#handleLeadingSlotChange(e: Event): void {
|
|
407
|
-
if (this.#leadingButton) {
|
|
408
|
-
this.#pressedController.unobserve(this.#leadingButton);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
this.#leadingButton = (<HTMLSlotElement>e.target)
|
|
412
|
-
.assignedElements({ flatten: true })
|
|
413
|
-
.find((x) => x instanceof M3eButtonElement);
|
|
414
|
-
|
|
415
|
-
if (this.#leadingButton) {
|
|
416
|
-
this.#pressedController.observe(this.#leadingButton);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
this.#updateButtons();
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
/** @private */
|
|
423
|
-
#handleTrailingSlotChange(e: Event): void {
|
|
424
|
-
if (this.#trailingButton) {
|
|
425
|
-
this.#pressedController.unobserve(this.#trailingButton);
|
|
426
|
-
this.#hoverController.unobserve(this.#trailingButton);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
this.#trailingButton = (<HTMLSlotElement>e.target)
|
|
430
|
-
.assignedElements({ flatten: true })
|
|
431
|
-
.find((x) => x instanceof M3eIconButtonElement);
|
|
432
|
-
|
|
433
|
-
if (this.#trailingButton) {
|
|
434
|
-
this.#pressedController.observe(this.#trailingButton);
|
|
435
|
-
this.#hoverController.observe(this.#trailingButton);
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
this.#updateButtons();
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
/** @private */
|
|
442
|
-
#updateButtons(): void {
|
|
443
|
-
if (this.#leadingButton) {
|
|
444
|
-
this.#leadingButton.variant = this.variant;
|
|
445
|
-
this.#leadingButton.size = this.size;
|
|
446
|
-
this.#leadingButton.shape = "rounded";
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
if (this.#trailingButton) {
|
|
450
|
-
this.#trailingButton.width = "default";
|
|
451
|
-
this.#trailingButton.shape = "rounded";
|
|
452
|
-
this.#trailingButton.setAttribute("variant", this.variant);
|
|
453
|
-
this.#trailingButton.size = this.size;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
/** @private */
|
|
458
|
-
#updateLeadingButtonShape(update: boolean): void {
|
|
459
|
-
if (update && this.#leadingButton) {
|
|
460
|
-
this.#updateButtonShape(this.#leadingButton, "--_leading-button-shape");
|
|
461
|
-
} else {
|
|
462
|
-
this._base?.style.removeProperty("--_leading-button-shape");
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
/** @private */
|
|
467
|
-
#updateTrailingButtonShape(update: boolean): void {
|
|
468
|
-
if (update && this.#trailingButton) {
|
|
469
|
-
this.#updateButtonShape(this.#trailingButton, "--_trailing-button-shape");
|
|
470
|
-
} else {
|
|
471
|
-
this._base?.style.removeProperty("--_trailing-button-shape");
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
/** @private */
|
|
476
|
-
#updateButtonShape(button: HTMLElement, property: string): void {
|
|
477
|
-
const adjustedShape = button.clientHeight / 2;
|
|
478
|
-
if (adjustedShape) {
|
|
479
|
-
this._base?.style.setProperty(property, `${adjustedShape}px`);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
declare global {
|
|
485
|
-
interface HTMLElementTagNameMap {
|
|
486
|
-
"m3e-split-button": M3eSplitButtonElement;
|
|
487
|
-
}
|
|
488
|
-
}
|
package/src/index.ts
DELETED