@3mo/button 0.3.0 → 0.3.1

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).
package/dist/Button.js CHANGED
@@ -29,73 +29,73 @@ let Button = class Button extends Component {
29
29
  this.instanceofAttributeController = new InstanceofAttributeController(this);
30
30
  }
31
31
  static get styles() {
32
- return css `
33
- :host {
34
- display: inline-block;
35
- text-transform: uppercase;
36
- text-align: center;
37
- border-radius: var(--mo-border-radius, 4px);
38
- min-height: 36px;
39
- }
40
-
41
- :host([type=normal]) mwc-button {
42
- --mo-button-default-horizontal-padding: 12px;
43
- }
44
-
45
- :host(:not([type=normal])) mwc-button {
46
- --mo-button-default-horizontal-padding: 16px;
47
- }
48
-
49
- slot[name=leading] *, slot[name=leading]::slotted(*) {
50
- margin-inline-end: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * 0.5);
51
- margin-inline-start: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * -0.5);
52
- }
53
-
54
- slot[name=trailing] *, slot[name=trailing]::slotted(*) {
55
- margin-inline-start: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * 0.5);
56
- margin-inline-end: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * -0.5);
57
- }
58
-
59
- mwc-button {
60
- min-height: inherit;
61
- text-align: inherit;
62
- --mdc-button-horizontal-padding: var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding));
63
- --mdc-theme-primary: var(--mo-button-accent-color, var(--mo-color-accent, #0077c8));
64
- --mdc-button-outline-color: var(--mo-button-accent-color, var(--mo-color-accent, #0077c8));
65
- --mdc-button-disabled-fill-color: var(--mo-button-disabled-background-color);
66
- --mdc-button-disabled-ink-color: var(--mo-button-disabled-color, var(--mo-color-gray-transparent));
67
- --mdc-button-disabled-outline-color: var(--mo-button-disabled-color, var(--mo-color-gray-transparent));
68
- --mdc-shape-small: inherit;
69
- }
32
+ return css `
33
+ :host {
34
+ display: inline-block;
35
+ text-transform: uppercase;
36
+ text-align: center;
37
+ border-radius: var(--mo-border-radius, 4px);
38
+ min-height: 36px;
39
+ }
40
+
41
+ :host([type=normal]) mwc-button {
42
+ --mo-button-default-horizontal-padding: 12px;
43
+ }
44
+
45
+ :host(:not([type=normal])) mwc-button {
46
+ --mo-button-default-horizontal-padding: 16px;
47
+ }
48
+
49
+ slot[name=leading] *, slot[name=leading]::slotted(*) {
50
+ margin-inline-end: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * 0.5);
51
+ margin-inline-start: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * -0.5);
52
+ }
53
+
54
+ slot[name=trailing] *, slot[name=trailing]::slotted(*) {
55
+ margin-inline-start: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * 0.5);
56
+ margin-inline-end: calc(var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding)) * -0.5);
57
+ }
58
+
59
+ mwc-button {
60
+ min-height: inherit;
61
+ text-align: inherit;
62
+ --mdc-button-horizontal-padding: var(--mo-button-horizontal-padding, var(--mo-button-default-horizontal-padding));
63
+ --mdc-theme-primary: var(--mo-button-accent-color, var(--mo-color-accent, #0077c8));
64
+ --mdc-button-outline-color: var(--mo-button-accent-color, var(--mo-color-accent, #0077c8));
65
+ --mdc-button-disabled-fill-color: var(--mo-button-disabled-background-color);
66
+ --mdc-button-disabled-ink-color: var(--mo-button-disabled-color, var(--mo-color-gray-transparent));
67
+ --mdc-button-disabled-outline-color: var(--mo-button-disabled-color, var(--mo-color-gray-transparent));
68
+ --mdc-shape-small: inherit;
69
+ }
70
70
  `;
71
71
  }
72
72
  get template() {
73
- return html `
74
- <mwc-button exportparts='button,ripple' expandContent
75
- ?raised=${this.type === "raised" /* ButtonType.Raised */}
76
- ?outlined=${this.type === "outlined" /* ButtonType.Outlined */}
77
- ?unelevated=${this.type === "unelevated" /* ButtonType.Unelevated */}
78
- ?disabled=${this.isDisabled}
79
- >
80
- ${this.contentTemplate}
81
- </mwc-button>
73
+ return html `
74
+ <mwc-button exportparts='button,ripple' expandContent
75
+ ?raised=${this.type === "raised" /* ButtonType.Raised */}
76
+ ?outlined=${this.type === "outlined" /* ButtonType.Outlined */}
77
+ ?unelevated=${this.type === "unelevated" /* ButtonType.Unelevated */}
78
+ ?disabled=${this.isDisabled}
79
+ >
80
+ ${this.contentTemplate}
81
+ </mwc-button>
82
82
  `;
83
83
  }
84
84
  get isDisabled() {
85
85
  return this.disabled;
86
86
  }
87
87
  get contentTemplate() {
88
- return html `
89
- ${this.leadingSlotTemplate}
90
- ${this.slotTemplate}
91
- ${this.trailingSlotTemplate}
88
+ return html `
89
+ ${this.leadingSlotTemplate}
90
+ ${this.slotTemplate}
91
+ ${this.trailingSlotTemplate}
92
92
  `;
93
93
  }
94
94
  get leadingSlotTemplate() {
95
- return html `
96
- <slot name='leading' slot='icon'>
97
- ${this.leadingIconTemplate}
98
- </slot>
95
+ return html `
96
+ <slot name='leading' slot='icon'>
97
+ ${this.leadingIconTemplate}
98
+ </slot>
99
99
  `;
100
100
  }
101
101
  get leadingIconTemplate() {
@@ -105,10 +105,10 @@ let Button = class Button extends Component {
105
105
  return html `<slot ${style({ width: '*' })}></slot>`;
106
106
  }
107
107
  get trailingSlotTemplate() {
108
- return html `
109
- <slot name='trailing' slot='trailingIcon'>
110
- ${this.trailingIconTemplate}
111
- </slot>
108
+ return html `
109
+ <slot name='trailing' slot='trailingIcon'>
110
+ ${this.trailingIconTemplate}
111
+ </slot>
112
112
  `;
113
113
  }
114
114
  get trailingIconTemplate() {
@@ -140,43 +140,43 @@ MwcButton.addInitializer(element => {
140
140
  }
141
141
  });
142
142
  });
143
- MwcButton.elementStyles.push(css `
144
- :host {
145
- display: inline-grid !important;
146
- width: 100% !important;
147
- height: 100% !important;
148
- border-radius: inherit !important;
149
- }
150
-
151
- button {
152
- width: 100% !important;
153
- height: 100% !important;
154
- min-width: unset !important;
155
- line-height: unset !important;
156
- padding-top: 4px !important;
157
- padding-bottom: 4px !important;
158
- text-transform: unset !important;
159
- border-radius: inherit !important;
160
- text-align: inherit !important;
161
- }
162
-
163
- .mdc-button__label {
164
- display: none;
165
- }
166
-
167
- .trailing-icon, .leading-icon {
168
- display: inline-flex;
169
- align-items: center;
170
- }
171
-
172
- .trailing-icon ::slotted(*), .leading-icon ::slotted(*) {
173
- margin-inline-start: unset;
174
- margin-inline-end: unset;
175
- display: unset;
176
- position: unset;
177
- vertical-align: unset;
178
- font-size: unset;
179
- height: unset;
180
- width: unset;
181
- }
143
+ MwcButton.elementStyles.push(css `
144
+ :host {
145
+ display: inline-grid !important;
146
+ width: 100% !important;
147
+ height: 100% !important;
148
+ border-radius: inherit !important;
149
+ }
150
+
151
+ button {
152
+ width: 100% !important;
153
+ height: 100% !important;
154
+ min-width: unset !important;
155
+ line-height: unset !important;
156
+ padding-top: 4px !important;
157
+ padding-bottom: 4px !important;
158
+ text-transform: unset !important;
159
+ border-radius: inherit !important;
160
+ text-align: inherit !important;
161
+ }
162
+
163
+ .mdc-button__label {
164
+ display: none;
165
+ }
166
+
167
+ .trailing-icon, .leading-icon {
168
+ display: inline-flex;
169
+ align-items: center;
170
+ }
171
+
172
+ .trailing-icon ::slotted(*), .leading-icon ::slotted(*) {
173
+ margin-inline-start: unset;
174
+ margin-inline-end: unset;
175
+ display: unset;
176
+ position: unset;
177
+ vertical-align: unset;
178
+ font-size: unset;
179
+ height: unset;
180
+ width: unset;
181
+ }
182
182
  `);