@crowdstrike/glide-core 0.32.3 → 0.33.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/dist/accordion.js +3 -2
- package/dist/button-group.button.js +3 -2
- package/dist/button-group.js +3 -2
- package/dist/button.js +5 -10
- package/dist/button.styles.js +0 -12
- package/dist/checkbox-group.js +8 -7
- package/dist/checkbox.js +8 -7
- package/dist/checkbox.styles.js +1 -1
- package/dist/drawer.js +3 -2
- package/dist/dropdown.js +19 -18
- package/dist/dropdown.option.d.ts +2 -0
- package/dist/dropdown.option.js +26 -25
- package/dist/form-controls-layout.js +3 -2
- package/dist/icon-button.js +2 -2
- package/dist/inline-alert.js +3 -2
- package/dist/input.js +7 -7
- package/dist/label.js +3 -2
- package/dist/library/assert-slot.js +2 -2
- package/dist/library/assert-slot.test.js +92 -0
- package/dist/link.js +2 -2
- package/dist/menu.js +61 -30
- package/dist/menu.styles.js +1 -0
- package/dist/modal.icon-button.js +3 -2
- package/dist/modal.js +3 -2
- package/dist/option.d.ts +5 -0
- package/dist/option.js +28 -5
- package/dist/options.d.ts +2 -0
- package/dist/options.group.js +3 -2
- package/dist/options.js +7 -8
- package/dist/options.styles.js +0 -6
- package/dist/popover.js +3 -2
- package/dist/radio-group.js +4 -3
- package/dist/radio-group.radio.js +3 -2
- package/dist/select.d.ts +90 -0
- package/dist/select.js +532 -0
- package/dist/slider.js +3 -3
- package/dist/spinner.js +2 -2
- package/dist/split-button.js +3 -2
- package/dist/split-button.primary-button.js +2 -2
- package/dist/split-button.primary-link.js +2 -2
- package/dist/split-button.secondary-button.js +2 -2
- package/dist/styles/opacity-and-scale-animation.js +2 -1
- package/dist/styles/variables.css +7 -4
- package/dist/tab.group.js +3 -2
- package/dist/tab.js +3 -2
- package/dist/tab.panel.js +3 -2
- package/dist/tag.js +2 -2
- package/dist/textarea.js +8 -7
- package/dist/toast.js +2 -2
- package/dist/toast.toasts.js +3 -2
- package/dist/toggle.js +3 -2
- package/dist/tooltip.container.js +3 -2
- package/dist/tooltip.js +4 -7
- package/package.json +4 -4
- package/dist/library/shadow-root-mode.d.ts +0 -2
- package/dist/library/shadow-root-mode.js +0 -4
package/dist/accordion.js
CHANGED
@@ -13,7 +13,6 @@ import packageJson from '../package.json' with { type: 'json' };
|
|
13
13
|
import chevronIcon from './icons/chevron.js';
|
14
14
|
import styles from './accordion.styles.js';
|
15
15
|
import assertSlot from './library/assert-slot.js';
|
16
|
-
import shadowRootMode from './library/shadow-root-mode.js';
|
17
16
|
import final from './library/final.js';
|
18
17
|
import required from './library/required.js';
|
19
18
|
/**
|
@@ -43,11 +42,13 @@ let Accordion = class Accordion extends LitElement {
|
|
43
42
|
this.#suffixIconsSlotElementRef = createRef();
|
44
43
|
this.#summaryElementRef = createRef();
|
45
44
|
}
|
45
|
+
/* c8 ignore start */
|
46
46
|
static { this.shadowRootOptions = {
|
47
47
|
...LitElement.shadowRootOptions,
|
48
48
|
delegatesFocus: true,
|
49
|
-
mode:
|
49
|
+
mode: window.navigator.webdriver ? 'open' : 'closed',
|
50
50
|
}; }
|
51
|
+
/* c8 ignore end */
|
51
52
|
static { this.styles = styles; }
|
52
53
|
/**
|
53
54
|
* @default false
|
@@ -11,7 +11,6 @@ import { classMap } from 'lit/directives/class-map.js';
|
|
11
11
|
import packageJson from '../package.json' with { type: 'json' };
|
12
12
|
import styles from './button-group.button.styles.js';
|
13
13
|
import assertSlot from './library/assert-slot.js';
|
14
|
-
import shadowRootMode from './library/shadow-root-mode.js';
|
15
14
|
import final from './library/final.js';
|
16
15
|
import required from './library/required.js';
|
17
16
|
/**
|
@@ -42,10 +41,12 @@ let ButtonGroupButton = class ButtonGroupButton extends LitElement {
|
|
42
41
|
this.#iconSlotElementRef = createRef();
|
43
42
|
this.#isSelected = false;
|
44
43
|
}
|
44
|
+
/* c8 ignore start */
|
45
45
|
static { this.shadowRootOptions = {
|
46
46
|
...LitElement.shadowRootOptions,
|
47
|
-
mode:
|
47
|
+
mode: window.navigator.webdriver ? 'open' : 'closed',
|
48
48
|
}; }
|
49
|
+
/* c8 ignore end */
|
49
50
|
static { this.styles = styles; }
|
50
51
|
/**
|
51
52
|
* @default false
|
package/dist/button-group.js
CHANGED
@@ -12,7 +12,6 @@ import packageJson from '../package.json' with { type: 'json' };
|
|
12
12
|
import ButtonGroupButton from './button-group.button.js';
|
13
13
|
import styles from './button-group.styles.js';
|
14
14
|
import assertSlot from './library/assert-slot.js';
|
15
|
-
import shadowRootMode from './library/shadow-root-mode.js';
|
16
15
|
import final from './library/final.js';
|
17
16
|
import required from './library/required.js';
|
18
17
|
/**
|
@@ -32,10 +31,12 @@ let ButtonGroup = class ButtonGroup extends LitElement {
|
|
32
31
|
this.#defaultSlotElementRef = createRef();
|
33
32
|
this.#orientation = 'horizontal';
|
34
33
|
}
|
34
|
+
/* c8 ignore start */
|
35
35
|
static { this.shadowRootOptions = {
|
36
36
|
...LitElement.shadowRootOptions,
|
37
|
-
mode:
|
37
|
+
mode: window.navigator.webdriver ? 'open' : 'closed',
|
38
38
|
}; }
|
39
|
+
/* c8 ignore end */
|
39
40
|
static { this.styles = styles; }
|
40
41
|
/**
|
41
42
|
* @default undefined
|
package/dist/button.js
CHANGED
@@ -11,7 +11,6 @@ import { createRef, ref } from 'lit/directives/ref.js';
|
|
11
11
|
import { customElement, property, state } from 'lit/decorators.js';
|
12
12
|
import packageJson from '../package.json' with { type: 'json' };
|
13
13
|
import styles from './button.styles.js';
|
14
|
-
import shadowRootMode from './library/shadow-root-mode.js';
|
15
14
|
import final from './library/final.js';
|
16
15
|
import required from './library/required.js';
|
17
16
|
/**
|
@@ -36,11 +35,13 @@ import required from './library/required.js';
|
|
36
35
|
*/
|
37
36
|
let Button = class Button extends LitElement {
|
38
37
|
static { this.formAssociated = true; }
|
38
|
+
/* c8 ignore start */
|
39
39
|
static { this.shadowRootOptions = {
|
40
40
|
...LitElement.shadowRootOptions,
|
41
41
|
delegatesFocus: true,
|
42
|
-
mode:
|
42
|
+
mode: window.navigator.webdriver ? 'open' : 'closed',
|
43
43
|
}; }
|
44
|
+
/* c8 ignore end */
|
44
45
|
static { this.styles = styles; }
|
45
46
|
// A getter and setter because Lit Analzyer doesn't recognize "aria-description"
|
46
47
|
// as a valid attribute on the `<button>` and doesn't provide a way to selectively
|
@@ -93,11 +94,8 @@ let Button = class Button extends LitElement {
|
|
93
94
|
${ref(this.#buttonElementRef)}
|
94
95
|
>
|
95
96
|
<slot
|
96
|
-
class=${classMap({
|
97
|
-
'prefix-icon-slot': true,
|
98
|
-
hidden: this.variant === 'link',
|
99
|
-
})}
|
100
97
|
name="prefix-icon"
|
98
|
+
?hidden=${this.variant === 'link'}
|
101
99
|
@slotchange=${this.#onPrefixIconSlotChange}
|
102
100
|
${ref(this.#prefixIconSlotElementRef)}
|
103
101
|
>
|
@@ -110,11 +108,8 @@ let Button = class Button extends LitElement {
|
|
110
108
|
<span class="label">${this.label}</span>
|
111
109
|
|
112
110
|
<slot
|
113
|
-
class=${classMap({
|
114
|
-
'suffix-icon-slot': true,
|
115
|
-
hidden: this.variant === 'link',
|
116
|
-
})}
|
117
111
|
name="suffix-icon"
|
112
|
+
?hidden=${this.variant === 'link'}
|
118
113
|
@slotchange=${this.#onSuffixIconSlotChange}
|
119
114
|
${ref(this.#suffixIconSlotElementRef)}
|
120
115
|
>
|
package/dist/button.styles.js
CHANGED
@@ -174,23 +174,11 @@ export default [
|
|
174
174
|
white-space: inherit;
|
175
175
|
}
|
176
176
|
|
177
|
-
.prefix-icon-slot {
|
178
|
-
&.hidden {
|
179
|
-
display: none;
|
180
|
-
}
|
181
|
-
}
|
182
|
-
|
183
177
|
.label {
|
184
178
|
min-inline-size: 3ch;
|
185
179
|
overflow: hidden;
|
186
180
|
text-overflow: ellipsis;
|
187
181
|
white-space: inherit;
|
188
182
|
}
|
189
|
-
|
190
|
-
.suffix-icon-slot {
|
191
|
-
&.hidden {
|
192
|
-
display: none;
|
193
|
-
}
|
194
|
-
}
|
195
183
|
`,
|
196
184
|
];
|
package/dist/checkbox-group.js
CHANGED
@@ -16,7 +16,6 @@ import packageJson from '../package.json' with { type: 'json' };
|
|
16
16
|
import Checkbox from './checkbox.js';
|
17
17
|
import styles from './checkbox-group.styles.js';
|
18
18
|
import assertSlot from './library/assert-slot.js';
|
19
|
-
import shadowRootMode from './library/shadow-root-mode.js';
|
20
19
|
import final from './library/final.js';
|
21
20
|
import required from './library/required.js';
|
22
21
|
/**
|
@@ -64,10 +63,12 @@ import required from './library/required.js';
|
|
64
63
|
*/
|
65
64
|
let CheckboxGroup = class CheckboxGroup extends LitElement {
|
66
65
|
static { this.formAssociated = true; }
|
66
|
+
/* c8 ignore start */
|
67
67
|
static { this.shadowRootOptions = {
|
68
68
|
...LitElement.shadowRootOptions,
|
69
|
-
mode:
|
69
|
+
mode: window.navigator.webdriver ? 'open' : 'closed',
|
70
70
|
}; }
|
71
|
+
/* c8 ignore end */
|
71
72
|
static { this.styles = styles; }
|
72
73
|
/**
|
73
74
|
* @default false
|
@@ -298,7 +299,7 @@ let CheckboxGroup = class CheckboxGroup extends LitElement {
|
|
298
299
|
reportValidity() {
|
299
300
|
this.isReportValidityOrSubmit = true;
|
300
301
|
const isValid = this.#internals.reportValidity();
|
301
|
-
// Ensures
|
302
|
+
// Ensures getters referencing `this.validity.valid` re-run.
|
302
303
|
this.requestUpdate();
|
303
304
|
return isValid;
|
304
305
|
}
|
@@ -363,12 +364,12 @@ let CheckboxGroup = class CheckboxGroup extends LitElement {
|
|
363
364
|
this.isReportValidityOrSubmit = true;
|
364
365
|
const isFirstInvalidFormElement = this.form?.querySelector(':invalid') === this;
|
365
366
|
if (isFirstInvalidFormElement) {
|
366
|
-
// - `
|
367
|
-
//
|
368
|
-
//
|
367
|
+
// - `delegatesFocus` is preferred because it's declarative. But it's limited to
|
368
|
+
// focusing the first focusable element. That doesn't work for us because the first
|
369
|
+
// focusable element is the Tooltip when it's present.
|
369
370
|
//
|
370
371
|
// - Canceling this event means the input won't get focus, even if we were to use
|
371
|
-
// `
|
372
|
+
// `delegatesFocus`.
|
372
373
|
//
|
373
374
|
// - The browser will ignore this if Checkbox isn't the first invalid form control.
|
374
375
|
//
|
package/dist/checkbox.js
CHANGED
@@ -17,7 +17,6 @@ import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
17
17
|
import packageJson from '../package.json' with { type: 'json' };
|
18
18
|
import checkedIcon from './icons/checked.js';
|
19
19
|
import styles from './checkbox.styles.js';
|
20
|
-
import shadowRootMode from './library/shadow-root-mode.js';
|
21
20
|
import final from './library/final.js';
|
22
21
|
import required from './library/required.js';
|
23
22
|
/**
|
@@ -69,10 +68,12 @@ import required from './library/required.js';
|
|
69
68
|
*/
|
70
69
|
let Checkbox = class Checkbox extends LitElement {
|
71
70
|
static { this.formAssociated = true; }
|
71
|
+
/* c8 ignore start */
|
72
72
|
static { this.shadowRootOptions = {
|
73
73
|
...LitElement.shadowRootOptions,
|
74
|
-
mode:
|
74
|
+
mode: window.navigator.webdriver ? 'open' : 'closed',
|
75
75
|
}; }
|
76
|
+
/* c8 ignore end */
|
76
77
|
static { this.styles = styles; }
|
77
78
|
/**
|
78
79
|
* @default undefined
|
@@ -355,7 +356,7 @@ let Checkbox = class Checkbox extends LitElement {
|
|
355
356
|
reportValidity() {
|
356
357
|
this.privateIsReportValidityOrSubmit = true;
|
357
358
|
const isValid = this.#internals.reportValidity();
|
358
|
-
// Ensures
|
359
|
+
// Ensures getters referencing `this.validity.valid` re-run.
|
359
360
|
this.requestUpdate();
|
360
361
|
return isValid;
|
361
362
|
}
|
@@ -437,12 +438,12 @@ let Checkbox = class Checkbox extends LitElement {
|
|
437
438
|
this.privateIsReportValidityOrSubmit = true;
|
438
439
|
const isFirstInvalidFormElement = this.form?.querySelector(':invalid') === this;
|
439
440
|
if (isFirstInvalidFormElement) {
|
440
|
-
// - `
|
441
|
-
//
|
442
|
-
//
|
441
|
+
// - `delegatesFocus` is preferred because it's declarative. But it's limited to
|
442
|
+
// focusing the first focusable element. That doesn't work for us because the first
|
443
|
+
// focusable element is the Tooltip when it's present.
|
443
444
|
//
|
444
445
|
// - Canceling this event means the input won't get focus, even if we were to use
|
445
|
-
// `
|
446
|
+
// `delegatesFocus`.
|
446
447
|
//
|
447
448
|
// - The browser will ignore this if Checkbox isn't the first invalid form control.
|
448
449
|
//
|
package/dist/checkbox.styles.js
CHANGED
@@ -44,7 +44,7 @@ export default [
|
|
44
44
|
border-radius: var(--glide-core-rounding-base-radius-xxs);
|
45
45
|
box-sizing: border-box;
|
46
46
|
color: var(
|
47
|
-
--glide-core-private-color-checkbox-surface-background-selected
|
47
|
+
--glide-core-private-color-checkbox-surface-background-selected
|
48
48
|
);
|
49
49
|
display: flex;
|
50
50
|
flex-shrink: 0; /* Don't shrink when the summary wraps. */
|
package/dist/drawer.js
CHANGED
@@ -12,7 +12,6 @@ import { ifDefined } from 'lit/directives/if-defined.js';
|
|
12
12
|
import packageJson from '../package.json' with { type: 'json' };
|
13
13
|
import styles from './drawer.styles.js';
|
14
14
|
import assertSlot from './library/assert-slot.js';
|
15
|
-
import shadowRootMode from './library/shadow-root-mode.js';
|
16
15
|
import final from './library/final.js';
|
17
16
|
import required from './library/required.js';
|
18
17
|
/**
|
@@ -38,10 +37,12 @@ let Drawer = class Drawer extends LitElement {
|
|
38
37
|
this.#defaultSlotElementRef = createRef();
|
39
38
|
this.#isOpen = false;
|
40
39
|
}
|
40
|
+
/* c8 ignore start */
|
41
41
|
static { this.shadowRootOptions = {
|
42
42
|
...LitElement.shadowRootOptions,
|
43
|
-
mode:
|
43
|
+
mode: window.navigator.webdriver ? 'open' : 'closed',
|
44
44
|
}; }
|
45
|
+
/* c8 ignore end */
|
45
46
|
static { this.styles = styles; }
|
46
47
|
/**
|
47
48
|
* @default false
|
package/dist/dropdown.js
CHANGED
@@ -28,7 +28,6 @@ import magnifyingGlassIcon from './icons/magnifying-glass.js';
|
|
28
28
|
import pencilIcon from './icons/pencil.js';
|
29
29
|
import styles from './dropdown.styles.js';
|
30
30
|
import assertSlot from './library/assert-slot.js';
|
31
|
-
import shadowRootMode from './library/shadow-root-mode.js';
|
32
31
|
import final from './library/final.js';
|
33
32
|
import required from './library/required.js';
|
34
33
|
import uniqueId from './library/unique-id.js';
|
@@ -94,10 +93,12 @@ import uniqueId from './library/unique-id.js';
|
|
94
93
|
*/
|
95
94
|
let Dropdown = class Dropdown extends LitElement {
|
96
95
|
static { this.formAssociated = true; }
|
96
|
+
/* c8 ignore start */
|
97
97
|
static { this.shadowRootOptions = {
|
98
98
|
...LitElement.shadowRootOptions,
|
99
|
-
mode:
|
99
|
+
mode: window.navigator.webdriver ? 'open' : 'closed',
|
100
100
|
}; }
|
101
|
+
/* c8 ignore end */
|
101
102
|
static { this.styles = styles; }
|
102
103
|
/**
|
103
104
|
* @default false
|
@@ -918,9 +919,9 @@ let Dropdown = class Dropdown extends LitElement {
|
|
918
919
|
-->
|
919
920
|
</slot>
|
920
921
|
|
921
|
-
${when(this.#isShowValidationFeedback && this.validityMessage, () => html `<span class="validity-message" data-test="validity-message"
|
922
|
-
|
923
|
-
>`)}
|
922
|
+
${when(this.#isShowValidationFeedback && this.validityMessage, () => html `<span class="validity-message" data-test="validity-message">
|
923
|
+
${unsafeHTML(this.validityMessage)}
|
924
|
+
</span>`)}
|
924
925
|
</div>
|
925
926
|
</glide-core-private-label>
|
926
927
|
</div>`;
|
@@ -928,7 +929,7 @@ let Dropdown = class Dropdown extends LitElement {
|
|
928
929
|
reportValidity() {
|
929
930
|
this.isReportValidityOrSubmit = true;
|
930
931
|
const isValid = this.#internals.reportValidity();
|
931
|
-
// Ensures
|
932
|
+
// Ensures getters referencing `this.validity.valid` re-run.
|
932
933
|
this.requestUpdate();
|
933
934
|
return isValid;
|
934
935
|
}
|
@@ -1095,7 +1096,7 @@ let Dropdown = class Dropdown extends LitElement {
|
|
1095
1096
|
// We only want to focus the input if the "invalid" event resulted from either:
|
1096
1097
|
//
|
1097
1098
|
// 1. A form submission.
|
1098
|
-
// 2. A call of `reportValidity()` that did not result from
|
1099
|
+
// 2. A call of `reportValidity()` that did not result from Dropdown's "blur"
|
1099
1100
|
// event.
|
1100
1101
|
if (this.isCheckingValidity || this.isBlurring) {
|
1101
1102
|
return;
|
@@ -1104,7 +1105,7 @@ let Dropdown = class Dropdown extends LitElement {
|
|
1104
1105
|
const isFirstInvalidFormElement = this.form?.querySelector(':invalid') === this;
|
1105
1106
|
if (isFirstInvalidFormElement) {
|
1106
1107
|
// Canceling the event means Dropdown won't get focus, even if we were to use
|
1107
|
-
// `
|
1108
|
+
// `delegatesFocus`. So we have to focus manually.
|
1108
1109
|
this.focus();
|
1109
1110
|
}
|
1110
1111
|
});
|
@@ -1461,8 +1462,7 @@ let Dropdown = class Dropdown extends LitElement {
|
|
1461
1462
|
this.#inputElementRef.value.value = this.activeOption.label;
|
1462
1463
|
this.inputValue = this.activeOption.label;
|
1463
1464
|
// One is subtracted to account for an apparent Chrome bug where `scrollWidth`
|
1464
|
-
// is off by one relative to `clientWidth` when they should be the same.
|
1465
|
-
// happens whenever the input field was overflowing and now isn't.
|
1465
|
+
// is off by one relative to `clientWidth` when they should be the same.
|
1466
1466
|
this.isInputOverflowing =
|
1467
1467
|
this.#inputElementRef.value.scrollWidth - 1 >
|
1468
1468
|
this.#inputElementRef.value.clientWidth;
|
@@ -1874,7 +1874,9 @@ let Dropdown = class Dropdown extends LitElement {
|
|
1874
1874
|
#onInputResize() {
|
1875
1875
|
if (this.#inputElementRef.value) {
|
1876
1876
|
this.isInputOverflowing =
|
1877
|
-
|
1877
|
+
// One is subtracted to account for an apparent Chrome bug where `scrollWidth`
|
1878
|
+
// is off by one relative to `clientWidth` when they should be the same.
|
1879
|
+
this.#inputElementRef.value.scrollWidth - 1 >
|
1878
1880
|
this.#inputElementRef.value.clientWidth;
|
1879
1881
|
}
|
1880
1882
|
}
|
@@ -1949,8 +1951,7 @@ let Dropdown = class Dropdown extends LitElement {
|
|
1949
1951
|
this.#inputElementRef.value.value = option.label;
|
1950
1952
|
this.inputValue = option.label;
|
1951
1953
|
// One is subtracted to account for an apparent Chrome bug where `scrollWidth`
|
1952
|
-
// is off by one relative to `clientWidth` when they should be the same.
|
1953
|
-
// happens whenever the input field was overflowing and now isn't.
|
1954
|
+
// is off by one relative to `clientWidth` when they should be the same.
|
1954
1955
|
this.isInputOverflowing =
|
1955
1956
|
this.#inputElementRef.value.scrollWidth - 1 >
|
1956
1957
|
this.#inputElementRef.value.clientWidth;
|
@@ -2007,8 +2008,7 @@ let Dropdown = class Dropdown extends LitElement {
|
|
2007
2008
|
this.lastSelectedAndEnabledOption?.label ?? '';
|
2008
2009
|
this.inputValue = this.lastSelectedAndEnabledOption?.label ?? '';
|
2009
2010
|
// One is subtracted to account for an apparent Chrome bug where `scrollWidth`
|
2010
|
-
// is off by one relative to `clientWidth` when they should be the same.
|
2011
|
-
// happens whenever the input field was overflowing and now isn't.
|
2011
|
+
// is off by one relative to `clientWidth` when they should be the same.
|
2012
2012
|
this.isInputOverflowing =
|
2013
2013
|
this.#inputElementRef.value.scrollWidth - 1 >
|
2014
2014
|
this.#inputElementRef.value.clientWidth;
|
@@ -2077,8 +2077,7 @@ let Dropdown = class Dropdown extends LitElement {
|
|
2077
2077
|
this.#inputElementRef.value.value = event.target.label;
|
2078
2078
|
this.inputValue = event.target.label;
|
2079
2079
|
// One is subtracted to account for an apparent Chrome bug where `scrollWidth`
|
2080
|
-
// is off by one relative to `clientWidth` when they should be the same.
|
2081
|
-
// happens whenever the input field was overflowing and now isn't.
|
2080
|
+
// is off by one relative to `clientWidth` when they should be the same.
|
2082
2081
|
this.isInputOverflowing =
|
2083
2082
|
this.#inputElementRef.value.scrollWidth - 1 >
|
2084
2083
|
this.#inputElementRef.value.clientWidth;
|
@@ -2116,8 +2115,10 @@ let Dropdown = class Dropdown extends LitElement {
|
|
2116
2115
|
this.#inputElementRef.value.value =
|
2117
2116
|
this.lastSelectedAndEnabledOption.label;
|
2118
2117
|
this.inputValue = this.lastSelectedAndEnabledOption.label;
|
2118
|
+
// One is subtracted to account for an apparent Chrome bug where `scrollWidth`
|
2119
|
+
// is off by one relative to `clientWidth` when they should be the same.
|
2119
2120
|
this.isInputOverflowing =
|
2120
|
-
this.#inputElementRef.value.scrollWidth >
|
2121
|
+
this.#inputElementRef.value.scrollWidth - 1 >
|
2121
2122
|
this.#inputElementRef.value.clientWidth;
|
2122
2123
|
}
|
2123
2124
|
else {
|
@@ -75,8 +75,10 @@ export default class DropdownOption extends LitElement {
|
|
75
75
|
private get lastSelectedAndEnabledOption();
|
76
76
|
click(): void;
|
77
77
|
connectedCallback(): void;
|
78
|
+
private get countSuffix();
|
78
79
|
disconnectedCallback(): void;
|
79
80
|
firstUpdated(): void;
|
81
|
+
private get isCountGreaterThanZero();
|
80
82
|
privateEdit(): void;
|
81
83
|
privateUpdateCheckbox(): Promise<void>;
|
82
84
|
render(): import("lit").TemplateResult<1>;
|
package/dist/dropdown.option.js
CHANGED
@@ -17,7 +17,6 @@ import checkedIcon from './icons/checked.js';
|
|
17
17
|
import pencilIcon from './icons/pencil.js';
|
18
18
|
import { LocalizeController } from './library/localize.js';
|
19
19
|
import styles from './dropdown.option.styles.js';
|
20
|
-
import shadowRootMode from './library/shadow-root-mode.js';
|
21
20
|
import final from './library/final.js';
|
22
21
|
import required from './library/required.js';
|
23
22
|
import uniqueId from './library/unique-id.js';
|
@@ -76,10 +75,12 @@ let DropdownOption = class DropdownOption extends LitElement {
|
|
76
75
|
this.#selected = false;
|
77
76
|
this.#value = '';
|
78
77
|
}
|
78
|
+
/* c8 ignore start */
|
79
79
|
static { this.shadowRootOptions = {
|
80
80
|
...LitElement.shadowRootOptions,
|
81
|
-
mode:
|
81
|
+
mode: window.navigator.webdriver ? 'open' : 'closed',
|
82
82
|
}; }
|
83
|
+
/* c8 ignore end */
|
83
84
|
static { this.styles = styles; }
|
84
85
|
/**
|
85
86
|
* @default undefined
|
@@ -199,6 +200,13 @@ let DropdownOption = class DropdownOption extends LitElement {
|
|
199
200
|
});
|
200
201
|
this.#intersectionObserver.observe(this);
|
201
202
|
}
|
203
|
+
get countSuffix() {
|
204
|
+
return typeof this.count === 'number' && this.count >= 0
|
205
|
+
? this.count >= 1000
|
206
|
+
? '999+'
|
207
|
+
: this.count.toString()
|
208
|
+
: '';
|
209
|
+
}
|
202
210
|
disconnectedCallback() {
|
203
211
|
super.disconnectedCallback();
|
204
212
|
this.#intersectionObserver?.disconnect();
|
@@ -208,6 +216,9 @@ let DropdownOption = class DropdownOption extends LitElement {
|
|
208
216
|
this.#checkboxElementRef.value.checked = this.selected && !this.disabled;
|
209
217
|
}
|
210
218
|
}
|
219
|
+
get isCountGreaterThanZero() {
|
220
|
+
return typeof this.count === 'number' && this.count >= 0;
|
221
|
+
}
|
211
222
|
privateEdit() {
|
212
223
|
this.dispatchEvent(new Event('edit', { bubbles: true, composed: true }));
|
213
224
|
}
|
@@ -274,7 +285,7 @@ let DropdownOption = class DropdownOption extends LitElement {
|
|
274
285
|
class=${classMap({
|
275
286
|
'edit-button': true,
|
276
287
|
active: this.privateIsEditActive,
|
277
|
-
count:
|
288
|
+
count: this.isCountGreaterThanZero,
|
278
289
|
disabled: this.disabled,
|
279
290
|
multiple: Boolean(this.isMultiple),
|
280
291
|
})}
|
@@ -286,7 +297,7 @@ let DropdownOption = class DropdownOption extends LitElement {
|
|
286
297
|
${pencilIcon}
|
287
298
|
</button>`;
|
288
299
|
})}
|
289
|
-
${when(this.
|
300
|
+
${when(this.isCountGreaterThanZero, () => {
|
290
301
|
return html `<div
|
291
302
|
class=${classMap({
|
292
303
|
'count-container': true,
|
@@ -294,15 +305,7 @@ let DropdownOption = class DropdownOption extends LitElement {
|
|
294
305
|
})}
|
295
306
|
data-test="count-container"
|
296
307
|
>
|
297
|
-
${
|
298
|
-
// `this.count` is guaranteed to be defined by the `when()` above.
|
299
|
-
//
|
300
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
301
|
-
this.count >= 1000, () => {
|
302
|
-
return '999+';
|
303
|
-
}, () => {
|
304
|
-
return this.count;
|
305
|
-
})}
|
308
|
+
${this.countSuffix}
|
306
309
|
</div>`;
|
307
310
|
})}
|
308
311
|
`;
|
@@ -311,7 +314,7 @@ let DropdownOption = class DropdownOption extends LitElement {
|
|
311
314
|
<div
|
312
315
|
class=${classMap({
|
313
316
|
option: true,
|
314
|
-
count:
|
317
|
+
count: this.isCountGreaterThanZero,
|
315
318
|
disabled: this.disabled,
|
316
319
|
editable: this.editable,
|
317
320
|
})}
|
@@ -369,7 +372,7 @@ let DropdownOption = class DropdownOption extends LitElement {
|
|
369
372
|
class=${classMap({
|
370
373
|
'edit-button': true,
|
371
374
|
active: this.privateActive && this.privateIsEditActive,
|
372
|
-
count:
|
375
|
+
count: this.isCountGreaterThanZero,
|
373
376
|
disabled: this.disabled,
|
374
377
|
})}
|
375
378
|
data-test="edit-button"
|
@@ -381,7 +384,7 @@ let DropdownOption = class DropdownOption extends LitElement {
|
|
381
384
|
</button>`;
|
382
385
|
})}
|
383
386
|
|
384
|
-
${when(this.
|
387
|
+
${when(this.isCountGreaterThanZero, () => {
|
385
388
|
return html `<div
|
386
389
|
class=${classMap({
|
387
390
|
'count-container': true,
|
@@ -389,15 +392,7 @@ let DropdownOption = class DropdownOption extends LitElement {
|
|
389
392
|
})}
|
390
393
|
data-test="count-container"
|
391
394
|
>
|
392
|
-
${
|
393
|
-
// `this.count` is guaranteed to be defined by the `when()` above.
|
394
|
-
//
|
395
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
396
|
-
this.count >= 1000, () => {
|
397
|
-
return '999+';
|
398
|
-
}, () => {
|
399
|
-
return this.count;
|
400
|
-
})}
|
395
|
+
${this.countSuffix}
|
401
396
|
</div>`;
|
402
397
|
})}
|
403
398
|
</div>
|
@@ -526,6 +521,12 @@ __decorate([
|
|
526
521
|
__decorate([
|
527
522
|
state()
|
528
523
|
], DropdownOption.prototype, "lastSelectedAndEnabledOption", null);
|
524
|
+
__decorate([
|
525
|
+
state()
|
526
|
+
], DropdownOption.prototype, "countSuffix", null);
|
527
|
+
__decorate([
|
528
|
+
state()
|
529
|
+
], DropdownOption.prototype, "isCountGreaterThanZero", null);
|
529
530
|
__decorate([
|
530
531
|
state()
|
531
532
|
], DropdownOption.prototype, "isLabelOverflow", void 0);
|
@@ -17,7 +17,6 @@ import Slider from './slider.js';
|
|
17
17
|
import TextArea from './textarea.js';
|
18
18
|
import styles from './form-controls-layout.styles.js';
|
19
19
|
import assertSlot from './library/assert-slot.js';
|
20
|
-
import shadowRootMode from './library/shadow-root-mode.js';
|
21
20
|
import final from './library/final.js';
|
22
21
|
/**
|
23
22
|
* @attr {'left'|'middle'|'right'} [split='left']
|
@@ -34,10 +33,12 @@ let FormControlsLayout = class FormControlsLayout extends LitElement {
|
|
34
33
|
this.#slotElementRef = createRef();
|
35
34
|
this.#split = 'left';
|
36
35
|
}
|
36
|
+
/* c8 ignore start */
|
37
37
|
static { this.shadowRootOptions = {
|
38
38
|
...LitElement.shadowRootOptions,
|
39
|
-
mode:
|
39
|
+
mode: window.navigator.webdriver ? 'open' : 'closed',
|
40
40
|
}; }
|
41
|
+
/* c8 ignore end */
|
41
42
|
static { this.styles = styles; }
|
42
43
|
/**
|
43
44
|
* @default 'left'
|
package/dist/icon-button.js
CHANGED
@@ -12,7 +12,6 @@ import { ifDefined } from 'lit/directives/if-defined.js';
|
|
12
12
|
import packageJson from '../package.json' with { type: 'json' };
|
13
13
|
import styles from './icon-button.styles.js';
|
14
14
|
import assertSlot from './library/assert-slot.js';
|
15
|
-
import shadowRootMode from './library/shadow-root-mode.js';
|
16
15
|
import final from './library/final.js';
|
17
16
|
import required from './library/required.js';
|
18
17
|
/**
|
@@ -42,10 +41,11 @@ let IconButton = class IconButton extends LitElement {
|
|
42
41
|
this.#buttonElementRef = createRef();
|
43
42
|
this.#defaultSlotElementRef = createRef();
|
44
43
|
}
|
44
|
+
/* c8 ignore start */
|
45
45
|
static { this.shadowRootOptions = {
|
46
46
|
...LitElement.shadowRootOptions,
|
47
47
|
delegatesFocus: true,
|
48
|
-
mode:
|
48
|
+
mode: window.navigator.webdriver ? 'open' : 'closed',
|
49
49
|
}; }
|
50
50
|
static { this.styles = styles; }
|
51
51
|
// A getter and setter because Lit Analzyer doesn't recognize "aria-description"
|
package/dist/inline-alert.js
CHANGED
@@ -15,7 +15,6 @@ import severityInformationalIcon from './icons/severity-informational.js';
|
|
15
15
|
import severityMediumIcon from './icons/severity-medium.js';
|
16
16
|
import severityCriticalIcon from './icons/severity-critical.js';
|
17
17
|
import assertSlot from './library/assert-slot.js';
|
18
|
-
import shadowRootMode from './library/shadow-root-mode.js';
|
19
18
|
import final from './library/final.js';
|
20
19
|
/**
|
21
20
|
* @attr {'informational'|'medium'|'high'|'critical'} [variant='informational']
|
@@ -33,10 +32,12 @@ let InlineAlert = class InlineAlert extends LitElement {
|
|
33
32
|
this.#animationDuration = 100;
|
34
33
|
this.#componentElementRef = createRef();
|
35
34
|
}
|
35
|
+
/* c8 ignore start */
|
36
36
|
static { this.shadowRootOptions = {
|
37
37
|
...LitElement.shadowRootOptions,
|
38
|
-
mode:
|
38
|
+
mode: window.navigator.webdriver ? 'open' : 'closed',
|
39
39
|
}; }
|
40
|
+
/* c8 ignore end */
|
40
41
|
static { this.styles = styles; }
|
41
42
|
firstUpdated() {
|
42
43
|
this.#componentElementRef.value?.addEventListener('animationend', () => {
|
package/dist/input.js
CHANGED
@@ -19,7 +19,6 @@ import { LocalizeController } from './library/localize.js';
|
|
19
19
|
import magnifyingGlassIcon from './icons/magnifying-glass.js';
|
20
20
|
import styles from './input.styles.js';
|
21
21
|
import xIcon from './icons/x.js';
|
22
|
-
import shadowRootMode from './library/shadow-root-mode.js';
|
23
22
|
import final from './library/final.js';
|
24
23
|
import required from './library/required.js';
|
25
24
|
/**
|
@@ -82,9 +81,10 @@ import required from './library/required.js';
|
|
82
81
|
*/
|
83
82
|
let Input = class Input extends LitElement {
|
84
83
|
static { this.formAssociated = true; }
|
84
|
+
/* c8 ignore start */
|
85
85
|
static { this.shadowRootOptions = {
|
86
86
|
...LitElement.shadowRootOptions,
|
87
|
-
mode:
|
87
|
+
mode: window.navigator.webdriver ? 'open' : 'closed',
|
88
88
|
delegatesFocus: true,
|
89
89
|
}; }
|
90
90
|
static { this.styles = styles; }
|
@@ -318,7 +318,7 @@ let Input = class Input extends LitElement {
|
|
318
318
|
reportValidity() {
|
319
319
|
this.isReportValidityOrSubmit = true;
|
320
320
|
const isValid = this.#internals.reportValidity();
|
321
|
-
// Ensures
|
321
|
+
// Ensures getters referencing `this.validity.valid` re-run.
|
322
322
|
this.requestUpdate();
|
323
323
|
return isValid;
|
324
324
|
}
|
@@ -397,12 +397,12 @@ let Input = class Input extends LitElement {
|
|
397
397
|
this.isReportValidityOrSubmit = true;
|
398
398
|
const isFirstInvalidFormElement = this.form?.querySelector(':invalid') === this;
|
399
399
|
if (isFirstInvalidFormElement) {
|
400
|
-
// - `
|
401
|
-
//
|
402
|
-
//
|
400
|
+
// - `delegatesFocus` is preferred because it's declarative. But it's limited to
|
401
|
+
// focusing the first focusable element. That doesn't work for us because the first
|
402
|
+
// focusable element is the Tooltip when it's present.
|
403
403
|
//
|
404
404
|
// - Canceling this event means the input won't get focus, even if we were to use
|
405
|
-
// `
|
405
|
+
// `delegatesFocus`.
|
406
406
|
//
|
407
407
|
// - The browser will ignore this if Input isn't the first invalid form control.
|
408
408
|
//
|