@fluid-topics/ft-switch 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/css-variables.d.ts +22 -0
- package/build/css-variables.js +23 -0
- package/build/ft-switch-option.d.ts +4 -11
- package/build/ft-switch-option.js +14 -26
- package/build/ft-switch.d.ts +3 -17
- package/build/ft-switch.inline-styles.js +532 -0
- package/build/ft-switch.js +7 -25
- package/build/ft-switch.light.js +276 -326
- package/build/ft-switch.min.js +315 -355
- package/build/index.d.ts +4 -0
- package/build/index.js +9 -0
- package/build/inline-styles.d.ts +2 -0
- package/build/inline-styles.js +6 -0
- package/package.json +9 -9
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FtCssVariable } from "@fluid-topics/ft-wc-utils";
|
|
2
|
+
export declare const FtSwitchCssVariables: {
|
|
3
|
+
textColor: FtCssVariable;
|
|
4
|
+
backgroundColor: FtCssVariable;
|
|
5
|
+
selectedTextColor: FtCssVariable;
|
|
6
|
+
selectedBackgroundColor: FtCssVariable;
|
|
7
|
+
borderColor: FtCssVariable;
|
|
8
|
+
borderRadius: FtCssVariable;
|
|
9
|
+
fontSize: FtCssVariable;
|
|
10
|
+
iconSize: FtCssVariable;
|
|
11
|
+
iconColor: FtCssVariable;
|
|
12
|
+
rippleColor: FtCssVariable;
|
|
13
|
+
outlineColor: FtCssVariable;
|
|
14
|
+
};
|
|
15
|
+
export declare const FtSwitchOptionCssVariables: {
|
|
16
|
+
borderRadiusLeft: FtCssVariable;
|
|
17
|
+
borderRadiusRight: FtCssVariable;
|
|
18
|
+
borderWidthLeft: FtCssVariable;
|
|
19
|
+
borderWidthRight: FtCssVariable;
|
|
20
|
+
borderWidthVertical: FtCssVariable;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=css-variables.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { designSystemVariables, FtCssVariable } from "@fluid-topics/ft-wc-utils";
|
|
2
|
+
import { FtTypographyButtonCssVariables } from "@fluid-topics/ft-typography";
|
|
3
|
+
export const FtSwitchCssVariables = {
|
|
4
|
+
textColor: FtCssVariable.extend("--ft-switch-text-color", designSystemVariables.colorOnSurfaceHigh),
|
|
5
|
+
backgroundColor: FtCssVariable.extend("--ft-switch-background-color", designSystemVariables.colorSurface),
|
|
6
|
+
selectedTextColor: FtCssVariable.extend("--ft-switch-selected-text-color", designSystemVariables.colorPrimary),
|
|
7
|
+
selectedBackgroundColor: FtCssVariable.extend("--ft-switch-selected-background-color", designSystemVariables.colorPrimary),
|
|
8
|
+
borderColor: FtCssVariable.extend("--ft-switch-border-color", designSystemVariables.colorOutline),
|
|
9
|
+
borderRadius: FtCssVariable.extend("--ft-switch-border-radius", designSystemVariables.borderRadiusL),
|
|
10
|
+
fontSize: FtCssVariable.extend("--ft-switch-font-size", FtTypographyButtonCssVariables.fontSize),
|
|
11
|
+
iconSize: FtCssVariable.create("--ft-switch-icon-size", "SIZE", "24px"),
|
|
12
|
+
iconColor: FtCssVariable.extend("--ft-switch-text-color", designSystemVariables.colorOnSurfaceMedium),
|
|
13
|
+
rippleColor: FtCssVariable.extend("--ft-switch-ripple-color", designSystemVariables.colorPrimary),
|
|
14
|
+
outlineColor: FtCssVariable.extend("--ft-switch-outline-color", designSystemVariables.colorPrimary),
|
|
15
|
+
};
|
|
16
|
+
export const FtSwitchOptionCssVariables = {
|
|
17
|
+
borderRadiusLeft: FtCssVariable.extend("--ft-switch-option-border-radius-left", designSystemVariables.borderRadiusL),
|
|
18
|
+
borderRadiusRight: FtCssVariable.extend("--ft-switch-option-border-radius-right", designSystemVariables.borderRadiusL),
|
|
19
|
+
borderWidthLeft: FtCssVariable.create("--ft-switch-option-border-width-left", "SIZE", "1px"),
|
|
20
|
+
borderWidthRight: FtCssVariable.create("--ft-switch-option-border-width-right", "SIZE", "1px"),
|
|
21
|
+
borderWidthVertical: FtCssVariable.create("--ft-switch-option-border-width-vertical", "SIZE", "1px"),
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=css-variables.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PropertyValues } from "lit";
|
|
2
|
-
import { ElementDefinitionsMap,
|
|
1
|
+
import { HTMLTemplateResult, PropertyValues } from "lit";
|
|
2
|
+
import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
3
3
|
import { Position } from "@fluid-topics/ft-tooltip";
|
|
4
4
|
export interface FtSwitchOptionProperties {
|
|
5
5
|
value: any;
|
|
@@ -7,19 +7,12 @@ export interface FtSwitchOptionProperties {
|
|
|
7
7
|
selected: boolean;
|
|
8
8
|
trailingIcon: boolean;
|
|
9
9
|
}
|
|
10
|
-
export declare const FtSwitchOptionCssVariables: {
|
|
11
|
-
borderRadiusLeft: FtCssVariable;
|
|
12
|
-
borderRadiusRight: FtCssVariable;
|
|
13
|
-
borderWidthLeft: FtCssVariable;
|
|
14
|
-
borderWidthRight: FtCssVariable;
|
|
15
|
-
borderWidthVertical: FtCssVariable;
|
|
16
|
-
};
|
|
17
10
|
export declare class SwitchOptionChange extends CustomEvent<void> {
|
|
18
11
|
constructor();
|
|
19
12
|
}
|
|
20
13
|
export declare class FtSwitchOption extends FtLitElement implements FtSwitchOptionProperties {
|
|
21
14
|
static elementDefinitions: ElementDefinitionsMap;
|
|
22
|
-
|
|
15
|
+
static get styles(): import("lit").CSSResult;
|
|
23
16
|
value: any;
|
|
24
17
|
icon?: string;
|
|
25
18
|
label: string;
|
|
@@ -30,7 +23,7 @@ export declare class FtSwitchOption extends FtLitElement implements FtSwitchOpti
|
|
|
30
23
|
private input;
|
|
31
24
|
focus(): void;
|
|
32
25
|
protected updated(props: PropertyValues<any>): void;
|
|
33
|
-
protected
|
|
26
|
+
protected render(): HTMLTemplateResult;
|
|
34
27
|
private addTooltip;
|
|
35
28
|
private onChange;
|
|
36
29
|
private getLabel;
|
|
@@ -6,26 +6,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { css, html, nothing } from "lit";
|
|
8
8
|
import { property, query } from "lit/decorators.js";
|
|
9
|
-
import {
|
|
9
|
+
import { designSystemVariables, FtLitElement, setVariable } from "@fluid-topics/ft-wc-utils";
|
|
10
10
|
import { FtRipple, FtRippleCssVariables } from "@fluid-topics/ft-ripple";
|
|
11
11
|
import { FtTypography, FtTypographyButtonCssVariables } from "@fluid-topics/ft-typography";
|
|
12
|
-
import { Icon } from "@material/mwc-icon";
|
|
13
12
|
import { classMap } from "lit/directives/class-map.js";
|
|
14
|
-
import { FtSwitchCssVariables } from "./ft-switch";
|
|
15
13
|
import { FtTooltip } from "@fluid-topics/ft-tooltip";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
borderRadiusRight: FtCssVariable.extend("--ft-switch-option-border-radius-right", designSystemVariables.borderRadiusL),
|
|
19
|
-
borderWidthLeft: FtCssVariable.create("--ft-switch-option-border-width-left", "SIZE", "1px"),
|
|
20
|
-
borderWidthRight: FtCssVariable.create("--ft-switch-option-border-width-right", "SIZE", "1px"),
|
|
21
|
-
borderWidthVertical: FtCssVariable.create("--ft-switch-option-border-width-vertical", "SIZE", "1px"),
|
|
22
|
-
};
|
|
14
|
+
import { FtIcon, FtIconCssVariables } from "@fluid-topics/ft-icon";
|
|
15
|
+
import { FtSwitchCssVariables, FtSwitchOptionCssVariables } from "./css-variables";
|
|
23
16
|
export class SwitchOptionChange extends CustomEvent {
|
|
24
17
|
constructor() {
|
|
25
18
|
super("option-change", { bubbles: true });
|
|
26
19
|
}
|
|
27
20
|
}
|
|
28
|
-
|
|
21
|
+
export class FtSwitchOption extends FtLitElement {
|
|
29
22
|
constructor() {
|
|
30
23
|
super(...arguments);
|
|
31
24
|
this.value = "";
|
|
@@ -34,7 +27,7 @@ let FtSwitchOption = class FtSwitchOption extends FtLitElement {
|
|
|
34
27
|
this.selected = false;
|
|
35
28
|
this.trailingIcon = false;
|
|
36
29
|
}
|
|
37
|
-
|
|
30
|
+
static get styles() {
|
|
38
31
|
// language=CSS
|
|
39
32
|
return css `
|
|
40
33
|
.ft-switch-option {
|
|
@@ -62,7 +55,7 @@ let FtSwitchOption = class FtSwitchOption extends FtLitElement {
|
|
|
62
55
|
justify-content: center;
|
|
63
56
|
overflow: hidden;
|
|
64
57
|
|
|
65
|
-
|
|
58
|
+
${setVariable(FtIconCssVariables.size, FtSwitchCssVariables.iconSize)};
|
|
66
59
|
padding: 6px 8px;
|
|
67
60
|
background-color: ${FtSwitchCssVariables.backgroundColor};
|
|
68
61
|
-webkit-mask-image: radial-gradient(white, black);
|
|
@@ -101,21 +94,20 @@ let FtSwitchOption = class FtSwitchOption extends FtLitElement {
|
|
|
101
94
|
${setVariable(FtRippleCssVariables.color, FtSwitchCssVariables.rippleColor)};
|
|
102
95
|
}
|
|
103
96
|
|
|
104
|
-
|
|
97
|
+
ft-icon, ft-ripple, ft-typography {
|
|
105
98
|
z-index: 2;
|
|
106
99
|
}
|
|
107
100
|
|
|
108
|
-
.ft-switch-option:not(.ft-switch-option--trailing-icon)
|
|
101
|
+
.ft-switch-option:not(.ft-switch-option--trailing-icon) ft-icon {
|
|
109
102
|
order: -1;
|
|
110
103
|
}
|
|
111
104
|
|
|
112
|
-
|
|
105
|
+
ft-icon {
|
|
113
106
|
flex-shrink: 0;
|
|
114
|
-
width: var(--mdc-icon-size);
|
|
115
107
|
color: ${FtSwitchCssVariables.iconColor};
|
|
116
108
|
}
|
|
117
109
|
|
|
118
|
-
.ft-switch-option--input:checked + .ft-switch-option--content
|
|
110
|
+
.ft-switch-option--input:checked + .ft-switch-option--content ft-icon {
|
|
119
111
|
color: ${FtSwitchCssVariables.selectedTextColor};
|
|
120
112
|
}
|
|
121
113
|
`;
|
|
@@ -129,7 +121,7 @@ let FtSwitchOption = class FtSwitchOption extends FtLitElement {
|
|
|
129
121
|
this.dispatchEvent(new SwitchOptionChange());
|
|
130
122
|
}
|
|
131
123
|
}
|
|
132
|
-
|
|
124
|
+
render() {
|
|
133
125
|
const classes = {
|
|
134
126
|
"ft-switch-option": true,
|
|
135
127
|
"ft-switch-option--trailing-icon": this.trailingIcon,
|
|
@@ -168,7 +160,7 @@ let FtSwitchOption = class FtSwitchOption extends FtLitElement {
|
|
|
168
160
|
resolveIcon() {
|
|
169
161
|
return this.icon
|
|
170
162
|
? html `
|
|
171
|
-
<
|
|
163
|
+
<ft-icon variant="material">${this.icon}</ft-icon> `
|
|
172
164
|
: nothing;
|
|
173
165
|
}
|
|
174
166
|
get textContent() {
|
|
@@ -181,12 +173,12 @@ let FtSwitchOption = class FtSwitchOption extends FtLitElement {
|
|
|
181
173
|
onSlotchange() {
|
|
182
174
|
this.requestUpdate();
|
|
183
175
|
}
|
|
184
|
-
}
|
|
176
|
+
}
|
|
185
177
|
FtSwitchOption.elementDefinitions = {
|
|
186
178
|
"ft-ripple": FtRipple,
|
|
187
179
|
"ft-typography": FtTypography,
|
|
188
180
|
"ft-tooltip": FtTooltip,
|
|
189
|
-
"
|
|
181
|
+
"ft-icon": FtIcon
|
|
190
182
|
};
|
|
191
183
|
__decorate([
|
|
192
184
|
property({ type: String })
|
|
@@ -212,8 +204,4 @@ __decorate([
|
|
|
212
204
|
__decorate([
|
|
213
205
|
query(".ft-switch-option--input")
|
|
214
206
|
], FtSwitchOption.prototype, "input", void 0);
|
|
215
|
-
FtSwitchOption = __decorate([
|
|
216
|
-
customElement("ft-switch-option")
|
|
217
|
-
], FtSwitchOption);
|
|
218
|
-
export { FtSwitchOption };
|
|
219
207
|
//# sourceMappingURL=ft-switch-option.js.map
|
package/build/ft-switch.d.ts
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
import { PropertyValues } from "lit";
|
|
2
|
-
import { ElementDefinitionsMap,
|
|
3
|
-
export * from "./ft-switch-option";
|
|
2
|
+
import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
4
3
|
export interface FtSwitchProperties {
|
|
5
4
|
value?: string;
|
|
6
5
|
}
|
|
7
|
-
export declare const FtSwitchCssVariables: {
|
|
8
|
-
textColor: FtCssVariable;
|
|
9
|
-
backgroundColor: FtCssVariable;
|
|
10
|
-
selectedTextColor: FtCssVariable;
|
|
11
|
-
selectedBackgroundColor: FtCssVariable;
|
|
12
|
-
borderColor: FtCssVariable;
|
|
13
|
-
borderRadius: FtCssVariable;
|
|
14
|
-
fontSize: FtCssVariable;
|
|
15
|
-
iconSize: FtCssVariable;
|
|
16
|
-
iconColor: FtCssVariable;
|
|
17
|
-
rippleColor: FtCssVariable;
|
|
18
|
-
outlineColor: FtCssVariable;
|
|
19
|
-
};
|
|
20
6
|
export declare class FtSwitchChange extends CustomEvent<any> {
|
|
21
7
|
constructor(value: any);
|
|
22
8
|
}
|
|
@@ -27,8 +13,8 @@ export declare class FtSwitch extends FtLitElement implements FtSwitchProperties
|
|
|
27
13
|
private selectedOption?;
|
|
28
14
|
private options;
|
|
29
15
|
protected updated(props: PropertyValues<any>): void;
|
|
30
|
-
|
|
31
|
-
protected
|
|
16
|
+
static get styles(): import("lit").CSSResult;
|
|
17
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
32
18
|
private onKeyDown;
|
|
33
19
|
private fixIndex;
|
|
34
20
|
private onSlotchange;
|