@scouterna/ui-webc 2.2.1 → 2.2.2
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/cjs/{index-CtwQwhfH.js → index-B3fXatmo.js} +9 -3
- package/dist/cjs/index-B3fXatmo.js.map +1 -0
- package/dist/cjs/inputMixin-CkYXihTB.js +67 -0
- package/dist/cjs/inputMixin-CkYXihTB.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/scout-app-bar.cjs.entry.js +1 -1
- package/dist/cjs/scout-bottom-bar-item.cjs.entry.js +1 -1
- package/dist/cjs/scout-bottom-bar.cjs.entry.js +1 -1
- package/dist/cjs/scout-button.cjs.entry.js +5 -4
- package/dist/cjs/scout-button.entry.cjs.js.map +1 -1
- package/dist/cjs/scout-card.cjs.entry.js +3 -3
- package/dist/cjs/scout-card.entry.cjs.js.map +1 -1
- package/dist/cjs/scout-checkbox.scout-radio-button.entry.cjs.js.map +1 -1
- package/dist/cjs/scout-checkbox_2.cjs.entry.js +24 -25
- package/dist/cjs/scout-divider.cjs.entry.js +2 -2
- package/dist/cjs/scout-field.cjs.entry.js +4 -4
- package/dist/cjs/scout-field.entry.cjs.js.map +1 -1
- package/dist/cjs/scout-input.cjs.entry.js +8 -32
- package/dist/cjs/scout-input.entry.cjs.js.map +1 -1
- package/dist/cjs/scout-link.cjs.entry.js +1 -1
- package/dist/cjs/scout-list-view-item.cjs.entry.js +2 -2
- package/dist/cjs/scout-list-view-subheader.cjs.entry.js +2 -2
- package/dist/cjs/scout-list-view.cjs.entry.js +2 -2
- package/dist/cjs/scout-loader.cjs.entry.js +2 -2
- package/dist/cjs/scout-select.cjs.entry.js +8 -32
- package/dist/cjs/scout-select.entry.cjs.js.map +1 -1
- package/dist/cjs/scout-stack.cjs.entry.js +3 -3
- package/dist/cjs/scout-switch.cjs.entry.js +21 -21
- package/dist/cjs/scout-switch.entry.cjs.js.map +1 -1
- package/dist/cjs/ui-webc.cjs.js +2 -2
- package/dist/collection/components/button/button.css +2 -5
- package/dist/collection/components/button/button.js +24 -3
- package/dist/collection/components/button/button.js.map +1 -1
- package/dist/collection/components/card/card.css +4 -0
- package/dist/collection/components/card/card.js +1 -1
- package/dist/collection/components/card/card.js.map +1 -1
- package/dist/collection/components/checkbox/checkbox.js +10 -32
- package/dist/collection/components/checkbox/checkbox.js.map +1 -1
- package/dist/collection/components/divider/divider.js +1 -1
- package/dist/collection/components/field/field.js +13 -7
- package/dist/collection/components/field/field.js.map +1 -1
- package/dist/collection/components/input/input.js +7 -106
- package/dist/collection/components/input/input.js.map +1 -1
- package/dist/collection/components/list-view/list-view.js +1 -1
- package/dist/collection/components/list-view-item/list-view-item.js +1 -1
- package/dist/collection/components/list-view-subheader/list-view-subheader.js +1 -1
- package/dist/collection/components/loader/loader.js +1 -1
- package/dist/collection/components/radio-button/radio-button.js +10 -32
- package/dist/collection/components/radio-button/radio-button.js.map +1 -1
- package/dist/collection/components/select/select.js +7 -106
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/stack/stack.js +2 -2
- package/dist/collection/components/switch/switch.css +8 -7
- package/dist/collection/components/switch/switch.js +20 -42
- package/dist/collection/components/switch/switch.js.map +1 -1
- package/dist/collection/mixins/inputMixin.js +172 -0
- package/dist/collection/mixins/inputMixin.js.map +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/{p-Jt6ZXtWI.js → p-BkrRT31y.js} +16 -16
- package/dist/components/p-BkrRT31y.js.map +1 -0
- package/dist/components/{p-C2uc7k4n.js → p-C2_wl40t.js} +16 -16
- package/dist/components/p-C2_wl40t.js.map +1 -0
- package/dist/components/p-DaGMxK4K.js +62 -0
- package/dist/components/p-DaGMxK4K.js.map +1 -0
- package/dist/components/{p-DNlelzlE.js → p-fr5CaUFu.js} +9 -4
- package/dist/components/p-fr5CaUFu.js.map +1 -0
- package/dist/components/scout-app-bar.js +1 -1
- package/dist/components/scout-bottom-bar-item.js +1 -1
- package/dist/components/scout-bottom-bar.js +1 -1
- package/dist/components/scout-button.js +7 -6
- package/dist/components/scout-button.js.map +1 -1
- package/dist/components/scout-card.js +3 -3
- package/dist/components/scout-card.js.map +1 -1
- package/dist/components/scout-checkbox.js +1 -1
- package/dist/components/scout-divider.js +2 -2
- package/dist/components/scout-field.js +5 -5
- package/dist/components/scout-field.js.map +1 -1
- package/dist/components/scout-input.js +9 -34
- package/dist/components/scout-input.js.map +1 -1
- package/dist/components/scout-link.js +1 -1
- package/dist/components/scout-list-view-item.js +4 -4
- package/dist/components/scout-list-view-subheader.js +2 -2
- package/dist/components/scout-list-view.js +2 -2
- package/dist/components/scout-loader.js +2 -2
- package/dist/components/scout-radio-button.js +1 -1
- package/dist/components/scout-select.js +9 -34
- package/dist/components/scout-select.js.map +1 -1
- package/dist/components/scout-stack.js +3 -3
- package/dist/components/scout-switch.js +22 -22
- package/dist/components/scout-switch.js.map +1 -1
- package/dist/custom-elements.json +393 -24
- package/dist/esm/{index-Cp4mWtfs.js → index-ksA_9NPe.js} +9 -4
- package/dist/esm/index-ksA_9NPe.js.map +1 -0
- package/dist/esm/inputMixin-mAf9ZFOg.js +65 -0
- package/dist/esm/inputMixin-mAf9ZFOg.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/scout-app-bar.entry.js +1 -1
- package/dist/esm/scout-bottom-bar-item.entry.js +1 -1
- package/dist/esm/scout-bottom-bar.entry.js +1 -1
- package/dist/esm/scout-button.entry.js +5 -4
- package/dist/esm/scout-button.entry.js.map +1 -1
- package/dist/esm/scout-card.entry.js +3 -3
- package/dist/esm/scout-card.entry.js.map +1 -1
- package/dist/esm/scout-checkbox.scout-radio-button.entry.js.map +1 -1
- package/dist/esm/scout-checkbox_2.entry.js +24 -25
- package/dist/esm/scout-divider.entry.js +2 -2
- package/dist/esm/scout-field.entry.js +4 -4
- package/dist/esm/scout-field.entry.js.map +1 -1
- package/dist/esm/scout-input.entry.js +8 -32
- package/dist/esm/scout-input.entry.js.map +1 -1
- package/dist/esm/scout-link.entry.js +1 -1
- package/dist/esm/scout-list-view-item.entry.js +2 -2
- package/dist/esm/scout-list-view-subheader.entry.js +2 -2
- package/dist/esm/scout-list-view.entry.js +2 -2
- package/dist/esm/scout-loader.entry.js +2 -2
- package/dist/esm/scout-select.entry.js +8 -32
- package/dist/esm/scout-select.entry.js.map +1 -1
- package/dist/esm/scout-stack.entry.js +3 -3
- package/dist/esm/scout-switch.entry.js +21 -21
- package/dist/esm/scout-switch.entry.js.map +1 -1
- package/dist/esm/ui-webc.js +3 -3
- package/dist/types/components/button/button.d.ts +1 -0
- package/dist/types/components/field/field.d.ts +3 -6
- package/dist/types/components.d.ts +140 -28
- package/dist/ui-webc/p-02c211ea.entry.js +2 -0
- package/dist/ui-webc/p-1a701759.entry.js +2 -0
- package/dist/ui-webc/p-1a701759.entry.js.map +1 -0
- package/dist/ui-webc/{p-5d73566e.entry.js → p-1efd7b9a.entry.js} +2 -2
- package/dist/ui-webc/{p-85e7b20f.entry.js → p-3018f46f.entry.js} +2 -2
- package/dist/ui-webc/p-3e750355.entry.js +2 -0
- package/dist/ui-webc/p-3e750355.entry.js.map +1 -0
- package/dist/ui-webc/p-4616484e.entry.js +2 -0
- package/dist/ui-webc/p-4616484e.entry.js.map +1 -0
- package/dist/ui-webc/p-479ae616.entry.js +2 -0
- package/dist/ui-webc/p-479ae616.entry.js.map +1 -0
- package/dist/ui-webc/{p-9f80fed6.entry.js → p-50112773.entry.js} +2 -2
- package/dist/ui-webc/p-974e8415.entry.js +2 -0
- package/dist/ui-webc/{p-29689fe2.entry.js → p-97956c4f.entry.js} +2 -2
- package/dist/ui-webc/p-97f9cf0a.entry.js +2 -0
- package/dist/ui-webc/p-97f9cf0a.entry.js.map +1 -0
- package/dist/ui-webc/p-BzgciO7w.js +2 -0
- package/dist/ui-webc/p-BzgciO7w.js.map +1 -0
- package/dist/ui-webc/p-ac65f104.entry.js +2 -0
- package/dist/ui-webc/{p-efab02f0.entry.js → p-c2c5857d.entry.js} +2 -2
- package/dist/ui-webc/p-d8084e5c.entry.js +2 -0
- package/dist/ui-webc/p-d8084e5c.entry.js.map +1 -0
- package/dist/ui-webc/p-d999b8d6.entry.js +2 -0
- package/dist/ui-webc/p-d999b8d6.entry.js.map +1 -0
- package/dist/ui-webc/{p-e4070682.entry.js → p-e2288570.entry.js} +2 -2
- package/dist/ui-webc/{p-b8715dc5.entry.js → p-e4f5dad7.entry.js} +2 -2
- package/dist/ui-webc/p-ksA_9NPe.js +3 -0
- package/dist/{esm/index-Cp4mWtfs.js.map → ui-webc/p-ksA_9NPe.js.map} +1 -1
- package/dist/ui-webc/scout-button.entry.esm.js.map +1 -1
- package/dist/ui-webc/scout-card.entry.esm.js.map +1 -1
- package/dist/ui-webc/scout-checkbox.scout-radio-button.entry.esm.js.map +1 -1
- package/dist/ui-webc/scout-field.entry.esm.js.map +1 -1
- package/dist/ui-webc/scout-input.entry.esm.js.map +1 -1
- package/dist/ui-webc/scout-select.entry.esm.js.map +1 -1
- package/dist/ui-webc/scout-switch.entry.esm.js.map +1 -1
- package/dist/ui-webc/ui-webc.css +2 -2
- package/dist/ui-webc/ui-webc.esm.js +1 -1
- package/package.json +2 -2
- package/dist/cjs/index-CtwQwhfH.js.map +0 -1
- package/dist/components/p-C2uc7k4n.js.map +0 -1
- package/dist/components/p-DNlelzlE.js.map +0 -1
- package/dist/components/p-Jt6ZXtWI.js.map +0 -1
- package/dist/types/components/checkbox/checkbox.d.ts +0 -24
- package/dist/types/components/input/input.d.ts +0 -48
- package/dist/types/components/radio-button/radio-button.d.ts +0 -24
- package/dist/types/components/select/select.d.ts +0 -32
- package/dist/types/components/switch/switch.d.ts +0 -25
- package/dist/ui-webc/p-0b42e59f.entry.js +0 -2
- package/dist/ui-webc/p-0b42e59f.entry.js.map +0 -1
- package/dist/ui-webc/p-33010b09.entry.js +0 -2
- package/dist/ui-webc/p-3b426423.entry.js +0 -2
- package/dist/ui-webc/p-3b426423.entry.js.map +0 -1
- package/dist/ui-webc/p-3e34c267.entry.js +0 -2
- package/dist/ui-webc/p-4c70c251.entry.js +0 -2
- package/dist/ui-webc/p-4c70c251.entry.js.map +0 -1
- package/dist/ui-webc/p-6ef8c777.entry.js +0 -2
- package/dist/ui-webc/p-6ef8c777.entry.js.map +0 -1
- package/dist/ui-webc/p-714363c8.entry.js +0 -2
- package/dist/ui-webc/p-714363c8.entry.js.map +0 -1
- package/dist/ui-webc/p-7f8dc0da.entry.js +0 -2
- package/dist/ui-webc/p-7f8dc0da.entry.js.map +0 -1
- package/dist/ui-webc/p-93ee0d2c.entry.js +0 -2
- package/dist/ui-webc/p-Cp4mWtfs.js +0 -3
- package/dist/ui-webc/p-Cp4mWtfs.js.map +0 -1
- package/dist/ui-webc/p-afa38195.entry.js +0 -2
- package/dist/ui-webc/p-afa38195.entry.js.map +0 -1
- /package/dist/ui-webc/{p-93ee0d2c.entry.js.map → p-02c211ea.entry.js.map} +0 -0
- /package/dist/ui-webc/{p-5d73566e.entry.js.map → p-1efd7b9a.entry.js.map} +0 -0
- /package/dist/ui-webc/{p-85e7b20f.entry.js.map → p-3018f46f.entry.js.map} +0 -0
- /package/dist/ui-webc/{p-9f80fed6.entry.js.map → p-50112773.entry.js.map} +0 -0
- /package/dist/ui-webc/{p-33010b09.entry.js.map → p-974e8415.entry.js.map} +0 -0
- /package/dist/ui-webc/{p-29689fe2.entry.js.map → p-97956c4f.entry.js.map} +0 -0
- /package/dist/ui-webc/{p-3e34c267.entry.js.map → p-ac65f104.entry.js.map} +0 -0
- /package/dist/ui-webc/{p-efab02f0.entry.js.map → p-c2c5857d.entry.js.map} +0 -0
- /package/dist/ui-webc/{p-e4070682.entry.js.map → p-e2288570.entry.js.map} +0 -0
- /package/dist/ui-webc/{p-b8715dc5.entry.js.map → p-e4f5dad7.entry.js.map} +0 -0
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { h, } from "@stencil/core";
|
|
2
|
-
|
|
1
|
+
import { h, Mixin, } from "@stencil/core";
|
|
2
|
+
import { inputMixin } from "../../mixins/inputMixin";
|
|
3
|
+
export class ScoutInput extends Mixin(inputMixin) {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
}
|
|
3
7
|
/**
|
|
4
8
|
* Type of input element. If you need a number input, read the accessibility
|
|
5
9
|
* section of this MDN article first:
|
|
@@ -24,36 +28,8 @@ export class ScoutInput {
|
|
|
24
28
|
* from tab order and are not validated.
|
|
25
29
|
*/
|
|
26
30
|
disabled = false;
|
|
27
|
-
/**
|
|
28
|
-
* Custom validation function run on top of the implicit validation performed
|
|
29
|
-
* by the browser. Return a string with the validation message to mark the
|
|
30
|
-
* input as invalid, or null to mark it as valid.
|
|
31
|
-
*/
|
|
32
|
-
validate;
|
|
33
|
-
scoutInputChange;
|
|
34
|
-
scoutBlur;
|
|
35
|
-
/**
|
|
36
|
-
* Internal event used for form field association.
|
|
37
|
-
*/
|
|
38
|
-
_fieldId;
|
|
39
|
-
ariaId;
|
|
40
|
-
componentWillLoad() {
|
|
41
|
-
this.ariaId = `_${Math.random().toString(36).substring(2, 9)}`;
|
|
42
|
-
this._fieldId.emit(this.ariaId);
|
|
43
|
-
}
|
|
44
|
-
onInput(event) {
|
|
45
|
-
const input = event.target;
|
|
46
|
-
if (this.validate) {
|
|
47
|
-
const validationMessage = this.validate(input.value);
|
|
48
|
-
input.setCustomValidity(validationMessage ?? "");
|
|
49
|
-
}
|
|
50
|
-
this.scoutInputChange.emit({
|
|
51
|
-
value: input.value,
|
|
52
|
-
element: input,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
31
|
render() {
|
|
56
|
-
return (h("input", { key: '
|
|
32
|
+
return (h("input", { key: '15b07e42a3bd97ccc5bfb2d35c97db4a63aa98b9', ref: (el) => this.setInputRef(el), id: this.ariaId, type: this.type, name: this.name, inputMode: this.inputmode, pattern: this.pattern, class: "input", value: this.value, disabled: this.disabled, onInput: () => this.onInput(), onBlur: () => this.onBlur(), onInvalid: () => this.onInvalid() }));
|
|
57
33
|
}
|
|
58
34
|
static get is() { return "scout-input"; }
|
|
59
35
|
static get encapsulation() { return "scoped"; }
|
|
@@ -197,83 +173,8 @@ export class ScoutInput {
|
|
|
197
173
|
"reflect": false,
|
|
198
174
|
"attribute": "disabled",
|
|
199
175
|
"defaultValue": "false"
|
|
200
|
-
},
|
|
201
|
-
"validate": {
|
|
202
|
-
"type": "unknown",
|
|
203
|
-
"mutable": false,
|
|
204
|
-
"complexType": {
|
|
205
|
-
"original": "(value: string) => string | null",
|
|
206
|
-
"resolved": "(value: string) => string",
|
|
207
|
-
"references": {}
|
|
208
|
-
},
|
|
209
|
-
"required": false,
|
|
210
|
-
"optional": true,
|
|
211
|
-
"docs": {
|
|
212
|
-
"tags": [],
|
|
213
|
-
"text": "Custom validation function run on top of the implicit validation performed\nby the browser. Return a string with the validation message to mark the\ninput as invalid, or null to mark it as valid."
|
|
214
|
-
},
|
|
215
|
-
"getter": false,
|
|
216
|
-
"setter": false
|
|
217
176
|
}
|
|
218
177
|
};
|
|
219
178
|
}
|
|
220
|
-
static get states() {
|
|
221
|
-
return {
|
|
222
|
-
"ariaId": {}
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
static get events() {
|
|
226
|
-
return [{
|
|
227
|
-
"method": "scoutInputChange",
|
|
228
|
-
"name": "scoutInputChange",
|
|
229
|
-
"bubbles": true,
|
|
230
|
-
"cancelable": true,
|
|
231
|
-
"composed": true,
|
|
232
|
-
"docs": {
|
|
233
|
-
"tags": [],
|
|
234
|
-
"text": ""
|
|
235
|
-
},
|
|
236
|
-
"complexType": {
|
|
237
|
-
"original": "{\n value: string;\n element: HTMLInputElement;\n }",
|
|
238
|
-
"resolved": "{ value: string; element: HTMLInputElement; }",
|
|
239
|
-
"references": {
|
|
240
|
-
"HTMLInputElement": {
|
|
241
|
-
"location": "global",
|
|
242
|
-
"id": "global::HTMLInputElement"
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}, {
|
|
247
|
-
"method": "scoutBlur",
|
|
248
|
-
"name": "scoutBlur",
|
|
249
|
-
"bubbles": true,
|
|
250
|
-
"cancelable": true,
|
|
251
|
-
"composed": true,
|
|
252
|
-
"docs": {
|
|
253
|
-
"tags": [],
|
|
254
|
-
"text": ""
|
|
255
|
-
},
|
|
256
|
-
"complexType": {
|
|
257
|
-
"original": "void",
|
|
258
|
-
"resolved": "void",
|
|
259
|
-
"references": {}
|
|
260
|
-
}
|
|
261
|
-
}, {
|
|
262
|
-
"method": "_fieldId",
|
|
263
|
-
"name": "_fieldId",
|
|
264
|
-
"bubbles": true,
|
|
265
|
-
"cancelable": true,
|
|
266
|
-
"composed": true,
|
|
267
|
-
"docs": {
|
|
268
|
-
"tags": [],
|
|
269
|
-
"text": "Internal event used for form field association."
|
|
270
|
-
},
|
|
271
|
-
"complexType": {
|
|
272
|
-
"original": "string",
|
|
273
|
-
"resolved": "string",
|
|
274
|
-
"references": {}
|
|
275
|
-
}
|
|
276
|
-
}];
|
|
277
|
-
}
|
|
278
179
|
}
|
|
279
180
|
//# sourceMappingURL=input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,CAAC,EACD,KAAK,EACL,IAAI,GACL,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AA6BrD,MAAM,OAAO,UACX,SAAQ,KAAK,CAAC,UAAU,CAAC;;;;IAGzB;;;;OAIG;IACK,IAAI,GAAc,MAAM,CAAC;IAEjC;;OAEG;IACK,SAAS,CAAa;IAE9B;;OAEG;IACK,OAAO,CAAU;IAEzB;;OAEG;IACK,KAAK,GAAW,EAAE,CAAC;IAEnB,IAAI,CAAS;IAErB;;;OAGG;IACK,QAAQ,GAAY,KAAK,CAAC;IAElC,MAAM;QACJ,OAAO,CACL,8DACE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,EACjC,EAAE,EAAE,IAAI,CAAC,MAAM,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,KAAK,EAAC,OAAO,EACb,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAC7B,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,EAC3B,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,GACjC,CACH,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n type ComponentInterface,\n h,\n Mixin,\n Prop,\n} from \"@stencil/core\";\nimport { inputMixin } from \"../../mixins/inputMixin\";\n\nexport type InputType =\n | \"text\"\n | \"password\"\n | \"email\"\n | \"number\"\n | \"tel\"\n | \"url\"\n // Hack to suggest above value but still allow any other string value\n | (string & {});\n\nexport type InputMode =\n | \"none\"\n | \"text\"\n | \"decimal\"\n | \"numeric\"\n | \"tel\"\n | \"search\"\n | \"email\"\n | \"url\"\n // Hack to suggest above value but still allow any other string value\n | (string & {});\n\n@Component({\n tag: \"scout-input\",\n styleUrl: \"input.css\",\n scoped: true,\n})\nexport class ScoutInput\n extends Mixin(inputMixin)\n implements ComponentInterface\n{\n /**\n * Type of input element. If you need a number input, read the accessibility\n * section of this MDN article first:\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/number#accessibility\n */\n @Prop() type: InputType = \"text\";\n\n /**\n * Input mode hints for devices with dynamic keyboards.\n */\n @Prop() inputmode?: InputMode;\n\n /**\n * Regex pattern for input validation.\n */\n @Prop() pattern?: string;\n\n /**\n * Value of the input element, in case you want to control it yourself.\n */\n @Prop() value: string = \"\";\n\n @Prop() name: string;\n\n /**\n * Whether the input is disabled. Disabled inputs are not editable, excluded\n * from tab order and are not validated.\n */\n @Prop() disabled: boolean = false;\n\n render() {\n return (\n <input\n ref={(el) => this.setInputRef(el)}\n id={this.ariaId}\n type={this.type}\n name={this.name}\n inputMode={this.inputmode}\n pattern={this.pattern}\n class=\"input\"\n value={this.value}\n disabled={this.disabled}\n onInput={() => this.onInput()}\n onBlur={() => this.onBlur()}\n onInvalid={() => this.onInvalid()}\n />\n );\n }\n}\n"]}
|
|
@@ -21,7 +21,7 @@ export class ScoutListView {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
|
-
return (h(Host, { key: '
|
|
24
|
+
return (h(Host, { key: '4364bb39e10f23da20440461fea6a8d7a3274bcc', role: "list" }, h("slot", { key: '34f7de708ef874254477b8b82e54cad78db0da6c' })));
|
|
25
25
|
}
|
|
26
26
|
static get is() { return "scout-list-view"; }
|
|
27
27
|
static get encapsulation() { return "shadow"; }
|
|
@@ -26,7 +26,7 @@ export class ScoutListViewItem {
|
|
|
26
26
|
(this.target === "_blank" ? "noopener noreferrer" : undefined),
|
|
27
27
|
}
|
|
28
28
|
: {};
|
|
29
|
-
return (h(Host, { key: '
|
|
29
|
+
return (h(Host, { key: '413bfec2ce5b069cb065b25e6a388b87d9bf972d', role: "listitem" }, h(Tag, { key: '8bd4978a887d2769bf537d7cf74fc02772055144', class: "button", ...linkProps, onClick: () => this.scoutClick.emit() }, this.getPrefix(), this.getContent(), this.getSuffix())));
|
|
30
30
|
}
|
|
31
31
|
getPrefix() {
|
|
32
32
|
if (!this.icon) {
|
|
@@ -3,7 +3,7 @@ export class ScoutListViewSubheader {
|
|
|
3
3
|
text;
|
|
4
4
|
headingLevel = "h2";
|
|
5
5
|
render() {
|
|
6
|
-
return (h(Host, { key: '
|
|
6
|
+
return (h(Host, { key: '5ff0f60b511992241c5dacc25bd2ede127180da5', role: "listitem" }, h(this.headingLevel, { key: 'e857ca6fd07f98e379ade3efab9b7638a69ef184', class: "heading" }, this.text)));
|
|
7
7
|
}
|
|
8
8
|
static get is() { return "scout-list-view-subheader"; }
|
|
9
9
|
static get encapsulation() { return "shadow"; }
|
|
@@ -22,7 +22,7 @@ export class ScoutLoader {
|
|
|
22
22
|
this.showElement(this.symbolElements[0]);
|
|
23
23
|
}
|
|
24
24
|
render() {
|
|
25
|
-
return (h(Host, { key: '
|
|
25
|
+
return (h(Host, { key: 'cb49f1cfa8fcf2b816da9442270724f90b5aa724', class: this.size === "base" ? "" : this.size }, h("div", { key: '9ce230b2839d37172359d3642dcd1ec87471d870', class: "frame" }, this.getSymbols()), this.text && h("div", { key: 'f79e4f64ad2ee471a39c49dc2237a8f7173bbeaf', class: "text" }, this.text)));
|
|
26
26
|
}
|
|
27
27
|
showElement(el) {
|
|
28
28
|
el.classList.remove("animate-out");
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { h, } from "@stencil/core";
|
|
2
|
-
|
|
1
|
+
import { h, Mixin, } from "@stencil/core";
|
|
2
|
+
import { inputMixin } from "../../mixins/inputMixin";
|
|
3
|
+
export class ScoutRadioButton extends Mixin(inputMixin) {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
}
|
|
3
7
|
checked = false;
|
|
4
8
|
disabled = false;
|
|
5
9
|
/**
|
|
@@ -9,16 +13,7 @@ export class ScoutRadioButton {
|
|
|
9
13
|
label;
|
|
10
14
|
value;
|
|
11
15
|
name;
|
|
12
|
-
ariaId;
|
|
13
16
|
scoutChecked;
|
|
14
|
-
/**
|
|
15
|
-
* Internal event used for form field association.
|
|
16
|
-
*/
|
|
17
|
-
_fieldId;
|
|
18
|
-
componentWillLoad() {
|
|
19
|
-
this.ariaId = `_${Math.random().toString(36).substring(2, 9)}`;
|
|
20
|
-
this._fieldId.emit(this.ariaId);
|
|
21
|
-
}
|
|
22
17
|
onChange(event) {
|
|
23
18
|
const radio = event.target;
|
|
24
19
|
this.scoutChecked.emit({
|
|
@@ -28,7 +23,10 @@ export class ScoutRadioButton {
|
|
|
28
23
|
}
|
|
29
24
|
render() {
|
|
30
25
|
const Tag = this.label?.length ? "label" : "div";
|
|
31
|
-
return (h(Tag, { key: '
|
|
26
|
+
return (h(Tag, { key: '0ce220559e5097e536928a27273f683600ee305b' }, h("input", { key: 'cb844c7a4751184aa253f73fca67211049f19a01', ref: (el) => this.setInputRef(el), id: this.ariaId, type: "radio", value: this.value, name: this.name, class: "radio", "aria-labelledby": this.ariaLabelledby, "aria-disabled": this.disabled, disabled: this.disabled, checked: this.checked, onChange: (event) => {
|
|
27
|
+
this.onInput();
|
|
28
|
+
this.onChange(event);
|
|
29
|
+
}, onBlur: () => this.onBlur(), onInvalid: () => this.onInvalid() }), this.label));
|
|
32
30
|
}
|
|
33
31
|
static get is() { return "scout-radio-button"; }
|
|
34
32
|
static get encapsulation() { return "scoped"; }
|
|
@@ -162,11 +160,6 @@ export class ScoutRadioButton {
|
|
|
162
160
|
}
|
|
163
161
|
};
|
|
164
162
|
}
|
|
165
|
-
static get states() {
|
|
166
|
-
return {
|
|
167
|
-
"ariaId": {}
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
163
|
static get events() {
|
|
171
164
|
return [{
|
|
172
165
|
"method": "scoutChecked",
|
|
@@ -188,21 +181,6 @@ export class ScoutRadioButton {
|
|
|
188
181
|
}
|
|
189
182
|
}
|
|
190
183
|
}
|
|
191
|
-
}, {
|
|
192
|
-
"method": "_fieldId",
|
|
193
|
-
"name": "_fieldId",
|
|
194
|
-
"bubbles": true,
|
|
195
|
-
"cancelable": true,
|
|
196
|
-
"composed": true,
|
|
197
|
-
"docs": {
|
|
198
|
-
"tags": [],
|
|
199
|
-
"text": "Internal event used for form field association."
|
|
200
|
-
},
|
|
201
|
-
"complexType": {
|
|
202
|
-
"original": "string",
|
|
203
|
-
"resolved": "string",
|
|
204
|
-
"references": {}
|
|
205
|
-
}
|
|
206
184
|
}];
|
|
207
185
|
}
|
|
208
186
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-button.js","sourceRoot":"","sources":["../../../src/components/radio-button/radio-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,
|
|
1
|
+
{"version":3,"file":"radio-button.js","sourceRoot":"","sources":["../../../src/components/radio-button/radio-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,KAAK,EAEL,CAAC,EACD,KAAK,EACL,IAAI,GACL,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAOrD,MAAM,OAAO,gBACX,SAAQ,KAAK,CAAC,UAAU,CAAC;;;;IAGjB,OAAO,GAAY,KAAK,CAAC;IAEzB,QAAQ,GAAY,KAAK,CAAC;IAElC;;OAEG;IACK,cAAc,CAAS;IAEvB,KAAK,CAAS;IAEd,KAAK,CAAS;IAEd,IAAI,CAAS;IAEZ,YAAY,CAGlB;IAEH,QAAQ,CAAC,KAAY;QACnB,MAAM,KAAK,GAAG,KAAK,CAAC,MAA0B,CAAC;QAE/C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;YACrB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;IACL,CAAC;IAED,MAAM;QACJ,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;QACjD,OAAO,CACL,EAAC,GAAG;YACF,8DACE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,EACjC,EAAE,EAAE,IAAI,CAAC,MAAM,EACf,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAC,OAAO,qBACI,IAAI,CAAC,cAAc,mBACrB,IAAI,CAAC,QAAQ,EAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oBAClB,IAAI,CAAC,OAAO,EAAE,CAAC;oBACf,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACvB,CAAC,EACD,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,EAC3B,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,GACjC;YACD,IAAI,CAAC,KAAK,CACP,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n type ComponentInterface,\n Event,\n type EventEmitter,\n h,\n Mixin,\n Prop,\n} from \"@stencil/core\";\nimport { inputMixin } from \"../../mixins/inputMixin\";\n\n@Component({\n tag: \"scout-radio-button\",\n styleUrl: \"radio-button.css\",\n scoped: true,\n})\nexport class ScoutRadioButton\n extends Mixin(inputMixin)\n implements ComponentInterface\n{\n @Prop() checked: boolean = false;\n\n @Prop() disabled: boolean = false;\n\n /**\n * Use this prop if you need to connect your radio button with another element describing its use, other than the property label.\n */\n @Prop() ariaLabelledby: string;\n\n @Prop() label: string;\n\n @Prop() value: string;\n\n @Prop() name: string;\n\n @Event() scoutChecked: EventEmitter<{\n checked: boolean;\n element: HTMLInputElement;\n }>;\n\n onChange(event: Event) {\n const radio = event.target as HTMLInputElement;\n\n this.scoutChecked.emit({\n checked: radio.checked,\n element: radio,\n });\n }\n\n render() {\n const Tag = this.label?.length ? \"label\" : \"div\";\n return (\n <Tag>\n <input\n ref={(el) => this.setInputRef(el)}\n id={this.ariaId}\n type=\"radio\"\n value={this.value}\n name={this.name}\n class=\"radio\"\n aria-labelledby={this.ariaLabelledby}\n aria-disabled={this.disabled}\n disabled={this.disabled}\n checked={this.checked}\n onChange={(event) => {\n this.onInput();\n this.onChange(event);\n }}\n onBlur={() => this.onBlur()}\n onInvalid={() => this.onInvalid()}\n />\n {this.label}\n </Tag>\n );\n }\n}\n"]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { h, } from "@stencil/core";
|
|
1
|
+
import { h, Mixin, } from "@stencil/core";
|
|
2
2
|
import chevronIcon from "@tabler/icons/outline/chevron-down.svg";
|
|
3
|
-
|
|
3
|
+
import { inputMixin } from "../../mixins/inputMixin";
|
|
4
|
+
export class ScoutSelect extends Mixin(inputMixin) {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
}
|
|
4
8
|
/**
|
|
5
9
|
* Value of the select element, in case you want to control it yourself.
|
|
6
10
|
*/
|
|
@@ -11,36 +15,8 @@ export class ScoutSelect {
|
|
|
11
15
|
*/
|
|
12
16
|
disabled = false;
|
|
13
17
|
name;
|
|
14
|
-
/**
|
|
15
|
-
* Custom validation function run on top of the implicit validation performed
|
|
16
|
-
* by the browser. Return a string with the validation message to mark the
|
|
17
|
-
* select as invalid, or null to mark it as valid.
|
|
18
|
-
*/
|
|
19
|
-
validate;
|
|
20
|
-
scoutInputChange;
|
|
21
|
-
scoutBlur;
|
|
22
|
-
/**
|
|
23
|
-
* Internal event used for form field association.
|
|
24
|
-
*/
|
|
25
|
-
_fieldId;
|
|
26
|
-
ariaId;
|
|
27
|
-
componentWillLoad() {
|
|
28
|
-
this.ariaId = `_${Math.random().toString(36).substring(2, 9)}`;
|
|
29
|
-
this._fieldId.emit(this.ariaId);
|
|
30
|
-
}
|
|
31
|
-
onChange(event) {
|
|
32
|
-
const select = event.target;
|
|
33
|
-
if (this.validate) {
|
|
34
|
-
const validationMessage = this.validate(select.value);
|
|
35
|
-
select.setCustomValidity(validationMessage ?? "");
|
|
36
|
-
}
|
|
37
|
-
this.scoutInputChange.emit({
|
|
38
|
-
value: select.value,
|
|
39
|
-
element: select,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
18
|
render() {
|
|
43
|
-
return (h("div", { key: '
|
|
19
|
+
return (h("div", { key: 'df8da542b4f1b6a90c1899ae2ebe3f1c24328d82', class: "select-wrapper" }, h("select", { key: 'ece339ed62a6395c282766f534a0290a25e10f03', id: this.ariaId, name: this.name, class: "select", disabled: this.disabled, onChange: () => this.onInput(), onBlur: () => this.onBlur(), onInvalid: () => this.onInvalid() }, h("slot", { key: '53baa52177e1a72c4b0f40ceda8f5de227958c38' })), h("span", { key: 'b19185c3f2152e3ee4abcab0e61c1a9f17fa2442', class: "select-icon", style: { "--icon-chevron": `url(${chevronIcon})` }, "aria-hidden": "true" })));
|
|
44
20
|
}
|
|
45
21
|
static get is() { return "scout-select"; }
|
|
46
22
|
static get encapsulation() { return "scoped"; }
|
|
@@ -114,83 +90,8 @@ export class ScoutSelect {
|
|
|
114
90
|
"setter": false,
|
|
115
91
|
"reflect": false,
|
|
116
92
|
"attribute": "name"
|
|
117
|
-
},
|
|
118
|
-
"validate": {
|
|
119
|
-
"type": "unknown",
|
|
120
|
-
"mutable": false,
|
|
121
|
-
"complexType": {
|
|
122
|
-
"original": "(value: string) => string | null",
|
|
123
|
-
"resolved": "(value: string) => string",
|
|
124
|
-
"references": {}
|
|
125
|
-
},
|
|
126
|
-
"required": false,
|
|
127
|
-
"optional": true,
|
|
128
|
-
"docs": {
|
|
129
|
-
"tags": [],
|
|
130
|
-
"text": "Custom validation function run on top of the implicit validation performed\nby the browser. Return a string with the validation message to mark the\nselect as invalid, or null to mark it as valid."
|
|
131
|
-
},
|
|
132
|
-
"getter": false,
|
|
133
|
-
"setter": false
|
|
134
93
|
}
|
|
135
94
|
};
|
|
136
95
|
}
|
|
137
|
-
static get states() {
|
|
138
|
-
return {
|
|
139
|
-
"ariaId": {}
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
static get events() {
|
|
143
|
-
return [{
|
|
144
|
-
"method": "scoutInputChange",
|
|
145
|
-
"name": "scoutInputChange",
|
|
146
|
-
"bubbles": true,
|
|
147
|
-
"cancelable": true,
|
|
148
|
-
"composed": true,
|
|
149
|
-
"docs": {
|
|
150
|
-
"tags": [],
|
|
151
|
-
"text": ""
|
|
152
|
-
},
|
|
153
|
-
"complexType": {
|
|
154
|
-
"original": "{\n value: string;\n element: HTMLSelectElement;\n }",
|
|
155
|
-
"resolved": "{ value: string; element: HTMLSelectElement; }",
|
|
156
|
-
"references": {
|
|
157
|
-
"HTMLSelectElement": {
|
|
158
|
-
"location": "global",
|
|
159
|
-
"id": "global::HTMLSelectElement"
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}, {
|
|
164
|
-
"method": "scoutBlur",
|
|
165
|
-
"name": "scoutBlur",
|
|
166
|
-
"bubbles": true,
|
|
167
|
-
"cancelable": true,
|
|
168
|
-
"composed": true,
|
|
169
|
-
"docs": {
|
|
170
|
-
"tags": [],
|
|
171
|
-
"text": ""
|
|
172
|
-
},
|
|
173
|
-
"complexType": {
|
|
174
|
-
"original": "void",
|
|
175
|
-
"resolved": "void",
|
|
176
|
-
"references": {}
|
|
177
|
-
}
|
|
178
|
-
}, {
|
|
179
|
-
"method": "_fieldId",
|
|
180
|
-
"name": "_fieldId",
|
|
181
|
-
"bubbles": true,
|
|
182
|
-
"cancelable": true,
|
|
183
|
-
"composed": true,
|
|
184
|
-
"docs": {
|
|
185
|
-
"tags": [],
|
|
186
|
-
"text": "Internal event used for form field association."
|
|
187
|
-
},
|
|
188
|
-
"complexType": {
|
|
189
|
-
"original": "string",
|
|
190
|
-
"resolved": "string",
|
|
191
|
-
"references": {}
|
|
192
|
-
}
|
|
193
|
-
}];
|
|
194
|
-
}
|
|
195
96
|
}
|
|
196
97
|
//# sourceMappingURL=select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/components/select/select.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/components/select/select.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,CAAC,EACD,KAAK,EACL,IAAI,GACL,MAAM,eAAe,CAAC;AACvB,OAAO,WAAW,MAAM,wCAAwC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAOrD,MAAM,OAAO,WACX,SAAQ,KAAK,CAAC,UAAU,CAAC;;;;IAGzB;;OAEG;IACK,KAAK,GAAW,EAAE,CAAC;IAE3B;;;OAGG;IACK,QAAQ,GAAY,KAAK,CAAC;IAE1B,IAAI,CAAS;IAErB,MAAM;QACJ,OAAO,CACL,4DAAK,KAAK,EAAC,gBAAgB;YACzB,+DACE,EAAE,EAAE,IAAI,CAAC,MAAM,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAC,QAAQ,EACd,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAC9B,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,EAC3B,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE;gBAEjC,8DAAQ,CACD;YACT,6DACE,KAAK,EAAC,aAAa,EACnB,KAAK,EAAE,EAAE,gBAAgB,EAAE,OAAO,WAAW,GAAG,EAAE,iBACtC,MAAM,GAClB,CACE,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n type ComponentInterface,\n h,\n Mixin,\n Prop,\n} from \"@stencil/core\";\nimport chevronIcon from \"@tabler/icons/outline/chevron-down.svg\";\nimport { inputMixin } from \"../../mixins/inputMixin\";\n\n@Component({\n tag: \"scout-select\",\n styleUrl: \"select.css\",\n scoped: true,\n})\nexport class ScoutSelect\n extends Mixin(inputMixin)\n implements ComponentInterface\n{\n /**\n * Value of the select element, in case you want to control it yourself.\n */\n @Prop() value: string = \"\";\n\n /**\n * Whether the select is disabled. Disabled selects are not editable, excluded\n * from tab order and are not validated.\n */\n @Prop() disabled: boolean = false;\n\n @Prop() name: string;\n\n render() {\n return (\n <div class=\"select-wrapper\">\n <select\n id={this.ariaId}\n name={this.name}\n class=\"select\"\n disabled={this.disabled}\n onChange={() => this.onInput()}\n onBlur={() => this.onBlur()}\n onInvalid={() => this.onInvalid()}\n >\n <slot />\n </select>\n <span\n class=\"select-icon\"\n style={{ \"--icon-chevron\": `url(${chevronIcon})` }}\n aria-hidden=\"true\"\n />\n </div>\n );\n }\n}\n"]}
|
|
@@ -18,10 +18,10 @@ export class ScoutStack {
|
|
|
18
18
|
*/
|
|
19
19
|
gapSize = "m";
|
|
20
20
|
render() {
|
|
21
|
-
return (h(Host, { key: '
|
|
21
|
+
return (h(Host, { key: '46f8dfbf3721fe377297d936ea07595e85b933a3', style: {
|
|
22
22
|
"--stack-flex-direction": `${this.direction}`,
|
|
23
23
|
"--stack-gap-spacing": `var(--spacing-${GapSizeValues[this.gapSize]})`,
|
|
24
|
-
} }, h("slot", { key: '
|
|
24
|
+
} }, h("slot", { key: '9d0a64fbc02da0960e96293696e77a7688af7132' })));
|
|
25
25
|
}
|
|
26
26
|
static get is() { return "scout-stack"; }
|
|
27
27
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
.switch {
|
|
2
|
-
width: var(--spacing-
|
|
2
|
+
width: var(--spacing-10);
|
|
3
3
|
height: var(--spacing-6);
|
|
4
4
|
-moz-appearance: none;
|
|
5
5
|
appearance: none;
|
|
6
6
|
-webkit-appearance: none;
|
|
7
7
|
border-radius: var(--spacing-8);
|
|
8
8
|
background-color: var(--color-text-brand-inverse);
|
|
9
|
-
border:
|
|
9
|
+
border: 2px solid var(--color-gray-300);
|
|
10
10
|
position: relative;
|
|
11
11
|
display: flex;
|
|
12
12
|
align-content: center;
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
transition-duration: 0.3s;
|
|
16
16
|
transition-timing-function: ease-in-out;
|
|
17
17
|
cursor: pointer;
|
|
18
|
-
--switch-ball-
|
|
18
|
+
--switch-ball-padding: calc(var(--spacing-1) / 4);
|
|
19
|
+
--switch-ball-size: calc(var(--spacing-5) - var(--switch-ball-padding) * 2);
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
.switch:hover {
|
|
@@ -43,8 +44,8 @@
|
|
|
43
44
|
height: var(--switch-ball-size);
|
|
44
45
|
border-radius: 50%;
|
|
45
46
|
position: absolute;
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
top: var(--switch-ball-padding);
|
|
48
|
+
left: var(--switch-ball-padding);
|
|
48
49
|
transition-duration: 0.3s;
|
|
49
50
|
transition-property: left, right;
|
|
50
51
|
}
|
|
@@ -52,8 +53,8 @@
|
|
|
52
53
|
.switch:checked::before {
|
|
53
54
|
content: "";
|
|
54
55
|
background-color: var(--color-background-brand-base);
|
|
55
|
-
left: calc(100% - (var(--
|
|
56
|
-
left: calc(100% - calc(var(--
|
|
56
|
+
left: calc(100% - (var(--switch-ball-size) + var(--switch-ball-padding)));
|
|
57
|
+
left: calc(100% - calc(var(--switch-ball-size) + var(--switch-ball-padding)));
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
.switch:disabled {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { h, } from "@stencil/core";
|
|
2
|
-
|
|
1
|
+
import { h, Mixin, } from "@stencil/core";
|
|
2
|
+
import { inputMixin } from "../../mixins/inputMixin";
|
|
3
|
+
export class ScoutSwitch extends Mixin(inputMixin) {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
}
|
|
3
7
|
/**
|
|
4
8
|
* Indicates whether the switch is toggled on or off.
|
|
5
9
|
*/
|
|
@@ -10,26 +14,20 @@ export class ScoutSwitch {
|
|
|
10
14
|
*/
|
|
11
15
|
ariaLabelledby;
|
|
12
16
|
label;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
componentWillLoad() {
|
|
20
|
-
this.ariaId = `_${Math.random().toString(36).substring(2, 9)}`;
|
|
21
|
-
this._fieldId.emit(this.ariaId);
|
|
22
|
-
}
|
|
23
|
-
onClick(event) {
|
|
24
|
-
const switchElement = event.target;
|
|
25
|
-
this.scoutSwitchToggled.emit({
|
|
26
|
-
toggled: switchElement.checked,
|
|
27
|
-
element: switchElement,
|
|
17
|
+
scoutChecked;
|
|
18
|
+
onChange(event) {
|
|
19
|
+
const checkbox = event.target;
|
|
20
|
+
this.scoutChecked.emit({
|
|
21
|
+
checked: checkbox.checked,
|
|
22
|
+
element: checkbox,
|
|
28
23
|
});
|
|
29
24
|
}
|
|
30
25
|
render() {
|
|
31
26
|
const Tag = this.label?.length ? "label" : "div";
|
|
32
|
-
return (h(Tag, { key: '
|
|
27
|
+
return (h(Tag, { key: '3df6f0be2cbb14fa4ad4ce777324960365ea5d68' }, this.label, h("span", { key: 'bbf999533051b967807f18f6d165a9b916a87252', class: "inlineDivider" }), h("input", { key: '8280933ed1b9038edcd8fb9bad39bef5745d4403', ref: (el) => this.setInputRef(el), id: this.ariaId, type: "checkbox", class: "switch", "aria-labelledby": this.ariaLabelledby, "aria-disabled": this.disabled, disabled: this.disabled, checked: this.toggled, onChange: (event) => {
|
|
28
|
+
this.onInput();
|
|
29
|
+
this.onChange(event);
|
|
30
|
+
}, onBlur: () => this.onBlur(), onInvalid: () => this.onInvalid() })));
|
|
33
31
|
}
|
|
34
32
|
static get is() { return "scout-switch"; }
|
|
35
33
|
static get encapsulation() { return "shadow"; }
|
|
@@ -126,15 +124,10 @@ export class ScoutSwitch {
|
|
|
126
124
|
}
|
|
127
125
|
};
|
|
128
126
|
}
|
|
129
|
-
static get states() {
|
|
130
|
-
return {
|
|
131
|
-
"ariaId": {}
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
127
|
static get events() {
|
|
135
128
|
return [{
|
|
136
|
-
"method": "
|
|
137
|
-
"name": "
|
|
129
|
+
"method": "scoutChecked",
|
|
130
|
+
"name": "scoutChecked",
|
|
138
131
|
"bubbles": true,
|
|
139
132
|
"cancelable": true,
|
|
140
133
|
"composed": true,
|
|
@@ -143,8 +136,8 @@ export class ScoutSwitch {
|
|
|
143
136
|
"text": ""
|
|
144
137
|
},
|
|
145
138
|
"complexType": {
|
|
146
|
-
"original": "{\n
|
|
147
|
-
"resolved": "{
|
|
139
|
+
"original": "{\n checked: boolean;\n element: HTMLInputElement;\n }",
|
|
140
|
+
"resolved": "{ checked: boolean; element: HTMLInputElement; }",
|
|
148
141
|
"references": {
|
|
149
142
|
"HTMLInputElement": {
|
|
150
143
|
"location": "global",
|
|
@@ -152,21 +145,6 @@ export class ScoutSwitch {
|
|
|
152
145
|
}
|
|
153
146
|
}
|
|
154
147
|
}
|
|
155
|
-
}, {
|
|
156
|
-
"method": "_fieldId",
|
|
157
|
-
"name": "_fieldId",
|
|
158
|
-
"bubbles": true,
|
|
159
|
-
"cancelable": true,
|
|
160
|
-
"composed": true,
|
|
161
|
-
"docs": {
|
|
162
|
-
"tags": [],
|
|
163
|
-
"text": "Internal event used for form field association."
|
|
164
|
-
},
|
|
165
|
-
"complexType": {
|
|
166
|
-
"original": "string",
|
|
167
|
-
"resolved": "string",
|
|
168
|
-
"references": {}
|
|
169
|
-
}
|
|
170
148
|
}];
|
|
171
149
|
}
|
|
172
150
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/components/switch/switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,
|
|
1
|
+
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/components/switch/switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,KAAK,EAEL,CAAC,EACD,KAAK,EACL,IAAI,GACL,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AASrD,MAAM,OAAO,WACX,SAAQ,KAAK,CAAC,UAAU,CAAC;;;;IAGzB;;OAEG;IACK,OAAO,GAAY,KAAK,CAAC;IAEzB,QAAQ,GAAY,KAAK,CAAC;IAElC;;OAEG;IACK,cAAc,CAAS;IAEvB,KAAK,CAAS;IAEb,YAAY,CAGlB;IAEH,QAAQ,CAAC,KAAY;QACnB,MAAM,QAAQ,GAAG,KAAK,CAAC,MAA0B,CAAC;QAElD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;YACrB,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,OAAO,EAAE,QAAQ;SAClB,CAAC,CAAC;IACL,CAAC;IAED,MAAM;QACJ,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;QACjD,OAAO,CACL,EAAC,GAAG;YACD,IAAI,CAAC,KAAK;YACX,6DAAM,KAAK,EAAC,eAAe,GAAQ;YACnC,8DACE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,EACjC,EAAE,EAAE,IAAI,CAAC,MAAM,EACf,IAAI,EAAC,UAAU,EACf,KAAK,EAAC,QAAQ,qBACG,IAAI,CAAC,cAAc,mBACrB,IAAI,CAAC,QAAQ,EAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oBAClB,IAAI,CAAC,OAAO,EAAE,CAAC;oBACf,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACvB,CAAC,EACD,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,EAC3B,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,GACjC,CACE,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n type ComponentInterface,\n Event,\n type EventEmitter,\n h,\n Mixin,\n Prop,\n} from \"@stencil/core\";\nimport { inputMixin } from \"../../mixins/inputMixin\";\n\n@Component({\n tag: \"scout-switch\",\n styleUrl: \"switch.css\",\n shadow: {\n delegatesFocus: true,\n },\n})\nexport class ScoutSwitch\n extends Mixin(inputMixin)\n implements ComponentInterface\n{\n /**\n * Indicates whether the switch is toggled on or off.\n */\n @Prop() toggled: boolean = false;\n\n @Prop() disabled: boolean = false;\n\n /**\n * Use this prop if you need to connect your switch with another element describing its use, other than the property label.\n */\n @Prop() ariaLabelledby: string;\n\n @Prop() label: string;\n\n @Event() scoutChecked: EventEmitter<{\n checked: boolean;\n element: HTMLInputElement;\n }>;\n\n onChange(event: Event) {\n const checkbox = event.target as HTMLInputElement;\n\n this.scoutChecked.emit({\n checked: checkbox.checked,\n element: checkbox,\n });\n }\n\n render() {\n const Tag = this.label?.length ? \"label\" : \"div\";\n return (\n <Tag>\n {this.label}\n <span class=\"inlineDivider\"></span>\n <input\n ref={(el) => this.setInputRef(el)}\n id={this.ariaId}\n type=\"checkbox\"\n class=\"switch\"\n aria-labelledby={this.ariaLabelledby}\n aria-disabled={this.disabled}\n disabled={this.disabled}\n checked={this.toggled}\n onChange={(event) => {\n this.onInput();\n this.onChange(event);\n }}\n onBlur={() => this.onBlur()}\n onInvalid={() => this.onInvalid()}\n />\n </Tag>\n );\n }\n}\n"]}
|