@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
package/README.md ADDED
@@ -0,0 +1,417 @@
1
+ # 📚 _elements_ 🏛️
2
+
3
+ ## Demo
4
+
5
+ <https://internetarchive.github.io/elements>
6
+
7
+ ## Installation
8
+
9
+ ```zsh
10
+ npm i -S @internetarchive/elements
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```typescript
16
+ import "@internetarchive/elements/ia-button/ia-button";
17
+
18
+ ...
19
+
20
+ <ia-button @click=() => alert('Clicked!')>Click Me</ia-button>
21
+ ```
22
+
23
+ ## Build Dependencies
24
+
25
+ We use SVGs in this repo, which not all build systems support out of the box. Here's how to support SVGs:
26
+
27
+ ### Webpack
28
+
29
+ Add this to your Webpack config:
30
+
31
+ ```json
32
+ module: {
33
+ rules: [
34
+ {
35
+ test: /\.svg/,
36
+ type: 'asset/resource',
37
+ },
38
+ ],
39
+ },
40
+ ```
41
+
42
+ ### @web/test-runner
43
+
44
+ Install rollup image plugins:
45
+
46
+ ```shell
47
+ npm i -D @rollup/plugin-image @web/dev-server-rollup
48
+ ```
49
+
50
+ Update config:
51
+
52
+ ```js
53
+ import rollupImage from '@rollup/plugin-image';
54
+ import { rollupAdapter } from '@web/dev-server-rollup';
55
+
56
+ export default ({
57
+ mimeTypes: {
58
+ '**/*.scss': 'js',
59
+ '**/*.css': 'js',
60
+ '**/*.svg': 'js',
61
+ '**/*.json': 'js',
62
+ },
63
+ plugins: [rollupAdapter(rollupImage())],
64
+ })
65
+ ```
66
+
67
+ ### Jest
68
+
69
+ Create `SVGMock` file, ie `tests/jest/mocks/svg.js`
70
+
71
+ ```js
72
+ /**
73
+ * Mock for SVG imports in Jest tests.
74
+ */
75
+ export class SVGMock {}
76
+ ```
77
+
78
+ Add to Jest config:
79
+
80
+ ```json
81
+ "jest": {
82
+ "moduleNameMapper": {
83
+ "\\.svg$": "<rootDir>/tests/jest/mocks/svg.js",
84
+ },
85
+ }
86
+ ```
87
+
88
+ ## Development
89
+
90
+ Requires Node 24+ and pnpm 11+. `engine-strict=true` in `.npmrc` makes an older
91
+ Node fail the install instead of warning, but nothing hard-blocks `npm install`:
92
+ npm ignores `engines.pnpm`, and there's deliberately no preinstall guard since it
93
+ would run for consumers too. Use pnpm. `packageManager` and the committed
94
+ `pnpm-lock.yaml` are what point you at it.
95
+
96
+ ```zsh
97
+ pnpm install
98
+ pnpm run dev
99
+ ```
100
+
101
+ ## Versioning and Publishing
102
+
103
+ ### Prerelease Version
104
+
105
+ 1. Create prerelease version on your branch:
106
+ 1. `pnpm version prerelease --preid=<some_prefix>`
107
+ 2. If you use JIRA, recommend using the ticket number, ie `--preid=webdev-1234`
108
+ 3. This will also create a `git` tag
109
+ 2. Push the tag that was created in the `pnpm version` step
110
+ 3. Publish prerelease to npm:
111
+ 1. Go to the [Element release page](https://github.com/internetarchive/elements/releases)
112
+ 2. Tap `Draft a new release` button
113
+ 3. Select the tag you created
114
+ 4. Tap `Generate release notes`
115
+ 5. Select `Set as a pre-release`
116
+ 6. Tap `Publish release`
117
+
118
+ ### Release Version
119
+
120
+ 1. Use [Semantic Versioning](https://semver.org) to determine release number
121
+ 2. On the `main` branch:
122
+ 1. Run `pnpm version [major | minor | patch]`
123
+ 2. `git push && git push --tags`
124
+ 3. Publish release to npm:
125
+ 1. Go to the [Element release page](https://github.com/internetarchive/elements/releases)
126
+ 2. Tap `Draft a new release` button
127
+ 3. Select the tag you created
128
+ 4. Tap `Generate release notes`
129
+ 5. Select `Set as the latest release`
130
+ 6. Tap `Publish release`
131
+
132
+ ## Adding a Component
133
+
134
+ ### Structure
135
+ Each component has its own directory in `src/elements` (or `src/labs` if it's still in development). The basic structure looks like this, though components can have additional files and directories if needed. Take a look at other elements to see what they each contain.
136
+ ```
137
+ src
138
+ - elements
139
+ - ia-foobar // the name of the element
140
+ - ia-foobar.ts // the main element class
141
+ - ia-foobar.test.ts // the element's tests
142
+ - ia-foobar-story.ts // an element that demos your element
143
+ ```
144
+ Export your component in `src/index.ts`
145
+
146
+ ### Naming
147
+ Custom elements all share one global registry, and that registry is shared with every other script on the host page. Give each element a name specific enough that nothing else would plausibly want it.
148
+
149
+ If a component is built from several elements, prefix its parts with the component's own name rather than naming them generically, and keep the file name matching the tag:
150
+ ```
151
+ src
152
+ - elements
153
+ - ia-foobar
154
+ - ia-foobar.ts // ia-foobar
155
+ - ia-foobar-list-item.ts // ia-foobar-list-item, not ia-list-item
156
+ ```
157
+ Declare each element in `HTMLElementTagNameMap` so `querySelector` is typed and a mistyped tag in a template is caught at build time:
158
+ ```ts
159
+ declare global {
160
+ interface HTMLElementTagNameMap {
161
+ 'ia-foobar-list-item': IAFoobarListItem;
162
+ }
163
+ }
164
+ ```
165
+
166
+ ### Story
167
+ To demo your component, we have a component catalog that you can add your demo to. Create a component in your component directory. Name it `COMPONENT-NAME-story.ts`, ie `ia-button-story.ts`.
168
+
169
+ We have a story template you can use for consistency. [More info on `story-template`](#story-template). The easiest way to use this is to copy an existing story and modify it for your needs.
170
+
171
+ Your story will be discovered by `/demo/app-root.ts` and added to the page.
172
+
173
+ #### Story Template<a id="story-template"></a>
174
+
175
+ The story template is a component you can use in your story to demo your component. This lets us present them in a consistent way.
176
+
177
+ It has a few main configurations:
178
+
179
+ *Properties*
180
+ - `elementTag` (_string_) your component's name, ie `ia-button`
181
+ - `labs` (_boolean_) if your component is in `labs` to update links
182
+ - `styleInputSettings` (_StyleInputSettings array_) the style options to display, in the appropriate format
183
+ - `propInputSettings` (_PropInputSettings array_) the prop options to display, in the appropriate format
184
+
185
+ **Note:** If the type of prop input you want to use isn't yet available in the `propInputSettings` options,
186
+ you can instead slot in custom property settings by using `slot="settings"`, adding a button to apply the
187
+ properties, and passing in a `customExampleUsage` (see `ia-snow-story.ts` for a sample implementation).
188
+
189
+ *Slots*
190
+ - `demo` put your component demo in here
191
+
192
+ Here's an example:
193
+ ```typescript
194
+ import '@demo/story-template';
195
+
196
+ // Style options to display
197
+ const styleInputSettings: StyleInputSettings[] = [
198
+ {
199
+ label: 'Button BG color',
200
+ cssVariable: '--button-background-color',
201
+ defaultValue: 'blue', // Should match the actual fallback value for the variable
202
+ inputType: 'color',
203
+ },
204
+ ];
205
+
206
+ // Prop options to display
207
+ const propInputSettings: PropInputSettings[] = [
208
+ {
209
+ label: 'Mode',
210
+ inputType: 'radio',
211
+ propertyName: 'mode', // Should match the name of the property from its @property() declaration
212
+ radioOptions: ['primary', 'secondary', 'danger'],
213
+ defaultValue: 'primary', // Should match the actual default value from the @property() declaration, if any
214
+ },
215
+ ]
216
+ ...
217
+ render() {
218
+ return html`
219
+ <story-template
220
+ elementTag="ia-button"
221
+ elementClassName="IAButton"
222
+ .styleInputData=${{settings: this.styleInputSettings}}
223
+ .propInputData=${{settings: this.propInputSettings}}
224
+ >
225
+ <div slot="demo">
226
+ <ia-button @click=${() => alert('Button clicked!')}>
227
+ Click Me
228
+ </ia-button>
229
+ </div>
230
+ </story-template>
231
+ `;
232
+ }
233
+ ```
234
+
235
+ ### Styling
236
+
237
+ For styling, our components use a series of rational CSS variable fallbacks to ensure:
238
+ 1. All components render out of the box with reasonable defaults for colors, sizing, etc.
239
+ 2. Customizable styles can be adjusted by the consumer by setting a CSS variable at the component or global level
240
+ 3. The available variables are easy to find in the component file and visible in the story
241
+
242
+ #### Setting up styles
243
+
244
+ 1. In the component's CSS, include the elements-wide `themeStyles` defaults
245
+ ```
246
+ import themeStyles from '@src/themes/theme-styles';
247
+ ...
248
+ static get styles(): CSSResultGroup {
249
+ return [
250
+ themeStyles,
251
+ css`
252
+ ```
253
+ 2. Check the theme styles to see if an existing theme variable exists you can use as a default, i.e. for an error message color you could use `--color-danger` if no variable exists but the style you want seems fairly reusable, see [Creating a new theme style](#creating-a-new-theme-style) below. If the variable is _not_ reusable, see [Non-reusable styles](#non-reusable-styles) below.
254
+ 3. In the component, create a private CSS variable in the top-level `:host` section to make your chosen variable obvious to consumers, and then use this private variable wherever you need the value
255
+ ```
256
+ css`
257
+ :host {
258
+ --color-danger--: var(--color-danger);
259
+ }
260
+
261
+ .error-msg {
262
+ color: var(--color-danger--);
263
+ ```
264
+ 4. In the component's story, add the variable you chose in its full `ia-theme-` form, with its default fallback value, to the story `styleInputData`
265
+ ```
266
+ const styleInputSettings: StyleInputSettings[] = [
267
+ {
268
+ label: 'Error color',
269
+ cssVariable: '--ia-theme-color-danger',
270
+ defaultValue: '#e51c23',
271
+ inputType: 'color',
272
+ },
273
+ ```
274
+
275
+ #### Creating a new theme style
276
+ While working on a component, you may realize that a customizable style you need doesn't already have an associated variable in `theme-styles.ts`. If this happens, you can follow the following steps to add one:
277
+ 1. Select a rational default value for the style, and add it to the defaults section at the top of the file:
278
+ ```
279
+ --default-font-size-xs: 0.625rem /* 10px with 16px root font size */
280
+ ```
281
+ 2. Name the variable and add it to the adjustable styles list with the following structure:
282
+ ```
283
+ --font-size-xs: var(--ia-theme-font-size-xs, var(--default-font-size-xs));
284
+ ```
285
+ 3. Use the variable as needed in your component and its story, following the steps in the [Setting up styles](#setting-up-styles) section
286
+
287
+ #### Non-reusable styles
288
+
289
+ If you have a variable that you want to make customizable but you're sure is only applicable for this component and wouldn't be of use elsewhere, you can add it as a private variable to `:host`, setting an explicit fallback within the component and prefixing it with the component to avoid variable overlap.
290
+ ```
291
+ --my-component-max-height--: var(--my-component-max-height, 250px);
292
+ ```
293
+
294
+ #### Other styles
295
+
296
+ For any styles that you won't be exposing to consumers via the story, you can proceed as usual, but we recommend adding a named `part` to areas of the component, such as nested elements, you imagine someone may want to further style directly.
297
+ ```
298
+ <div class="indicator">
299
+ <ia-status-indicator
300
+ part="status-indicator"
301
+ .mode=${this.validationStatus}
302
+ ></ia-status-indicator>
303
+ </div>
304
+ ```
305
+
306
+ ## Component Inventory
307
+
308
+ To kickstart our library, we are going to take inventory of what already exists
309
+ and can be ported, repurposed, or deprecated in favor of the single, common solution
310
+ we are building here.
311
+
312
+ Below is a list of Lit web components that developers across the Internet Archive
313
+ have built thus far for their respective teams.
314
+
315
+ ### Button
316
+
317
+ - __ads-button__ - 3 varieties, a few CSS params, and borderless styles. [@jeffwklein][jeffwklein]
318
+ [(link)](https://github.com/internetarchive/ads-common/blob/d1dbdd0b137b54b871f1ed41a54e4256af2abaee/packages/ads-button/src/ads-button.ts)
319
+ - __ia-button__ - Many CSS-based style variations, plus loading and disabled state support, including optional custom loading message. Point: [@rebecca-shoptaw][rebecca-shoptaw]. [(link)](https://git.archive.org/www/offshoot/-/blob/main/src/widgets/ia-button.ts)
320
+
321
+ ### Table
322
+
323
+ - __ads-table__ - Sortable columns, arrow key navigation, and
324
+ multiselect support. [@jeffwklein][jeffwklein]
325
+ [(link)](https://github.com/internetarchive/ads-common/blob/d1dbdd0b137b54b871f1ed41a54e4256af2abaee/packages/ads-table/src/ads-table.ts)
326
+
327
+ ### Modal
328
+
329
+ - __modal-element (vault)__ - Latest modal for ADS, globally in use on Vault site. (ignore ads-modal) [@jeffwklein][jeffwklein]
330
+ [(link)](https://git.archive.org/dps/vault-site/-/blob/fe99de1d53c62f426b1d6b70cc100321d651a9aa/frontend/src/modals/generic-modal.ts#L58)
331
+ - __iaux-modal-manager__ - Finicky but powerful modal manager with a number of config options. Point: likely [@latonv][latonv]. [(link)](https://github.com/internetarchive/iaux-modal-manager)
332
+
333
+ ### Tree
334
+
335
+ - __ads-tree (vault)__ - Basic tree component, CSS animation arrow rotation on folder expansion,
336
+ powers Vault file explorer, has material-UI icon dependency. [@jeffwklein][jeffwklein]
337
+ [(link)](https://git.archive.org/dps/vault-site/-/blob/fe99de1d53c62f426b1d6b70cc100321d651a9aa/frontend/src/web-components/ads-tree.ts)
338
+
339
+ ### Card
340
+
341
+ - __ads-card (vault)__ - Very basic card component, in use in Vault a couple places. [@jeffwklein][jeffwklein]
342
+ [(link)](https://git.archive.org/dps/vault-site/-/blob/fe99de1d53c62f426b1d6b70cc100321d651a9aa/frontend/src/web-components/ads-card.ts)
343
+ - __ia-image-card__ - Simple component to display an image as a card, with an optional overlay color, hover-title, and on-click link. Used by various custom collections such as [Democracy's Library](https://archive.org/details/democracys-library). Point: [@rebecca-shoptaw][rebecca-shoptaw]. [(link)](https://git.archive.org/www/offshoot/-/blob/main/src/widgets/ia-image-card.ts)
344
+
345
+ ### Toggle Switch
346
+
347
+ - __ads-toggle-switch (vault)__ - Nice toggle switch with CSS animation moving toggle back and forth. [@jeffwklein][jeffwklein]
348
+ [(link)](https://git.archive.org/dps/vault-site/-/blob/fe99de1d53c62f426b1d6b70cc100321d651a9aa/frontend/src/web-components/ads-toggle-switch.ts)
349
+ - __toggle-switch (UX team)__ - Toggle switch with screen-reader support and a lot of CSS customization options. Point: [@latonv][latonv] & [@nsharma123][nsharma123]. [(link)](https://git.archive.org/www/offshoot/-/blob/main/src/widgets/toggle-switch.ts)
350
+ - __ia-password-toggle__ - Intended for password inputs but definitely extensible, renders an eye open/closed icon that switches the type of any input passed in from `text` to `password` and back. Point: [@rebecca-shoptaw][rebecca-shoptaw]. [(link)](https://git.archive.org/www/offshoot/-/blob/main/src/widgets/ia-password-toggle.ts)
351
+
352
+ ### Icons
353
+
354
+ - Vault ([@jeffwklein][jeffwklein]) uses [material-web](https://github.com/material-components/material-web)'s `md-icon` font-based icon system. This project is
355
+ unfor tunately in maintenance mode, but it nevertheless works well for Lit 3.
356
+ - __ia-icon__ - Icon designed to remove need for CSS-filtering, inherits current color by default and can inherit custom color via `color: ` or CSS variable. Point: [@rebecca-shoptaw][rebecca-shoptaw]. [(link)](https://git.archive.org/www/offshoot/-/blob/main/src/widgets/ia-icon.ts)
357
+ - __iaux-icons__ - Icon monorepo that also exports an `ia-icon`. Hopefully the `ia-icon` above can be folded into this one either by adding both to the library or using a library-hosted component within the icons repo. Point: [@iisa][iisa] & [@jbuckner][jbuckner]? [(link)](https://github.com/internetarchive/iaux-icons)
358
+ - __ia-icons__ - Another icon repo, this one with separate widgets for individual icons, i.e. `ia-icon-video`. Hopefully all three icon implementations here can be somehow standardized/combined in the new world. Point: [@traceypooh][traceypooh]. [(link)](https://github.com/internetarchive/ia-icons)
359
+
360
+ ### Library (non-rendering)
361
+
362
+ - __ads-library__ - Includes: Helpful `fetch()` abstraction, data formatters, event abstractions,
363
+ a place for common code dependencies within the broader component library. [@jeffwklein][jeffwklein]
364
+ [(link)](https://github.com/internetarchive/ads-common/tree/d1dbdd0b137b54b871f1ed41a54e4256af2abaee/packages/ads-library/src)
365
+
366
+ ### Carousel
367
+
368
+ - __basic-carousel (UX team)__ - Transforms any slotted content into a fully functioning carousel, including nav button showing/hiding, pagination-style-snapping, and custom arrow BG colors. Point: [@rebecca-shoptaw][rebecca-shoptaw]. [(link)](https://git.archive.org/www/offshoot/-/blob/main/src/widgets/basic-carousel.ts)
369
+
370
+ ### Divider
371
+
372
+ - __ia-text-divider__ - Lightweight component to handle styling/rendering for the big ---OR--- divider used on i.e. the account settings page, can use custom text instead of `OR` if desired. Point: [@rebecca-shoptaw][rebecca-shoptaw]. [(link)](https://git.archive.org/www/offshoot/-/blob/main/src/widgets/ia-text-divider.ts?ref_type=heads)
373
+
374
+ ### Banner
375
+
376
+ - __alert-banner (UX team)__ - Straightforward banner component with 3 urgency levels and an optional close button. Point: [@jbuckner][jbuckner]. [(link)](https://git.archive.org/www/offshoot/-/commits/main/src/widgets/alert-banner.ts)
377
+
378
+ ### Input
379
+
380
+ - __ia-otp-input (UX team)__ - Complex little component to handle rendering a 6-box OTP input. Autofocuses first input, hops between inputs, supports pasting, autocomplete, a custom number of boxes and a custom allowed-characters regex (defaults to numeric-only). Used i.e. in the `Email me a code` modal on the [account settings](https://archive.org/account/settings) page. Point: [@rebecca-shoptaw][rebecca-shoptaw]. [(link)](https://git.archive.org/www/offshoot/-/blob/main/src/widgets/otp/ia-otp-input.ts)
381
+ - __ia-clearable-text-input__ - Text input with a clear button and substantial a11y support. Point: [@latonv][latonv]. [(link)](https://github.com/internetarchive/iaux-clearable-text-input/blob/main/src/ia-clearable-text-input.ts)
382
+
383
+ ### Menu
384
+
385
+ - __ia-dropdown__ - Supports various customized dropdown menu use cases. Point: [@latonv][latonv]. [(link)](https://github.com/internetarchive/iaux-dropdown)
386
+
387
+ ### Infinite Scroller
388
+
389
+ - __infinite-scroller (UX team)__ - Supports virtualized buffered scrolling of large lists. Point: [@latonv][latonv]. [(link)](https://github.com/internetarchive/iaux-infinite-scroller)
390
+
391
+ ### Histogram
392
+
393
+ - __collection-histogram (UX team)__ - Histogram component, only used on collection pages at the moment, but the component is fairly general already. Point: [@latonv][latonv]. [(link)](https://git.archive.org/www/offshoot/-/blob/main/src/scenes/collection-page/components/histograms/collection-histogram.ts)
394
+ - __histogram-date-range (UX team)__ - Date range component for histogram, which we might explore consolidating with the above. Point: [@latonv][latonv]. [(link)](https://github.com/internetarchive/iaux-histogram-date-range)
395
+
396
+ ### Activity Indicator
397
+
398
+ - __ia-activity-indicator__ - SVG-based circular activity indicator with two mode options, used in `ia-button` and throughout site. Point: [@jbuckner][jbuckner]. [(link)](https://github.com/internetarchive/iaux/blob/master/packages/ia-activity-indicator/src/ia-activity-indicator.ts)
399
+ - __circular-activity-indicator (UX team)__ - Variation on the IA activity indicator with CSS variable customization. Point: [@jbuckner][jbuckner]. [(link)](https://git.archive.org/www/offshoot/-/blob/main/src/widgets/activity-indicators/circular-activity-indicator.ts)
400
+ - __horizontal-activity-indicator (UX team)__ - Horizontal page-wide activity indicator, relies on the `sharedResizeObserver` which we'd need to convert and generalize as well. Point: [@jbuckner][jbuckner]. [(link)](https://git.archive.org/www/offshoot/-/blob/main/src/widgets/activity-indicators/horizontal-activity-indicator.ts)
401
+
402
+ ### Responsiveness Helpers
403
+
404
+ - __SharedResizeObserver__ - Could be made into a more declarative component similar to [what Shoelace has done](https://shoelace.style/components/resize-observer). I.e., the component itself manages attaching/detaching the shared observer instance from its slotted children as part of its lifecycle, so that we don't have to repeat that logic all over our other components. Used by horizontal activity indicator and carousel. Point: [@latonv][latonv]. [(link)](https://github.com/internetarchive/iaux-shared-resize-observer)
405
+
406
+ ### Accessibility Helpers
407
+
408
+ - __ia-sronly__ - Importable CSS class to quickly style screen-reader-only text. Point: [@nsharma123][nsharma123]. [(link)](https://github.com/internetarchive/iaux/blob/master/packages/ia-styles/src/ia-sronly.ts)
409
+
410
+ <!-- URLs for GitHub @s, in alphabetical order -->
411
+ [iisa]: https://github.com/iisa
412
+ [jbuckner]: https://github.com/jbuckner
413
+ [jeffwklein]: https://github.com/jeffwklein
414
+ [latonv]: https://github.com/latonv
415
+ [nsharma123]: https://github.com/nsharma123s
416
+ [rebecca-shoptaw]: https://github.com/rebecca-shoptaw
417
+ [traceypooh]: https://github.com/traceypooh
@@ -0,0 +1,47 @@
1
+ import { LitElement, TemplateResult, CSSResultGroup, PropertyValues } from 'lit';
2
+ import '../ia-status-indicator/ia-status-indicator.js';
3
+ /**
4
+ * Renders a standardized button built off the ia-button styling and the activity indicator, with the option to show
5
+ * a loading indicator instead of the text or to customize the text, and the ability to pass in any
6
+ * function to run on click.
7
+ *
8
+ * Designed to behave exactly like a native type="submit" or type="reset" button if either type is supplied,
9
+ * i.e. for an <ia-button type="submit" @click=${doSideEffects}></ia-button>,
10
+ * whether the form is submitted via enter or by clicking the button directly, the button will always
11
+ * run doSideEffects() and then submit the form.
12
+ */
13
+ export declare class IAButton extends LitElement {
14
+ mode: 'primary' | 'secondary' | 'danger' | 'warning' | 'disabled' | 'transparent' | 'custom' | 'link' | 'danger-link';
15
+ loading: boolean;
16
+ disabled: boolean;
17
+ loadingText: string;
18
+ type: 'button' | 'submit' | 'reset';
19
+ href?: string;
20
+ openLinksNewTab: boolean;
21
+ render(): TemplateResult;
22
+ protected willUpdate(changed: PropertyValues): void;
23
+ private get buttonTemplate();
24
+ private get buttonTextTemplate();
25
+ private get loadingStateTemplate();
26
+ /** Sets up or removes button type emulation as needed */
27
+ private setButtonTypeEmulation;
28
+ /**
29
+ * Triggers form actions (submit/reset) on click, if desired
30
+ * and if actions not already in progress
31
+ */
32
+ private handleComponentClick;
33
+ /**
34
+ * Adds a hidden button to the light DOM to
35
+ * emulate native reset/submit button behavior.
36
+ *
37
+ * Used for:
38
+ * - Submitting/resetting the form (on behalf of handleComponentClick)
39
+ * - Activating any component click events if form is submitted with the enter key
40
+ * (via handleFormActions)
41
+ */
42
+ private addHiddenButton;
43
+ /** Triggers the component's click event manually to prevent extra submission/reset */
44
+ private handleFormActions;
45
+ static get styles(): CSSResultGroup;
46
+ }
47
+ //# sourceMappingURL=ia-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ia-button.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-button/ia-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,cAAc,EACd,cAAc,EAEd,cAAc,EAEf,MAAM,KAAK,CAAC;AAKb,OAAO,4CAA4C,CAAC;AAEpD;;;;;;;;;GASG;AACH,qBACa,QAAS,SAAQ,UAAU;IAEV,IAAI,EAC5B,SAAS,GACT,WAAW,GACX,QAAQ,GACR,SAAS,GACT,UAAU,GACV,aAAa,GACb,QAAQ,GACR,MAAM,GACN,aAAa,CAAa;IAGD,OAAO,EAAE,OAAO,CAAS;IAGzB,QAAQ,EAAE,OAAO,CAAS;IAG3B,WAAW,EAAE,MAAM,CAAM;IAGV,IAAI,EAC3C,QAAQ,GACR,QAAQ,GACR,OAAO,CAAY;IAGK,IAAI,CAAC,EAAE,MAAM,CAAC;IAGb,eAAe,EAAE,OAAO,CAAS;IAE9D,MAAM,IAAI,cAAc;IAaxB,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAOnD,OAAO,KAAK,cAAc,GAUzB;IAGD,OAAO,KAAK,kBAAkB,GAE7B;IAGD,OAAO,KAAK,oBAAoB,GAQ/B;IAED,yDAAyD;IACzD,OAAO,CAAC,sBAAsB;IAc9B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;;;;;;;OAQG;IACH,OAAO,CAAC,eAAe;IAevB,sFAAsF;IACtF,OAAO,CAAC,iBAAiB;IAwBzB,MAAM,KAAK,MAAM,IAAI,cAAc,CAkNlC;CACF"}