@internetarchive/ia-topnav 1.3.6 → 1.3.7-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.
Files changed (85) hide show
  1. package/.eslintrc +16 -16
  2. package/LICENSE +661 -661
  3. package/README.md +147 -147
  4. package/index.d.ts +109 -109
  5. package/index.js +3 -3
  6. package/package.json +61 -61
  7. package/src/assets/img/hamburger.js +38 -38
  8. package/src/assets/img/ia-icon.js +33 -33
  9. package/src/assets/img/icon-audio.js +23 -23
  10. package/src/assets/img/icon-close.js +16 -16
  11. package/src/assets/img/icon-donate-unpadded.js +16 -16
  12. package/src/assets/img/icon-donate.js +15 -15
  13. package/src/assets/img/icon-ellipses.js +15 -15
  14. package/src/assets/img/icon-ia-logo.js +22 -22
  15. package/src/assets/img/icon-images.js +15 -15
  16. package/src/assets/img/icon-search.js +15 -15
  17. package/src/assets/img/icon-software.js +15 -15
  18. package/src/assets/img/icon-texts.js +15 -15
  19. package/src/assets/img/icon-upload-unpadded.js +14 -14
  20. package/src/assets/img/icon-upload.js +15 -15
  21. package/src/assets/img/icon-user.js +15 -15
  22. package/src/assets/img/icon-video.js +15 -15
  23. package/src/assets/img/icon-web.js +15 -15
  24. package/src/assets/img/icon.js +18 -18
  25. package/src/assets/img/icons.js +33 -33
  26. package/src/assets/img/wordmark-stacked.js +13 -13
  27. package/src/data/menus.js +646 -646
  28. package/src/desktop-subnav.js +45 -45
  29. package/src/dropdown-menu.js +110 -109
  30. package/src/ia-topnav.js +324 -314
  31. package/src/lib/formatUrl.js +1 -1
  32. package/src/lib/keyboard-navigation.js +128 -0
  33. package/src/lib/location-handler.js +5 -5
  34. package/src/lib/query-handler.js +7 -7
  35. package/src/lib/toSentenceCase.js +8 -8
  36. package/src/login-button.js +79 -79
  37. package/src/media-button.js +113 -113
  38. package/src/media-menu.js +154 -133
  39. package/src/media-slider.js +118 -104
  40. package/src/media-subnav.js +112 -112
  41. package/src/more-slider.js +33 -33
  42. package/src/nav-search.js +111 -117
  43. package/src/primary-nav.js +258 -224
  44. package/src/save-page-form.js +59 -59
  45. package/src/search-menu.js +145 -115
  46. package/src/signed-out-dropdown.js +10 -10
  47. package/src/styles/base.js +48 -48
  48. package/src/styles/desktop-subnav.js +37 -37
  49. package/src/styles/dropdown-menu.js +168 -166
  50. package/src/styles/ia-topnav.js +87 -87
  51. package/src/styles/login-button.js +82 -79
  52. package/src/styles/media-button.js +156 -156
  53. package/src/styles/media-menu.js +66 -70
  54. package/src/styles/media-slider.js +81 -81
  55. package/src/styles/media-subnav.js +156 -156
  56. package/src/styles/more-slider.js +15 -15
  57. package/src/styles/nav-search.js +136 -136
  58. package/src/styles/primary-nav.js +311 -300
  59. package/src/styles/save-page-form.js +54 -54
  60. package/src/styles/search-menu.js +105 -99
  61. package/src/styles/signed-out-dropdown.js +31 -31
  62. package/src/styles/user-menu.js +31 -31
  63. package/src/styles/wayback-search.js +48 -48
  64. package/src/styles/wayback-slider.js +30 -30
  65. package/src/tracked-element.js +29 -27
  66. package/src/user-menu.js +56 -42
  67. package/src/wayback-search.js +18 -18
  68. package/src/wayback-slider.js +87 -87
  69. package/test/assets/img/hamburger.test.js +15 -15
  70. package/test/assets/img/user.test.js +15 -15
  71. package/test/data/menus.test.js +19 -19
  72. package/test/dropdown-menu.test.js +25 -25
  73. package/test/ia-icon.test.js +13 -13
  74. package/test/ia-topnav.test.js +273 -273
  75. package/test/login-button.test.js +15 -15
  76. package/test/media-button.test.js +19 -19
  77. package/test/media-menu.test.js +40 -40
  78. package/test/media-slider.test.js +57 -57
  79. package/test/more-slider.test.js +13 -13
  80. package/test/nav-search.test.js +61 -61
  81. package/test/primary-nav.test.js +82 -82
  82. package/test/save-page-form.test.js +35 -35
  83. package/test/search-menu.test.js +49 -49
  84. package/test/user-menu.test.js +33 -33
  85. package/test/wayback-slider.test.js +80 -80
