@exmg/exm-navigation 1.1.0 → 1.1.2

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.
Files changed (60) hide show
  1. package/README.md +73 -0
  2. package/package.json +3 -3
  3. package/src/exm-navigation-base.d.ts +3 -1
  4. package/src/exm-navigation-base.js +35 -4
  5. package/src/exm-navigation-drawer-base.js +3 -1
  6. package/src/exm-navigation-drawer-nav.d.ts +9 -0
  7. package/src/exm-navigation-drawer-nav.js +47 -0
  8. package/src/exm-navigation-rail-base.js +2 -2
  9. package/src/exm-navigation-rail-nav-base.d.ts +4 -0
  10. package/src/exm-navigation-rail-nav-base.js +9 -0
  11. package/src/exm-navigation-rail-nav.d.ts +9 -0
  12. package/src/exm-navigation-rail-nav.js +12 -0
  13. package/src/exm-navigation-signals.d.ts +8 -1
  14. package/src/exm-navigation-signals.js +11 -0
  15. package/src/exm-navigation-sub-menu-base.d.ts +1 -0
  16. package/src/exm-navigation-sub-menu-base.js +7 -1
  17. package/src/exm-navigation-toolbar-base.d.ts +8 -0
  18. package/src/exm-navigation-toolbar-base.js +33 -0
  19. package/src/exm-navigation-toolbar.d.ts +9 -0
  20. package/src/exm-navigation-toolbar.js +12 -0
  21. package/src/exm-navigation-topbar-base.js +2 -1
  22. package/src/mixins/media-queries.js +2 -3
  23. package/src/styles/exm-navigate-drawer-nav-item-css.d.ts +0 -1
  24. package/src/styles/exm-navigate-drawer-nav-item-css.js +38 -2
  25. package/src/styles/exm-navigation-css.d.ts +0 -1
  26. package/src/styles/exm-navigation-css.js +64 -2
  27. package/src/styles/exm-navigation-drawer-css.d.ts +0 -1
  28. package/src/styles/exm-navigation-drawer-css.js +22 -2
  29. package/src/styles/exm-navigation-drawer-nav-item-css.d.ts +0 -1
  30. package/src/styles/exm-navigation-drawer-nav-item-css.js +38 -2
  31. package/src/styles/exm-navigation-icon-button-css.d.ts +0 -1
  32. package/src/styles/exm-navigation-icon-button-css.js +23 -2
  33. package/src/styles/exm-navigation-icon-css.d.ts +0 -1
  34. package/src/styles/exm-navigation-icon-css.js +20 -2
  35. package/src/styles/exm-navigation-rail-css.d.ts +0 -1
  36. package/src/styles/exm-navigation-rail-css.js +47 -2
  37. package/src/styles/exm-navigation-rail-nav-css.d.ts +2 -0
  38. package/src/styles/exm-navigation-rail-nav-css.js +4 -0
  39. package/src/styles/exm-navigation-rail-nav-item-css.d.ts +0 -1
  40. package/src/styles/exm-navigation-rail-nav-item-css.js +92 -2
  41. package/src/styles/exm-navigation-styles-css.d.ts +2 -0
  42. package/src/styles/exm-navigation-styles-css.js +4 -0
  43. package/src/styles/exm-navigation-sub-menu-css.d.ts +0 -1
  44. package/src/styles/exm-navigation-sub-menu-css.js +44 -2
  45. package/src/styles/exm-navigation-toolbar-css.d.ts +2 -0
  46. package/src/styles/exm-navigation-toolbar-css.js +4 -0
  47. package/src/styles/exm-navigation-topbar-css.d.ts +0 -1
  48. package/src/styles/exm-navigation-topbar-css.js +28 -2
  49. package/src/exm-navigation-menu-button-base.d.ts +0 -7
  50. package/src/exm-navigation-menu-button.d.ts +0 -9
  51. package/src/mediaQueries.d.ts +0 -7
  52. package/src/styles/exm-navigation-drawer-nav-item.scss +0 -36
  53. package/src/styles/exm-navigation-drawer.scss +0 -24
  54. package/src/styles/exm-navigation-icon-button.scss +0 -19
  55. package/src/styles/exm-navigation-icon.scss +0 -18
  56. package/src/styles/exm-navigation-rail-nav-item.scss +0 -92
  57. package/src/styles/exm-navigation-rail.scss +0 -44
  58. package/src/styles/exm-navigation-sub-menu.scss +0 -34
  59. package/src/styles/exm-navigation-topbar.scss +0 -27
  60. package/src/styles/exm-navigation.scss +0 -52
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # `<exm-navigation>` [![Published on npm](https://img.shields.io/npm/v/@exmg/exm-navigation.svg)](https://www.npmjs.com/package/@exmg/exm-navigation)
2
+
3
+ # @exmg/exm-navigation
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @exmg/exm-navigation
9
+ ```
10
+
11
+ ## Anatomy
12
+
13
+ This library contains following component:
14
+
15
+ 1. Navigation (main component and fully composed navigation component)
16
+
17
+ Conceptual usage:
18
+
19
+ ```html
20
+ <exm-navigation .items=${menuItems} .path=${['spaces']}>
21
+ <!-- Slot for adding a title to the topbar. Topbar is only visible on mobile -->
22
+ <section slot="topbar-title">My Title</section>
23
+ <!-- Slot for adding actions to the right of the topbar. Topbar is only visible on mobile -->
24
+ <section slot="topbar-actions">Actions</section>
25
+ <!-- Slot for adding a logo in the top part of the rail. This is not visible on mobile -->
26
+ <section slot="rail-top">Rail top</section>
27
+ <!-- Slot for adding extra actions or other content to the bottom of the rail. This is not visible on mobile -->
28
+ <section slot="rail-bottom">Rail bottom</section>
29
+ <!-- The actual page content to display -->
30
+ <section class="content">${this.renderPage()}</section>
31
+ </exm-navigation>
32
+ ```
33
+
34
+ Some of the components used in the navigation c an be used separately. Please check the code for implementation
35
+
36
+ ## API
37
+
38
+ ### Slots
39
+
40
+ | Name | Description |
41
+ | ---------------- | ------------------------------------------------------------------------------------------------------- |
42
+ | `topbar-title` | Slot for adding a title to the topbar. Topbar is only visible on mobile |
43
+ | `topbar-actions` | Slot for adding actions to the right of the topbar. Topbar is only visible on mobile |
44
+ | `rail-top` | Slot for adding a logo in the top part of the rail. This is not visible on mobile |
45
+ | `rail-bottom` | Slot for adding extra actions or other content to the bottom of the rail. This is not visible on mobile |
46
+ | `default` | The actual page content to display |
47
+
48
+ ### Properties/Attributes
49
+
50
+ | Name | Type | Default | Description |
51
+ | -------------------- | ------------ | ------- | ------------------------------------------------------------------------------------------ |
52
+ | `items` | `MenuItem[]` | _[]_ | The list of menuitems to display in the navigation component |
53
+ | `path` | `string[]` | _[]_ | The current/initial path for the navigation |
54
+ | `disable-navigation` | `boolean` | _false_ | Disable navigation managed by the component. In that case you can use the event to trigger |
55
+
56
+ #### MenuItem
57
+
58
+ ```typescript
59
+ interface MenuItem {
60
+ id: string;
61
+ label: string;
62
+ path?: string;
63
+ url?: string;
64
+ icon?: string;
65
+ items?: MenuItem[];
66
+ }
67
+ ```
68
+
69
+ ### Events
70
+
71
+ | Name | Detail | Description |
72
+ | ------------------- | ---------------- | ----------------------------------- |
73
+ | `navigation-change` | `['one', 'two']` | The path selected in the navigation |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exmg/exm-navigation",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -51,5 +51,5 @@
51
51
  "publishConfig": {
52
52
  "access": "public"
53
53
  },
54
- "gitHead": "1973df6ecaaf0a57b688f5eb8852516295bc04d6"
55
- }
54
+ "gitHead": "3423f0a9b57aa88161bddceec081fa0ba608c605"
55
+ }
@@ -15,6 +15,7 @@ export declare class ExmNavigationBase extends ExmNavigationBase_base {
15
15
  items: MenuItem[];
16
16
  path: string[];
17
17
  drawerWidth: number;
18
+ disableNavigate: boolean;
18
19
  drawer?: ExmNavigationDrawer;
19
20
  navContent?: HTMLDivElement;
20
21
  persistent: boolean;
@@ -37,13 +38,14 @@ export declare class ExmNavigationBase extends ExmNavigationBase_base {
37
38
  * Set the correct values when the media changes.
38
39
  */
39
40
  handleMediaTypeChange(): void;
41
+ private getPathEndpoint;
40
42
  loadPage(path: string[]): void;
41
43
  /**
42
44
  * Handle Rail item click or Drawer sub menu click.
43
45
  * If the selected menu item has children, we add the first item to the list (as per Google implementation).
44
46
  * In this case we also do not close the drawer in non persistent mode, so the user is able to select a next level in the menu
45
47
  */
46
- handleRailItemClick({ detail }: CustomEvent<string>): void;
48
+ private handleRailItemClick;
47
49
  /**
48
50
  * Handle the mouse enter of the rail item.
49
51
  */
@@ -19,6 +19,7 @@ export class ExmNavigationBase extends MediaQueries(ExmgElement) {
19
19
  this.items = [];
20
20
  this.path = ['chat'];
21
21
  this.drawerWidth = 319;
22
+ this.disableNavigate = false;
22
23
  this.persistent = true;
23
24
  this.selectedItem = [];
24
25
  this.activeItem = [];
@@ -61,9 +62,29 @@ export class ExmNavigationBase extends MediaQueries(ExmgElement) {
61
62
  this.drawerOpen = this.media === 'desktop' && this.navigationHasSubmenu[this.selectedItem[0]];
62
63
  this.railOpen = this.media !== 'mobile';
63
64
  }
65
+ getPathEndpoint() {
66
+ let items = this.items;
67
+ let result;
68
+ const checkItems = (path, last) => {
69
+ const item = items.find((item) => item.id === path);
70
+ if (last) {
71
+ return (item === null || item === void 0 ? void 0 : item.path) || '/';
72
+ }
73
+ items = (item === null || item === void 0 ? void 0 : item.items) || [];
74
+ return;
75
+ };
76
+ for (let i = 0; i < this.selectedItem.length; i++) {
77
+ result = checkItems(this.selectedItem[i], i === this.selectedItem.length - 1);
78
+ }
79
+ return result || window.location.href;
80
+ }
64
81
  loadPage(path) {
65
82
  this.path = path;
66
83
  this.selectedItem = path;
84
+ this.fire('navigation-change', path);
85
+ if (!this.disableNavigate) {
86
+ window.history.pushState({}, '', this.getPathEndpoint());
87
+ }
67
88
  }
68
89
  /**
69
90
  * Handle Rail item click or Drawer sub menu click.
@@ -151,6 +172,7 @@ export class ExmNavigationBase extends MediaQueries(ExmgElement) {
151
172
  if ((!this.railOpen || !this.persistent) && !this.currentSelectedHasChildren(detail)) {
152
173
  this.drawerOpen = false;
153
174
  }
175
+ this.loadPage(this.selectedItem);
154
176
  }
155
177
  /**
156
178
  * Handle the topbar menu click.
@@ -185,7 +207,7 @@ export class ExmNavigationBase extends MediaQueries(ExmgElement) {
185
207
  renderDrawerMenuButton() {
186
208
  return !this.railOpen
187
209
  ? html `
