nve-designsystem 3.2.0 → 3.3.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/chunks/chunk.2PCBEMQZ.js +163 -226
- package/chunks/chunk.36O46B5H.js +15 -15
- package/chunks/chunk.4TUIT776.js +78 -96
- package/chunks/chunk.5JY5FUCG.js +965 -1245
- package/chunks/chunk.5P45LHIX.js +668 -96
- package/chunks/chunk.6CTB5ZDJ.js +107 -100
- package/chunks/chunk.B4BZKR24.js +29 -39
- package/chunks/chunk.D5YQDJ7X.js +122 -166
- package/chunks/chunk.EA437WHD.js +5 -5
- package/chunks/chunk.GI7VDIWX.js +14 -15
- package/chunks/chunk.GMYPQTFK.js +18 -20
- package/chunks/chunk.HVTXQL7M.js +191 -215
- package/chunks/chunk.IKV4VH3T.js +18 -16
- package/chunks/chunk.IVVHNXMC.js +26 -27
- package/chunks/chunk.JHOXTQXA.js +65 -74
- package/chunks/chunk.JXOKFADN.js +63 -90
- package/chunks/chunk.K7JGTRV7.js +24 -23
- package/chunks/chunk.KPLQLAWP.js +132 -147
- package/chunks/chunk.LD4M4QGE.js +61 -74
- package/chunks/chunk.MSKEYBDI.js +53 -71
- package/chunks/chunk.NYIIDP5N.js +39 -45
- package/chunks/chunk.RWUUFNUL.js +91 -114
- package/chunks/chunk.SAPQLUO4.js +249 -228
- package/chunks/chunk.SI4ACBFK.js +139 -5
- package/chunks/chunk.TP2GB2HO.js +361 -460
- package/chunks/chunk.UDWRA64J.js +185 -223
- package/chunks/chunk.URTPIBTY.js +119 -151
- package/chunks/chunk.VESXC477.js +63 -66
- package/chunks/chunk.XA43ZQPC.js +198 -313
- package/chunks/chunk.XQ2OKYYA.js +25 -26
- package/chunks/chunk.XZNBUGX7.js +6 -6
- package/chunks/chunk.YHLNUJ7P.js +93 -116
- package/chunks/chunk.ZH2AND3P.js +340 -399
- package/chunks/chunk.ZL53POKZ.js +61 -156
- package/chunks/chunk.js +20 -0
- package/chunks/class-map.js +49 -45
- package/chunks/decorate.js +105 -0
- package/chunks/directive-helpers.js +5 -7
- package/chunks/if-defined.js +5 -5
- package/chunks/lit.js +525 -0
- package/chunks/live.js +24 -24
- package/chunks/nve-alert.component.js +163 -0
- package/chunks/nve-carousel-item.component.js +36 -0
- package/chunks/nve-carousel.component.js +41 -0
- package/chunks/nve-checkbox-group.component.js +114 -0
- package/chunks/nve-checkbox.component.js +28 -0
- package/chunks/nve-dialog.component.js +39 -0
- package/chunks/nve-divider.component.js +23 -0
- package/chunks/nve-drawer.component.js +40 -0
- package/chunks/nve-dropdown.component.js +83 -0
- package/chunks/nve-input.component.js +80 -0
- package/chunks/nve-label.component.js +89 -0
- package/chunks/nve-menu-item.component.js +35 -0
- package/chunks/nve-menu.component.js +17 -0
- package/chunks/nve-option.component.js +27 -0
- package/chunks/nve-popup.component.js +15 -0
- package/chunks/nve-radio-button.component.js +20 -0
- package/chunks/nve-radio-group.component.js +78 -0
- package/chunks/nve-radio.component.js +18 -0
- package/chunks/nve-select.component.js +58 -0
- package/chunks/nve-skeleton.component.js +20 -0
- package/chunks/nve-spinner.component.js +23 -0
- package/chunks/nve-tooltip.component.js +20 -0
- package/chunks/nve-warning-level.component.js +57 -0
- package/chunks/ref.js +75 -84
- package/chunks/shoelace.js +10006 -0
- package/chunks/static-html.js +27 -0
- package/chunks/unsafe-html.js +24 -20
- package/chunks/updateInvalidProperty.js +7 -7
- package/chunks/watch.js +20 -20
- package/components/nve-accordion/nve-accordion.component.js +24 -30
- package/components/nve-accordion-item/nve-accordion-item.component.js +30 -64
- package/components/nve-accordion-item/nve-accordion-item.styles.js +5 -5
- package/components/nve-alert/nve-alert.component.js +2 -227
- package/components/nve-alert/nve-alert.styles.js +45 -27
- package/components/nve-badge/nve-badge.component.js +41 -45
- package/components/nve-badge/nve-badge.styles.js +33 -31
- package/components/nve-button/nve-button.component.d.ts +110 -10
- package/components/nve-button/nve-button.component.js +146 -39
- package/components/nve-button/nve-button.styles.js +214 -157
- package/components/nve-carousel/nve-carousel.component.js +2 -47
- package/components/nve-carousel/nve-carousel.styles.js +6 -6
- package/components/nve-carousel-item/nve-carousel-item.component.js +2 -40
- package/components/nve-carousel-item/nve-carousel-item.styles.js +5 -5
- package/components/nve-carousel-thumbnail/nve-carousel-thumbnail.component.js +44 -54
- package/components/nve-carousel-thumbnail/nve-carousel-thumbnail.styles.js +5 -5
- package/components/nve-checkbox/nve-checkbox.component.js +2 -34
- package/components/nve-checkbox/nve-checkbox.styles.js +7 -7
- package/components/nve-checkbox-group/nve-checkbox-group.component.js +2 -152
- package/components/nve-checkbox-group/nve-checkbox-group.styles.js +5 -5
- package/components/nve-combobox/nve-combobox.component.js +222 -440
- package/components/nve-combobox/nve-combobox.styles.js +6 -6
- package/components/nve-darkmode-switch/nve-darkmode-switch.component.js +32 -38
- package/components/nve-dialog/nve-dialog-styles.js +6 -6
- package/components/nve-dialog/nve-dialog.component.js +2 -54
- package/components/nve-divider/nve-divider.component.js +2 -30
- package/components/nve-drawer/nve-drawer.component.js +2 -44
- package/components/nve-drawer/nve-drawer.styles.js +6 -6
- package/components/nve-dropdown/nve-dropdown.component.js +2 -79
- package/components/nve-dropdown/nve-dropdown.styles.js +5 -5
- package/components/nve-heading/nve-heading.component.d.ts +29 -0
- package/components/nve-heading/nve-heading.component.js +45 -0
- package/components/nve-heading/nve-heading.styles.d.ts +2 -0
- package/components/nve-heading/nve-heading.styles.js +41 -0
- package/components/nve-icon/nve-icon.component.js +145 -164
- package/components/nve-icon/nve-icon.styles.js +11 -6
- package/components/nve-icon/offline-icons.js +16 -13
- package/components/nve-input/nve-input.component.js +2 -100
- package/components/nve-input/nve-input.styles.js +5 -5
- package/components/nve-label/nve-label.component.js +2 -115
- package/components/nve-label/nve-label.styles.js +5 -5
- package/components/nve-link-card/nve-link-card.component.d.ts +5 -2
- package/components/nve-link-card/nve-link-card.component.js +44 -80
- package/components/nve-link-card/nve-link-card.styles.js +71 -66
- package/components/nve-menu/nve-menu.component.js +2 -22
- package/components/nve-menu/nve-menu.styles.js +5 -5
- package/components/nve-menu-item/nve-menu-item.component.js +2 -43
- package/components/nve-menu-item/nve-menu-item.styles.js +7 -7
- package/components/nve-message-card/nve-message-card.component.js +61 -91
- package/components/nve-message-card/nve-message-card.styles.js +24 -27
- package/components/nve-navigation-card/nve-navigation-card.component.d.ts +52 -0
- package/components/nve-navigation-card/nve-navigation-card.component.js +60 -0
- package/components/nve-navigation-card/nve-navigation-card.styles.d.ts +2 -0
- package/components/nve-navigation-card/nve-navigation-card.styles.js +112 -0
- package/components/nve-option/nve-option.component.js +2 -41
- package/components/nve-option/nve-option.styles.js +5 -5
- package/components/nve-paragraph/nve-paragraph.component.d.ts +26 -0
- package/components/nve-paragraph/nve-paragraph.component.js +26 -0
- package/components/nve-paragraph/nve-paragraph.styles.d.ts +2 -0
- package/components/nve-paragraph/nve-paragraph.styles.js +105 -0
- package/components/nve-popup/nve-popup.component.js +2 -22
- package/components/nve-radio/nve-radio.component.js +2 -23
- package/components/nve-radio/nve-radio.styles.js +5 -5
- package/components/nve-radio-button/nve-radio-button.component.js +2 -25
- package/components/nve-radio-button/nve-radio-button.styles.js +5 -5
- package/components/nve-radio-group/nve-radio-group.component.js +2 -119
- package/components/nve-radio-group/nve-radio-group.styles.js +5 -5
- package/components/nve-relative-time/nve-relative-time.component.js +21 -56
- package/components/nve-relative-time/nve-relative-time.styles.js +5 -5
- package/components/nve-select/nve-select.component.js +2 -80
- package/components/nve-select/nve-select.styles.js +5 -5
- package/components/nve-skeleton/nve-skeleton.component.js +2 -27
- package/components/nve-skeleton/nve-skeleton.styles.js +5 -5
- package/components/nve-spinner/nve-spinner.component.js +2 -31
- package/components/nve-stepper/nve-step/nve-step.component.js +113 -173
- package/components/nve-stepper/nve-step/nve-step.styles.js +12 -12
- package/components/nve-stepper/nve-stepper-mobile.component.js +37 -49
- package/components/nve-stepper/nve-stepper-mobile.styles.js +7 -7
- package/components/nve-stepper/nve-stepper.component.js +94 -139
- package/components/nve-stepper/nve-stepper.styles.js +5 -5
- package/components/nve-switch/nve-switch.component.js +75 -107
- package/components/nve-switch/nve-switch.styles.js +7 -7
- package/components/nve-tab/nve-tab.component.js +30 -42
- package/components/nve-tab/nve-tab.styles.js +7 -7
- package/components/nve-tab-group/nve-tab-group.component.js +180 -260
- package/components/nve-tab-group/nve-tab-group.styles.js +5 -5
- package/components/nve-tab-panel/nve-tab-panel.component.js +21 -31
- package/components/nve-tab-panel/nve-tab-panel.styles.js +5 -5
- package/components/nve-tag/nve-tag.component.d.ts +3 -3
- package/components/nve-tag/nve-tag.component.js +71 -72
- package/components/nve-tag/nve-tag.styles.js +23 -22
- package/components/nve-textarea/nve-textarea.component.d.ts +3 -1
- package/components/nve-textarea/nve-textarea.component.js +112 -173
- package/components/nve-textarea/nve-textarea.styles.js +10 -5
- package/components/nve-tooltip/nve-tooltip.component.js +2 -30
- package/components/nve-tooltip/nve-tooltip.styles.js +5 -5
- package/components/nve-warning-level/nve-warning-level.component.js +2 -78
- package/components/nve-warning-level/nve-warning-level.styles.js +7 -7
- package/css/global.css +13 -55
- package/css/nve.css +1048 -393
- package/css/nve_dark.css +406 -305
- package/css/rme.css +1050 -395
- package/css/rme_dark.css +408 -307
- package/css/shoelace-styles.css +539 -0
- package/css/varsom.css +1046 -391
- package/css/varsom_dark.css +404 -303
- package/custom-elements.json +2905 -12389
- package/fonts/LICENSE.txt +37 -0
- package/fonts/SourceSans3-VariableFont_wght.woff2 +0 -0
- package/interfaces/NveComponent.interface.js +0 -1
- package/nve-designsystem.d.ts +5 -0
- package/nve-designsystem.js +46 -86
- package/package.json +26 -8
- package/registerIcons/systemLibraryCustomization.js +23 -91
- package/vite-env.d.js +0 -1
- package/chunks/chunk.3RPBFEDE.js +0 -162
- package/chunks/chunk.JCXLDPQF.js +0 -225
- package/chunks/chunk.JQBT7BOV.js +0 -8446
- package/chunks/chunk.MAQXLKQ7.js +0 -598
- package/chunks/lit-element.js +0 -508
- package/chunks/property.js +0 -37
- package/chunks/query.js +0 -13
- package/chunks/state.js +0 -7
- package/chunks/static.js +0 -26
- package/nve-designsystem.css +0 -1
- package/vscode.css-custom-data.json +0 -621
- package/vscode.html-custom-data.json +0 -2354
|
@@ -1,292 +1,212 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import y from "../nve-tab/nve-tab.component.js";
|
|
1
|
+
import { a as e, n as t, t as n } from "../../chunks/lit.js";
|
|
2
|
+
import { a as r, o as i, s as a, t as o } from "../../chunks/decorate.js";
|
|
3
|
+
import { t as s } from "../../chunks/class-map.js";
|
|
4
|
+
import { t as c } from "../../chunks/if-defined.js";
|
|
6
5
|
import "../nve-icon/nve-icon.component.js";
|
|
7
6
|
import "../nve-button/nve-button.component.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Sjekker om tab gruppen har overflow og oppdaterer tilstanden for scroll knappene.
|
|
165
|
-
* Kalles ved endring av størrelse på tab gruppen.
|
|
166
|
-
*/
|
|
167
|
-
checkOverflow() {
|
|
168
|
-
const t = this.shadowRoot?.querySelector(".tab-group__nav");
|
|
169
|
-
if (!t) return;
|
|
170
|
-
const e = t.scrollWidth > t.clientWidth;
|
|
171
|
-
this.isOverflow = e, this.updateScrollState();
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Oppdaterer tilstanden for scroll knappene basert på gjeldende scroll posisjon.
|
|
175
|
-
* Kalles når brukeren scroller i tab gruppen.
|
|
176
|
-
*/
|
|
177
|
-
updateScrollState() {
|
|
178
|
-
const t = this.shadowRoot?.querySelector(".tab-group__nav");
|
|
179
|
-
t && (this.canScrollBack = t.scrollLeft > 0, this.canScrollForward = t.scrollLeft + t.clientWidth + 5 < t.scrollWidth);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Ruller navigasjonslisten fremover. Flytter den siste fanen som er full synlig (den blir den første nå).
|
|
183
|
-
*/
|
|
184
|
-
scrollNavForward() {
|
|
185
|
-
const t = this.shadowRoot?.querySelector(".tab-group__nav");
|
|
186
|
-
if (!t || !this.tabs.length) return;
|
|
187
|
-
const e = t.scrollLeft, o = t.clientWidth, a = e + o;
|
|
188
|
-
for (let s of this.tabs)
|
|
189
|
-
if (s.offsetLeft + s.offsetWidth > a) {
|
|
190
|
-
const l = this.tabs[this.tabs.indexOf(s) - 1], p = l ? l.offsetLeft : 0;
|
|
191
|
-
t.scrollTo({
|
|
192
|
-
left: p - this.buttonContainerWidth,
|
|
193
|
-
behavior: "smooth"
|
|
194
|
-
});
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Ruller navigasjonslisten bakover. Flytter den første fanen som er full synlig (den blir den første nå).
|
|
200
|
-
*/
|
|
201
|
-
scrollNavBackward() {
|
|
202
|
-
const t = this.shadowRoot?.querySelector(".tab-group__nav");
|
|
203
|
-
if (!t || !this.tabs.length) return;
|
|
204
|
-
const e = t.clientWidth, o = t.scrollLeft;
|
|
205
|
-
for (let a of this.tabs) {
|
|
206
|
-
const s = a.offsetLeft, i = s + a.offsetWidth;
|
|
207
|
-
if (s > o) {
|
|
208
|
-
t.scrollTo({
|
|
209
|
-
left: i - e + this.buttonContainerWidth,
|
|
210
|
-
behavior: "smooth"
|
|
211
|
-
});
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
render() {
|
|
217
|
-
return u`
|
|
7
|
+
import l from "../nve-tab/nve-tab.component.js";
|
|
8
|
+
import u from "./nve-tab-group.styles.js";
|
|
9
|
+
//#region src/components/nve-tab-group/nve-tab-group.component.ts
|
|
10
|
+
var d = class extends n {
|
|
11
|
+
static {
|
|
12
|
+
this.styles = [u];
|
|
13
|
+
}
|
|
14
|
+
firstUpdated() {
|
|
15
|
+
this.syncTabsAndPanels();
|
|
16
|
+
let e = this.shadowRoot?.querySelector(".tab-group__nav");
|
|
17
|
+
e && this.resizeObserver && (this.resizeObserver.observe(e), e.addEventListener("scroll", () => this.updateScrollState()));
|
|
18
|
+
}
|
|
19
|
+
async updated(e) {
|
|
20
|
+
super.updated?.(e), (e.has("canScrollBack") || e.has("isOverflow")) && await this.removeTabIndexFromBackwardScrollButton(), (e.has("canScrollForward") || e.has("isOverflow")) && await this.removeTabIndexFromForwardScrollButton();
|
|
21
|
+
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
super.connectedCallback(), this.style.setProperty("--button-container-width", `${this.buttonContainerWidth}px`), this.setAttribute("role", "tablist"), this.resizeObserver = new ResizeObserver(() => this.checkOverflow()), this.addEventListener("click", this.handleClick), this.addEventListener("keydown", this.handleKeyDown);
|
|
24
|
+
}
|
|
25
|
+
disconnectedCallback() {
|
|
26
|
+
super.disconnectedCallback(), this.resizeObserver?.disconnect();
|
|
27
|
+
let e = this.shadowRoot?.querySelector(".tab-group__nav");
|
|
28
|
+
e && e.removeEventListener("scroll", () => this.updateScrollState()), this.removeEventListener("click", this.handleClick), this.removeEventListener("keydown", this.handleKeyDown);
|
|
29
|
+
}
|
|
30
|
+
constructor() {
|
|
31
|
+
super(), this.testId = void 0, this.background = !1, this.size = "large", this.activeTab = null, this.isOverflow = !1, this.canScrollBack = !1, this.canScrollForward = !1, this.isBackground = !1, this.tabs = [], this.panels = [], this.buttonContainerWidth = 40;
|
|
32
|
+
}
|
|
33
|
+
handleClick(e) {
|
|
34
|
+
let t = e.composedPath(), n = t.find((e) => e instanceof HTMLElement && e.tagName.toLowerCase() === "nve-tab");
|
|
35
|
+
t.find((e) => e instanceof HTMLElement && e.tagName.toLowerCase() === "nve-tab-group") === this && (n instanceof l && n.disabled || n && n.panel && this.setActiveTab(n.panel));
|
|
36
|
+
}
|
|
37
|
+
handleKeyDown(e) {
|
|
38
|
+
let t = e.composedPath(), n = t.find((e) => e instanceof HTMLElement && e.closest && e.closest("nve-tab") === e) || null;
|
|
39
|
+
if (t.find((e) => e instanceof HTMLElement && e.tagName.toLowerCase() === "nve-tab-group") === this && (["Enter", " "].includes(e.key) && n && n.panel && (this.setActiveTab(n.panel), e.preventDefault()), [
|
|
40
|
+
"ArrowLeft",
|
|
41
|
+
"ArrowRight",
|
|
42
|
+
"Home",
|
|
43
|
+
"End"
|
|
44
|
+
].includes(e.key))) {
|
|
45
|
+
let t = this.tabs.find((e) => e === n);
|
|
46
|
+
if (!t) return;
|
|
47
|
+
let r, i = this.tabs.filter((e) => !e.disabled), a = i.indexOf(t);
|
|
48
|
+
e.key === "ArrowLeft" && (r = a > 0 ? i[a - 1] : i[i.length - 1]), e.key === "ArrowRight" && (r = a < i.length - 1 ? i[a + 1] : i[0]), e.key === "Home" && (r = i[0]), e.key === "End" && (r = i[i.length - 1]), r && (r.focus(), e.preventDefault());
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
getPanels() {
|
|
52
|
+
let e = this.shadowRoot?.querySelector("slot:not([name])");
|
|
53
|
+
return e ? e.assignedElements({ flatten: !0 }).filter((e) => e.tagName.toLowerCase() === "nve-tab-panel") : [];
|
|
54
|
+
}
|
|
55
|
+
getTabs() {
|
|
56
|
+
let e = this.shadowRoot?.querySelector("slot[name=\"nav\"]");
|
|
57
|
+
return e ? e.assignedElements({ flatten: !0 }).filter((e) => e.tagName.toLowerCase() === "nve-tab") : [];
|
|
58
|
+
}
|
|
59
|
+
setActiveTab(e) {
|
|
60
|
+
this.tabs.forEach((t) => t.setAttribute("aria-selected", `${t.panel === e}`)), this.tabs.forEach((t) => t.setAttribute("tabindex", t.panel === e ? "0" : "-1")), this.panels.forEach((t) => t.classList.toggle("tab-panel--hidden", t.name !== e)), this.activeTab = e, requestAnimationFrame(() => {
|
|
61
|
+
this.updateIndicator();
|
|
62
|
+
}), requestAnimationFrame(() => {
|
|
63
|
+
let e = this.tabs.find((e) => e.getAttribute("aria-selected") === "true");
|
|
64
|
+
if (e) {
|
|
65
|
+
let t = this.shadowRoot?.querySelector(".tab-group__nav");
|
|
66
|
+
if (t) {
|
|
67
|
+
let n = e.offsetLeft, r = e.offsetLeft + e.offsetWidth;
|
|
68
|
+
(n < t.scrollLeft || r > t.scrollLeft + t.clientWidth) && t.scrollTo({
|
|
69
|
+
left: n,
|
|
70
|
+
behavior: "smooth"
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}), this.dispatchEvent(new CustomEvent("nve-tab-change", {
|
|
75
|
+
detail: e,
|
|
76
|
+
bubbles: !0,
|
|
77
|
+
composed: !0
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
updateIndicator() {
|
|
81
|
+
if (this.isBackground) return;
|
|
82
|
+
let e = this.shadowRoot?.querySelector(".tab-group__nav"), t = this.tabs.find((e) => e.getAttribute("aria-selected") === "true");
|
|
83
|
+
if (e && t) {
|
|
84
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect().left - n.left + e.scrollLeft, i = t.offsetWidth;
|
|
85
|
+
e.style.setProperty("--indicator-x", `${r}px`), e.style.setProperty("--indicator-width", `${i}px`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
setAriaLabels() {
|
|
89
|
+
this.tabs.forEach((e) => {
|
|
90
|
+
let t = this.panels.find((t) => t.name === e.panel);
|
|
91
|
+
t && (e.setAttribute("aria-controls", t.id), t.setAttribute("aria-labelledby", e.id));
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
async syncTabsAndPanels() {
|
|
95
|
+
if (await customElements.whenDefined("nve-tab"), await customElements.whenDefined("nve-tab-panel"), this.tabs = this.getTabs(), this.panels = this.getPanels(), this.setAriaLabels(), this.tabs.forEach((e) => {
|
|
96
|
+
e.background = e.background ? e.background : this.background;
|
|
97
|
+
}), this.isBackground = this.tabs.some((e) => e.background) || this.background, this.tabs.forEach((e) => {
|
|
98
|
+
e.size = this.size;
|
|
99
|
+
}), this.activeTab) this.setActiveTab(this.activeTab);
|
|
100
|
+
else {
|
|
101
|
+
let e = this.tabs.length > 0 ? this.tabs[0].panel : null;
|
|
102
|
+
e && this.setActiveTab(e);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async removeTabIndexFromForwardScrollButton() {
|
|
106
|
+
let e = (this.shadowRoot?.querySelector(".tab-group__nav-button--forward"))?.querySelector("nve-button");
|
|
107
|
+
if (e) {
|
|
108
|
+
await e.updateComplete;
|
|
109
|
+
let t = e.shadowRoot?.querySelector("[part=\"base\"]");
|
|
110
|
+
t && t.setAttribute("tabindex", "-1");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async removeTabIndexFromBackwardScrollButton() {
|
|
114
|
+
let e = (this.shadowRoot?.querySelector(".tab-group__nav-button--backward"))?.querySelector("nve-button");
|
|
115
|
+
if (e) {
|
|
116
|
+
await e.updateComplete;
|
|
117
|
+
let t = e.shadowRoot?.querySelector("[part=\"base\"]");
|
|
118
|
+
t && t.setAttribute("tabindex", "-1");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
checkOverflow() {
|
|
122
|
+
let e = this.shadowRoot?.querySelector(".tab-group__nav");
|
|
123
|
+
if (!e) return;
|
|
124
|
+
let t = e.scrollWidth > e.clientWidth;
|
|
125
|
+
this.isOverflow = t, this.updateScrollState();
|
|
126
|
+
}
|
|
127
|
+
updateScrollState() {
|
|
128
|
+
let e = this.shadowRoot?.querySelector(".tab-group__nav");
|
|
129
|
+
e && (this.canScrollBack = e.scrollLeft > 0, this.canScrollForward = e.scrollLeft + e.clientWidth + 5 < e.scrollWidth);
|
|
130
|
+
}
|
|
131
|
+
scrollNavForward() {
|
|
132
|
+
let e = this.shadowRoot?.querySelector(".tab-group__nav");
|
|
133
|
+
if (!e || !this.tabs.length) return;
|
|
134
|
+
let t = e.scrollLeft + e.clientWidth;
|
|
135
|
+
for (let n of this.tabs) if (n.offsetLeft + n.offsetWidth > t) {
|
|
136
|
+
let t = this.tabs[this.tabs.indexOf(n) - 1], r = t ? t.offsetLeft : 0;
|
|
137
|
+
e.scrollTo({
|
|
138
|
+
left: r - this.buttonContainerWidth,
|
|
139
|
+
behavior: "smooth"
|
|
140
|
+
});
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
scrollNavBackward() {
|
|
145
|
+
let e = this.shadowRoot?.querySelector(".tab-group__nav");
|
|
146
|
+
if (!e || !this.tabs.length) return;
|
|
147
|
+
let t = e.clientWidth, n = e.scrollLeft;
|
|
148
|
+
for (let r of this.tabs) {
|
|
149
|
+
let i = r.offsetLeft, a = i + r.offsetWidth;
|
|
150
|
+
if (i > n) {
|
|
151
|
+
e.scrollTo({
|
|
152
|
+
left: a - t + this.buttonContainerWidth,
|
|
153
|
+
behavior: "smooth"
|
|
154
|
+
});
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
render() {
|
|
160
|
+
return e`
|
|
218
161
|
<div
|
|
219
162
|
part="base"
|
|
220
163
|
class="tab-group"
|
|
221
164
|
@click=${this.handleClick}
|
|
222
165
|
@keydown=${this.handleKeyDown}
|
|
223
|
-
testId=${
|
|
166
|
+
testId=${c(this.testId)}
|
|
224
167
|
>
|
|
225
168
|
<div class="tab-group__nav-container">
|
|
226
169
|
<div
|
|
227
170
|
part="nav"
|
|
228
|
-
class=${
|
|
171
|
+
class=${s({
|
|
172
|
+
"tab-group__nav": !0,
|
|
173
|
+
"tab-group__nav--background": this.isBackground
|
|
174
|
+
})}
|
|
229
175
|
>
|
|
230
176
|
<slot name="nav"></slot>
|
|
231
177
|
</div>
|
|
232
|
-
${this.canScrollBack && this.isOverflow ?
|
|
178
|
+
${this.canScrollBack && this.isOverflow ? e`
|
|
233
179
|
<div
|
|
234
180
|
aria-hidden="true"
|
|
235
181
|
part="button-backward-base"
|
|
236
182
|
class="tab-group__nav-button tab-group__nav-button--backward"
|
|
237
183
|
>
|
|
238
|
-
<nve-button @click=${this.scrollNavBackward} variant="
|
|
184
|
+
<nve-button @click=${this.scrollNavBackward} variant="ghost">
|
|
239
185
|
<nve-icon name="chevron_backward"></nve-icon>
|
|
240
186
|
</nve-button>
|
|
241
187
|
</div>
|
|
242
|
-
` :
|
|
243
|
-
${this.canScrollForward && this.isOverflow ?
|
|
188
|
+
` : t}
|
|
189
|
+
${this.canScrollForward && this.isOverflow ? e`
|
|
244
190
|
<div
|
|
245
191
|
part="button-forward-base"
|
|
246
192
|
aria-hidden="true"
|
|
247
|
-
class=${
|
|
248
|
-
"tab-group__nav-button tab-group__nav-button--forward": !0
|
|
249
|
-
})}
|
|
193
|
+
class=${s({ "tab-group__nav-button tab-group__nav-button--forward": !0 })}
|
|
250
194
|
>
|
|
251
|
-
<nve-button variant="
|
|
252
|
-
|
|
253
|
-
|
|
195
|
+
<nve-button variant="ghost" @click=${this.scrollNavForward}>
|
|
196
|
+
<nve-icon name="chevron_forward"></nve-icon>
|
|
197
|
+
</nve-button>
|
|
254
198
|
</div>
|
|
255
|
-
` :
|
|
199
|
+
` : t}
|
|
256
200
|
</div>
|
|
257
201
|
<slot part="body"></slot>
|
|
258
202
|
</div>
|
|
259
203
|
`;
|
|
260
|
-
|
|
261
|
-
};
|
|
262
|
-
n.styles = [m];
|
|
263
|
-
c([
|
|
264
|
-
d({ type: String })
|
|
265
|
-
], n.prototype, "testId", 2);
|
|
266
|
-
c([
|
|
267
|
-
d({ type: Boolean })
|
|
268
|
-
], n.prototype, "background", 2);
|
|
269
|
-
c([
|
|
270
|
-
d({ type: String })
|
|
271
|
-
], n.prototype, "size", 2);
|
|
272
|
-
c([
|
|
273
|
-
d({ type: String, reflect: !0 })
|
|
274
|
-
], n.prototype, "activeTab", 2);
|
|
275
|
-
c([
|
|
276
|
-
b()
|
|
277
|
-
], n.prototype, "isOverflow", 2);
|
|
278
|
-
c([
|
|
279
|
-
b()
|
|
280
|
-
], n.prototype, "canScrollBack", 2);
|
|
281
|
-
c([
|
|
282
|
-
b()
|
|
283
|
-
], n.prototype, "canScrollForward", 2);
|
|
284
|
-
c([
|
|
285
|
-
b()
|
|
286
|
-
], n.prototype, "isBackground", 2);
|
|
287
|
-
n = c([
|
|
288
|
-
g("nve-tab-group")
|
|
289
|
-
], n);
|
|
290
|
-
export {
|
|
291
|
-
n as default
|
|
204
|
+
}
|
|
292
205
|
};
|
|
206
|
+
o([i({ type: String })], d.prototype, "testId", void 0), o([i({ type: Boolean })], d.prototype, "background", void 0), o([i({ type: String })], d.prototype, "size", void 0), o([i({
|
|
207
|
+
type: String,
|
|
208
|
+
reflect: !0
|
|
209
|
+
})], d.prototype, "activeTab", void 0), o([r()], d.prototype, "isOverflow", void 0), o([r()], d.prototype, "canScrollBack", void 0), o([r()], d.prototype, "canScrollForward", void 0), o([r()], d.prototype, "isBackground", void 0), d = o([a("nve-tab-group")], d);
|
|
210
|
+
var f = d;
|
|
211
|
+
//#endregion
|
|
212
|
+
export { f as default };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { u as e } from "../../chunks/lit.js";
|
|
2
|
+
//#region src/components/nve-tab-group/nve-tab-group.styles.ts
|
|
3
|
+
var t = e`
|
|
3
4
|
.tab-group__nav-container {
|
|
4
5
|
display: flex;
|
|
5
6
|
position: relative;
|
|
@@ -70,6 +71,5 @@ const o = t`
|
|
|
70
71
|
left: 0;
|
|
71
72
|
}
|
|
72
73
|
`;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
};
|
|
74
|
+
//#endregion
|
|
75
|
+
export { t as default };
|
|
@@ -1,34 +1,24 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { n as
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return this.id = this.id.length > 0 ? this.id : this.componentId, h`<div class="tab-panel" part="base">
|
|
1
|
+
import { a as e, t } from "../../chunks/lit.js";
|
|
2
|
+
import { o as n, s as r, t as i } from "../../chunks/decorate.js";
|
|
3
|
+
import a from "./nve-tab-panel.styles.js";
|
|
4
|
+
//#region src/components/nve-tab-panel/nve-tab-panel.component.ts
|
|
5
|
+
var o = 0, s = class extends t {
|
|
6
|
+
static {
|
|
7
|
+
this.styles = [a];
|
|
8
|
+
}
|
|
9
|
+
connectedCallback() {
|
|
10
|
+
super.connectedCallback(), this.setAttribute("role", "tabpanel"), this.name && this.setAttribute("name", this.name);
|
|
11
|
+
}
|
|
12
|
+
constructor() {
|
|
13
|
+
super(), this.testId = void 0, this.name = null, this.attrId = ++o, this.componentId = `nve-panel-${this.attrId}`;
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
return this.id = this.id.length > 0 ? this.id : this.componentId, e`<div class="tab-panel" part="base">
|
|
18
17
|
<slot></slot>
|
|
19
18
|
</div> `;
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
e.styles = [m];
|
|
23
|
-
l([
|
|
24
|
-
p({ type: String })
|
|
25
|
-
], e.prototype, "testId", 2);
|
|
26
|
-
l([
|
|
27
|
-
p({ type: String })
|
|
28
|
-
], e.prototype, "name", 2);
|
|
29
|
-
e = l([
|
|
30
|
-
c("nve-tab-panel")
|
|
31
|
-
], e);
|
|
32
|
-
export {
|
|
33
|
-
e as default
|
|
19
|
+
}
|
|
34
20
|
};
|
|
21
|
+
i([n({ type: String })], s.prototype, "testId", void 0), i([n({ type: String })], s.prototype, "name", void 0), s = i([r("nve-tab-panel")], s);
|
|
22
|
+
var c = s;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { c as default };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { u as e } from "../../chunks/lit.js";
|
|
2
|
+
//#region src/components/nve-tab-panel/nve-tab-panel.styles.ts
|
|
3
|
+
var t = e`
|
|
3
4
|
:host(.tab-panel--hidden) {
|
|
4
5
|
display: none;
|
|
5
6
|
}
|
|
@@ -13,6 +14,5 @@ const r = a`
|
|
|
13
14
|
padding: var(--spacing-small);
|
|
14
15
|
}
|
|
15
16
|
`;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { t as default };
|
|
@@ -27,13 +27,13 @@ export default class NveTag extends LitElement {
|
|
|
27
27
|
/** Størrelse på komponenten */
|
|
28
28
|
size: 'small' | 'medium';
|
|
29
29
|
/** Ekstra tekst */
|
|
30
|
-
|
|
30
|
+
extraText: string;
|
|
31
31
|
/** Viser dot-ikon i prefix */
|
|
32
32
|
dot: boolean;
|
|
33
33
|
/** Viser lukke-knapp */
|
|
34
|
-
|
|
34
|
+
closeable: boolean;
|
|
35
35
|
/** aria-label på lukke-knapp */
|
|
36
|
-
|
|
36
|
+
closeAriaLabel: string;
|
|
37
37
|
private closeButtonClick;
|
|
38
38
|
render(): import('lit-html').TemplateResult<1>;
|
|
39
39
|
}
|