@3mo/button 0.2.5 → 0.2.6

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 CHANGED
@@ -1,3 +1,3 @@
1
- # Button
2
-
1
+ # Button
2
+
3
3
  A button web-component based on Material Web Components (MWC).
@@ -1,48 +1,48 @@
1
- import { Component } from '@a11d/lit';
2
- import { InstanceofAttributeController } from '@3mo/instanceof-attribute-controller';
3
- import { MaterialIcon } from '@3mo/icon';
4
- export declare const enum ButtonType {
5
- Normal = "normal",
6
- Outlined = "outlined",
7
- Raised = "raised",
8
- Unelevated = "unelevated"
9
- }
10
- /**
11
- * @attr type
12
- * @attr disabled
13
- * @attr leadingIcon
14
- * @attr trailingIcon
15
- *
16
- * @slot - The content of the button.
17
- * @slot leading - The leading content of the button.
18
- * @slot trailing - The trailing content of the button.
19
- *
20
- * @cssprop --mo-button-accent-color
21
- * @cssprop --mo-button-horizontal-padding
22
- * @cssprop --mo-button-disabled-background-color
23
- * @cssprop --mo-button-disabled-color
24
- *
25
- * @csspart button - The composed native button element.
26
- */
27
- export declare class Button extends Component {
28
- type: ButtonType;
29
- disabled: boolean;
30
- leadingIcon?: MaterialIcon;
31
- trailingIcon?: MaterialIcon;
32
- static get styles(): import("@a11d/lit").CSSResult;
33
- protected readonly instanceofAttributeController: InstanceofAttributeController;
34
- protected get template(): import("lit-html").TemplateResult<1>;
35
- protected get isDisabled(): boolean;
36
- protected get contentTemplate(): import("lit-html").TemplateResult<1>;
37
- protected get leadingSlotTemplate(): import("lit-html").TemplateResult<1>;
38
- protected get leadingIconTemplate(): import("lit-html").HTMLTemplateResult;
39
- protected get slotTemplate(): import("lit-html").TemplateResult<1>;
40
- protected get trailingSlotTemplate(): import("lit-html").TemplateResult<1>;
41
- protected get trailingIconTemplate(): import("lit-html").HTMLTemplateResult;
42
- }
43
- declare global {
44
- interface HTMLElementTagNameMap {
45
- 'mo-button': Button;
46
- }
47
- }
1
+ import { Component } from '@a11d/lit';
2
+ import { InstanceofAttributeController } from '@3mo/instanceof-attribute-controller';
3
+ import { type MaterialIcon } from '@3mo/icon';
4
+ export declare const enum ButtonType {
5
+ Normal = "normal",
6
+ Outlined = "outlined",
7
+ Raised = "raised",
8
+ Unelevated = "unelevated"
9
+ }
10
+ /**
11
+ * @attr type
12
+ * @attr disabled
13
+ * @attr leadingIcon
14
+ * @attr trailingIcon
15
+ *
16
+ * @slot - The content of the button.
17
+ * @slot leading - The leading content of the button.
18
+ * @slot trailing - The trailing content of the button.
19
+ *
20
+ * @cssprop --mo-button-accent-color
21
+ * @cssprop --mo-button-horizontal-padding
22
+ * @cssprop --mo-button-disabled-background-color
23
+ * @cssprop --mo-button-disabled-color
24
+ *
25
+ * @csspart button - The composed native button element.
26
+ */
27
+ export declare class Button extends Component {
28
+ type: ButtonType;
29
+ disabled: boolean;
30
+ leadingIcon?: MaterialIcon;
31
+ trailingIcon?: MaterialIcon;
32
+ static get styles(): import("@a11d/lit").CSSResult;
33
+ protected readonly instanceofAttributeController: InstanceofAttributeController;
34
+ protected get template(): import("lit-html").TemplateResult<1>;
35
+ protected get isDisabled(): boolean;
36
+ protected get contentTemplate(): import("lit-html").TemplateResult<1>;
37
+ protected get leadingSlotTemplate(): import("lit-html").TemplateResult<1>;
38
+ protected get leadingIconTemplate(): import("lit-html").HTMLTemplateResult;
39
+ protected get slotTemplate(): import("lit-html").TemplateResult<1>;
40
+ protected get trailingSlotTemplate(): import("lit-html").TemplateResult<1>;
41
+ protected get trailingIconTemplate(): import("lit-html").HTMLTemplateResult;
42
+ }
43
+ declare global {
44
+ interface HTMLElementTagNameMap {
45
+ 'mo-button': Button;
46
+ }
47
+ }
48
48
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../Button.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,SAAS,EAAwB,MAAM,WAAW,CAAA;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAA;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAGxC,0BAAkB,UAAU;IAC3B,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,UAAU,eAAe;CACzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,MAAO,SAAQ,SAAS;IACP,IAAI,aAAoB;IACT,QAAQ,UAAQ;IAEhD,WAAW,CAAC,EAAE,YAAY,CAAA;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAA;IAEvC,WAAoB,MAAM,kCAEzB;IAED,SAAS,CAAC,QAAQ,CAAC,6BAA6B,gCAA0C;IAE1F,cAAuB,QAAQ,yCAE9B;IAED,SAAS,KAAK,UAAU,YAEvB;IAED,SAAS,KAAK,eAAe,yCAE5B;IAED,SAAS,KAAK,mBAAmB,yCAEhC;IAED,SAAS,KAAK,mBAAmB,0CAEhC;IAED,SAAS,KAAK,YAAY,yCAEzB;IAED,SAAS,KAAK,oBAAoB,yCAEjC;IAED,SAAS,KAAK,oBAAoB,0CAEjC;CACD;AAWD,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,WAAW,EAAE,MAAM,CAAA;KACnB;CACD"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../Button.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,SAAS,EAAwB,MAAM,WAAW,CAAA;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAA;AACpF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AAI7C,0BAAkB,UAAU;IAC3B,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,UAAU,eAAe;CACzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,MAAO,SAAQ,SAAS;IACP,IAAI,aAAoB;IACjC,QAAQ,UAAQ;IAExB,WAAW,CAAC,EAAE,YAAY,CAAA;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAA;IAEvC,WAAoB,MAAM,kCAEzB;IAED,SAAS,CAAC,QAAQ,CAAC,6BAA6B,gCAA0C;IAE1F,cAAuB,QAAQ,yCAE9B;IAED,SAAS,KAAK,UAAU,YAEvB;IAED,SAAS,KAAK,eAAe,yCAE5B;IAED,SAAS,KAAK,mBAAmB,yCAEhC;IAED,SAAS,KAAK,mBAAmB,0CAEhC;IAED,SAAS,KAAK,YAAY,yCAEzB;IAED,SAAS,KAAK,oBAAoB,yCAEjC;IAED,SAAS,KAAK,oBAAoB,0CAEjC;CACD;AAWD,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,WAAW,EAAE,MAAM,CAAA;KACnB;CACD"}
@@ -1,2 +1,2 @@
1
- export * from './Button.js';
1
+ export * from './Button.js';
2
2
  //# sourceMappingURL=index.d.ts.map