188
- <section>
210
+ <section class="drawer-menu-button">
189
211
  <exm-navigation-icon-button
190
212
  icon=${this.drawerOpen ? 'menu_open' : 'menu'}
191
213
  @navigation-icon-button-click=${this.handleTopbarMenuClick}
@@ -209,7 +231,7 @@ export class ExmNavigationBase extends MediaQueries(ExmgElement) {
209
231
  ></exm-navigation-drawer-menu>`
210
232
  : !this.railOpen
211
233
  ? html `
212
- <section>
234
+ <section class="drawer-back-button">
213
235
  <exm-navigation-icon-button
214
236
  icon="arrow_back"
215
237
  label="Main menu"
@@ -227,6 +249,9 @@ export class ExmNavigationBase extends MediaQueries(ExmgElement) {
227
249
  <exm-navigation-sub-menu
228
250
  .items=${this.items}
229
251
  .path=${this.activeItem}
252
+ ?has-back-button=${!this.railOpen &&
253
+ (this.activeItem.length > 1 ||
254
+ (this.activeItem.length > 0 && this.currentSelectedHasChildren(this.activeItem)))}
230
255
  @sub-menu-item-click=${this.handleSubMenuClick}
231
256
  ></exm-navigation-sub-menu>
232
257
  `;
@@ -241,7 +266,10 @@ export class ExmNavigationBase extends MediaQueries(ExmgElement) {
241
266
  @rail-item-click=${this.handleRailItemClick}
242
267
  @rail-item-mouseenter=${this.handleRailItemMouseEnter}
243
268
  @rail-item-mouseleave=${this.handleRailItemMouseLeave}
244
- ></exm-navigation-rail>`;
269
+ >
270
+ <slot name="rail-top" slot="rail-top"></slot>
271
+ <slot name="rail-bottom" slot="rail-bottom"></slot>
272
+ </exm-navigation-rail>`;
245
273
  }
246
274
  /**
247
275
  * Render the topbar. This is displayed on mobile and contains the menu button and a slot for the title
@@ -249,6 +277,7 @@ export class ExmNavigationBase extends MediaQueries(ExmgElement) {
249
277
  renderTopbar() {
250
278
  return html `<exm-navigation-topbar ?drawer-open=${this.drawerOpen} @topbar-menu-click=${this.handleTopbarMenuClick}>
251
279
  <slot name="topbar-title" slot="topbar-title"></slot>
280
+ <slot name="topbar-actions" slot="topbar-actions"></slot>
252
281
  </exm-navigation-topbar>`;
253
282
  }
254
283
  render() {
@@ -271,7 +300,6 @@ export class ExmNavigationBase extends MediaQueries(ExmgElement) {
271
300
  <slot></slot>
272
301
  </section>
273
302
  </section>
274
- <slot></slot>
275
303
  `;
276
304
  }
277
305
  }
