@internetarchive/elements 0.0.0-WEBDEV-8458-update-item-nav

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 (127) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +417 -0
  3. package/dist/src/elements/ia-button/ia-button.d.ts +47 -0
  4. package/dist/src/elements/ia-button/ia-button.d.ts.map +1 -0
  5. package/dist/src/elements/ia-button/ia-button.js +377 -0
  6. package/dist/src/elements/ia-button/ia-button.js.map +1 -0
  7. package/dist/src/elements/ia-combo-box/caret-closed.svg +8 -0
  8. package/dist/src/elements/ia-combo-box/caret-open.svg +8 -0
  9. package/dist/src/elements/ia-combo-box/clear.svg +9 -0
  10. package/dist/src/elements/ia-combo-box/ia-combo-box.d.ts +427 -0
  11. package/dist/src/elements/ia-combo-box/ia-combo-box.d.ts.map +1 -0
  12. package/dist/src/elements/ia-combo-box/ia-combo-box.js +1295 -0
  13. package/dist/src/elements/ia-combo-box/ia-combo-box.js.map +1 -0
  14. package/dist/src/elements/ia-combo-box/models.d.ts +76 -0
  15. package/dist/src/elements/ia-combo-box/models.d.ts.map +1 -0
  16. package/dist/src/elements/ia-combo-box/models.js +40 -0
  17. package/dist/src/elements/ia-combo-box/models.js.map +1 -0
  18. package/dist/src/elements/ia-combo-box/story-support/200-countries.json +802 -0
  19. package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.d.ts +68 -0
  20. package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.d.ts.map +1 -0
  21. package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.js +331 -0
  22. package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.js.map +1 -0
  23. package/dist/src/elements/ia-dropdown-search-bar/models.d.ts +17 -0
  24. package/dist/src/elements/ia-dropdown-search-bar/models.d.ts.map +1 -0
  25. package/dist/src/elements/ia-dropdown-search-bar/models.js +2 -0
  26. package/dist/src/elements/ia-dropdown-search-bar/models.js.map +1 -0
  27. package/dist/src/elements/ia-dropdown-search-bar/search.svg +10 -0
  28. package/dist/src/elements/ia-item-navigator/ia-item-navigator.d.ts +97 -0
  29. package/dist/src/elements/ia-item-navigator/ia-item-navigator.d.ts.map +1 -0
  30. package/dist/src/elements/ia-item-navigator/ia-item-navigator.js +588 -0
  31. package/dist/src/elements/ia-item-navigator/ia-item-navigator.js.map +1 -0
  32. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-button.d.ts +39 -0
  33. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-button.d.ts.map +1 -0
  34. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-button.js +249 -0
  35. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-button.js.map +1 -0
  36. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-slider.d.ts +55 -0
  37. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-slider.d.ts.map +1 -0
  38. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-slider.js +394 -0
  39. package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-slider.js.map +1 -0
  40. package/dist/src/elements/ia-item-navigator/ia-itemnav-no-theater-available.d.ts +20 -0
  41. package/dist/src/elements/ia-item-navigator/ia-itemnav-no-theater-available.d.ts.map +1 -0
  42. package/dist/src/elements/ia-item-navigator/ia-itemnav-no-theater-available.js +102 -0
  43. package/dist/src/elements/ia-item-navigator/ia-itemnav-no-theater-available.js.map +1 -0
  44. package/dist/src/elements/ia-item-navigator/icons/collapse-sidebar.svg +7 -0
  45. package/dist/src/elements/ia-item-navigator/icons/ellipses.svg +7 -0
  46. package/dist/src/elements/ia-item-navigator/icons.d.ts +13 -0
  47. package/dist/src/elements/ia-item-navigator/icons.d.ts.map +1 -0
  48. package/dist/src/elements/ia-item-navigator/icons.js +16 -0
  49. package/dist/src/elements/ia-item-navigator/icons.js.map +1 -0
  50. package/dist/src/elements/ia-item-navigator/interfaces/event-interfaces.d.ts +41 -0
  51. package/dist/src/elements/ia-item-navigator/interfaces/event-interfaces.d.ts.map +1 -0
  52. package/dist/src/elements/ia-item-navigator/interfaces/event-interfaces.js +2 -0
  53. package/dist/src/elements/ia-item-navigator/interfaces/event-interfaces.js.map +1 -0
  54. package/dist/src/elements/ia-item-navigator/interfaces/menu-interfaces.d.ts +23 -0
  55. package/dist/src/elements/ia-item-navigator/interfaces/menu-interfaces.d.ts.map +1 -0
  56. package/dist/src/elements/ia-item-navigator/interfaces/menu-interfaces.js +2 -0
  57. package/dist/src/elements/ia-item-navigator/interfaces/menu-interfaces.js.map +1 -0
  58. package/dist/src/elements/ia-item-navigator/masked-icon.d.ts +24 -0
  59. package/dist/src/elements/ia-item-navigator/masked-icon.d.ts.map +1 -0
  60. package/dist/src/elements/ia-item-navigator/masked-icon.js +30 -0
  61. package/dist/src/elements/ia-item-navigator/masked-icon.js.map +1 -0
  62. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-share-panel.d.ts +47 -0
  63. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-share-panel.d.ts.map +1 -0
  64. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-share-panel.js +352 -0
  65. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-share-panel.js.map +1 -0
  66. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-sort-files-button.d.ts +22 -0
  67. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-sort-files-button.d.ts.map +1 -0
  68. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-sort-files-button.js +137 -0
  69. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-sort-files-button.js.map +1 -0
  70. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-viewable-files-panel.d.ts +40 -0
  71. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-viewable-files-panel.d.ts.map +1 -0
  72. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-viewable-files-panel.js +217 -0
  73. package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-viewable-files-panel.js.map +1 -0
  74. package/dist/src/elements/ia-item-navigator/menus/icons/email.svg +6 -0
  75. package/dist/src/elements/ia-item-navigator/menus/icons/facebook.svg +6 -0
  76. package/dist/src/elements/ia-item-navigator/menus/icons/link.svg +6 -0
  77. package/dist/src/elements/ia-item-navigator/menus/icons/list.svg +3 -0
  78. package/dist/src/elements/ia-item-navigator/menus/icons/pinterest.svg +6 -0
  79. package/dist/src/elements/ia-item-navigator/menus/icons/share.svg +6 -0
  80. package/dist/src/elements/ia-item-navigator/menus/icons/sort-asc.svg +22 -0
  81. package/dist/src/elements/ia-item-navigator/menus/icons/sort-desc.svg +21 -0
  82. package/dist/src/elements/ia-item-navigator/menus/icons/sort-neutral.svg +13 -0
  83. package/dist/src/elements/ia-item-navigator/menus/icons/tumblr.svg +6 -0
  84. package/dist/src/elements/ia-item-navigator/menus/icons/twitter.svg +6 -0
  85. package/dist/src/elements/ia-item-navigator/menus/icons/viewable-files.svg +6 -0
  86. package/dist/src/elements/ia-item-navigator/menus/models.d.ts +17 -0
  87. package/dist/src/elements/ia-item-navigator/menus/models.d.ts.map +1 -0
  88. package/dist/src/elements/ia-item-navigator/menus/models.js +2 -0
  89. package/dist/src/elements/ia-item-navigator/menus/models.js.map +1 -0
  90. package/dist/src/elements/ia-item-navigator/menus/share-icons.d.ts +16 -0
  91. package/dist/src/elements/ia-item-navigator/menus/share-icons.d.ts.map +1 -0
  92. package/dist/src/elements/ia-item-navigator/menus/share-icons.js +23 -0
  93. package/dist/src/elements/ia-item-navigator/menus/share-icons.js.map +1 -0
  94. package/dist/src/elements/ia-otp-form/ia-otp-form.d.ts +21 -0
  95. package/dist/src/elements/ia-otp-form/ia-otp-form.d.ts.map +1 -0
  96. package/dist/src/elements/ia-otp-form/ia-otp-form.js +157 -0
  97. package/dist/src/elements/ia-otp-form/ia-otp-form.js.map +1 -0
  98. package/dist/src/elements/ia-otp-input/ia-otp-input.d.ts +35 -0
  99. package/dist/src/elements/ia-otp-input/ia-otp-input.d.ts.map +1 -0
  100. package/dist/src/elements/ia-otp-input/ia-otp-input.js +217 -0
  101. package/dist/src/elements/ia-otp-input/ia-otp-input.js.map +1 -0
  102. package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.d.ts +10 -0
  103. package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.d.ts.map +1 -0
  104. package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.js +43 -0
  105. package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.js.map +1 -0
  106. package/dist/src/elements/ia-status-indicator/ia-status-indicator.d.ts +24 -0
  107. package/dist/src/elements/ia-status-indicator/ia-status-indicator.d.ts.map +1 -0
  108. package/dist/src/elements/ia-status-indicator/ia-status-indicator.js +229 -0
  109. package/dist/src/elements/ia-status-indicator/ia-status-indicator.js.map +1 -0
  110. package/dist/src/elements/index.d.ts +8 -0
  111. package/dist/src/elements/index.d.ts.map +1 -0
  112. package/dist/src/elements/index.js +8 -0
  113. package/dist/src/elements/index.js.map +1 -0
  114. package/dist/src/labs/ia-snow/flake.svg +1 -0
  115. package/dist/src/labs/ia-snow/ia-snow.d.ts +18 -0
  116. package/dist/src/labs/ia-snow/ia-snow.d.ts.map +1 -0
  117. package/dist/src/labs/ia-snow/ia-snow.js +100 -0
  118. package/dist/src/labs/ia-snow/ia-snow.js.map +1 -0
  119. package/dist/src/themes/theme-styles.d.ts +3 -0
  120. package/dist/src/themes/theme-styles.d.ts.map +1 -0
  121. package/dist/src/themes/theme-styles.js +168 -0
  122. package/dist/src/themes/theme-styles.js.map +1 -0
  123. package/dist/src/util/lazy-load-template.d.ts +51 -0
  124. package/dist/src/util/lazy-load-template.d.ts.map +1 -0
  125. package/dist/src/util/lazy-load-template.js +50 -0
  126. package/dist/src/util/lazy-load-template.js.map +1 -0
  127. package/package.json +128 -0
