@solid-design-system/components 1.36.0 → 1.37.1
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/teaser.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/teaser/teaser.js +5 -1
- 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 +6 -2
- 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
|
@@ -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-1-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-1-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-1-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-1-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-1-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-1-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-1-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-1-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-1-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-1-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-1-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-1-option> elements
|
|
301
291
|
getAllOptions() {
|
|
302
|
-
return [...this.querySelectorAll("sd-1-
|
|
292
|
+
return [...this.querySelectorAll("sd-1-37-1-option")];
|
|
303
293
|
}
|
|
304
|
-
// Gets the first <sd-1-
|
|
294
|
+
// Gets the first <sd-1-37-1-option> element
|
|
305
295
|
getFirstOption() {
|
|
306
|
-
return this.querySelector("sd-1-
|
|
296
|
+
return this.querySelector("sd-1-37-1-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-1-tag size="${this.size === "sm" ? "sm" : "lg"}" ?disabled="${this.disabled}">+${this.selectedOptions.length - index}</sd-1-37-1-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-1-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-1-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-1-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-1-icon class="${cx("text-neutral-500", iconSize)}" library="system" name="closing-round"></sd-1-37-1-icon></slot></button>` : ""} ${this.showInvalidStyle ? html`<sd-1-37-1-icon class="${cx("text-error", iconMarginLeft, iconSize)}" library="system" name="risk"></sd-1-37-1-icon>` : ""} ${this.showValidStyle ? html`<sd-1-37-1-icon class="${cx("text-success", iconMarginLeft, iconSize)}" library="system" name="confirm"></sd-1-37-1-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-1-icon name="chevron-down" part="chevron" library="system" color="currentColor"></sd-1-37-1-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-1-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-1-icon": SdIcon,
|
|
549
|
+
"sd-1-37-1-popup": SdPopup,
|
|
550
|
+
"sd-1-37-1-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-1-popup::part(popup){overflow-y:scroll}sd-1-37-1-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-1-tag[size=lg]::part(base){padding-left:var(--sd-spacing-2,.5rem);padding-right:var(--sd-spacing-2,.5rem)}sd-1-37-1-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-1-option" })
|
|
567
559
|
], SdSelect.prototype, "_optionsInDefaultSlot", 2);
|
|
568
560
|
__decorateClass([
|
|
569
|
-
query("sd-1-
|
|
561
|
+
query("sd-1-37-1-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-1-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-1-switch': SdSwitch;
|
|
36
38
|
}
|
|
37
39
|
}
|
|
@@ -4,7 +4,7 @@ import { defaultValue } from "../../internal/default-value.js";
|
|
|
4
4
|
import { FormControlController } from "../../internal/form.js";
|
|
5
5
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
6
6
|
import { live } from "lit/directives/live.js";
|
|
7
|
-
import { query, property } from "lit/decorators.js";
|
|
7
|
+
import { query, state, property } from "lit/decorators.js";
|
|
8
8
|
import { watch } from "../../internal/watch.js";
|
|
9
9
|
import cx from "classix";
|
|
10
10
|
import SolidElement from "../../internal/solid-element.js";
|
|
@@ -27,6 +27,7 @@ let SdSwitch = class extends SolidElement {
|
|
|
27
27
|
defaultValue: (control) => control.defaultChecked,
|
|
28
28
|
setValue: (control, checked) => control.checked = checked
|
|
29
29
|
});
|
|
30
|
+
this.showInvalidStyle = false;
|
|
30
31
|
this.title = "";
|
|
31
32
|
this.name = "";
|
|
32
33
|
this.disabled = false;
|
|
@@ -50,11 +51,12 @@ let SdSwitch = class extends SolidElement {
|
|
|
50
51
|
this.emit("sd-blur");
|
|
51
52
|
}
|
|
52
53
|
handleInput() {
|
|
53
|
-
this.emit("sd-1-
|
|
54
|
+
this.emit("sd-1-37-1-input");
|
|
54
55
|
}
|
|
55
56
|
handleInvalid(event) {
|
|
56
57
|
this.formControlController.setValidity(false);
|
|
57
58
|
this.formControlController.emitInvalidEvent(event);
|
|
59
|
+
this.invalidMessage.textContent = event.target.validationMessage;
|
|
58
60
|
}
|
|
59
61
|
handleFocus() {
|
|
60
62
|
this.emit("sd-focus");
|
|
@@ -107,23 +109,29 @@ let SdSwitch = class extends SolidElement {
|
|
|
107
109
|
`relative flex flex-initial items-center justify-center border rounded-full h-4 w-8 transition-colors ease duration-100
|
|
108
110
|
peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2
|
|
109
111
|
peer-focus-visible:outline-primary`,
|
|
110
|
-
this.disabled && this.checked
|
|
112
|
+
this.disabled && this.checked ? "border-neutral-500 bg-neutral-500" : this.disabled ? "border-neutral-500" : this.showInvalidStyle ? "border-error bg-error hover:bg-error-400" : this.checked ? "border-accent bg-accent hover:bg-accent-550 group-hover:bg-accent-550" : "border-neutral-800 bg-white hover:bg-neutral-200 group-hover:bg-neutral-200"
|
|
111
113
|
)}"><span id="thumb" part="thumb" class="${cx(
|
|
112
114
|
"w-2.5 h-2.5 rounded-full transition-transform ease-in-out duration-200",
|
|
113
|
-
this.
|
|
115
|
+
this.disabled && this.checked ? "bg-white" : this.disabled ? "-translate-x-2 bg-neutral-500" : this.showInvalidStyle ? "bg-white -translate-x-2" : this.checked ? "translate-x-2 bg-white" : "bg-neutral-800 -translate-x-2"
|
|
114
116
|
)}"></span> </span><span part="label" id="label" class="${cx(
|
|
115
|
-
"select-none inline-block ml-2
|
|
116
|
-
this.disabled
|
|
117
|
-
)}"><slot></slot></span></label
|
|
117
|
+
"select-none inline-block ml-2",
|
|
118
|
+
this.disabled ? "text-neutral-500" : this.showInvalidStyle ? "text-error" : "text-black"
|
|
119
|
+
)}"><slot></slot></span></label> ${this.formControlController.renderInvalidMessage()}`;
|
|
118
120
|
}
|
|
119
121
|
};
|
|
120
122
|
SdSwitch.styles = [
|
|
121
123
|
SolidElement.styles,
|
|
122
|
-
css`:host{display:block}:host(:focus-visible){outline:2px solid transparent;outline-offset:2px}:host([required]) #label::after{content:' *'}
|
|
124
|
+
css`:host{display:block}:host(:focus-visible){outline:2px solid transparent;outline-offset:2px}:host([required]) #label::after{content:' *'}`
|
|
123
125
|
];
|
|
124
126
|
__decorateClass([
|
|
125
127
|
query("input")
|
|
126
128
|
], SdSwitch.prototype, "input", 2);
|
|
129
|
+
__decorateClass([
|
|
130
|
+
query("#invalid-message")
|
|
131
|
+
], SdSwitch.prototype, "invalidMessage", 2);
|
|
132
|
+
__decorateClass([
|
|
133
|
+
state()
|
|
134
|
+
], SdSwitch.prototype, "showInvalidStyle", 2);
|
|
127
135
|
__decorateClass([
|
|
128
136
|
property()
|
|
129
137
|
], SdSwitch.prototype, "title", 2);
|
|
@@ -155,7 +163,7 @@ __decorateClass([
|
|
|
155
163
|
watch(["checked"], { waitUntilFirstUpdate: true })
|
|
156
164
|
], SdSwitch.prototype, "handleStateChange", 1);
|
|
157
165
|
SdSwitch = __decorateClass([
|
|
158
|
-
customElement("sd-1-
|
|
166
|
+
customElement("sd-1-37-1-switch")
|
|
159
167
|
], SdSwitch);
|
|
160
168
|
export {
|
|
161
169
|
SdSwitch as default
|
|
@@ -74,7 +74,7 @@ let SdTag = class extends SolidElement {
|
|
|
74
74
|
lg: "text-base",
|
|
75
75
|
sm: "text-[12px]"
|
|
76
76
|
}[this.size]
|
|
77
|
-
)}"><sd-1-
|
|
77
|
+
)}"><sd-1-37-1-icon library="system" name="close" label="remove"></sd-1-37-1-icon></slot>` : ""}</${tag}>`;
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
SdTag.styles = [
|
|
@@ -106,7 +106,7 @@ __decorateClass([
|
|
|
106
106
|
property()
|
|
107
107
|
], SdTag.prototype, "download", 2);
|
|
108
108
|
SdTag = __decorateClass([
|
|
109
|
-
customElement("sd-1-
|
|
109
|
+
customElement("sd-1-37-1-tag")
|
|
110
110
|
], SdTag);
|
|
111
111
|
export {
|
|
112
112
|
SdTag as default
|
|
@@ -69,7 +69,11 @@ let SdTeaser = class extends SolidElement {
|
|
|
69
69
|
this._orientation === "vertical" && "flex-col",
|
|
70
70
|
this._orientation === "horizontal" && "flex-row gap-8",
|
|
71
71
|
this._orientation === "horizontal" && inset && "py-8 px-10"
|
|
72
|
-
)}" part="base"><div style="${this._orientation === "horizontal" ? `width: var(--distribution-media, 100%);` : ""}" class="${cx(
|
|
72
|
+
)}" part="base"><div style="${this._orientation === "horizontal" ? `width: var(--distribution-media, 100%);` : ""}" class="${cx(
|
|
73
|
+
!inset && this._orientation === "vertical" && "mb-4",
|
|
74
|
+
!slots["teaser-has-media"] && "hidden",
|
|
75
|
+
this.variant === "white border-neutral-400" && this._orientation === "vertical" && "mx-[-1px] mt-[-1px]"
|
|
76
|
+
)}" part="media"><slot name="media"></slot></div><div style="${this._orientation === "horizontal" ? `width: var(--distribution-content, 100%); ${inset ? "width: var(--distribution-content, calc(100% - 2rem));" : ""}` : ""}" class="${cx(
|
|
73
77
|
"flex flex-col text-left",
|
|
74
78
|
this._orientation === "horizontal" && `flex flex-col`,
|
|
75
79
|
this._orientation === "vertical" && inset && "m-4"
|
|
@@ -96,7 +100,7 @@ __decorateClass([
|
|
|
96
100
|
state()
|
|
97
101
|
], SdTeaser.prototype, "_orientation", 2);
|
|
98
102
|
SdTeaser = __decorateClass([
|
|
99
|
-
customElement("sd-1-
|
|
103
|
+
customElement("sd-1-37-1-teaser")
|
|
100
104
|
], SdTeaser);
|
|
101
105
|
export {
|
|
102
106
|
SdTeaser as default
|
|
@@ -4,7 +4,10 @@ export default class SdTextarea extends SolidElement implements SolidFormControl
|
|
|
4
4
|
private readonly formControlController;
|
|
5
5
|
private readonly hasSlotController;
|
|
6
6
|
textarea: HTMLTextAreaElement;
|
|
7
|
+
invalidMessage: HTMLDivElement;
|
|
7
8
|
private hasFocus;
|
|
9
|
+
showValidStyle: boolean;
|
|
10
|
+
showInvalidStyle: boolean;
|
|
8
11
|
title: string;
|
|
9
12
|
name: string;
|
|
10
13
|
value: string;
|
|
@@ -62,6 +65,6 @@ export default class SdTextarea extends SolidElement implements SolidFormControl
|
|
|
62
65
|
}
|
|
63
66
|
declare global {
|
|
64
67
|
interface HTMLElementTagNameMap {
|
|
65
|
-
'sd-1-
|
|
68
|
+
'sd-1-37-1-textarea': SdTextarea;
|
|
66
69
|
}
|
|
67
70
|
}
|
|
@@ -7,8 +7,8 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|
|
7
7
|
import { live } from "lit/directives/live.js";
|
|
8
8
|
import { query, state, property } from "lit/decorators.js";
|
|
9
9
|
import { watch } from "../../internal/watch.js";
|
|
10
|
+
import componentStyles from "../../styles/component.styles.js";
|
|
10
11
|
import cx from "classix";
|
|
11
|
-
import formControlStyles from "../../styles/form-control.styles.js";
|
|
12
12
|
import SolidElement from "../../internal/solid-element.js";
|
|
13
13
|
var __defProp = Object.defineProperty;
|
|
14
14
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -27,6 +27,8 @@ let SdTextarea = class extends SolidElement {
|
|
|
27
27
|
this.formControlController = new FormControlController(this);
|
|
28
28
|
this.hasSlotController = new HasSlotController(this, "help-text", "label");
|
|
29
29
|
this.hasFocus = false;
|
|
30
|
+
this.showValidStyle = false;
|
|
31
|
+
this.showInvalidStyle = false;
|
|
30
32
|
this.title = "";
|
|
31
33
|
this.name = "";
|
|
32
34
|
this.value = "";
|
|
@@ -78,11 +80,12 @@ let SdTextarea = class extends SolidElement {
|
|
|
78
80
|
handleInput() {
|
|
79
81
|
this.value = this.textarea.value;
|
|
80
82
|
this.formControlController.updateValidity();
|
|
81
|
-
this.emit("sd-1-
|
|
83
|
+
this.emit("sd-1-37-1-input");
|
|
82
84
|
}
|
|
83
85
|
handleInvalid(event) {
|
|
84
86
|
this.formControlController.setValidity(false);
|
|
85
87
|
this.formControlController.emitInvalidEvent(event);
|
|
88
|
+
this.invalidMessage.textContent = event.target.validationMessage;
|
|
86
89
|
}
|
|
87
90
|
setTextareaHeight() {
|
|
88
91
|
this.textarea.style.height = void 0;
|
|
@@ -164,17 +167,14 @@ let SdTextarea = class extends SolidElement {
|
|
|
164
167
|
};
|
|
165
168
|
const hasLabel = this.label ? true : !!slots["label"];
|
|
166
169
|
const hasHelpText = this.helpText ? true : !!slots["helpText"];
|
|
167
|
-
const
|
|
168
|
-
const isInvalid = hasValidationAttr && !this.checkValidity();
|
|
169
|
-
const isValid = hasValidationAttr && this.checkValidity();
|
|
170
|
-
const inputState = this.disabled ? "disabled" : this.readonly ? "readonly" : this.hasFocus && isInvalid ? "activeInvalid" : this.hasFocus && isValid ? "activeValid" : this.hasFocus ? "active" : isInvalid ? "invalid" : isValid ? "valid" : "default";
|
|
170
|
+
const textareaState = this.disabled ? "disabled" : this.readonly ? "readonly" : this.hasFocus && this.showInvalidStyle ? "activeInvalid" : this.hasFocus && this.showValidStyle ? "activeValid" : this.hasFocus ? "active" : this.showInvalidStyle ? "invalid" : this.showValidStyle ? "valid" : "default";
|
|
171
171
|
const textSize = this.size === "sm" ? "text-sm" : "text-base";
|
|
172
|
-
|
|
173
|
-
"
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
172
|
+
const iconSizeMarginLeft = {
|
|
173
|
+
sm: "text-base ml-1",
|
|
174
|
+
md: "text-lg ml-2",
|
|
175
|
+
lg: "text-xl ml-2"
|
|
176
|
+
}[this.size];
|
|
177
|
+
return html`<div part="form-control" class="text-left"><label part="form-control-label" id="label" class="${cx("mb-2", hasLabel ? "inline-block" : "hidden", textSize)}" for="input" aria-hidden="${hasLabel ? "false" : "true"}"><slot name="label">${this.label}</slot></label><div part="form-control-input" class="${cx("relative w-full", this.disabled && "cursor-not-allowed")}"><div part="border" class="${cx(
|
|
178
178
|
"absolute w-full h-full pointer-events-none border rounded-default",
|
|
179
179
|
{
|
|
180
180
|
disabled: "border-neutral-500",
|
|
@@ -185,9 +185,9 @@ let SdTextarea = class extends SolidElement {
|
|
|
185
185
|
invalid: "border-error",
|
|
186
186
|
valid: "border-success",
|
|
187
187
|
default: "border-neutral-800"
|
|
188
|
-
}[
|
|
188
|
+
}[textareaState]
|
|
189
189
|
)}"></div><div part="base" class="${cx(
|
|
190
|
-
"textarea px-4 flex
|
|
190
|
+
"textarea px-4 flex items-top rounded-default bg-white group",
|
|
191
191
|
{
|
|
192
192
|
sm: "textarea-sm py-1",
|
|
193
193
|
md: "textarea-md py-1",
|
|
@@ -202,30 +202,36 @@ let SdTextarea = class extends SolidElement {
|
|
|
202
202
|
invalid: "text-error",
|
|
203
203
|
valid: "text-success",
|
|
204
204
|
default: "text-black"
|
|
205
|
-
}[
|
|
205
|
+
}[textareaState],
|
|
206
206
|
!this.disabled && !this.readonly ? "hover:bg-neutral-200" : "",
|
|
207
|
-
this.readonly && "bg-neutral-100"
|
|
208
|
-
isInvalid && "form-control-input--invalid",
|
|
209
|
-
!this.value && "textarea--empty"
|
|
207
|
+
this.readonly && "bg-neutral-100"
|
|
210
208
|
)}"><textarea part="textarea" id="input" class="${cx(
|
|
211
209
|
"flex-grow focus:outline-none bg-transparent placeholder-neutral-700 resize-none",
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
)}" title="${this.title}" name="${ifDefined(this.name)}" .value="${live(this.value)}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" placeholder="${ifDefined(this.placeholder)}" minlength="${ifDefined(this.minlength)}" maxlength="${ifDefined(this.maxlength)}" rows="${ifDefined(this.rows)}" autocapitalize="${ifDefined(this.autocapitalize)}" autocorrect="${ifDefined(this.autocorrect)}" ?autofocus="${this.autofocus}" spellcheck="${ifDefined(this.spellcheck)}" enterkeyhint="${ifDefined(this.enterkeyhint)}" inputmode="${ifDefined(this.inputmode)}" aria-describedby="help-text" @change="${this.handleChange}" @input="${this.handleInput}" @invalid="${this.handleInvalid}" @focus="${this.handleFocus}" @blur="${this.handleBlur}"></textarea></div></div><slot name="help-text" part="form-control-help-text" id="help-text" class="${cx("text-sm text-neutral-700", hasHelpText ? "block" : "hidden")}" aria-hidden="${hasHelpText ? "false" : "true"}">${this.helpText}</slot></div
|
|
210
|
+
this.disabled && "cursor-not-allowed",
|
|
211
|
+
textSize
|
|
212
|
+
)}" title="${this.title}" name="${ifDefined(this.name)}" .value="${live(this.value)}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" placeholder="${ifDefined(this.placeholder)}" minlength="${ifDefined(this.minlength)}" maxlength="${ifDefined(this.maxlength)}" rows="${ifDefined(this.rows)}" autocapitalize="${ifDefined(this.autocapitalize)}" autocorrect="${ifDefined(this.autocorrect)}" ?autofocus="${this.autofocus}" spellcheck="${ifDefined(this.spellcheck)}" enterkeyhint="${ifDefined(this.enterkeyhint)}" inputmode="${ifDefined(this.inputmode)}" aria-describedby="help-text" @change="${this.handleChange}" @input="${this.handleInput}" @invalid="${this.handleInvalid}" @focus="${this.handleFocus}" @blur="${this.handleBlur}"></textarea> ${this.showInvalidStyle ? html`<sd-1-37-1-icon class="${cx("text-error absolute right-4 bg-white group-hover:bg-neutral-200", iconSizeMarginLeft)}" library="system" name="risk"></sd-1-37-1-icon>` : ""} ${this.showValidStyle ? html`<sd-1-37-1-icon class="${cx("text-success absolute right-4 bg-white group-hover:bg-neutral-200", iconSizeMarginLeft)}" library="system" name="confirm"></sd-1-37-1-icon>` : ""}</div></div><slot name="help-text" part="form-control-help-text" id="help-text" class="${cx("text-sm text-neutral-700", hasHelpText ? "block" : "hidden")}" aria-hidden="${hasHelpText ? "false" : "true"}">${this.helpText}</slot></div>${this.formControlController.renderInvalidMessage()}`;
|
|
215
213
|
}
|
|
216
214
|
};
|
|
217
215
|
SdTextarea.styles = [
|
|
218
|
-
|
|
219
|
-
formControlStyles,
|
|
216
|
+
componentStyles,
|
|
220
217
|
SolidElement.styles,
|
|
221
|
-
css`:host{display:block}:host([required]) #label
|
|
218
|
+
css`:host{display:block}:host([required]) #label::after{content:' *'}.no-scrollbar::-webkit-scrollbar{display:none}`
|
|
222
219
|
];
|
|
223
220
|
__decorateClass([
|
|
224
|
-
query("
|
|
221
|
+
query("#input")
|
|
225
222
|
], SdTextarea.prototype, "textarea", 2);
|
|
223
|
+
__decorateClass([
|
|
224
|
+
query("#invalid-message")
|
|
225
|
+
], SdTextarea.prototype, "invalidMessage", 2);
|
|
226
226
|
__decorateClass([
|
|
227
227
|
state()
|
|
228
228
|
], SdTextarea.prototype, "hasFocus", 2);
|
|
229
|
+
__decorateClass([
|
|
230
|
+
state()
|
|
231
|
+
], SdTextarea.prototype, "showValidStyle", 2);
|
|
232
|
+
__decorateClass([
|
|
233
|
+
state()
|
|
234
|
+
], SdTextarea.prototype, "showInvalidStyle", 2);
|
|
229
235
|
__decorateClass([
|
|
230
236
|
property()
|
|
231
237
|
], SdTextarea.prototype, "title", 2);
|
|
@@ -309,7 +315,7 @@ __decorateClass([
|
|
|
309
315
|
watch("value", { waitUntilFirstUpdate: true })
|
|
310
316
|
], SdTextarea.prototype, "handleValueChange", 1);
|
|
311
317
|
SdTextarea = __decorateClass([
|
|
312
|
-
customElement("sd-1-
|
|
318
|
+
customElement("sd-1-37-1-textarea")
|
|
313
319
|
], SdTextarea);
|
|
314
320
|
export {
|
|
315
321
|
SdTextarea as default
|