@crowdstrike/glide-core 0.32.3 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/accordion.js +3 -2
  2. package/dist/button-group.button.js +3 -2
  3. package/dist/button-group.js +3 -2
  4. package/dist/button.js +5 -10
  5. package/dist/button.styles.js +0 -12
  6. package/dist/checkbox-group.js +8 -7
  7. package/dist/checkbox.js +11 -9
  8. package/dist/checkbox.styles.js +1 -1
  9. package/dist/drawer.js +3 -2
  10. package/dist/dropdown.js +51 -45
  11. package/dist/dropdown.option.d.ts +2 -0
  12. package/dist/dropdown.option.js +26 -25
  13. package/dist/dropdown.styles.js +11 -2
  14. package/dist/form-controls-layout.js +3 -2
  15. package/dist/icon-button.js +2 -2
  16. package/dist/inline-alert.d.ts +4 -0
  17. package/dist/inline-alert.js +25 -6
  18. package/dist/input.js +7 -7
  19. package/dist/input.styles.js +3 -2
  20. package/dist/label.js +3 -2
  21. package/dist/library/assert-slot.js +2 -2
  22. package/dist/library/assert-slot.test.js +92 -0
  23. package/dist/library/localize.d.ts +1 -0
  24. package/dist/link.js +2 -2
  25. package/dist/menu.js +61 -30
  26. package/dist/menu.styles.js +1 -0
  27. package/dist/modal.icon-button.js +3 -2
  28. package/dist/modal.js +3 -2
  29. package/dist/option.d.ts +5 -0
  30. package/dist/option.js +28 -5
  31. package/dist/options.d.ts +2 -0
  32. package/dist/options.group.js +3 -2
  33. package/dist/options.js +7 -8
  34. package/dist/options.styles.js +0 -6
  35. package/dist/popover.js +3 -2
  36. package/dist/radio-group.js +4 -3
  37. package/dist/radio-group.radio.js +3 -2
  38. package/dist/select.d.ts +90 -0
  39. package/dist/select.js +532 -0
  40. package/dist/slider.js +3 -3
  41. package/dist/slider.styles.js +1 -3
  42. package/dist/spinner.js +2 -2
  43. package/dist/split-button.js +3 -2
  44. package/dist/split-button.primary-button.js +2 -2
  45. package/dist/split-button.primary-link.js +2 -2
  46. package/dist/split-button.secondary-button.js +2 -2
  47. package/dist/styles/opacity-and-scale-animation.js +2 -1
  48. package/dist/styles/variables.css +12 -8
  49. package/dist/tab.group.js +3 -2
  50. package/dist/tab.js +3 -2
  51. package/dist/tab.panel.js +3 -2
  52. package/dist/tag.d.ts +1 -0
  53. package/dist/tag.js +8 -2
  54. package/dist/tag.styles.js +9 -1
  55. package/dist/textarea.js +8 -7
  56. package/dist/textarea.styles.js +3 -2
  57. package/dist/toast.js +2 -2
  58. package/dist/toast.toasts.js +3 -2
  59. package/dist/toggle.js +3 -2
  60. package/dist/tooltip.container.js +3 -2
  61. package/dist/tooltip.js +6 -9
  62. package/dist/translations/en.js +1 -0
  63. package/dist/translations/fr.d.ts +1 -1
  64. package/dist/translations/fr.js +1 -0
  65. package/dist/translations/ja.d.ts +1 -1
  66. package/dist/translations/ja.js +1 -0
  67. package/package.json +4 -4
  68. package/dist/library/shadow-root-mode.d.ts +0 -2
  69. 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: shadowRootMode,
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: shadowRootMode,
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
@@ -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: shadowRootMode,
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: shadowRootMode,
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
  >
@@ -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
  ];
@@ -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: shadowRootMode,
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 that getters referencing `this.validity.valid` are updated.
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
- // - `this.#internals.delegatesFocus` is preferred because it's declarative. But
367
- // it's limited to focusing the first focusable element. That doesn't work for
368
- // us because our first focusable element is the tooltip when it's present.
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
- // `this.#internals.delegatesFocus`.
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: shadowRootMode,
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
@@ -237,7 +238,8 @@ let Checkbox = class Checkbox extends LitElement {
237
238
  disabled: this.disabled,
238
239
  })}