@@ -0,0 +1,68 @@
1
+ import { LitElement, PropertyValues, TemplateResult } from 'lit';
2
+ import type { SearchCategory } from './models.js';
3
+ import '@internetarchive/ia-clearable-text-input';
4
+ import '@internetarchive/ia-dropdown';
5
+ import '../../elements/ia-status-indicator/ia-status-indicator.js';
6
+ export declare class IADropdownSearchBar extends LitElement {
7
+ /** The query that appears in the search bar */
8
+ query?: string;
9
+ /** Dropdown menu options (tab IDs + labels) */
10
+ categories: SearchCategory[];
11
+ /** The currently selected dropdown category ID */
12
+ selectedCategory?: string;
13
+ /** Placeholder text for the search input */
14
+ placeholder: string;
15
+ /** Whether to use the mobile layout */
16
+ useMobileView: boolean;
17
+ /** Whether to hide the category dropdown to the left of the search bar */
18
+ hideDropdown: boolean;
19
+ /** Whether the search button should show its loading state */
20
+ loading: boolean;
21
+ private searchInput;
22
+ private categoryDropdown?;
23
+ /** The effective selected category, falling back to the first in the list. */
24
+ private get resolvedCategory();
25
+ render(): TemplateResult;
26
+ willUpdate(changed: PropertyValues): void;
27
+ /**
28
+ * Template for the category dropdown on the left side of the search bar.
29
+ */
30
+ private get dropdownTemplate();
31
+ /**
32
+ * Template for the main text entry box of the search bar.
33
+ */
34
+ private get textBoxTemplate();
35
+ /**
36
+ * Template for the "magnifying glass" search button to the right of the search bar.
37
+ */
38
+ private get searchButtonTemplate();
39
+ /**
40
+ * The display label for the currently selected category.
41
+ */
42
+ private get selectedCategoryLabel();
43
+ /**
44
+ * The current search query with +'s replaced by spaces.
45
+ */
46
+ private get spacedQuery();
47
+ /**
48
+ * Handler for when the search bar's clear button is pressed.
49
+ */
50
+ private searchFieldCleared;
51
+ /**
52
+ * Handler for Enter key or search button click.
53
+ */
54
+ private handleSubmit;
55
+ /**
56
+ * Handler for when the user selects a category from the dropdown.
57
+ *
58
+ * Sets `selectedCategory` locally for immediate visual feedback (semi-controlled
59
+ * pattern). The parent also binds this property and may re-set it on re-render.
60
+ */
61
+ private handleCategorySelected;
62
+ /**
63
+ * Emits a `searchRequested` event with the current query and category.
64
+ */
65
+ private emitSearchRequested;
66
+ static get styles(): import("lit").CSSResult[];
67
+ }
68
+ //# sourceMappingURL=ia-dropdown-search-bar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ia-dropdown-search-bar.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,UAAU,EAEV,cAAc,EACd,cAAc,EACf,MAAM,KAAK,CAAC;AAIb,OAAO,KAAK,EAAE,cAAc,EAAyB,MAAM,UAAU,CAAC;AAKtE,OAAO,0CAA0C,CAAC;AAClD,OAAO,8BAA8B,CAAC;AACtC,OAAO,uDAAuD,CAAC;AAU/D,qBACa,mBAAoB,SAAQ,UAAU;IACjD,+CAA+C;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IAE3C,+CAA+C;IACpB,UAAU,EAAE,cAAc,EAAE,CAAM;IAE7D,kDAAkD;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAEtD,4CAA4C;IAChB,WAAW,SAAiB;IAExD,uCAAuC;IACV,aAAa,UAAS;IAEnD,0EAA0E;IAC7C,YAAY,UAAS;IAElD,8DAA8D;IACjC,OAAO,UAAS;IAG7C,OAAO,CAAC,WAAW,CAAwB;IAG3C,OAAO,CAAC,gBAAgB,CAAC,CAAa;IAEtC,8EAA8E;IAC9E,OAAO,KAAK,gBAAgB,GAE3B;IAED,MAAM,IAAI,cAAc;IAexB,UAAU,CAAC,OAAO,EAAE,cAAc;IAelC;;OAEG;IACH,OAAO,KAAK,gBAAgB,GAoB3B;IAED;;OAEG;IACH,OAAO,KAAK,eAAe,GAe1B;IAED;;OAEG;IACH,OAAO,KAAK,oBAAoB,GAkB/B;IAED;;OAEG;IACH,OAAO,KAAK,qBAAqB,GAGhC;IAED;;OAEG;IACH,OAAO,KAAK,WAAW,GAEtB;IAED;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAM1B;;OAEG;IACH,OAAO,CAAC,YAAY;IAIpB;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAkB9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAW3B,MAAM,KAAK,MAAM,8BAwHhB;CACF"}
@@ -0,0 +1,331 @@
1
+ import { __decorate } from "tslib";
2
+ import { msg } from '@lit/localize';
3
+ import { css, html, LitElement, nothing, } from 'lit';
4
+ import { customElement, property, query } from 'lit/decorators.js';
5
+ import themeStyles from '../../themes/theme-styles.js';
6
+ import searchIcon from './search.svg';
7
+ import '@internetarchive/ia-clearable-text-input';
8
+ import '@internetarchive/ia-dropdown';
9
+ import '../../elements/ia-status-indicator/ia-status-indicator.js';
10
+ /**
11
+ * Event names emitted by this component
12
+ */
13
+ const Events = {
14
+ CategoryChanged: 'categoryChanged',
15
+ SearchRequested: 'searchRequested',
16
+ };
17
+ let IADropdownSearchBar = class IADropdownSearchBar extends LitElement {
18
+ constructor() {
19
+ super(...arguments);
20
+ /** Dropdown menu options (tab IDs + labels) */
21
+ this.categories = [];
22
+ /** Placeholder text for the search input */
23
+ this.placeholder = msg('Search');
24
+ /** Whether to use the mobile layout */
25
+ this.useMobileView = false;
26
+ /** Whether to hide the category dropdown to the left of the search bar */
27
+ this.hideDropdown = false;
28
+ /** Whether the search button should show its loading state */
29
+ this.loading = false;
30
+ }
31
+ /** The effective selected category, falling back to the first in the list. */
32
+ get resolvedCategory() {
33
+ return this.selectedCategory ?? this.categories?.[0]?.id ?? '';
34
+ }
35
+ render() {
36
+ return html `
37
+ <div id="container" part="container" role="search">
38
+ <div
39
+ id="main-bar"
40
+ part="main-bar"
41
+ class=${this.hideDropdown ? 'no-dropdown' : nothing}
42
+ >
43
+ ${this.hideDropdown ? nothing : this.dropdownTemplate}
44
+ ${this.textBoxTemplate} ${this.searchButtonTemplate}
45
+ </div>
46
+ </div>
47
+ `;
48
+ }
49
+ willUpdate(changed) {
50
+ // Push new categories down to the inner dropdown immediately, since ia-dropdown
51
+ // mutates its own selected option on interaction which can cause Lit's
52
+ // property-binding diff to miss the change in certain cases.
53
+ if (changed.has('selectedCategory') || changed.has('categories')) {
54
+ const resolved = this.resolvedCategory;
55
+ if (this.categoryDropdown &&
56
+ this.categoryDropdown.selectedOption !== resolved) {
57
+ this.categoryDropdown.selectedOption = resolved;
58
+ }
59
+ }
60
+ }
61
+ /**
62
+ * Template for the category dropdown on the left side of the search bar.
63
+ */
64
+ get dropdownTemplate() {
65
+ return html `
66
+ <ia-dropdown
67
+ id="category-dropdown"
68
+ part="category-dropdown"
69
+ displayCaret
70
+ includeSelectedOption
71
+ closeOnSelect
72
+ closeOnEscape
73
+ closeOnBackdropClick
74
+ openViaButton
75
+ .selectedOption=${this.resolvedCategory}
76
+ .options=${this.categories}
77
+ @optionSelected=${this.handleCategorySelected}
78
+ >
79
+ <span slot="dropdown-label" part="category-dropdown-label"
80
+ >${this.selectedCategoryLabel}</span
81
+ >
82
+ </ia-dropdown>
83
+ `;
84
+ }
85
+ /**
86
+ * Template for the main text entry box of the search bar.
87
+ */
88
+ get textBoxTemplate() {
89
+ return html `
90
+ <ia-clearable-text-input
91
+ id="search-input"
92
+ part="search-input"
93
+ .value=${this.spacedQuery}
94
+ placeholder=${this.placeholder}
95
+ clearButtonScreenReaderLabel=${msg('Clear search query')}
96
+ screenReaderLabel=${msg('Search the Archive. Filters and Advanced Search available below.')}
97
+ @clear=${this.searchFieldCleared}
98
+ @submit=${this.handleSubmit}
99
+ ></ia-clearable-text-input>
100
+ `;
101
+ }
102
+ /**
103
+ * Template for the "magnifying glass" search button to the right of the search bar.
104
+ */
105
+ get searchButtonTemplate() {
106
+ return html `
107
+ <button
108
+ id="search-button"
109
+ part="search-button"
110
+ class=${this.loading ? 'loading' : nothing}
111
+ type="button"
112
+ aria-label=${msg('Search')}
113
+ @click=${this.handleSubmit}
114
+ >
115
+ ${this.loading
116
+ ? html `<ia-status-indicator
117
+ mode="loading"
118
+ class="search-button-loading-icon"
119
+ ></ia-status-indicator>`
120
+ : html `<img src=${searchIcon} alt="" />`}
121
+ </button>
122
+ `;
123
+ }
124
+ /**
125
+ * The display label for the currently selected category.
126
+ */
127
+ get selectedCategoryLabel() {
128
+ const match = this.categories.find((c) => c.id === this.resolvedCategory);
129
+ return match?.label ?? this.resolvedCategory;
130
+ }
131
+ /**
132
+ * The current search query with +'s replaced by spaces.
133
+ */
134
+ get spacedQuery() {
135
+ return this.query?.replace(/\+/g, ' ') ?? '';
136
+ }
137
+ /**
138
+ * Handler for when the search bar's clear button is pressed.
139
+ */
140
+ searchFieldCleared() {
141
+ if (this.query) {
142
+ this.emitSearchRequested();
143
+ }
144
+ }
145
+ /**
146
+ * Handler for Enter key or search button click.
147
+ */
148
+ handleSubmit() {
149
+ this.emitSearchRequested();
150
+ }
151
+ /**
152
+ * Handler for when the user selects a category from the dropdown.
153
+ *
154
+ * Sets `selectedCategory` locally for immediate visual feedback (semi-controlled
155
+ * pattern). The parent also binds this property and may re-set it on re-render.
156
+ */
157
+ handleCategorySelected(e) {
158
+ const newCategoryId = e.detail.option.id;
159
+ if (newCategoryId === this.resolvedCategory)
160
+ return;
161
+ this.selectedCategory = newCategoryId;
162
+ // On next tick, focus the text input bar (seemingly fails in Safari without the delay)
163
+ setTimeout(() => this.searchInput.focus());
164
+ this.dispatchEvent(new CustomEvent(Events.CategoryChanged, {
165
+ detail: newCategoryId,
166
+ }));
167
+ }
168
+ /**
169
+ * Emits a `searchRequested` event with the current query and category.
170
+ */
171
+ emitSearchRequested() {
172
+ this.dispatchEvent(new CustomEvent(Events.SearchRequested, {
173
+ detail: {
174
+ query: this.searchInput.value,
175
+ category: this.resolvedCategory,
176
+ },
177
+ }));
178
+ }
179
+ static get styles() {
180
+ const ownStyles = css `
181
+ :host {
182
+ --search-bar-height--: var(--search-bar-height, 30px);
183
+ --search-bar-width--: var(--search-bar-width, 300px);
184
+ --search-bar-internal-padding--: var(--padding-sm, 5px);
185
+ --clear-button-offset--: var(--clear-button-offset, 0);
186
+ /* While it would be nice to fall back to ia-dropdown's own default here by making this var
187
+ fall back to "initial", older Safari versions don't support that keyword in a var() fallback.
188
+ So instead we just restate ia-dropdown's current default 2 here as the fallback. */
189
+ --dropdown-z-index--: var(--dropdown-z-index, 2);
190
+ }
191
+
192
+ #container {
193
+ display: inline-block;
194
+ width: var(--search-bar-width--);
195
+ }
196
+
197
+ #main-bar {
198
+ display: flex;
199
+ height: var(--search-bar-height--, 30px);
200
+ flex: 1;
201
+ }
202
+
203
+ #category-dropdown {
204
+ display: flex;
205
+ flex-shrink: 0;
206
+ height: 100%;
207
+ box-sizing: border-box;
208
+
209
+ background-color: #f5f5f7;
210
+ border: 1px solid #999;
211
+ border-radius: 5px 0 0 5px;
212
+
213
+ --dropdownMainButtonPadding: 0 var(--search-bar-internal-padding--, 5px);
214
+ --dropdownBgColor: #2c2c2c;
215
+ --dropdownTextColor: #fff;
216
+ --dropdownBorderColor: #ddd;
217
+ --dropdownCaretColor: var(--ia-theme-primary-text-color, #2c2c2c);
218
+ --dropdownHoverBgColor: rgba(255, 255, 255, 0.3);
219
+ --dropdownHoverTextColor: #fff;
220
+ --dropdownSelectedBgColor: rgba(255, 255, 255, 0.3);
221
+ --dropdownSelectedTextColor: #fff;
222
+ --dropdownWhiteSpace: nowrap;
223
+ --dropdownOffsetTop: 2px;
224
+ --caretHeight: 8px;
225
+ --caretWidth: 12px;
226
+ --caretPadding: 0 0 0 5px;
227
+ --dropdownFontSize: inherit;
228
+ --dropdownBorderRadius: 4px;
229
+ --buttonSlotPaddingRight: 0;
230
+ --dropdownTextAlign: left;
231
+ --dropdownListZIndex: var(--dropdown-z-index--);
232
+ }
233
+
234
+ #category-dropdown [slot='dropdown-label'] {
235
+ color: var(--ia-theme-primary-text-color, #2c2c2c);
236
+ font-size: 1.4rem;
237
+ font-family: inherit;
238
+ white-space: nowrap;
239
+ }
240
+
241
+ .no-dropdown #search-input {
242
+ border-left: 1px solid #999;
243
+ border-radius: 5px 0 0 5px;
244
+ overflow: hidden;
245
+ }
246
+
247
+ #search-input {
248
+ width: 100%;
249
+ height: 100%;
250
+ box-sizing: border-box;
251
+ border-top: 1px solid #999;
252
+ border-bottom: 1px solid #999;
253
+ font-size: inherit;
254
+
255
+ --input-height: calc(var(--search-bar-height--) - 2px);
256
+ --input-padding: 0 var(--search-bar-internal-padding--, 5px);
257
+ --input-background-color: var(
258
+ --ia-theme-secondary-background-color,
259
+ #fff
260
+ );
261
+ --input-border-radius: 0;
262
+ --input-border-width: 0;
263
+ --input-box-shadow: none;
264
+ --input-focused-box-shadow: none;
265
+ --input-font-size: auto;
266
+ --clear-button-top: var(--clear-button-offset--, 0);
267
+ --clear-button-right: 2px;
268
+ }
269
+
270
+ #search-button {
271
+ appearance: none;
272
+ box-sizing: border-box;
273
+ border-radius: 0 5px 5px 0;
274
+ background-color: var(--ia-theme-secondary-background-color, #fff);
275
+ border: 1px solid #999;
276
+ border-left: 0;
277
+ padding: 0 var(--search-bar-internal-padding--, 5px) 0 5px;
278
+ min-width: 30px;
279
+ height: 100%;
280
+ cursor: pointer;
281
+ display: flex;
282
+ align-items: center;
283
+ justify-content: center;
284
+ flex-shrink: 0;
285
+ }
286
+
287
+ #search-button img {
288
+ width: 18px;
289
+ height: 18px;
290
+ }
291
+
292
+ .search-button-loading-icon {
293
+ --icon-width: 20px;
294
+ margin-top: 2px;
295
+ }
296
+ `;
297
+ return [themeStyles, ownStyles];
298
+ }
299
+ };
300
+ __decorate([
301
+ property({ type: String })
302
+ ], IADropdownSearchBar.prototype, "query", void 0);
303
+ __decorate([
304
+ property({ type: Array })
305
+ ], IADropdownSearchBar.prototype, "categories", void 0);
306
+ __decorate([
307
+ property({ type: String })
308
+ ], IADropdownSearchBar.prototype, "selectedCategory", void 0);
309
+ __decorate([
310
+ property({ type: String })
311
+ ], IADropdownSearchBar.prototype, "placeholder", void 0);
312
+ __decorate([
313
+ property({ type: Boolean })
314
+ ], IADropdownSearchBar.prototype, "useMobileView", void 0);
315
+ __decorate([
316
+ property({ type: Boolean })
317
+ ], IADropdownSearchBar.prototype, "hideDropdown", void 0);
318
+ __decorate([
319
+ property({ type: Boolean })
320
+ ], IADropdownSearchBar.prototype, "loading", void 0);
321
+ __decorate([
322
+ query('#search-input')
323
+ ], IADropdownSearchBar.prototype, "searchInput", void 0);
324
+ __decorate([
325
+ query('#category-dropdown')
326
+ ], IADropdownSearchBar.prototype, "categoryDropdown", void 0);
327
+ IADropdownSearchBar = __decorate([
328
+ customElement('ia-dropdown-search-bar')
329
+ ], IADropdownSearchBar);
330
+ export { IADropdownSearchBar };
331
+ //# sourceMappingURL=ia-dropdown-search-bar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ia-dropdown-search-bar.js","sourceRoot":"","sources":["../../../../src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,OAAO,GAGR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAKnE,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,OAAO,0CAA0C,CAAC;AAClD,OAAO,8BAA8B,CAAC;AACtC,OAAO,uDAAuD,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,GAAG;IACb,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;CACnC,CAAC;AAGK,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,UAAU;IAA5C;;QAIL,+CAA+C;QACpB,eAAU,GAAqB,EAAE,CAAC;QAK7D,4CAA4C;QAChB,gBAAW,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;QAExD,uCAAuC;QACV,kBAAa,GAAG,KAAK,CAAC;QAEnD,0EAA0E;QAC7C,iBAAY,GAAG,KAAK,CAAC;QAElD,8DAA8D;QACjC,YAAO,GAAG,KAAK,CAAC;IA6S/C,CAAC;IArSC,8EAA8E;IAC9E,IAAY,gBAAgB;QAC1B,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AAK,CAAC,eAAe,CAAC;wDACoB;AAGnC;IADP,KAAK,CAAC,oBAAoB,CAAC;6DACU;AA1B3B,mBAAmB;IAD/B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,mBAAmB,CAiU/B","sourcesContent":["import { msg } from '@lit/localize';\nimport {\n css,\n html,\n LitElement,\n nothing,\n PropertyValues,\n TemplateResult,\n} from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport type { IaClearableTextInput } from '@internetarchive/ia-clearable-text-input';\nimport type { IaDropdown, optionInterface } from '@internetarchive/ia-dropdown';\nimport type { SearchCategory, SearchRequestedDetail } from './models';\n\nimport themeStyles from '@src/themes/theme-styles';\nimport searchIcon from './search.svg';\n\nimport '@internetarchive/ia-clearable-text-input';\nimport '@internetarchive/ia-dropdown';\nimport '@src/elements/ia-status-indicator/ia-status-indicator';\n\n/**\n * Event names emitted by this component\n */\nconst Events = {\n CategoryChanged: 'categoryChanged',\n SearchRequested: 'searchRequested',\n};\n\n@customElement('ia-dropdown-search-bar')\nexport class IADropdownSearchBar extends LitElement {\n /** The query that appears in the search bar */\n @property({ type: String }) query?: string;\n\n /** Dropdown menu options (tab IDs + labels) */\n @property({ type: Array }) categories: SearchCategory[] = [];\n\n /** The currently selected dropdown category ID */\n @property({ type: String }) selectedCategory?: string;\n\n /** Placeholder text for the search input */\n @property({ type: String }) placeholder = msg('Search');\n\n /** Whether to use the mobile layout */\n @property({ type: Boolean }) useMobileView = false;\n\n /** Whether to hide the category dropdown to the left of the search bar */\n @property({ type: Boolean }) hideDropdown = false;\n\n /** Whether the search button should show its loading state */\n @property({ type: Boolean }) loading = false;\n\n @query('#search-input')\n private searchInput!: IaClearableTextInput;\n\n @query('#category-dropdown')\n private categoryDropdown?: IaDropdown;\n\n /** The effective selected category, falling back to the first in the list. */\n private get resolvedCategory(): string {\n return this.selectedCategory ?? this.categories?.[0]?.id ?? '';\n }\n\n render(): TemplateResult {\n return html`\n <div id=\"container\" part=\"container\" role=\"search\">\n <div\n id=\"main-bar\"\n part=\"main-bar\"\n class=${this.hideDropdown ? 'no-dropdown' : nothing}\n >\n ${this.hideDropdown ? nothing : this.dropdownTemplate}\n ${this.textBoxTemplate} ${this.searchButtonTemplate}\n </div>\n </div>\n `;\n }\n\n willUpdate(changed: PropertyValues) {\n // Push new categories down to the inner dropdown immediately, since ia-dropdown\n // mutates its own selected option on interaction which can cause Lit's\n // property-binding diff to miss the change in certain cases.\n if (changed.has('selectedCategory') || changed.has('categories')) {\n const resolved = this.resolvedCategory;\n if (\n this.categoryDropdown &&\n this.categoryDropdown.selectedOption !== resolved\n ) {\n this.categoryDropdown.selectedOption = resolved;\n }\n }\n }\n\n /**\n * Template for the category dropdown on the left side of the search bar.\n */\n private get dropdownTemplate(): TemplateResult {\n return html`\n <ia-dropdown\n id=\"category-dropdown\"\n part=\"category-dropdown\"\n displayCaret\n includeSelectedOption\n closeOnSelect\n closeOnEscape\n closeOnBackdropClick\n openViaButton\n .selectedOption=${this.resolvedCategory}\n .options=${this.categories}\n @optionSelected=${this.handleCategorySelected}\n >\n <span slot=\"dropdown-label\" part=\"category-dropdown-label\"\n >${this.selectedCategoryLabel}</span\n >\n </ia-dropdown>\n `;\n }\n\n /**\n * Template for the main text entry box of the search bar.\n */\n private get textBoxTemplate(): TemplateResult {\n return html`\n <ia-clearable-text-input\n id=\"search-input\"\n part=\"search-input\"\n .value=${this.spacedQuery}\n placeholder=${this.placeholder}\n clearButtonScreenReaderLabel=${msg('Clear search query')}\n screenReaderLabel=${msg(\n 'Search the Archive. Filters and Advanced Search available below.',\n )}\n @clear=${this.searchFieldCleared}\n @submit=${this.handleSubmit}\n ></ia-clearable-text-input>\n `;\n }\n\n /**\n * Template for the \"magnifying glass\" search button to the right of the search bar.\n */\n private get searchButtonTemplate(): TemplateResult {\n return html`\n <button\n id=\"search-button\"\n part=\"search-button\"\n class=${this.loading ? 'loading' : nothing}\n type=\"button\"\n aria-label=${msg('Search')}\n @click=${this.handleSubmit}\n >\n ${this.loading\n ? html`<ia-status-indicator\n mode=\"loading\"\n class=\"search-button-loading-icon\"\n ></ia-status-indicator>`\n : html`<img src=${searchIcon} alt=\"\" />`}\n </button>\n `;\n }\n\n /**\n * The display label for the currently selected category.\n */\n private get selectedCategoryLabel(): string | TemplateResult {\n const match = this.categories.find((c) => c.id === this.resolvedCategory);\n return match?.label ?? this.resolvedCategory;\n }\n\n /**\n * The current search query with +'s replaced by spaces.\n */\n private get spacedQuery(): string {\n return this.query?.replace(/\\+/g, ' ') ?? '';\n }\n\n /**\n * Handler for when the search bar's clear button is pressed.\n */\n private searchFieldCleared(): void {\n if (this.query) {\n this.emitSearchRequested();\n }\n }\n\n /**\n * Handler for Enter key or search button click.\n */\n private handleSubmit(): void {\n this.emitSearchRequested();\n }\n\n /**\n * Handler for when the user selects a category from the dropdown.\n *\n * Sets `selectedCategory` locally for immediate visual feedback (semi-controlled\n * pattern). The parent also binds this property and may re-set it on re-render.\n */\n private handleCategorySelected(\n e: CustomEvent<{ option: optionInterface }>,\n ): void {\n const newCategoryId = e.detail.option.id;\n if (newCategoryId === this.resolvedCategory) return;\n\n this.selectedCategory = newCategoryId;\n\n // On next tick, focus the text input bar (seemingly fails in Safari without the delay)\n setTimeout(() => this.searchInput.focus());\n\n this.dispatchEvent(\n new CustomEvent<string>(Events.CategoryChanged, {\n detail: newCategoryId,\n }),\n );\n }\n\n /**\n * Emits a `searchRequested` event with the current query and category.\n */\n private emitSearchRequested(): void {\n this.dispatchEvent(\n new CustomEvent<SearchRequestedDetail>(Events.SearchRequested, {\n detail: {\n query: this.searchInput.value,\n category: this.resolvedCategory,\n },\n }),\n );\n }\n\n static get styles() {\n const ownStyles = css`\n :host {\n --search-bar-height--: var(--search-bar-height, 30px);\n --search-bar-width--: var(--search-bar-width, 300px);\n --search-bar-internal-padding--: var(--padding-sm, 5px);\n --clear-button-offset--: var(--clear-button-offset, 0);\n /* While it would be nice to fall back to ia-dropdown's own default here by making this var\n fall back to \"initial\", older Safari versions don't support that keyword in a var() fallback.\n So instead we just restate ia-dropdown's current default 2 here as the fallback. */\n --dropdown-z-index--: var(--dropdown-z-index, 2);\n }\n\n #container {\n display: inline-block;\n width: var(--search-bar-width--);\n }\n\n #main-bar {\n display: flex;\n height: var(--search-bar-height--, 30px);\n flex: 1;\n }\n\n #category-dropdown {\n display: flex;\n flex-shrink: 0;\n height: 100%;\n box-sizing: border-box;\n\n background-color: #f5f5f7;\n border: 1px solid #999;\n border-radius: 5px 0 0 5px;\n\n --dropdownMainButtonPadding: 0 var(--search-bar-internal-padding--, 5px);\n --dropdownBgColor: #2c2c2c;\n --dropdownTextColor: #fff;\n --dropdownBorderColor: #ddd;\n --dropdownCaretColor: var(--ia-theme-primary-text-color, #2c2c2c);\n --dropdownHoverBgColor: rgba(255, 255, 255, 0.3);\n --dropdownHoverTextColor: #fff;\n --dropdownSelectedBgColor: rgba(255, 255, 255, 0.3);\n --dropdownSelectedTextColor: #fff;\n --dropdownWhiteSpace: nowrap;\n --dropdownOffsetTop: 2px;\n --caretHeight: 8px;\n --caretWidth: 12px;\n --caretPadding: 0 0 0 5px;\n --dropdownFontSize: inherit;\n --dropdownBorderRadius: 4px;\n --buttonSlotPaddingRight: 0;\n --dropdownTextAlign: left;\n --dropdownListZIndex: var(--dropdown-z-index--);\n }\n\n #category-dropdown [slot='dropdown-label'] {\n color: var(--ia-theme-primary-text-color, #2c2c2c);\n font-size: 1.4rem;\n font-family: inherit;\n white-space: nowrap;\n }\n\n .no-dropdown #search-input {\n border-left: 1px solid #999;\n border-radius: 5px 0 0 5px;\n overflow: hidden;\n }\n\n #search-input {\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n border-top: 1px solid #999;\n border-bottom: 1px solid #999;\n font-size: inherit;\n\n --input-height: calc(var(--search-bar-height--) - 2px);\n --input-padding: 0 var(--search-bar-internal-padding--, 5px);\n --input-background-color: var(\n --ia-theme-secondary-background-color,\n #fff\n );\n --input-border-radius: 0;\n --input-border-width: 0;\n --input-box-shadow: none;\n --input-focused-box-shadow: none;\n --input-font-size: auto;\n --clear-button-top: var(--clear-button-offset--, 0);\n --clear-button-right: 2px;\n }\n\n #search-button {\n appearance: none;\n box-sizing: border-box;\n border-radius: 0 5px 5px 0;\n background-color: var(--ia-theme-secondary-background-color, #fff);\n border: 1px solid #999;\n border-left: 0;\n padding: 0 var(--search-bar-internal-padding--, 5px) 0 5px;\n min-width: 30px;\n height: 100%;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n\n #search-button img {\n width: 18px;\n height: 18px;\n }\n\n .search-button-loading-icon {\n --icon-width: 20px;\n margin-top: 2px;\n }\n `;\n\n return [themeStyles, ownStyles];\n }\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { TemplateResult } from 'lit';
2
+ /**
3
+ * A category to include in the dropdown. Consists of an internal `id` string that is
4
+ * emitted on selection, and a human-readable `label` to display in the dropdown.
5
+ */
6
+ export type SearchCategory = {
7
+ id: string;
8
+ label: string | TemplateResult;
9
+ };
10
+ /**
11
+ * Detail object emitted with `searchRequested` events.
12
+ */
13
+ export type SearchRequestedDetail = {
14
+ query: string;
15
+ category: string;
16
+ };
17
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-dropdown-search-bar/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAErC;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,GAAG,cAAc,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/elements/ia-dropdown-search-bar/models.ts"],"names":[],"mappings":"","sourcesContent":["import { TemplateResult } from 'lit';\n\n/**\n * A category to include in the dropdown. Consists of an internal `id` string that is\n * emitted on selection, and a human-readable `label` to display in the dropdown.\n */\nexport type SearchCategory = {\n id: string;\n label: string | TemplateResult;\n};\n\n/**\n * Detail object emitted with `searchRequested` events.\n */\nexport type SearchRequestedDetail = {\n query: string;\n category: string;\n};\n"]}
@@ -0,0 +1,10 @@
1
+ <svg
2
+ viewBox="0 0 100 100"
3
+ xmlns="http://www.w3.org/2000/svg">
4
+ <path
5
+ class="fill-color"
6
+ d="m17.0555551 41.3194459c0-12.7430552 10.3541664-23.1027772 23.0847216-23.1027772 12.7166664 0 23.0777773 10.359722 23.0777773 23.1027772 0 12.7361108-10.3611109 23.0986106-23.0777773 23.0986106-12.7305552 0-23.0847216-10.3624998-23.0847216-23.0986106zm-17.24305512 0c0 22.2916661 18.04583292 40.3472213 40.32777672 40.3472213 8.9208332 0 17.145833-2.9319449 23.8194439-7.8527776l24.1513883 24.0777771c1.2125 1.1402778 2.8430555 1.8430556 4.6374999 1.8430556 3.7444443 0 6.7805554-3.0361111 6.7805554-6.7791665 0-2.0652778-.9222222-3.9069444-2.3736111-5.1499999l-23.718055-23.7458328c4.4152777-6.4791665 7.0152776-14.3055552 7.0152776-22.7402772 0-22.2791661-18.0458328-40.34861006-40.312499-40.34861006-22.2819438 0-40.32777672 18.06944396-40.32777672 40.34861006z"
7
+ fill="#2c2c2c"
8
+ fill-rule="evenodd"
9
+ />
10
+ </svg>
@@ -0,0 +1,97 @@
1
+ import { LitElement, TemplateResult, nothing, type CSSResultGroup } from 'lit';
2
+ import './ia-itemnav-menu-slider.js';
3
+ import './ia-itemnav-no-theater-available.js';
4
+ import { ToggleSideMenuOpenEvent, ToggleSidePanelOpenEvent, SetSideMenuContentsEvent, SetSideMenuShortcutsEvent, LoadingStateUpdatedEvent, ManageFullscreenEvent } from './interfaces/event-interfaces.js';
5
+ import { MenuProviderInterface, MenuShortcutInterface, MenuId } from './interfaces/menu-interfaces.js';
6
+ /**
7
+ * A fullscreen-capable frame that hosts an Archive.org item's theater. The
8
+ * consumer projects a header bar and the theater itself into the `header` and
9
+ * `main` slots; a collapsible left drawer (`ia-itemnav-menu-slider`) is driven by a
10
+ * data array of menu providers, and a minimized rail shows shortcut icons.
11
+ *
12
+ * The navigator is a shell — it does not know how to render any particular
13
+ * viewer. Menu panel bodies are opaque `TemplateResult`s supplied by the
14
+ * consumer via `menuContents`.
15
+ */
16
+ export declare class IAItemNavigator extends LitElement {
17
+ /** archive.org item identifier. */
18
+ identifier?: string;
19
+ viewAvailable: boolean;
20
+ baseHost: string;
21
+ signedIn: boolean;
22
+ menuContents: MenuProviderInterface[];
23
+ menuShortcuts: MenuShortcutInterface[];
24
+ viewportInFullscreen: boolean | null;
25
+ menuOpened: boolean;
26
+ openMenu?: MenuId;
27
+ /**
28
+ * Whether the slotted theater is ready. While false the reader stays
29
+ * hidden and the frame is empty.
30
+ *
31
+ * The navigator used to fill that gap with its own spinner, but a shell
32
+ * shouldn't decide what loading looks like — and its glyph and fullscreen
33
+ * caption were branding a consumer couldn't override. An indicator returns
34
+ * once WEBDEV-8951 moves the shared status indicators into elements, so the
35
+ * navigator can use that one instead of carrying its own.
36
+ */
37
+ loaded: boolean;
38
+ /**
39
+ * Set for the render where the drawer opens straight to a panel, so the
40
+ * panel holds still and rides in. Every other path clears it, rather
41
+ * than waiting for the drawer's `transitionend` — that never fires when
42
+ * animations are disabled, which would strand the flag on.
43
+ */
44
+ private drawerEntering;
45
+ private menuSlider;
46
+ private toggleMenuButton;
47
+ slotChange(e: Event, type: 'header' | 'main'): void;
48
+ render(): TemplateResult;
49
+ get noTheaterView(): TemplateResult;
50
+ get renderViewport(): TemplateResult | typeof nothing;
51
+ loadingStateUpdated(e: LoadingStateUpdatedEvent): void;
52
+ /** Fullscreen Management */
53
+ manageViewportFullscreen(e: ManageFullscreenEvent): void;
54
+ /** End Fullscreen Management */
55
+ /** Side menu */
56
+ get shouldRenderMenu(): boolean;
57
+ toggleMenu(forceValue?: boolean | undefined): void;
58
+ /**
59
+ * Opening the drawer moves focus into it; closing hands focus back to the
60
+ * toggle. Without this, opening from the shortcut rail would leave focus on
61
+ * a button that is about to be hidden, dropping it to the document.
62
+ */
63
+ private moveFocusForDrawer;
64
+ /**
65
+ * Closing the drawer also closes whatever panel was open inside it, so the
66
+ * two can't disagree and a stale panel can't reappear on the next open.
67
+ */
68
+ closeMenu(): void;
69
+ setOpenMenu(e: ToggleSidePanelOpenEvent): void;
70
+ /**
71
+ * Clears the open channel when the slider closes its sub-panel, without
72
+ * closing the drawer. Keeps `openMenu` in sync with the slider so the same
73
+ * channel can be reopened afterwards.
74
+ */
75
+ closeSidePanel(): void;
76
+ setMenuContents(e: SetSideMenuContentsEvent): void;
77
+ setMenuShortcuts(e: SetSideMenuShortcutsEvent): void;
78
+ /** Toggles Side Menu & Sets viewable subpanel */
79
+ manageSideMenuEvents(e: ToggleSideMenuOpenEvent): void;
80
+ get menuToggleButton(): TemplateResult;
81
+ get selectedMenuId(): MenuId | '';
82
+ get renderSideMenu(): TemplateResult;
83
+ /** End Side menu */
84
+ /** Menu Shortcuts */
85
+ openShortcut(selectedMenuId?: MenuId): void;
86
+ get shortcuts(): TemplateResult;
87
+ /** End Menu Shortcuts */
88
+ /** Misc Render */
89
+ get menuClass(): string;
90
+ static get styles(): CSSResultGroup;
91
+ }
92
+ declare global {
93
+ interface HTMLElementTagNameMap {
94
+ 'ia-item-navigator': IAItemNavigator;
95
+ }
96
+ }
97
+ //# sourceMappingURL=ia-item-navigator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ia-item-navigator.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-item-navigator/ia-item-navigator.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,cAAc,EACd,OAAO,EACP,KAAK,cAAc,EACpB,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