@fluid-topics/ft-button 0.1.16 → 0.2.0
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/build/ft-button.d.ts +2 -2
- package/build/ft-button.inline-styles.js +624 -0
- package/build/ft-button.js +16 -18
- package/build/ft-button.light.js +272 -319
- package/build/ft-button.min.js +313 -350
- package/build/index.d.ts +2 -0
- package/build/index.js +5 -0
- package/build/inline-styles.d.ts +2 -0
- package/build/inline-styles.js +4 -0
- package/package.json +10 -10
package/build/ft-button.js
CHANGED
|
@@ -7,13 +7,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { css, html, nothing, } from "lit";
|
|
8
8
|
import { property, query } from "lit/decorators.js";
|
|
9
9
|
import { classMap } from "lit/directives/class-map.js";
|
|
10
|
-
import {
|
|
10
|
+
import { designSystemVariables, FtCssVariable, FtLitElement, isSafari, noTextSelect, setVariable } from "@fluid-topics/ft-wc-utils";
|
|
11
11
|
import { FtRipple, FtRippleCssVariables } from "@fluid-topics/ft-ripple";
|
|
12
12
|
import { FtTypography, FtTypographyButtonCssVariables } from "@fluid-topics/ft-typography";
|
|
13
|
-
import { Icon } from "@material/mwc-icon";
|
|
14
13
|
import { FtTooltip } from "@fluid-topics/ft-tooltip";
|
|
15
14
|
import { FtLoader, FtLoaderCssVariables } from "@fluid-topics/ft-loader";
|
|
16
15
|
import "@fluid-topics/ft-loader";
|
|
16
|
+
import { FtIcon, FtIconCssVariables } from "@fluid-topics/ft-icon";
|
|
17
17
|
const buttonColor = FtCssVariable.extend("--ft-button-color", designSystemVariables.colorPrimary);
|
|
18
18
|
export const FtButtonCssVariables = {
|
|
19
19
|
backgroundColor: FtCssVariable.extend("--ft-button-background-color", designSystemVariables.colorSurface),
|
|
@@ -33,7 +33,7 @@ export const FtButtonPrimaryCssVariables = {
|
|
|
33
33
|
export const FtButtonDenseCssVariables = {
|
|
34
34
|
borderRadius: FtCssVariable.extend("--ft-button-dense-border-radius", FtCssVariable.extend("--ft-button-border-radius", designSystemVariables.borderRadiusM)),
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
export class FtButton extends FtLitElement {
|
|
37
37
|
constructor() {
|
|
38
38
|
super(...arguments);
|
|
39
39
|
this.primary = false;
|
|
@@ -54,7 +54,7 @@ let FtButton = class FtButton extends FtLitElement {
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
static get styles() {
|
|
58
58
|
//language=css
|
|
59
59
|
return [
|
|
60
60
|
noTextSelect,
|
|
@@ -62,6 +62,7 @@ let FtButton = class FtButton extends FtLitElement {
|
|
|
62
62
|
:host {
|
|
63
63
|
display: inline-block;
|
|
64
64
|
max-width: 100%;
|
|
65
|
+
pointer-events: none;
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
button {
|
|
@@ -94,15 +95,16 @@ let FtButton = class FtButton extends FtLitElement {
|
|
|
94
95
|
overflow: hidden;
|
|
95
96
|
box-sizing: border-box;
|
|
96
97
|
border: none;
|
|
98
|
+
pointer-events: auto;
|
|
97
99
|
|
|
98
100
|
--ft-button-internal-font-size: ${FtButtonCssVariables.fontSize};
|
|
99
101
|
--ft-button-internal-line-height: calc(var(--ft-button-internal-font-size) + 2px);
|
|
100
102
|
--ft-button-internal-color: ${FtButtonCssVariables.color};
|
|
101
|
-
|
|
103
|
+
${setVariable(FtIconCssVariables.size, FtButtonCssVariables.iconSize)};
|
|
102
104
|
--ft-button-internal-vertical-padding: 6px;
|
|
103
105
|
--ft-button-internal-horizontal-padding: 8px;
|
|
104
106
|
${setVariable(FtRippleCssVariables.color, FtButtonCssVariables.rippleColor)};
|
|
105
|
-
--ft-button-internal-content-height: max(var(--ft-button-internal-line-height),
|
|
107
|
+
--ft-button-internal-content-height: max(var(--ft-button-internal-line-height), ${FtButtonCssVariables.iconSize});
|
|
106
108
|
|
|
107
109
|
border-radius: ${FtButtonCssVariables.borderRadius};
|
|
108
110
|
padding: var(--ft-button-internal-vertical-padding) var(--ft-button-internal-horizontal-padding);
|
|
@@ -133,6 +135,7 @@ let FtButton = class FtButton extends FtLitElement {
|
|
|
133
135
|
.ft-button.ft-button--primary {
|
|
134
136
|
background-color: ${FtButtonPrimaryCssVariables.backgroundColor};
|
|
135
137
|
--ft-button-internal-color: ${FtButtonPrimaryCssVariables.color};
|
|
138
|
+
${setVariable(FtRippleCssVariables.color, FtButtonPrimaryCssVariables.rippleColor)};
|
|
136
139
|
}
|
|
137
140
|
|
|
138
141
|
.ft-button.ft-button--outlined {
|
|
@@ -168,17 +171,16 @@ let FtButton = class FtButton extends FtLitElement {
|
|
|
168
171
|
display: none;
|
|
169
172
|
}
|
|
170
173
|
|
|
171
|
-
|
|
174
|
+
ft-icon {
|
|
172
175
|
flex-shrink: 0;
|
|
173
|
-
width: var(--mdc-icon-size);
|
|
174
176
|
}
|
|
175
177
|
|
|
176
|
-
.ft-button--label[hidden] +
|
|
178
|
+
.ft-button--label[hidden] + ft-icon {
|
|
177
179
|
margin: 0 calc(var(--ft-button-internal-horizontal-padding) * -1);
|
|
178
180
|
padding: 0 var(--ft-button-internal-vertical-padding);
|
|
179
181
|
}
|
|
180
182
|
|
|
181
|
-
.ft-button:not(.ft-button--trailing-icon)
|
|
183
|
+
.ft-button:not(.ft-button--trailing-icon) ft-icon,
|
|
182
184
|
.ft-button:not(.ft-button--trailing-icon) ft-loader {
|
|
183
185
|
order: -1;
|
|
184
186
|
}
|
|
@@ -190,7 +192,7 @@ let FtButton = class FtButton extends FtLitElement {
|
|
|
190
192
|
`
|
|
191
193
|
];
|
|
192
194
|
}
|
|
193
|
-
|
|
195
|
+
render() {
|
|
194
196
|
const classes = {
|
|
195
197
|
"ft-button": true,
|
|
196
198
|
"ft-button--primary": this.primary,
|
|
@@ -235,7 +237,7 @@ let FtButton = class FtButton extends FtLitElement {
|
|
|
235
237
|
else {
|
|
236
238
|
return this.icon
|
|
237
239
|
? html `
|
|
238
|
-
<
|
|
240
|
+
<ft-icon variant="material">${this.icon}</ft-icon> `
|
|
239
241
|
: nothing;
|
|
240
242
|
}
|
|
241
243
|
}
|
|
@@ -264,12 +266,12 @@ let FtButton = class FtButton extends FtLitElement {
|
|
|
264
266
|
isDisabled() {
|
|
265
267
|
return this.disabled || this.loading;
|
|
266
268
|
}
|
|
267
|
-
}
|
|
269
|
+
}
|
|
268
270
|
FtButton.elementDefinitions = {
|
|
269
271
|
"ft-ripple": FtRipple,
|
|
270
272
|
"ft-tooltip": FtTooltip,
|
|
271
273
|
"ft-typography": FtTypography,
|
|
272
|
-
"
|
|
274
|
+
"ft-icon": FtIcon,
|
|
273
275
|
"ft-loader": FtLoader,
|
|
274
276
|
};
|
|
275
277
|
__decorate([
|
|
@@ -308,8 +310,4 @@ __decorate([
|
|
|
308
310
|
__decorate([
|
|
309
311
|
query(".ft-button--label slot")
|
|
310
312
|
], FtButton.prototype, "slottedContent", void 0);
|
|
311
|
-
FtButton = __decorate([
|
|
312
|
-
customElement("ft-button")
|
|
313
|
-
], FtButton);
|
|
314
|
-
export { FtButton };
|
|
315
313
|
//# sourceMappingURL=ft-button.js.map
|