@fluid-topics/ft-checkbox 2.0.38 → 2.1.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/definitions.d.ts +0 -2
- package/build/definitions.js +0 -2
- package/build/ft-checkbox.d.ts +28 -3
- package/build/ft-checkbox.js +141 -5
- package/build/ft-checkbox.light.js +154 -2197
- package/build/ft-checkbox.min.js +222 -2239
- package/build/ft-checkbox.properties.d.ts +7 -0
- package/build/ft-checkbox.properties.js +1 -0
- package/build/ft-checkbox.styles.d.ts +7 -7
- package/build/index.d.ts +1 -2
- package/build/index.js +1 -2
- package/package.json +5 -8
- package/build/ft-base-checkbox.d.ts +0 -45
- package/build/ft-base-checkbox.js +0 -173
- package/build/ftds-checkbox.d.ts +0 -29
- package/build/ftds-checkbox.js +0 -110
- package/build/ftds-checkbox.styles.d.ts +0 -1
- package/build/ftds-checkbox.styles.js +0 -159
package/build/definitions.d.ts
CHANGED
package/build/definitions.js
CHANGED
package/build/ft-checkbox.d.ts
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { PropertyValues } from "lit";
|
|
2
|
+
import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
3
|
+
import { ClassInfo } from "lit/directives/class-map.js";
|
|
4
|
+
import { FtCheckboxProperties } from "./ft-checkbox.properties";
|
|
5
|
+
export declare class FtCheckboxChangeEvent extends CustomEvent<boolean> {
|
|
6
|
+
constructor(checked: boolean);
|
|
7
|
+
}
|
|
8
|
+
export declare class FtCheckbox extends FtLitElement implements FtCheckboxProperties {
|
|
9
|
+
static elementDefinitions: ElementDefinitionsMap;
|
|
3
10
|
static styles: import("lit").CSSResult;
|
|
4
|
-
|
|
11
|
+
name: string;
|
|
12
|
+
value: string;
|
|
13
|
+
checked: boolean;
|
|
14
|
+
indeterminate: boolean;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
error: boolean;
|
|
17
|
+
private container?;
|
|
18
|
+
private ripple?;
|
|
19
|
+
private input;
|
|
20
|
+
get checkboxClasses(): ClassInfo;
|
|
21
|
+
private renderBoxContainer;
|
|
22
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
23
|
+
private renderBoxIcon;
|
|
24
|
+
private onSlotchange;
|
|
25
|
+
protected willUpdate(changedProperties: PropertyValues): void;
|
|
26
|
+
private onChange;
|
|
27
|
+
protected contentAvailableCallback(props: PropertyValues): void;
|
|
28
|
+
click(): void;
|
|
29
|
+
focus(): void;
|
|
5
30
|
}
|
package/build/ft-checkbox.js
CHANGED
|
@@ -1,9 +1,145 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, } from "lit";
|
|
8
|
+
import { property, query, } from "lit/decorators.js";
|
|
9
|
+
import { FtLitElement, } from "@fluid-topics/ft-wc-utils";
|
|
10
|
+
import { classMap, } from "lit/directives/class-map.js";
|
|
11
|
+
import { FtRipple } from "@fluid-topics/ft-ripple";
|
|
12
|
+
import { FtTypography, FtTypographyVariants, } from "@fluid-topics/ft-typography";
|
|
3
13
|
import { styles } from "./ft-checkbox.styles";
|
|
4
|
-
export class
|
|
5
|
-
|
|
6
|
-
|
|
14
|
+
export class FtCheckboxChangeEvent extends CustomEvent {
|
|
15
|
+
constructor(checked) {
|
|
16
|
+
super("change", { detail: checked });
|
|
7
17
|
}
|
|
8
18
|
}
|
|
19
|
+
export class FtCheckbox extends FtLitElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.name = "";
|
|
23
|
+
this.value = "";
|
|
24
|
+
this.checked = false;
|
|
25
|
+
this.indeterminate = false;
|
|
26
|
+
this.disabled = false;
|
|
27
|
+
this.error = false;
|
|
28
|
+
}
|
|
29
|
+
get checkboxClasses() {
|
|
30
|
+
return {
|
|
31
|
+
"ft-checkbox": true,
|
|
32
|
+
"ft-checkbox--error": this.error,
|
|
33
|
+
"ft-checkbox--checked": this.indeterminate ? false : this.checked,
|
|
34
|
+
"ft-checkbox--indeterminate": this.indeterminate,
|
|
35
|
+
"ft-checkbox--disabled": this.disabled,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
renderBoxContainer() {
|
|
39
|
+
return html `
|
|
40
|
+
<div class="ft-checkbox--box-container" part="checkbox-box-container">
|
|
41
|
+
<ft-ripple part="checkbox-ripple"
|
|
42
|
+
?disabled=${this.disabled}
|
|
43
|
+
?primary=${this.checked || this.indeterminate}
|
|
44
|
+
unbounded>
|
|
45
|
+
</ft-ripple>
|
|
46
|
+
<div class="ft-checkbox--box" part="checkbox-box">
|
|
47
|
+
${this.renderBoxIcon()}
|
|
48
|
+
</div>
|
|
49
|
+
<input type="checkbox"
|
|
50
|
+
id="checkbox-input"
|
|
51
|
+
part="checkbox-input"
|
|
52
|
+
name="${this.name}"
|
|
53
|
+
aria-checked="${this.indeterminate ? "mixed" : (this.checked ? "true" : "false")}"
|
|
54
|
+
role="checkbox"
|
|
55
|
+
.checked=${this.indeterminate ? false : this.checked}
|
|
56
|
+
.indeterminate=${this.indeterminate}
|
|
57
|
+
.disabled=${this.disabled}
|
|
58
|
+
@change=${this.onChange}
|
|
59
|
+
>
|
|
60
|
+
</div>
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
render() {
|
|
64
|
+
return html `
|
|
65
|
+
<label class="${classMap(this.checkboxClasses)}" for="checkbox-input" part="checkbox-label">
|
|
66
|
+
${this.renderBoxContainer()}
|
|
67
|
+
<ft-typography variant="${(FtTypographyVariants.body2)}" part="checkbox-body">
|
|
68
|
+
<slot @slotchange=${this.onSlotchange}></slot>
|
|
69
|
+
</ft-typography>
|
|
70
|
+
</label>
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
73
|
+
renderBoxIcon() {
|
|
74
|
+
return html `
|
|
75
|
+
<svg class="ft-checkbox--checkmark" viewBox="0 0 24 24" part="checkbox-check" aria-hidden="true">
|
|
76
|
+
<path class="ft-checkbox--checkmark-path" fill="none"
|
|
77
|
+
d="${(this.indeterminate && !this.checked)
|
|
78
|
+
? "M2,12 22,12"
|
|
79
|
+
: "M1.73,12.91 8.1,19.28 22.79,4.59"}"></path>
|
|
80
|
+
</svg>
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
onSlotchange() {
|
|
84
|
+
this.requestUpdate();
|
|
85
|
+
}
|
|
86
|
+
willUpdate(changedProperties) {
|
|
87
|
+
super.willUpdate(changedProperties);
|
|
88
|
+
if (changedProperties.has("checked")) {
|
|
89
|
+
this.ariaChecked = this.checked ? "true" : "false";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
onChange(event) {
|
|
93
|
+
event.stopPropagation();
|
|
94
|
+
this.checked = event.target.checked;
|
|
95
|
+
this.indeterminate = false;
|
|
96
|
+
this.dispatchEvent(new FtCheckboxChangeEvent(this.checked));
|
|
97
|
+
}
|
|
98
|
+
contentAvailableCallback(props) {
|
|
99
|
+
var _a;
|
|
100
|
+
super.contentAvailableCallback(props);
|
|
101
|
+
(_a = this.ripple) === null || _a === void 0 ? void 0 : _a.setupFor(this.container);
|
|
102
|
+
}
|
|
103
|
+
click() {
|
|
104
|
+
this.input.click();
|
|
105
|
+
}
|
|
106
|
+
focus() {
|
|
107
|
+
this.input.focus();
|
|
108
|
+
setTimeout(() => {
|
|
109
|
+
var _a;
|
|
110
|
+
(_a = this.ripple) === null || _a === void 0 ? void 0 : _a.forceFocusUpdate();
|
|
111
|
+
}, 0);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
FtCheckbox.elementDefinitions = {
|
|
115
|
+
"ft-ripple": FtRipple,
|
|
116
|
+
"ft-typography": FtTypography,
|
|
117
|
+
};
|
|
9
118
|
FtCheckbox.styles = styles;
|
|
119
|
+
__decorate([
|
|
120
|
+
property()
|
|
121
|
+
], FtCheckbox.prototype, "name", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
property()
|
|
124
|
+
], FtCheckbox.prototype, "value", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
property({ type: Boolean, reflect: true })
|
|
127
|
+
], FtCheckbox.prototype, "checked", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
property({ type: Boolean })
|
|
130
|
+
], FtCheckbox.prototype, "indeterminate", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
property({ type: Boolean })
|
|
133
|
+
], FtCheckbox.prototype, "disabled", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
property({ type: Boolean })
|
|
136
|
+
], FtCheckbox.prototype, "error", void 0);
|
|
137
|
+
__decorate([
|
|
138
|
+
query(".ft-checkbox")
|
|
139
|
+
], FtCheckbox.prototype, "container", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
query("ft-ripple")
|
|
142
|
+
], FtCheckbox.prototype, "ripple", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
query("input")
|
|
145
|
+
], FtCheckbox.prototype, "input", void 0);
|