@visma-swno/vsn-navigation 1.1.0-beta.28 → 1.1.0-beta.29

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.
@@ -924,7 +924,7 @@ var ht = class {
924
924
  this.onSwitcherKeydown = (e) => {
925
925
  if (e.key === "Enter" || e.key === " ") {
926
926
  if (e.preventDefault(), this.host.expanded && !this.host.canClose) return;
927
- (this.host.expanded || this.host.hasAvailableItems) && (this.host.expanded = !this.host.expanded);
927
+ (this.host.expanded || this.host.hasAvailableItems || this.host.modulesLoading) && (this.host.expanded = !this.host.expanded);
928
928
  return;
929
929
  }
930
930
  if (e.key === "ArrowDown" && !this.host.expanded) {
@@ -1174,6 +1174,47 @@ var V = class extends e {
1174
1174
  this.canClose && (this.expanded = !1);
1175
1175
  });
1176
1176
  }
1177
+ render() {
1178
+ let e = this._state;
1179
+ return n`
1180
+ <div class="ga-side-navigation__header">
1181
+ <div class="vsn-switcher-anchor">
1182
+ <div class="ga-side-navigation__switcher ${this.expanded ? "ga-side-navigation__switcher--active" : ""}"
1183
+ tabindex="0"
1184
+ role="button"
1185
+ aria-expanded="${this.expanded}"
1186
+ aria-haspopup="menu"
1187
+ @click=${this._toggle}
1188
+ @keydown=${this._keyboard.onSwitcherKeydown}
1189
+ title="">
1190
+ <span class="ga-side-navigation__switcher-title">${e.title}</span>
1191
+ ${u(this.canClose, () => n`
1192
+ <span class="ga-side-navigation__switcher-action">
1193
+ ${this.expanded ? j(M, 16) : j(tt, 16)}
1194
+ </span>
1195
+ `)}
1196
+ </div>
1197
+
1198
+ ${u(this.expanded, () => n`
1199
+ <vsn-switcher-menu
1200
+ .items=${e.kind === "loading" ? [] : e.available}
1201
+ .loading=${e.kind === "loading"}
1202
+ @item-select=${this._onItemSelect}
1203
+ @close-request=${this._onCloseRequest}
1204
+ @focus-switcher=${this._onFocusSwitcher}
1205
+ @tab-exit=${this._onTabExit}>
1206
+ </vsn-switcher-menu>`)}
1207
+ </div>
1208
+
1209
+ ${u(this.search?.enabled, () => n`
1210
+ <vsn-search
1211
+ .shortcut=${this.search?.shortcut ?? Le()}
1212
+ .value=${this.searchValue}
1213
+ .loading=${this.searchLoading}>
1214
+ </vsn-search>`)}
1215
+ </div>
1216
+ `;
1217
+ }
1177
1218
  get _state() {
1178
1219
  if (this.modulesLoading) return {
1179
1220
  kind: "loading",
@@ -1199,11 +1240,7 @@ var V = class extends e {
1199
1240
  }
1200
1241
  willUpdate() {
1201
1242
  let e = this._state;
1202
- if (e.kind === "loading") {
1203
- this.expanded = !0;
1204
- return;
1205
- }
1206
- this.hasMenu || e.kind !== "no-active" || e.available.length === 0 || (this.expanded = !0);
1243
+ e.kind !== "loading" && (this.hasMenu || e.kind !== "no-active" || e.available.length === 0 || (this.expanded = !0));
1207
1244
  }
1208
1245
  reset() {
1209
1246
  this.expanded = !1;
@@ -1233,47 +1270,6 @@ var V = class extends e {
1233
1270
  _onTabExit() {
1234
1271
  this.canClose && (this.expanded = !1);
1235
1272
  }
1236
- render() {
1237
- let e = this._state;
1238
- return n`
1239
- <div class="ga-side-navigation__header">
1240
- <div class="vsn-switcher-anchor">
1241
- <div class="ga-side-navigation__switcher ${this.expanded ? "ga-side-navigation__switcher--active" : ""}"
1242
- tabindex="0"
1243
- role="button"
1244
- aria-expanded="${this.expanded}"
1245
- aria-haspopup="menu"
1246
- @click=${this._toggle}
1247
- @keydown=${this._keyboard.onSwitcherKeydown}
1248
- title="">
1249
- <span class="ga-side-navigation__switcher-title">${e.title}</span>
1250
- ${u(this.canClose, () => n`
1251
- <span class="ga-side-navigation__switcher-action">
1252
- ${this.expanded ? j(M, 16) : j(tt, 16)}
1253
- </span>
1254
- `)}
1255
- </div>
1256
-
1257
- ${u(this.expanded, () => n`
1258
- <vsn-switcher-menu
1259
- .items=${e.kind === "loading" ? [] : e.available}
1260
- .loading=${e.kind === "loading"}
1261
- @item-select=${this._onItemSelect}
1262
- @close-request=${this._onCloseRequest}
1263
- @focus-switcher=${this._onFocusSwitcher}
1264
- @tab-exit=${this._onTabExit}>
1265
- </vsn-switcher-menu>`)}
1266
- </div>
1267
-
1268
- ${u(this.search?.enabled, () => n`
1269
- <vsn-search
1270
- .shortcut=${this.search?.shortcut ?? Le()}
1271
- .value=${this.searchValue}
1272
- .loading=${this.searchLoading}>
1273
- </vsn-search>`)}
1274
- </div>
1275
- `;
1276
- }
1277
1273
  };
1278
1274
  N([s({ attribute: !1 })], V.prototype, "modules", void 0), N([s()], V.prototype, "activeModuleId", void 0), N([s()], V.prototype, "activeModuleLabel", void 0), N([s({ type: Boolean })], V.prototype, "modulesLoading", void 0), N([s({ type: Boolean })], V.prototype, "hasMenu", void 0), N([s({ attribute: !1 })], V.prototype, "search", void 0), N([s()], V.prototype, "searchValue", void 0), N([s({ type: Boolean })], V.prototype, "searchLoading", void 0), N([s({
1279
1275
  type: Boolean,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visma-swno/vsn-navigation",
3
- "version": "1.1.0-beta.28",
3
+ "version": "1.1.0-beta.29",
4
4
  "type": "module",
5
5
  "customElements": "dist/custom-elements.json",
6
6
  "exports": {