@solid-design-system/components 1.36.0 → 1.37.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/components/es/checkbox-group.js +1 -1
- package/dist/components/es/checkbox.js +1 -1
- package/dist/components/es/form.js +1 -1
- package/dist/components/es/input.js +1 -1
- package/dist/components/es/option.js +1 -1
- package/dist/components/es/radio-group.js +1 -1
- package/dist/components/es/radio.js +1 -1
- package/dist/components/es/select.js +2 -2
- package/dist/components/es/solid-element.js +1 -1
- package/dist/components/es/switch.js +1 -1
- package/dist/components/es/textarea.js +1 -1
- package/dist/components/umd/solid-components.js +18 -18
- package/dist/custom-elements.json +1 -1
- package/dist/package/components/checkbox/checkbox.d.ts +2 -0
- package/dist/package/components/checkbox/checkbox.js +23 -6
- package/dist/package/components/checkbox-group/checkbox-group.js +1 -1
- package/dist/package/components/input/input.d.ts +3 -0
- package/dist/package/components/input/input.js +20 -19
- package/dist/package/components/option/option.js +0 -2
- package/dist/package/components/radio/radio.js +3 -3
- package/dist/package/components/radio-group/radio-group.d.ts +4 -3
- package/dist/package/components/radio-group/radio-group.js +25 -27
- package/dist/package/components/select/select.d.ts +3 -3
- package/dist/package/components/select/select.js +18 -23
- package/dist/package/components/switch/switch.d.ts +2 -0
- package/dist/package/components/switch/switch.js +15 -7
- package/dist/package/components/textarea/textarea.d.ts +3 -0
- package/dist/package/components/textarea/textarea.js +30 -24
- package/dist/package/internal/form.d.ts +3 -1
- package/dist/package/internal/form.js +38 -10
- package/dist/package/internal/solid-element.d.ts +2 -0
- package/dist/package/styles/tailwind.css.js +1 -1
- package/dist/versioned-components/es/accordion-group.js +1 -1
- package/dist/versioned-components/es/accordion.js +1 -1
- package/dist/versioned-components/es/badge.js +1 -1
- package/dist/versioned-components/es/brandshape.js +1 -1
- package/dist/versioned-components/es/button.js +1 -1
- package/dist/versioned-components/es/carousel-item.js +1 -1
- package/dist/versioned-components/es/carousel.js +3 -3
- package/dist/versioned-components/es/checkbox-group.js +1 -1
- package/dist/versioned-components/es/checkbox.js +1 -1
- package/dist/versioned-components/es/divider.js +1 -1
- package/dist/versioned-components/es/drawer.js +1 -1
- package/dist/versioned-components/es/dropdown.js +1 -1
- package/dist/versioned-components/es/form.js +1 -1
- package/dist/versioned-components/es/header.js +1 -1
- package/dist/versioned-components/es/icon.js +1 -1
- package/dist/versioned-components/es/include.js +1 -1
- package/dist/versioned-components/es/input.js +1 -1
- package/dist/versioned-components/es/link.js +1 -1
- package/dist/versioned-components/es/navigation-item.js +1 -1
- package/dist/versioned-components/es/notification.js +1 -1
- package/dist/versioned-components/es/option.js +1 -1
- package/dist/versioned-components/es/popup.js +1 -1
- package/dist/versioned-components/es/radio-button.js +1 -1
- package/dist/versioned-components/es/radio-group.js +1 -1
- package/dist/versioned-components/es/radio.js +1 -1
- package/dist/versioned-components/es/select.js +2 -2
- package/dist/versioned-components/es/solid-element.js +1 -1
- package/dist/versioned-components/es/spinner.js +1 -1
- package/dist/versioned-components/es/switch.js +1 -1
- package/dist/versioned-components/es/tag.js +1 -1
- package/dist/versioned-components/es/teaser.js +1 -1
- package/dist/versioned-components/es/textarea.js +1 -1
- package/dist/versioned-components/es/tooltip.js +2 -2
- package/dist/versioned-components/es/video.js +1 -1
- package/dist/versioned-package/_components/button-group/button-group.d.ts +1 -1
- package/dist/versioned-package/_components/button-group/button-group.js +11 -11
- package/dist/versioned-package/components/accordion/accordion.d.ts +1 -1
- package/dist/versioned-package/components/accordion/accordion.js +2 -2
- package/dist/versioned-package/components/accordion-group/accordion-group.d.ts +1 -1
- package/dist/versioned-package/components/accordion-group/accordion-group.js +3 -3
- package/dist/versioned-package/components/badge/badge.d.ts +1 -1
- package/dist/versioned-package/components/badge/badge.js +1 -1
- package/dist/versioned-package/components/brandshape/brandshape.d.ts +1 -1
- package/dist/versioned-package/components/brandshape/brandshape.js +1 -1
- package/dist/versioned-package/components/button/button.d.ts +1 -1
- package/dist/versioned-package/components/button/button.js +4 -4
- package/dist/versioned-package/components/carousel/carousel.d.ts +1 -1
- package/dist/versioned-package/components/carousel/carousel.js +6 -6
- package/dist/versioned-package/components/carousel-item/carousel-item.d.ts +1 -1
- package/dist/versioned-package/components/carousel-item/carousel-item.js +1 -1
- package/dist/versioned-package/components/checkbox/checkbox.d.ts +3 -1
- package/dist/versioned-package/components/checkbox/checkbox.js +27 -10
- package/dist/versioned-package/components/checkbox-group/checkbox-group.d.ts +1 -1
- package/dist/versioned-package/components/checkbox-group/checkbox-group.js +6 -6
- package/dist/versioned-package/components/divider/divider.d.ts +1 -1
- package/dist/versioned-package/components/divider/divider.js +2 -2
- package/dist/versioned-package/components/drawer/drawer.d.ts +1 -1
- package/dist/versioned-package/components/drawer/drawer.js +2 -2
- package/dist/versioned-package/components/dropdown/dropdown.d.ts +1 -1
- package/dist/versioned-package/components/dropdown/dropdown.js +8 -8
- package/dist/versioned-package/components/header/header.d.ts +1 -1
- package/dist/versioned-package/components/header/header.js +4 -4
- package/dist/versioned-package/components/icon/icon.d.ts +1 -1
- package/dist/versioned-package/components/icon/icon.js +1 -1
- package/dist/versioned-package/components/include/include.d.ts +1 -1
- package/dist/versioned-package/components/include/include.js +1 -1
- package/dist/versioned-package/components/input/input.d.ts +4 -1
- package/dist/versioned-package/components/input/input.js +23 -22
- package/dist/versioned-package/components/link/link.d.ts +1 -1
- package/dist/versioned-package/components/link/link.js +2 -2
- package/dist/versioned-package/components/navigation-item/navigation-item.d.ts +1 -1
- package/dist/versioned-package/components/navigation-item/navigation-item.js +3 -3
- package/dist/versioned-package/components/notification/notification.d.ts +1 -1
- package/dist/versioned-package/components/notification/notification.js +5 -5
- package/dist/versioned-package/components/option/option.d.ts +1 -1
- package/dist/versioned-package/components/option/option.js +2 -4
- package/dist/versioned-package/components/popup/popup.d.ts +1 -1
- package/dist/versioned-package/components/popup/popup.js +1 -1
- package/dist/versioned-package/components/radio/radio.d.ts +1 -1
- package/dist/versioned-package/components/radio/radio.js +5 -5
- package/dist/versioned-package/components/radio-button/radio-button.d.ts +1 -1
- package/dist/versioned-package/components/radio-button/radio-button.js +2 -2
- package/dist/versioned-package/components/radio-group/radio-group.d.ts +6 -5
- package/dist/versioned-package/components/radio-group/radio-group.js +38 -40
- package/dist/versioned-package/components/select/select.d.ts +7 -7
- package/dist/versioned-package/components/select/select.js +44 -49
- package/dist/versioned-package/components/spinner/spinner.d.ts +1 -1
- package/dist/versioned-package/components/spinner/spinner.js +1 -1
- package/dist/versioned-package/components/switch/switch.d.ts +3 -1
- package/dist/versioned-package/components/switch/switch.js +17 -9
- package/dist/versioned-package/components/tag/tag.d.ts +1 -1
- package/dist/versioned-package/components/tag/tag.js +2 -2
- package/dist/versioned-package/components/teaser/teaser.js +1 -1
- package/dist/versioned-package/components/textarea/textarea.d.ts +4 -1
- package/dist/versioned-package/components/textarea/textarea.js +32 -26
- package/dist/versioned-package/components/tooltip/tooltip.d.ts +1 -1
- package/dist/versioned-package/components/tooltip/tooltip.js +5 -5
- package/dist/versioned-package/components/video/video.d.ts +1 -1
- package/dist/versioned-package/components/video/video.js +2 -2
- package/dist/versioned-package/internal/form.d.ts +3 -1
- package/dist/versioned-package/internal/form.js +40 -12
- package/dist/versioned-package/internal/solid-element.d.ts +2 -0
- package/dist/versioned-package/styles/tailwind.css.js +1 -1
- package/dist/versioned-styles/solid-styles.css +1 -1
- package/dist/vscode.html-custom-data.json +44 -34
- package/dist/web-types.json +78 -18
- package/package.json +1 -1
- package/dist/components/es/form-control.styles.js +0 -1
- package/dist/package/styles/form-control.styles.d.ts +0 -2
- package/dist/package/styles/form-control.styles.js +0 -5
- package/dist/versioned-components/es/form-control.styles.js +0 -1
- package/dist/versioned-package/styles/form-control.styles.d.ts +0 -2
- package/dist/versioned-package/styles/form-control.styles.js +0 -5
|
@@ -73,7 +73,7 @@ let SdRadio = class extends SolidElement {
|
|
|
73
73
|
}
|
|
74
74
|
render() {
|
|
75
75
|
return html`<span part="base" class="${cx(
|
|
76
|
-
"sd-1-
|
|
76
|
+
"sd-1-37-0-radio group inline-flex items-start items-center text-base leading-normal text-black cursor-pointer align-middle",
|
|
77
77
|
this.disabled && "hover:cursor-not-allowed",
|
|
78
78
|
{
|
|
79
79
|
/* sizes, fonts */
|
|
@@ -82,13 +82,13 @@ let SdRadio = class extends SolidElement {
|
|
|
82
82
|
}[this.size]
|
|
83
83
|
)}"><span part="${`${this.checked ? "control--checked" : "control--unchecked"}`}" class="${cx(
|
|
84
84
|
"flex-initial shrink-0 relative inline-flex items-center justify-center border rounded-full bg-white h-4 w-4",
|
|
85
|
-
this.disabled
|
|
85
|
+
this.disabled ? "border-neutral-500" : this.invalid ? "border-error hover:border-error-400 group-hover:border-error-400" : this.checked ? "border-accent hover:border-accent-550 group-hover:border-accent-550" : "border-neutral-800 hover:bg-neutral-200 group-hover:bg-neutral-200"
|
|
86
86
|
)}">${this.checked ? html`<span part="checked" class="${cx(
|
|
87
87
|
"rounded-full inline-flex text-white border bg-accent h-2.5 w-2.5",
|
|
88
|
-
this.disabled
|
|
88
|
+
this.disabled ? "bg-neutral-500" : this.invalid ? "bg-error hover:bg-error-400 group-hover:bg-error-400" : this.checked ? "bg-accent hover:bg-accent-550 group-hover:bg-accent-550" : "bg-neutral-800"
|
|
89
89
|
)}"></span>` : ""}</span><slot part="label" class="${cx(
|
|
90
90
|
"ml-2 select-none inline-block",
|
|
91
|
-
this.disabled
|
|
91
|
+
this.disabled ? "text-neutral-500" : this.invalid ? "text-error" : "text-black"
|
|
92
92
|
)}"></slot></span>`;
|
|
93
93
|
}
|
|
94
94
|
};
|
|
@@ -121,7 +121,7 @@ __decorateClass([
|
|
|
121
121
|
watch("disabled", { waitUntilFirstUpdate: true })
|
|
122
122
|
], SdRadio.prototype, "handleDisabledChange", 1);
|
|
123
123
|
SdRadio = __decorateClass([
|
|
124
|
-
customElement("sd-1-
|
|
124
|
+
customElement("sd-1-37-0-radio")
|
|
125
125
|
], SdRadio);
|
|
126
126
|
export {
|
|
127
127
|
SdRadio as default
|
|
@@ -84,7 +84,7 @@ let SdRadioButton = class extends SolidElement {
|
|
|
84
84
|
SdRadioButton.styles = [
|
|
85
85
|
SolidElement.styles,
|
|
86
86
|
componentStyles,
|
|
87
|
-
css`:host{display:block;width:-moz-min-content;width:min-content}.hidden-input{all:unset;position:absolute;inset:var(--sd-spacing-0,0);z-index:-10;opacity:var(--sd-opacity-0,0);outline-style:dotted;outline-width:1px;outline-color:rgb(var(--sd-color-error,204 25 55) / 1)}.lg-label{height:var(--sd-spacing-12,3rem)}.lg-no-label{height:var(--sd-spacing-12,3rem);width:var(--sd-spacing-12,3rem)}.md-label{height:var(--sd-spacing-10,2.5rem)}.md-no-label{height:var(--sd-spacing-10,2.5rem);width:var(--sd-spacing-10,2.5rem)}.sm-label{height:var(--sd-spacing-8,2rem)}.sm-no-label{height:var(--sd-spacing-8,2rem);width:var(--sd-spacing-8,2rem)}:host(.sd-1-
|
|
87
|
+
css`:host{display:block;width:-moz-min-content;width:min-content}.hidden-input{all:unset;position:absolute;inset:var(--sd-spacing-0,0);z-index:-10;opacity:var(--sd-opacity-0,0);outline-style:dotted;outline-width:1px;outline-color:rgb(var(--sd-color-error,204 25 55) / 1)}.lg-label{height:var(--sd-spacing-12,3rem)}.lg-no-label{height:var(--sd-spacing-12,3rem);width:var(--sd-spacing-12,3rem)}.md-label{height:var(--sd-spacing-10,2.5rem)}.md-no-label{height:var(--sd-spacing-10,2.5rem);width:var(--sd-spacing-10,2.5rem)}.sm-label{height:var(--sd-spacing-8,2rem)}.sm-no-label{height:var(--sd-spacing-8,2rem);width:var(--sd-spacing-8,2rem)}:host(.sd-1-37-0-button-group__button--first:not(.sd-1-37-0-button-group__button--last)) button{border-top-right-radius:var(--sd-border-radius-none,0);border-bottom-right-radius:var(--sd-border-radius-none,0)}:host(.sd-1-37-0-button-group__button--inner) button{border-radius:var(--sd-border-radius-none,0)}:host(.sd-1-37-0-button-group__button--last:not(.sd-1-37-0-button-group__button--first)) button{border-top-left-radius:var(--sd-border-radius-none,0);border-bottom-left-radius:var(--sd-border-radius-none,0)}:host(.sd-1-37-0-button-group__button:not(.sd-1-37-0-button-group__button--first)){margin-inline-start:-1px}:host(.sd-1-37-0-button-group__button--hover){z-index:10}:host(.sd-1-37-0-button-group__button--focus),:host(.sd-1-37-0-button-group__button[checked]){z-index:20}`
|
|
88
88
|
];
|
|
89
89
|
__decorateClass([
|
|
90
90
|
query(".button")
|
|
@@ -111,7 +111,7 @@ __decorateClass([
|
|
|
111
111
|
watch("disabled", { waitUntilFirstUpdate: true })
|
|
112
112
|
], SdRadioButton.prototype, "handleDisabledChange", 1);
|
|
113
113
|
SdRadioButton = __decorateClass([
|
|
114
|
-
customElement("sd-1-
|
|
114
|
+
customElement("sd-1-37-0-radio-button")
|
|
115
115
|
], SdRadioButton);
|
|
116
116
|
export {
|
|
117
117
|
SdRadioButton as default
|
|
@@ -4,7 +4,7 @@ import SolidElement from '../../internal/solid-element';
|
|
|
4
4
|
import type { SolidFormControl } from '../../internal/solid-element';
|
|
5
5
|
export default class SdRadioGroup extends SolidElement implements SolidFormControl {
|
|
6
6
|
static dependencies: {
|
|
7
|
-
'sd-1-
|
|
7
|
+
'sd-1-37-0-button-group': typeof SdButtonGroup;
|
|
8
8
|
};
|
|
9
9
|
protected readonly formControlController: FormControlController;
|
|
10
10
|
private readonly hasSlotController;
|
|
@@ -12,11 +12,12 @@ export default class SdRadioGroup extends SolidElement implements SolidFormContr
|
|
|
12
12
|
private validationTimeout;
|
|
13
13
|
defaultSlot: HTMLSlotElement;
|
|
14
14
|
validationInput: HTMLInputElement;
|
|
15
|
+
invalidMessage: HTMLDivElement;
|
|
15
16
|
private hasButtonGroup;
|
|
16
17
|
defaultValue: string;
|
|
17
|
-
|
|
18
|
-
private errorText;
|
|
18
|
+
showInvalidStyle: boolean;
|
|
19
19
|
label: string;
|
|
20
|
+
boldLabel: boolean;
|
|
20
21
|
name: string;
|
|
21
22
|
value: string;
|
|
22
23
|
size: 'lg' | 'sm';
|
|
@@ -30,7 +31,7 @@ export default class SdRadioGroup extends SolidElement implements SolidFormContr
|
|
|
30
31
|
private getAllRadios;
|
|
31
32
|
private handleRadioClick;
|
|
32
33
|
private handleKeyDown;
|
|
33
|
-
|
|
34
|
+
focus(): void;
|
|
34
35
|
private handleInvalid;
|
|
35
36
|
private syncRadioElements;
|
|
36
37
|
private syncRadios;
|
|
@@ -47,6 +48,6 @@ export default class SdRadioGroup extends SolidElement implements SolidFormContr
|
|
|
47
48
|
}
|
|
48
49
|
declare global {
|
|
49
50
|
interface HTMLElementTagNameMap {
|
|
50
|
-
'sd-1-
|
|
51
|
+
'sd-1-37-0-radio-group': SdRadioGroup;
|
|
51
52
|
}
|
|
52
53
|
}
|
|
@@ -7,6 +7,7 @@ import { watch } from "../../internal/watch.js";
|
|
|
7
7
|
import componentStyles from "../../styles/component.styles.js";
|
|
8
8
|
import cx from "classix";
|
|
9
9
|
import SdButtonGroup from "../../_components/button-group/button-group.js";
|
|
10
|
+
import SdRadio from "../radio/radio.js";
|
|
10
11
|
import SolidElement from "../../internal/solid-element.js";
|
|
11
12
|
var __defProp = Object.defineProperty;
|
|
12
13
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -27,9 +28,9 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
27
28
|
this.customValidityMessage = "";
|
|
28
29
|
this.hasButtonGroup = false;
|
|
29
30
|
this.defaultValue = "";
|
|
30
|
-
this.
|
|
31
|
-
this.errorText = "";
|
|
31
|
+
this.showInvalidStyle = false;
|
|
32
32
|
this.label = "";
|
|
33
|
+
this.boldLabel = false;
|
|
33
34
|
this.name = "option";
|
|
34
35
|
this.value = "";
|
|
35
36
|
this.size = "lg";
|
|
@@ -42,13 +43,10 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
42
43
|
const isRequiredAndEmpty = this.required && !this.value;
|
|
43
44
|
const hasCustomValidityMessage = this.customValidityMessage !== "";
|
|
44
45
|
if (hasCustomValidityMessage) {
|
|
45
|
-
this.invalid = true;
|
|
46
46
|
return customErrorValidityState;
|
|
47
47
|
} else if (isRequiredAndEmpty) {
|
|
48
|
-
this.invalid = true;
|
|
49
48
|
return valueMissingValidityState;
|
|
50
49
|
}
|
|
51
|
-
this.invalid = false;
|
|
52
50
|
return validValidityState;
|
|
53
51
|
}
|
|
54
52
|
/** Gets the validation message */
|
|
@@ -56,10 +54,8 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
56
54
|
const isRequiredAndEmpty = this.required && !this.value;
|
|
57
55
|
const hasCustomValidityMessage = this.customValidityMessage !== "";
|
|
58
56
|
if (hasCustomValidityMessage) {
|
|
59
|
-
console.log("this.customValidityMessage", this.customValidityMessage);
|
|
60
57
|
return this.customValidityMessage;
|
|
61
58
|
} else if (isRequiredAndEmpty) {
|
|
62
|
-
console.log("this.validationInput.validationMessage", this.validationInput);
|
|
63
59
|
return this.validationInput.validationMessage;
|
|
64
60
|
}
|
|
65
61
|
return "";
|
|
@@ -72,10 +68,10 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
72
68
|
this.formControlController.updateValidity();
|
|
73
69
|
}
|
|
74
70
|
getAllRadios() {
|
|
75
|
-
return [...this.querySelectorAll("sd-1-
|
|
71
|
+
return [...this.querySelectorAll("sd-1-37-0-radio, sd-1-37-0-radio-button")];
|
|
76
72
|
}
|
|
77
73
|
handleRadioClick(event) {
|
|
78
|
-
const target = event.target.closest("sd-1-
|
|
74
|
+
const target = event.target.closest("sd-1-37-0-radio, sd-1-37-0-radio-button");
|
|
79
75
|
const radios = this.getAllRadios();
|
|
80
76
|
const oldValue = this.value;
|
|
81
77
|
if (target.disabled) {
|
|
@@ -85,7 +81,7 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
85
81
|
radios.forEach((radio) => radio.checked = radio === target);
|
|
86
82
|
if (this.value !== oldValue) {
|
|
87
83
|
this.emit("sd-change");
|
|
88
|
-
this.emit("sd-1-
|
|
84
|
+
this.emit("sd-1-37-0-input");
|
|
89
85
|
}
|
|
90
86
|
}
|
|
91
87
|
handleKeyDown(event) {
|
|
@@ -119,11 +115,12 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
119
115
|
}
|
|
120
116
|
if (this.value !== oldValue) {
|
|
121
117
|
this.emit("sd-change");
|
|
122
|
-
this.emit("sd-1-
|
|
118
|
+
this.emit("sd-1-37-0-input");
|
|
123
119
|
}
|
|
124
120
|
event.preventDefault();
|
|
125
121
|
}
|
|
126
|
-
|
|
122
|
+
/** Move focus to the checked radio (or the first one if none are checked) */
|
|
123
|
+
focus() {
|
|
127
124
|
const radios = this.getAllRadios();
|
|
128
125
|
const checked = radios.find((radio) => radio.checked);
|
|
129
126
|
const radioToFocus = checked || radios[0];
|
|
@@ -134,6 +131,7 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
134
131
|
handleInvalid(event) {
|
|
135
132
|
this.formControlController.setValidity(false);
|
|
136
133
|
this.formControlController.emitInvalidEvent(event);
|
|
134
|
+
this.invalidMessage.textContent = event.target.validationMessage;
|
|
137
135
|
}
|
|
138
136
|
async syncRadioElements() {
|
|
139
137
|
var _a, _b;
|
|
@@ -144,12 +142,12 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
144
142
|
await radio.updateComplete;
|
|
145
143
|
radio.checked = radio.value === this.value;
|
|
146
144
|
radio.size = this.size;
|
|
147
|
-
if (
|
|
148
|
-
radio.invalid = this.
|
|
145
|
+
if (radio instanceof SdRadio) {
|
|
146
|
+
radio.invalid = this.showInvalidStyle;
|
|
149
147
|
}
|
|
150
148
|
})
|
|
151
149
|
);
|
|
152
|
-
this.hasButtonGroup = radios.some((radio) => radio.tagName.toLowerCase() === "sd-1-
|
|
150
|
+
this.hasButtonGroup = radios.some((radio) => radio.tagName.toLowerCase() === "sd-1-37-0-radio-button");
|
|
153
151
|
if (!radios.some((radio) => radio.checked)) {
|
|
154
152
|
if (this.hasButtonGroup) {
|
|
155
153
|
const buttonRadio = (_a = radios[0].shadowRoot) == null ? void 0 : _a.querySelector("button");
|
|
@@ -161,26 +159,26 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
161
159
|
}
|
|
162
160
|
}
|
|
163
161
|
if (this.hasButtonGroup) {
|
|
164
|
-
const buttonGroup = (_b = this.shadowRoot) == null ? void 0 : _b.querySelector("sd-1-
|
|
162
|
+
const buttonGroup = (_b = this.shadowRoot) == null ? void 0 : _b.querySelector("sd-1-37-0-button-group");
|
|
165
163
|
if (buttonGroup) {
|
|
166
164
|
buttonGroup.disableRole = true;
|
|
167
165
|
}
|
|
168
166
|
}
|
|
169
167
|
}
|
|
170
168
|
syncRadios() {
|
|
171
|
-
if (customElements.get("sd-1-
|
|
169
|
+
if (customElements.get("sd-1-37-0-radio") && customElements.get("sd-1-37-0-radio-button")) {
|
|
172
170
|
this.syncRadioElements();
|
|
173
171
|
return;
|
|
174
172
|
}
|
|
175
|
-
if (customElements.get("sd-1-
|
|
173
|
+
if (customElements.get("sd-1-37-0-radio")) {
|
|
176
174
|
this.syncRadioElements();
|
|
177
175
|
} else {
|
|
178
|
-
customElements.whenDefined("sd-1-
|
|
176
|
+
customElements.whenDefined("sd-1-37-0-radio").then(() => this.syncRadios());
|
|
179
177
|
}
|
|
180
|
-
if (customElements.get("sd-1-
|
|
178
|
+
if (customElements.get("sd-1-37-0-radio-button")) {
|
|
181
179
|
this.syncRadioElements();
|
|
182
180
|
} else {
|
|
183
|
-
customElements.whenDefined("sd-1-
|
|
181
|
+
customElements.whenDefined("sd-1-37-0-radio-button").then(() => this.syncRadios());
|
|
184
182
|
}
|
|
185
183
|
}
|
|
186
184
|
updateCheckedRadio() {
|
|
@@ -215,10 +213,8 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
215
213
|
return this.formControlController.getForm();
|
|
216
214
|
}
|
|
217
215
|
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
218
|
-
// TODO: https://github.com/solid-design-system/solid/issues/501
|
|
219
216
|
reportValidity() {
|
|
220
217
|
const isValid = this.validity.valid;
|
|
221
|
-
this.errorText = this.customValidityMessage || isValid ? "" : this.validationInput.validationMessage;
|
|
222
218
|
this.formControlController.setValidity(isValid);
|
|
223
219
|
this.validationInput.hidden = true;
|
|
224
220
|
clearTimeout(this.validationTimeout);
|
|
@@ -232,39 +228,38 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
232
228
|
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
|
233
229
|
setCustomValidity(message = "") {
|
|
234
230
|
this.customValidityMessage = message;
|
|
235
|
-
this.errorText = message;
|
|
236
231
|
this.validationInput.setCustomValidity(message);
|
|
237
232
|
this.formControlController.updateValidity();
|
|
238
233
|
}
|
|
239
234
|
render() {
|
|
240
235
|
const hasLabelSlot = this.hasSlotController.test("label");
|
|
241
|
-
const hasErrorTextSlot = this.hasSlotController.test("error-text");
|
|
242
236
|
const hasLabel = this.label ? true : !!hasLabelSlot;
|
|
243
|
-
const hasErrorText = this.errorText ? true : !!hasErrorTextSlot;
|
|
244
237
|
const defaultSlot = html`<slot @slotchange="${this.syncRadios}" @click="${this.handleRadioClick}" @keydown="${this.handleKeyDown}"></slot>`;
|
|
245
238
|
return html`<fieldset part="form-control" class="${cx(
|
|
246
|
-
"border-0 p-0 m-0",
|
|
247
|
-
hasErrorText && "text-error",
|
|
239
|
+
"border-0 p-0 m-0 flex flex-col",
|
|
248
240
|
{
|
|
249
241
|
/* sizes, fonts */
|
|
250
242
|
sm: "text-sm",
|
|
251
243
|
lg: "text-base"
|
|
252
244
|
}[this.size]
|
|
253
|
-
)}" role="radiogroup" aria-labelledby="label" aria-errormessage="error-text"><label part="form-control-label" id="label" class="${cx(
|
|
254
|
-
"
|
|
255
|
-
|
|
245
|
+
)}" role="radiogroup" aria-labelledby="label" aria-errormessage="error-text"><label part="form-control-label" id="label" class="${cx(
|
|
246
|
+
"mb-2 p-0 leading-normal text-black text-left",
|
|
247
|
+
!hasLabel && "hidden",
|
|
248
|
+
this.boldLabel && "font-bold"
|
|
249
|
+
)}" @click="${this.focus}" aria-hidden="${hasLabel ? "false" : "true"}"><slot name="label">${this.label}</slot></label><div part="form-control-input" class="${cx(
|
|
250
|
+
"flex",
|
|
256
251
|
{
|
|
257
252
|
vertical: "flex-col",
|
|
258
253
|
horizontal: "flex-row"
|
|
259
254
|
}[this.orientation]
|
|
260
|
-
)}"><div class="sr-only"><
|
|
255
|
+
)}"><div class="sr-only"><label><input id="validation-input" type="text" ?required="${this.required}" tabindex="-1" hidden @invalid="${this.handleInvalid}"></label></div>${this.hasButtonGroup ? html`<sd-1-37-0-button-group part="button-group" exportparts="base:button-group__base" role="presentation">${defaultSlot}</sd-1-37-0-button-group>` : defaultSlot}</div></fieldset>${this.formControlController.renderInvalidMessage()}`;
|
|
261
256
|
}
|
|
262
257
|
};
|
|
263
|
-
SdRadioGroup.dependencies = { "sd-1-
|
|
258
|
+
SdRadioGroup.dependencies = { "sd-1-37-0-button-group": SdButtonGroup };
|
|
264
259
|
SdRadioGroup.styles = [
|
|
265
260
|
componentStyles,
|
|
266
261
|
SolidElement.styles,
|
|
267
|
-
css`:host{display:block}:host([orientation=vertical]) ::slotted(sd-1-
|
|
262
|
+
css`:host{display:block}:host([orientation=vertical]) ::slotted(sd-1-37-0-radio){margin-bottom:var(--sd-spacing-2,.5rem);display:flex}:host([orientation=vertical]) ::slotted(sd-1-37-0-radio:last-of-type){margin-bottom:var(--sd-spacing-0,0)}:host([orientation=horizontal]) ::slotted(sd-1-37-0-radio){margin-right:var(--sd-spacing-6,1.5rem)}:host([orientation=horizontal]) ::slotted(sd-1-37-0-radio:last-of-type){margin-right:var(--sd-spacing-0,0)}:host([orientation=horizontal]):host([size=sm]) ::slotted(sd-1-37-0-radio){margin-right:var(--sd-spacing-4,1rem)}:host([orientation=horizontal]):host([size=sm]) ::slotted(sd-1-37-0-radio:last-of-type){margin-right:var(--sd-spacing-0,0)}:host([required]) #label::after{content:' *'}`
|
|
268
263
|
];
|
|
269
264
|
__decorateClass([
|
|
270
265
|
query("slot:not([name])")
|
|
@@ -272,6 +267,9 @@ __decorateClass([
|
|
|
272
267
|
__decorateClass([
|
|
273
268
|
query("#validation-input")
|
|
274
269
|
], SdRadioGroup.prototype, "validationInput", 2);
|
|
270
|
+
__decorateClass([
|
|
271
|
+
query("#invalid-message")
|
|
272
|
+
], SdRadioGroup.prototype, "invalidMessage", 2);
|
|
275
273
|
__decorateClass([
|
|
276
274
|
state()
|
|
277
275
|
], SdRadioGroup.prototype, "hasButtonGroup", 2);
|
|
@@ -280,13 +278,13 @@ __decorateClass([
|
|
|
280
278
|
], SdRadioGroup.prototype, "defaultValue", 2);
|
|
281
279
|
__decorateClass([
|
|
282
280
|
state()
|
|
283
|
-
], SdRadioGroup.prototype, "
|
|
284
|
-
__decorateClass([
|
|
285
|
-
state()
|
|
286
|
-
], SdRadioGroup.prototype, "errorText", 2);
|
|
281
|
+
], SdRadioGroup.prototype, "showInvalidStyle", 2);
|
|
287
282
|
__decorateClass([
|
|
288
283
|
property()
|
|
289
284
|
], SdRadioGroup.prototype, "label", 2);
|
|
285
|
+
__decorateClass([
|
|
286
|
+
property({ type: Boolean, reflect: true })
|
|
287
|
+
], SdRadioGroup.prototype, "boldLabel", 2);
|
|
290
288
|
__decorateClass([
|
|
291
289
|
property()
|
|
292
290
|
], SdRadioGroup.prototype, "name", 2);
|
|
@@ -309,13 +307,13 @@ __decorateClass([
|
|
|
309
307
|
watch("size", { waitUntilFirstUpdate: true })
|
|
310
308
|
], SdRadioGroup.prototype, "handleSizeChange", 1);
|
|
311
309
|
__decorateClass([
|
|
312
|
-
watch("
|
|
310
|
+
watch("showInvalidStyle", { waitUntilFirstUpdate: true })
|
|
313
311
|
], SdRadioGroup.prototype, "handleInvalidChange", 1);
|
|
314
312
|
__decorateClass([
|
|
315
313
|
watch("value")
|
|
316
314
|
], SdRadioGroup.prototype, "handleValueChange", 1);
|
|
317
315
|
SdRadioGroup = __decorateClass([
|
|
318
|
-
customElement("sd-1-
|
|
316
|
+
customElement("sd-1-37-0-radio-group")
|
|
319
317
|
], SdRadioGroup);
|
|
320
318
|
export {
|
|
321
319
|
SdRadioGroup as default
|
|
@@ -7,9 +7,9 @@ import type { TemplateResult } from 'lit';
|
|
|
7
7
|
import type SdOption from '../option/option';
|
|
8
8
|
export default class SdSelect extends SolidElement implements SolidFormControl {
|
|
9
9
|
static dependencies: {
|
|
10
|
-
'sd-1-
|
|
11
|
-
'sd-1-
|
|
12
|
-
'sd-1-
|
|
10
|
+
'sd-1-37-0-icon': typeof SdIcon;
|
|
11
|
+
'sd-1-37-0-popup': typeof SdPopup;
|
|
12
|
+
'sd-1-37-0-tag': typeof SdTag;
|
|
13
13
|
};
|
|
14
14
|
private readonly formControlController;
|
|
15
15
|
private readonly hasSlotController;
|
|
@@ -22,13 +22,14 @@ export default class SdSelect extends SolidElement implements SolidFormControl {
|
|
|
22
22
|
displayInput: HTMLInputElement;
|
|
23
23
|
valueInput: HTMLInputElement;
|
|
24
24
|
listbox: HTMLSlotElement;
|
|
25
|
+
invalidMessage: HTMLDivElement;
|
|
25
26
|
private hasFocus;
|
|
26
27
|
hasHover: boolean;
|
|
27
28
|
private displayLabel;
|
|
28
29
|
private currentOption;
|
|
29
30
|
private selectedOptions;
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
showValidStyle: boolean;
|
|
32
|
+
showInvalidStyle: boolean;
|
|
32
33
|
defaultValue: string | string[];
|
|
33
34
|
open: boolean;
|
|
34
35
|
size: 'lg' | 'md' | 'sm';
|
|
@@ -51,7 +52,6 @@ export default class SdSelect extends SolidElement implements SolidFormControl {
|
|
|
51
52
|
get validity(): ValidityState;
|
|
52
53
|
get validationMessage(): string;
|
|
53
54
|
connectedCallback(): void;
|
|
54
|
-
updated(): void;
|
|
55
55
|
private addOpenListeners;
|
|
56
56
|
private removeOpenListeners;
|
|
57
57
|
private handleFocus;
|
|
@@ -96,6 +96,6 @@ export default class SdSelect extends SolidElement implements SolidFormControl {
|
|
|
96
96
|
}
|
|
97
97
|
declare global {
|
|
98
98
|
interface HTMLElementTagNameMap {
|
|
99
|
-
'sd-1-
|
|
99
|
+
'sd-1-37-0-select': SdSelect;
|
|
100
100
|
}
|
|
101
101
|
}
|