@visma-swno/vsn-navigation 1.1.0-beta.3 → 1.1.0-beta.5

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,43 +1,83 @@
1
- import { AppModules } from '../shared/types/index.ts';
2
1
  import { CSSResult } from 'lit';
3
- import { FeedbackConfig } from '../shared/types/index.ts';
4
- import { isTreeLeaf } from '../shared/types/index.ts';
5
- import { isTreeParent } from '../shared/types/index.ts';
6
- import { LanguageCode } from '../shared/types/index.ts';
7
2
  import { LitElement } from 'lit';
8
- import { ModuleItem } from '../shared/types/index.ts';
9
- import { NavigationMenu } from '../shared/types/index.ts';
10
- import { SearchConfig } from '../shared/types/index.ts';
11
3
  import { TemplateResult } from 'lit-html';
12
- import { TreeItem } from '../shared/types/index.ts';
13
- import { TreeLeaf } from '../shared/types/index.ts';
14
- import { TreeParent } from '../shared/types/index.ts';
15
- import { VsnAuth } from '../shared/types/index.ts';
16
- import { VsnNavigation } from '../shared/types/index.ts';
17
4
 
18
- export { AppModules }
5
+ export declare type AppModules = {
6
+ /** Current module id (to be ignored from the list of modules) */
7
+ activeModuleId: string;
8
+ /** Current module label — shown before the modules list is asynchronously loaded */
9
+ activeModuleLabel: string;
10
+ /** Modules, or a loader for the modules */
11
+ modules: ModuleItem[] | (() => Promise<ModuleItem[]>);
12
+ };
19
13
 
20
- export { FeedbackConfig }
14
+ declare type BaseTreeItem = {
15
+ /** id of the item, unique */
16
+ id: string;
17
+ /** The label to show for that item, in the relevant language */
18
+ label: string;
19
+ };
21
20
 
22
- export { isTreeLeaf }
21
+ export declare type FeedbackConfig = {
22
+ workspaceId: string;
23
+ surveyId: string;
24
+ };
23
25
 
24
- export { isTreeParent }
26
+ export declare function isTreeLeaf(item: TreeItem): item is TreeLeaf;
25
27
 
26
- export { LanguageCode }
28
+ export declare function isTreeParent(item: TreeItem): item is TreeParent;
27
29
 
28
- export { ModuleItem }
30
+ /** Supported languages. Note: 'nb' and 'nn' are automatically mapped to 'no'. Non-supported languages will default to 'en' */
31
+ export declare type LanguageCode = 'en' | 'no' | 'nb' | 'nn' | 'sv' | 'nl' | 'fi' | 'da';
29
32
 
30
- export { NavigationMenu }
33
+ export declare type ModuleItem = {
34
+ id: string;
35
+ label: string;
36
+ url: string;
37
+ };
31
38
 
32
- export { SearchConfig }
39
+ /** Configuration for the navigation menu (pages in current module) */
40
+ export declare type NavigationMenu = {
41
+ /** The list of items to show in the side menu and the breadcrumbs. Applications can
42
+ update it at any time, e.g. when the context changes, when the language changes */
43
+ items: TreeItem[];
44
+ /** the item id corresponding to the current page. When it's found in items,
45
+ the breadcrumbs will update to reflect the path to the item and side menu will
46
+ expand and select that item. When it's not found in items, breadcrumbs will show
47
+ nothing and the side menu will have no element selected */
48
+ currentItem: string;
49
+ /** Sidebar search config; default disabled when undefined */
50
+ search?: SearchConfig;
51
+ };
33
52
 
34
- export { TreeItem }
53
+ declare type NonEmptyArray<T> = [T, ...T[]];
35
54
 
36
- export { TreeLeaf }
55
+ export declare type SearchConfig = {
56
+ enabled: boolean;
57
+ shortcut?: string;
58
+ };
37
59
 
38
- export { TreeParent }
60
+ export declare type TreeItem = TreeParent | TreeLeaf;
39
61
 
40
- export { VsnAuth }
62
+ export declare type TreeLeaf = BaseTreeItem & {
63
+ url: string;
64
+ };
65
+
66
+ export declare type TreeParent = BaseTreeItem & {
67
+ items: NonEmptyArray<TreeItem>;
68
+ };
69
+
70
+ declare type User = {
71
+ userId: string;
72
+ clientId?: string;
73
+ userName: string;
74
+ userEmail: string;
75
+ };
76
+
77
+ export declare type VsnAuth = {
78
+ user: User;
79
+ myProfileUrl: string;
80
+ };
41
81
 
42
82
  export declare class VSNNavigation extends LitElement {
43
83
  /** Language to use for the component's labels (Search, Log out, etc) */
@@ -78,6 +118,27 @@ export declare class VSNNavigation extends LitElement {
78
118
  render(): TemplateResult<1>;
79
119
  }
80
120
 
81
- export { VsnNavigation }
121
+ export declare type VsnNavigation = {
122
+ /** Language to use for the component's labels (Search, Log out, etc) */
123
+ lang?: LanguageCode;
124
+ /** Link to landing page */
125
+ landingPageUrl?: string;
126
+ /** Configuration for the navigation menu (pages in current module) */
127
+ tree?: NavigationMenu;
128
+ /** Configuration for the module switcher */
129
+ modules?: AppModules;
130
+ /** Show help icon */
131
+ showHelp?: boolean;
132
+ /** Use a fixed url for link to help */
133
+ helpUrl?: string;
134
+ /** Show notification icon */
135
+ showNotification?: boolean;
136
+ /** Notification icon shows active state */
137
+ notificationActive?: boolean;
138
+ /** Configuration related to authenticated user */
139
+ auth?: VsnAuth;
140
+ /** Configuration for the feedback component */
141
+ feedback?: FeedbackConfig | null;
142
+ };
82
143
 
83
144
  export { }
@@ -120,7 +120,6 @@ var d = class extends e {
120
120
  .modulesLoading=${this._modulesLoading}
121
121
  .auth=${this.auth}
122
122
  ?open=${this._sideBarOpen}
123
- @vsn-close=${this._onSideBarClose}
124
123
  @vsn-side-bar-close=${this._onSideBarClose}
125
124
  ></vsn-side-bar>
126
125
  <slot></slot>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visma-swno/vsn-navigation",
3
- "version": "1.1.0-beta.3",
3
+ "version": "1.1.0-beta.5",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {