@solid-design-system/components 1.31.0 → 1.33.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.js +1 -1
- package/dist/components/es/default-value.js +1 -0
- package/dist/components/es/drawer.js +1 -1
- package/dist/components/es/dropdown.js +1 -1
- package/dist/components/es/form-control.styles.js +1 -0
- package/dist/components/es/icon.js +3 -4
- package/dist/components/es/input.js +1 -1
- package/dist/components/es/live.js +3 -3
- package/dist/components/es/option.js +1 -0
- package/dist/components/es/popup.js +1 -1
- package/dist/components/es/scroll.js +1 -0
- package/dist/components/es/select.js +5 -0
- 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/tabbable.js +1 -1
- package/dist/components/es/tag.js +1 -1
- package/dist/components/es/textarea.js +1 -0
- package/dist/components/umd/solid-components.js +25 -22
- package/dist/custom-elements.json +1 -1
- package/dist/package/components/input/input.js +2 -2
- package/dist/package/components/option/option.d.ts +30 -0
- package/dist/package/components/option/option.js +145 -0
- package/dist/package/components/popup/popup.d.ts +3 -0
- package/dist/package/components/popup/popup.js +17 -0
- package/dist/package/components/select/select.d.ts +101 -0
- package/dist/package/components/select/select.js +700 -0
- package/dist/package/components/tag/tag.d.ts +1 -0
- package/dist/package/components/tag/tag.js +5 -3
- package/dist/package/components/textarea/textarea.d.ts +67 -0
- package/dist/package/components/textarea/textarea.js +315 -0
- package/dist/package/solid-components.d.ts +3 -0
- package/dist/package/solid-components.js +24 -18
- package/dist/package/styles/tailwind.css.js +1 -1
- package/dist/package/translations/en.js +3 -4
- package/dist/package/utilities/localize.d.ts +1 -0
- 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/default-value.js +1 -0
- 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-control.styles.js +1 -0
- 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 +3 -4
- 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/live.js +3 -3
- 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 -0
- package/dist/versioned-components/es/popup.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/scroll.js +1 -0
- package/dist/versioned-components/es/select.js +5 -0
- 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/tabbable.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 -0
- 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 +1 -1
- package/dist/versioned-package/components/checkbox/checkbox.js +4 -4
- package/dist/versioned-package/components/checkbox-group/checkbox-group.d.ts +1 -1
- package/dist/versioned-package/components/checkbox-group/checkbox-group.js +5 -5
- 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 +1 -1
- package/dist/versioned-package/components/input/input.js +6 -6
- 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 +30 -0
- package/dist/versioned-package/components/option/option.js +145 -0
- package/dist/versioned-package/components/popup/popup.d.ts +4 -1
- package/dist/versioned-package/components/popup/popup.js +18 -1
- package/dist/versioned-package/components/radio/radio.d.ts +1 -1
- package/dist/versioned-package/components/radio/radio.js +2 -2
- package/dist/versioned-package/components/radio-group/radio-group.d.ts +2 -2
- package/dist/versioned-package/components/radio-group/radio-group.js +14 -14
- package/dist/versioned-package/components/select/select.d.ts +101 -0
- package/dist/versioned-package/components/select/select.js +700 -0
- 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 +1 -1
- package/dist/versioned-package/components/switch/switch.js +2 -2
- package/dist/versioned-package/components/tag/tag.d.ts +2 -1
- package/dist/versioned-package/components/tag/tag.js +6 -4
- package/dist/versioned-package/components/teaser/teaser.js +1 -1
- package/dist/versioned-package/components/textarea/textarea.d.ts +67 -0
- package/dist/versioned-package/components/textarea/textarea.js +315 -0
- 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.js +2 -2
- package/dist/versioned-package/solid-components.d.ts +3 -0
- package/dist/versioned-package/solid-components.js +24 -18
- package/dist/versioned-package/styles/form-control.styles.js +1 -1
- package/dist/versioned-package/styles/tailwind.css.js +1 -1
- package/dist/versioned-package/translations/en.js +3 -4
- package/dist/versioned-package/utilities/localize.d.ts +1 -0
- package/dist/versioned-styles/solid-styles.css +1 -1
- package/dist/vscode.html-custom-data.json +795 -127
- package/dist/web-types.json +1428 -276
- package/package.json +3 -3
|
@@ -50,7 +50,7 @@ let SdSwitch = class extends SolidElement {
|
|
|
50
50
|
this.emit("sd-blur");
|
|
51
51
|
}
|
|
52
52
|
handleInput() {
|
|
53
|
-
this.emit("sd-1-
|
|
53
|
+
this.emit("sd-1-33-0-input");
|
|
54
54
|
}
|
|
55
55
|
handleInvalid(event) {
|
|
56
56
|
this.formControlController.setValidity(false);
|
|
@@ -155,7 +155,7 @@ __decorateClass([
|
|
|
155
155
|
watch(["checked"], { waitUntilFirstUpdate: true })
|
|
156
156
|
], SdSwitch.prototype, "handleStateChange", 1);
|
|
157
157
|
SdSwitch = __decorateClass([
|
|
158
|
-
customElement("sd-1-
|
|
158
|
+
customElement("sd-1-33-0-switch")
|
|
159
159
|
], SdSwitch);
|
|
160
160
|
export {
|
|
161
161
|
SdSwitch as default
|
|
@@ -10,6 +10,7 @@ export default class SdTag extends SolidElement {
|
|
|
10
10
|
download?: string;
|
|
11
11
|
private handleBlur;
|
|
12
12
|
private handleFocus;
|
|
13
|
+
private handleRemoveClick;
|
|
13
14
|
private isLink;
|
|
14
15
|
click(): void;
|
|
15
16
|
focus(options?: FocusOptions): void;
|
|
@@ -19,6 +20,6 @@ export default class SdTag extends SolidElement {
|
|
|
19
20
|
}
|
|
20
21
|
declare global {
|
|
21
22
|
interface HTMLElementTagNameMap {
|
|
22
|
-
'sd-1-
|
|
23
|
+
'sd-1-33-0-tag': SdTag;
|
|
23
24
|
}
|
|
24
25
|
}
|
|
@@ -31,6 +31,9 @@ let SdTag = class extends SolidElement {
|
|
|
31
31
|
handleFocus() {
|
|
32
32
|
this.emit("sd-focus");
|
|
33
33
|
}
|
|
34
|
+
handleRemoveClick() {
|
|
35
|
+
this.emit("sd-remove");
|
|
36
|
+
}
|
|
34
37
|
isLink() {
|
|
35
38
|
return this.href ? true : false;
|
|
36
39
|
}
|
|
@@ -65,14 +68,13 @@ let SdTag = class extends SolidElement {
|
|
|
65
68
|
/* colors */
|
|
66
69
|
!this.selected ? "border-primary text-primary hover:border-primary-500 hover:bg-neutral-100 hover:text-primary-500 disabled:border-neutral-500 disabled:text-neutral-500" : "bg-primary border-primary text-white hover:bg-primary-500 hover:border-primary-500 disabled:bg-neutral-500 disabled:border-neutral-500",
|
|
67
70
|
this.disabled && !isLink && "cursor-not-allowed"
|
|
68
|
-
)}"><slot part="content"></slot
|
|
69
|
-
!this.removable && "hidden",
|
|
71
|
+
)}"><slot part="content"></slot>${this.removable ? html`<slot part="removable-indicator" name="removable-indicator" @click="${this.handleRemoveClick}" class="${cx(
|
|
70
72
|
{
|
|
71
73
|
/* sizes, fonts */
|
|
72
74
|
lg: "text-base",
|
|
73
75
|
sm: "text-[12px]"
|
|
74
76
|
}[this.size]
|
|
75
|
-
)}"><sd-1-
|
|
77
|
+
)}"><sd-1-33-0-icon library="system" name="close" label="remove"></sd-1-33-0-icon></slot>` : ""}</${tag}>`;
|
|
76
78
|
}
|
|
77
79
|
};
|
|
78
80
|
SdTag.styles = [
|
|
@@ -104,7 +106,7 @@ __decorateClass([
|
|
|
104
106
|
property()
|
|
105
107
|
], SdTag.prototype, "download", 2);
|
|
106
108
|
SdTag = __decorateClass([
|
|
107
|
-
customElement("sd-1-
|
|
109
|
+
customElement("sd-1-33-0-tag")
|
|
108
110
|
], SdTag);
|
|
109
111
|
export {
|
|
110
112
|
SdTag as default
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import SolidElement from '../../internal/solid-element';
|
|
2
|
+
import type { SolidFormControl } from '../../internal/solid-element';
|
|
3
|
+
export default class SdTextarea extends SolidElement implements SolidFormControl {
|
|
4
|
+
private readonly formControlController;
|
|
5
|
+
private readonly hasSlotController;
|
|
6
|
+
textarea: HTMLTextAreaElement;
|
|
7
|
+
private hasFocus;
|
|
8
|
+
title: string;
|
|
9
|
+
name: string;
|
|
10
|
+
value: string;
|
|
11
|
+
size: 'lg' | 'md' | 'sm';
|
|
12
|
+
label: string;
|
|
13
|
+
helpText: string;
|
|
14
|
+
placeholder: string;
|
|
15
|
+
rows: number;
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
readonly: boolean;
|
|
18
|
+
form: string;
|
|
19
|
+
required: boolean;
|
|
20
|
+
minlength: number;
|
|
21
|
+
maxlength: number;
|
|
22
|
+
autocapitalize: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';
|
|
23
|
+
autocorrect: 'off' | 'on';
|
|
24
|
+
autocomplete: string;
|
|
25
|
+
autofocus: boolean;
|
|
26
|
+
enterkeyhint: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
|
27
|
+
spellcheck: boolean;
|
|
28
|
+
inputmode: 'none' | 'text';
|
|
29
|
+
defaultValue: string;
|
|
30
|
+
get validity(): ValidityState;
|
|
31
|
+
get validationMessage(): string;
|
|
32
|
+
connectedCallback(): void;
|
|
33
|
+
firstUpdated(): void;
|
|
34
|
+
disconnectedCallback(): void;
|
|
35
|
+
private handleBlur;
|
|
36
|
+
private handleChange;
|
|
37
|
+
private handleFocus;
|
|
38
|
+
private handleInput;
|
|
39
|
+
private handleInvalid;
|
|
40
|
+
private setTextareaHeight;
|
|
41
|
+
handleDisabledChange(): void;
|
|
42
|
+
handleRowsChange(): void;
|
|
43
|
+
handleValueChange(): Promise<void>;
|
|
44
|
+
focus(options?: FocusOptions): void;
|
|
45
|
+
blur(): void;
|
|
46
|
+
select(): void;
|
|
47
|
+
scrollPosition(position?: {
|
|
48
|
+
top?: number;
|
|
49
|
+
left?: number;
|
|
50
|
+
}): {
|
|
51
|
+
top: number;
|
|
52
|
+
left: number;
|
|
53
|
+
} | undefined;
|
|
54
|
+
setSelectionRange(selectionStart: number, selectionEnd: number, selectionDirection?: 'forward' | 'backward' | 'none'): void;
|
|
55
|
+
setRangeText(replacement: string, start?: number, end?: number, selectMode?: 'select' | 'start' | 'end' | 'preserve'): void;
|
|
56
|
+
checkValidity(): boolean;
|
|
57
|
+
getForm(): HTMLFormElement | null;
|
|
58
|
+
reportValidity(): boolean;
|
|
59
|
+
setCustomValidity(message: string): void;
|
|
60
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
61
|
+
static styles: import("lit").CSSResultGroup[];
|
|
62
|
+
}
|
|
63
|
+
declare global {
|
|
64
|
+
interface HTMLElementTagNameMap {
|
|
65
|
+
'sd-1-33-0-textarea': SdTextarea;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { css, html } from "lit";
|
|
2
|
+
import { customElement } from "../../internal/register-custom-element.js";
|
|
3
|
+
import { defaultValue } from "../../internal/default-value.js";
|
|
4
|
+
import { FormControlController } from "../../internal/form.js";
|
|
5
|
+
import { HasSlotController } from "../../internal/slot.js";
|
|
6
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
7
|
+
import { live } from "lit/directives/live.js";
|
|
8
|
+
import { query, state, property } from "lit/decorators.js";
|
|
9
|
+
import { watch } from "../../internal/watch.js";
|
|
10
|
+
import cx from "classix";
|
|
11
|
+
import formControlStyles from "../../styles/form-control.styles.js";
|
|
12
|
+
import SolidElement from "../../internal/solid-element.js";
|
|
13
|
+
var __defProp = Object.defineProperty;
|
|
14
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
15
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
16
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
17
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
18
|
+
if (decorator = decorators[i])
|
|
19
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
20
|
+
if (kind && result)
|
|
21
|
+
__defProp(target, key, result);
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
let SdTextarea = class extends SolidElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
this.formControlController = new FormControlController(this);
|
|
28
|
+
this.hasSlotController = new HasSlotController(this, "help-text", "label");
|
|
29
|
+
this.hasFocus = false;
|
|
30
|
+
this.title = "";
|
|
31
|
+
this.name = "";
|
|
32
|
+
this.value = "";
|
|
33
|
+
this.size = "lg";
|
|
34
|
+
this.label = "";
|
|
35
|
+
this.helpText = "";
|
|
36
|
+
this.placeholder = "";
|
|
37
|
+
this.rows = 4;
|
|
38
|
+
this.disabled = false;
|
|
39
|
+
this.readonly = false;
|
|
40
|
+
this.form = "";
|
|
41
|
+
this.required = false;
|
|
42
|
+
this.spellcheck = true;
|
|
43
|
+
this.defaultValue = "";
|
|
44
|
+
}
|
|
45
|
+
/** Gets the validity state object */
|
|
46
|
+
get validity() {
|
|
47
|
+
return this.textarea.validity;
|
|
48
|
+
}
|
|
49
|
+
/** Gets the validation message */
|
|
50
|
+
get validationMessage() {
|
|
51
|
+
return this.textarea.validationMessage;
|
|
52
|
+
}
|
|
53
|
+
connectedCallback() {
|
|
54
|
+
super.connectedCallback();
|
|
55
|
+
this.updateComplete.then(() => {
|
|
56
|
+
this.setTextareaHeight();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
firstUpdated() {
|
|
60
|
+
this.formControlController.updateValidity();
|
|
61
|
+
}
|
|
62
|
+
disconnectedCallback() {
|
|
63
|
+
super.disconnectedCallback();
|
|
64
|
+
}
|
|
65
|
+
handleBlur() {
|
|
66
|
+
this.hasFocus = false;
|
|
67
|
+
this.emit("sd-blur");
|
|
68
|
+
}
|
|
69
|
+
handleChange() {
|
|
70
|
+
this.value = this.textarea.value;
|
|
71
|
+
this.setTextareaHeight();
|
|
72
|
+
this.emit("sd-change");
|
|
73
|
+
}
|
|
74
|
+
handleFocus() {
|
|
75
|
+
this.hasFocus = true;
|
|
76
|
+
this.emit("sd-focus");
|
|
77
|
+
}
|
|
78
|
+
handleInput() {
|
|
79
|
+
this.value = this.textarea.value;
|
|
80
|
+
this.formControlController.updateValidity();
|
|
81
|
+
this.emit("sd-1-33-0-input");
|
|
82
|
+
}
|
|
83
|
+
handleInvalid(event) {
|
|
84
|
+
this.formControlController.setValidity(false);
|
|
85
|
+
this.formControlController.emitInvalidEvent(event);
|
|
86
|
+
}
|
|
87
|
+
setTextareaHeight() {
|
|
88
|
+
this.textarea.style.height = void 0;
|
|
89
|
+
}
|
|
90
|
+
handleDisabledChange() {
|
|
91
|
+
this.formControlController.setValidity(this.disabled);
|
|
92
|
+
}
|
|
93
|
+
handleRowsChange() {
|
|
94
|
+
this.setTextareaHeight();
|
|
95
|
+
}
|
|
96
|
+
async handleValueChange() {
|
|
97
|
+
await this.updateComplete;
|
|
98
|
+
this.formControlController.updateValidity();
|
|
99
|
+
this.setTextareaHeight();
|
|
100
|
+
}
|
|
101
|
+
/** Sets focus on the textarea. */
|
|
102
|
+
focus(options) {
|
|
103
|
+
this.textarea.focus(options);
|
|
104
|
+
}
|
|
105
|
+
/** Removes focus from the textarea. */
|
|
106
|
+
blur() {
|
|
107
|
+
this.textarea.blur();
|
|
108
|
+
}
|
|
109
|
+
/** Selects all the text in the textarea. */
|
|
110
|
+
select() {
|
|
111
|
+
this.textarea.select();
|
|
112
|
+
}
|
|
113
|
+
/** Gets or sets the textarea's scroll position. */
|
|
114
|
+
scrollPosition(position) {
|
|
115
|
+
if (position) {
|
|
116
|
+
if (typeof position.top === "number")
|
|
117
|
+
this.textarea.scrollTop = position.top;
|
|
118
|
+
if (typeof position.left === "number")
|
|
119
|
+
this.textarea.scrollLeft = position.left;
|
|
120
|
+
return void 0;
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
top: this.textarea.scrollTop,
|
|
124
|
+
left: this.textarea.scrollTop
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/** Sets the start and end positions of the text selection (0-based). */
|
|
128
|
+
setSelectionRange(selectionStart, selectionEnd, selectionDirection = "none") {
|
|
129
|
+
this.textarea.setSelectionRange(selectionStart, selectionEnd, selectionDirection);
|
|
130
|
+
}
|
|
131
|
+
/** Replaces a range of text with a new string. */
|
|
132
|
+
setRangeText(replacement, start, end, selectMode) {
|
|
133
|
+
this.textarea.setRangeText(replacement, start, end, selectMode);
|
|
134
|
+
if (this.value !== this.textarea.value) {
|
|
135
|
+
this.value = this.textarea.value;
|
|
136
|
+
}
|
|
137
|
+
if (this.value !== this.textarea.value) {
|
|
138
|
+
this.value = this.textarea.value;
|
|
139
|
+
this.setTextareaHeight();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
|
|
143
|
+
checkValidity() {
|
|
144
|
+
var _a;
|
|
145
|
+
return (_a = this.textarea) == null ? void 0 : _a.checkValidity();
|
|
146
|
+
}
|
|
147
|
+
/** Gets the associated form, if one exists. */
|
|
148
|
+
getForm() {
|
|
149
|
+
return this.formControlController.getForm();
|
|
150
|
+
}
|
|
151
|
+
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
152
|
+
reportValidity() {
|
|
153
|
+
return this.textarea.reportValidity();
|
|
154
|
+
}
|
|
155
|
+
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
|
156
|
+
setCustomValidity(message) {
|
|
157
|
+
this.textarea.setCustomValidity(message);
|
|
158
|
+
this.formControlController.updateValidity();
|
|
159
|
+
}
|
|
160
|
+
render() {
|
|
161
|
+
const slots = {
|
|
162
|
+
label: this.hasSlotController.test("label"),
|
|
163
|
+
helpText: this.hasSlotController.test("help-text")
|
|
164
|
+
};
|
|
165
|
+
const hasLabel = this.label ? true : !!slots["label"];
|
|
166
|
+
const hasHelpText = this.helpText ? true : !!slots["helpText"];
|
|
167
|
+
const hasValidationAttr = this.required || !!this.minlength || !!this.maxlength;
|
|
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";
|
|
171
|
+
const textSize = this.size === "sm" ? "text-sm" : "text-base";
|
|
172
|
+
return html`<div part="form-control" class="${cx(
|
|
173
|
+
"form-control text-left",
|
|
174
|
+
hasLabel && "form-control--has-label",
|
|
175
|
+
hasHelpText && "form-control--has-help-text",
|
|
176
|
+
this.disabled && "cursor-not-allowed"
|
|
177
|
+
)}"><label part="form-control-label" id="label" class="${cx("form-control-label mb-2", hasLabel ? "has-label inline-block" : "hidden", textSize)}" for="input" aria-hidden="${hasLabel ? "false" : "true"}"><slot name="label">${this.label}</slot></label><div part="form-control-input" class="form-control-input relative w-full"><div part="border" class="${cx(
|
|
178
|
+
"absolute w-full h-full pointer-events-none border rounded-default",
|
|
179
|
+
{
|
|
180
|
+
disabled: "border-neutral-500",
|
|
181
|
+
readonly: "border-neutral-800",
|
|
182
|
+
activeInvalid: "border-error border-2",
|
|
183
|
+
activeValid: "border-success border-2",
|
|
184
|
+
active: "border-primary border-2",
|
|
185
|
+
invalid: "border-error",
|
|
186
|
+
valid: "border-success",
|
|
187
|
+
default: "border-neutral-800"
|
|
188
|
+
}[inputState]
|
|
189
|
+
)}"></div><div part="base" class="${cx(
|
|
190
|
+
"textarea px-4 flex flex-row items-center rounded-default textarea--resize-none",
|
|
191
|
+
{
|
|
192
|
+
sm: "textarea-sm py-1",
|
|
193
|
+
md: "textarea-md py-1",
|
|
194
|
+
lg: "textarea-lg py-2"
|
|
195
|
+
}[this.size],
|
|
196
|
+
{
|
|
197
|
+
disabled: "text-neutral-500",
|
|
198
|
+
readonly: "text-black",
|
|
199
|
+
activeInvalid: "text-error",
|
|
200
|
+
activeValid: "text-success",
|
|
201
|
+
active: "text-black",
|
|
202
|
+
invalid: "text-error",
|
|
203
|
+
valid: "text-success",
|
|
204
|
+
default: "text-black"
|
|
205
|
+
}[inputState],
|
|
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"
|
|
210
|
+
)}"><textarea part="textarea" id="input" class="${cx(
|
|
211
|
+
'textarea__control flex-grow focus:outline-none bg-transparent placeholder-neutral-700"',
|
|
212
|
+
textSize
|
|
213
|
+
)}" 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>`;
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
SdTextarea.styles = [
|
|
217
|
+
// componentStyles,
|
|
218
|
+
formControlStyles,
|
|
219
|
+
SolidElement.styles,
|
|
220
|
+
css`:host{display:block}:host([required]) #label.has-label::after{content:'*';margin-left:2px}:host([disabled]) .textarea__control{cursor:not-allowed}.no-scrollbar::-webkit-scrollbar{display:none}.textarea--resize-none .textarea__control{resize:none}`
|
|
221
|
+
];
|
|
222
|
+
__decorateClass([
|
|
223
|
+
query(".textarea__control")
|
|
224
|
+
], SdTextarea.prototype, "textarea", 2);
|
|
225
|
+
__decorateClass([
|
|
226
|
+
state()
|
|
227
|
+
], SdTextarea.prototype, "hasFocus", 2);
|
|
228
|
+
__decorateClass([
|
|
229
|
+
property()
|
|
230
|
+
], SdTextarea.prototype, "title", 2);
|
|
231
|
+
__decorateClass([
|
|
232
|
+
property()
|
|
233
|
+
], SdTextarea.prototype, "name", 2);
|
|
234
|
+
__decorateClass([
|
|
235
|
+
property()
|
|
236
|
+
], SdTextarea.prototype, "value", 2);
|
|
237
|
+
__decorateClass([
|
|
238
|
+
property({ reflect: true })
|
|
239
|
+
], SdTextarea.prototype, "size", 2);
|
|
240
|
+
__decorateClass([
|
|
241
|
+
property()
|
|
242
|
+
], SdTextarea.prototype, "label", 2);
|
|
243
|
+
__decorateClass([
|
|
244
|
+
property({ attribute: "help-text" })
|
|
245
|
+
], SdTextarea.prototype, "helpText", 2);
|
|
246
|
+
__decorateClass([
|
|
247
|
+
property()
|
|
248
|
+
], SdTextarea.prototype, "placeholder", 2);
|
|
249
|
+
__decorateClass([
|
|
250
|
+
property({ type: Number })
|
|
251
|
+
], SdTextarea.prototype, "rows", 2);
|
|
252
|
+
__decorateClass([
|
|
253
|
+
property({ type: Boolean, reflect: true })
|
|
254
|
+
], SdTextarea.prototype, "disabled", 2);
|
|
255
|
+
__decorateClass([
|
|
256
|
+
property({ type: Boolean, reflect: true })
|
|
257
|
+
], SdTextarea.prototype, "readonly", 2);
|
|
258
|
+
__decorateClass([
|
|
259
|
+
property({ reflect: true })
|
|
260
|
+
], SdTextarea.prototype, "form", 2);
|
|
261
|
+
__decorateClass([
|
|
262
|
+
property({ type: Boolean, reflect: true })
|
|
263
|
+
], SdTextarea.prototype, "required", 2);
|
|
264
|
+
__decorateClass([
|
|
265
|
+
property({ type: Number })
|
|
266
|
+
], SdTextarea.prototype, "minlength", 2);
|
|
267
|
+
__decorateClass([
|
|
268
|
+
property({ type: Number })
|
|
269
|
+
], SdTextarea.prototype, "maxlength", 2);
|
|
270
|
+
__decorateClass([
|
|
271
|
+
property()
|
|
272
|
+
], SdTextarea.prototype, "autocapitalize", 2);
|
|
273
|
+
__decorateClass([
|
|
274
|
+
property()
|
|
275
|
+
], SdTextarea.prototype, "autocorrect", 2);
|
|
276
|
+
__decorateClass([
|
|
277
|
+
property()
|
|
278
|
+
], SdTextarea.prototype, "autocomplete", 2);
|
|
279
|
+
__decorateClass([
|
|
280
|
+
property({ type: Boolean })
|
|
281
|
+
], SdTextarea.prototype, "autofocus", 2);
|
|
282
|
+
__decorateClass([
|
|
283
|
+
property()
|
|
284
|
+
], SdTextarea.prototype, "enterkeyhint", 2);
|
|
285
|
+
__decorateClass([
|
|
286
|
+
property({
|
|
287
|
+
type: Boolean,
|
|
288
|
+
converter: {
|
|
289
|
+
// Allow "true|false" attribute values but keep the property boolean
|
|
290
|
+
fromAttribute: (value) => !value || value === "false" ? false : true,
|
|
291
|
+
toAttribute: (value) => value ? "true" : "false"
|
|
292
|
+
}
|
|
293
|
+
})
|
|
294
|
+
], SdTextarea.prototype, "spellcheck", 2);
|
|
295
|
+
__decorateClass([
|
|
296
|
+
property()
|
|
297
|
+
], SdTextarea.prototype, "inputmode", 2);
|
|
298
|
+
__decorateClass([
|
|
299
|
+
defaultValue()
|
|
300
|
+
], SdTextarea.prototype, "defaultValue", 2);
|
|
301
|
+
__decorateClass([
|
|
302
|
+
watch("disabled", { waitUntilFirstUpdate: true })
|
|
303
|
+
], SdTextarea.prototype, "handleDisabledChange", 1);
|
|
304
|
+
__decorateClass([
|
|
305
|
+
watch("rows", { waitUntilFirstUpdate: true })
|
|
306
|
+
], SdTextarea.prototype, "handleRowsChange", 1);
|
|
307
|
+
__decorateClass([
|
|
308
|
+
watch("value", { waitUntilFirstUpdate: true })
|
|
309
|
+
], SdTextarea.prototype, "handleValueChange", 1);
|
|
310
|
+
SdTextarea = __decorateClass([
|
|
311
|
+
customElement("sd-1-33-0-textarea")
|
|
312
|
+
], SdTextarea);
|
|
313
|
+
export {
|
|
314
|
+
SdTextarea as default
|
|
315
|
+
};
|
|
@@ -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-33-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-33-0-icon library="system" name="info-circle" class="${cx(this.disabled && "sd-interactive--disabled")}"></sd-1-33-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-33-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-33-0-popup{--arrow-color:rgb(var(--sd-color-primary, 0 53 142) / 1);--arrow-size:10px}sd-1-33-0-popup::part(popup){pointer-events:none;z-index:10;box-shadow:0 1px 3px 0 rgb(81 81 81 / 75%)}sd-1-33-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-33-0-popup[placement^=top]::part(popup){transform-origin:bottom}sd-1-33-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-33-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-33-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-33-0-icon id="default-play-icon" library="system" name="start"></sd-1-33-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-33-0-video")
|
|
114
114
|
], SdVideo);
|
|
115
115
|
export {
|
|
116
116
|
SdVideo as default
|
|
@@ -8,7 +8,7 @@ class FormControlController {
|
|
|
8
8
|
const disabled = this.options.disabled(this.host);
|
|
9
9
|
const name = this.options.name(this.host);
|
|
10
10
|
const value = this.options.value(this.host);
|
|
11
|
-
const isButton = this.host.tagName.toLowerCase() === "sd-1-
|
|
11
|
+
const isButton = this.host.tagName.toLowerCase() === "sd-1-33-0-button";
|
|
12
12
|
if (!disabled && !isButton && typeof name === "string" && name.length > 0 && typeof value !== "undefined") {
|
|
13
13
|
if (Array.isArray(value)) {
|
|
14
14
|
value.forEach((val) => {
|
|
@@ -65,7 +65,7 @@ class FormControlController {
|
|
|
65
65
|
disabled: (input) => input.disabled ?? false,
|
|
66
66
|
reportValidity: (input) => typeof input.reportValidity === "function" ? input.reportValidity() : true,
|
|
67
67
|
setValue: (input, value) => input.value = value,
|
|
68
|
-
assumeInteractionOn: ["sd-1-
|
|
68
|
+
assumeInteractionOn: ["sd-1-33-0-input"],
|
|
69
69
|
...options
|
|
70
70
|
};
|
|
71
71
|
}
|
|
@@ -17,13 +17,16 @@ export { default as SdInput } from './components/input/input';
|
|
|
17
17
|
export { default as SdLink } from './components/link/link';
|
|
18
18
|
export { default as SdNavigationItem } from './components/navigation-item/navigation-item';
|
|
19
19
|
export { default as SdNotification } from './components/notification/notification';
|
|
20
|
+
export { default as SdOption } from './components/option/option';
|
|
20
21
|
export { default as SdPopup } from './components/popup/popup';
|
|
21
22
|
export { default as SdRadio } from './components/radio/radio';
|
|
22
23
|
export { default as SdRadioGroup } from './components/radio-group/radio-group';
|
|
24
|
+
export { default as SdSelect } from './components/select/select';
|
|
23
25
|
export { default as SdSpinner } from './components/spinner/spinner';
|
|
24
26
|
export { default as SdSwitch } from './components/switch/switch';
|
|
25
27
|
export { default as SdTag } from './components/tag/tag';
|
|
26
28
|
export { default as SdTeaser } from './components/teaser/teaser';
|
|
29
|
+
export { default as SdTextarea } from './components/textarea/textarea';
|
|
27
30
|
export { default as SdTooltip } from './components/tooltip/tooltip';
|
|
28
31
|
export { default as SdVideo } from './components/video/video';
|
|
29
32
|
export * from './utilities/icon-library';
|