@c2n/checkbox 0.0.4 → 0.0.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/LICENSE +21 -0
- package/dist/checkbox.js +96 -75
- package/package.json +27 -79
- package/types/src/checkbox.d.ts +60 -5
- package/types/src/checkbox.d.ts.map +1 -1
- package/types/src/index.d.ts +0 -2
- package/types/src/index.d.ts.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Nguyen Thai Vinh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/checkbox.js
CHANGED
|
@@ -1,90 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ifDefined
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
2
|
+
import { customElement, property, query } from "lit/decorators.js";
|
|
3
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
4
|
+
import { redispatchEvent } from "@c2n/core/dom-helper.js";
|
|
5
|
+
//#region src/checkbox.scss?inline
|
|
6
|
+
var checkbox_default = "/* ex : var((width: 24px), width, c2-checkbox) returns var(--c2-checkbox-width, 24px) */\n:host {\n display: inline-flex;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.c2-checkbox {\n display: inline-flex;\n position: relative;\n line-height: 0;\n white-space: nowrap;\n cursor: pointer;\n vertical-align: bottom;\n z-index: 0;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n width: var(--c2-checkbox__state-layer--size,32px);\n height: var(--c2-checkbox__state-layer--size,32px);\n}\n\n.c2-checkbox-input {\n position: absolute;\n inset: 0;\n margin: 0;\n padding: 0;\n opacity: 0;\n cursor: inherit;\n width: 100%;\n height: 100%;\n}\n\n.c2-checkbox__background {\n display: inline-flex;\n position: absolute;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n border-style: solid;\n background-color: var(--c2-checkbox__container--background-color,transparent);\n pointer-events: none;\n will-change: background-color, border-color;\n transition: background-color 250ms cubic-bezier(0.2, 0, 0, 1), border-color 250ms cubic-bezier(0.2, 0, 0, 1);\n width: var(--c2-checkbox__container--width,18px);\n height: var(--c2-checkbox__container--height,18px);\n border-top-left-radius: var(--c2-checkbox__container--border-top-left-radius,4px);\n border-top-right-radius: var(--c2-checkbox__container--border-top-right-radius,4px);\n border-bottom-left-radius: var(--c2-checkbox__container--border-bottom-left-radius,4px);\n border-bottom-right-radius: var(--c2-checkbox__container--border-bottom-right-radius,4px);\n}\n\n.c2-checkbox__mark {\n position: absolute;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n line-height: 0;\n opacity: 0;\n transition: opacity 200ms cubic-bezier(0, 0, 0, 1);\n pointer-events: none;\n}\n.c2-checkbox__mark svg,\n.c2-checkbox__mark ::slotted(*) {\n width: 100%;\n height: 100%;\n}\n\n.c2-checkbox__mark--check {\n width: var(--c2-checkbox__checkmark--size,12px);\n height: var(--c2-checkbox__checkmark--size,12px);\n color: var(--c2-checkbox__checkmark--color,#ffffff);\n --c2-feather-icon--size: var(--c2-checkbox__checkmark--size,12px);\n --c2-mat-icon--font-size: var(--c2-checkbox__checkmark--size,12px);\n}\n\n.c2-checkbox__mark--mixed {\n width: var(--c2-checkbox__mixedmark--size,12px);\n height: var(--c2-checkbox__mixedmark--size,12px);\n color: var(--c2-checkbox__mixedmark--color,#ffffff);\n transform: scaleX(0) rotate(0deg);\n transition: opacity 200ms cubic-bezier(0, 0, 0, 1), transform 200ms cubic-bezier(0, 0, 0, 1);\n --c2-feather-icon--size: var(--c2-checkbox__mixedmark--size,12px);\n --c2-mat-icon--font-size: var(--c2-checkbox__mixedmark--size,12px);\n}\n\n.c2-checkbox__mark--uncheck {\n width: var(--c2-checkbox__uncheckmark--size,12px);\n height: var(--c2-checkbox__uncheckmark--size,12px);\n color: var(--c2-checkbox__uncheckmark--color,#ffffff);\n --c2-feather-icon--size: var(--c2-checkbox__uncheckmark--size,12px);\n --c2-mat-icon--font-size: var(--c2-checkbox__uncheckmark--size,12px);\n}\n\n.c2-checkbox-state-layer {\n position: absolute;\n inset: 0;\n z-index: -1;\n border-top-left-radius: var(--c2-checkbox__state-layer--border-top-left-radius,6px);\n border-top-right-radius: var(--c2-checkbox__state-layer--border-top-right-radius,6px);\n border-bottom-left-radius: var(--c2-checkbox__state-layer--border-bottom-left-radius,6px);\n border-bottom-right-radius: var(--c2-checkbox__state-layer--border-bottom-right-radius,6px);\n background-color: transparent;\n opacity: 0;\n pointer-events: none;\n will-change: background-color, opacity;\n transition: background-color 250ms cubic-bezier(0.2, 0, 0, 1), opacity 250ms cubic-bezier(0.2, 0, 0, 1);\n}\n\n.c2-checkbox-input:not(:checked):not(:indeterminate):enabled ~ .c2-checkbox__background {\n border-top: var(--c2-checkbox__container--border-top,1px solid #bcbcc6);\n border-right: var(--c2-checkbox__container--border-right,1px solid #bcbcc6);\n border-bottom: var(--c2-checkbox__container--border-bottom,1px solid #bcbcc6);\n border-left: var(--c2-checkbox__container--border-left,1px solid #bcbcc6);\n}\n.c2-checkbox-input:not(:checked):not(:indeterminate):enabled ~ .c2-checkbox__background .c2-checkbox__mark--uncheck {\n opacity: 1;\n}\n\n.c2-checkbox-input:indeterminate:enabled ~ .c2-checkbox__background {\n border-top: var(--c2-checkbox__container__selected--border-top,0px solid transparent);\n border-right: var(--c2-checkbox__container__selected--border-right,0px solid transparent);\n border-bottom: var(--c2-checkbox__container__selected--border-bottom,0px solid transparent);\n border-left: var(--c2-checkbox__container__selected--border-left,0px solid transparent);\n background-color: var(--c2-checkbox__container__selected--background-color,#476ef9);\n}\n.c2-checkbox-input:indeterminate:enabled ~ .c2-checkbox__background .c2-checkbox__mark--mixed {\n opacity: 1;\n transform: scaleX(1) rotate(0deg);\n}\n\n.c2-checkbox-input:checked:enabled ~ .c2-checkbox__background {\n border-top: var(--c2-checkbox__container__selected--border-top,0px solid transparent);\n border-right: var(--c2-checkbox__container__selected--border-right,0px solid transparent);\n border-bottom: var(--c2-checkbox__container__selected--border-bottom,0px solid transparent);\n border-left: var(--c2-checkbox__container__selected--border-left,0px solid transparent);\n background-color: var(--c2-checkbox__container__selected--background-color,#476ef9);\n}\n.c2-checkbox-input:checked:enabled ~ .c2-checkbox__background .c2-checkbox__mark--check {\n opacity: 1;\n}\n\n.c2-checkbox-input:not(:checked):not(:indeterminate):disabled ~ .c2-checkbox__background {\n border-top: var(--c2-checkbox__container--border-top,1px solid #bcbcc6);\n border-right: var(--c2-checkbox__container--border-right,1px solid #bcbcc6);\n border-left: var(--c2-checkbox__container--border-left,1px solid #bcbcc6);\n border-bottom: var(--c2-checkbox__container--border-bottom,1px solid #bcbcc6);\n opacity: var(--c2-checkbox__container__disabled--opacity,0.38);\n}\n.c2-checkbox-input:not(:checked):not(:indeterminate):disabled ~ .c2-checkbox__background .c2-checkbox__mark--uncheck {\n opacity: 1;\n}\n\n.c2-checkbox-input:indeterminate:disabled ~ .c2-checkbox__background {\n border-top: var(--c2-checkbox__container__selected--border-top,0px solid transparent);\n border-right: var(--c2-checkbox__container__selected--border-right,0px solid transparent);\n border-bottom: var(--c2-checkbox__container__selected--border-bottom,0px solid transparent);\n border-left: var(--c2-checkbox__container__selected--border-left,0px solid transparent);\n background-color: var(--c2-checkbox__container__selected--background-color,#476ef9);\n opacity: var(--c2-checkbox__container__disabled--opacity,0.38);\n}\n.c2-checkbox-input:indeterminate:disabled ~ .c2-checkbox__background .c2-checkbox__mark--mixed {\n opacity: 1;\n transform: scaleX(1) rotate(0deg);\n}\n\n.c2-checkbox-input:checked:disabled ~ .c2-checkbox__background {\n border-top: var(--c2-checkbox__container__selected--border-top,0px solid transparent);\n border-right: var(--c2-checkbox__container__selected--border-right,0px solid transparent);\n border-bottom: var(--c2-checkbox__container__selected--border-bottom,0px solid transparent);\n border-left: var(--c2-checkbox__container__selected--border-left,0px solid transparent);\n background-color: var(--c2-checkbox__container__selected--background-color,#476ef9);\n opacity: var(--c2-checkbox__container__disabled--opacity,0.38);\n}\n.c2-checkbox-input:checked:disabled ~ .c2-checkbox__background .c2-checkbox__mark--check {\n opacity: 1;\n}\n\n.c2-checkbox-input:disabled {\n cursor: default;\n}\n\n.c2-checkbox-input:not(:checked):not(:indeterminate):enabled:hover ~ .c2-checkbox-state-layer {\n background-color: var(--c2-checkbox__state-layer__hover__unselected--color);\n opacity: 0.08;\n}\n\n.c2-checkbox-input:indeterminate:enabled:hover ~ .c2-checkbox__background,\n.c2-checkbox-input:checked:enabled:hover ~ .c2-checkbox__background {\n background-color: var(--c2-checkbox__container__selected__hover--background-color,var(--c2-checkbox__container__selected--background-color,#476ef9));\n}\n.c2-checkbox-input:indeterminate:enabled:hover ~ .c2-checkbox-state-layer,\n.c2-checkbox-input:checked:enabled:hover ~ .c2-checkbox-state-layer {\n background-color: var(--c2-checkbox__state-layer__hover__selected--color);\n opacity: 0.08;\n}\n\n.c2-checkbox-input:focus-visible ~ .c2-checkbox__background {\n outline: var(--c2-checkbox__container__focus--outline,2px solid rgba(71, 110, 249, 0.4));\n outline-offset: var(--c2-checkbox__container__focus--outline-offset,2px);\n}";
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region \0@oxc-project+runtime@0.148.0/helpers/esm/decorate.js
|
|
9
|
+
function __decorate(decorators, target, key, desc) {
|
|
10
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12
|
+
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;
|
|
13
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/checkbox.ts
|
|
17
|
+
var Checkbox = class Checkbox extends LitElement {
|
|
18
|
+
constructor(..._args) {
|
|
19
|
+
super(..._args);
|
|
20
|
+
this.checked = false;
|
|
21
|
+
this.indeterminate = false;
|
|
22
|
+
this.disabled = false;
|
|
23
|
+
this.name = "";
|
|
24
|
+
}
|
|
25
|
+
render() {
|
|
26
|
+
const ariaChecked = this.indeterminate ? "mixed" : void 0;
|
|
27
|
+
return html`
|
|
18
28
|
<div class="c2-checkbox">
|
|
19
29
|
<input
|
|
20
30
|
class="c2-checkbox-input"
|
|
21
31
|
type="checkbox"
|
|
22
|
-
name="${
|
|
23
|
-
aria-checked="${
|
|
24
|
-
aria-label="${
|
|
25
|
-
aria-labelledby="${
|
|
26
|
-
aria-describedby="${
|
|
32
|
+
name="${ifDefined(this.name)}"
|
|
33
|
+
aria-checked="${ifDefined(ariaChecked)}"
|
|
34
|
+
aria-label="${ifDefined(this.ariaLabel)}"
|
|
35
|
+
aria-labelledby="${ifDefined(this.ariaLabelledBy)}"
|
|
36
|
+
aria-describedby="${ifDefined(this.ariaDescribedBy)}"
|
|
27
37
|
?disabled="${this.disabled}"
|
|
28
38
|
.indeterminate="${this.indeterminate}"
|
|
29
39
|
?checked="${this.checked}"
|
|
30
40
|
@change="${this.handleChange}"
|
|
31
41
|
/>
|
|
32
42
|
<div class="c2-checkbox__background">
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
<!-- Each mark slot sits in its own positioned wrapper, so any slotted content (an inline SVG, a c2-feather-*
|
|
44
|
+
icon, a c2-mat-icon, or a framework wrapper around them) is centred, sized and faded as one unit. -->
|
|
45
|
+
<span class="c2-checkbox__mark c2-checkbox__mark--check" part="checkmark">
|
|
46
|
+
<slot name="checkmark">
|
|
47
|
+
<svg viewBox="0 0 24 24">
|
|
48
|
+
<path fill="currentColor" d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z" />
|
|
49
|
+
</svg>
|
|
50
|
+
</slot>
|
|
51
|
+
</span>
|
|
52
|
+
<span class="c2-checkbox__mark c2-checkbox__mark--mixed" part="mixedmark">
|
|
53
|
+
<slot name="mixedmark">
|
|
54
|
+
<svg viewBox="0 0 24 24">
|
|
55
|
+
<path fill="currentColor" d="M19 13H5v-2h14v2z" />
|
|
56
|
+
</svg>
|
|
57
|
+
</slot>
|
|
58
|
+
</span>
|
|
59
|
+
<span class="c2-checkbox__mark c2-checkbox__mark--uncheck" part="uncheckmark">
|
|
60
|
+
<slot name="uncheckmark"></slot>
|
|
61
|
+
</span>
|
|
43
62
|
</div>
|
|
44
63
|
<div class="c2-checkbox-state-layer"></div>
|
|
45
64
|
</div>
|
|
46
65
|
`;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
], e.prototype, "formElement", 2);
|
|
64
|
-
c([
|
|
65
|
-
r({ type: Boolean, reflect: !0 })
|
|
66
|
-
], e.prototype, "checked", 2);
|
|
67
|
-
c([
|
|
68
|
-
r({ type: Boolean, reflect: !0 })
|
|
69
|
-
], e.prototype, "indeterminate", 2);
|
|
70
|
-
c([
|
|
71
|
-
r({ type: Boolean, reflect: !0 })
|
|
72
|
-
], e.prototype, "disabled", 2);
|
|
73
|
-
c([
|
|
74
|
-
r({ type: String })
|
|
75
|
-
], e.prototype, "name", 2);
|
|
76
|
-
c([
|
|
77
|
-
r({ type: String, attribute: "aria-label" })
|
|
78
|
-
], e.prototype, "ariaLabel", 2);
|
|
79
|
-
c([
|
|
80
|
-
r({ type: String, attribute: "aria-labelledby" })
|
|
81
|
-
], e.prototype, "ariaLabelledBy", 2);
|
|
82
|
-
c([
|
|
83
|
-
r({ type: String, attribute: "aria-describedby" })
|
|
84
|
-
], e.prototype, "ariaDescribedBy", 2);
|
|
85
|
-
e = c([
|
|
86
|
-
p("c2-checkbox")
|
|
87
|
-
], e);
|
|
88
|
-
export {
|
|
89
|
-
e as Checkbox
|
|
66
|
+
}
|
|
67
|
+
focus(options) {
|
|
68
|
+
this.formElement?.focus(options);
|
|
69
|
+
}
|
|
70
|
+
update(changedProperties) {
|
|
71
|
+
if (changedProperties.has("checked") && this.formElement) this.formElement.checked = this.checked;
|
|
72
|
+
super.update(changedProperties);
|
|
73
|
+
}
|
|
74
|
+
handleChange(event) {
|
|
75
|
+
this.checked = this.formElement.checked;
|
|
76
|
+
this.indeterminate = this.formElement.indeterminate;
|
|
77
|
+
redispatchEvent(this, event);
|
|
78
|
+
}
|
|
79
|
+
static {
|
|
80
|
+
this.styles = unsafeCSS(checkbox_default);
|
|
81
|
+
}
|
|
90
82
|
};
|
|
83
|
+
__decorate([query("input")], Checkbox.prototype, "formElement", void 0);
|
|
84
|
+
__decorate([property({
|
|
85
|
+
type: Boolean,
|
|
86
|
+
reflect: true
|
|
87
|
+
})], Checkbox.prototype, "checked", void 0);
|
|
88
|
+
__decorate([property({
|
|
89
|
+
type: Boolean,
|
|
90
|
+
reflect: true
|
|
91
|
+
})], Checkbox.prototype, "indeterminate", void 0);
|
|
92
|
+
__decorate([property({
|
|
93
|
+
type: Boolean,
|
|
94
|
+
reflect: true
|
|
95
|
+
})], Checkbox.prototype, "disabled", void 0);
|
|
96
|
+
__decorate([property({ type: String })], Checkbox.prototype, "name", void 0);
|
|
97
|
+
__decorate([property({
|
|
98
|
+
type: String,
|
|
99
|
+
attribute: "aria-label"
|
|
100
|
+
})], Checkbox.prototype, "ariaLabel", void 0);
|
|
101
|
+
__decorate([property({
|
|
102
|
+
type: String,
|
|
103
|
+
attribute: "aria-labelledby"
|
|
104
|
+
})], Checkbox.prototype, "ariaLabelledBy", void 0);
|
|
105
|
+
__decorate([property({
|
|
106
|
+
type: String,
|
|
107
|
+
attribute: "aria-describedby"
|
|
108
|
+
})], Checkbox.prototype, "ariaDescribedBy", void 0);
|
|
109
|
+
Checkbox = __decorate([customElement("c2-checkbox")], Checkbox);
|
|
110
|
+
//#endregion
|
|
111
|
+
export { Checkbox };
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c2n/checkbox",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/checkbox.js",
|
|
6
6
|
"exports": {
|
|
7
|
-
".":
|
|
7
|
+
".": {
|
|
8
|
+
"default": "./dist/checkbox.js",
|
|
9
|
+
"types": "./types/src/checkbox.d.ts"
|
|
10
|
+
},
|
|
11
|
+
"./custom-elements.json": "./custom-elements.json"
|
|
8
12
|
},
|
|
9
|
-
"types": "types/src/index.d.ts",
|
|
10
13
|
"files": [
|
|
11
14
|
"dist",
|
|
12
15
|
"types"
|
|
@@ -26,86 +29,31 @@
|
|
|
26
29
|
"url": "https://github.com/code2nguyen/web-components.git"
|
|
27
30
|
},
|
|
28
31
|
"scripts": {
|
|
29
|
-
"lint": "npm run lint:lit-analyzer && npm run lint:eslint",
|
|
30
|
-
"lint:eslint": "eslint 'src/**/*.ts'",
|
|
31
|
-
"lint:lit-analyzer": "lit-analyzer",
|
|
32
32
|
"dev": "vite",
|
|
33
|
-
"build": "
|
|
33
|
+
"build": "wireit",
|
|
34
|
+
"type-check": "wireit"
|
|
35
|
+
},
|
|
36
|
+
"wireit": {
|
|
37
|
+
"type-check": {
|
|
38
|
+
"dependencies": [
|
|
39
|
+
"../../core:build"
|
|
40
|
+
],
|
|
41
|
+
"command": "tsc -p tsconfig.lib.json --composite false"
|
|
42
|
+
},
|
|
43
|
+
"build": {
|
|
44
|
+
"dependencies": [
|
|
45
|
+
"type-check"
|
|
46
|
+
],
|
|
47
|
+
"command": "vite build"
|
|
48
|
+
}
|
|
34
49
|
},
|
|
35
50
|
"dependencies": {
|
|
36
|
-
"@c2n/
|
|
37
|
-
"lit": "
|
|
51
|
+
"@c2n/core": "0.0.6",
|
|
52
|
+
"lit": "3.3.3"
|
|
38
53
|
},
|
|
39
54
|
"devDependencies": {
|
|
40
|
-
"@
|
|
41
|
-
"@typescript-eslint/parser": "5.33.1",
|
|
42
|
-
"eslint": "8.22.0",
|
|
43
|
-
"lit-analyzer": "1.2.1",
|
|
44
|
-
"prettier": "2.7.1",
|
|
45
|
-
"typescript": "4.7.4",
|
|
46
|
-
"vite": "3.0.8"
|
|
47
|
-
},
|
|
48
|
-
"prettier": {
|
|
49
|
-
"singleQuote": true,
|
|
50
|
-
"printWidth": 160,
|
|
51
|
-
"tabWidth": 2,
|
|
52
|
-
"semi": false
|
|
53
|
-
},
|
|
54
|
-
"eslintConfig": {
|
|
55
|
-
"root": true,
|
|
56
|
-
"extends": [
|
|
57
|
-
"eslint:recommended",
|
|
58
|
-
"plugin:@typescript-eslint/eslint-recommended",
|
|
59
|
-
"plugin:@typescript-eslint/recommended"
|
|
60
|
-
],
|
|
61
|
-
"parser": "@typescript-eslint/parser",
|
|
62
|
-
"parserOptions": {
|
|
63
|
-
"ecmaVersion": 2020,
|
|
64
|
-
"sourceType": "module"
|
|
65
|
-
},
|
|
66
|
-
"plugins": [
|
|
67
|
-
"@typescript-eslint"
|
|
68
|
-
],
|
|
69
|
-
"env": {
|
|
70
|
-
"browser": true
|
|
71
|
-
},
|
|
72
|
-
"rules": {
|
|
73
|
-
"no-prototype-builtins": "off",
|
|
74
|
-
"@typescript-eslint/ban-types": "off",
|
|
75
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
76
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
77
|
-
"@typescript-eslint/no-explicit-any": "error",
|
|
78
|
-
"@typescript-eslint/no-empty-function": "off",
|
|
79
|
-
"@typescript-eslint/no-non-null-assertion": "off",
|
|
80
|
-
"@typescript-eslint/no-unused-vars": [
|
|
81
|
-
"warn",
|
|
82
|
-
{
|
|
83
|
-
"argsIgnorePattern": "^_"
|
|
84
|
-
}
|
|
85
|
-
]
|
|
86
|
-
},
|
|
87
|
-
"overrides": [
|
|
88
|
-
{
|
|
89
|
-
"files": [
|
|
90
|
-
"rollup.config.js",
|
|
91
|
-
"web-test-runner.config.js"
|
|
92
|
-
],
|
|
93
|
-
"env": {
|
|
94
|
-
"node": true
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"files": [
|
|
99
|
-
"*_test.ts",
|
|
100
|
-
"**/custom_typings/*.ts",
|
|
101
|
-
"packages/labs/ssr/src/test/integration/tests/**",
|
|
102
|
-
"packages/labs/ssr/src/lib/util/parse5-utils.ts"
|
|
103
|
-
],
|
|
104
|
-
"rules": {
|
|
105
|
-
"@typescript-eslint/no-explicit-any": "off"
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
]
|
|
55
|
+
"@c2n/config": "*"
|
|
109
56
|
},
|
|
110
|
-
"
|
|
57
|
+
"customElements": "custom-elements.json",
|
|
58
|
+
"gitHead": "2921054bc75299da66dad11c1e374246ff88a51e"
|
|
111
59
|
}
|
package/types/src/checkbox.d.ts
CHANGED
|
@@ -1,22 +1,77 @@
|
|
|
1
|
-
import { LitElement, PropertyValues } from 'lit';
|
|
1
|
+
import { LitElement, type PropertyValues } from 'lit';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* A checkbox with native `<input type="checkbox">` behaviour. The visible box sits centred in a square touch target
|
|
4
|
+
* (`state-layer--size`) that doubles as the hover layer; that layer is transparent unless a
|
|
5
|
+
* `state-layer__hover__*--color` is set, so the default look is quiet.
|
|
4
6
|
*
|
|
5
|
-
* @
|
|
6
|
-
*
|
|
7
|
+
* @tag c2-checkbox
|
|
8
|
+
*
|
|
9
|
+
* @slot checkmark - Icon shown when checked: an inline SVG, a `c2-feather-*` icon or a `c2-mat-icon`. Defaults to a check.
|
|
10
|
+
* @slot mixedmark - Icon shown when indeterminate. Defaults to a dash.
|
|
11
|
+
* @slot uncheckmark - Icon shown when unchecked. Empty by default.
|
|
12
|
+
*
|
|
13
|
+
* @event {Event} change - Re-dispatched from the inner input when the checked state changes.
|
|
14
|
+
*
|
|
15
|
+
* @cssproperty {pixel} [--c2-checkbox__container--height=18px]
|
|
16
|
+
* @cssproperty {pixel} [--c2-checkbox__container--width=18px]
|
|
17
|
+
* @cssproperty {border-radius} [--c2-checkbox__container--border-top-left-radius=4px]
|
|
18
|
+
* @cssproperty {border-radius} [--c2-checkbox__container--border-top-right-radius=4px]
|
|
19
|
+
* @cssproperty {border-radius} [--c2-checkbox__container--border-bottom-left-radius=4px]
|
|
20
|
+
* @cssproperty {border-radius} [--c2-checkbox__container--border-bottom-right-radius=4px]
|
|
21
|
+
*
|
|
22
|
+
* @cssproperty {border} [--c2-checkbox__container--border-top=1px solid #bcbcc6]
|
|
23
|
+
* @cssproperty {border} [--c2-checkbox__container--border-right=1px solid #bcbcc6]
|
|
24
|
+
* @cssproperty {border} [--c2-checkbox__container--border-bottom=1px solid #bcbcc6]
|
|
25
|
+
* @cssproperty {border} [--c2-checkbox__container--border-left=1px solid #bcbcc6]
|
|
26
|
+
* @cssproperty {color} [--c2-checkbox__container--background-color=transparent]
|
|
27
|
+
*
|
|
28
|
+
* @cssproperty {color} [--c2-checkbox__container__selected--background-color=#476ef9]
|
|
29
|
+
* @cssproperty {border} [--c2-checkbox__container__selected--border-top=0px solid transparent]
|
|
30
|
+
* @cssproperty {border} [--c2-checkbox__container__selected--border-right=0px solid transparent]
|
|
31
|
+
* @cssproperty {border} [--c2-checkbox__container__selected--border-bottom=0px solid transparent]
|
|
32
|
+
* @cssproperty {border} [--c2-checkbox__container__selected--border-left=0px solid transparent]
|
|
33
|
+
*
|
|
34
|
+
* @cssproperty {color} --c2-checkbox__container__selected__hover--background-color
|
|
35
|
+
*
|
|
36
|
+
* @cssproperty {outline} [--c2-checkbox__container__focus--outline=2px solid rgba(71, 110, 249, 0.4)]
|
|
37
|
+
* @cssproperty {pixel} [--c2-checkbox__container__focus--outline-offset=2px]
|
|
38
|
+
*
|
|
39
|
+
* @cssproperty {opacity} [--c2-checkbox__container__disabled--opacity=0.38]
|
|
40
|
+
*
|
|
41
|
+
* @cssproperty {pixel} [--c2-checkbox__checkmark--size=12px]
|
|
42
|
+
* @cssproperty {color} [--c2-checkbox__checkmark--color=#ffffff]
|
|
43
|
+
*
|
|
44
|
+
* @cssproperty {pixel} [--c2-checkbox__mixedmark--size=12px]
|
|
45
|
+
* @cssproperty {color} [--c2-checkbox__mixedmark--color=#ffffff]
|
|
46
|
+
*
|
|
47
|
+
* @cssproperty {pixel} [--c2-checkbox__uncheckmark--size=12px]
|
|
48
|
+
* @cssproperty {color} [--c2-checkbox__uncheckmark--color=#ffffff]
|
|
49
|
+
*
|
|
50
|
+
* @cssproperty {pixel} [--c2-checkbox__state-layer--size=32px]
|
|
51
|
+
* @cssproperty {border-radius} [--c2-checkbox__state-layer--border-top-left-radius=6px]
|
|
52
|
+
* @cssproperty {border-radius} [--c2-checkbox__state-layer--border-top-right-radius=6px]
|
|
53
|
+
* @cssproperty {border-radius} [--c2-checkbox__state-layer--border-bottom-left-radius=6px]
|
|
54
|
+
* @cssproperty {border-radius} [--c2-checkbox__state-layer--border-bottom-right-radius=6px]
|
|
55
|
+
* @cssproperty {color} --c2-checkbox__state-layer__hover__unselected--color
|
|
56
|
+
* @cssproperty {color} --c2-checkbox__state-layer__hover__selected--color
|
|
7
57
|
*/
|
|
8
58
|
export declare class Checkbox extends LitElement {
|
|
9
59
|
protected formElement: HTMLInputElement;
|
|
60
|
+
/** Whether the checkbox is checked. */
|
|
10
61
|
checked: boolean;
|
|
62
|
+
/** Shows the mixed state (neither checked nor unchecked), e.g. for a parent of a partially selected group. */
|
|
11
63
|
indeterminate: boolean;
|
|
64
|
+
/** Disables the control: it no longer toggles and is rendered dimmed. */
|
|
12
65
|
disabled: boolean;
|
|
66
|
+
/** Form field name forwarded to the inner input. */
|
|
13
67
|
name: string;
|
|
14
68
|
ariaLabel: string;
|
|
15
69
|
ariaLabelledBy: undefined | string;
|
|
16
70
|
ariaDescribedBy: undefined | string;
|
|
17
71
|
render(): import("lit-html").TemplateResult<1>;
|
|
72
|
+
focus(options?: FocusOptions | undefined): void;
|
|
18
73
|
protected update(changedProperties: PropertyValues): void;
|
|
19
|
-
protected handleChange(): void;
|
|
74
|
+
protected handleChange(event: Event): void;
|
|
20
75
|
static styles: import("lit").CSSResult;
|
|
21
76
|
}
|
|
22
77
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,cAAc,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAA;AAMtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,qBACa,QAAS,SAAQ,UAAU;IACtB,SAAS,CAAC,WAAW,EAAG,gBAAgB,CAAA;IAExD,uCAAuC;IACK,OAAO,UAAQ;IAE3D,8GAA8G;IAClE,aAAa,UAAQ;IAEjE,yEAAyE;IAC7B,QAAQ,UAAQ;IAE5D,oDAAoD;IACxB,IAAI,SAAK;IAG5B,SAAS,EAAG,MAAM,CAAA;IAG3B,cAAc,EAAG,SAAS,GAAG,MAAM,CAAA;IAGnC,eAAe,EAAG,SAAS,GAAG,MAAM,CAAA;IAE3B,MAAM;IA2CN,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI;cAIrC,MAAM,CAAC,iBAAiB,EAAE,cAAc;IAO3D,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK;IAMnC,OAAgB,MAAM,0BAAoB;CAC3C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,QAAQ,CAAA;KACxB;CACF"}
|
package/types/src/index.d.ts
DELETED
package/types/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|