@solid-design-system/components 1.35.1 → 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-button.js +1 -0
- 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-components2.js +1 -1
- 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 +19 -19
- 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-button/radio-button.d.ts +25 -0
- package/dist/package/components/radio-button/radio-button.js +118 -0
- package/dist/package/components/radio-group/radio-group.d.ts +4 -3
- package/dist/package/components/radio-group/radio-group.js +26 -26
- 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/solid-components.d.ts +1 -0
- package/dist/package/solid-components.js +20 -18
- 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 -0
- 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-components2.js +1 -1
- 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 +25 -0
- package/dist/versioned-package/components/radio-button/radio-button.js +118 -0
- package/dist/versioned-package/components/radio-group/radio-group.d.ts +6 -5
- package/dist/versioned-package/components/radio-group/radio-group.js +39 -39
- 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/solid-components.d.ts +1 -0
- package/dist/versioned-package/solid-components.js +20 -18
- 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 +107 -33
- package/dist/web-types.json +177 -18
- package/package.json +5 -4
- 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
|
@@ -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,10 +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
|
-
radio
|
|
145
|
+
if (radio instanceof SdRadio) {
|
|
146
|
+
radio.invalid = this.showInvalidStyle;
|
|
147
|
+
}
|
|
148
148
|
})
|
|
149
149
|
);
|
|
150
|
-
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");
|
|
151
151
|
if (!radios.some((radio) => radio.checked)) {
|
|
152
152
|
if (this.hasButtonGroup) {
|
|
153
153
|
const buttonRadio = (_a = radios[0].shadowRoot) == null ? void 0 : _a.querySelector("button");
|
|
@@ -159,26 +159,26 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
if (this.hasButtonGroup) {
|
|
162
|
-
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");
|
|
163
163
|
if (buttonGroup) {
|
|
164
164
|
buttonGroup.disableRole = true;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
syncRadios() {
|
|
169
|
-
if (customElements.get("sd-1-
|
|
169
|
+
if (customElements.get("sd-1-37-0-radio") && customElements.get("sd-1-37-0-radio-button")) {
|
|
170
170
|
this.syncRadioElements();
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
|
-
if (customElements.get("sd-1-
|
|
173
|
+
if (customElements.get("sd-1-37-0-radio")) {
|
|
174
174
|
this.syncRadioElements();
|
|
175
175
|
} else {
|
|
176
|
-
customElements.whenDefined("sd-1-
|
|
176
|
+
customElements.whenDefined("sd-1-37-0-radio").then(() => this.syncRadios());
|
|
177
177
|
}
|
|
178
|
-
if (customElements.get("sd-1-
|
|
178
|
+
if (customElements.get("sd-1-37-0-radio-button")) {
|
|
179
179
|
this.syncRadioElements();
|
|
180
180
|
} else {
|
|
181
|
-
customElements.whenDefined("sd-1-
|
|
181
|
+
customElements.whenDefined("sd-1-37-0-radio-button").then(() => this.syncRadios());
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
updateCheckedRadio() {
|
|
@@ -213,10 +213,8 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
213
213
|
return this.formControlController.getForm();
|
|
214
214
|
}
|
|
215
215
|
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
216
|
-
// TODO: https://github.com/solid-design-system/solid/issues/501
|
|
217
216
|
reportValidity() {
|
|
218
217
|
const isValid = this.validity.valid;
|
|
219
|
-
this.errorText = this.customValidityMessage || isValid ? "" : this.validationInput.validationMessage;
|
|
220
218
|
this.formControlController.setValidity(isValid);
|
|
221
219
|
this.validationInput.hidden = true;
|
|
222
220
|
clearTimeout(this.validationTimeout);
|
|
@@ -230,39 +228,38 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
230
228
|
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
|
231
229
|
setCustomValidity(message = "") {
|
|
232
230
|
this.customValidityMessage = message;
|
|
233
|
-
this.errorText = message;
|
|
234
231
|
this.validationInput.setCustomValidity(message);
|
|
235
232
|
this.formControlController.updateValidity();
|
|
236
233
|
}
|
|
237
234
|
render() {
|
|
238
235
|
const hasLabelSlot = this.hasSlotController.test("label");
|
|
239
|
-
const hasErrorTextSlot = this.hasSlotController.test("error-text");
|
|
240
236
|
const hasLabel = this.label ? true : !!hasLabelSlot;
|
|
241
|
-
const hasErrorText = this.errorText ? true : !!hasErrorTextSlot;
|
|
242
237
|
const defaultSlot = html`<slot @slotchange="${this.syncRadios}" @click="${this.handleRadioClick}" @keydown="${this.handleKeyDown}"></slot>`;
|
|
243
238
|
return html`<fieldset part="form-control" class="${cx(
|
|
244
|
-
"border-0 p-0 m-0",
|
|
245
|
-
hasErrorText && "text-error",
|
|
239
|
+
"border-0 p-0 m-0 flex flex-col",
|
|
246
240
|
{
|
|
247
241
|
/* sizes, fonts */
|
|
248
242
|
sm: "text-sm",
|
|
249
243
|
lg: "text-base"
|
|
250
244
|
}[this.size]
|
|
251
|
-
)}" role="radiogroup" aria-labelledby="label" aria-errormessage="error-text"><label part="form-control-label" id="label" class="${cx(
|
|
252
|
-
"
|
|
253
|
-
|
|
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",
|
|
254
251
|
{
|
|
255
252
|
vertical: "flex-col",
|
|
256
253
|
horizontal: "flex-row"
|
|
257
254
|
}[this.orientation]
|
|
258
|
-
)}"><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()}`;
|
|
259
256
|
}
|
|
260
257
|
};
|
|
261
|
-
SdRadioGroup.dependencies = { "sd-1-
|
|
258
|
+
SdRadioGroup.dependencies = { "sd-1-37-0-button-group": SdButtonGroup };
|
|
262
259
|
SdRadioGroup.styles = [
|
|
263
260
|
componentStyles,
|
|
264
261
|
SolidElement.styles,
|
|
265
|
-
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:' *'}`
|
|
266
263
|
];
|
|
267
264
|
__decorateClass([
|
|
268
265
|
query("slot:not([name])")
|
|
@@ -270,6 +267,9 @@ __decorateClass([
|
|
|
270
267
|
__decorateClass([
|
|
271
268
|
query("#validation-input")
|
|
272
269
|
], SdRadioGroup.prototype, "validationInput", 2);
|
|
270
|
+
__decorateClass([
|
|
271
|
+
query("#invalid-message")
|
|
272
|
+
], SdRadioGroup.prototype, "invalidMessage", 2);
|
|
273
273
|
__decorateClass([
|
|
274
274
|
state()
|
|
275
275
|
], SdRadioGroup.prototype, "hasButtonGroup", 2);
|
|
@@ -278,13 +278,13 @@ __decorateClass([
|
|
|
278
278
|
], SdRadioGroup.prototype, "defaultValue", 2);
|
|
279
279
|
__decorateClass([
|
|
280
280
|
state()
|
|
281
|
-
], SdRadioGroup.prototype, "
|
|
282
|
-
__decorateClass([
|
|
283
|
-
state()
|
|
284
|
-
], SdRadioGroup.prototype, "errorText", 2);
|
|
281
|
+
], SdRadioGroup.prototype, "showInvalidStyle", 2);
|
|
285
282
|
__decorateClass([
|
|
286
283
|
property()
|
|
287
284
|
], SdRadioGroup.prototype, "label", 2);
|
|
285
|
+
__decorateClass([
|
|
286
|
+
property({ type: Boolean, reflect: true })
|
|
287
|
+
], SdRadioGroup.prototype, "boldLabel", 2);
|
|
288
288
|
__decorateClass([
|
|
289
289
|
property()
|
|
290
290
|
], SdRadioGroup.prototype, "name", 2);
|
|
@@ -307,13 +307,13 @@ __decorateClass([
|
|
|
307
307
|
watch("size", { waitUntilFirstUpdate: true })
|
|
308
308
|
], SdRadioGroup.prototype, "handleSizeChange", 1);
|
|
309
309
|
__decorateClass([
|
|
310
|
-
watch("
|
|
310
|
+
watch("showInvalidStyle", { waitUntilFirstUpdate: true })
|
|
311
311
|
], SdRadioGroup.prototype, "handleInvalidChange", 1);
|
|
312
312
|
__decorateClass([
|
|
313
313
|
watch("value")
|
|
314
314
|
], SdRadioGroup.prototype, "handleValueChange", 1);
|
|
315
315
|
SdRadioGroup = __decorateClass([
|
|
316
|
-
customElement("sd-1-
|
|
316
|
+
customElement("sd-1-37-0-radio-group")
|
|
317
317
|
], SdRadioGroup);
|
|
318
318
|
export {
|
|
319
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
|
}
|
|
@@ -13,7 +13,6 @@ import { waitForEvent } from "../../internal/event.js";
|
|
|
13
13
|
import { watch } from "../../internal/watch.js";
|
|
14
14
|
import componentStyles from "../../styles/component.styles.js";
|
|
15
15
|
import cx from "classix";
|
|
16
|
-
import formControlStyles from "../../styles/form-control.styles.js";
|
|
17
16
|
import SdIcon from "../icon/icon.js";
|
|
18
17
|
import SdPopup from "../popup/popup.js";
|
|
19
18
|
import SdTag from "../tag/tag.js";
|
|
@@ -33,7 +32,7 @@ let SdSelect = class extends SolidElement {
|
|
|
33
32
|
constructor() {
|
|
34
33
|
super(...arguments);
|
|
35
34
|
this.formControlController = new FormControlController(this, {
|
|
36
|
-
assumeInteractionOn: ["sd-blur", "sd-1-
|
|
35
|
+
assumeInteractionOn: ["sd-blur", "sd-1-37-0-input"]
|
|
37
36
|
});
|
|
38
37
|
this.hasSlotController = new HasSlotController(this, "help-text", "label");
|
|
39
38
|
this.localize = new LocalizeController(this);
|
|
@@ -42,12 +41,12 @@ let SdSelect = class extends SolidElement {
|
|
|
42
41
|
this.hasHover = false;
|
|
43
42
|
this.displayLabel = "";
|
|
44
43
|
this.selectedOptions = [];
|
|
45
|
-
this.
|
|
46
|
-
this.
|
|
44
|
+
this.showValidStyle = false;
|
|
45
|
+
this.showInvalidStyle = false;
|
|
47
46
|
this.defaultValue = "";
|
|
48
47
|
this.open = false;
|
|
49
48
|
this.size = "lg";
|
|
50
|
-
this.label = "
|
|
49
|
+
this.label = "";
|
|
51
50
|
this.placeholder = this.localize.term("selectDefaultPlaceholder");
|
|
52
51
|
this.helpText = "";
|
|
53
52
|
this.placement = "bottom";
|
|
@@ -63,11 +62,11 @@ let SdSelect = class extends SolidElement {
|
|
|
63
62
|
this.required = false;
|
|
64
63
|
this.hoist = false;
|
|
65
64
|
this.getTag = (option) => {
|
|
66
|
-
return html`<sd-1-
|
|
65
|
+
return html`<sd-1-37-0-tag ?disabled="${this.disabled}" part="tag" exportparts="
|
|
67
66
|
base:tag__base,
|
|
68
67
|
content:tag__content,
|
|
69
68
|
removable-indicator:tag__removable-indicator,
|
|
70
|
-
" size="${this.size === "sm" ? "sm" : "lg"}" removable @sd-remove="${(event) => this.handleTagRemove(event, option)}">${option.getTextLabel()}</sd-1-
|
|
69
|
+
" size="${this.size === "sm" ? "sm" : "lg"}" removable @sd-remove="${(event) => this.handleTagRemove(event, option)}">${option.getTextLabel()}</sd-1-37-0-tag>`;
|
|
71
70
|
};
|
|
72
71
|
this.handleDocumentFocusIn = (event) => {
|
|
73
72
|
const path = event.composedPath();
|
|
@@ -78,7 +77,7 @@ let SdSelect = class extends SolidElement {
|
|
|
78
77
|
this.handleDocumentKeyDown = (event) => {
|
|
79
78
|
const target = event.target;
|
|
80
79
|
const isClearButton = target.closest(".select__clear") !== null;
|
|
81
|
-
const isIconButton = target.closest("sd-1-
|
|
80
|
+
const isIconButton = target.closest("sd-1-37-0-icon-button") !== null;
|
|
82
81
|
if (isClearButton || isIconButton) {
|
|
83
82
|
return;
|
|
84
83
|
}
|
|
@@ -102,7 +101,7 @@ let SdSelect = class extends SolidElement {
|
|
|
102
101
|
this.setSelectedOptions(this.currentOption);
|
|
103
102
|
}
|
|
104
103
|
this.updateComplete.then(() => {
|
|
105
|
-
this.emit("sd-1-
|
|
104
|
+
this.emit("sd-1-37-0-input");
|
|
106
105
|
this.emit("sd-change");
|
|
107
106
|
});
|
|
108
107
|
if (!this.multiple) {
|
|
@@ -187,15 +186,6 @@ let SdSelect = class extends SolidElement {
|
|
|
187
186
|
this.applySizeToOptions();
|
|
188
187
|
this.open = false;
|
|
189
188
|
}
|
|
190
|
-
/** Checks for the presence of the attributes 'data-user-valid' or 'data-user-invalid' and updates the corresponding state for reactive conditional styling. */
|
|
191
|
-
updated() {
|
|
192
|
-
if (this.hasAttribute("data-user-valid") && this.checkValidity()) {
|
|
193
|
-
this.isValid = true;
|
|
194
|
-
}
|
|
195
|
-
if (this.hasAttribute("data-user-invalid") && !this.checkValidity()) {
|
|
196
|
-
this.isInvalid = true;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
189
|
addOpenListeners() {
|
|
200
190
|
document.addEventListener("focusin", this.handleDocumentFocusIn);
|
|
201
191
|
document.addEventListener("keydown", this.handleDocumentKeyDown);
|
|
@@ -239,7 +229,7 @@ let SdSelect = class extends SolidElement {
|
|
|
239
229
|
this.displayInput.focus({ preventScroll: true });
|
|
240
230
|
this.updateComplete.then(() => {
|
|
241
231
|
this.emit("sd-clear");
|
|
242
|
-
this.emit("sd-1-
|
|
232
|
+
this.emit("sd-1-37-0-input");
|
|
243
233
|
this.emit("sd-change");
|
|
244
234
|
});
|
|
245
235
|
}
|
|
@@ -250,7 +240,7 @@ let SdSelect = class extends SolidElement {
|
|
|
250
240
|
}
|
|
251
241
|
handleOptionClick(event) {
|
|
252
242
|
const target = event.target;
|
|
253
|
-
const option = target.closest("sd-1-
|
|
243
|
+
const option = target.closest("sd-1-37-0-option");
|
|
254
244
|
const oldValue = this.value;
|
|
255
245
|
if (option && !option.disabled) {
|
|
256
246
|
if (this.multiple) {
|
|
@@ -261,7 +251,7 @@ let SdSelect = class extends SolidElement {
|
|
|
261
251
|
this.updateComplete.then(() => this.displayInput.focus({ preventScroll: true }));
|
|
262
252
|
if (this.value !== oldValue) {
|
|
263
253
|
this.updateComplete.then(() => {
|
|
264
|
-
this.emit("sd-1-
|
|
254
|
+
this.emit("sd-1-37-0-input");
|
|
265
255
|
this.emit("sd-change");
|
|
266
256
|
});
|
|
267
257
|
}
|
|
@@ -275,7 +265,7 @@ let SdSelect = class extends SolidElement {
|
|
|
275
265
|
const allOptions = this.getAllOptions();
|
|
276
266
|
const value = Array.isArray(this.value) ? this.value : [this.value];
|
|
277
267
|
const values = [];
|
|
278
|
-
if (customElements.get("sd-1-
|
|
268
|
+
if (customElements.get("sd-1-37-0-option")) {
|
|
279
269
|
allOptions.forEach((option) => {
|
|
280
270
|
if (this.multiple) {
|
|
281
271
|
option.checkbox = true;
|
|
@@ -284,7 +274,7 @@ let SdSelect = class extends SolidElement {
|
|
|
284
274
|
});
|
|
285
275
|
this.setSelectedOptions(allOptions.filter((el) => value.includes(el.value)));
|
|
286
276
|
} else {
|
|
287
|
-
customElements.whenDefined("sd-1-
|
|
277
|
+
customElements.whenDefined("sd-1-37-0-option").then(() => this.handleDefaultSlotChange());
|
|
288
278
|
}
|
|
289
279
|
}
|
|
290
280
|
handleTagRemove(event, option) {
|
|
@@ -292,18 +282,18 @@ let SdSelect = class extends SolidElement {
|
|
|
292
282
|
if (!this.disabled) {
|
|
293
283
|
this.toggleOptionSelection(option, false);
|
|
294
284
|
this.updateComplete.then(() => {
|
|
295
|
-
this.emit("sd-1-
|
|
285
|
+
this.emit("sd-1-37-0-input");
|
|
296
286
|
this.emit("sd-change");
|
|
297
287
|
});
|
|
298
288
|
}
|
|
299
289
|
}
|
|
300
|
-
// Gets an array of all <sd-1-
|
|
290
|
+
// Gets an array of all <sd-1-37-0-option> elements
|
|
301
291
|
getAllOptions() {
|
|
302
|
-
return [...this.querySelectorAll("sd-1-
|
|
292
|
+
return [...this.querySelectorAll("sd-1-37-0-option")];
|
|
303
293
|
}
|
|
304
|
-
// Gets the first <sd-1-
|
|
294
|
+
// Gets the first <sd-1-37-0-option> element
|
|
305
295
|
getFirstOption() {
|
|
306
|
-
return this.querySelector("sd-1-
|
|
296
|
+
return this.querySelector("sd-1-37-0-option");
|
|
307
297
|
}
|
|
308
298
|
// Sets the current option, which is the option the user is currently interacting with (e.g. via keyboard). Only one
|
|
309
299
|
// option may be "current" at a time.
|
|
@@ -365,7 +355,7 @@ let SdSelect = class extends SolidElement {
|
|
|
365
355
|
const tag = this.getTag(option, index);
|
|
366
356
|
return html`<div @sd-remove="${(e) => this.handleTagRemove(e, option)}">${typeof tag === "string" ? unsafeHTML(tag) : tag}</div>`;
|
|
367
357
|
} else if (index === this.maxOptionsVisible) {
|
|
368
|
-
return html`<sd-1-
|
|
358
|
+
return html`<sd-1-37-0-tag size="${this.size === "sm" ? "sm" : "lg"}" ?disabled="${this.disabled}">+${this.selectedOptions.length - index}</sd-1-37-0-tag>`;
|
|
369
359
|
}
|
|
370
360
|
return html``;
|
|
371
361
|
});
|
|
@@ -373,6 +363,7 @@ let SdSelect = class extends SolidElement {
|
|
|
373
363
|
handleInvalid(event) {
|
|
374
364
|
this.formControlController.setValidity(false);
|
|
375
365
|
this.formControlController.emitInvalidEvent(event);
|
|
366
|
+
this.invalidMessage.textContent = event.target.validationMessage;
|
|
376
367
|
}
|
|
377
368
|
handleMouseEnter() {
|
|
378
369
|
this.hasHover = true;
|
|
@@ -380,7 +371,7 @@ let SdSelect = class extends SolidElement {
|
|
|
380
371
|
handleMouseLeave() {
|
|
381
372
|
this.hasHover = false;
|
|
382
373
|
}
|
|
383
|
-
/** Receives incoming event detail from sd-1-
|
|
374
|
+
/** Receives incoming event detail from sd-1-37-0-popup and updates local state for conditional styling. */
|
|
384
375
|
handleCurrentPlacement(e) {
|
|
385
376
|
const incomingPlacement = e.detail;
|
|
386
377
|
if (incomingPlacement) {
|
|
@@ -389,7 +380,7 @@ let SdSelect = class extends SolidElement {
|
|
|
389
380
|
}
|
|
390
381
|
handleUseTagsChange() {
|
|
391
382
|
const allOptions = this.getAllOptions();
|
|
392
|
-
if (customElements.get("sd-1-
|
|
383
|
+
if (customElements.get("sd-1-37-0-option")) {
|
|
393
384
|
allOptions.forEach((option) => {
|
|
394
385
|
option.checkbox = this.multiple;
|
|
395
386
|
});
|
|
@@ -494,7 +485,7 @@ let SdSelect = class extends SolidElement {
|
|
|
494
485
|
const hasLabel = this.label ? true : !!slots["label"];
|
|
495
486
|
const hasHelpText = this.helpText ? true : !!slots["helpText"];
|
|
496
487
|
const hasClearIcon = this.clearable && !this.disabled && this.value.length > 0;
|
|
497
|
-
const selectState = this.disabled ? "disabled" : this.hasFocus && this.
|
|
488
|
+
const selectState = this.disabled ? "disabled" : this.hasFocus && this.showInvalidStyle ? "activeInvalid" : this.hasFocus && this.showValidStyle ? "activeValid" : this.hasFocus || this.open ? "active" : this.showInvalidStyle ? "invalid" : this.showValidStyle ? "valid" : "default";
|
|
498
489
|
const cursorStyles = this.disabled ? "cursor-not-allowed" : "cursor-pointer";
|
|
499
490
|
const iconMarginLeft = { sm: "ml-1", md: "ml-2", lg: "ml-2" }[this.size];
|
|
500
491
|
const iconSize = {
|
|
@@ -503,9 +494,12 @@ let SdSelect = class extends SolidElement {
|
|
|
503
494
|
lg: "text-xl"
|
|
504
495
|
}[this.size];
|
|
505
496
|
return html`<div part="form-control" class="${cx(
|
|
506
|
-
"
|
|
497
|
+
"relative text-left",
|
|
507
498
|
cursorStyles,
|
|
508
499
|
this.size === "sm" ? "text-sm" : "text-base",
|
|
500
|
+
this.open && "z-50"
|
|
501
|
+
)}"><label id="label" part="form-control-label" class="${hasLabel && "inline-block mb-2"}" aria-hidden="${hasLabel ? "false" : "true"}" @click="${this.handleLabelClick}"><slot name="label">${this.label}</slot></label><div part="form-control-input" class="${cx(
|
|
502
|
+
"relative w-full bg-white",
|
|
509
503
|
{
|
|
510
504
|
disabled: "text-neutral-500",
|
|
511
505
|
readonly: "text-black",
|
|
@@ -515,9 +509,8 @@ let SdSelect = class extends SolidElement {
|
|
|
515
509
|
invalid: "text-error",
|
|
516
510
|
valid: "text-success",
|
|
517
511
|
default: "text-black"
|
|
518
|
-
}[selectState]
|
|
519
|
-
|
|
520
|
-
)}"><label id="label" part="form-control-label" class="${hasLabel && "inline-block mb-2"}" aria-hidden="${hasLabel ? "false" : "true"}" @click="${this.handleLabelClick}"><slot name="label" class="${cx(this.disabled && "text-black")}">${this.label}</slot></label><div part="form-control-input" class="${cx("relative w-full bg-white")}"><div part="border" class="${cx(
|
|
512
|
+
}[selectState]
|
|
513
|
+
)}"><div part="border" class="${cx(
|
|
521
514
|
"absolute top-0 w-full h-full pointer-events-none border rounded-default",
|
|
522
515
|
this.hasHover && "bg-neutral-200",
|
|
523
516
|
{
|
|
@@ -531,7 +524,7 @@ let SdSelect = class extends SolidElement {
|
|
|
531
524
|
default: "border-neutral-800"
|
|
532
525
|
}[selectState],
|
|
533
526
|
this.open && (this.currentPlacement === "bottom" ? "rounded-bl-none rounded-br-none" : "rounded-tl-none rounded-tr-none")
|
|
534
|
-
)}"></div><sd-1-
|
|
527
|
+
)}"></div><sd-1-37-0-popup @sd-current-placement="${this.handleCurrentPlacement}" class="${cx(
|
|
535
528
|
"inline-flex relative w-full",
|
|
536
529
|
this.currentPlacement === "bottom" ? "origin-top" : "origin-bottom"
|
|
537
530
|
)}" placement="${this.placement}" strategy="${this.hoist ? "fixed" : "absolute"}" flip shift sync="width" auto-size="vertical" auto-size-padding="10"><div part="combobox" class="${cx(
|
|
@@ -545,28 +538,27 @@ let SdSelect = class extends SolidElement {
|
|
|
545
538
|
"appearance-none outline-none flex-grow bg-transparent",
|
|
546
539
|
cursorStyles,
|
|
547
540
|
this.multiple && this.useTags && this.value.length > 0 ? "hidden" : ""
|
|
548
|
-
)}" type="text" placeholder="${this.placeholder}" .disabled="${this.disabled}" .value="${this.displayLabel}" autocomplete="off" spellcheck="false" autocapitalize="off" readonly="readonly" aria-controls="listbox" aria-expanded="${this.open ? "true" : "false"}" aria-haspopup="listbox" aria-labelledby="label" aria-disabled="${this.disabled ? "true" : "false"}" aria-describedby="help-text" role="combobox" tabindex="0" @focus="${this.handleFocus}" @blur="${this.handleBlur}"> ${this.multiple && this.useTags ? html`<div part="tags" class="flex-grow flex flex-wrap items-center gap-1">${this.tags}</div>` : ""} <input class="${cx("value-input absolute top-0 left-0 w-full h-full opacity-0 -z-10", cursorStyles)}" type="text" ?disabled="${this.disabled}" ?required="${this.required}" .value="${Array.isArray(this.value) ? this.value.join(", ") : this.value}" tabindex="-1" aria-hidden="true" @focus="${() => this.focus()}" @invalid="${this.handleInvalid}"> ${hasClearIcon ? html`<button part="clear-button" class="${cx("select__clear flex justify-center", iconMarginLeft)}" type="button" aria-label="${this.localize.term("clearEntry")}" @mousedown="${this.handleClearMouseDown}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-1-
|
|
541
|
+
)}" type="text" placeholder="${this.placeholder}" .disabled="${this.disabled}" .value="${this.displayLabel}" autocomplete="off" spellcheck="false" autocapitalize="off" readonly="readonly" aria-controls="listbox" aria-expanded="${this.open ? "true" : "false"}" aria-haspopup="listbox" aria-labelledby="label" aria-disabled="${this.disabled ? "true" : "false"}" aria-describedby="help-text" role="combobox" tabindex="0" @focus="${this.handleFocus}" @blur="${this.handleBlur}"> ${this.multiple && this.useTags ? html`<div part="tags" class="flex-grow flex flex-wrap items-center gap-1">${this.tags}</div>` : ""} <input class="${cx("value-input absolute top-0 left-0 w-full h-full opacity-0 -z-10", cursorStyles)}" type="text" ?disabled="${this.disabled}" ?required="${this.required}" .value="${Array.isArray(this.value) ? this.value.join(", ") : this.value}" tabindex="-1" aria-hidden="true" @focus="${() => this.focus()}" @invalid="${this.handleInvalid}"> ${hasClearIcon ? html`<button part="clear-button" class="${cx("select__clear flex justify-center", iconMarginLeft)}" type="button" aria-label="${this.localize.term("clearEntry")}" @mousedown="${this.handleClearMouseDown}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-1-37-0-icon class="${cx("text-neutral-500", iconSize)}" library="system" name="closing-round"></sd-1-37-0-icon></slot></button>` : ""} ${this.showInvalidStyle ? html`<sd-1-37-0-icon class="${cx("text-error", iconMarginLeft, iconSize)}" library="system" name="risk"></sd-1-37-0-icon>` : ""} ${this.showValidStyle ? html`<sd-1-37-0-icon class="${cx("text-success", iconMarginLeft, iconSize)}" library="system" name="confirm"></sd-1-37-0-icon>` : ""}<slot name="expand-icon" part="expand-icon" class="${cx("inline-flex ml-2 transition-all", this.open ? "rotate-180" : "rotate-0", iconSize)}"><sd-1-37-0-icon name="chevron-down" part="chevron" library="system" color="currentColor"></sd-1-37-0-icon></slot></div><div id="listbox" role="listbox" aria-expanded="${this.open ? "true" : "false"}" aria-multiselectable="${this.multiple ? "true" : "false"}" aria-labelledby="label" part="listbox" class="${cx(
|
|
549
542
|
"bg-white px-2 py-3 relative",
|
|
550
543
|
this.currentPlacement === "bottom" ? "border-r-2 border-b-2 border-l-2 rounded-br-default rounded-bl-default" : "border-r-2 border-t-2 border-l-2 rounded-tr-default rounded-tl-default"
|
|
551
|
-
)}" tabindex="-1" @mouseup="${this.handleOptionClick}" @slotchange="${this.handleDefaultSlotChange}"><slot></slot></div></sd-1-
|
|
544
|
+
)}" tabindex="-1" @mouseup="${this.handleOptionClick}" @slotchange="${this.handleDefaultSlotChange}"><slot></slot></div></sd-1-37-0-popup></div><div class="text-sm text-neutral-700" part="form-control-help-text" id="help-text" aria-hidden="${hasHelpText ? "false" : "true"}"><slot name="help-text">${this.helpText}</slot></div></div>${this.formControlController.renderInvalidMessage()}`;
|
|
552
545
|
}
|
|
553
546
|
};
|
|
554
547
|
SdSelect.dependencies = {
|
|
555
|
-
"sd-1-
|
|
556
|
-
"sd-1-
|
|
557
|
-
"sd-1-
|
|
548
|
+
"sd-1-37-0-icon": SdIcon,
|
|
549
|
+
"sd-1-37-0-popup": SdPopup,
|
|
550
|
+
"sd-1-37-0-tag": SdTag
|
|
558
551
|
};
|
|
559
552
|
SdSelect.styles = [
|
|
560
553
|
componentStyles,
|
|
561
|
-
formControlStyles,
|
|
562
554
|
SolidElement.styles,
|
|
563
|
-
css`:host{position:relative;display:block;width:100%}:host([required]) #label::after{content:' *'}sd-1-
|
|
555
|
+
css`:host{position:relative;display:block;width:100%}:host([required]) #label::after{content:' *'}sd-1-37-0-popup::part(popup){overflow-y:scroll}sd-1-37-0-tag::part(base){border-radius:var(--sd-border-radius-default,.25rem);padding-left:var(--sd-spacing-1,.25rem);padding-right:var(--sd-spacing-1,.25rem)}sd-1-37-0-tag[size=lg]::part(base){padding-left:var(--sd-spacing-2,.5rem);padding-right:var(--sd-spacing-2,.5rem)}sd-1-37-0-tag[disabled=false]::part(base):hover{--tw-bg-opacity:1;background-color:rgb(var(--sd-color-primary-100,236 240 249) / var(--tw-bg-opacity))}`
|
|
564
556
|
];
|
|
565
557
|
__decorateClass([
|
|
566
|
-
queryAssignedElements({ selector: "sd-1-
|
|
558
|
+
queryAssignedElements({ selector: "sd-1-37-0-option" })
|
|
567
559
|
], SdSelect.prototype, "_optionsInDefaultSlot", 2);
|
|
568
560
|
__decorateClass([
|
|
569
|
-
query("sd-1-
|
|
561
|
+
query("sd-1-37-0-popup")
|
|
570
562
|
], SdSelect.prototype, "popup", 2);
|
|
571
563
|
__decorateClass([
|
|
572
564
|
query('[part="combobox"]')
|
|
@@ -580,6 +572,9 @@ __decorateClass([
|
|
|
580
572
|
__decorateClass([
|
|
581
573
|
query('[part="listbox"]')
|
|
582
574
|
], SdSelect.prototype, "listbox", 2);
|
|
575
|
+
__decorateClass([
|
|
576
|
+
query("#invalid-message")
|
|
577
|
+
], SdSelect.prototype, "invalidMessage", 2);
|
|
583
578
|
__decorateClass([
|
|
584
579
|
state()
|
|
585
580
|
], SdSelect.prototype, "hasFocus", 2);
|
|
@@ -597,10 +592,10 @@ __decorateClass([
|
|
|
597
592
|
], SdSelect.prototype, "selectedOptions", 2);
|
|
598
593
|
__decorateClass([
|
|
599
594
|
state()
|
|
600
|
-
], SdSelect.prototype, "
|
|
595
|
+
], SdSelect.prototype, "showValidStyle", 2);
|
|
601
596
|
__decorateClass([
|
|
602
597
|
state()
|
|
603
|
-
], SdSelect.prototype, "
|
|
598
|
+
], SdSelect.prototype, "showInvalidStyle", 2);
|
|
604
599
|
__decorateClass([
|
|
605
600
|
defaultValue()
|
|
606
601
|
], SdSelect.prototype, "defaultValue", 2);
|
|
@@ -679,7 +674,7 @@ __decorateClass([
|
|
|
679
674
|
watch("value", { waitUntilFirstUpdate: true })
|
|
680
675
|
], SdSelect.prototype, "handleValueChange", 1);
|
|
681
676
|
SdSelect = __decorateClass([
|
|
682
|
-
customElement("sd-1-
|
|
677
|
+
customElement("sd-1-37-0-select")
|
|
683
678
|
], SdSelect);
|
|
684
679
|
setDefaultAnimation("select.show", {
|
|
685
680
|
keyframes: [
|
|
@@ -3,6 +3,8 @@ import type { SolidFormControl } from '../../internal/solid-element';
|
|
|
3
3
|
export default class SdSwitch extends SolidElement implements SolidFormControl {
|
|
4
4
|
private readonly formControlController;
|
|
5
5
|
input: HTMLInputElement;
|
|
6
|
+
invalidMessage: HTMLDivElement;
|
|
7
|
+
showInvalidStyle: boolean;
|
|
6
8
|
title: string;
|
|
7
9
|
name: string;
|
|
8
10
|
value: string;
|
|
@@ -32,6 +34,6 @@ export default class SdSwitch extends SolidElement implements SolidFormControl {
|
|
|
32
34
|
}
|
|
33
35
|
declare global {
|
|
34
36
|
interface HTMLElementTagNameMap {
|
|
35
|
-
'sd-1-
|
|
37
|
+
'sd-1-37-0-switch': SdSwitch;
|
|
36
38
|
}
|
|
37
39
|
}
|