@visma-swno/vsn-navigation 1.1.0-beta.8 → 1.1.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.
@@ -16,6 +16,13 @@ declare type BaseTreeItem = {
16
16
  id: string;
17
17
  /** The label to show for that item, in the relevant language */
18
18
  label: string;
19
+ /** Optional QA identifier rendered as a data-qa-id attribute on the nav item element */
20
+ 'data-qa-id'?: string;
21
+ };
22
+
23
+ export declare type ButtonClickedEvent = {
24
+ /** The clicked HTMLButtonElement. Can be used as an anchor to position popups. */
25
+ target: HTMLButtonElement;
19
26
  };
20
27
 
21
28
  export declare type FeedbackConfig = {
@@ -46,6 +53,8 @@ export declare type NavigationMenu = {
46
53
  expand and select that item. When it's not found in items, breadcrumbs will show
47
54
  nothing and the side menu will have no element selected */
48
55
  currentItem: string;
56
+ /** Optionally set the current page title. This will be shown as the last item in the breadcrumbs */
57
+ pageTitle?: string;
49
58
  /** Sidebar search config; default disabled when undefined */
50
59
  search?: SearchConfig;
51
60
  };
@@ -55,6 +64,37 @@ declare type NonEmptyArray<T> = [T, ...T[]];
55
64
  export declare type SearchConfig = {
56
65
  enabled: boolean;
57
66
  shortcut?: string;
67
+ extraDataSets?: SearchDataSetConfig[];
68
+ };
69
+
70
+ export declare type SearchDataSetConfig = {
71
+ /** Stable unique identifier for the dataset, used for selection and lookup */
72
+ id: string;
73
+ /** User-facing label for display purposes */
74
+ label: string;
75
+ searchFunction: (query: SearchQuery) => Promise<SearchResult>;
76
+ };
77
+
78
+ export declare class SearchError extends Error {
79
+ constructor(message: string);
80
+ }
81
+
82
+ export declare type SearchQuery = {
83
+ abortController: AbortController;
84
+ query: string;
85
+ cursor?: string;
86
+ };
87
+
88
+ export declare type SearchResult = {
89
+ nextCursor?: string;
90
+ results: SearchResultItem[];
91
+ };
92
+
93
+ export declare type SearchResultItem = {
94
+ id: string;
95
+ label: string;
96
+ url: string;
97
+ lines?: [string] | [string, string];
58
98
  };
59
99
 
60
100
  export declare type TreeItem = TreeParent | TreeLeaf;
@@ -76,6 +116,7 @@ declare type User = {
76
116
 
77
117
  export declare type VsnAuth = {
78
118
  user: User;
119
+ profilePictureBaseUrl: string;
79
120
  myProfileUrl: string;
80
121
  };
81
122
 
@@ -105,6 +146,10 @@ export declare class VSNNavigation extends LitElement {
105
146
  private _resolvedModules;
106
147
  private _modulesLoading;
107
148
  private _modulesLoadToken;
149
+ /** Set at close time: whether focus was inside the side-bar. Gates the focus
150
+ restore so we don't steal focus when the user closed the side-bar by
151
+ clicking a focusable element outside (e.g. a top-bar button). */
152
+ private _restoreFocusToToggle;
108
153
  private _resolveModules;
109
154
  static styles: CSSResult[];
110
155
  willUpdate(changed: Map<string, unknown>): void;
@@ -113,7 +158,23 @@ export declare class VSNNavigation extends LitElement {
113
158
  /** Project tree into the shape the side-bar expects: top-level items lifted from the active module. */
114
159
  private get _sideBarMenu();
115
160
  private _onToggleSideBar;
161
+ /** Open the side-bar and, once rendered, focus the search field (if enabled).
162
+ Shared by the hamburger toggle and the CTRL/Cmd+K shortcut. */
163
+ private _openAndFocusSearch;
116
164
  private _onSideBarClose;
165
+ /** Close the side-bar. Captures `:focus-within` BEFORE flipping the state, since
166
+ the side-bar becomes display:none and the check would then always be false. */
167
+ private _closeSideBar;
168
+ updated(changed: Map<string, unknown>): void;
169
+ connectedCallback(): void;
170
+ disconnectedCallback(): void;
171
+ /** CTRL+K (Cmd+K on Mac) opens the side-bar and focuses the search field (if enabled). */
172
+ private _onShortcut;
173
+ /** Escape closes the side-bar when nothing is focused. Skips when focus is on
174
+ any element — including inside the side-bar's shadow (activeElement is then
175
+ the host `<vsn-side-bar>`, not body), so existing in-component Escape
176
+ handlers (search input clear-then-close) keep their priority. */
177
+ private _onDocEscape;
117
178
  private _onTopBarClick;
118
179
  render(): TemplateResult<1>;
119
180
  }