@devschile/chucao 1.3.0 → 1.4.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/dist/chucao/chucao.esm.js +1 -1
- package/dist/chucao/p-1f47dd08.entry.js +2 -0
- package/dist/chucao/p-1f47dd08.entry.js.map +1 -0
- package/dist/chucao/p-438e1401.entry.js +2 -0
- package/dist/chucao/p-438e1401.entry.js.map +1 -0
- package/dist/chucao/p-7413b8c3.entry.js +2 -0
- package/dist/chucao/p-7413b8c3.entry.js.map +1 -0
- package/dist/chucao/p-90db80a2.entry.js +2 -0
- package/dist/chucao/p-90db80a2.entry.js.map +1 -0
- package/dist/chucao/p-Bk9pvIKL.js +3 -0
- package/dist/chucao/p-Bk9pvIKL.js.map +1 -0
- package/dist/chucao/p-faa21ce0.entry.js +2 -0
- package/dist/chucao/p-faa21ce0.entry.js.map +1 -0
- package/dist/cjs/ch-badge_5.cjs.entry.js +54 -6
- package/dist/cjs/ch-badge_5.cjs.entry.js.map +1 -1
- package/dist/cjs/ch-checkbox.cjs.entry.js +80 -0
- package/dist/cjs/ch-checkbox.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-radio.cjs.entry.js +83 -0
- package/dist/cjs/ch-radio.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-switch.cjs.entry.js +80 -0
- package/dist/cjs/ch-switch.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-textarea.cjs.entry.js +94 -0
- package/dist/cjs/ch-textarea.cjs.entry.js.map +1 -0
- package/dist/cjs/chucao.cjs.js +2 -2
- package/dist/cjs/{index-yB1Ik3Sa.js → index-DX3RZKi8.js} +5 -2
- package/dist/cjs/index-DX3RZKi8.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +5 -1
- package/dist/collection/components/ch-card/ch-card.js +1 -1
- package/dist/collection/components/ch-checkbox/ch-checkbox.css +79 -0
- package/dist/collection/components/ch-checkbox/ch-checkbox.js +276 -0
- package/dist/collection/components/ch-checkbox/ch-checkbox.js.map +1 -0
- package/dist/collection/components/ch-input/ch-input.css +20 -0
- package/dist/collection/components/ch-input/ch-input.js +83 -1
- package/dist/collection/components/ch-input/ch-input.js.map +1 -1
- package/dist/collection/components/ch-radio/ch-radio.css +89 -0
- package/dist/collection/components/ch-radio/ch-radio.js +282 -0
- package/dist/collection/components/ch-radio/ch-radio.js.map +1 -0
- package/dist/collection/components/ch-select/ch-select.css +20 -0
- package/dist/collection/components/ch-select/ch-select.js +83 -1
- package/dist/collection/components/ch-select/ch-select.js.map +1 -1
- package/dist/collection/components/ch-switch/ch-switch.css +92 -0
- package/dist/collection/components/ch-switch/ch-switch.js +276 -0
- package/dist/collection/components/ch-switch/ch-switch.js.map +1 -0
- package/dist/collection/components/ch-textarea/ch-textarea.css +66 -0
- package/dist/collection/components/ch-textarea/ch-textarea.js +323 -0
- package/dist/collection/components/ch-textarea/ch-textarea.js.map +1 -0
- package/dist/components/ch-badge.js +1 -1
- package/dist/components/ch-button.js +1 -1
- package/dist/components/ch-card.js +1 -1
- package/dist/components/ch-card.js.map +1 -1
- package/dist/components/ch-checkbox.d.ts +11 -0
- package/dist/components/ch-checkbox.js +2 -0
- package/dist/components/ch-checkbox.js.map +1 -0
- package/dist/components/ch-input.js +1 -1
- package/dist/components/ch-input.js.map +1 -1
- package/dist/components/ch-radio.d.ts +11 -0
- package/dist/components/ch-radio.js +2 -0
- package/dist/components/ch-radio.js.map +1 -0
- package/dist/components/ch-select.js +1 -1
- package/dist/components/ch-select.js.map +1 -1
- package/dist/components/ch-switch.d.ts +11 -0
- package/dist/components/ch-switch.js +2 -0
- package/dist/components/ch-switch.js.map +1 -0
- package/dist/components/ch-textarea.d.ts +11 -0
- package/dist/components/ch-textarea.js +2 -0
- package/dist/components/ch-textarea.js.map +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-CcEsJ4Ml.js +2 -0
- package/dist/components/p-CcEsJ4Ml.js.map +1 -0
- package/dist/esm/ch-badge_5.entry.js +54 -6
- package/dist/esm/ch-badge_5.entry.js.map +1 -1
- package/dist/esm/ch-checkbox.entry.js +78 -0
- package/dist/esm/ch-checkbox.entry.js.map +1 -0
- package/dist/esm/ch-radio.entry.js +81 -0
- package/dist/esm/ch-radio.entry.js.map +1 -0
- package/dist/esm/ch-switch.entry.js +78 -0
- package/dist/esm/ch-switch.entry.js.map +1 -0
- package/dist/esm/ch-textarea.entry.js +92 -0
- package/dist/esm/ch-textarea.entry.js.map +1 -0
- package/dist/esm/chucao.js +3 -3
- package/dist/esm/{index-COo5t8-6.js → index-Bk9pvIKL.js} +5 -2
- package/dist/esm/index-Bk9pvIKL.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/types/components/ch-checkbox/ch-checkbox.d.ts +51 -0
- package/dist/types/components/ch-input/ch-input.d.ts +16 -0
- package/dist/types/components/ch-radio/ch-radio.d.ts +58 -0
- package/dist/types/components/ch-select/ch-select.d.ts +16 -0
- package/dist/types/components/ch-switch/ch-switch.d.ts +51 -0
- package/dist/types/components/ch-textarea/ch-textarea.d.ts +60 -0
- package/dist/types/components.d.ts +571 -0
- package/dist-react/components.d.ts +22 -1
- package/dist-react/components.js +39 -0
- package/dist-react/components.ts +55 -1
- package/dist-vue/index.d.ts +4 -0
- package/dist-vue/index.js +69 -0
- package/dist-vue/index.ts +77 -0
- package/package.json +1 -1
- package/dist/chucao/p-94a2b1be.entry.js +0 -2
- package/dist/chucao/p-94a2b1be.entry.js.map +0 -1
- package/dist/chucao/p-COo5t8-6.js +0 -3
- package/dist/chucao/p-COo5t8-6.js.map +0 -1
- package/dist/cjs/index-yB1Ik3Sa.js.map +0 -1
- package/dist/components/p-DCKzDjxR.js +0 -2
- package/dist/components/p-DCKzDjxR.js.map +0 -1
- package/dist/esm/index-COo5t8-6.js.map +0 -1
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-DX3RZKi8.js');
|
|
4
4
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await index.globalScripts();
|
|
8
|
-
return index.bootstrapLazy([["ch-badge_5.cjs",[[769,"ch-badge",{"variant":[1]}],[769,"ch-button",{"variant":[1],"disabled":[4],"label":[1]}],[257,"ch-card"],[513,"ch-input",{"label":[1],"type":[1],"value":[1025],"placeholder":[1],"name":[1],"disabled":[4],"required":[4]}],[513,"ch-select",{"label":[1],"options":[16],"value":[1025],"placeholder":[1],"name":[1],"disabled":[4],"required":[4]}]]]], options);
|
|
8
|
+
return index.bootstrapLazy([["ch-badge_5.cjs",[[769,"ch-badge",{"variant":[1]}],[769,"ch-button",{"variant":[1],"disabled":[4],"label":[1]}],[257,"ch-card"],[513,"ch-input",{"label":[1],"type":[1],"value":[1025],"placeholder":[1],"name":[1],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}],[513,"ch-select",{"label":[1],"options":[16],"value":[1025],"placeholder":[1],"name":[1],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}]]],["ch-checkbox.cjs",[[513,"ch-checkbox",{"label":[1],"name":[1],"value":[1],"checked":[1028],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}]]],["ch-radio.cjs",[[513,"ch-radio",{"label":[1],"options":[16],"value":[1025],"name":[1],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}]]],["ch-switch.cjs",[[513,"ch-switch",{"label":[1],"name":[1],"value":[1],"checked":[1028],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}]]],["ch-textarea.cjs",[[513,"ch-textarea",{"label":[1],"value":[1025],"placeholder":[1],"rows":[2],"name":[1],"disabled":[4],"required":[4],"hint":[1],"errorMessage":[1,"error-message"],"invalid":[4]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
exports.setNonce = index.setNonce;
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
"entries": [
|
|
3
3
|
"components/ch-badge/ch-badge.js",
|
|
4
4
|
"components/ch-button/ch-button.js",
|
|
5
|
+
"components/ch-radio/ch-radio.js",
|
|
5
6
|
"components/ch-select/ch-select.js",
|
|
6
7
|
"components/ch-card/ch-card.js",
|
|
7
|
-
"components/ch-
|
|
8
|
+
"components/ch-checkbox/ch-checkbox.js",
|
|
9
|
+
"components/ch-input/ch-input.js",
|
|
10
|
+
"components/ch-switch/ch-switch.js",
|
|
11
|
+
"components/ch-textarea/ch-textarea.js"
|
|
8
12
|
],
|
|
9
13
|
"mixins": [],
|
|
10
14
|
"compiler": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
export class ChCard {
|
|
3
3
|
render() {
|
|
4
|
-
return (h(Host, { key: '
|
|
4
|
+
return (h(Host, { key: '82dd174c07247b97a95a7d0f98493b78edc990e0' }, h("div", { key: '5e08ed6ba926510a0253436ed63c18a3a4d8e62c', class: "card" }, h("slot", { key: '98b78c7a62887d2080dbd464da2c5329a1a5f0db' }))));
|
|
5
5
|
}
|
|
6
6
|
static get is() { return "ch-card"; }
|
|
7
7
|
static get encapsulation() { return "shadow"; }
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.control {
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: var(--spacing-lg);
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.control--disabled {
|
|
13
|
+
opacity: var(--opacity-disabled);
|
|
14
|
+
cursor: not-allowed;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.input {
|
|
18
|
+
appearance: none;
|
|
19
|
+
-webkit-appearance: none;
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
width: var(--spacing-4xl);
|
|
25
|
+
height: var(--spacing-4xl);
|
|
26
|
+
margin: 0;
|
|
27
|
+
flex-shrink: 0;
|
|
28
|
+
border: var(--border-width) solid var(--border);
|
|
29
|
+
border-radius: var(--radius-sm);
|
|
30
|
+
background: var(--surface);
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
transition:
|
|
33
|
+
border-color var(--duration-normal) var(--easing-default),
|
|
34
|
+
background-color var(--duration-normal) var(--easing-default),
|
|
35
|
+
box-shadow var(--duration-normal) var(--easing-default);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.input:focus-visible {
|
|
39
|
+
outline: var(--focus-outline-width) solid var(--accent);
|
|
40
|
+
outline-offset: var(--focus-outline-offset);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.input:checked {
|
|
44
|
+
border-color: var(--accent);
|
|
45
|
+
background: var(--accent);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.input:checked::before {
|
|
49
|
+
content: '';
|
|
50
|
+
width: var(--spacing-xs);
|
|
51
|
+
height: var(--spacing-lg);
|
|
52
|
+
border: solid var(--color-accent-text);
|
|
53
|
+
border-width: 0 var(--spacing-shift) var(--spacing-shift) 0;
|
|
54
|
+
transform: rotate(45deg);
|
|
55
|
+
margin-top: calc(-1 * var(--spacing-2xs));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.input--invalid {
|
|
59
|
+
border-color: var(--color-status-warning);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.input--invalid:focus-visible {
|
|
63
|
+
outline-color: var(--color-status-warning);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.label-text {
|
|
67
|
+
color: var(--text);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.hint,
|
|
71
|
+
.error {
|
|
72
|
+
margin: var(--spacing-sm) 0 0;
|
|
73
|
+
font-size: var(--typography-size-sm);
|
|
74
|
+
color: var(--text-muted);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.error {
|
|
78
|
+
color: var(--color-status-warning);
|
|
79
|
+
}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
let checkboxIds = 0;
|
|
3
|
+
export class ChCheckbox {
|
|
4
|
+
checkboxId = `ch-checkbox-${++checkboxIds}`;
|
|
5
|
+
hintId = `${this.checkboxId}-hint`;
|
|
6
|
+
errorId = `${this.checkboxId}-error`;
|
|
7
|
+
/**
|
|
8
|
+
* Visible label rendered next to the checkbox, associated with it via
|
|
9
|
+
* `for`/`id`, so assistive technology announces the checkbox's purpose.
|
|
10
|
+
*/
|
|
11
|
+
label;
|
|
12
|
+
/**
|
|
13
|
+
* The name of the checkbox, submitted with form data.
|
|
14
|
+
*/
|
|
15
|
+
name;
|
|
16
|
+
/**
|
|
17
|
+
* The value of the checkbox, submitted with form data.
|
|
18
|
+
*/
|
|
19
|
+
value = 'on';
|
|
20
|
+
/**
|
|
21
|
+
* Whether the checkbox is checked.
|
|
22
|
+
*/
|
|
23
|
+
checked = false;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the checkbox is disabled.
|
|
26
|
+
*/
|
|
27
|
+
disabled = false;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the checkbox is required.
|
|
30
|
+
*/
|
|
31
|
+
required = false;
|
|
32
|
+
/**
|
|
33
|
+
* Helper text rendered below the checkbox, associated via `aria-describedby`.
|
|
34
|
+
* Replaced by `errorMessage` when the checkbox is invalid.
|
|
35
|
+
*/
|
|
36
|
+
hint;
|
|
37
|
+
/**
|
|
38
|
+
* Error message rendered below the checkbox when it is invalid.
|
|
39
|
+
*/
|
|
40
|
+
errorMessage;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the checkbox is in an invalid state; toggles `aria-invalid` and error styling.
|
|
43
|
+
*/
|
|
44
|
+
invalid = false;
|
|
45
|
+
/**
|
|
46
|
+
* Emitted when the checked state changes, with the new checked value.
|
|
47
|
+
*/
|
|
48
|
+
chChange;
|
|
49
|
+
handleChange = (ev) => {
|
|
50
|
+
this.checked = ev.target.checked;
|
|
51
|
+
this.chChange.emit(this.checked);
|
|
52
|
+
};
|
|
53
|
+
get describedBy() {
|
|
54
|
+
if (this.invalid && this.errorMessage) {
|
|
55
|
+
return this.errorId;
|
|
56
|
+
}
|
|
57
|
+
if (this.hint) {
|
|
58
|
+
return this.hintId;
|
|
59
|
+
}
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
return (h(Host, { key: '6908382079fec6d7769305c22fc0198b428e2d68' }, h("label", { key: '9f3d7d91f4ed7840cad97c4757fbdfad740279fa', class: { 'control': true, 'control--disabled': this.disabled }, htmlFor: this.checkboxId }, h("input", { key: 'eb69f96246876eeb5a885a01e6809ed972f6a148', id: this.checkboxId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), this.label && h("span", { key: 'e51e04239c2f044c28c3bf45af78f87f5271cba9', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: 'eed6378c2017980dca779dd1ad41041980da944f', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: 'c6fc50a2f0bdc08f29941eb3fb838e4f167f3df3', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
64
|
+
}
|
|
65
|
+
static get is() { return "ch-checkbox"; }
|
|
66
|
+
static get encapsulation() { return "shadow"; }
|
|
67
|
+
static get originalStyleUrls() {
|
|
68
|
+
return {
|
|
69
|
+
"$": ["ch-checkbox.css"]
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
static get styleUrls() {
|
|
73
|
+
return {
|
|
74
|
+
"$": ["ch-checkbox.css"]
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
static get properties() {
|
|
78
|
+
return {
|
|
79
|
+
"label": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"mutable": false,
|
|
82
|
+
"complexType": {
|
|
83
|
+
"original": "string",
|
|
84
|
+
"resolved": "string",
|
|
85
|
+
"references": {}
|
|
86
|
+
},
|
|
87
|
+
"required": false,
|
|
88
|
+
"optional": true,
|
|
89
|
+
"docs": {
|
|
90
|
+
"tags": [],
|
|
91
|
+
"text": "Visible label rendered next to the checkbox, associated with it via\n`for`/`id`, so assistive technology announces the checkbox's purpose."
|
|
92
|
+
},
|
|
93
|
+
"getter": false,
|
|
94
|
+
"setter": false,
|
|
95
|
+
"reflect": false,
|
|
96
|
+
"attribute": "label"
|
|
97
|
+
},
|
|
98
|
+
"name": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"mutable": false,
|
|
101
|
+
"complexType": {
|
|
102
|
+
"original": "string",
|
|
103
|
+
"resolved": "string",
|
|
104
|
+
"references": {}
|
|
105
|
+
},
|
|
106
|
+
"required": false,
|
|
107
|
+
"optional": true,
|
|
108
|
+
"docs": {
|
|
109
|
+
"tags": [],
|
|
110
|
+
"text": "The name of the checkbox, submitted with form data."
|
|
111
|
+
},
|
|
112
|
+
"getter": false,
|
|
113
|
+
"setter": false,
|
|
114
|
+
"reflect": false,
|
|
115
|
+
"attribute": "name"
|
|
116
|
+
},
|
|
117
|
+
"value": {
|
|
118
|
+
"type": "string",
|
|
119
|
+
"mutable": false,
|
|
120
|
+
"complexType": {
|
|
121
|
+
"original": "string",
|
|
122
|
+
"resolved": "string",
|
|
123
|
+
"references": {}
|
|
124
|
+
},
|
|
125
|
+
"required": false,
|
|
126
|
+
"optional": false,
|
|
127
|
+
"docs": {
|
|
128
|
+
"tags": [],
|
|
129
|
+
"text": "The value of the checkbox, submitted with form data."
|
|
130
|
+
},
|
|
131
|
+
"getter": false,
|
|
132
|
+
"setter": false,
|
|
133
|
+
"reflect": false,
|
|
134
|
+
"attribute": "value",
|
|
135
|
+
"defaultValue": "'on'"
|
|
136
|
+
},
|
|
137
|
+
"checked": {
|
|
138
|
+
"type": "boolean",
|
|
139
|
+
"mutable": true,
|
|
140
|
+
"complexType": {
|
|
141
|
+
"original": "boolean",
|
|
142
|
+
"resolved": "boolean",
|
|
143
|
+
"references": {}
|
|
144
|
+
},
|
|
145
|
+
"required": false,
|
|
146
|
+
"optional": false,
|
|
147
|
+
"docs": {
|
|
148
|
+
"tags": [],
|
|
149
|
+
"text": "Whether the checkbox is checked."
|
|
150
|
+
},
|
|
151
|
+
"getter": false,
|
|
152
|
+
"setter": false,
|
|
153
|
+
"reflect": false,
|
|
154
|
+
"attribute": "checked",
|
|
155
|
+
"defaultValue": "false"
|
|
156
|
+
},
|
|
157
|
+
"disabled": {
|
|
158
|
+
"type": "boolean",
|
|
159
|
+
"mutable": false,
|
|
160
|
+
"complexType": {
|
|
161
|
+
"original": "boolean",
|
|
162
|
+
"resolved": "boolean",
|
|
163
|
+
"references": {}
|
|
164
|
+
},
|
|
165
|
+
"required": false,
|
|
166
|
+
"optional": false,
|
|
167
|
+
"docs": {
|
|
168
|
+
"tags": [],
|
|
169
|
+
"text": "Whether the checkbox is disabled."
|
|
170
|
+
},
|
|
171
|
+
"getter": false,
|
|
172
|
+
"setter": false,
|
|
173
|
+
"reflect": false,
|
|
174
|
+
"attribute": "disabled",
|
|
175
|
+
"defaultValue": "false"
|
|
176
|
+
},
|
|
177
|
+
"required": {
|
|
178
|
+
"type": "boolean",
|
|
179
|
+
"mutable": false,
|
|
180
|
+
"complexType": {
|
|
181
|
+
"original": "boolean",
|
|
182
|
+
"resolved": "boolean",
|
|
183
|
+
"references": {}
|
|
184
|
+
},
|
|
185
|
+
"required": false,
|
|
186
|
+
"optional": false,
|
|
187
|
+
"docs": {
|
|
188
|
+
"tags": [],
|
|
189
|
+
"text": "Whether the checkbox is required."
|
|
190
|
+
},
|
|
191
|
+
"getter": false,
|
|
192
|
+
"setter": false,
|
|
193
|
+
"reflect": false,
|
|
194
|
+
"attribute": "required",
|
|
195
|
+
"defaultValue": "false"
|
|
196
|
+
},
|
|
197
|
+
"hint": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"mutable": false,
|
|
200
|
+
"complexType": {
|
|
201
|
+
"original": "string",
|
|
202
|
+
"resolved": "string",
|
|
203
|
+
"references": {}
|
|
204
|
+
},
|
|
205
|
+
"required": false,
|
|
206
|
+
"optional": true,
|
|
207
|
+
"docs": {
|
|
208
|
+
"tags": [],
|
|
209
|
+
"text": "Helper text rendered below the checkbox, associated via `aria-describedby`.\nReplaced by `errorMessage` when the checkbox is invalid."
|
|
210
|
+
},
|
|
211
|
+
"getter": false,
|
|
212
|
+
"setter": false,
|
|
213
|
+
"reflect": false,
|
|
214
|
+
"attribute": "hint"
|
|
215
|
+
},
|
|
216
|
+
"errorMessage": {
|
|
217
|
+
"type": "string",
|
|
218
|
+
"mutable": false,
|
|
219
|
+
"complexType": {
|
|
220
|
+
"original": "string",
|
|
221
|
+
"resolved": "string",
|
|
222
|
+
"references": {}
|
|
223
|
+
},
|
|
224
|
+
"required": false,
|
|
225
|
+
"optional": true,
|
|
226
|
+
"docs": {
|
|
227
|
+
"tags": [],
|
|
228
|
+
"text": "Error message rendered below the checkbox when it is invalid."
|
|
229
|
+
},
|
|
230
|
+
"getter": false,
|
|
231
|
+
"setter": false,
|
|
232
|
+
"reflect": false,
|
|
233
|
+
"attribute": "error-message"
|
|
234
|
+
},
|
|
235
|
+
"invalid": {
|
|
236
|
+
"type": "boolean",
|
|
237
|
+
"mutable": false,
|
|
238
|
+
"complexType": {
|
|
239
|
+
"original": "boolean",
|
|
240
|
+
"resolved": "boolean",
|
|
241
|
+
"references": {}
|
|
242
|
+
},
|
|
243
|
+
"required": false,
|
|
244
|
+
"optional": false,
|
|
245
|
+
"docs": {
|
|
246
|
+
"tags": [],
|
|
247
|
+
"text": "Whether the checkbox is in an invalid state; toggles `aria-invalid` and error styling."
|
|
248
|
+
},
|
|
249
|
+
"getter": false,
|
|
250
|
+
"setter": false,
|
|
251
|
+
"reflect": false,
|
|
252
|
+
"attribute": "invalid",
|
|
253
|
+
"defaultValue": "false"
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
static get events() {
|
|
258
|
+
return [{
|
|
259
|
+
"method": "chChange",
|
|
260
|
+
"name": "chChange",
|
|
261
|
+
"bubbles": true,
|
|
262
|
+
"cancelable": true,
|
|
263
|
+
"composed": true,
|
|
264
|
+
"docs": {
|
|
265
|
+
"tags": [],
|
|
266
|
+
"text": "Emitted when the checked state changes, with the new checked value."
|
|
267
|
+
},
|
|
268
|
+
"complexType": {
|
|
269
|
+
"original": "boolean",
|
|
270
|
+
"resolved": "boolean",
|
|
271
|
+
"references": {}
|
|
272
|
+
}
|
|
273
|
+
}];
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=ch-checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ch-checkbox.js","sourceRoot":"","sources":["../../../../src/components/ch-checkbox/ch-checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAqB,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAEnF,IAAI,WAAW,GAAG,CAAC,CAAC;AAOpB,MAAM,OAAO,UAAU;IACJ,UAAU,GAAG,eAAe,EAAE,WAAW,EAAE,CAAC;IAC5C,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,OAAO,CAAC;IACnC,OAAO,GAAG,GAAG,IAAI,CAAC,UAAU,QAAQ,CAAC;IAEtD;;;OAGG;IACK,KAAK,CAAU;IAEvB;;OAEG;IACK,IAAI,CAAU;IAEtB;;OAEG;IACK,KAAK,GAAG,IAAI,CAAC;IAErB;;OAEG;IACsB,OAAO,GAAG,KAAK,CAAC;IAEzC;;OAEG;IACK,QAAQ,GAAG,KAAK,CAAC;IAEzB;;OAEG;IACK,QAAQ,GAAG,KAAK,CAAC;IAEzB;;;OAGG;IACK,IAAI,CAAU;IAEtB;;OAEG;IACK,YAAY,CAAU;IAE9B;;OAEG;IACK,OAAO,GAAG,KAAK,CAAC;IAExB;;OAEG;IACM,QAAQ,CAAwB;IAEjC,YAAY,GAAG,CAAC,EAAS,EAAE,EAAE;QACnC,IAAI,CAAC,OAAO,GAAI,EAAE,CAAC,MAA2B,CAAC,OAAO,CAAC;QACvD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC,CAAC;IAEF,IAAY,WAAW;QACrB,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtC,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI;YACH,8DAAO,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU;gBAC7F,8DACE,EAAE,EAAE,IAAI,CAAC,UAAU,EACnB,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,CAAC,OAAO,EAAE,EACxD,IAAI,EAAC,UAAU,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,kBACT,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,sBAC7B,IAAI,CAAC,WAAW,EAClC,QAAQ,EAAE,IAAI,CAAC,YAAY,GAC3B;gBACD,IAAI,CAAC,KAAK,IAAI,6DAAM,KAAK,EAAC,YAAY,IAAE,IAAI,CAAC,KAAK,CAAQ,CACrD;YACP,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CACpD,0DAAG,KAAK,EAAC,MAAM,EAAC,EAAE,EAAE,IAAI,CAAC,MAAM,IAC5B,IAAI,CAAC,IAAI,CACR,CACL;YACA,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,YAAY,IAAI,CACpC,0DAAG,KAAK,EAAC,OAAO,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAC,OAAO,IAC5C,IAAI,CAAC,YAAY,CAChB,CACL,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nlet checkboxIds = 0;\n\n@Component({\n tag: 'ch-checkbox',\n styleUrl: 'ch-checkbox.css',\n shadow: true,\n})\nexport class ChCheckbox {\n private readonly checkboxId = `ch-checkbox-${++checkboxIds}`;\n private readonly hintId = `${this.checkboxId}-hint`;\n private readonly errorId = `${this.checkboxId}-error`;\n\n /**\n * Visible label rendered next to the checkbox, associated with it via\n * `for`/`id`, so assistive technology announces the checkbox's purpose.\n */\n @Prop() label?: string;\n\n /**\n * The name of the checkbox, submitted with form data.\n */\n @Prop() name?: string;\n\n /**\n * The value of the checkbox, submitted with form data.\n */\n @Prop() value = 'on';\n\n /**\n * Whether the checkbox is checked.\n */\n @Prop({ mutable: true }) checked = false;\n\n /**\n * Whether the checkbox is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Whether the checkbox is required.\n */\n @Prop() required = false;\n\n /**\n * Helper text rendered below the checkbox, associated via `aria-describedby`.\n * Replaced by `errorMessage` when the checkbox is invalid.\n */\n @Prop() hint?: string;\n\n /**\n * Error message rendered below the checkbox when it is invalid.\n */\n @Prop() errorMessage?: string;\n\n /**\n * Whether the checkbox is in an invalid state; toggles `aria-invalid` and error styling.\n */\n @Prop() invalid = false;\n\n /**\n * Emitted when the checked state changes, with the new checked value.\n */\n @Event() chChange: EventEmitter<boolean>;\n\n private handleChange = (ev: Event) => {\n this.checked = (ev.target as HTMLInputElement).checked;\n this.chChange.emit(this.checked);\n };\n\n private get describedBy(): string | undefined {\n if (this.invalid && this.errorMessage) {\n return this.errorId;\n }\n if (this.hint) {\n return this.hintId;\n }\n return undefined;\n }\n\n render() {\n return (\n <Host>\n <label class={{ 'control': true, 'control--disabled': this.disabled }} htmlFor={this.checkboxId}>\n <input\n id={this.checkboxId}\n class={{ 'input': true, 'input--invalid': this.invalid }}\n type=\"checkbox\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n disabled={this.disabled}\n required={this.required}\n aria-invalid={this.invalid ? 'true' : undefined}\n aria-describedby={this.describedBy}\n onChange={this.handleChange}\n />\n {this.label && <span class=\"label-text\">{this.label}</span>}\n </label>\n {this.hint && !(this.invalid && this.errorMessage) && (\n <p class=\"hint\" id={this.hintId}>\n {this.hint}\n </p>\n )}\n {this.invalid && this.errorMessage && (\n <p class=\"error\" id={this.errorId} role=\"alert\">\n {this.errorMessage}\n </p>\n )}\n </Host>\n );\n }\n}\n"]}
|
|
@@ -37,7 +37,27 @@
|
|
|
37
37
|
outline: none;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
.input--invalid {
|
|
41
|
+
border-color: var(--color-status-warning);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.input--invalid:focus {
|
|
45
|
+
border-color: var(--color-status-warning);
|
|
46
|
+
box-shadow: 0 0 0 3px var(--color-status-warning-background);
|
|
47
|
+
}
|
|
48
|
+
|
|
40
49
|
.input:disabled {
|
|
41
50
|
opacity: var(--opacity-disabled);
|
|
42
51
|
cursor: not-allowed;
|
|
43
52
|
}
|
|
53
|
+
|
|
54
|
+
.hint,
|
|
55
|
+
.error {
|
|
56
|
+
margin: var(--spacing-sm) 0 0;
|
|
57
|
+
font-size: var(--typography-size-sm);
|
|
58
|
+
color: var(--text-muted);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.error {
|
|
62
|
+
color: var(--color-status-warning);
|
|
63
|
+
}
|
|
@@ -2,6 +2,8 @@ import { Host, h } from "@stencil/core";
|
|
|
2
2
|
let inputIds = 0;
|
|
3
3
|
export class ChInput {
|
|
4
4
|
inputId = `ch-input-${++inputIds}`;
|
|
5
|
+
hintId = `${this.inputId}-hint`;
|
|
6
|
+
errorId = `${this.inputId}-error`;
|
|
5
7
|
/**
|
|
6
8
|
* Visible label rendered above the input and associated with it via
|
|
7
9
|
* `for`/`id`, so assistive technology announces the input's purpose.
|
|
@@ -31,6 +33,19 @@ export class ChInput {
|
|
|
31
33
|
* Whether the input is required.
|
|
32
34
|
*/
|
|
33
35
|
required = false;
|
|
36
|
+
/**
|
|
37
|
+
* Helper text rendered below the input, associated via `aria-describedby`.
|
|
38
|
+
* Replaced by `errorMessage` when the input is invalid.
|
|
39
|
+
*/
|
|
40
|
+
hint;
|
|
41
|
+
/**
|
|
42
|
+
* Error message rendered below the input when it is invalid.
|
|
43
|
+
*/
|
|
44
|
+
errorMessage;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the input is in an invalid state; toggles `aria-invalid` and error styling.
|
|
47
|
+
*/
|
|
48
|
+
invalid = false;
|
|
34
49
|
/**
|
|
35
50
|
* Emitted on every keystroke, with the current input value.
|
|
36
51
|
*/
|
|
@@ -47,8 +62,17 @@ export class ChInput {
|
|
|
47
62
|
this.value = ev.target.value;
|
|
48
63
|
this.chChange.emit(this.value);
|
|
49
64
|
};
|
|
65
|
+
get describedBy() {
|
|
66
|
+
if (this.invalid && this.errorMessage) {
|
|
67
|
+
return this.errorId;
|
|
68
|
+
}
|
|
69
|
+
if (this.hint) {
|
|
70
|
+
return this.hintId;
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
50
74
|
render() {
|
|
51
|
-
return (h(Host, { key: '
|
|
75
|
+
return (h(Host, { key: 'a5023a46ae36b92652a9f3af4c0f4b0e38ae3048' }, this.label && (h("label", { key: 'c1f30bcef7952942cecba1ac974cd11a08175907', class: "label", htmlFor: this.inputId }, this.label)), h("input", { key: 'a99f938c676405b8bb464566d1a7b70793b814e4', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.invalid }, type: this.type, name: this.name, placeholder: this.placeholder, disabled: this.disabled, required: this.required, value: this.value, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange }), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '09612cded2b2b78b6d123b574a888266f4cbc1d4', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: 'fb5b26357dcbe64b5a7c16c642c5c189f98f6f78', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
52
76
|
}
|
|
53
77
|
static get is() { return "ch-input"; }
|
|
54
78
|
static get encapsulation() { return "shadow"; }
|
|
@@ -200,6 +224,64 @@ export class ChInput {
|
|
|
200
224
|
"reflect": false,
|
|
201
225
|
"attribute": "required",
|
|
202
226
|
"defaultValue": "false"
|
|
227
|
+
},
|
|
228
|
+
"hint": {
|
|
229
|
+
"type": "string",
|
|
230
|
+
"mutable": false,
|
|
231
|
+
"complexType": {
|
|
232
|
+
"original": "string",
|
|
233
|
+
"resolved": "string",
|
|
234
|
+
"references": {}
|
|
235
|
+
},
|
|
236
|
+
"required": false,
|
|
237
|
+
"optional": true,
|
|
238
|
+
"docs": {
|
|
239
|
+
"tags": [],
|
|
240
|
+
"text": "Helper text rendered below the input, associated via `aria-describedby`.\nReplaced by `errorMessage` when the input is invalid."
|
|
241
|
+
},
|
|
242
|
+
"getter": false,
|
|
243
|
+
"setter": false,
|
|
244
|
+
"reflect": false,
|
|
245
|
+
"attribute": "hint"
|
|
246
|
+
},
|
|
247
|
+
"errorMessage": {
|
|
248
|
+
"type": "string",
|
|
249
|
+
"mutable": false,
|
|
250
|
+
"complexType": {
|
|
251
|
+
"original": "string",
|
|
252
|
+
"resolved": "string",
|
|
253
|
+
"references": {}
|
|
254
|
+
},
|
|
255
|
+
"required": false,
|
|
256
|
+
"optional": true,
|
|
257
|
+
"docs": {
|
|
258
|
+
"tags": [],
|
|
259
|
+
"text": "Error message rendered below the input when it is invalid."
|
|
260
|
+
},
|
|
261
|
+
"getter": false,
|
|
262
|
+
"setter": false,
|
|
263
|
+
"reflect": false,
|
|
264
|
+
"attribute": "error-message"
|
|
265
|
+
},
|
|
266
|
+
"invalid": {
|
|
267
|
+
"type": "boolean",
|
|
268
|
+
"mutable": false,
|
|
269
|
+
"complexType": {
|
|
270
|
+
"original": "boolean",
|
|
271
|
+
"resolved": "boolean",
|
|
272
|
+
"references": {}
|
|
273
|
+
},
|
|
274
|
+
"required": false,
|
|
275
|
+
"optional": false,
|
|
276
|
+
"docs": {
|
|
277
|
+
"tags": [],
|
|
278
|
+
"text": "Whether the input is in an invalid state; toggles `aria-invalid` and error styling."
|
|
279
|
+
},
|
|
280
|
+
"getter": false,
|
|
281
|
+
"setter": false,
|
|
282
|
+
"reflect": false,
|
|
283
|
+
"attribute": "invalid",
|
|
284
|
+
"defaultValue": "false"
|
|
203
285
|
}
|
|
204
286
|
};
|
|
205
287
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ch-input.js","sourceRoot":"","sources":["../../../../src/components/ch-input/ch-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAqB,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAEnF,IAAI,QAAQ,GAAG,CAAC,CAAC;AAOjB,MAAM,OAAO,OAAO;IACD,OAAO,GAAG,YAAY,EAAE,QAAQ,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ch-input.js","sourceRoot":"","sources":["../../../../src/components/ch-input/ch-input.tsx"],"names":[],"mappings":"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","sourcesContent":["import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nlet inputIds = 0;\n\n@Component({\n tag: 'ch-input',\n styleUrl: 'ch-input.css',\n shadow: true,\n})\nexport class ChInput {\n private readonly inputId = `ch-input-${++inputIds}`;\n private readonly hintId = `${this.inputId}-hint`;\n private readonly errorId = `${this.inputId}-error`;\n\n /**\n * Visible label rendered above the input and associated with it via\n * `for`/`id`, so assistive technology announces the input's purpose.\n */\n @Prop() label?: string;\n\n /**\n * The type of the input, mirroring the native `<input type>` attribute.\n */\n @Prop() type = 'text';\n\n /**\n * The value of the input.\n */\n @Prop({ mutable: true }) value = '';\n\n /**\n * Placeholder text shown when the input is empty.\n */\n @Prop() placeholder?: string;\n\n /**\n * The name of the input, submitted with form data.\n */\n @Prop() name?: string;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Whether the input is required.\n */\n @Prop() required = false;\n\n /**\n * Helper text rendered below the input, associated via `aria-describedby`.\n * Replaced by `errorMessage` when the input is invalid.\n */\n @Prop() hint?: string;\n\n /**\n * Error message rendered below the input when it is invalid.\n */\n @Prop() errorMessage?: string;\n\n /**\n * Whether the input is in an invalid state; toggles `aria-invalid` and error styling.\n */\n @Prop() invalid = false;\n\n /**\n * Emitted on every keystroke, with the current input value.\n */\n @Event() chInput: EventEmitter<string>;\n\n /**\n * Emitted when the input value is committed (on native `change`).\n */\n @Event() chChange: EventEmitter<string>;\n\n private handleInput = (ev: InputEvent) => {\n this.value = (ev.target as HTMLInputElement).value;\n this.chInput.emit(this.value);\n };\n\n private handleChange = (ev: Event) => {\n this.value = (ev.target as HTMLInputElement).value;\n this.chChange.emit(this.value);\n };\n\n private get describedBy(): string | undefined {\n if (this.invalid && this.errorMessage) {\n return this.errorId;\n }\n if (this.hint) {\n return this.hintId;\n }\n return undefined;\n }\n\n render() {\n return (\n <Host>\n {this.label && (\n <label class=\"label\" htmlFor={this.inputId}>\n {this.label}\n </label>\n )}\n <input\n id={this.label ? this.inputId : undefined}\n class={{ 'input': true, 'input--invalid': this.invalid }}\n type={this.type}\n name={this.name}\n placeholder={this.placeholder}\n disabled={this.disabled}\n required={this.required}\n value={this.value}\n aria-invalid={this.invalid ? 'true' : undefined}\n aria-describedby={this.describedBy}\n onInput={this.handleInput}\n onChange={this.handleChange}\n />\n {this.hint && !(this.invalid && this.errorMessage) && (\n <p class=\"hint\" id={this.hintId}>\n {this.hint}\n </p>\n )}\n {this.invalid && this.errorMessage && (\n <p class=\"error\" id={this.errorId} role=\"alert\">\n {this.errorMessage}\n </p>\n )}\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.group-label {
|
|
6
|
+
display: block;
|
|
7
|
+
margin-bottom: var(--spacing-sm);
|
|
8
|
+
font-size: var(--typography-size-sm);
|
|
9
|
+
font-weight: var(--typography-weight-semibold);
|
|
10
|
+
color: var(--text);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.radio-group {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: var(--spacing-lg);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.control {
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: var(--spacing-lg);
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.control--disabled {
|
|
27
|
+
opacity: var(--opacity-disabled);
|
|
28
|
+
cursor: not-allowed;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.input {
|
|
32
|
+
appearance: none;
|
|
33
|
+
-webkit-appearance: none;
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
width: var(--spacing-4xl);
|
|
39
|
+
height: var(--spacing-4xl);
|
|
40
|
+
margin: 0;
|
|
41
|
+
flex-shrink: 0;
|
|
42
|
+
border: var(--border-width) solid var(--border);
|
|
43
|
+
border-radius: 50%;
|
|
44
|
+
background: var(--surface);
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
transition:
|
|
47
|
+
border-color var(--duration-normal) var(--easing-default),
|
|
48
|
+
box-shadow var(--duration-normal) var(--easing-default);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.input:focus-visible {
|
|
52
|
+
outline: var(--focus-outline-width) solid var(--accent);
|
|
53
|
+
outline-offset: var(--focus-outline-offset);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.input:checked {
|
|
57
|
+
border-color: var(--accent);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.input:checked::before {
|
|
61
|
+
content: '';
|
|
62
|
+
width: var(--spacing-md);
|
|
63
|
+
height: var(--spacing-md);
|
|
64
|
+
border-radius: 50%;
|
|
65
|
+
background: var(--accent);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.input--invalid {
|
|
69
|
+
border-color: var(--color-status-warning);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.input--invalid:focus-visible {
|
|
73
|
+
outline-color: var(--color-status-warning);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.label-text {
|
|
77
|
+
color: var(--text);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.hint,
|
|
81
|
+
.error {
|
|
82
|
+
margin: var(--spacing-sm) 0 0;
|
|
83
|
+
font-size: var(--typography-size-sm);
|
|
84
|
+
color: var(--text-muted);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.error {
|
|
88
|
+
color: var(--color-status-warning);
|
|
89
|
+
}
|