@@ -285,6 +313,9 @@ __decorate([
285
313
  __decorate([
286
314
  property({ type: Number, attribute: 'drawer-width' })
287
315
  ], ExmNavigationBase.prototype, "drawerWidth", void 0);
316
+ __decorate([
317
+ property({ type: Boolean, attribute: 'disable-navigation' })
318
+ ], ExmNavigationBase.prototype, "disableNavigate", void 0);
288
319
  __decorate([
289
320
  query('exm-navigation-drawer')
290
321
  ], ExmNavigationBase.prototype, "drawer", void 0);
@@ -33,7 +33,9 @@ export class ExmNavigationDrawerBase extends ExmgElement {
33
33
  this.addEventListener('drawer-close', this.handleDrawerClose.bind(this));
34
34
  }
35
35
  render() {
36
- return html `<mwc-drawer type="dismissible" ?open=${this.open}><slot></slot></mwc-drawer>`;
36
+ return html `<mwc-drawer type="dismissible" ?open=${this.open}>
37
+ <slot></slot>
38
+ </mwc-drawer>`;
37
39
  }
38
40
  }
39
41
  ExmNavigationDrawerBase.styles = [style];
@@ -0,0 +1,9 @@
1
+ import '@material/web/list/list.js';
2
+ import '@material/web/list/list-item.js';
3
+ import { ExmgElement } from '@exmg/lit-base';
4
+ declare const ExmNavigationDrawerNav_base: typeof ExmgElement;
5
+ export declare class ExmNavigationDrawerNav extends ExmNavigationDrawerNav_base {
6
+ static styles: import("lit").CSSResult[];
7
+ render(): import("lit-html").TemplateResult<1>;
8
+ }
9
+ export {};
@@ -0,0 +1,47 @@
1
+ import { __decorate } from "tslib";
2
+ import { html, css } from 'lit';
3
+ import { customElement } from 'lit/decorators.js';
4
+ import { navigationRailHidden, navigationRailActive } from './exm-navigation-signals.js';
5
+ import { SignalWatcher } from '@lit-labs/preact-signals';
6
+ import '@material/web/list/list.js';
7
+ import '@material/web/list/list-item.js';
8
+ import { ExmgElement } from '@exmg/lit-base';
9
+ let ExmNavigationDrawerNav = class ExmNavigationDrawerNav extends SignalWatcher(ExmgElement) {
10
+ render() {
11
+ return navigationRailHidden.value
12
+ ? html `<div class="nav">
13
+ <div class="header">
14
+ <md-icon-button @click=${() => this.fire('drawer-close', null, true)}
15
+ ><md-icon>menu_open</md-icon></md-icon-button
16
+ >
17
+ </div>
18
+ <div class="navigation">
19
+ ${navigationRailActive.value === null
20
+ ? html `<div class="nav top-level"><slot name="topLevel"></slot></div>`
21
+ : html `<div class="nav"><slot name="navTop"></slot><slot></slot></div>`}
22
+ </div>
23
+ </div>`
24
+ : html `<slot></slot>`;
25
+ }
26
+ };
27
+ ExmNavigationDrawerNav.styles = [
28
+ css `
29
+ :host {
30
+ display: block;
31
+ }
32
+
33
+ .nav {
34
+ margin: 8px 0 auto;
35
+ }
36
+
37
+ .header md-icon-button {
38
+ margin: 4px 12px 8px 16px;
39
+ }
40
+ `,
41
+ ];
42
+ ExmNavigationDrawerNav = __decorate([
43
+ customElement('exm-navigation-drawer-nav')
44
+ // eslint-disable-next-line
45
+ ], ExmNavigationDrawerNav);
46
+ export { ExmNavigationDrawerNav };
47
+ //# sourceMappingURL=exm-navigation-drawer-nav.js.map
@@ -21,7 +21,7 @@ export class ExmNavigationRailBase extends ExmgElement {
21
21
  this.fire('rail-item-mouseleave', itemId);
22
22
  }
23
23
  render() {
24
- return html `<div class="top"><slot name="top"></slot></div>
24
+ return html `<div class="rail-top"><slot name="rail-top"></slot></div>
25
25
  <nav class="nav">
26
26
  <ul>
27
27
  ${repeat(this.items, (item) => {
@@ -42,7 +42,7 @@ export class ExmNavigationRailBase extends ExmgElement {
42
42
  })}
43
43
  </ul>
44
44
  </nav>
45
- <div class="bottom"><slot name="bottom"></slot></div>`;
45
+ <div class="rail-bottom"><slot name="rail-bottom"></slot></div>`;
46
46
  }
47
47
  }
48
48
  ExmNavigationRailBase.styles = [style];
@@ -0,0 +1,4 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class ExmNavigationRailNavBase extends LitElement {
3
+ render(): import("lit-html").TemplateResult<1>;
4
+ }
@@ -0,0 +1,9 @@
1
+ import { LitElement, html } from 'lit';
2
+ export class ExmNavigationRailNavBase extends LitElement {
3
+ render() {
4
+ return html `<nav aria-label="Main">
5
+ <slot></slot>
6
+ </nav>`;
7
+ }
8
+ }
9
+ //# sourceMappingURL=exm-navigation-rail-nav-base.js.map
@@ -0,0 +1,9 @@
1
+ import { ExmNavigationRailNavBase } from './exm-navigation-rail-nav-base.js';
2
+ export declare class ExmNavigationRailNav extends ExmNavigationRailNavBase {
3
+ static styles: import("lit").CSSResult[];
4
+ }
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ 'exm-navigation-rail-nav': ExmNavigationRailNav;
8
+ }
9
+ }
@@ -0,0 +1,12 @@
1
+ import { __decorate } from "tslib";
2
+ import { customElement } from 'lit/decorators.js';
3
+ import { style } from './styles/exm-navigation-rail-nav-css.js';
4
+ import { ExmNavigationRailNavBase } from './exm-navigation-rail-nav-base.js';
5
+ let ExmNavigationRailNav = class ExmNavigationRailNav extends ExmNavigationRailNavBase {
6
+ };
7
+ ExmNavigationRailNav.styles = [style];
8
+ ExmNavigationRailNav = __decorate([
9
+ customElement('exm-navigation-rail-nav')
10
+ ], ExmNavigationRailNav);
11
+ export { ExmNavigationRailNav };
12
+ //# sourceMappingURL=exm-navigation-rail-nav.js.map
@@ -1,4 +1,11 @@
1
+ export declare const navigationItemHover: import("@preact/signals-core").Signal<boolean>;
1
2
  export declare const navigationDrawerHover: import("@preact/signals-core").Signal<boolean>;
