@internetarchive/elements 0.2.1-webdev-8162.0 → 0.2.1-webdev-8777.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.
- package/README.md +208 -30
- package/dist/src/elements/ia-button/ia-button.d.ts +41 -3
- package/dist/src/elements/ia-button/ia-button.d.ts.map +1 -1
- package/dist/src/elements/ia-button/ia-button.js +350 -11
- package/dist/src/elements/ia-button/ia-button.js.map +1 -1
- package/dist/src/elements/ia-combo-box/ia-combo-box.d.ts +4 -4
- package/dist/src/elements/ia-combo-box/ia-combo-box.d.ts.map +1 -1
- package/dist/src/elements/ia-combo-box/ia-combo-box.js +21 -13
- package/dist/src/elements/ia-combo-box/ia-combo-box.js.map +1 -1
- package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.d.ts +68 -0
- package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.d.ts.map +1 -0
- package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.js +328 -0
- package/dist/src/elements/ia-dropdown-search-bar/ia-dropdown-search-bar.js.map +1 -0
- package/dist/src/elements/ia-dropdown-search-bar/models.d.ts +17 -0
- package/dist/src/elements/ia-dropdown-search-bar/models.d.ts.map +1 -0
- package/dist/src/elements/ia-dropdown-search-bar/models.js +2 -0
- package/dist/src/elements/ia-dropdown-search-bar/models.js.map +1 -0
- package/dist/src/elements/ia-dropdown-search-bar/search.svg +10 -0
- package/dist/src/elements/ia-otp-form/ia-otp-form.d.ts +21 -0
- package/dist/src/elements/ia-otp-form/ia-otp-form.d.ts.map +1 -0
- package/dist/src/elements/ia-otp-form/ia-otp-form.js +157 -0
- package/dist/src/elements/ia-otp-form/ia-otp-form.js.map +1 -0
- package/dist/src/elements/ia-otp-input/ia-otp-input.d.ts +35 -0
- package/dist/src/elements/ia-otp-input/ia-otp-input.d.ts.map +1 -0
- package/dist/src/elements/ia-otp-input/ia-otp-input.js +217 -0
- package/dist/src/elements/ia-otp-input/ia-otp-input.js.map +1 -0
- package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.d.ts +10 -0
- package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.d.ts.map +1 -0
- package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.js +43 -0
- package/dist/src/elements/ia-sr-only-text/ia-sr-only-text.js.map +1 -0
- package/dist/src/elements/ia-status-indicator/ia-status-indicator.d.ts +4 -1
- package/dist/src/elements/ia-status-indicator/ia-status-indicator.d.ts.map +1 -1
- package/dist/src/elements/ia-status-indicator/ia-status-indicator.js +10 -1
- package/dist/src/elements/ia-status-indicator/ia-status-indicator.js.map +1 -1
- package/dist/src/elements/index.d.ts +3 -2
- package/dist/src/elements/index.d.ts.map +1 -1
- package/dist/src/elements/index.js +3 -2
- package/dist/src/elements/index.js.map +1 -1
- package/dist/src/labs/ia-snow/ia-snow.js +3 -3
- package/dist/src/themes/theme-styles.d.ts.map +1 -1
- package/dist/src/themes/theme-styles.js +94 -0
- package/dist/src/themes/theme-styles.js.map +1 -1
- package/package.json +5 -3
|
@@ -1,36 +1,375 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { css,
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import { html, LitElement, css, render, } from 'lit';
|
|
3
|
+
import { msg } from '@lit/localize';
|
|
4
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
5
|
+
import themeStyles from '../../themes/theme-styles.js';
|
|
6
|
+
import '../ia-status-indicator/ia-status-indicator.js';
|
|
5
7
|
/**
|
|
6
|
-
*
|
|
8
|
+
* Renders a standardized button built off the ia-button styling and the activity indicator, with the option to show
|
|
9
|
+
* a loading indicator instead of the text or to customize the text, and the ability to pass in any
|
|
10
|
+
* function to run on click.
|
|
11
|
+
*
|
|
12
|
+
* Designed to behave exactly like a native type="submit" or type="reset" button if either type is supplied,
|
|
13
|
+
* i.e. for an <ia-button type="submit" @click=${doSideEffects}></ia-button>,
|
|
14
|
+
* whether the form is submitted via enter or by clicking the button directly, the button will always
|
|
15
|
+
* run doSideEffects() and then submit the form.
|
|
7
16
|
*/
|
|
8
17
|
let IAButton = class IAButton extends LitElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
/* Which version of the button to display */
|
|
21
|
+
this.mode = 'primary';
|
|
22
|
+
/* Whether to show a loading indicator instead of the button */
|
|
23
|
+
this.loading = false;
|
|
24
|
+
/* Whether the button should be disabled, regardless of submission status */
|
|
25
|
+
this.disabled = false;
|
|
26
|
+
/* Optional text to include next to the loading indicator */
|
|
27
|
+
this.loadingText = '';
|
|
28
|
+
/* Type of the button - defaults to 'button' to prevent form submission */
|
|
29
|
+
this.type = 'button';
|
|
30
|
+
/* Whether to add a target="_blank" to any wrapping link */
|
|
31
|
+
this.openLinksNewTab = false;
|
|
32
|
+
}
|
|
9
33
|
render() {
|
|
10
34
|
return html `
|
|
11
|
-
|
|
12
|
-
|
|
35
|
+
${this.href
|
|
36
|
+
? html `<a
|
|
37
|
+
href=${this.href}
|
|
38
|
+
target=${this.openLinksNewTab ? '_blank' : '_self'}
|
|
39
|
+
>${this.buttonTemplate}</a
|
|
40
|
+
>`
|
|
41
|
+
: this.buttonTemplate}
|
|
42
|
+
<slot name="hidden-button"></slot>
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
willUpdate(changed) {
|
|
46
|
+
if (changed.has('type')) {
|
|
47
|
+
this.setButtonTypeEmulation();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/* The native button to render */
|
|
51
|
+
get buttonTemplate() {
|
|
52
|
+
return html `
|
|
53
|
+
<button
|
|
54
|
+
part="button"
|
|
55
|
+
class=${this.mode}
|
|
56
|
+
?disabled=${this.disabled || this.loading}
|
|
57
|
+
>
|
|
58
|
+
${this.buttonTextTemplate}
|
|
13
59
|
</button>
|
|
14
60
|
`;
|
|
15
61
|
}
|
|
62
|
+
/* The text to render within the button */
|
|
63
|
+
get buttonTextTemplate() {
|
|
64
|
+
return this.loading ? this.loadingStateTemplate : html `<slot></slot>`;
|
|
65
|
+
}
|
|
66
|
+
/* Content to render while button is loading */
|
|
67
|
+
get loadingStateTemplate() {
|
|
68
|
+
return html `
|
|
69
|
+
<span class="loading-indicator" alt="Loading indicator">
|
|
70
|
+
<ia-status-indicator mode="loading"></ia-status-indicator> ${msg(this.loadingText)}
|
|
71
|
+
</span>
|
|
72
|
+
`;
|
|
73
|
+
}
|
|
74
|
+
/** Sets up or removes button type emulation as needed */
|
|
75
|
+
setButtonTypeEmulation() {
|
|
76
|
+
const hiddenButton = this.querySelector('input.hidden-button');
|
|
77
|
+
if (hiddenButton) {
|
|
78
|
+
hiddenButton.type = this.type;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this.addHiddenButton();
|
|
82
|
+
this.addEventListener('click', this.handleComponentClick);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Triggers form actions (submit/reset) on click, if desired
|
|
86
|
+
* and if actions not already in progress
|
|
87
|
+
*/
|
|
88
|
+
handleComponentClick(e) {
|
|
89
|
+
if (this.type === 'button')
|
|
90
|
+
return;
|
|
91
|
+
// No need to submit/reset the form if it's already submitting/resetting
|
|
92
|
+
const formActionsInProgress = e instanceof CustomEvent && e.detail.formActionsInProgress;
|
|
93
|
+
if (formActionsInProgress)
|
|
94
|
+
return;
|
|
95
|
+
// Request form submission/reset by clicking the hidden native submit/reset button we added earlier
|
|
96
|
+
const hiddenButton = this.querySelector('input.hidden-button');
|
|
97
|
+
hiddenButton.dispatchEvent(new PointerEvent('click'));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Adds a hidden button to the light DOM to
|
|
101
|
+
* emulate native reset/submit button behavior.
|
|
102
|
+
*
|
|
103
|
+
* Used for:
|
|
104
|
+
* - Submitting/resetting the form (on behalf of handleComponentClick)
|
|
105
|
+
* - Activating any component click events if form is submitted with the enter key
|
|
106
|
+
* (via handleFormActions)
|
|
107
|
+
*/
|
|
108
|
+
addHiddenButton() {
|
|
109
|
+
if (this.type === 'button')
|
|
110
|
+
return;
|
|
111
|
+
render(html `<input
|
|
112
|
+
type=${this.type}
|
|
113
|
+
class="hidden-button"
|
|
114
|
+
style="display:none"
|
|
115
|
+
slot="hidden-button"
|
|
116
|
+
@click=${(e) => this.handleFormActions(e)}
|
|
117
|
+
/>`, this);
|
|
118
|
+
}
|
|
119
|
+
/** Triggers the component's click event manually to prevent extra submission/reset */
|
|
120
|
+
handleFormActions(e) {
|
|
121
|
+
/**
|
|
122
|
+
* Prevents the event from bubbling up to the ia-button component itself.
|
|
123
|
+
* This way, if the click on this button is triggered by a click on the component,
|
|
124
|
+
* we don't accidentally bubble up a second click and end up in an infinite loop.
|
|
125
|
+
*
|
|
126
|
+
* And if the click was triggered by form submission (via the enter key), we can hijack the click
|
|
127
|
+
* event to pass that info to the component, so it knows not to
|
|
128
|
+
* re-attempt submission.
|
|
129
|
+
*/
|
|
130
|
+
e.stopPropagation();
|
|
131
|
+
// Detect if click comes from the parent component,
|
|
132
|
+
// in which case there's no need to trigger a second click on it
|
|
133
|
+
const triggeredByComponentClick = !e.isTrusted;
|
|
134
|
+
if (triggeredByComponentClick)
|
|
135
|
+
return;
|
|
136
|
+
// Trigger parent component click events manually,
|
|
137
|
+
// so it knows not to try to re-submit/re-reset the form
|
|
138
|
+
this.dispatchEvent(new CustomEvent('click', { detail: { formActionsInProgress: true } }));
|
|
139
|
+
}
|
|
16
140
|
static get styles() {
|
|
17
141
|
return [
|
|
18
142
|
themeStyles,
|
|
19
143
|
css `
|
|
20
144
|
:host {
|
|
21
|
-
--primary-
|
|
22
|
-
--primary-
|
|
145
|
+
--primary-cta-text-color--: var(--primary-cta-text-color);
|
|
146
|
+
--primary-cta-fill--: var(--primary-cta-fill);
|
|
147
|
+
--primary-cta-border--: var(--primary-cta-border);
|
|
148
|
+
|
|
149
|
+
--secondary-cta-text-color--: var(--secondary-cta-text-color);
|
|
150
|
+
--secondary-cta-fill--: var(--secondary-cta-fill);
|
|
151
|
+
--secondary-cta-border--: var(--secondary-cta-border);
|
|
152
|
+
|
|
153
|
+
--danger-cta-text-color--: var(--danger-cta-text-color);
|
|
154
|
+
--danger-cta-fill--: var(--danger-cta-fill);
|
|
155
|
+
--danger-cta-border--: var(--danger-cta-border);
|
|
156
|
+
|
|
157
|
+
--warning-cta-text-color--: var(--warning-cta-text-color);
|
|
158
|
+
--warning-cta-fill--: var(--warning-cta-fill);
|
|
159
|
+
--warning-cta-border--: var(--warning-cta-border);
|
|
160
|
+
|
|
161
|
+
--disabled-cta-text-color--: var(--disabled-cta-text-color);
|
|
162
|
+
--disabled-cta-fill--: var(--disabled-cta-fill);
|
|
163
|
+
--disabled-cta-border--: var(--disabled-cta-border);
|
|
164
|
+
|
|
165
|
+
--link-color--: var(--link-color);
|
|
166
|
+
--color-danger--: var(--color-danger);
|
|
167
|
+
|
|
168
|
+
--button-padding--: var(--button-padding);
|
|
169
|
+
--button-width--: var(--button-width);
|
|
170
|
+
--button-height--: var(--button-height);
|
|
171
|
+
--button-border-width--: var(--button-border-width);
|
|
172
|
+
--button-border-radius--: var(--button-border-radius);
|
|
173
|
+
--base-font-family--: var(--base-font-family);
|
|
174
|
+
--font-size-standard--: var(--font-size-standard);
|
|
175
|
+
|
|
176
|
+
--ia-button-transition--: var(
|
|
177
|
+
--ia-button-transition,
|
|
178
|
+
all 0.1s ease 0s
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
--ia-button-custom-text-color--: var(
|
|
182
|
+
--ia-button-custom-text-color,
|
|
183
|
+
var(--primary-cta-text-color--)
|
|
184
|
+
);
|
|
185
|
+
--ia-button-custom-fill--: var(
|
|
186
|
+
--ia-button-custom-fill,
|
|
187
|
+
var(--primary-cta-fill--)
|
|
188
|
+
);
|
|
189
|
+
--ia-button-custom-border--: var(
|
|
190
|
+
--ia-button-custom-border,
|
|
191
|
+
var(--primary-cta-border--)
|
|
192
|
+
);
|
|
193
|
+
--ia-button-custom-active-text-color--: var(
|
|
194
|
+
--ia-button-custom-active-text-color,
|
|
195
|
+
var(--ia-button-custom-text-color--)
|
|
196
|
+
);
|
|
197
|
+
--ia-button-custom-active-fill--: var(
|
|
198
|
+
--ia-button-custom-active-fill,
|
|
199
|
+
var(--ia-button-custom-fill--)
|
|
200
|
+
);
|
|
201
|
+
--ia-button-custom-active-border--: var(
|
|
202
|
+
--ia-button-custom-active-border,
|
|
203
|
+
var(--ia-button-custom-border--)
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
display: inline-block; /* keeps host sized to button */
|
|
23
207
|
}
|
|
24
208
|
|
|
25
209
|
button {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
210
|
+
font-family: var(--base-font-family--);
|
|
211
|
+
font-size: var(--font-size-standard--);
|
|
212
|
+
height: var(--button-height--);
|
|
213
|
+
min-height: var(--button-height--);
|
|
214
|
+
width: var(--button-width--);
|
|
215
|
+
padding: var(--button-padding--);
|
|
216
|
+
border-width: var(--button-border-width--);
|
|
217
|
+
border-radius: var(--button-border-radius--);
|
|
218
|
+
transition: var(--ia-button-transition--);
|
|
219
|
+
|
|
220
|
+
outline-color: currentColor;
|
|
221
|
+
cursor: pointer;
|
|
222
|
+
line-height: normal;
|
|
223
|
+
border-style: solid;
|
|
224
|
+
white-space: nowrap;
|
|
225
|
+
appearance: auto;
|
|
226
|
+
box-sizing: border-box;
|
|
227
|
+
display: flex;
|
|
228
|
+
align-items: center;
|
|
229
|
+
justify-content: center;
|
|
230
|
+
vertical-align: middle;
|
|
231
|
+
outline-offset: -4px;
|
|
232
|
+
user-select: none;
|
|
233
|
+
text-decoration: none;
|
|
234
|
+
-webkit-user-select: none;
|
|
235
|
+
-moz-user-select: none;
|
|
236
|
+
-ms-user-select: none;
|
|
237
|
+
-o-user-select: none;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
a {
|
|
241
|
+
text-decoration: none;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
button:disabled,
|
|
245
|
+
button.disabled {
|
|
246
|
+
cursor: not-allowed;
|
|
247
|
+
color: var(--disabled-cta-text-color--);
|
|
248
|
+
background-color: var(--disabled-cta-fill--);
|
|
249
|
+
border: 1px solid var(--disabled-cta-border--);
|
|
250
|
+
opacity: 0.5;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
button:enabled:hover {
|
|
254
|
+
opacity: 0.9;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
button:focus-visible {
|
|
258
|
+
opacity: 0.8;
|
|
259
|
+
outline-style: double;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
button:active {
|
|
263
|
+
opacity: 0.7;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
button.primary {
|
|
267
|
+
color: var(--primary-cta-text-color--);
|
|
268
|
+
background-color: var(--primary-cta-fill--);
|
|
269
|
+
border-color: var(--primary-cta-border--);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
button.secondary {
|
|
273
|
+
color: var(--secondary-cta-text-color--);
|
|
274
|
+
background-color: var(--secondary-cta-fill--);
|
|
275
|
+
border-color: var(--secondary-cta-border--);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
button.danger {
|
|
279
|
+
color: var(--danger-cta-text-color--);
|
|
280
|
+
background-color: var(--danger-cta-fill--);
|
|
281
|
+
border-color: var(--danger-cta-border--);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
button.warning {
|
|
285
|
+
color: var(--warning-cta-text-color--);
|
|
286
|
+
background-color: var(--warning-cta-fill--);
|
|
287
|
+
border-color: var(--warning-cta-border--);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
button.transparent {
|
|
291
|
+
color: inherit;
|
|
292
|
+
border-width: 0;
|
|
293
|
+
background-color: transparent;
|
|
294
|
+
border-color: transparent;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
button.custom {
|
|
298
|
+
color: var(--ia-button-custom-text-color--);
|
|
299
|
+
background-color: var(--ia-button-custom-fill--);
|
|
300
|
+
border-color: var(--ia-button-custom-border--);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
button.custom:enabled:is(:hover, :focus, :active, .active) {
|
|
304
|
+
color: var(--ia-button-custom-active-text-color--);
|
|
305
|
+
background-color: var(--ia-button-custom-active-fill--);
|
|
306
|
+
border-color: var(--ia-button-custom-active-border--);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
:host(.fit-content) button {
|
|
310
|
+
padding: 0;
|
|
311
|
+
height: fit-content;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
button.link:enabled:hover,
|
|
315
|
+
button.danger-link:enabled:hover {
|
|
316
|
+
text-decoration: underline;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
button.link,
|
|
320
|
+
button.danger-link {
|
|
321
|
+
margin: 0;
|
|
322
|
+
border: 0;
|
|
323
|
+
appearance: none;
|
|
324
|
+
background: none;
|
|
325
|
+
text-decoration: none;
|
|
326
|
+
cursor: pointer;
|
|
327
|
+
padding: 0;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
button.link {
|
|
331
|
+
color: var(--link-color--);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
button.danger-link {
|
|
335
|
+
color: var(--color-danger--);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.loading-indicator {
|
|
339
|
+
display: flex;
|
|
340
|
+
flex-direction: row;
|
|
341
|
+
gap: 0.5rem;
|
|
342
|
+
align-items: center;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
ia-status-indicator {
|
|
346
|
+
--ia-theme-primary-text-color: currentColor;
|
|
29
347
|
}
|
|
30
348
|
`,
|
|
31
349
|
];
|
|
32
350
|
}
|
|
33
351
|
};
|
|
352
|
+
__decorate([
|
|
353
|
+
property({ type: String })
|
|
354
|
+
], IAButton.prototype, "mode", void 0);
|
|
355
|
+
__decorate([
|
|
356
|
+
property({ type: Boolean })
|
|
357
|
+
], IAButton.prototype, "loading", void 0);
|
|
358
|
+
__decorate([
|
|
359
|
+
property({ type: Boolean })
|
|
360
|
+
], IAButton.prototype, "disabled", void 0);
|
|
361
|
+
__decorate([
|
|
362
|
+
property({ type: String })
|
|
363
|
+
], IAButton.prototype, "loadingText", void 0);
|
|
364
|
+
__decorate([
|
|
365
|
+
property({ type: String, reflect: true })
|
|
366
|
+
], IAButton.prototype, "type", void 0);
|
|
367
|
+
__decorate([
|
|
368
|
+
property({ type: String })
|
|
369
|
+
], IAButton.prototype, "href", void 0);
|
|
370
|
+
__decorate([
|
|
371
|
+
property({ type: Boolean })
|
|
372
|
+
], IAButton.prototype, "openLinksNewTab", void 0);
|
|
34
373
|
IAButton = __decorate([
|
|
35
374
|
customElement('ia-button')
|
|
36
375
|
], IAButton);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-button.js","sourceRoot":"","sources":["../../../../src/elements/ia-button/ia-button.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAEnD;;GAEG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IACtC,MAAM;QACJ,OAAO,IAAI,CAAA;;;;KAIV,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,WAAW;YACX,GAAG,CAAA;;;;;;;;;;;OAWF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA1BY,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA0BpB","sourcesContent":["import { css, html, LitElement, type CSSResultGroup } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\n\nimport themeStyles from '@src/themes/theme-styles';\n\n/**\n * A button element to demo the elements library\n */\n@customElement('ia-button')\nexport class IAButton extends LitElement {\n render() {\n return html`\n <button>\n <slot></slot>\n </button>\n `;\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --primary-background-color--: var(--primary-cta-fill);\n --primary-text-color--: var(--primary-cta-text-color);\n }\n\n button {\n padding: 8px 16px;\n background-color: var(--primary-background-color--);\n color: var(--primary-text-color--);\n }\n `,\n ];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ia-button.js","sourceRoot":"","sources":["../../../../src/elements/ia-button/ia-button.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,IAAI,EACJ,UAAU,EAGV,GAAG,EAEH,MAAM,GACP,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAEnD,OAAO,4CAA4C,CAAC;AAEpD;;;;;;;;;GASG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QACL,4CAA4C;QAChB,SAAI,GASZ,SAAS,CAAC;QAE9B,+DAA+D;QAClC,YAAO,GAAY,KAAK,CAAC;QAEtD,4EAA4E;QAC/C,aAAQ,GAAY,KAAK,CAAC;QAEvD,4DAA4D;QAChC,gBAAW,GAAW,EAAE,CAAC;QAErD,0EAA0E;QAC/B,SAAI,GAGjC,QAAQ,CAAC;QAKvB,2DAA2D;QAC9B,oBAAe,GAAY,KAAK,CAAC;IAwVhE,CAAC;IAtVC,MAAM;QACJ,OAAO,IAAI,CAAA;QACP,IAAI,CAAC,IAAI;YACT,CAAC,CAAC,IAAI,CAAA;mBACK,IAAI,CAAC,IAAI;qBACP,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO;eAC/C,IAAI,CAAC,cAAc;YACtB;YACJ,CAAC,CAAC,IAAI,CAAC,cAAc;;KAExB,CAAC;IACJ,CA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EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCAA0B;AAGzB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAA2B;AAG3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAA0B;AAGV;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCAGnB;AAGK;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAAe;AAGb;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDAAkC;AAhCnD,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAwXpB","sourcesContent":["import {\n html,\n LitElement,\n TemplateResult,\n CSSResultGroup,\n css,\n PropertyValues,\n render,\n} from 'lit';\nimport { msg } from '@lit/localize';\nimport { property, customElement } from 'lit/decorators.js';\nimport themeStyles from '@src/themes/theme-styles';\n\nimport '../ia-status-indicator/ia-status-indicator';\n\n/**\n * Renders a standardized button built off the ia-button styling and the activity indicator, with the option to show\n * a loading indicator instead of the text or to customize the text, and the ability to pass in any\n * function to run on click.\n *\n * Designed to behave exactly like a native type=\"submit\" or type=\"reset\" button if either type is supplied,\n * i.e. for an <ia-button type=\"submit\" @click=${doSideEffects}></ia-button>,\n * whether the form is submitted via enter or by clicking the button directly, the button will always\n * run doSideEffects() and then submit the form.\n */\n@customElement('ia-button')\nexport class IAButton extends LitElement {\n /* Which version of the button to display */\n @property({ type: String }) mode:\n | 'primary'\n | 'secondary'\n | 'danger'\n | 'warning'\n | 'disabled'\n | 'transparent'\n | 'custom'\n | 'link'\n | 'danger-link' = 'primary';\n\n /* Whether to show a loading indicator instead of the button */\n @property({ type: Boolean }) loading: boolean = false;\n\n /* Whether the button should be disabled, regardless of submission status */\n @property({ type: Boolean }) disabled: boolean = false;\n\n /* Optional text to include next to the loading indicator */\n @property({ type: String }) loadingText: string = '';\n\n /* Type of the button - defaults to 'button' to prevent form submission */\n @property({ type: String, reflect: true }) type:\n | 'button'\n | 'submit'\n | 'reset' = 'button';\n\n /* An optional href to wrap around the button */\n @property({ type: String }) href?: string;\n\n /* Whether to add a target=\"_blank\" to any wrapping link */\n @property({ type: Boolean }) openLinksNewTab: boolean = false;\n\n render(): TemplateResult {\n return html`\n ${this.href\n ? html`<a\n href=${this.href}\n target=${this.openLinksNewTab ? '_blank' : '_self'}\n >${this.buttonTemplate}</a\n >`\n : this.buttonTemplate}\n <slot name=\"hidden-button\"></slot>\n `;\n }\n\n protected willUpdate(changed: PropertyValues): void {\n if (changed.has('type')) {\n this.setButtonTypeEmulation();\n }\n }\n\n /* The native button to render */\n private get buttonTemplate(): TemplateResult {\n return html`\n <button\n part=\"button\"\n class=${this.mode}\n ?disabled=${this.disabled || this.loading}\n >\n ${this.buttonTextTemplate}\n </button>\n `;\n }\n\n /* The text to render within the button */\n private get buttonTextTemplate(): TemplateResult {\n return this.loading ? this.loadingStateTemplate : html`<slot></slot>`;\n }\n\n /* Content to render while button is loading */\n private get loadingStateTemplate(): TemplateResult {\n return html`\n <span class=\"loading-indicator\" alt=\"Loading indicator\">\n <ia-status-indicator mode=\"loading\"></ia-status-indicator> ${msg(\n this.loadingText,\n )}\n </span>\n `;\n }\n\n /** Sets up or removes button type emulation as needed */\n private setButtonTypeEmulation(): void {\n const hiddenButton: HTMLInputElement | null = this.querySelector(\n 'input.hidden-button',\n );\n\n if (hiddenButton) {\n hiddenButton.type = this.type;\n return;\n }\n\n this.addHiddenButton();\n this.addEventListener('click', this.handleComponentClick);\n }\n\n /**\n * Triggers form actions (submit/reset) on click, if desired\n * and if actions not already in progress\n */\n private handleComponentClick(e: Event): void {\n if (this.type === 'button') return;\n\n // No need to submit/reset the form if it's already submitting/resetting\n const formActionsInProgress =\n e instanceof CustomEvent && e.detail.formActionsInProgress;\n if (formActionsInProgress) return;\n\n // Request form submission/reset by clicking the hidden native submit/reset button we added earlier\n const hiddenButton = this.querySelector(\n 'input.hidden-button',\n ) as HTMLInputElement;\n hiddenButton.dispatchEvent(new PointerEvent('click'));\n }\n\n /**\n * Adds a hidden button to the light DOM to\n * emulate native reset/submit button behavior.\n *\n * Used for:\n * - Submitting/resetting the form (on behalf of handleComponentClick)\n * - Activating any component click events if form is submitted with the enter key\n * (via handleFormActions)\n */\n private addHiddenButton(): void {\n if (this.type === 'button') return;\n\n render(\n html`<input\n type=${this.type}\n class=\"hidden-button\"\n style=\"display:none\"\n slot=\"hidden-button\"\n @click=${(e: Event) => this.handleFormActions(e)}\n />`,\n this,\n );\n }\n\n /** Triggers the component's click event manually to prevent extra submission/reset */\n private handleFormActions(e: Event): void {\n /**\n * Prevents the event from bubbling up to the ia-button component itself.\n * This way, if the click on this button is triggered by a click on the component,\n * we don't accidentally bubble up a second click and end up in an infinite loop.\n *\n * And if the click was triggered by form submission (via the enter key), we can hijack the click\n * event to pass that info to the component, so it knows not to\n * re-attempt submission.\n */\n e.stopPropagation();\n\n // Detect if click comes from the parent component,\n // in which case there's no need to trigger a second click on it\n const triggeredByComponentClick = !e.isTrusted;\n if (triggeredByComponentClick) return;\n\n // Trigger parent component click events manually,\n // so it knows not to try to re-submit/re-reset the form\n this.dispatchEvent(\n new CustomEvent('click', { detail: { formActionsInProgress: true } }),\n );\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --primary-cta-text-color--: var(--primary-cta-text-color);\n --primary-cta-fill--: var(--primary-cta-fill);\n --primary-cta-border--: var(--primary-cta-border);\n\n --secondary-cta-text-color--: var(--secondary-cta-text-color);\n --secondary-cta-fill--: var(--secondary-cta-fill);\n --secondary-cta-border--: var(--secondary-cta-border);\n\n --danger-cta-text-color--: var(--danger-cta-text-color);\n --danger-cta-fill--: var(--danger-cta-fill);\n --danger-cta-border--: var(--danger-cta-border);\n\n --warning-cta-text-color--: var(--warning-cta-text-color);\n --warning-cta-fill--: var(--warning-cta-fill);\n --warning-cta-border--: var(--warning-cta-border);\n\n --disabled-cta-text-color--: var(--disabled-cta-text-color);\n --disabled-cta-fill--: var(--disabled-cta-fill);\n --disabled-cta-border--: var(--disabled-cta-border);\n\n --link-color--: var(--link-color);\n --color-danger--: var(--color-danger);\n\n --button-padding--: var(--button-padding);\n --button-width--: var(--button-width);\n --button-height--: var(--button-height);\n --button-border-width--: var(--button-border-width);\n --button-border-radius--: var(--button-border-radius);\n --base-font-family--: var(--base-font-family);\n --font-size-standard--: var(--font-size-standard);\n\n --ia-button-transition--: var(\n --ia-button-transition,\n all 0.1s ease 0s\n );\n\n --ia-button-custom-text-color--: var(\n --ia-button-custom-text-color,\n var(--primary-cta-text-color--)\n );\n --ia-button-custom-fill--: var(\n --ia-button-custom-fill,\n var(--primary-cta-fill--)\n );\n --ia-button-custom-border--: var(\n --ia-button-custom-border,\n var(--primary-cta-border--)\n );\n --ia-button-custom-active-text-color--: var(\n --ia-button-custom-active-text-color,\n var(--ia-button-custom-text-color--)\n );\n --ia-button-custom-active-fill--: var(\n --ia-button-custom-active-fill,\n var(--ia-button-custom-fill--)\n );\n --ia-button-custom-active-border--: var(\n --ia-button-custom-active-border,\n var(--ia-button-custom-border--)\n );\n\n display: inline-block; /* keeps host sized to button */\n }\n\n button {\n font-family: var(--base-font-family--);\n font-size: var(--font-size-standard--);\n height: var(--button-height--);\n min-height: var(--button-height--);\n width: var(--button-width--);\n padding: var(--button-padding--);\n border-width: var(--button-border-width--);\n border-radius: var(--button-border-radius--);\n transition: var(--ia-button-transition--);\n\n outline-color: currentColor;\n cursor: pointer;\n line-height: normal;\n border-style: solid;\n white-space: nowrap;\n appearance: auto;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n vertical-align: middle;\n outline-offset: -4px;\n user-select: none;\n text-decoration: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -o-user-select: none;\n }\n\n a {\n text-decoration: none;\n }\n\n button:disabled,\n button.disabled {\n cursor: not-allowed;\n color: var(--disabled-cta-text-color--);\n background-color: var(--disabled-cta-fill--);\n border: 1px solid var(--disabled-cta-border--);\n opacity: 0.5;\n }\n\n button:enabled:hover {\n opacity: 0.9;\n }\n\n button:focus-visible {\n opacity: 0.8;\n outline-style: double;\n }\n\n button:active {\n opacity: 0.7;\n }\n\n button.primary {\n color: var(--primary-cta-text-color--);\n background-color: var(--primary-cta-fill--);\n border-color: var(--primary-cta-border--);\n }\n\n button.secondary {\n color: var(--secondary-cta-text-color--);\n background-color: var(--secondary-cta-fill--);\n border-color: var(--secondary-cta-border--);\n }\n\n button.danger {\n color: var(--danger-cta-text-color--);\n background-color: var(--danger-cta-fill--);\n border-color: var(--danger-cta-border--);\n }\n\n button.warning {\n color: var(--warning-cta-text-color--);\n background-color: var(--warning-cta-fill--);\n border-color: var(--warning-cta-border--);\n }\n\n button.transparent {\n color: inherit;\n border-width: 0;\n background-color: transparent;\n border-color: transparent;\n }\n\n button.custom {\n color: var(--ia-button-custom-text-color--);\n background-color: var(--ia-button-custom-fill--);\n border-color: var(--ia-button-custom-border--);\n }\n\n button.custom:enabled:is(:hover, :focus, :active, .active) {\n color: var(--ia-button-custom-active-text-color--);\n background-color: var(--ia-button-custom-active-fill--);\n border-color: var(--ia-button-custom-active-border--);\n }\n\n :host(.fit-content) button {\n padding: 0;\n height: fit-content;\n }\n\n button.link:enabled:hover,\n button.danger-link:enabled:hover {\n text-decoration: underline;\n }\n\n button.link,\n button.danger-link {\n margin: 0;\n border: 0;\n appearance: none;\n background: none;\n text-decoration: none;\n cursor: pointer;\n padding: 0;\n }\n\n button.link {\n color: var(--link-color--);\n }\n\n button.danger-link {\n color: var(--color-danger--);\n }\n\n .loading-indicator {\n display: flex;\n flex-direction: row;\n gap: 0.5rem;\n align-items: center;\n }\n\n ia-status-indicator {\n --ia-theme-primary-text-color: currentColor;\n }\n `,\n ];\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement, nothing, TemplateResult, CSSResultGroup, PropertyValues } from 'lit';
|
|
2
|
-
import { type IAComboBoxBehavior, type IAComboBoxFilterOption, type IAComboBoxOption } from './models';
|
|
2
|
+
import { type IAComboBoxBehavior, type IAComboBoxFilterOption, type IAComboBoxOption } from './models.js';
|
|
3
3
|
/**
|
|
4
4
|
* A flexible component combining the features of a dropdown menu and a text input,
|
|
5
5
|
* allowing users to either select from a predefined list of options or type
|
|
@@ -137,9 +137,9 @@ export declare class IAComboBox extends LitElement {
|
|
|
137
137
|
* The text that we are currently using the filter the dropdown menu options.
|
|
138
138
|
*/
|
|
139
139
|
private filterText;
|
|
140
|
-
private mainWidgetRow
|
|
141
|
-
private textInput
|
|
142
|
-
private optionsList
|
|
140
|
+
private mainWidgetRow?;
|
|
141
|
+
private textInput?;
|
|
142
|
+
private optionsList?;
|
|
143
143
|
static formAssociated: boolean;
|
|
144
144
|
static shadowRootOptions: ShadowRootInit;
|
|
145
145
|
private internals;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-combo-box.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-combo-box/ia-combo-box.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,OAAO,EACP,cAAc,EACd,cAAc,EAEd,cAAc,EACf,MAAM,KAAK,CAAC;AAQb,OAAO,EAGL,KAAK,kBAAkB,EAEvB,KAAK,sBAAsB,EAE3B,KAAK,gBAAgB,EACtB,MAAM,UAAU,CAAC;AA0BlB;;;;GAIG;AACH,qBACa,UAAW,SAAQ,UAAU;IACxC;;;;;;;;;;OAUG;IACwB,OAAO,EAAE,gBAAgB,EAAE,CAAM;IAE5D;;OAEG;IACyB,WAAW,CAAC,EAAE,MAAM,CAAC;IAEjD;;;;;;;;;;OAUG;IACyB,QAAQ,EAAE,kBAAkB,CAAoB;IAE5E;;;;OAIG;IAEH,sBAAsB,SAA4B;IAElD;;;;;;;;;;;;;;;;;;;;OAoBG;IACyB,MAAM,EAAE,sBAA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IAQ3B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,QAAQ;IAYhB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAMpB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAKrB,eAAe,IAAI,IAAI;IAKvB,gBAAgB,IAAI,IAAI;IAKxB,iBAAiB,IAAI,IAAI;IAKzB,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,eAAe;IAYvB;;OAEG;IACH,OAAO,KAAK,OAAO,GAElB;IAED;;;OAGG;IACH,OAAO,KAAK,qBAAqB,GAEhC;IAED;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAiC3B;;;OAGG;IACH,OAAO,KAAK,aAAa,GAExB;IAED;;OAEG;IACH,OAAO,CAAC,YAAY;IAIpB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAO1B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAY5B;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IAUpC;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAsB9B;;OAEG;IACH,OAAO,KAAK,mBAAmB,GAE9B;IAED;;OAEG;IACH,OAAO,KAAK,kBAAkB,GAE7B;IAED;;OAEG;IACH,OAAO,KAAK,iBAAiB,GAE5B;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,gBAAgB,GAAG,IAAI,CAG5C;IAED;;;OAGG;IACH,OAAO,KAAK,gBAAgB,GAG3B;IAED;;;OAGG;IACH,OAAO,KAAK,kBAAkB,GAG7B;IAED,MAAM,KAAK,MAAM,IAAI,cAAc,CA2KlC;CACF"}
|
|
@@ -6,8 +6,8 @@ import { ifDefined } from 'lit/directives/if-defined.js';
|
|
|
6
6
|
import { live } from 'lit/directives/live.js';
|
|
7
7
|
import { when } from 'lit/directives/when.js';
|
|
8
8
|
import { msg } from '@lit/localize';
|
|
9
|
-
import { hasAnyOf, isSubsequence, } from './models';
|
|
10
|
-
import themeStyles from '../../themes/theme-styles';
|
|
9
|
+
import { hasAnyOf, isSubsequence, } from './models.js';
|
|
10
|
+
import themeStyles from '../../themes/theme-styles.js';
|
|
11
11
|
import caretClosedIcon from './caret-closed.svg';
|
|
12
12
|
import caretOpenIcon from './caret-open.svg';
|
|
13
13
|
import clearIcon from './clear.svg';
|
|
@@ -262,12 +262,12 @@ let IAComboBox = class IAComboBox extends LitElement {
|
|
|
262
262
|
if (changed.has('open')) {
|
|
263
263
|
if (this.open) {
|
|
264
264
|
this.positionOptionsMenu();
|
|
265
|
-
this.optionsList
|
|
266
|
-
this.optionsList
|
|
265
|
+
this.optionsList?.showPopover?.();
|
|
266
|
+
this.optionsList?.classList.add('visible');
|
|
267
267
|
}
|
|
268
268
|
else {
|
|
269
|
-
this.optionsList
|
|
270
|
-
this.optionsList
|
|
269
|
+
this.optionsList?.hidePopover?.();
|
|
270
|
+
this.optionsList?.classList.remove('visible');
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
}
|
|
@@ -534,8 +534,9 @@ let IAComboBox = class IAComboBox extends LitElement {
|
|
|
534
534
|
* Handler for `input` events in the text input box.
|
|
535
535
|
*/
|
|
536
536
|
async handleTextBoxInput() {
|
|
537
|
-
|
|
538
|
-
this.
|
|
537
|
+
const value = this.textInput?.value ?? '';
|
|
538
|
+
this.enteredText = value;
|
|
539
|
+
this.setFilterText(value);
|
|
539
540
|
this.openOptionsMenu();
|
|
540
541
|
await this.updateComplete;
|
|
541
542
|
this.highlightFirstOption();
|
|
@@ -641,7 +642,7 @@ let IAComboBox = class IAComboBox extends LitElement {
|
|
|
641
642
|
*/
|
|
642
643
|
handleClearButtonClick() {
|
|
643
644
|
this.clearSelectedOption();
|
|
644
|
-
this.textInput
|
|
645
|
+
this.textInput?.focus();
|
|
645
646
|
this.openOptionsMenu();
|
|
646
647
|
}
|
|
647
648
|
/**
|
|
@@ -650,7 +651,7 @@ let IAComboBox = class IAComboBox extends LitElement {
|
|
|
650
651
|
handleFocus() {
|
|
651
652
|
if (this.behavior !== 'select-only') {
|
|
652
653
|
// Always keep focus on the text input if it's editable
|
|
653
|
-
this.textInput
|
|
654
|
+
this.textInput?.focus();
|
|
654
655
|
}
|
|
655
656
|
this.hasFocus = true;
|
|
656
657
|
this.losingFocus = false;
|
|
@@ -763,7 +764,7 @@ let IAComboBox = class IAComboBox extends LitElement {
|
|
|
763
764
|
this.highlightedOption = option;
|
|
764
765
|
await this.updateComplete;
|
|
765
766
|
const { optionsList, highlightedElement } = this;
|
|
766
|
-
if (!highlightedElement)
|
|
767
|
+
if (!highlightedElement || !optionsList)
|
|
767
768
|
return;
|
|
768
769
|
// TODO: Not ideal as this will trigger a reflow...
|
|
769
770
|
// But may not be an issue in practice given the highlight isn't changing in a hot loop.
|
|
@@ -837,7 +838,8 @@ let IAComboBox = class IAComboBox extends LitElement {
|
|
|
837
838
|
* matched. Defaults to `true`.
|
|
838
839
|
*/
|
|
839
840
|
setTextValue(value, setFilter = true) {
|
|
840
|
-
this.textInput
|
|
841
|
+
if (this.textInput)
|
|
842
|
+
this.textInput.value = value;
|
|
841
843
|
this.enteredText = value;
|
|
842
844
|
if (setFilter)
|
|
843
845
|
this.setFilterText(value);
|
|
@@ -905,6 +907,8 @@ let IAComboBox = class IAComboBox extends LitElement {
|
|
|
905
907
|
*/
|
|
906
908
|
positionOptionsMenu() {
|
|
907
909
|
const { mainWidgetRow, optionsList } = this;
|
|
910
|
+
if (!mainWidgetRow || !optionsList)
|
|
911
|
+
return;
|
|
908
912
|
const mainWidgetRect = mainWidgetRow.getBoundingClientRect();
|
|
909
913
|
const { innerHeight, scrollX, scrollY } = window;
|
|
910
914
|
const usableHeightAbove = mainWidgetRect.top;
|
|
@@ -1051,6 +1055,10 @@ let IAComboBox = class IAComboBox extends LitElement {
|
|
|
1051
1055
|
--combo-box-padding--: var(--padding-sm);
|
|
1052
1056
|
--combo-box-list-width--: var(--combo-box-list-width, unset);
|
|
1053
1057
|
--combo-box-list-max-height--: var(--combo-box-list-max-height, 250px);
|
|
1058
|
+
--combo-box-list-fade-duration--: var(
|
|
1059
|
+
--combo-box-list-fade-duration,
|
|
1060
|
+
125ms
|
|
1061
|
+
);
|
|
1054
1062
|
}
|
|
1055
1063
|
|
|
1056
1064
|
#container {
|
|
@@ -1151,7 +1159,7 @@ let IAComboBox = class IAComboBox extends LitElement {
|
|
|
1151
1159
|
max-height: 400px;
|
|
1152
1160
|
box-shadow: 0 0 1px 1px #ddd;
|
|
1153
1161
|
opacity: 0;
|
|
1154
|
-
transition: opacity
|
|
1162
|
+
transition: opacity var(--combo-box-list-fade-duration--) ease;
|
|
1155
1163
|
}
|
|
1156
1164
|
|
|
1157
1165
|
#options-list.visible {
|