@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
|
@@ -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-0-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-0-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-0-icon library="system" name="close" label="remove"></sd-1-37-0-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-0-tag")
|
|
110
110
|
], SdTag);
|
|
111
111
|
export {
|
|
112
112
|
SdTag 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-0-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-0-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-0-icon class="${cx("text-error absolute right-4 bg-white group-hover:bg-neutral-200", iconSizeMarginLeft)}" library="system" name="risk"></sd-1-37-0-icon>` : ""} ${this.showValidStyle ? html`<sd-1-37-0-icon class="${cx("text-success absolute right-4 bg-white group-hover:bg-neutral-200", iconSizeMarginLeft)}" library="system" name="confirm"></sd-1-37-0-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-0-textarea")
|
|
313
319
|
], SdTextarea);
|
|
314
320
|
export {
|
|
315
321
|
SdTextarea as default
|
|
@@ -161,16 +161,16 @@ let SdTooltip = class extends SolidElement {
|
|
|
161
161
|
render() {
|
|
162
162
|
const isStart = this.placement.endsWith("-start");
|
|
163
163
|
const isEnd = this.placement.endsWith("-end");
|
|
164
|
-
return html`<sd-1-
|
|
164
|
+
return html`<sd-1-37-0-popup part="base" exportparts="
|
|
165
165
|
popup:base__popup,
|
|
166
166
|
arrow:base__arrow
|
|
167
|
-
" class="${cx(this.open && "tooltip--open")}" placement="${this.placement}" distance="10" skidding="${{ start: 2, end: -2, default: 0 }[isStart ? "start" : isEnd ? "end" : "default"] * (this.size === "sm" ? -1 : 1)}" strategy="${this.hoist ? "fixed" : "absolute"}" flip shift arrow auto-size="vertical" arrow-padding="0"><slot slot="anchor" aria-describedby="tooltip" class="${cx(this.size === "lg" ? "text-xl" : "text-base")}"><button class="flex sd-interactive rounded-full"><sd-1-
|
|
167
|
+
" class="${cx(this.open && "tooltip--open")}" placement="${this.placement}" distance="10" skidding="${{ start: 2, end: -2, default: 0 }[isStart ? "start" : isEnd ? "end" : "default"] * (this.size === "sm" ? -1 : 1)}" strategy="${this.hoist ? "fixed" : "absolute"}" flip shift arrow auto-size="vertical" arrow-padding="0"><slot slot="anchor" aria-describedby="tooltip" class="${cx(this.size === "lg" ? "text-xl" : "text-base")}"><button class="flex sd-interactive rounded-full"><sd-1-37-0-icon library="system" name="info-circle" class="${cx(this.disabled && "sd-interactive--disabled")}"></sd-1-37-0-icon></button></slot><slot name="content" part="body" id="tooltip" class="bg-primary text-white py-3 px-4 block rounded-none text-sm text-left" role="tooltip" aria-label="Tooltip" aria-live="${this.open ? "polite" : "off"}">${this.content}</slot></sd-1-37-0-popup>`;
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
170
|
SdTooltip.styles = [
|
|
171
171
|
SolidElement.styles,
|
|
172
172
|
unsafeCSS(InteractiveStyles),
|
|
173
|
-
css`:host{--hide-delay:0ms;--show-delay:150ms;display:contents}sd-1-
|
|
173
|
+
css`:host{--hide-delay:0ms;--show-delay:150ms;display:contents}sd-1-37-0-popup{--arrow-color:rgb(var(--sd-color-primary, 0 53 142) / 1);--arrow-size:10px}sd-1-37-0-popup::part(popup){pointer-events:none;z-index:10;--tw-shadow:var(--sd-shadow, 0px 1px 3px 0px rgb(81 81 81 / 75%));--tw-shadow-colored:0px 1px 3px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}sd-1-37-0-popup::part(arrow){--tw-shadow:var(--sd-shadow, 0px 1px 3px 0px rgb(81 81 81 / 75%));--tw-shadow-colored:0px 1px 3px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}sd-1-37-0-popup[placement^=top]::part(popup){transform-origin:bottom}sd-1-37-0-popup[placement^=bottom]::part(popup){transform-origin:top}#tooltip{max-width:var(--max-width)}::slotted([slot=content]){overflow:auto;max-width:var(--auto-size-available-width)!important;max-height:var(--auto-size-available-height)!important}`
|
|
174
174
|
];
|
|
175
175
|
__decorateClass([
|
|
176
176
|
query("slot:not([name])")
|
|
@@ -179,7 +179,7 @@ __decorateClass([
|
|
|
179
179
|
query("#tooltip")
|
|
180
180
|
], SdTooltip.prototype, "body", 2);
|
|
181
181
|
__decorateClass([
|
|
182
|
-
query("sd-1-
|
|
182
|
+
query("sd-1-37-0-popup")
|
|
183
183
|
], SdTooltip.prototype, "popup", 2);
|
|
184
184
|
__decorateClass([
|
|
185
185
|
property()
|
|
@@ -212,7 +212,7 @@ __decorateClass([
|
|
|
212
212
|
watch("disabled")
|
|
213
213
|
], SdTooltip.prototype, "handleDisabledChange", 1);
|
|
214
214
|
SdTooltip = __decorateClass([
|
|
215
|
-
customElement("sd-1-
|
|
215
|
+
customElement("sd-1-37-0-tooltip")
|
|
216
216
|
], SdTooltip);
|
|
217
217
|
setDefaultAnimation("tooltip.show", {
|
|
218
218
|
keyframes: [
|
|
@@ -87,7 +87,7 @@ let SdVideo = class extends SolidElement {
|
|
|
87
87
|
this.playing ? "opacity-0" : "opacity-100",
|
|
88
88
|
this.isBelowBreakpoint ? "w-[48px] h-[48px]" : "w-[96px] h-[96px]",
|
|
89
89
|
"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 p-4 bg-white bg-opacity-75 rounded-full play-pause-transition"
|
|
90
|
-
)}"><slot name="play-icon" part="play-icon" class="${cx(this.isBelowBreakpoint ? "text-[2rem]" : "text-[4rem]")}"><sd-1-
|
|
90
|
+
)}"><slot name="play-icon" part="play-icon" class="${cx(this.isBelowBreakpoint ? "text-[2rem]" : "text-[4rem]")}"><sd-1-37-0-icon id="default-play-icon" library="system" name="start"></sd-1-37-0-icon></slot></div></button> ${this.hasSlotController.test("poster") ? html`<slot name="poster" role="presentation" @transitionend="${this.hidePoster}"></slot>` : null}<div part="overlay" id="overlay" role="presentation" class="${cx(
|
|
91
91
|
this.overlay && !this.playing ? "opacity-100" : "opacity-0",
|
|
92
92
|
"bg-[rgba(0,0,0,0.65)] w-full h-full absolute top-0 left-0 pointer-events-none z-20 play-pause-transition"
|
|
93
93
|
)}"></div><slot></slot></div>`;
|
|
@@ -110,7 +110,7 @@ __decorateClass([
|
|
|
110
110
|
property({ type: Boolean })
|
|
111
111
|
], SdVideo.prototype, "isBelowBreakpoint", 2);
|
|
112
112
|
SdVideo = __decorateClass([
|
|
113
|
-
customElement("sd-1-
|
|
113
|
+
customElement("sd-1-37-0-video")
|
|
114
114
|
], SdVideo);
|
|
115
115
|
export {
|
|
116
116
|
SdVideo as default
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactiveController, type ReactiveControllerHost } from 'lit';
|
|
2
2
|
import type { SolidFormControl } from '../internal/solid-element';
|
|
3
3
|
import type SdButton from '../components/button/button';
|
|
4
4
|
export declare const formCollections: WeakMap<HTMLFormElement, Set<SolidFormControl>>;
|
|
@@ -29,7 +29,9 @@ export declare class FormControlController implements ReactiveController {
|
|
|
29
29
|
private reportFormValidity;
|
|
30
30
|
private setUserInteracted;
|
|
31
31
|
private doAction;
|
|
32
|
+
updateValidityStyle(): void;
|
|
32
33
|
getForm(): HTMLFormElement | null;
|
|
34
|
+
renderInvalidMessage(): import("lit-html").TemplateResult<1>;
|
|
33
35
|
reset(invoker?: HTMLInputElement | SdButton): void;
|
|
34
36
|
submit(invoker?: HTMLInputElement | SdButton): void;
|
|
35
37
|
setValidity(isValid: boolean): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
1
2
|
const formCollections = /* @__PURE__ */ new WeakMap();
|
|
2
3
|
const reportValidityOverloads = /* @__PURE__ */ new WeakMap();
|
|
3
4
|
const userInteractedControls = /* @__PURE__ */ new WeakMap();
|
|
@@ -8,7 +9,7 @@ class FormControlController {
|
|
|
8
9
|
const disabled = this.options.disabled(this.host);
|
|
9
10
|
const name = this.options.name(this.host);
|
|
10
11
|
const value = this.options.value(this.host);
|
|
11
|
-
const isButton = this.host.tagName.toLowerCase() === "sd-1-
|
|
12
|
+
const isButton = this.host.tagName.toLowerCase() === "sd-1-37-0-button";
|
|
12
13
|
if (!disabled && !isButton && typeof name === "string" && name.length > 0 && typeof value !== "undefined") {
|
|
13
14
|
if (Array.isArray(value)) {
|
|
14
15
|
value.forEach((val) => {
|
|
@@ -20,7 +21,7 @@ class FormControlController {
|
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
23
|
this.handleFormSubmit = (event) => {
|
|
23
|
-
var _a;
|
|
24
|
+
var _a, _b;
|
|
24
25
|
const disabled = this.options.disabled(this.host);
|
|
25
26
|
const reportValidity = this.options.reportValidity;
|
|
26
27
|
if (this.form && !this.form.noValidate) {
|
|
@@ -31,6 +32,16 @@ class FormControlController {
|
|
|
31
32
|
if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {
|
|
32
33
|
event.preventDefault();
|
|
33
34
|
event.stopImmediatePropagation();
|
|
35
|
+
const invalidElements = (_b = this.form) == null ? void 0 : _b.querySelectorAll("[data-invalid]");
|
|
36
|
+
const sdRadioGroups = Array.from(invalidElements).filter(
|
|
37
|
+
(element) => element.tagName.toLowerCase() === "sd-1-37-0-radio-group"
|
|
38
|
+
);
|
|
39
|
+
sdRadioGroups.forEach((radioGroup) => {
|
|
40
|
+
var _a2, _b2;
|
|
41
|
+
(_b2 = (_a2 = radioGroup.shadowRoot) == null ? void 0 : _a2.querySelector("input")) == null ? void 0 : _b2.dispatchEvent(new Event("invalid"));
|
|
42
|
+
});
|
|
43
|
+
if (invalidElements == null ? void 0 : invalidElements.length)
|
|
44
|
+
invalidElements[0].focus();
|
|
34
45
|
}
|
|
35
46
|
};
|
|
36
47
|
this.handleFormReset = () => {
|
|
@@ -65,7 +76,7 @@ class FormControlController {
|
|
|
65
76
|
disabled: (input) => input.disabled ?? false,
|
|
66
77
|
reportValidity: (input) => typeof input.reportValidity === "function" ? input.reportValidity() : true,
|
|
67
78
|
setValue: (input, value) => input.value = value,
|
|
68
|
-
assumeInteractionOn: ["sd-1-
|
|
79
|
+
assumeInteractionOn: ["sd-1-37-0-input"],
|
|
69
80
|
...options
|
|
70
81
|
};
|
|
71
82
|
}
|
|
@@ -98,6 +109,7 @@ class FormControlController {
|
|
|
98
109
|
}
|
|
99
110
|
if (this.host.hasUpdated) {
|
|
100
111
|
this.setValidity((_a = this.host) == null ? void 0 : _a.validity.valid);
|
|
112
|
+
this.updateValidityStyle();
|
|
101
113
|
}
|
|
102
114
|
}
|
|
103
115
|
attachForm(form) {
|
|
@@ -174,10 +186,30 @@ class FormControlController {
|
|
|
174
186
|
button.remove();
|
|
175
187
|
}
|
|
176
188
|
}
|
|
189
|
+
/** Checks for the presence of the attributes 'data-user-valid' or 'data-user-invalid' on the host form element and updates its corresponding style state. */
|
|
190
|
+
updateValidityStyle() {
|
|
191
|
+
if (this.host.hasAttribute("data-user-valid") && this.host.checkValidity()) {
|
|
192
|
+
if (this.host.showValidStyle !== void 0)
|
|
193
|
+
this.host.showValidStyle = true;
|
|
194
|
+
this.host.showInvalidStyle = false;
|
|
195
|
+
} else if (this.host.hasAttribute("data-user-invalid") && !this.host.checkValidity()) {
|
|
196
|
+
if (this.host.showValidStyle !== void 0)
|
|
197
|
+
this.host.showValidStyle = false;
|
|
198
|
+
this.host.showInvalidStyle = true;
|
|
199
|
+
} else {
|
|
200
|
+
if (this.host.showValidStyle !== void 0)
|
|
201
|
+
this.host.showValidStyle = false;
|
|
202
|
+
this.host.showInvalidStyle = false;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
177
205
|
/** Returns the associated `<form>` element, if one exists. */
|
|
178
206
|
getForm() {
|
|
179
207
|
return this.form ?? null;
|
|
180
208
|
}
|
|
209
|
+
/** Returns a styled `<div>` element to display inline validation messages via its `textContent` property when a form element is invalid. */
|
|
210
|
+
renderInvalidMessage() {
|
|
211
|
+
return html`<div id="invalid-message" class="text-error text-sm mt-2 text-left" part="error-message" aria-live="polite" ?hidden="${!this.host.showInvalidStyle}"></div>`;
|
|
212
|
+
}
|
|
181
213
|
/** Resets the form, restoring all the control to their default value */
|
|
182
214
|
reset(invoker) {
|
|
183
215
|
this.doAction("reset", invoker);
|
|
@@ -220,24 +252,20 @@ class FormControlController {
|
|
|
220
252
|
this.setValidity(host == null ? void 0 : host.validity.valid);
|
|
221
253
|
}
|
|
222
254
|
/**
|
|
223
|
-
* Dispatches a non-bubbling, cancelable custom event of type `
|
|
224
|
-
* If
|
|
225
|
-
* event (which may have been passed as argument) will also be cancelled.
|
|
226
|
-
* If no original `invalid` event has been passed then the `sl-invalid`
|
|
255
|
+
* Dispatches a non-bubbling, cancelable custom event of type `sd-invalid`.
|
|
256
|
+
* If no original `invalid` event has been passed then the `sd-invalid`
|
|
227
257
|
* event will be cancelled before being dispatched.
|
|
228
258
|
*/
|
|
229
259
|
emitInvalidEvent(originalInvalidEvent) {
|
|
230
|
-
|
|
260
|
+
originalInvalidEvent == null ? void 0 : originalInvalidEvent.preventDefault();
|
|
261
|
+
const sdInvalidEvent = new CustomEvent("sd-invalid", {
|
|
231
262
|
bubbles: false,
|
|
232
263
|
composed: false,
|
|
233
264
|
cancelable: true,
|
|
234
265
|
detail: {}
|
|
235
266
|
});
|
|
236
267
|
if (!originalInvalidEvent) {
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
if (!this.host.dispatchEvent(slInvalidEvent)) {
|
|
240
|
-
originalInvalidEvent == null ? void 0 : originalInvalidEvent.preventDefault();
|
|
268
|
+
sdInvalidEvent.preventDefault();
|
|
241
269
|
}
|
|
242
270
|
}
|
|
243
271
|
}
|
|
@@ -20,6 +20,7 @@ export { default as SdNotification } from './components/notification/notificatio
|
|
|
20
20
|
export { default as SdOption } from './components/option/option';
|
|
21
21
|
export { default as SdPopup } from './components/popup/popup';
|
|
22
22
|
export { default as SdRadio } from './components/radio/radio';
|
|
23
|
+
export { default as SdRadioButton } from './components/radio-button/radio-button';
|
|
23
24
|
export { default as SdRadioGroup } from './components/radio-group/radio-group';
|
|
24
25
|
export { default as SdSelect } from './components/select/select';
|
|
25
26
|
export { default as SdSpinner } from './components/spinner/spinner';
|
|
@@ -20,15 +20,16 @@ import { default as default20 } from "./components/notification/notification.js"
|
|
|
20
20
|
import { default as default21 } from "./components/option/option.js";
|
|
21
21
|
import { default as default22 } from "./components/popup/popup.js";
|
|
22
22
|
import { default as default23 } from "./components/radio/radio.js";
|
|
23
|
-
import { default as default24 } from "./components/radio-
|
|
24
|
-
import { default as default25 } from "./components/
|
|
25
|
-
import { default as default26 } from "./components/
|
|
26
|
-
import { default as default27 } from "./components/
|
|
27
|
-
import { default as default28 } from "./components/
|
|
28
|
-
import { default as default29 } from "./components/
|
|
29
|
-
import { default as default30 } from "./components/
|
|
30
|
-
import { default as default31 } from "./components/
|
|
31
|
-
import { default as default32 } from "./components/
|
|
23
|
+
import { default as default24 } from "./components/radio-button/radio-button.js";
|
|
24
|
+
import { default as default25 } from "./components/radio-group/radio-group.js";
|
|
25
|
+
import { default as default26 } from "./components/select/select.js";
|
|
26
|
+
import { default as default27 } from "./components/spinner/spinner.js";
|
|
27
|
+
import { default as default28 } from "./components/switch/switch.js";
|
|
28
|
+
import { default as default29 } from "./components/tag/tag.js";
|
|
29
|
+
import { default as default30 } from "./components/teaser/teaser.js";
|
|
30
|
+
import { default as default31 } from "./components/textarea/textarea.js";
|
|
31
|
+
import { default as default32 } from "./components/tooltip/tooltip.js";
|
|
32
|
+
import { default as default33 } from "./components/video/video.js";
|
|
32
33
|
import { registerIconLibrary, unregisterIconLibrary } from "./components/icon/library.js";
|
|
33
34
|
import { LocalizeController } from "./utilities/localize.js";
|
|
34
35
|
export {
|
|
@@ -55,15 +56,16 @@ export {
|
|
|
55
56
|
default21 as SdOption,
|
|
56
57
|
default22 as SdPopup,
|
|
57
58
|
default23 as SdRadio,
|
|
58
|
-
default24 as
|
|
59
|
-
default25 as
|
|
60
|
-
default26 as
|
|
61
|
-
default27 as
|
|
62
|
-
default28 as
|
|
63
|
-
default29 as
|
|
64
|
-
default30 as
|
|
65
|
-
default31 as
|
|
66
|
-
default32 as
|
|
59
|
+
default24 as SdRadioButton,
|
|
60
|
+
default25 as SdRadioGroup,
|
|
61
|
+
default26 as SdSelect,
|
|
62
|
+
default27 as SdSpinner,
|
|
63
|
+
default28 as SdSwitch,
|
|
64
|
+
default29 as SdTag,
|
|
65
|
+
default30 as SdTeaser,
|
|
66
|
+
default31 as SdTextarea,
|
|
67
|
+
default32 as SdTooltip,
|
|
68
|
+
default33 as SdVideo,
|
|
67
69
|
registerIconLibrary,
|
|
68
70
|
unregisterIconLibrary
|
|
69
71
|
};
|