nve-designsystem 0.1.62 → 0.1.63
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.
|
@@ -64,6 +64,13 @@ export default class NveTextarea extends LitElement {
|
|
|
64
64
|
* tastaturet på støttede enheter.
|
|
65
65
|
*/
|
|
66
66
|
inputmode?: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
|
|
67
|
+
/** Antall rader med tekst i textarea-taggen.
|
|
68
|
+
* Browser-default dersom denne ikke er satt er 2 i alle browsere
|
|
69
|
+
*
|
|
70
|
+
* Bestemmer initiell høyde på textarea-boksen
|
|
71
|
+
* (settes slik at antall rader * font-høyde får plass)
|
|
72
|
+
*/
|
|
73
|
+
rows?: number;
|
|
67
74
|
/** Bestemmer om feilmelding skal vises når validering feiler */
|
|
68
75
|
private showErrorMessage;
|
|
69
76
|
/** Om bruker starter å skrive noe i textarea */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { s as c, x as
|
|
1
|
+
import { s as c, x as l } from "../../chunks/lit-element.js";
|
|
2
2
|
import { n as r, t as m } from "../../chunks/property.js";
|
|
3
3
|
import { r as u } from "../../chunks/state.js";
|
|
4
4
|
import { e as b } from "../../chunks/query.js";
|
|
5
5
|
import v from "./nve-textarea.styles.js";
|
|
6
|
-
import { o
|
|
6
|
+
import { o } from "../../chunks/if-defined.js";
|
|
7
7
|
import { l as f } from "../../chunks/live.js";
|
|
8
8
|
import { e as g } from "../../chunks/class-map.js";
|
|
9
9
|
import "../nve-icon/nve-icon.component.js";
|
|
@@ -84,37 +84,38 @@ let t = class extends c {
|
|
|
84
84
|
this.toggleAttribute("data-valid", e), this.toggleAttribute("data-user-valid", e), this.toggleAttribute("data-invalid", !e), this.toggleAttribute("data-user-invalid", !e);
|
|
85
85
|
}
|
|
86
86
|
render() {
|
|
87
|
-
return
|
|
87
|
+
return l`
|
|
88
88
|
<div part="form-control" class=${g({ "form-control": !0, "form-control--has-label": this.label })}>
|
|
89
89
|
<div part="textarea-label" class="textarea__label">
|
|
90
|
-
${this.label ?
|
|
90
|
+
${this.label ? l`
|
|
91
91
|
<nve-label
|
|
92
92
|
for="input"
|
|
93
93
|
aria-hidden=${this.label ? "false" : "true"}
|
|
94
94
|
value=${this.label}
|
|
95
|
-
tooltip=${
|
|
95
|
+
tooltip=${o(this.tooltip)}
|
|
96
96
|
></nve-label>
|
|
97
97
|
` : null}
|
|
98
|
-
${this.required && this.label ?
|
|
98
|
+
${this.required && this.label ? l`<span class="textarea__required-label">${this.requiredLabel}</span>` : null}
|
|
99
99
|
</div>
|
|
100
100
|
<div part="base" class="textarea__base">
|
|
101
101
|
<textarea
|
|
102
102
|
part="textarea"
|
|
103
103
|
class="textarea__control"
|
|
104
104
|
title=${this.title}
|
|
105
|
-
name=${
|
|
105
|
+
name=${o(this.name)}
|
|
106
106
|
.value=${f(this.value)}
|
|
107
107
|
?disabled=${this.disabled}
|
|
108
108
|
?readonly=${this.readonly}
|
|
109
109
|
?required=${this.required}
|
|
110
|
-
placeholder=${
|
|
111
|
-
minlength=${
|
|
112
|
-
maxlength=${
|
|
113
|
-
autocapitalize=${
|
|
114
|
-
autocorrect=${
|
|
110
|
+
placeholder=${o(this.placeholder)}
|
|
111
|
+
minlength=${o(this.minlength)}
|
|
112
|
+
maxlength=${o(this.maxlength)}
|
|
113
|
+
autocapitalize=${o(this.autocapitalize)}
|
|
114
|
+
autocorrect=${o(this.autocorrect)}
|
|
115
115
|
?autofocus=${this.autofocus}
|
|
116
|
-
inputmode=${
|
|
116
|
+
inputmode=${o(this.inputmode)}
|
|
117
117
|
aria-describedby="help-text"
|
|
118
|
+
rows=${o(this.rows)}
|
|
118
119
|
@change=${this.handleChange}
|
|
119
120
|
@input=${this.handleInput}
|
|
120
121
|
@blur=${this.handleBlur}
|
|
@@ -124,17 +125,17 @@ let t = class extends c {
|
|
|
124
125
|
Må gjøres sånn fordi vi vil ikke begrense textarea__base brede til fit-content (da textarea kan aldri ta så mye plass som er
|
|
125
126
|
tilgjengelig i nettleseren og man må alltid sette brede på den manuelt. Nei takk.) -->
|
|
126
127
|
<!-- Foreløpig kan man ha enten 'lock' eller 'error' ikone -->
|
|
127
|
-
${this.disabled || this.showErrorMessage ?
|
|
128
|
-
${this.disabled ?
|
|
129
|
-
${this.showErrorMessage ?
|
|
128
|
+
${this.disabled || this.showErrorMessage ? l`<div class="textarea__icon__container">
|
|
129
|
+
${this.disabled ? l`<nve-icon name="lock"></nve-icon>` : null}
|
|
130
|
+
${this.showErrorMessage ? l`<nve-icon class="textarea__icon--error" name="error"></nve-icon>` : null}
|
|
130
131
|
</div>` : null}
|
|
131
132
|
</div>
|
|
132
133
|
<div part="help-text-container" class="textarea__help-text__container">
|
|
133
134
|
<!-- Ikke vis hjelpe tekst mens feil -->
|
|
134
|
-
${!this.showErrorMessage && this.helpText ?
|
|
135
|
+
${!this.showErrorMessage && this.helpText ? l`<span class="textarea__help-text" aria-hidden=${this.helpText ? "false" : "true"}
|
|
135
136
|
>${this.helpText}</span
|
|
136
137
|
>` : null}
|
|
137
|
-
${this.showErrorMessage ?
|
|
138
|
+
${this.showErrorMessage ? l`<span class="textarea__help-text textarea__help-text--error">${this.errorMessage}</span>` : null}
|
|
138
139
|
</div>
|
|
139
140
|
</div>
|
|
140
141
|
`;
|
|
@@ -195,6 +196,9 @@ i([
|
|
|
195
196
|
i([
|
|
196
197
|
r()
|
|
197
198
|
], t.prototype, "inputmode", 2);
|
|
199
|
+
i([
|
|
200
|
+
r()
|
|
201
|
+
], t.prototype, "rows", 2);
|
|
198
202
|
i([
|
|
199
203
|
u()
|
|
200
204
|
], t.prototype, "showErrorMessage", 2);
|