3
+ export declare const navigationDrawerOpen: import("@preact/signals-core").Signal<boolean>;
2
4
  export declare const navigationActiveHasSubmenu: import("@preact/signals-core").Signal<{
3
- [menuItem: string]: boolean;
5
+ [k: string]: boolean;
4
6
  }>;
7
+ export declare const navigationRailSelected: import("@preact/signals-core").Signal<string | null>;
8
+ export declare const navigationSubSelected: import("@preact/signals-core").Signal<string | null>;
9
+ export declare const navigationRailActive: import("@preact/signals-core").Signal<string | null>;
10
+ export declare const navigationRailHidden: import("@preact/signals-core").Signal<boolean>;
11
+ export declare const navigationDrawerPersistent: import("@preact/signals-core").Signal<boolean>;
@@ -0,0 +1,11 @@
1
+ import { signal } from '@lit-labs/preact-signals';
2
+ export const navigationItemHover = signal(false);
3
+ export const navigationDrawerHover = signal(false);
4
+ export const navigationDrawerOpen = signal(false);
5
+ export const navigationActiveHasSubmenu = signal({});
6
+ export const navigationRailSelected = signal(null);
7
+ export const navigationSubSelected = signal(null);
8
+ export const navigationRailActive = signal(null);
9
+ export const navigationRailHidden = signal(false);
10
+ export const navigationDrawerPersistent = signal(false);
11
+ //# sourceMappingURL=exm-navigation-signals.js.map
@@ -8,6 +8,7 @@ import '@exmg/exm-collapsed/exm-collapsed.js';
8
8
  export declare class ExmNavigationSubMenuBase extends ExmgElement {
9
9
  items: MenuItem[];
10
10
  path: (string | null)[];
11
+ hasBackButton: boolean;
11
12
  currentItem?: MenuItem['items'];
12
13
  static styles: import("lit").CSSResult[];
13
14
  protected updated(changedProperties: PropertyValues): void;
@@ -8,11 +8,13 @@ import './exm-navigation-rail-nav-item.js';
8
8
  import './exm-navigation-drawer-nav-item.js';
9
9
  import '@material/web/list/list.js';
10
10
  import '@exmg/exm-collapsed/exm-collapsed.js';
11
+ import { classMap } from 'lit/directives/class-map.js';
11
12
  export class ExmNavigationSubMenuBase extends ExmgElement {
12
13
  constructor() {
13
14
  super(...arguments);
14
15
  this.items = [];
15
16
  this.path = [];
17
+ this.hasBackButton = false;
16
18
  }
17
19
  updated(changedProperties) {
18
20
  var _a;
@@ -56,8 +58,9 @@ export class ExmNavigationSubMenuBase extends ExmgElement {
56
58
  `;
57
59
  }
58
60
  render() {
61
+ const navClass = { nav: true, 'has-back-button': this.hasBackButton };
59
62
  return html `<div class="top"><slot name="top"></slot></div>
60
- <nav class="nav">
63
+ <nav class=${classMap(navClass)}>
61
64
  <md-list>
62
65
  ${repeat(this.currentItem || [], ({ id }) => id, (item) => (item.items || []).length === 0
63
66
  ? html `
@@ -82,6 +85,9 @@ __decorate([
82
85
  __decorate([
83
86
  property({ type: Array })
84
87
  ], ExmNavigationSubMenuBase.prototype, "path", void 0);
88
+ __decorate([
89
+ property({ type: Boolean, attribute: 'has-back-button' })
90
+ ], ExmNavigationSubMenuBase.prototype, "hasBackButton", void 0);
85
91
  __decorate([
86
92
  state()
87
93
  ], ExmNavigationSubMenuBase.prototype, "currentItem", void 0);
@@ -0,0 +1,8 @@
1
+ import { ExmgElement } from '@exmg/lit-base';
2
+ import '@material/web/iconbutton/icon-button.js';
3
+ import '@material/web/icon/icon.js';
4
+ import '@material/mwc-top-app-bar-fixed';
5
+ export declare class ExmNavigationToolbarBase extends ExmgElement {
6
+ protected firstUpdated(): void;
7
+ render(): import("lit-html").TemplateResult<1>;
8
+ }
@@ -0,0 +1,33 @@
1
+ import { ExmgElement } from '@exmg/lit-base';
2
+ import { html } from 'lit';
3
+ import '@material/web/iconbutton/icon-button.js';
4
+ import '@material/web/icon/icon.js';
5
+ import '@material/mwc-top-app-bar-fixed';
6
+ export class ExmNavigationToolbarBase extends ExmgElement {
7
+ firstUpdated() {
8
+ const appToolbar = this.shadowRoot.querySelector('mwc-top-app-bar-fixed');
9
+ if (appToolbar) {
10
+ const observer = new MutationObserver((_, obs) => {
11
+ const shadowRoot = appToolbar.shadowRoot;
12
+ const header = shadowRoot ? shadowRoot.querySelector('header') : null;
13
+ if (header) {
14
+ header.style.left = '0px';
15
+ header.style.right = '0px';
16
+ obs.disconnect(); // Stop observing once we have made the changes
17
+ }
18
+ });
19
+ observer.observe(appToolbar.shadowRoot, {
20
+ childList: true,
21
+ subtree: true,
22
+ });
23
+ }
24
+ }
25
+ render() {
26
+ return html `<mwc-top-app-bar-fixed>
27
+ <slot name="navigationIcon" slot="navigationIcon"></slot>
28
+ <slot name="title" slot="title"></slot>
29
+ <slot name="actionItems" slot="actionItems"></slot>
30
+ </mwc-top-app-bar-fixed>`;
31
+ }
32
+ }
33
+ //# sourceMappingURL=exm-navigation-toolbar-base.js.map
@@ -0,0 +1,9 @@
1
+ import { ExmNavigationToolbarBase } from './exm-navigation-toolbar-base.js';
2
+ export declare class ExmNavigationToolbar extends ExmNavigationToolbarBase {
3
+ static styles: import("lit").CSSResult[];
4
+ }
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ 'exm-navigation-toolbar': ExmNavigationToolbar;
8
+ }
9
+ }
@@ -0,0 +1,12 @@
1
+ import { __decorate } from "tslib";
2
+ import { customElement } from 'lit/decorators.js';
3
+ import { style } from './styles/exm-navigation-toolbar-css.js';
4
+ import { ExmNavigationToolbarBase } from './exm-navigation-toolbar-base.js';
5
+ let ExmNavigationToolbar = class ExmNavigationToolbar extends ExmNavigationToolbarBase {
6
+ };
7
+ ExmNavigationToolbar.styles = [style];
8
+ ExmNavigationToolbar = __decorate([
9
+ customElement('exm-navigation-toolbar')
10
+ ], ExmNavigationToolbar);
11
+ export { ExmNavigationToolbar };
12
+ //# sourceMappingURL=exm-navigation-toolbar.js.map
@@ -19,7 +19,8 @@ export class ExmNavigationTopbarBase extends ExmgElement {
19
19
  icon=${this.drawerOpen ? 'menu_open' : 'menu'}
20
20
  @navigation-icon-button-click=${this.handleMenuButtonClick}
21
21
  ></exm-navigation-icon-button>
22
- <slot name="topbar-title"></slot>
22
+ <slot name="topbar-title" class="topbar-title"></slot>
23
+ <slot name="topbar-actions"></slot>
23
24
  `;
24
25
  }
25
26
  }
@@ -5,8 +5,8 @@ export const MediaQueries = (superClass) => {
5
5
  constructor() {
6
6
  super(...arguments);
7
7
  this.media = 'desktop';
8
- this.mobileMedia = window.matchMedia('(max-width: 400px)');
9
- this.tabletMedia = window.matchMedia('(min-width: 401px) and (max-width: 1200px)');
8
+ this.mobileMedia = window.matchMedia('(max-width: 960px)');
9
+ this.tabletMedia = window.matchMedia('(min-width: 961px) and (max-width: 1200px)');
10
10
  this.desktopMedia = window.matchMedia('(min-width: 1201px)');
11
11
  }
12
12
  updateMedia(media) {
@@ -15,7 +15,6 @@ export const MediaQueries = (superClass) => {
15
15
  this.media = media;
16
16
  this.requestUpdate();
17
17
  }
18
- console.log(media, mediaMatch.matches);
19
18
  };
20
19
  }
21
20
  connectedCallback() {
@@ -1,2 +1 @@
1
1
  export declare const style: import("lit").CSSResult;
2
- export default style;
@@ -1,4 +1,40 @@
1
1
  import { css } from 'lit';
2
- export const style = css `:host{--_exm-navigation-item-background-color-selected: var( --exm-navigation-item-background-color-selected, var(--md-sys-color-secondary) );--_exm-navigation-item-color-selected: var(--exm-navigation-item-color-selected, var(--md-sys-color-on-secondary))}md-list-item{margin-right:8px;margin-left:8px;border-radius:1rem;--md-list-item-container-shape: 1rem;display:grid;grid-template-columns:auto 1fr auto}md-list-item[selected]{--md-list-item-label-text-color: var(--_exm-navigation-item-color-selected);background-color:var(--_exm-navigation-item-background-color-selected);--md-list-item-leading-icon-color: var(--_exm-navigation-item-color-selected) --md-list-item-trailing-icon-color: var(--_exm-navigation-item-color-selected)}md-list-item.collapsed-item[selected]{--md-list-item-label-text-color: var(--_exm-navigation-item-color-selected);background-color:var(--_exm-navigation-item-background-color-selected)}md-list-item[selected] md-icon{color:var(--md-sys-color-primary)}.sub-menu{margin-left:1rem}`;
3
- export default style;
2
+ export const style = css `
3
+ :host {
4
+ --_exm-navigation-item-background-color-selected: var(
5
+ --exm-navigation-item-background-color-selected,
6
+ var(--md-sys-color-secondary)
7
+ );
8
+ --_exm-navigation-item-color-selected: var(--exm-navigation-item-color-selected, var(--md-sys-color-on-secondary));
9
+ }
10
+
11
+ md-list-item {
12
+ margin-right: 8px;
13
+ margin-left: 8px;
14
+ border-radius: 1rem;
15
+ --md-list-item-container-shape: 1rem;
16
+ display: grid;
17
+ grid-template-columns: auto 1fr auto;
18
+ }
19
+
20
+ md-list-item[selected] {
21
+ --md-list-item-label-text-color: var(--_exm-navigation-item-color-selected);
22
+ background-color: var(--_exm-navigation-item-background-color-selected);
23
+ --md-list-item-leading-icon-color: var(--_exm-navigation-item-color-selected)
24
+ --md-list-item-trailing-icon-color: var(--_exm-navigation-item-color-selected);
25
+ }
26
+
27
+ md-list-item.collapsed-item[selected] {
28
+ --md-list-item-label-text-color: var(--_exm-navigation-item-color-selected);
29
+ background-color: var(--_exm-navigation-item-background-color-selected);
30
+ }
31
+
32
+ md-list-item[selected] md-icon {
33
+ color: var(--md-sys-color-primary);
34
+ }
35
+
36
+ .sub-menu {
37
+ margin-left: 1rem;
38
+ }
39
+ `;
4
40
  //# sourceMappingURL=exm-navigate-drawer-nav-item-css.js.map
@@ -1,2 +1 @@
1
1
  export declare const style: import("lit").CSSResult;
2
- export default style;
@@ -1,4 +1,66 @@
1
1
  import { css } from 'lit';
2
- export const style = css `.navigation-container{display:grid;grid-template-columns:auto var(--exm-drawer-width, 500px) 1fr;grid-template-rows:1fr;width:100%;transition:grid-template-columns .3s ease}.navigation-container.show-topbar{grid-template-columns:1fr;grid-template-rows:auto 1fr}.navigation-container.show-topbar exm-navigation-topbar{grid-area:1/1/2/2;z-index:2}.navigation-container.show-topbar exm-navigation-drawer{grid-area:1/1/3/2}.navigation-container.show-topbar .content{grid-area:2/1/3/2}exm-navigation-rail{grid-area:1/1/2/2}exm-navigation-drawer{grid-area:1/2/2/3}.content{grid-area:1/3/2/4;z-index:1}exm-navigation-drawer{--md-list-container-color: none;--md-list-item-label-text-color: var(--md-sys-color-on-surface-variant);--md-list-item-supporting-text-color: var(--md-sys-color-on-surface-variant);--md-list-item-trailing-supporting-text-color: var(--md-sys-color-on-surface-variant);--md-list-item-container-shape: 24px;--mdc-theme-surface: var(--md-sys-color-surface-container-high);--mdc-shape-large: 1rem}.left-margin{margin-left:2.5rem}`;
3
- export default style;
2
+ export const style = css `
3
+ .navigation-container {
4
+ display: grid;
5
+ grid-template-columns: auto var(--exm-drawer-width, 500px) 1fr;
6
+ grid-template-rows: 1fr;
7
+ width: 100%;
8
+ transition: grid-template-columns 0.3s ease;
9
+ max-height: 100vh;
10
+ }
11
+
12
+ .navigation-container.show-topbar {
13
+ grid-template-columns: 1fr;
14
+ grid-template-rows: auto 1fr;
15
+ }
16
+
17
+ .navigation-container.show-topbar exm-navigation-topbar {
18
+ grid-area: 1/1/2/2;
19
+ z-index: 2;
20
+ }
21
+
22
+ .navigation-container.show-topbar exm-navigation-drawer {
23
+ grid-area: 1/1/3/2;
24
+ }
25
+
26
+ .navigation-container.show-topbar .content {
27
+ grid-area: 2/1/3/2;
28
+ }
29
+
30
+ exm-navigation-rail {
31
+ grid-area: 1/1/2/2;
32
+ }
33
+
34
+ exm-navigation-drawer {
35
+ grid-area: 1/2/2/3;
36
+ }
37
+
38
+ .content {
39
+ grid-area: 1/3/2/4;
40
+ z-index: 1;
41
+ overflow: scroll;
42
+ }
43
+
44
+ exm-navigation-drawer {
45
+ --md-list-container-color: none;
46
+ --md-list-item-label-text-color: var(--md-sys-color-on-surface-variant);
47
+ --md-list-item-supporting-text-color: var(--md-sys-color-on-surface-variant);
48
+ --md-list-item-trailing-supporting-text-color: var(--md-sys-color-on-surface-variant);
49
+ --md-list-item-container-shape: 24px;
50
+ --mdc-theme-surface: var(--md-sys-color-surface-container-high);
51
+ --mdc-shape-large: 1rem;
52
+ }
53
+
54
+ .left-margin {
55
+ margin-left: 2.5rem;
56
+ }
57
+
58
+ .drawer-menu-button {
59
+ padding: 8px 12px;
60
+ }
61
+
62
+ .drawer-back-button {
63
+ padding: 8px 12px 0;
64
+ }
65
+ `;
4
66
  //# sourceMappingURL=exm-navigation-css.js.map
@@ -1,2 +1 @@
1
1
  export declare const style: import("lit").CSSResult;
2
- export default style;