nve-designsystem 2.7.0 → 2.8.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as r } from "../../chunks/lit-element.js";
|
|
2
|
-
const
|
|
2
|
+
const a = r`
|
|
3
3
|
.error {
|
|
4
4
|
border-color: var(--feedback-background-emphasized-error) !important;
|
|
5
5
|
}
|
|
@@ -8,8 +8,7 @@ const t = r`
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
:host::part(control)
|
|
12
|
-
:host([disabled]:hover)::part(control) {
|
|
11
|
+
:host::part(control) {
|
|
13
12
|
border: var(--border-width-strong) solid var(--neutrals-foreground-primary);
|
|
14
13
|
border-radius: var(--border-radius-small);
|
|
15
14
|
width: 1.1rem;
|
|
@@ -18,25 +17,20 @@ const t = r`
|
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
:host::part(control control--checked),
|
|
21
|
-
:host::part(control control--indeterminate)
|
|
22
|
-
:host([disabled]:hover)::part(control control--checked),
|
|
23
|
-
:host([disabled]:hover)::part(control control--indeterminate) {
|
|
20
|
+
:host::part(control control--indeterminate) {
|
|
24
21
|
background: var(--neutrals-foreground-primary) !important;
|
|
25
22
|
border-color: var(--neutrals-foreground-primary) !important;
|
|
26
23
|
}
|
|
27
24
|
|
|
28
|
-
:host([data-invalid])::part(control)
|
|
29
|
-
:host([disabled][data-user-invalid]:hover)::part(control) {
|
|
25
|
+
:host([data-invalid])::part(control) {
|
|
30
26
|
border-color: var(--feedback-background-emphasized-error);
|
|
31
27
|
}
|
|
32
28
|
:host([data-invalid])::part(control control--checked),
|
|
33
|
-
:host([data-user-invalid])::part(control control--indeterminate)
|
|
34
|
-
:host([disabled][data-user-invalid]:hover)::part(control control--checked),
|
|
35
|
-
:host([disabled][data-user-invalid]:hover)::part(control control--indeterminate) {
|
|
29
|
+
:host([data-user-invalid])::part(control control--indeterminate) {
|
|
36
30
|
background: var(--feedback-background-emphasized-error);
|
|
37
31
|
}
|
|
38
32
|
|
|
39
|
-
:host(:hover)::part(control) {
|
|
33
|
+
:host(:not([disabled]):hover)::part(control) {
|
|
40
34
|
border-color: var(--neutrals-foreground-subtle, #006b99) !important;
|
|
41
35
|
}
|
|
42
36
|
|
|
@@ -50,9 +44,6 @@ const t = r`
|
|
|
50
44
|
background: var(--neutrals-foreground-subtle, #006b99);
|
|
51
45
|
}
|
|
52
46
|
|
|
53
|
-
.checkbox--disabled {
|
|
54
|
-
opacity: var(--disabled);
|
|
55
|
-
}
|
|
56
47
|
.checkbox {
|
|
57
48
|
align-items: center;
|
|
58
49
|
}
|
|
@@ -61,5 +52,5 @@ const t = r`
|
|
|
61
52
|
}
|
|
62
53
|
`;
|
|
63
54
|
export {
|
|
64
|
-
|
|
55
|
+
a as default
|
|
65
56
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as m, E as p, x as
|
|
2
|
-
import { n as
|
|
1
|
+
import { a as m, E as p, x as o } from "../../chunks/lit-element.js";
|
|
2
|
+
import { n as s, t as b } from "../../chunks/property.js";
|
|
3
3
|
import { r as u } from "../../chunks/state.js";
|
|
4
4
|
import { e as v } from "../../chunks/query.js";
|
|
5
5
|
import f from "./nve-textarea.styles.js";
|
|
@@ -8,10 +8,10 @@ import { l as y } from "../../chunks/live.js";
|
|
|
8
8
|
import { e as g } from "../../chunks/class-map.js";
|
|
9
9
|
import "../nve-icon/nve-icon.component.js";
|
|
10
10
|
import "../nve-label/nve-label.component.js";
|
|
11
|
-
var x = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, t = (
|
|
12
|
-
for (var
|
|
13
|
-
(c =
|
|
14
|
-
return h &&
|
|
11
|
+
var x = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, t = (i, l, a, h) => {
|
|
12
|
+
for (var n = h > 1 ? void 0 : h ? _(l, a) : l, d = i.length - 1, c; d >= 0; d--)
|
|
13
|
+
(c = i[d]) && (n = (h ? c(l, a, n) : c(n)) || n);
|
|
14
|
+
return h && n && x(l, a, n), n;
|
|
15
15
|
};
|
|
16
16
|
let e = class extends m {
|
|
17
17
|
constructor() {
|
|
@@ -22,11 +22,11 @@ let e = class extends m {
|
|
|
22
22
|
const a = this.input.checkValidity();
|
|
23
23
|
this.toggleAttribute("data-valid", a), this.toggleAttribute("data-invalid", !a);
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
const i = this.shadowRoot?.querySelector(".textarea__control"), l = this.shadowRoot?.querySelector(".textarea__label");
|
|
26
|
+
i && l && (this.resizeObserver = new ResizeObserver((a) => {
|
|
27
27
|
for (const h of a)
|
|
28
|
-
|
|
29
|
-
}), this.resizeObserver.observe(
|
|
28
|
+
l.style.width = `${h.contentRect.width + 32}px`;
|
|
29
|
+
}), this.resizeObserver.observe(i));
|
|
30
30
|
}
|
|
31
31
|
connectedCallback() {
|
|
32
32
|
super.connectedCallback(), this.closest("form")?.addEventListener("submit", this.handleSubmit.bind(this));
|
|
@@ -35,11 +35,11 @@ let e = class extends m {
|
|
|
35
35
|
super.disconnectedCallback(), this.closest("form")?.removeEventListener("submit", this.handleSubmit.bind(this)), this.resizeObserver?.disconnect();
|
|
36
36
|
}
|
|
37
37
|
// kan senere flyttes til utils hvis blir brukt flere steder
|
|
38
|
-
emit(
|
|
39
|
-
this.dispatchEvent(new CustomEvent(
|
|
38
|
+
emit(i) {
|
|
39
|
+
this.dispatchEvent(new CustomEvent(i));
|
|
40
40
|
}
|
|
41
|
-
handleSubmit(
|
|
42
|
-
|
|
41
|
+
handleSubmit(i) {
|
|
42
|
+
i.preventDefault(), this.checkValidity();
|
|
43
43
|
}
|
|
44
44
|
// validerer ikke hvis bruker ikke har tatt på input feltet
|
|
45
45
|
handleBlur() {
|
|
@@ -55,8 +55,8 @@ let e = class extends m {
|
|
|
55
55
|
checkValidity() {
|
|
56
56
|
this.input.checkValidity() ? this.resetValidation() : this.makeInvalid();
|
|
57
57
|
}
|
|
58
|
-
setCustomValidity(
|
|
59
|
-
this.input.setCustomValidity(
|
|
58
|
+
setCustomValidity(i = "") {
|
|
59
|
+
this.input.setCustomValidity(i), this.checkValidity();
|
|
60
60
|
}
|
|
61
61
|
makeInvalid() {
|
|
62
62
|
this.errorMessage = this.errorMessage || this.input.validationMessage, this.showErrorMessage = !0, this.emit("sl-invalid"), this.toggleValidationAttributes(!1);
|
|
@@ -65,16 +65,20 @@ let e = class extends m {
|
|
|
65
65
|
this.showErrorMessage = !1, this.toggleValidationAttributes(!0);
|
|
66
66
|
}
|
|
67
67
|
/** Toggler riktig validering attribute for å vise riktig style */
|
|
68
|
-
toggleValidationAttributes(
|
|
69
|
-
this.toggleAttribute("data-valid",
|
|
68
|
+
toggleValidationAttributes(i) {
|
|
69
|
+
this.toggleAttribute("data-valid", i), this.toggleAttribute("data-user-valid", i), this.toggleAttribute("data-invalid", !i), this.toggleAttribute("data-user-invalid", !i);
|
|
70
70
|
}
|
|
71
71
|
// eslint-disable-next-line max-lines-per-function
|
|
72
72
|
render() {
|
|
73
|
-
|
|
73
|
+
const i = !!this.querySelector('[slot="label"]');
|
|
74
|
+
return o`
|
|
74
75
|
<div part="form-control" class=${g({ "form-control": !0, "form-control--has-label": this.label })}>
|
|
75
|
-
${
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
${i ? o`<slot name="label"></slot>` : this.label ? o`<nve-label
|
|
77
|
+
id="label"
|
|
78
|
+
value=${this.label}
|
|
79
|
+
size="small"
|
|
80
|
+
tooltip=${r(this.tooltip)}
|
|
81
|
+
></nve-label>` : p}
|
|
78
82
|
<div part="base" class="textarea__base">
|
|
79
83
|
<textarea
|
|
80
84
|
part="textarea"
|
|
@@ -103,17 +107,17 @@ let e = class extends m {
|
|
|
103
107
|
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
|
|
104
108
|
tilgjengelig i nettleseren og man må alltid sette brede på den manuelt. Nei takk.) -->
|
|
105
109
|
<!-- Foreløpig kan man ha enten 'lock' eller 'error' ikone -->
|
|
106
|
-
${this.disabled || this.showErrorMessage ?
|
|
107
|
-
${this.disabled ?
|
|
108
|
-
${this.showErrorMessage ?
|
|
110
|
+
${this.disabled || this.showErrorMessage ? o`<div class="textarea__icon__container">
|
|
111
|
+
${this.disabled ? o`<nve-icon name="lock"></nve-icon>` : null}
|
|
112
|
+
${this.showErrorMessage ? o`<nve-icon class="textarea__icon--error" name="error"></nve-icon>` : null}
|
|
109
113
|
</div>` : p}
|
|
110
114
|
</div>
|
|
111
115
|
<div part="help-text-container" class="textarea__help-text__container">
|
|
112
116
|
<!-- Ikke vis hjelpe tekst mens feil -->
|
|
113
|
-
${!this.showErrorMessage && this.helpText ?
|
|
117
|
+
${!this.showErrorMessage && this.helpText ? o`<span class="textarea__help-text" aria-hidden=${this.helpText ? "false" : "true"}
|
|
114
118
|
>${this.helpText}</span
|
|
115
119
|
>` : p}
|
|
116
|
-
${this.showErrorMessage ?
|
|
120
|
+
${this.showErrorMessage ? o`<span class="textarea__help-text textarea__help-text--error">${this.errorMessage}</span>` : p}
|
|
117
121
|
</div>
|
|
118
122
|
</div>
|
|
119
123
|
`;
|
|
@@ -121,64 +125,64 @@ let e = class extends m {
|
|
|
121
125
|
};
|
|
122
126
|
e.styles = [f];
|
|
123
127
|
t([
|
|
124
|
-
|
|
128
|
+
s()
|
|
125
129
|
], e.prototype, "name", 2);
|
|
126
130
|
t([
|
|
127
|
-
|
|
131
|
+
s()
|
|
128
132
|
], e.prototype, "value", 2);
|
|
129
133
|
t([
|
|
130
|
-
|
|
134
|
+
s()
|
|
131
135
|
], e.prototype, "errorMessage", 2);
|
|
132
136
|
t([
|
|
133
|
-
|
|
137
|
+
s()
|
|
134
138
|
], e.prototype, "title", 2);
|
|
135
139
|
t([
|
|
136
|
-
|
|
140
|
+
s({ type: Boolean, reflect: !0 })
|
|
137
141
|
], e.prototype, "filled", 2);
|
|
138
142
|
t([
|
|
139
|
-
|
|
143
|
+
s()
|
|
140
144
|
], e.prototype, "label", 2);
|
|
141
145
|
t([
|
|
142
|
-
|
|
146
|
+
s()
|
|
143
147
|
], e.prototype, "helpText", 2);
|
|
144
148
|
t([
|
|
145
|
-
|
|
149
|
+
s({ type: Boolean, reflect: !0 })
|
|
146
150
|
], e.prototype, "disabled", 2);
|
|
147
151
|
t([
|
|
148
|
-
|
|
152
|
+
s({ type: Boolean, reflect: !0 })
|
|
149
153
|
], e.prototype, "readonly", 2);
|
|
150
154
|
t([
|
|
151
|
-
|
|
155
|
+
s()
|
|
152
156
|
], e.prototype, "placeholder", 2);
|
|
153
157
|
t([
|
|
154
|
-
|
|
158
|
+
s({ type: Boolean, reflect: !0 })
|
|
155
159
|
], e.prototype, "required", 2);
|
|
156
160
|
t([
|
|
157
|
-
|
|
161
|
+
s()
|
|
158
162
|
], e.prototype, "requiredLabel", 2);
|
|
159
163
|
t([
|
|
160
|
-
|
|
164
|
+
s({ type: Number })
|
|
161
165
|
], e.prototype, "minlength", 2);
|
|
162
166
|
t([
|
|
163
|
-
|
|
167
|
+
s({ type: Number })
|
|
164
168
|
], e.prototype, "maxlength", 2);
|
|
165
169
|
t([
|
|
166
|
-
|
|
170
|
+
s()
|
|
167
171
|
], e.prototype, "autocapitalize", 2);
|
|
168
172
|
t([
|
|
169
|
-
|
|
173
|
+
s()
|
|
170
174
|
], e.prototype, "autocorrect", 2);
|
|
171
175
|
t([
|
|
172
|
-
|
|
176
|
+
s()
|
|
173
177
|
], e.prototype, "tooltip", 2);
|
|
174
178
|
t([
|
|
175
|
-
|
|
179
|
+
s({ reflect: !0, type: String })
|
|
176
180
|
], e.prototype, "testId", 2);
|
|
177
181
|
t([
|
|
178
|
-
|
|
182
|
+
s()
|
|
179
183
|
], e.prototype, "inputmode", 2);
|
|
180
184
|
t([
|
|
181
|
-
|
|
185
|
+
s()
|
|
182
186
|
], e.prototype, "rows", 2);
|
|
183
187
|
t([
|
|
184
188
|
u()
|
package/custom-elements.json
CHANGED