package/dist/Button.d.ts CHANGED
@@ -1,48 +1,48 @@
1
- import { Component } from '@a11d/lit';
2
- import { InstanceofAttributeController } from '@3mo/instanceof-attribute-controller';
3
- import { MaterialIcon } from '@3mo/icon';
4
- export declare const enum ButtonType {
5
- Normal = "normal",
6
- Outlined = "outlined",
7
- Raised = "raised",
8
- Unelevated = "unelevated"
9
- }
10
- /**
11
- * @attr type
12
- * @attr disabled
13
- * @attr leadingIcon
14
- * @attr trailingIcon
15
- *
16
- * @slot - The content of the button.
17
- * @slot leading - The leading content of the button.
18
- * @slot trailing - The trailing content of the button.
19
- *
20
- * @cssprop --mo-button-accent-color
21
- * @cssprop --mo-button-horizontal-padding
22
- * @cssprop --mo-button-disabled-background-color
23
- * @cssprop --mo-button-disabled-color
24
- *
25
- * @csspart button - The composed native button element.
26
- */
27
- export declare class Button extends Component {
28
- type: ButtonType;
29
- disabled: boolean;
30
- leadingIcon?: MaterialIcon;
31
- trailingIcon?: MaterialIcon;
32
- static get styles(): import("@a11d/lit").CSSResult;
33
- protected readonly instanceofAttributeController: InstanceofAttributeController;
34
- protected get template(): import("lit-html").TemplateResult<1>;
35
- protected get isDisabled(): boolean;
36
- protected get contentTemplate(): import("lit-html").TemplateResult<1>;
37
- protected get leadingSlotTemplate(): import("lit-html").TemplateResult<1>;
38
- protected get leadingIconTemplate(): import("lit-html").HTMLTemplateResult;
39
- protected get slotTemplate(): import("lit-html").TemplateResult<1>;
40
- protected get trailingSlotTemplate(): import("lit-html").TemplateResult<1>;
41
- protected get trailingIconTemplate(): import("lit-html").HTMLTemplateResult;
42
- }
43
- declare global {
44
- interface HTMLElementTagNameMap {
45
- 'mo-button': Button;
46
- }
47
- }
1
+ import { Component } from '@a11d/lit';
2
+ import { InstanceofAttributeController } from '@3mo/instanceof-attribute-controller';
3
+ import { type MaterialIcon } from '@3mo/icon';
4
+ export declare const enum ButtonType {
5
+ Normal = "normal",
6
+ Outlined = "outlined",
7
+ Raised = "raised",
8
+ Unelevated = "unelevated"
9
+ }
10
+ /**
11
+ * @attr type
12
+ * @attr disabled
13
+ * @attr leadingIcon
14
+ * @attr trailingIcon
15
+ *
16
+ * @slot - The content of the button.
17
+ * @slot leading - The leading content of the button.
18
+ * @slot trailing - The trailing content of the button.
19
+ *
20
+ * @cssprop --mo-button-accent-color
21
+ * @cssprop --mo-button-horizontal-padding
22
+ * @cssprop --mo-button-disabled-background-color
23
+ * @cssprop --mo-button-disabled-color
24
+ *
25
+ * @csspart button - The composed native button element.
26
+ */
27
+ export declare class Button extends Component {
28
+ type: ButtonType;
29
+ disabled: boolean;
30
+ leadingIcon?: MaterialIcon;
31
+ trailingIcon?: MaterialIcon;
32
+ static get styles(): import("@a11d/lit").CSSResult;
33
+ protected readonly instanceofAttributeController: InstanceofAttributeController;
34
+ protected get template(): import("lit-html").TemplateResult<1>;
35
+ protected get isDisabled(): boolean;
36
+ protected get contentTemplate(): import("lit-html").TemplateResult<1>;
37
+ protected get leadingSlotTemplate(): import("lit-html").TemplateResult<1>;
38
+ protected get leadingIconTemplate(): import("lit-html").HTMLTemplateResult;
39
+ protected get slotTemplate(): import("lit-html").TemplateResult<1>;
40
+ protected get trailingSlotTemplate(): import("lit-html").TemplateResult<1>;
41
+ protected get trailingIconTemplate(): import("lit-html").HTMLTemplateResult;
42
+ }
43
+ declare global {
44
+ interface HTMLElementTagNameMap {
45
+ 'mo-button': Button;
46
+ }
47
+ }
48
48
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../Button.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,SAAS,EAAwB,MAAM,WAAW,CAAA;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAA;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAGxC,0BAAkB,UAAU;IAC3B,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,UAAU,eAAe;CACzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,MAAO,SAAQ,SAAS;IACP,IAAI,aAAoB;IACT,QAAQ,UAAQ;IAEhD,WAAW,CAAC,EAAE,YAAY,CAAA;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAA;IAEvC,WAAoB,MAAM,kCA4CzB;IAED,SAAS,CAAC,QAAQ,CAAC,6BAA6B,gCAA0C;IAE1F,cAAuB,QAAQ,yCAW9B;IAED,SAAS,KAAK,UAAU,YAEvB;IAED,SAAS,KAAK,eAAe,yCAM5B;IAED,SAAS,KAAK,mBAAmB,yCAMhC;IAED,SAAS,KAAK,mBAAmB,0CAEhC;IAED,SAAS,KAAK,YAAY,yCAEzB;IAED,SAAS,KAAK,oBAAoB,yCAMjC;IAED,SAAS,KAAK,oBAAoB,0CAEjC;CACD;AAkDD,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,WAAW,EAAE,MAAM,CAAA;KACnB;CACD"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../Button.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,SAAS,EAAwB,MAAM,WAAW,CAAA;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAA;AACpF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AAI7C,0BAAkB,UAAU;IAC3B,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,UAAU,eAAe;CACzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,MAAO,SAAQ,SAAS;IACP,IAAI,aAAoB;IACjC,QAAQ,UAAQ;IAExB,WAAW,CAAC,EAAE,YAAY,CAAA;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAA;IAEvC,WAAoB,MAAM,kCAwCzB;IAED,SAAS,CAAC,QAAQ,CAAC,6BAA6B,gCAA0C;IAE1F,cAAuB,QAAQ,yCAW9B;IAED,SAAS,KAAK,UAAU,YAEvB;IAED,SAAS,KAAK,eAAe,yCAM5B;IAED,SAAS,KAAK,mBAAmB,yCAMhC;IAED,SAAS,KAAK,mBAAmB,0CAEhC;IAED,SAAS,KAAK,YAAY,yCAEzB;IAED,SAAS,KAAK,oBAAoB,yCAMjC;IAED,SAAS,KAAK,oBAAoB,0CAEjC;CACD;AAkDD,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,WAAW,EAAE,MAAM,CAAA;KACnB;CACD"}
package/dist/Button.js CHANGED
@@ -1,181 +1,178 @@
1
- import { __decorate } from "tslib";
2
- import { component, property, css, Component, html, nothing, style } from '@a11d/lit';
3
- import { InstanceofAttributeController } from '@3mo/instanceof-attribute-controller';
4
- import { Button as MwcButton } from '@material/mwc-button';
5
- /**
6
- * @attr type
7
- * @attr disabled
8
- * @attr leadingIcon
9
- * @attr trailingIcon
10
- *
11
- * @slot - The content of the button.
12
- * @slot leading - The leading content of the button.
13
- * @slot trailing - The trailing content of the button.
14
- *
15
- * @cssprop --mo-button-accent-color
16
- * @cssprop --mo-button-horizontal-padding
17
- * @cssprop --mo-button-disabled-background-color
18
- * @cssprop --mo-button-disabled-color
19
- *
20
- * @csspart button - The composed native button element.
21
- */
22
- let Button = class Button extends Component {
23
- constructor() {
24
- super(...arguments);
25
- this.type = "normal" /* ButtonType.Normal */;
26
- this.disabled = false;
27
- this.instanceofAttributeController = new InstanceofAttributeController(this);
28
- }
29
- static get styles() {
30
- return css `
31
- :host {
32
- display: inline-block;
33
- text-transform: uppercase;
34
- text-align: center;
35
- border-radius: var(--mo-border-radius, 4px);
36
- min-height: 36px;
37
- }
38
-
39
- :host([disabled]) {
40
- pointer-events: none;
41
- }
42
-
43
- :host([type=normal]) mwc-button {
44
- --mo-button-default-horizontal-padding: 12px;
45
- }
46
-
47
- :host(:not([type=normal])) mwc-button {
48
- --mo-button-default-horizontal-padding: 16px;
49
- }
50
-
51
- slot[name=leading] *, slot[name=leading]::slotted(*) {
52
- margin-inline-end: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * 0.5);
53
- margin-inline-start: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * -0.5);
54
- }
55
-
56
- slot[name=trailing] *, slot[name=trailing]::slotted(*) {
57
- margin-inline-start: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * 0.5);
58
- margin-inline-end: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * -0.5);
59
- }
60
-
61
- mwc-button {
62
- min-height: inherit;
63
- text-align: inherit;
64
- --mdc-button-horizontal-padding: var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding));
65
- --mdc-theme-primary: var(--mo-button-accent-color, var(--mo-color-accent, #0077c8));
66
- --mdc-button-outline-color: var(--mo-button-accent-color, var(--mo-color-accent, #0077c8));
67
- --mdc-button-disabled-fill-color: var(--mo-button-disabled-background-color);
68
- --mdc-button-disabled-ink-color: var(--mo-button-disabled-color, var(--mo-color-gray-transparent));
69
- --mdc-button-disabled-outline-color: var(--mo-button-disabled-color, var(--mo-color-gray-transparent));
70
- --mdc-shape-small: inherit;
71
- }
72
- `;
73
- }
74
- get template() {
75
- return html `
76
- <mwc-button exportparts='button' expandContent
77
- ?raised=${this.type === "raised" /* ButtonType.Raised */}
78
- ?outlined=${this.type === "outlined" /* ButtonType.Outlined */}
79
- ?unelevated=${this.type === "unelevated" /* ButtonType.Unelevated */}
80
- ?disabled=${this.isDisabled}
81
- >
82
- ${this.contentTemplate}
83
- </mwc-button>
84
- `;
85
- }
86
- get isDisabled() {
87
- return this.disabled;
88
- }
89
- get contentTemplate() {
90
- return html `
91
- ${this.leadingSlotTemplate}
92
- ${this.slotTemplate}
93
- ${this.trailingSlotTemplate}
94
- `;
95
- }
96
- get leadingSlotTemplate() {
97
- return html `
98
- <slot name='leading' slot='icon'>
99
- ${this.leadingIconTemplate}
100
- </slot>
101
- `;
102
- }
103
- get leadingIconTemplate() {
104
- return !this.leadingIcon ? nothing : html `<mo-icon icon=${this.leadingIcon}></mo-icon>`;
105
- }
106
- get slotTemplate() {
107
- return html `<slot ${style({ width: '*' })}></slot>`;
108
- }
109
- get trailingSlotTemplate() {
110
- return html `
111
- <slot name='trailing' slot='trailingIcon'>
112
- ${this.trailingIconTemplate}
113
- </slot>
114
- `;
115
- }
116
- get trailingIconTemplate() {
117
- return !this.trailingIcon ? nothing : html `<mo-icon icon=${this.trailingIcon}></mo-icon>`;
118
- }
119
- };
120
- __decorate([
121
- property({ reflect: true })
122
- ], Button.prototype, "type", void 0);
123
- __decorate([
124
- property({ reflect: true, type: Boolean })
125
- ], Button.prototype, "disabled", void 0);
126
- __decorate([
127
- property()
128
- ], Button.prototype, "leadingIcon", void 0);
129
- __decorate([
130
- property()
131
- ], Button.prototype, "trailingIcon", void 0);
132
- Button = __decorate([
133
- component('mo-button')
134
- ], Button);
135
- export { Button };
136
- MwcButton.addInitializer(async (element) => {
137
- var _a;
138
- const button = element;
139
- await button.updateComplete;
140
- (_a = button.renderRoot.querySelector('button')) === null || _a === void 0 ? void 0 : _a.setAttribute('part', 'button');
141
- });
142
- MwcButton.elementStyles.push(css `
143
- :host {
144
- display: inline-grid !important;
145
- width: 100% !important;
146
- height: 100% !important;
147
- border-radius: inherit !important;
148
- }
149
-
150
- button {
151
- width: 100% !important;
152
- height: 100% !important;
153
- min-width: unset !important;
154
- line-height: unset !important;
155
- padding-top: 4px !important;
156
- padding-bottom: 4px !important;
157
- text-transform: unset !important;
158
- border-radius: inherit !important;
159
- text-align: inherit !important;
160
- }
161
-
162
- .mdc-button__label {
163
- display: none;
164
- }
165
-
166
- .trailing-icon, .leading-icon {
167
- display: inline-flex;
168
- align-items: center;
169
- }
170
-
171
- .trailing-icon ::slotted(*), .leading-icon ::slotted(*) {
172
- margin-inline-start: unset;
173
- margin-inline-end: unset;
174
- display: unset;
175
- position: unset;
176
- vertical-align: unset;
177
- font-size: unset;
178
- height: unset;
179
- width: unset;
180
- }
181
- `);
1
+ import { __decorate } from "tslib";
2
+ import { component, property, css, Component, html, nothing, style } from '@a11d/lit';
3
+ import { InstanceofAttributeController } from '@3mo/instanceof-attribute-controller';
4
+ import { Button as MwcButton } from '@material/mwc-button';
5
+ import { disabledProperty } from '@3mo/disabled-property';
6
+ /**
7
+ * @attr type
8
+ * @attr disabled
9
+ * @attr leadingIcon
10
+ * @attr trailingIcon
11
+ *
12
+ * @slot - The content of the button.
13
+ * @slot leading - The leading content of the button.
14
+ * @slot trailing - The trailing content of the button.
15
+ *
16
+ * @cssprop --mo-button-accent-color
17
+ * @cssprop --mo-button-horizontal-padding
18
+ * @cssprop --mo-button-disabled-background-color
19
+ * @cssprop --mo-button-disabled-color
20
+ *
21
+ * @csspart button - The composed native button element.
22
+ */
23
+ let Button = class Button extends Component {
24
+ constructor() {
25
+ super(...arguments);
26
+ this.type = "normal" /* ButtonType.Normal */;
27
+ this.disabled = false;
28
+ this.instanceofAttributeController = new InstanceofAttributeController(this);
29
+ }
30
+ static get styles() {
31
+ return css `
32
+ :host {
33
+ display: inline-block;
34
+ text-transform: uppercase;
35
+ text-align: center;
36
+ border-radius: var(--mo-border-radius, 4px);
37
+ min-height: 36px;
38
+ }
39
+
40
+ :host([type=normal]) mwc-button {
41
+ --mo-button-default-horizontal-padding: 12px;
42
+ }
43
+
44
+ :host(:not([type=normal])) mwc-button {
45
+ --mo-button-default-horizontal-padding: 16px;
46
+ }
47
+
48
+ slot[name=leading] *, slot[name=leading]::slotted(*) {
49
+ margin-inline-end: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * 0.5);
50
+ margin-inline-start: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * -0.5);
51
+ }
52
+
53
+ slot[name=trailing] *, slot[name=trailing]::slotted(*) {
54
+ margin-inline-start: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * 0.5);
55
+ margin-inline-end: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * -0.5);
56
+ }
57
+
58
+ mwc-button {
59
+ min-height: inherit;
60
+ text-align: inherit;
61
+ --mdc-button-horizontal-padding: var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding));
62
+ --mdc-theme-primary: var(--mo-button-accent-color, var(--mo-color-accent, #0077c8));
63
+ --mdc-button-outline-color: var(--mo-button-accent-color, var(--mo-color-accent, #0077c8));
64
+ --mdc-button-disabled-fill-color: var(--mo-button-disabled-background-color);
65
+ --mdc-button-disabled-ink-color: var(--mo-button-disabled-color, var(--mo-color-gray-transparent));
66
+ --mdc-button-disabled-outline-color: var(--mo-button-disabled-color, var(--mo-color-gray-transparent));
67
+ --mdc-shape-small: inherit;
68
+ }
69
+ `;
70
+ }
71
+ get template() {
72
+ return html `
73
+ <mwc-button exportparts='button' expandContent
74
+ ?raised=${this.type === "raised" /* ButtonType.Raised */}
75
+ ?outlined=${this.type === "outlined" /* ButtonType.Outlined */}
76
+ ?unelevated=${this.type === "unelevated" /* ButtonType.Unelevated */}
77
+ ?disabled=${this.isDisabled}
78
+ >
79
+ ${this.contentTemplate}
80
+ </mwc-button>
81
+ `;
82
+ }
83
+ get isDisabled() {
84
+ return this.disabled;
85
+ }
86
+ get contentTemplate() {
87
+ return html `
88
+ ${this.leadingSlotTemplate}
89
+ ${this.slotTemplate}
90
+ ${this.trailingSlotTemplate}
91
+ `;
92
+ }
93
+ get leadingSlotTemplate() {
94
+ return html `
95
+ <slot name='leading' slot='icon'>
96
+ ${this.leadingIconTemplate}
97
+ </slot>
98
+ `;
99
+ }
100
+ get leadingIconTemplate() {
101
+ return !this.leadingIcon ? nothing : html `<mo-icon icon=${this.leadingIcon}></mo-icon>`;
102
+ }
103
+ get slotTemplate() {
104
+ return html `<slot ${style({ width: '*' })}></slot>`;
105
+ }
106
+ get trailingSlotTemplate() {
107
+ return html `
108
+ <slot name='trailing' slot='trailingIcon'>
109
+ ${this.trailingIconTemplate}
110
+ </slot>
111
+ `;
112
+ }
113
+ get trailingIconTemplate() {
114
+ return !this.trailingIcon ? nothing : html `<mo-icon icon=${this.trailingIcon}></mo-icon>`;
115
+ }
116
+ };
117
+ __decorate([
118
+ property({ reflect: true })
119
+ ], Button.prototype, "type", void 0);
120
+ __decorate([
121
+ disabledProperty()
122
+ ], Button.prototype, "disabled", void 0);
123
+ __decorate([
124
+ property()
125
+ ], Button.prototype, "leadingIcon", void 0);
126
+ __decorate([
127
+ property()
128
+ ], Button.prototype, "trailingIcon", void 0);
129
+ Button = __decorate([
130
+ component('mo-button')
131
+ ], Button);
132
+ export { Button };
133
+ MwcButton.addInitializer(async (element) => {
134
+ var _a;
135
+ const button = element;
136
+ await button.updateComplete;
137
+ (_a = button.renderRoot.querySelector('button')) === null || _a === void 0 ? void 0 : _a.setAttribute('part', 'button');
138
+ });
139
+ MwcButton.elementStyles.push(css `
140
+ :host {
141
+ display: inline-grid !important;
142
+ width: 100% !important;
143
+ height: 100% !important;
144
+ border-radius: inherit !important;
145
+ }
146
+
147
+ button {
148
+ width: 100% !important;
149
+ height: 100% !important;
150
+ min-width: unset !important;
151
+ line-height: unset !important;
152
+ padding-top: 4px !important;
153
+ padding-bottom: 4px !important;
154
+ text-transform: unset !important;
155
+ border-radius: inherit !important;
156
+ text-align: inherit !important;
157
+ }
158
+
159
+ .mdc-button__label {
160
+ display: none;
161
+ }
162
+
163
+ .trailing-icon, .leading-icon {
164
+ display: inline-flex;
165
+ align-items: center;
166
+ }
167
+
168
+ .trailing-icon ::slotted(*), .leading-icon ::slotted(*) {
169
+ margin-inline-start: unset;
170
+ margin-inline-end: unset;
171
+ display: unset;
172
+ position: unset;
173
+ vertical-align: unset;
174
+ font-size: unset;
175
+ height: unset;
176
+ width: unset;
177
+ }
178
+ `);
@@ -1,33 +1,33 @@
1
- import { Component } from '@a11d/lit';
2
- import { MaterialIcon } from './index.js';
3
- export declare const enum IconVariant {
4
- Filled = "filled",
5
- Outlined = "outlined",
6
- Sharp = "sharp",
7
- Rounded = "rounded"
8
- }
9
- /**
10
- * @attr variant - The variant of the icon tied to a specific font.
11
- * @attr icon - The icon to display.
12
- */
13
- export declare class Icon extends Component {
14
- static defaultVariant: IconVariant;
15
- static readonly fontsByVariant: Map<IconVariant, {
16
- name: string;
17
- url: string;
18
- }>;
19
- private static readonly fontStyleElement;
20
- private static readonly fontUrls;
21
- private static get;
22
- private static ensureAvailable;
23
- variant: IconVariant;
24
- icon?: MaterialIcon;
25
- static get styles(): import("@a11d/lit").CSSResult;
26
- protected get template(): import("lit-html").TemplateResult<1>;
27
- }
28
- declare global {
29
- interface HTMLElementTagNameMap {
30
- 'mo-icon': Icon;
31
- }
32
- }
1
+ import { Component } from '@a11d/lit';
2
+ import { type MaterialIcon } from './index.js';
3
+ export declare const enum IconVariant {
4
+ Filled = "filled",
5
+ Outlined = "outlined",
6
+ Sharp = "sharp",
7
+ Rounded = "rounded"
8
+ }
9
+ /**
10
+ * @attr variant - The variant of the icon tied to a specific font.
11
+ * @attr icon - The icon to display.
12
+ */
13
+ export declare class Icon extends Component {
14
+ static defaultVariant: IconVariant;
15
+ static readonly fontsByVariant: Map<IconVariant, {
16
+ name: string;
17
+ url: string;
18
+ }>;
19
+ private static readonly fontStyleElement;
20
+ private static readonly fontUrls;
21
+ private static get;
22
+ private static ensureAvailable;
23
+ variant: IconVariant;
24
+ icon?: MaterialIcon;
25
+ static get styles(): import("@a11d/lit").CSSResult;
26
+ protected get template(): import("lit-html").TemplateResult<1>;
27
+ }
28
+ declare global {
29
+ interface HTMLElementTagNameMap {
30
+ 'mo-icon': Icon;
31
+ }
32
+ }
33
33
  //# sourceMappingURL=Icon.d.ts.map