package/src/ia-topnav.js CHANGED
@@ -1,314 +1,324 @@
1
- import { LitElement, html, nothing } from 'https://offshoot.prod.archive.org/lit.js';
2
-
3
- import './primary-nav.js';
4
- import './user-menu.js';
5
- import './search-menu.js';
6
- import './media-slider.js';
7
- import './desktop-subnav.js';
8
- import './dropdown-menu.js';
9
- import './signed-out-dropdown.js';
10
- import iaTopNavCSS from './styles/ia-topnav.js';
11
- import { buildTopNavMenus, defaultTopNavConfig } from './data/menus.js';
12
-
13
- export default class IATopNav extends LitElement {
14
- static get styles() {
15
- return iaTopNavCSS;
16
- }
17
-
18
- // NOTE:
19
- // When adding properties, also add them to index.d.ts in the root `ia-topnav` directory
20
- // so Typescript can find them
21
- static get properties() {
22
- return {
23
- // we default to fully-qualified `https://archive.org` urls in nav, set to false for relatives
24
- localLinks: Boolean,
25
- // @see `data/menus.js` for a description:
26
- waybackPagesArchived: String,
27
- // the base host is for navigation, so may be empty for relative links
28
- baseHost: { type: String },
29
- // the media base host is the base host for images, such as the profile picture
30
- // which may not be hosted locally
31
- mediaBaseHost: { type: String },
32
- /** Whether the user has privs to edit all items */
33
- admin: { type: Boolean },
34
- /** Whether the user has privs to manage item flags */
35
- canManageFlags: { type: Boolean },
36
- config: {
37
- type: Object,
38
- converter(value) {
39
- return JSON.parse(atob(value));
40
- },
41
- },
42
- hideSearch: { type: Boolean },
43
- /** Identifier for the item or collection currently being viewed */
44
- itemIdentifier: { type: String },
45
- mediaSliderOpen: { type: Boolean },
46
- menus: {
47
- type: Object,
48
- converter(value) {
49
- return JSON.parse(atob(value));
50
- },
51
- },
52
- openMenu: { type: String },
53
- screenName: { type: String },
54
- searchIn: { type: String },
55
- searchQuery: {
56
- type: String,
57
- converter(value) {
58
- return atob(value);
59
- },
60
- },
61
- selectedMenuOption: { type: String },
62
- username: { type: String },
63
- userProfileImagePath: { type: String },
64
- secondIdentitySlotMode: { type: String },
65
- };
66
- }
67
-
68
- constructor() {
69
- super();
70
- this.menuSetup();
71
- this.mediaBaseHost = 'https://archive.org';
72
- this.userProfileImagePath = '/services/img/user/profile';
73
- this.config = defaultTopNavConfig;
74
- this.hideSearch = false;
75
- this.mediaSliderOpen = false;
76
- this.openMenu = '';
77
- this.searchIn = '';
78
- this.selectedMenuOption = '';
79
- this.secondIdentitySlotMode = '';
80
- }
81
-
82
- updated(props) {
83
- if (props.has('username') || props.has('localLinks') || props.has('baseHost') ||
84
- props.has('waybackPagesArchived') || props.has('itemIdentifier')) {
85
- this.menuSetup();
86
- }
87
- }
88
-
89
- firstUpdated() {
90
- // close open menu on `esc` click
91
- document.addEventListener('keydown', e => {
92
- if (e.key === 'Escape') this.closeMenus();
93
- }, false);
94
- }
95
-
96
- menuSetup() {
97
- this.localLinks = this.getAttribute('localLinks') !== 'false' && this.getAttribute('localLinks') !== false;
98
- this.username = this.getAttribute('username')
99
- this.screenName = this.getAttribute('screenname');
100
- this.waybackPagesArchived = this.getAttribute('waybackPagesArchived') ?? ''
101
-
102
- // ensure we update other components that use `baseHost`
103
- this.baseHost = this.localLinks ? '' : 'https://archive.org';
104
-
105
- // re/build the nav
106
- this.menus = buildTopNavMenus(this.username, this.localLinks, this.waybackPagesArchived, this.itemIdentifier);
107
- }
108
-
109
- menuToggled({ detail }) {
110
- const currentMenu = this.openMenu;
111
- this.openMenu = currentMenu === detail.menuName ? '' : detail.menuName;
112
- // Keeps media slider open if media menu is open
113
- if (this.openMenu === 'media') {
114
- return;
115
- }
116
- this.closeMediaSlider();
117
- }
118
-
119
- openMediaSlider() {
120
- this.mediaSliderOpen = true;
121
- }
122
-
123
- closeMediaSlider() {
124
- this.mediaSliderOpen = false;
125
- this.selectedMenuOption = '';
126
- }
127
-
128
- closeMenus() {
129
- this.openMenu = '';
130
- this.closeMediaSlider();
131
- }
132
-
133
- searchInChanged(e) {
134
- this.searchIn = e.detail.searchIn;
135
- }
136
-
137
- trackClick({ detail }) {
138
- this.dispatchEvent(new CustomEvent('analyticsClick', {
139
- bubbles: true,
140
- composed: true,
141
- detail,
142
- }));
143
- }
144
-
145
- trackSubmit({ detail }) {
146
- this.dispatchEvent(new CustomEvent('analyticsSubmit', {
147
- bubbles: true,
148
- composed: true,
149
- detail,
150
- }));
151
- }
152
-
153
- mediaTypeSelected({ detail }) {
154
- if (this.selectedMenuOption === detail.mediatype) {
155
- this.closeMediaSlider();
156
- return;
157
- }
158
- this.selectedMenuOption = detail.mediatype;
159
- this.openMediaSlider();
160
- }
161
-
162
- get searchMenuOpened() {
163
- return this.openMenu === 'search';
164
- }
165
-
166
- get signedOutOpened() {
167
- return this.openMenu === 'login';
168
- }
169
-
170
- get userMenuOpened() {
171
- return this.openMenu === 'user';
172
- }
173
-
174
- get searchMenuTabIndex() {
175
- return this.searchMenuOpened ? '' : '-1';
176
- }
177
-
178
- get userMenuTabIndex() {
179
- return this.userMenuOpened ? '' : '-1';
180
- }
181
-
182
- get signedOutTabIndex() {
183
- return this.signedOutOpened ? '' : '-1';
184
- }
185
-
186
- get closeLayerClass() {
187
- return !!this.openMenu || this.mediaSliderOpen ? 'visible' : '';
188
- }
189
-
190
- get userMenu() {
191
- return html`
192
- <user-menu
193
- .baseHost=${this.baseHost}
194
- .config=${this.config}
195
- .menuItems=${this.userMenuItems}
196
- ?open=${this.openMenu === 'user'}
197
- .username=${this.username}
198
- ?hideSearch=${this.hideSearch}
199
- tabindex="${this.userMenuTabIndex}"
200
- @menuToggled=${this.menuToggled}
201
- @trackClick=${this.trackClick}
202
- ></user-menu>
203
- `;
204
- }
205
-
206
- get signedOutDropdown() {
207
- return html`
208
- <signed-out-dropdown
209
- .baseHost=${this.baseHost}
210
- .config=${this.config}
211
- .open=${this.signedOutOpened}
212
- ?hideSearch=${this.hideSearch}
213
- tabindex="${this.signedOutTabIndex}"
214
- .menuItems=${this.signedOutMenuItems}
215
- ></signed-out-dropdown>
216
- `;
217
- }
218
-
219
- get signedOutMenuItems() {
220
- return this.menus.signedOut;
221
- }
222
-
223
- /**
224
- * Most users just get the basic menu items.
225
- * For users with `/items` priv, additional admin menu items are included too.
226
- * Having the `/flags` priv adds a further admin item for managing flags.
227
- */
228
- get userMenuItems() {
229
- const basicItems = this.menus.user;
230
-
231
- let adminItems = this.menus.userAdmin;
232
- if (this.canManageFlags) {
233
- adminItems = adminItems.concat(this.menus.userAdminFlags);
234
- }
235
-
236
- return this.itemIdentifier && this.admin
237
- ? [basicItems, adminItems]
238
- : basicItems;
239
- }
240
-
241
- get desktopSubnavMenuItems() {
242
- return this.menus.more;
243
- }
244
-
245
- get allowSecondaryIcon() {
246
- return this.secondIdentitySlotMode === 'allow';
247
- }
248
-
249
- get secondLogoSlot() {
250
- return this.allowSecondaryIcon
251
- ? html`
252
- <slot name="opt-sec-logo" slot="opt-sec-logo"></slot>
253
- <slot name="opt-sec-logo-mobile" slot="opt-sec-logo-mobile"></slot>
254
- `
255
- : nothing;
256
- }
257
-
258
- get separatorTemplate() {
259
- return html`<li class="divider" role="presentation"></li>`;
260
- }
261
-
262
- render() {
263
- return html`
264
- <div class="topnav">
265
- <primary-nav
266
- .baseHost=${this.baseHost}
267
- .mediaBaseHost=${this.mediaBaseHost}
268
- .config=${this.config}
269
- .openMenu=${this.openMenu}
270
- .screenName=${this.screenName}
271
- .searchIn=${this.searchIn}
272
- .searchQuery=${this.searchQuery}
273
- .secondIdentitySlotMode=${this.secondIdentitySlotMode}
274
- .selectedMenuOption=${this.selectedMenuOption}
275
- .username=${this.username}
276
- .userProfileImagePath=${this.userProfileImagePath}
277
- ?hideSearch=${this.hideSearch}
278
- @mediaTypeSelected=${this.mediaTypeSelected}
279
- @toggleSearchMenu=${this.toggleSearchMenu}
280
- @trackClick=${this.trackClick}
281
- @trackSubmit=${this.trackSubmit}
282
- @menuToggled=${this.menuToggled}
283
- >
284
- ${this.secondLogoSlot}
285
- </primary-nav>
286
- <media-slider
287
- .baseHost=${this.baseHost}
288
- .config=${this.config}
289
- .selectedMenuOption=${this.selectedMenuOption}
290
- .mediaSliderOpen=${this.mediaSliderOpen}
291
- .menus=${this.menus}
292
- ></media-slider>
293
- </div>
294
- ${this.username ? this.userMenu : this.signedOutDropdown}
295
- <search-menu
296
- .baseHost=${this.baseHost}
297
- .config=${this.config}
298
- .openMenu=${this.openMenu}
299
- tabindex="${this.searchMenuTabIndex}"
300
- ?hideSearch=${this.hideSearch}
301
- @searchInChanged=${this.searchInChanged}
302
- @trackClick=${this.trackClick}
303
- @trackSubmit=${this.trackSubmit}
304
- ></search-menu>
305
- <desktop-subnav
306
- .baseHost=${this.baseHost}
307
- .menuItems=${this.desktopSubnavMenuItems}
308
- ></desktop-subnav>
309
- <div id="close-layer" class="${this.closeLayerClass}" @click=${this.closeMenus}></div>
310
- `;
311
- }
312
- }
313
-
314
- customElements.define('ia-topnav', IATopNav);
1
+ import { LitElement, html, nothing } from 'https://offshoot.prod.archive.org/lit.js';
2
+
3
+ import './primary-nav.js';
4
+ import './user-menu.js';
5
+ import './search-menu.js';
6
+ import './media-slider.js';
7
+ import './desktop-subnav.js';
8
+ import './dropdown-menu.js';
9
+ import './signed-out-dropdown.js';
10
+ import iaTopNavCSS from './styles/ia-topnav.js';
11
+ import { buildTopNavMenus, defaultTopNavConfig } from './data/menus.js';
12
+
13
+ export default class IATopNav extends LitElement {
14
+ static get styles() {
15
+ return iaTopNavCSS;
16
+ }
17
+
18
+ // NOTE:
19
+ // When adding properties, also add them to index.d.ts in the root `ia-topnav` directory
20
+ // so Typescript can find them
21
+ static get properties() {
22
+ return {
23
+ // we default to fully-qualified `https://archive.org` urls in nav, set to false for relatives
24
+ localLinks: Boolean,
25
+ // @see `data/menus.js` for a description:
26
+ waybackPagesArchived: String,
27
+ // the base host is for navigation, so may be empty for relative links
28
+ baseHost: { type: String },
29
+ // the media base host is the base host for images, such as the profile picture
30
+ // which may not be hosted locally
31
+ mediaBaseHost: { type: String },
32
+ /** Whether the user has privs to edit all items */
33
+ admin: { type: Boolean },
34
+ /** Whether the user has privs to manage item flags */
35
+ canManageFlags: { type: Boolean },
36
+ config: {
37
+ type: Object,
38
+ converter(value) {
39
+ return JSON.parse(atob(value));
40
+ },
41
+ },
42
+ hideSearch: { type: Boolean },
43
+ /** Identifier for the item or collection currently being viewed */
44
+ itemIdentifier: { type: String },
45
+ mediaSliderOpen: { type: Boolean },
46
+ menus: {
47
+ type: Object,
48
+ converter(value) {
49
+ return JSON.parse(atob(value));
50
+ },
51
+ },
52
+ openMenu: { type: String },
53
+ screenName: { type: String },
54
+ searchIn: { type: String },
55
+ searchQuery: {
56
+ type: String,
57
+ converter(value) {
58
+ return atob(value);
59
+ },
60
+ },
61
+ selectedMenuOption: { type: String },
62
+ username: { type: String },
63
+ userProfileImagePath: { type: String },
64
+ secondIdentitySlotMode: { type: String },
65
+ currentTab: { type: Object },
66
+ };
67
+ }
68
+
69
+ constructor() {
70
+ super();
71
+ this.menuSetup();
72
+ this.mediaBaseHost = 'https://archive.org';
73
+ this.userProfileImagePath = '/services/img/user/profile';
74
+ this.config = defaultTopNavConfig;
75
+ this.hideSearch = false;
76
+ this.mediaSliderOpen = false;
77
+ this.openMenu = '';
78
+ this.searchIn = '';
79
+ this.selectedMenuOption = '';
80
+ this.secondIdentitySlotMode = '';
81
+ this.currentTab = {};
82
+ }
83
+
84
+ updated(props) {
85
+ if (props.has('username') || props.has('localLinks') || props.has('baseHost') ||
86
+ props.has('waybackPagesArchived') || props.has('itemIdentifier')) {
87
+ this.menuSetup();
88
+ }
89
+ }
90
+
91
+ firstUpdated() {
92
+ // close open menu on `esc` click
93
+ document.addEventListener('keydown', e => {
94
+ if (e.key === 'Escape') {
95
+ this.openMenu = '';
96
+ this.mediaSliderOpen = false;
97
+ }
98
+ }, false);
99
+ }
100
+
101
+ menuSetup() {
102
+ this.localLinks = this.getAttribute('localLinks') !== 'false' && this.getAttribute('localLinks') !== false;
103
+ this.username = this.getAttribute('username')
104
+ this.screenName = this.getAttribute('screenname');
105
+ this.waybackPagesArchived = this.getAttribute('waybackPagesArchived') ?? ''
106
+
107
+ // ensure we update other components that use `baseHost`
108
+ this.baseHost = this.localLinks ? '' : 'https://archive.org';
109
+
110
+ // re/build the nav
111
+ this.menus = buildTopNavMenus(this.username, this.localLinks, this.waybackPagesArchived, this.itemIdentifier);
112
+ }
113
+
114
+ menuToggled({ detail }) {
115
+ const currentMenu = this.openMenu;
116
+ this.openMenu = currentMenu === detail.menuName ? '' : detail.menuName;
117
+ // Keeps media slider open if media menu is open
118
+ if (this.openMenu === 'media') {
119
+ return;
120
+ }
121
+ this.closeMediaSlider();
122
+ }
123
+
124
+ openMediaSlider() {
125
+ this.mediaSliderOpen = true;
126
+ }
127
+
128
+ closeMediaSlider() {
129
+ this.mediaSliderOpen = false;
130
+ this.selectedMenuOption = '';
131
+ }
132
+
133
+ closeMenus() {
134
+ this.openMenu = '';
135
+ this.closeMediaSlider();
136
+ }
137
+
138
+ searchInChanged(e) {
139
+ this.searchIn = e.detail.searchIn;
140
+ }
141
+
142
+ trackClick({ detail }) {
143
+ this.dispatchEvent(new CustomEvent('analyticsClick', {
144
+ bubbles: true,
145
+ composed: true,
146
+ detail,
147
+ }));
148
+ }
149
+
150
+ trackSubmit({ detail }) {
151
+ this.dispatchEvent(new CustomEvent('analyticsSubmit', {
152
+ bubbles: true,
153
+ composed: true,
154
+ detail,
155
+ }));
156
+ }
157
+
158
+ mediaTypeSelected({ detail }) {
159
+ if (this.selectedMenuOption === detail.mediatype) {
160
+ this.closeMediaSlider();
161
+ return;
162
+ }
163
+ this.selectedMenuOption = detail.mediatype;
164
+ this.openMediaSlider();
165
+ }
166
+
167
+ get searchMenuOpened() {
168
+ return this.openMenu === 'search';
169
+ }
170
+
171
+ get signedOutOpened() {
172
+ return this.openMenu === 'login';
173
+ }
174
+
175
+ get userMenuOpened() {
176
+ return this.openMenu === 'user';
177
+ }
178
+
179
+ get searchMenuTabIndex() {
180
+ return this.searchMenuOpened ? '' : '-1';
181
+ }
182
+
183
+ get userMenuTabIndex() {
184
+ return this.userMenuOpened ? '' : '-1';
185
+ }
186
+
187
+ get signedOutTabIndex() {
188
+ return this.signedOutOpened ? '' : '-1';
189
+ }
190
+
191
+ get closeLayerClass() {
192
+ return !!this.openMenu || this.mediaSliderOpen ? 'visible' : '';
193
+ }
194
+
195
+ get userMenu() {
196
+ return html`
197
+ <user-menu
198
+ .baseHost=${this.baseHost}
199
+ .config=${this.config}
200
+ .menuItems=${this.userMenuItems}
201
+ ?open=${this.openMenu === 'user'}
202
+ .username=${this.username}
203
+ ?hideSearch=${this.hideSearch}
204
+ tabindex="${this.userMenuTabIndex}"
205
+ @menuToggled=${this.menuToggled}
206
+ @trackClick=${this.trackClick}
207
+ @focusToOtherMenuItem=${(e) => this.currentTab = e.detail}
208
+ ></user-menu>
209
+ `;
210
+ }
211
+
212
+ get signedOutDropdown() {
213
+ return html`
214
+ <signed-out-dropdown
215
+ .baseHost=${this.baseHost}
216
+ .config=${this.config}
217
+ .open=${this.signedOutOpened}
218
+ ?hideSearch=${this.hideSearch}
219
+ tabindex="${this.signedOutTabIndex}"
220
+ .menuItems=${this.signedOutMenuItems}
221
+ ></signed-out-dropdown>
222
+ `;
223
+ }
224
+
225
+ get signedOutMenuItems() {
226
+ return this.menus.signedOut;
227
+ }
228
+
229
+ /**
230
+ * Most users just get the basic menu items.
231
+ * For users with `/items` priv, additional admin menu items are included too.
232
+ * Having the `/flags` priv adds a further admin item for managing flags.
233
+ */
234
+ get userMenuItems() {
235
+ const basicItems = this.menus.user;
236
+
237
+ let adminItems = this.menus.userAdmin;
238
+ if (this.canManageFlags) {
239
+ adminItems = adminItems.concat(this.menus.userAdminFlags);
240
+ }
241
+
242
+ return this.itemIdentifier && this.admin
243
+ ? [basicItems, adminItems]
244
+ : basicItems;
245
+ }
246
+
247
+ get desktopSubnavMenuItems() {
248
+ return this.menus.more;
249
+ }
250
+
251
+ get allowSecondaryIcon() {
252
+ return this.secondIdentitySlotMode === 'allow';
253
+ }
254
+
255
+ get secondLogoSlot() {
256
+ return this.allowSecondaryIcon
257
+ ? html`
258
+ <slot name="opt-sec-logo" slot="opt-sec-logo"></slot>
259
+ <slot name="opt-sec-logo-mobile" slot="opt-sec-logo-mobile"></slot>
260
+ `
261
+ : nothing;
262
+ }
263
+
264
+ get separatorTemplate() {
265
+ return html`<li class="divider" role="presentation"></li>`;
266
+ }
267
+
268
+ render() {
269
+ return html`
270
+ <div class="topnav">
271
+ <primary-nav
272
+ .baseHost=${this.baseHost}
273
+ .mediaBaseHost=${this.mediaBaseHost}
274
+ .config=${this.config}
275
+ .openMenu=${this.openMenu}
276
+ .screenName=${this.screenName}
277
+ .searchIn=${this.searchIn}
278
+ .searchQuery=${this.searchQuery}
279
+ .secondIdentitySlotMode=${this.secondIdentitySlotMode}
280
+ .selectedMenuOption=${this.selectedMenuOption}
281
+ .username=${this.username}
282
+ .userProfileImagePath=${this.userProfileImagePath}
283
+ .currentTab=${this.currentTab}
284
+ ?hideSearch=${this.hideSearch}
285
+ @mediaTypeSelected=${this.mediaTypeSelected}
286
+ @toggleSearchMenu=${this.toggleSearchMenu}
287
+ @trackClick=${this.trackClick}
288
+ @trackSubmit=${this.trackSubmit}
289
+ @menuToggled=${this.menuToggled}
290
+ >
291
+ ${this.secondLogoSlot}
292
+ </primary-nav>
293
+ <media-slider
294
+ .baseHost=${this.baseHost}
295
+ .config=${this.config}
296
+ .selectedMenuOption=${this.selectedMenuOption}
297
+ .mediaSliderOpen=${this.mediaSliderOpen}
298
+ .menus=${this.menus}
299
+ tabindex="${this.mediaSliderOpen ? '1' : '-1'}"
300
+ @focusToOtherMenuItem=${(e) => this.currentTab = e.detail}
301
+ ></media-slider>
302
+ </div>
303
+ ${this.username ? this.userMenu : this.signedOutDropdown}
304
+ <search-menu
305
+ .baseHost=${this.baseHost}
306
+ .config=${this.config}
307
+ .openMenu=${this.openMenu}
308
+ tabindex="${this.searchMenuTabIndex}"
309
+ ?hideSearch=${this.hideSearch}
310
+ @searchInChanged=${this.searchInChanged}
311
+ @trackClick=${this.trackClick}
312
+ @trackSubmit=${this.trackSubmit}
313
+ ></search-menu>
314
+ <desktop-subnav
315
+ .baseHost=${this.baseHost}
316
+ .menuItems=${this.desktopSubnavMenuItems}
317
+ @focus=${this.closeMenus}
318
+ ></desktop-subnav>
319
+ <div id="close-layer" class="${this.closeLayerClass}" @click=${this.closeMenus}></div>
320
+ `;
321
+ }
322
+ }
323
+
324
+ customElements.define('ia-topnav', IATopNav);
@@ -1 +1 @@
1
- export default (url, baseHost) => (/^https?:/.test(url) ? url : `${baseHost}${url}`);
1
+ export default (url, baseHost) => (/^https?:/.test(url) ? url : `${baseHost}${url}`);