@uh-design-system/component-library 0.4.1 → 0.5.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/cjs/component-library.cjs.js +3 -3
- package/dist/cjs/ds-accordion_3.cjs.entry.js +10 -10
- package/dist/cjs/ds-checkbox-group.cjs.entry.js +16 -17
- package/dist/cjs/ds-checkbox.cjs.entry.js +42 -35
- package/dist/cjs/ds-input-validity.cjs.entry.js +4 -6
- package/dist/cjs/ds-link-with-arrow.cjs.entry.js +5 -5
- package/dist/cjs/ds-link.cjs.entry.js +5 -5
- package/dist/cjs/ds-text-input.cjs.entry.js +51 -23
- package/dist/cjs/ds-visually-hidden.cjs.entry.js +2 -2
- package/dist/cjs/{index-b1d61146.js → index-bf84b124.js} +237 -134
- package/dist/cjs/index.cjs.js +8 -0
- package/dist/cjs/{linkUtils-e911e899.js → linkUtils-695da37c.js} +0 -10
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/store-9bd20f3c.js +207 -0
- package/dist/cjs/{utils-c9113835.js → utils-2ba5e075.js} +10 -0
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/00-foundations/types.js +1 -0
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +6 -6
- package/dist/collection/components/01-base-components/ds-button/ds-button.js +1 -1
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.css +1 -172
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.js +68 -56
- package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.stories.js +1 -0
- package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.css +1 -1
- package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.js +27 -67
- package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +1 -1
- package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js +6 -9
- package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.js +1 -0
- package/dist/collection/components/01-base-components/ds-link/ds-link.css +0 -138
- package/dist/collection/components/01-base-components/ds-link/ds-link.js +4 -4
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +4 -1
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +0 -138
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +4 -4
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-link-with-arrow.stories.js +4 -1
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +73 -27
- package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.js +82 -13
- package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.stories.js +6 -7
- package/dist/collection/components/01-base-components/ds-text-input/utils.js +1 -10
- package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
- package/dist/collection/index.js +1 -1
- package/dist/collection/store.js +13 -0
- package/dist/collection/utils/link/linkUtils.js +0 -9
- package/dist/collection/utils/utils.js +9 -0
- package/dist/component-library/component-library.esm.js +1 -1
- package/dist/component-library/ds-accordion_3.entry.js +1 -1
- package/dist/component-library/ds-checkbox-group.entry.js +1 -1
- package/dist/component-library/ds-checkbox.entry.js +1 -1
- package/dist/component-library/ds-input-validity.entry.js +1 -1
- package/dist/component-library/ds-link-with-arrow.entry.js +1 -1
- package/dist/component-library/ds-link.entry.js +1 -1
- package/dist/component-library/ds-text-input.entry.js +1 -1
- package/dist/component-library/ds-visually-hidden.entry.js +1 -1
- package/dist/component-library/index-434995e1.js +2 -0
- package/dist/component-library/index.esm.js +1 -0
- package/dist/component-library/{linkUtils-fe63ff72.js → linkUtils-3d1b28cf.js} +1 -1
- package/dist/component-library/store-b8d17c10.js +1 -0
- package/dist/component-library/utils-5daa5bc0.js +1 -0
- package/dist/components/ds-accordion.js +6 -6
- package/dist/components/ds-button2.js +1 -1
- package/dist/components/ds-checkbox-group.js +22 -24
- package/dist/components/ds-checkbox2.js +44 -37
- package/dist/components/ds-icon2.js +11 -2
- package/dist/components/ds-input-validity2.js +5 -7
- package/dist/components/ds-link-with-arrow.js +4 -4
- package/dist/components/ds-link.js +4 -4
- package/dist/components/ds-text-input.js +57 -28
- package/dist/components/ds-visually-hidden2.js +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index2.js +218 -136
- package/dist/components/linkUtils.js +1 -10
- package/dist/components/store.js +204 -0
- package/dist/esm/component-library.js +4 -4
- package/dist/esm/ds-accordion_3.entry.js +10 -10
- package/dist/esm/ds-checkbox-group.entry.js +16 -17
- package/dist/esm/ds-checkbox.entry.js +42 -35
- package/dist/esm/ds-input-validity.entry.js +4 -6
- package/dist/esm/ds-link-with-arrow.entry.js +5 -5
- package/dist/esm/ds-link.entry.js +5 -5
- package/dist/esm/ds-text-input.entry.js +51 -23
- package/dist/esm/ds-visually-hidden.entry.js +2 -2
- package/dist/esm/{index-aaccd233.js → index-434995e1.js} +236 -135
- package/dist/esm/index.js +2 -1
- package/dist/esm/{linkUtils-fe63ff72.js → linkUtils-3d1b28cf.js} +1 -10
- package/dist/esm/loader.js +3 -3
- package/dist/esm/store-b8d17c10.js +204 -0
- package/dist/esm/{utils-b5843ae1.js → utils-5daa5bc0.js} +10 -1
- package/dist/types/components/00-foundations/types.d.ts +3 -0
- package/dist/types/components/01-base-components/ds-checkbox/ds-checkbox.d.ts +14 -14
- package/dist/types/components/01-base-components/ds-checkbox-group/ds-checkbox-group.d.ts +14 -16
- package/dist/types/components/01-base-components/ds-input-validity/ds-input-validity.d.ts +1 -1
- package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +1 -1
- package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +1 -1
- package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +17 -8
- package/dist/types/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.d.ts +1 -0
- package/dist/types/components/01-base-components/ds-text-input/utils.d.ts +1 -1
- package/dist/types/components.d.ts +42 -28
- package/dist/types/index.d.ts +1 -0
- package/dist/types/store.d.ts +10 -0
- package/dist/types/utils/link/linkUtils.d.ts +0 -1
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +19 -18
- package/dist/component-library/index-aaccd233.js +0 -2
- package/dist/component-library/utils-b5843ae1.js +0 -1
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { Fragment, h } from "@stencil/core";
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { inheritAriaAttributes } from "../../../utils/attributes/attributes";
|
|
4
|
-
import { idGenerator } from "../../../utils/utils";
|
|
5
4
|
import { getOptionalText, getRequiredText } from "../../../utils/controls/controlUtils";
|
|
5
|
+
import { isValidation } from "../../../store";
|
|
6
|
+
import { getAriaLabel, idGenerator } from "../../../utils/utils";
|
|
6
7
|
const checkboxIdGenerator = idGenerator('ds-checkbox');
|
|
7
8
|
export class DsCheckbox {
|
|
9
|
+
inputElem;
|
|
8
10
|
labelId;
|
|
9
|
-
|
|
11
|
+
inputValidityId;
|
|
10
12
|
assistiveTextId;
|
|
11
13
|
inheritedAttributes = {};
|
|
12
14
|
initialChecked;
|
|
13
|
-
|
|
15
|
+
labelClicked = false;
|
|
14
16
|
el;
|
|
15
17
|
internals;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
checkboxId;
|
|
18
|
+
dsCheckboxInput;
|
|
19
|
+
identifier = checkboxIdGenerator.next().value;
|
|
19
20
|
checked = false;
|
|
20
21
|
legend;
|
|
21
22
|
assistiveText;
|
|
@@ -31,12 +32,11 @@ export class DsCheckbox {
|
|
|
31
32
|
value = this.checked.toString();
|
|
32
33
|
validationMessage;
|
|
33
34
|
setIds = () => {
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
this.assistiveTextId = `${this.checkboxId}-assistive-text`;
|
|
35
|
+
this.labelId = `${this.identifier}-label`;
|
|
36
|
+
this.inputValidityId = `${this.identifier}-validity`;
|
|
37
|
+
this.assistiveTextId = `${this.identifier}-assistive-text`;
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
getValidationMessage = () => (!this.errorsDisabled ? this.errorText || this.internals?.validationMessage || this.inputElem?.validationMessage : '');
|
|
40
40
|
getLegendText = () => {
|
|
41
41
|
if (this.required) {
|
|
42
42
|
return getRequiredText(this.legend);
|
|
@@ -58,7 +58,7 @@ export class DsCheckbox {
|
|
|
58
58
|
}
|
|
59
59
|
return this.text;
|
|
60
60
|
};
|
|
61
|
-
getAriaDescribedBy = () => [Boolean(this.assistiveText) && this.assistiveTextId, Boolean(this.
|
|
61
|
+
getAriaDescribedBy = () => [Boolean(this.assistiveText) && this.assistiveTextId, Boolean(this.getValidationMessage()) && this.inputValidityId].filter(Boolean).join(' ');
|
|
62
62
|
restoreInitialState = () => {
|
|
63
63
|
this.checked = this.initialChecked;
|
|
64
64
|
this.value = this.checked.toString();
|
|
@@ -70,34 +70,43 @@ export class DsCheckbox {
|
|
|
70
70
|
this.value = this.checked.toString();
|
|
71
71
|
this.internals?.setFormValue(this.value);
|
|
72
72
|
};
|
|
73
|
-
emitCheckboxError = () => {
|
|
74
|
-
this.dsCheckboxError.emit(this.getErrorText());
|
|
75
|
-
};
|
|
76
73
|
formResetCallback() {
|
|
77
74
|
this.restoreInitialState();
|
|
78
75
|
}
|
|
79
76
|
componentWillLoad() {
|
|
80
77
|
this.setInitialState();
|
|
81
78
|
this.setIds();
|
|
82
|
-
this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-label', 'aria-describedby', 'aria-hidden']);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this.el.removeAttribute('aria-label');
|
|
87
|
-
}
|
|
88
|
-
componentDidUpdate() {
|
|
89
|
-
this.emitCheckboxError();
|
|
79
|
+
this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-label', 'aria-describedby', 'aria-hidden', 'aria-invalid']);
|
|
80
|
+
if (isValidation('server') || this.errorText) {
|
|
81
|
+
this.validationMessage = this.getValidationMessage();
|
|
82
|
+
}
|
|
90
83
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
this.
|
|
84
|
+
handleInput = (e) => {
|
|
85
|
+
const target = e.target;
|
|
86
|
+
this.checked = target.checked;
|
|
87
|
+
this.value = target.checked.toString();
|
|
94
88
|
this.internals?.setFormValue(this.value);
|
|
95
|
-
this.
|
|
89
|
+
this.dsCheckboxInput.emit({ id: this.identifier, checked: target.checked });
|
|
90
|
+
if (isValidation('client') && this.validationMessage) {
|
|
91
|
+
this.validationMessage = this.getValidationMessage();
|
|
92
|
+
}
|
|
96
93
|
};
|
|
97
94
|
handleKeyUp = (event) => {
|
|
98
95
|
if (event.key === 'Enter') {
|
|
99
|
-
this.
|
|
96
|
+
this.inputElem.dispatchEvent(new Event('input'));
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
handleBlur = () => {
|
|
100
|
+
if (isValidation('client') && !this.labelClicked) {
|
|
101
|
+
this.validationMessage = this.getValidationMessage();
|
|
100
102
|
}
|
|
103
|
+
this.labelClicked = false;
|
|
104
|
+
};
|
|
105
|
+
handleMouseDown = () => {
|
|
106
|
+
this.labelClicked = true;
|
|
107
|
+
};
|
|
108
|
+
handleMouseUp = () => {
|
|
109
|
+
this.labelClicked = false;
|
|
101
110
|
};
|
|
102
111
|
renderCheckbox() {
|
|
103
112
|
const classes = classNames('ds-checkbox', {
|
|
@@ -107,12 +116,11 @@ export class DsCheckbox {
|
|
|
107
116
|
const inputClasses = classNames('ds-checkbox__input', {
|
|
108
117
|
'ds-checkbox__input--invalid': Boolean(this.errorText),
|
|
109
118
|
});
|
|
110
|
-
const errorText = this.getErrorText();
|
|
111
119
|
const errorClasses = classNames('ds-checkbox-error', {
|
|
112
|
-
'ds-checkbox-error--visible': Boolean(
|
|
120
|
+
'ds-checkbox-error--visible': Boolean(this.validationMessage),
|
|
113
121
|
});
|
|
114
122
|
const ariaDescribedBy = this.getAriaDescribedBy();
|
|
115
|
-
return (h(Fragment, null, h("div", null, h("label", { id: this.labelId, class: classes }, h("input", { ref: inputElem => (this.inputElem = inputElem), type: "checkbox", class: inputClasses, checked: this.checked, indeterminate: this.indeterminate,
|
|
123
|
+
return (h(Fragment, null, h("div", null, h("label", { id: this.labelId, class: classes, onMouseDown: this.handleMouseDown, onMouseUp: this.handleMouseUp }, h("input", { ref: inputElem => (this.inputElem = inputElem), type: "checkbox", class: inputClasses, checked: this.checked, indeterminate: this.indeterminate, onInput: this.handleInput, onKeyUp: this.handleKeyUp, onBlur: this.handleBlur, value: this.value, disabled: this.disabled, required: this.required, id: this.identifier, "aria-describedby": ariaDescribedBy, "aria-label": getAriaLabel(this.getCheckboxText(), this.ariaLabel), "aria-invalid": this.errorText ? true : undefined, ...this.inheritedAttributes }), this.getCheckboxText())), !this.errorsDisabled && (h("div", { class: errorClasses }, h("ds-input-validity", { id: this.inputValidityId, text: this.validationMessage, type: "error", role: "alert" })))));
|
|
116
124
|
}
|
|
117
125
|
renderFieldset() {
|
|
118
126
|
const fieldsetClasses = classNames('ds-checkbox-fieldset');
|
|
@@ -141,9 +149,9 @@ export class DsCheckbox {
|
|
|
141
149
|
}
|
|
142
150
|
static get properties() {
|
|
143
151
|
return {
|
|
144
|
-
"
|
|
152
|
+
"identifier": {
|
|
145
153
|
"type": "string",
|
|
146
|
-
"mutable":
|
|
154
|
+
"mutable": false,
|
|
147
155
|
"complexType": {
|
|
148
156
|
"original": "string",
|
|
149
157
|
"resolved": "string",
|
|
@@ -158,7 +166,8 @@ export class DsCheckbox {
|
|
|
158
166
|
"getter": false,
|
|
159
167
|
"setter": false,
|
|
160
168
|
"attribute": "id",
|
|
161
|
-
"reflect": false
|
|
169
|
+
"reflect": false,
|
|
170
|
+
"defaultValue": "checkboxIdGenerator.next().value as string"
|
|
162
171
|
},
|
|
163
172
|
"checked": {
|
|
164
173
|
"type": "boolean",
|
|
@@ -375,20 +384,38 @@ export class DsCheckbox {
|
|
|
375
384
|
"setter": false,
|
|
376
385
|
"attribute": "optional-text",
|
|
377
386
|
"reflect": false
|
|
387
|
+
},
|
|
388
|
+
"ariaLabel": {
|
|
389
|
+
"type": "string",
|
|
390
|
+
"mutable": false,
|
|
391
|
+
"complexType": {
|
|
392
|
+
"original": "string",
|
|
393
|
+
"resolved": "string",
|
|
394
|
+
"references": {}
|
|
395
|
+
},
|
|
396
|
+
"required": false,
|
|
397
|
+
"optional": false,
|
|
398
|
+
"docs": {
|
|
399
|
+
"tags": [],
|
|
400
|
+
"text": ""
|
|
401
|
+
},
|
|
402
|
+
"getter": false,
|
|
403
|
+
"setter": false,
|
|
404
|
+
"attribute": "aria-label",
|
|
405
|
+
"reflect": false
|
|
378
406
|
}
|
|
379
407
|
};
|
|
380
408
|
}
|
|
381
409
|
static get states() {
|
|
382
410
|
return {
|
|
383
|
-
"ariaLabel": {},
|
|
384
411
|
"value": {},
|
|
385
412
|
"validationMessage": {}
|
|
386
413
|
};
|
|
387
414
|
}
|
|
388
415
|
static get events() {
|
|
389
416
|
return [{
|
|
390
|
-
"method": "
|
|
391
|
-
"name": "
|
|
417
|
+
"method": "dsCheckboxInput",
|
|
418
|
+
"name": "dsCheckboxInput",
|
|
392
419
|
"bubbles": true,
|
|
393
420
|
"cancelable": true,
|
|
394
421
|
"composed": true,
|
|
@@ -397,31 +424,16 @@ export class DsCheckbox {
|
|
|
397
424
|
"text": ""
|
|
398
425
|
},
|
|
399
426
|
"complexType": {
|
|
400
|
-
"original": "
|
|
401
|
-
"resolved": "
|
|
427
|
+
"original": "DsCheckboxInputEvent",
|
|
428
|
+
"resolved": "DsCheckboxInputEvent",
|
|
402
429
|
"references": {
|
|
403
|
-
"
|
|
430
|
+
"DsCheckboxInputEvent": {
|
|
404
431
|
"location": "local",
|
|
405
432
|
"path": "/Users/teemuparssinen/hy/uh-design-system/component-library/packages/component-library/src/components/01-base-components/ds-checkbox/ds-checkbox.tsx",
|
|
406
|
-
"id": "src/components/01-base-components/ds-checkbox/ds-checkbox.tsx::
|
|
433
|
+
"id": "src/components/01-base-components/ds-checkbox/ds-checkbox.tsx::DsCheckboxInputEvent"
|
|
407
434
|
}
|
|
408
435
|
}
|
|
409
436
|
}
|
|
410
|
-
}, {
|
|
411
|
-
"method": "dsCheckboxError",
|
|
412
|
-
"name": "dsCheckboxError",
|
|
413
|
-
"bubbles": true,
|
|
414
|
-
"cancelable": true,
|
|
415
|
-
"composed": true,
|
|
416
|
-
"docs": {
|
|
417
|
-
"tags": [],
|
|
418
|
-
"text": ""
|
|
419
|
-
},
|
|
420
|
-
"complexType": {
|
|
421
|
-
"original": "string",
|
|
422
|
-
"resolved": "string",
|
|
423
|
-
"references": {}
|
|
424
|
-
}
|
|
425
437
|
}];
|
|
426
438
|
}
|
|
427
439
|
static get elementRef() { return "el"; }
|
package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.js
CHANGED
|
@@ -19,10 +19,9 @@ export class DsCheckboxGroup {
|
|
|
19
19
|
errorText = '';
|
|
20
20
|
text = '';
|
|
21
21
|
checked = false;
|
|
22
|
-
checkedChildElementCount = 0;
|
|
23
22
|
disabled = false;
|
|
24
|
-
parentCheckedCount = 0;
|
|
25
23
|
childElementsCount = 0;
|
|
24
|
+
checkedChildElementCount = 0;
|
|
26
25
|
isIndeterminate = false;
|
|
27
26
|
indeterminateChildCheckboxCount = 0;
|
|
28
27
|
elementIs = (localName) => (element) => element.localName === localName;
|
|
@@ -56,21 +55,21 @@ export class DsCheckboxGroup {
|
|
|
56
55
|
async setChecked(newValue) {
|
|
57
56
|
this.updateChildElementsChecked(newValue);
|
|
58
57
|
}
|
|
59
|
-
|
|
58
|
+
watchCheckboxDisabledChange(newValue) {
|
|
60
59
|
this.updateChildElements((element) => {
|
|
61
60
|
element.disabled = newValue;
|
|
62
61
|
});
|
|
63
62
|
}
|
|
64
|
-
|
|
63
|
+
watchCheckedChange(newValue) {
|
|
65
64
|
this.updateChildElementsChecked(newValue);
|
|
66
65
|
}
|
|
67
|
-
|
|
66
|
+
watchIndeterminateChange(newValue) {
|
|
68
67
|
this.dsCheckboxGroupIndeterminateChildChange.emit({ id: this.fieldsetId, indeterminate: newValue });
|
|
69
68
|
}
|
|
70
|
-
|
|
69
|
+
listenIndeterminateChildChange(event) {
|
|
71
70
|
this.indeterminateChildCheckboxCount = event.detail.indeterminate ? this.indeterminateChildCheckboxCount + 1 : this.indeterminateChildCheckboxCount - 1;
|
|
72
71
|
}
|
|
73
|
-
|
|
72
|
+
watchCheckedChildElementCountChange(newValue, oldValue) {
|
|
74
73
|
this.isIndeterminate =
|
|
75
74
|
this.checkedChildElementCount !== this.childElementsCount && this.checkedChildElementCount < this.childElementsCount && this.checkedChildElementCount > 0;
|
|
76
75
|
if (newValue === this.childElementsCount && newValue > oldValue) {
|
|
@@ -88,7 +87,7 @@ export class DsCheckboxGroup {
|
|
|
88
87
|
this.checkedChildElementCount = this.checkedChildElementCount === 0 ? 0 : this.checkedChildElementCount - 1;
|
|
89
88
|
}
|
|
90
89
|
};
|
|
91
|
-
|
|
90
|
+
listenCheckboxChange(event) {
|
|
92
91
|
if (event.detail.id === this.checkboxId) {
|
|
93
92
|
this.updateChildElementsChecked(event.detail.checked);
|
|
94
93
|
return;
|
|
@@ -97,7 +96,7 @@ export class DsCheckboxGroup {
|
|
|
97
96
|
this.updateCheckedChildElementCount(event);
|
|
98
97
|
}
|
|
99
98
|
}
|
|
100
|
-
|
|
99
|
+
listenCheckboxGroupChange(event) {
|
|
101
100
|
if (this.getChildElements().includes(event.target)) {
|
|
102
101
|
this.updateCheckedChildElementCount(event);
|
|
103
102
|
}
|
|
@@ -129,7 +128,7 @@ export class DsCheckboxGroup {
|
|
|
129
128
|
const nestedClasses = classNames('ds-checkbox-group', 'ds-checkbox-group--inset');
|
|
130
129
|
const checkboxesClasses = classNames('ds-checkbox-group__checkboxes');
|
|
131
130
|
const ariaDescribedBy = this.getAriaDescribedBy();
|
|
132
|
-
return (h("fieldset", { key: '
|
|
131
|
+
return (h("fieldset", { key: '1029763130b4d2d138679c9f84ec72c0231fcc83', id: this.fieldsetId, class: classes, "aria-describedby": ariaDescribedBy, ...this.inheritedAttributes }, this.legend && h("legend", { key: 'a9be37aab510d5e402841c8bbda64190548bc1ea', class: legendClasses }, this.legend), this.assistiveText && (h("small", { key: '0ae42c2b46e52dad0570ad120180e662db43f2fa', class: assistiveTextClasses, id: this.assistiveTextId }, this.assistiveText)), this.text ? (h(Fragment, null, h("ds-checkbox", { id: this.checkboxId, text: this.text, checked: this.checkedChildElementCount === this.childElementsCount, disabled: this.disabled, indeterminate: this.indeterminateChildCheckboxCount > 0 || this.isIndeterminate }), h("fieldset", { id: this.nestedId, "aria-labelledby": this.checkboxId, class: nestedClasses }, h("slot", null)))) : (h("div", { class: checkboxesClasses }, h("slot", null))), h("div", { key: '3ea5bb7991a99c676cb50a24d1a679b6f68c96bf', class: errorClasses }, h("ds-input-validity", { key: '8d5ca5e80b2a5f985e09bf7039538a5a13278e8e', id: this.errorTextId, text: this.errorText, type: "error" }))));
|
|
133
132
|
}
|
|
134
133
|
static get is() { return "ds-checkbox-group"; }
|
|
135
134
|
static get encapsulation() { return "shadow"; }
|
|
@@ -245,7 +244,7 @@ export class DsCheckboxGroup {
|
|
|
245
244
|
},
|
|
246
245
|
"checked": {
|
|
247
246
|
"type": "boolean",
|
|
248
|
-
"mutable":
|
|
247
|
+
"mutable": false,
|
|
249
248
|
"complexType": {
|
|
250
249
|
"original": "boolean",
|
|
251
250
|
"resolved": "boolean",
|
|
@@ -263,26 +262,6 @@ export class DsCheckboxGroup {
|
|
|
263
262
|
"reflect": false,
|
|
264
263
|
"defaultValue": "false"
|
|
265
264
|
},
|
|
266
|
-
"checkedChildElementCount": {
|
|
267
|
-
"type": "number",
|
|
268
|
-
"mutable": true,
|
|
269
|
-
"complexType": {
|
|
270
|
-
"original": "number",
|
|
271
|
-
"resolved": "number",
|
|
272
|
-
"references": {}
|
|
273
|
-
},
|
|
274
|
-
"required": false,
|
|
275
|
-
"optional": false,
|
|
276
|
-
"docs": {
|
|
277
|
-
"tags": [],
|
|
278
|
-
"text": ""
|
|
279
|
-
},
|
|
280
|
-
"getter": false,
|
|
281
|
-
"setter": false,
|
|
282
|
-
"attribute": "checked-child-element-count",
|
|
283
|
-
"reflect": false,
|
|
284
|
-
"defaultValue": "0"
|
|
285
|
-
},
|
|
286
265
|
"disabled": {
|
|
287
266
|
"type": "boolean",
|
|
288
267
|
"mutable": false,
|
|
@@ -302,32 +281,13 @@ export class DsCheckboxGroup {
|
|
|
302
281
|
"attribute": "disabled",
|
|
303
282
|
"reflect": false,
|
|
304
283
|
"defaultValue": "false"
|
|
305
|
-
},
|
|
306
|
-
"parentCheckedCount": {
|
|
307
|
-
"type": "number",
|
|
308
|
-
"mutable": false,
|
|
309
|
-
"complexType": {
|
|
310
|
-
"original": "number",
|
|
311
|
-
"resolved": "number",
|
|
312
|
-
"references": {}
|
|
313
|
-
},
|
|
314
|
-
"required": false,
|
|
315
|
-
"optional": false,
|
|
316
|
-
"docs": {
|
|
317
|
-
"tags": [],
|
|
318
|
-
"text": ""
|
|
319
|
-
},
|
|
320
|
-
"getter": false,
|
|
321
|
-
"setter": false,
|
|
322
|
-
"attribute": "parent-checked-count",
|
|
323
|
-
"reflect": false,
|
|
324
|
-
"defaultValue": "0"
|
|
325
284
|
}
|
|
326
285
|
};
|
|
327
286
|
}
|
|
328
287
|
static get states() {
|
|
329
288
|
return {
|
|
330
289
|
"childElementsCount": {},
|
|
290
|
+
"checkedChildElementCount": {},
|
|
331
291
|
"isIndeterminate": {},
|
|
332
292
|
"indeterminateChildCheckboxCount": {}
|
|
333
293
|
};
|
|
@@ -344,13 +304,13 @@ export class DsCheckboxGroup {
|
|
|
344
304
|
"text": ""
|
|
345
305
|
},
|
|
346
306
|
"complexType": {
|
|
347
|
-
"original": "
|
|
348
|
-
"resolved": "
|
|
307
|
+
"original": "DsCheckboxGroupChangeEvent",
|
|
308
|
+
"resolved": "DsCheckboxGroupChangeEvent",
|
|
349
309
|
"references": {
|
|
350
|
-
"
|
|
310
|
+
"DsCheckboxGroupChangeEvent": {
|
|
351
311
|
"location": "local",
|
|
352
312
|
"path": "/Users/teemuparssinen/hy/uh-design-system/component-library/packages/component-library/src/components/01-base-components/ds-checkbox-group/ds-checkbox-group.tsx",
|
|
353
|
-
"id": "src/components/01-base-components/ds-checkbox-group/ds-checkbox-group.tsx::
|
|
313
|
+
"id": "src/components/01-base-components/ds-checkbox-group/ds-checkbox-group.tsx::DsCheckboxGroupChangeEvent"
|
|
354
314
|
}
|
|
355
315
|
}
|
|
356
316
|
}
|
|
@@ -365,13 +325,13 @@ export class DsCheckboxGroup {
|
|
|
365
325
|
"text": ""
|
|
366
326
|
},
|
|
367
327
|
"complexType": {
|
|
368
|
-
"original": "
|
|
369
|
-
"resolved": "
|
|
328
|
+
"original": "DsCheckboxGroupIndeterminateChildChangeEvent",
|
|
329
|
+
"resolved": "DsCheckboxGroupIndeterminateChildChangeEvent",
|
|
370
330
|
"references": {
|
|
371
|
-
"
|
|
331
|
+
"DsCheckboxGroupIndeterminateChildChangeEvent": {
|
|
372
332
|
"location": "local",
|
|
373
333
|
"path": "/Users/teemuparssinen/hy/uh-design-system/component-library/packages/component-library/src/components/01-base-components/ds-checkbox-group/ds-checkbox-group.tsx",
|
|
374
|
-
"id": "src/components/01-base-components/ds-checkbox-group/ds-checkbox-group.tsx::
|
|
334
|
+
"id": "src/components/01-base-components/ds-checkbox-group/ds-checkbox-group.tsx::DsCheckboxGroupIndeterminateChildChangeEvent"
|
|
375
335
|
}
|
|
376
336
|
}
|
|
377
337
|
}
|
|
@@ -409,34 +369,34 @@ export class DsCheckboxGroup {
|
|
|
409
369
|
static get watchers() {
|
|
410
370
|
return [{
|
|
411
371
|
"propName": "disabled",
|
|
412
|
-
"methodName": "
|
|
372
|
+
"methodName": "watchCheckboxDisabledChange"
|
|
413
373
|
}, {
|
|
414
374
|
"propName": "checked",
|
|
415
|
-
"methodName": "
|
|
375
|
+
"methodName": "watchCheckedChange"
|
|
416
376
|
}, {
|
|
417
377
|
"propName": "isIndeterminate",
|
|
418
|
-
"methodName": "
|
|
378
|
+
"methodName": "watchIndeterminateChange"
|
|
419
379
|
}, {
|
|
420
380
|
"propName": "checkedChildElementCount",
|
|
421
|
-
"methodName": "
|
|
381
|
+
"methodName": "watchCheckedChildElementCountChange"
|
|
422
382
|
}];
|
|
423
383
|
}
|
|
424
384
|
static get listeners() {
|
|
425
385
|
return [{
|
|
426
386
|
"name": "dsCheckboxGroupIndeterminateChildChange",
|
|
427
|
-
"method": "
|
|
387
|
+
"method": "listenIndeterminateChildChange",
|
|
428
388
|
"target": undefined,
|
|
429
389
|
"capture": false,
|
|
430
390
|
"passive": false
|
|
431
391
|
}, {
|
|
432
|
-
"name": "
|
|
433
|
-
"method": "
|
|
392
|
+
"name": "dsCheckboxInput",
|
|
393
|
+
"method": "listenCheckboxChange",
|
|
434
394
|
"target": undefined,
|
|
435
395
|
"capture": false,
|
|
436
396
|
"passive": false
|
|
437
397
|
}, {
|
|
438
398
|
"name": "dsCheckboxGroupChange",
|
|
439
|
-
"method": "
|
|
399
|
+
"method": "listenCheckboxGroupChange",
|
|
440
400
|
"target": undefined,
|
|
441
401
|
"capture": false,
|
|
442
402
|
"passive": false
|
|
@@ -48,7 +48,7 @@ export class DsIcon {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
render() {
|
|
51
|
-
return (h(Fragment, { key: '
|
|
51
|
+
return (h(Fragment, { key: '58309a22dafbad09a1f9e884657aad264261174e' }, h("span", { key: '3295d61af901e74ea7c39d1e7a4b7e083f44794f', class: "ds-icon--container", innerHTML: this.getIcon(), "aria-hidden": this.hidden ? 'true' : 'false' })));
|
|
52
52
|
}
|
|
53
53
|
static get is() { return "ds-icon"; }
|
|
54
54
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
2
|
import classNames from "classnames";
|
|
3
|
+
import { isValidation } from "../../../store";
|
|
3
4
|
export class DsInputValidity {
|
|
4
5
|
el;
|
|
5
6
|
text;
|
|
6
7
|
type = 'error';
|
|
7
|
-
|
|
8
|
+
validityRole;
|
|
8
9
|
identifier;
|
|
9
10
|
componentDidLoad() {
|
|
10
11
|
this.identifier = this.el.getAttribute('id');
|
|
@@ -16,10 +17,7 @@ export class DsInputValidity {
|
|
|
16
17
|
'ds-input-validity--success': this.type === 'success',
|
|
17
18
|
});
|
|
18
19
|
const icon = this.type === 'success' ? 'check_circle_fill' : 'warning_fill';
|
|
19
|
-
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
return (h(Fragment, null, this.text && (h("div", { class: classes, role: this.role }, h("ds-icon", { name: icon }), h("small", { id: this.identifier }, this.text)))));
|
|
20
|
+
return (h("div", { key: '2eca152eca6e7b4d7e894ff8aaf50a6d03c3e44f', role: isValidation('client') ? this.validityRole : undefined }, this.text && (h("div", { key: '73e4cd1b3af6a84b9c7cbca813c166bc10e9dd26', class: classes }, h("ds-icon", { key: '4eaad4001e758837f9e8b1aae48292a1c5a1a08f', name: icon }), h("small", { key: '3ee5d39785454b9aab9ae6012f3ad940c1f18df0', id: this.identifier }, this.text)))));
|
|
23
21
|
}
|
|
24
22
|
static get is() { return "ds-input-validity"; }
|
|
25
23
|
static get originalStyleUrls() {
|
|
@@ -78,7 +76,7 @@ export class DsInputValidity {
|
|
|
78
76
|
"reflect": false,
|
|
79
77
|
"defaultValue": "'error'"
|
|
80
78
|
},
|
|
81
|
-
"
|
|
79
|
+
"validityRole": {
|
|
82
80
|
"type": "string",
|
|
83
81
|
"mutable": false,
|
|
84
82
|
"complexType": {
|
|
@@ -100,8 +98,7 @@ export class DsInputValidity {
|
|
|
100
98
|
"getter": false,
|
|
101
99
|
"setter": false,
|
|
102
100
|
"attribute": "role",
|
|
103
|
-
"reflect": false
|
|
104
|
-
"defaultValue": "'status'"
|
|
101
|
+
"reflect": false
|
|
105
102
|
}
|
|
106
103
|
};
|
|
107
104
|
}
|