239
240
  >
240
- <div class="checked-icon">${checkedIcon}</div>
241
+ <div class="checked-icon" role="none">${checkedIcon}</div>
242
+
241
243
  ${icons.indeterminate}
242
244
  </div>
243
245
  </div>
@@ -287,7 +289,7 @@ let Checkbox = class Checkbox extends LitElement {
287
289
  Screenreaders will come across the tooltip naturally as focus moves toward
288
290
  the Checkbox.
289
291
  -->
290
- <div class="input-and-checkbox" slot="control">
292
+ <div class="input-and-checkbox" slot="control" role="none">
291
293
  <input
292
294
  aria-describedby="summary description"
293
295
  aria-invalid=${this.#isShowValidationFeedback}
@@ -355,7 +357,7 @@ let Checkbox = class Checkbox extends LitElement {
355
357
  reportValidity() {
356
358
  this.privateIsReportValidityOrSubmit = true;
357
359
  const isValid = this.#internals.reportValidity();
358
- // Ensures that getters referencing `this.validity.valid` are updated.
360
+ // Ensures getters referencing `this.validity.valid` re-run.
359
361
  this.requestUpdate();
360
362
  return isValid;
361
363
  }
@@ -437,12 +439,12 @@ let Checkbox = class Checkbox extends LitElement {
437
439
  this.privateIsReportValidityOrSubmit = true;
438
440
  const isFirstInvalidFormElement = this.form?.querySelector(':invalid') === this;
439
441
  if (isFirstInvalidFormElement) {
440
- // - `this.#internals.delegatesFocus` is preferred because it's declarative. But
441
- // it's limited to focusing the first focusable element. That doesn't work for
442
- // us because our first focusable element is the tooltip when it's present.
442
+ // - `delegatesFocus` is preferred because it's declarative. But it's limited to
443
+ // focusing the first focusable element. That doesn't work for us because the first
444
+ // focusable element is the Tooltip when it's present.
443
445
  //
444
446
  // - Canceling this event means the input won't get focus, even if we were to use
445
- // `this.#internals.delegatesFocus`.
447
+ // `delegatesFocus`.
446
448
  //
447
449
  // - The browser will ignore this if Checkbox isn't the first invalid form control.
448
450
  //
@@ -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--default
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: shadowRootMode,
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: shadowRootMode,
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
@@ -567,6 +568,7 @@ let Dropdown = class Dropdown extends LitElement {
567
568
  removable
568
569
  ?disabled=${this.disabled || this.readonly}
569
570
  ?private-editable=${option.editable}
571
+ ?private-readonly=${this.readonly}
570
572
  @edit=${this.#onTagEdit}
571
573
  @remove=${this.#onTagRemove.bind(this, option)}
572
574
  >
@@ -597,7 +599,11 @@ let Dropdown = class Dropdown extends LitElement {
597
599
  this.selectedAndEnabledOptions.length > this.tagOverflowLimit, () => {
598
600
  return html `<div
599
601
  aria-hidden="true"
600
- class="tag-overflow-text"
602
+ class=${classMap({
603
+ 'tag-overflow-text': true,
604
+ disabled: this.disabled,
605
+ readonly: this.readonly,
606
+ })}
601
607
  id="tag-overflow-text"
602
608
  >
603
609
  +
@@ -649,6 +655,7 @@ let Dropdown = class Dropdown extends LitElement {
649
655
  .isCommunicateItemCountToScreenreaders
650
656
  ? 'item-count'
651
657
  : ''}"
658
+ aria-required=${this.required}
652
659
  autocapitalize="off"
653
660
  autocomplete="off"
654
661
  class=${classMap({
@@ -754,32 +761,31 @@ let Dropdown = class Dropdown extends LitElement {
754
761
  ${pencilIcon}
755
762
  </glide-core-icon-button>`;
756
763
  })}
757
-
758
- <button
759
- aria-controls="options"
760
- aria-describedby="description"
761
- aria-expanded=${this.open && !this.disabled}
762
- aria-haspopup="listbox"
763
- aria-hidden=${this.filterable || this.isFilterable}
764
- aria-labelledby="selected-option-labels label loading-feedback"
765
- class="primary-button"
766
- data-test="primary-button"
767
- id="primary-button"
768
- tabindex=${this.filterable || this.isFilterable || this.disabled
769
- ? '-1'
770
- : '0'}
771
- type="button"
772
- ?disabled=${this.disabled}
773
- @focusin=${this.#onPrimaryButtonFocusin}
774
- @focusout=${this.#onPrimaryButtonFocusout}
775
- ${ref(this.#primaryButtonElementRef)}
776
- >
777
- ${when(this.isFiltering, () => {
778
- return html `<div data-test="magnifying-glass-icon">
779
- ${magnifyingGlassIcon}
780
- </div>`;
781
- }, () => chevronIcon)}
782
- </button>
764
+ ${when(!(this.disabled || this.readonly), () => {
765
+ return html `<button
766
+ aria-controls="options"
767
+ aria-describedby="description"
768
+ aria-expanded=${this.open}
769
+ aria-haspopup="listbox"
770
+ aria-hidden=${this.filterable || this.isFilterable}
771
+ aria-labelledby="selected-option-labels label loading-feedback"
772
+ aria-required=${this.required}
773
+ class="primary-button"
774
+ data-test="primary-button"
775
+ id="primary-button"
776
+ tabindex=${this.filterable || this.isFilterable ? '-1' : '0'}
777
+ type="button"
778
+ @focusin=${this.#onPrimaryButtonFocusin}
779
+ @focusout=${this.#onPrimaryButtonFocusout}
780
+ ${ref(this.#primaryButtonElementRef)}
781
+ >
782
+ ${when(this.isFiltering, () => {
783
+ return html `<div data-test="magnifying-glass-icon">
784
+ ${magnifyingGlassIcon}
785
+ </div>`;
786
+ }, () => chevronIcon)}
787
+ </button>`;
788
+ })}
783
789
  </div>
784
790
  </div>
785
791
 
@@ -918,9 +924,9 @@ let Dropdown = class Dropdown extends LitElement {
918
924
  -->
919
925
  </slot>
920
926
 
921
- ${when(this.#isShowValidationFeedback && this.validityMessage, () => html `<span class="validity-message" data-test="validity-message"
922
- >${unsafeHTML(this.validityMessage)}</span
923
- >`)}
927
+ ${when(this.#isShowValidationFeedback && this.validityMessage, () => html `<span class="validity-message" data-test="validity-message">
928
+ ${unsafeHTML(this.validityMessage)}
929
+ </span>`)}
924
930
  </div>
925
931
  </glide-core-private-label>
926
932
  </div>`;
@@ -928,7 +934,7 @@ let Dropdown = class Dropdown extends LitElement {
928
934
  reportValidity() {
929
935
  this.isReportValidityOrSubmit = true;
930
936
  const isValid = this.#internals.reportValidity();
931
- // Ensures that getters referencing `this.validity.valid` are updated.
937
+ // Ensures getters referencing `this.validity.valid` re-run.
932
938
  this.requestUpdate();
933
939
  return isValid;
934
940
  }
@@ -1095,7 +1101,7 @@ let Dropdown = class Dropdown extends LitElement {
1095
1101
  // We only want to focus the input if the "invalid" event resulted from either:
1096
1102
  //
1097
1103
  // 1. A form submission.
1098
- // 2. A call of `reportValidity()` that did not result from Checkbox's "blur"
1104
+ // 2. A call of `reportValidity()` that did not result from Dropdown's "blur"
1099
1105
  // event.
1100
1106
  if (this.isCheckingValidity || this.isBlurring) {
1101
1107
  return;
@@ -1104,7 +1110,7 @@ let Dropdown = class Dropdown extends LitElement {
1104
1110
  const isFirstInvalidFormElement = this.form?.querySelector(':invalid') === this;
1105
1111
  if (isFirstInvalidFormElement) {
1106
1112
  // Canceling the event means Dropdown won't get focus, even if we were to use
1107
- // `this.#internals.delegatesFocus`. So we have to focus manually.
1113
+ // `delegatesFocus`. So we have to focus manually.
1108
1114
  this.focus();
1109
1115
  }
1110
1116
  });
@@ -1461,8 +1467,7 @@ let Dropdown = class Dropdown extends LitElement {
1461
1467
  this.#inputElementRef.value.value = this.activeOption.label;
1462
1468
  this.inputValue = this.activeOption.label;
1463
1469
  // 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. It
1465
- // happens whenever the input field was overflowing and now isn't.
1470
+ // is off by one relative to `clientWidth` when they should be the same.
1466
1471
  this.isInputOverflowing =
1467
1472
  this.#inputElementRef.value.scrollWidth - 1 >
1468
1473
  this.#inputElementRef.value.clientWidth;
@@ -1874,7 +1879,9 @@ let Dropdown = class Dropdown extends LitElement {
1874
1879
  #onInputResize() {
1875
1880
  if (this.#inputElementRef.value) {
1876
1881
  this.isInputOverflowing =
1877
- this.#inputElementRef.value.scrollWidth >
1882
+ // One is subtracted to account for an apparent Chrome bug where `scrollWidth`
1883
+ // is off by one relative to `clientWidth` when they should be the same.
1884
+ this.#inputElementRef.value.scrollWidth - 1 >
1878
1885
  this.#inputElementRef.value.clientWidth;
1879
1886
  }
1880
1887
  }
@@ -1949,8 +1956,7 @@ let Dropdown = class Dropdown extends LitElement {
1949
1956
  this.#inputElementRef.value.value = option.label;
1950
1957
  this.inputValue = option.label;
1951
1958
  // 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. It
1953
- // happens whenever the input field was overflowing and now isn't.
1959
+ // is off by one relative to `clientWidth` when they should be the same.
1954
1960
  this.isInputOverflowing =
1955
1961
  this.#inputElementRef.value.scrollWidth - 1 >
1956
1962
  this.#inputElementRef.value.clientWidth;
@@ -2007,8 +2013,7 @@ let Dropdown = class Dropdown extends LitElement {
2007
2013
  this.lastSelectedAndEnabledOption?.label ?? '';
2008
2014
  this.inputValue = this.lastSelectedAndEnabledOption?.label ?? '';
2009
2015
  // 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. It
2011
- // happens whenever the input field was overflowing and now isn't.
2016
+ // is off by one relative to `clientWidth` when they should be the same.
2012
2017
  this.isInputOverflowing =
2013
2018
  this.#inputElementRef.value.scrollWidth - 1 >
2014
2019
  this.#inputElementRef.value.clientWidth;
@@ -2077,8 +2082,7 @@ let Dropdown = class Dropdown extends LitElement {
2077
2082
  this.#inputElementRef.value.value = event.target.label;
2078
2083
  this.inputValue = event.target.label;
2079
2084
  // 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. It
2081
- // happens whenever the input field was overflowing and now isn't.
2085
+ // is off by one relative to `clientWidth` when they should be the same.
2082
2086
  this.isInputOverflowing =
2083
2087
  this.#inputElementRef.value.scrollWidth - 1 >
2084
2088
  this.#inputElementRef.value.clientWidth;
@@ -2116,8 +2120,10 @@ let Dropdown = class Dropdown extends LitElement {
2116
2120
  this.#inputElementRef.value.value =
2117
2121
  this.lastSelectedAndEnabledOption.label;
2118
2122
  this.inputValue = this.lastSelectedAndEnabledOption.label;
2123
+ // One is subtracted to account for an apparent Chrome bug where `scrollWidth`
2124
+ // is off by one relative to `clientWidth` when they should be the same.
2119
2125
  this.isInputOverflowing =
2120
- this.#inputElementRef.value.scrollWidth >
2126
+ this.#inputElementRef.value.scrollWidth - 1 >
2121
2127
  this.#inputElementRef.value.clientWidth;
2122
2128
  }
2123
2129
  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>;
@@ -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: shadowRootMode,
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: Boolean(this.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.count && this.count > 0, () => {
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
- ${when(
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: Boolean(this.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: Boolean(this.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.count && this.count > 0, () => {
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
- ${when(
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);