@crowdstrike/glide-core 0.6.5 → 0.8.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 (140) hide show
  1. package/README.md +44 -5
  2. package/dist/accordion.test.basics.js +1 -0
  3. package/dist/accordion.test.events.js +1 -0
  4. package/dist/button-group.button.test.basics.js +1 -0
  5. package/dist/button-group.button.test.events.js +1 -0
  6. package/dist/button-group.test.basics.js +1 -0
  7. package/dist/button-group.test.events.js +1 -0
  8. package/dist/button.test.basics.js +1 -0
  9. package/dist/button.test.events.js +1 -0
  10. package/dist/button.test.form.js +1 -0
  11. package/dist/checkbox-group.d.ts +1 -0
  12. package/dist/checkbox-group.js +1 -1
  13. package/dist/checkbox-group.test.basics.js +1 -0
  14. package/dist/checkbox-group.test.events.js +1 -0
  15. package/dist/checkbox-group.test.focus.js +24 -0
  16. package/dist/checkbox-group.test.form.js +1 -0
  17. package/dist/checkbox-group.test.validity.js +1 -0
  18. package/dist/checkbox.d.ts +3 -1
  19. package/dist/checkbox.js +1 -1
  20. package/dist/checkbox.styles.js +4 -5
  21. package/dist/checkbox.test.basics.js +1 -0
  22. package/dist/checkbox.test.events.js +1 -0
  23. package/dist/checkbox.test.focus.js +11 -0
  24. package/dist/checkbox.test.form.js +1 -0
  25. package/dist/checkbox.test.states.js +1 -0
  26. package/dist/checkbox.test.validity.js +1 -0
  27. package/dist/drawer.styles.js +4 -3
  28. package/dist/drawer.test.basics.js +1 -0
  29. package/dist/drawer.test.closing.js +1 -0
  30. package/dist/drawer.test.events.js +1 -0
  31. package/dist/drawer.test.floating-components.js +1 -0
  32. package/dist/drawer.test.methods.js +1 -0
  33. package/dist/dropdown.d.ts +1 -0
  34. package/dist/dropdown.js +1 -1
  35. package/dist/dropdown.option.d.ts +1 -0
  36. package/dist/dropdown.option.js +1 -1
  37. package/dist/dropdown.option.test.basics.js +1 -0
  38. package/dist/dropdown.option.test.basics.multiple.js +1 -0
  39. package/dist/dropdown.option.test.basics.single.js +1 -0
  40. package/dist/dropdown.option.test.events.js +1 -0
  41. package/dist/dropdown.option.test.interactions.multiple.js +1 -0
  42. package/dist/dropdown.option.test.interactions.single.js +1 -0
  43. package/dist/dropdown.styles.js +8 -4
  44. package/dist/dropdown.test.basics.filterable.js +1 -0
  45. package/dist/dropdown.test.basics.js +1 -0
  46. package/dist/dropdown.test.basics.multiple.js +1 -1
  47. package/dist/dropdown.test.basics.single.js +1 -1
  48. package/dist/dropdown.test.events.js +1 -0
  49. package/dist/dropdown.test.events.multiple.js +72 -5
  50. package/dist/dropdown.test.events.single.js +46 -5
  51. package/dist/dropdown.test.focus.js +11 -2
  52. package/dist/dropdown.test.focus.multiple.js +0 -1
  53. package/dist/dropdown.test.form.js +1 -0
  54. package/dist/dropdown.test.form.multiple.js +1 -0
  55. package/dist/dropdown.test.form.single.js +1 -0
  56. package/dist/dropdown.test.interactions.filterable.js +1 -0
  57. package/dist/dropdown.test.interactions.js +1 -0
  58. package/dist/dropdown.test.interactions.multiple.js +1 -1
  59. package/dist/dropdown.test.interactions.single.js +1 -0
  60. package/dist/dropdown.test.validity.js +1 -0
  61. package/dist/form-controls-layout.test.basics.js +1 -0
  62. package/dist/icon-button.test.basics.js +1 -0
  63. package/dist/input.d.ts +2 -1
  64. package/dist/input.js +1 -1
  65. package/dist/input.test.basics.js +1 -0
  66. package/dist/input.test.events.js +1 -0
  67. package/dist/input.test.focus.js +6 -3
  68. package/dist/input.test.form.js +1 -0
  69. package/dist/input.test.validity.js +1 -0
  70. package/dist/label.styles.js +11 -11
  71. package/dist/label.test.basics.js +1 -0
  72. package/dist/library/localize.d.ts +2 -0
  73. package/dist/library/ow.test.d.ts +2 -1
  74. package/dist/library/ow.test.js +8 -3
  75. package/dist/menu.button.test.basics.js +1 -0
  76. package/dist/menu.link.test.basics.js +1 -0
  77. package/dist/menu.options.test.basics.js +1 -0
  78. package/dist/menu.styles.js +4 -4
  79. package/dist/menu.test.basics.js +1 -0
  80. package/dist/menu.test.events.d.ts +1 -0
  81. package/dist/menu.test.events.js +2 -1
  82. package/dist/menu.test.focus.js +1 -0
  83. package/dist/menu.test.interactions.js +1 -0
  84. package/dist/modal.icon-button.test.basics.js +1 -0
  85. package/dist/modal.tertiary-icon.test.basics.js +1 -0
  86. package/dist/modal.test.accessibility.js +1 -0
  87. package/dist/modal.test.basics.js +1 -0
  88. package/dist/modal.test.close.js +1 -0
  89. package/dist/modal.test.events.js +1 -0
  90. package/dist/modal.test.floating-components.js +1 -0
  91. package/dist/modal.test.lock-scroll.js +1 -0
  92. package/dist/modal.test.methods.js +1 -0
  93. package/dist/modal.test.scrollbars.js +1 -0
  94. package/dist/radio-group.d.ts +1 -0
  95. package/dist/radio-group.js +1 -1
  96. package/dist/radio-group.test.basics.js +1 -0
  97. package/dist/radio-group.test.events.js +1 -0
  98. package/dist/radio-group.test.focus.js +20 -0
  99. package/dist/radio-group.test.form.js +1 -0
  100. package/dist/radio-group.test.validity.js +1 -0
  101. package/dist/split-button.test.basics.js +1 -0
  102. package/dist/split-container.test.basics.js +1 -0
  103. package/dist/split-link.test.basics.js +1 -0
  104. package/dist/split-link.test.interactions.js +1 -0
  105. package/dist/tab.d.ts +0 -2
  106. package/dist/tab.group.d.ts +3 -5
  107. package/dist/tab.group.js +1 -1
  108. package/dist/tab.group.styles.js +27 -13
  109. package/dist/tab.group.test.basics.js +7 -56
  110. package/dist/tab.group.test.interactions.d.ts +3 -0
  111. package/dist/tab.group.test.interactions.js +258 -0
  112. package/dist/tab.js +1 -1
  113. package/dist/tab.styles.js +7 -68
  114. package/dist/tab.test.basics.js +0 -20
  115. package/dist/tabs.stories.d.ts +1 -2
  116. package/dist/tag.test.basics.js +1 -0
  117. package/dist/textarea.d.ts +1 -0
  118. package/dist/textarea.js +2 -2
  119. package/dist/textarea.test.basics.js +1 -0
  120. package/dist/textarea.test.events.js +1 -0
  121. package/dist/textarea.test.form.js +1 -0
  122. package/dist/textarea.test.validity.js +14 -1
  123. package/dist/toggle.test.basics.js +1 -0
  124. package/dist/toggle.test.events.js +1 -0
  125. package/dist/toggle.test.states.js +1 -0
  126. package/dist/tooltip.test.basics.js +1 -0
  127. package/dist/tooltip.test.interactions.js +1 -0
  128. package/dist/translations/en.js +1 -1
  129. package/dist/translations/fr.js +1 -1
  130. package/dist/translations/ja.js +1 -1
  131. package/dist/tree.item.d.ts +4 -1
  132. package/dist/tree.item.js +1 -1
  133. package/dist/tree.item.menu.js +1 -1
  134. package/dist/tree.item.test.basics.js +12 -0
  135. package/dist/tree.js +1 -1
  136. package/dist/tree.stories.d.ts +1 -0
  137. package/dist/tree.test.basics.js +7 -0
  138. package/dist/tree.test.events.js +1 -1
  139. package/dist/tree.test.focus.js +32 -0
  140. package/package.json +39 -26
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './dropdown.option.js';
2
3
  import { expect, fixture, html } from '@open-wc/testing';
3
4
  import GlideCoreDropdown from './dropdown.js';
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './dropdown.option.js';
2
3
  import { ArgumentError } from 'ow';
3
4
  import { expect, fixture, html } from '@open-wc/testing';
@@ -1,7 +1,7 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './dropdown.option.js';
2
3
  import { expect, fixture, html } from '@open-wc/testing';
3
4
  import GlideCoreDropdown from './dropdown.js';
4
- import GlideCoreDropdownOption from './dropdown.option.js';
5
5
  GlideCoreDropdown.shadowRootOptions.mode = 'open';
6
6
  it('is accessible', async () => {
7
7
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" multiple>
@@ -1,6 +1,6 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import { expect, fixture, html } from '@open-wc/testing';
2
3
  import GlideCoreDropdown from './dropdown.js';
3
- import GlideCoreDropdownOption from './dropdown.option.js';
4
4
  GlideCoreDropdown.shadowRootOptions.mode = 'open';
5
5
  it('is accessible ', async () => {
6
6
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import * as sinon from 'sinon';
2
3
  import { aTimeout, expect, fixture, html, oneEvent } from '@open-wc/testing';
3
4
  import { sendKeys } from '@web/test-runner-commands';
@@ -1,5 +1,6 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import * as sinon from 'sinon';
2
- import { aTimeout, expect, fixture, html } from '@open-wc/testing';
3
+ import { aTimeout, expect, fixture, html, oneEvent } from '@open-wc/testing';
3
4
  import GlideCoreDropdown from './dropdown.js';
4
5
  import GlideCoreDropdownOption from './dropdown.option.js';
5
6
  GlideCoreDropdown.shadowRootOptions.mode = 'open';
@@ -62,7 +63,7 @@ it('dispatches one "input" event when Select All is clicked', async () => {
62
63
  await aTimeout(0);
63
64
  expect(spy.calledOnce).to.be.true;
64
65
  });
65
- it('dispatches one "change" event when `value` is changed programmatically', async () => {
66
+ it('does not dispatch a "change" event when `value` is changed programmatically', async () => {
66
67
  const component = await fixture(html `<glide-core-dropdown
67
68
  label="Label"
68
69
  placeholder="Placeholder"
@@ -91,9 +92,42 @@ it('dispatches one "change" event when `value` is changed programmatically', asy
91
92
  component.value = ['one', 'two'];
92
93
  });
93
94
  await aTimeout(0);
94
- expect(spy.calledOnce).to.be.true;
95
+ expect(spy.called).to.be.false;
96
+ });
97
+ it('continues to dispatch "change" events upon selection after `value` is changed programmatically', async () => {
98
+ const component = await fixture(html `<glide-core-dropdown
99
+ label="Label"
100
+ placeholder="Placeholder"
101
+ open
102
+ multiple
103
+ >
104
+ <glide-core-dropdown-option
105
+ label="One"
106
+ value="one"
107
+ ></glide-core-dropdown-option>
108
+
109
+ <glide-core-dropdown-option
110
+ label="Two"
111
+ value="two"
112
+ selected
113
+ ></glide-core-dropdown-option>
114
+
115
+ <glide-core-dropdown-option
116
+ label="Three"
117
+ value="three"
118
+ selected
119
+ ></glide-core-dropdown-option>
120
+ </glide-core-dropdown>`);
121
+ component.value = ['one', 'two'];
122
+ setTimeout(() => {
123
+ component
124
+ .querySelector('glide-core-dropdown-option:last-of-type')
125
+ ?.click();
126
+ });
127
+ const event = await oneEvent(component, 'change');
128
+ expect(event instanceof Event).to.be.true;
95
129
  });
96
- it('dispatches one "input" event when `value` is changed programmatically', async () => {
130
+ it('does not dispatch an "input" event when `value` is changed programmatically', async () => {
97
131
  const component = await fixture(html `<glide-core-dropdown
98
132
  label="Label"
99
133
  placeholder="Placeholder"
@@ -122,7 +156,40 @@ it('dispatches one "input" event when `value` is changed programmatically', asyn
122
156
  component.value = ['one', 'two'];
123
157
  });
124
158
  await aTimeout(0);
125
- expect(spy.calledOnce).to.be.true;
159
+ expect(spy.called).to.be.false;
160
+ });
161
+ it('continues to dispatch "input" events upon selection after `value` is changed programmatically', async () => {
162
+ const component = await fixture(html `<glide-core-dropdown
163
+ label="Label"
164
+ placeholder="Placeholder"
165
+ open
166
+ multiple
167
+ >
168
+ <glide-core-dropdown-option
169
+ label="One"
170
+ value="one"
171
+ ></glide-core-dropdown-option>
172
+
173
+ <glide-core-dropdown-option
174
+ label="Two"
175
+ value="two"
176
+ selected
177
+ ></glide-core-dropdown-option>
178
+
179
+ <glide-core-dropdown-option
180
+ label="Three"
181
+ value="three"
182
+ selected
183
+ ></glide-core-dropdown-option>
184
+ </glide-core-dropdown>`);
185
+ component.value = ['one', 'two'];
186
+ setTimeout(() => {
187
+ component
188
+ .querySelector('glide-core-dropdown-option:last-of-type')
189
+ ?.click();
190
+ });
191
+ const event = await oneEvent(component, 'input');
192
+ expect(event instanceof Event).to.be.true;
126
193
  });
127
194
  it('dispatches a "change" event when an option is selected after Select All is clicked', async () => {
128
195
  const component = await fixture(html `<glide-core-dropdown
@@ -1,9 +1,10 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './dropdown.option.js';
2
3
  import * as sinon from 'sinon';
3
- import { aTimeout, expect, fixture, html } from '@open-wc/testing';
4
+ import { aTimeout, expect, fixture, html, oneEvent } from '@open-wc/testing';
4
5
  import GlideCoreDropdown from './dropdown.js';
5
6
  GlideCoreDropdown.shadowRootOptions.mode = 'open';
6
- it('dispatches one "change" event when `value` is changed programmatically', async () => {
7
+ it('does not dispatch a "change" event when `value` is changed programmatically', async () => {
7
8
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
8
9
  <glide-core-dropdown-option
9
10
  label="One"
@@ -22,9 +23,29 @@ it('dispatches one "change" event when `value` is changed programmatically', asy
22
23
  component.value = ['one'];
23
24
  });
24
25
  await aTimeout(0);
25
- expect(spy.calledOnce).to.be.true;
26
+ expect(spy.called).to.be.false;
26
27
  });
27
- it('dispatches one "input" event when `value` is changed programmatically', async () => {
28
+ it('continues to dispatch "change" events upon selection after `value` is changed programmatically', async () => {
29
+ const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
30
+ <glide-core-dropdown-option
31
+ label="One"
32
+ value="one"
33
+ ></glide-core-dropdown-option>
34
+
35
+ <glide-core-dropdown-option
36
+ label="Two"
37
+ value="two"
38
+ selected
39
+ ></glide-core-dropdown-option>
40
+ </glide-core-dropdown>`);
41
+ component.value = ['two'];
42
+ setTimeout(() => {
43
+ component.querySelector('glide-core-dropdown-option')?.click();
44
+ });
45
+ const event = await oneEvent(component, 'change');
46
+ expect(event instanceof Event).to.be.true;
47
+ });
48
+ it('does not dispatch an "input" event when `value` is changed programmatically', async () => {
28
49
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
29
50
  <glide-core-dropdown-option
30
51
  label="One"
@@ -43,5 +64,25 @@ it('dispatches one "input" event when `value` is changed programmatically', asyn
43
64
  component.value = ['one'];
44
65
  });
45
66
  await aTimeout(0);
46
- expect(spy.calledOnce).to.be.true;
67
+ expect(spy.called).to.be.false;
68
+ });
69
+ it('continues to dispatch "input" events upon selection after `value` is changed programmatically', async () => {
70
+ const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
71
+ <glide-core-dropdown-option
72
+ label="One"
73
+ value="one"
74
+ ></glide-core-dropdown-option>
75
+
76
+ <glide-core-dropdown-option
77
+ label="Two"
78
+ value="two"
79
+ selected
80
+ ></glide-core-dropdown-option>
81
+ </glide-core-dropdown>`);
82
+ component.value = ['two'];
83
+ setTimeout(() => {
84
+ component.querySelector('glide-core-dropdown-option')?.click();
85
+ });
86
+ const event = await oneEvent(component, 'input');
87
+ expect(event instanceof Event).to.be.true;
47
88
  });
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './dropdown.option.js';
2
3
  import { expect, fixture, html } from '@open-wc/testing';
3
4
  import { sendKeys } from '@web/test-runner-commands';
@@ -5,9 +6,14 @@ import GlideCoreDropdown from './dropdown.js';
5
6
  import GlideCoreDropdownOption from './dropdown.option.js';
6
7
  GlideCoreDropdown.shadowRootOptions.mode = 'open';
7
8
  GlideCoreDropdownOption.shadowRootOptions.mode = 'open';
8
- it('closes when it loses focus', async () => {
9
+ it('closes and reports validity when it loses focus', async () => {
9
10
  const div = document.createElement('div');
10
- const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
11
+ const component = await fixture(html `<glide-core-dropdown
12
+ label="Label"
13
+ placeholder="Placeholder"
14
+ open
15
+ required
16
+ >
11
17
  <glide-core-dropdown-option
12
18
  label="Label"
13
19
  value="value"
@@ -25,4 +31,7 @@ it('closes when it loses focus', async () => {
25
31
  await sendKeys({ down: 'Shift' });
26
32
  await sendKeys({ press: 'Tab' });
27
33
  expect(component.open).to.be.false;
34
+ expect(component.shadowRoot?.activeElement).to.equal(null);
35
+ expect(component.validity.valid).to.equal(false);
36
+ expect(component.shadowRoot?.querySelector('glide-core-label')?.error).to.equal(true);
28
37
  });
@@ -2,7 +2,6 @@ import './dropdown.option.js';
2
2
  import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
3
3
  import GlideCoreDropdown from './dropdown.js';
4
4
  import GlideCoreDropdownOption from './dropdown.option.js';
5
- import GlideCoreTag from './tag.js';
6
5
  GlideCoreDropdown.shadowRootOptions.mode = 'open';
7
6
  GlideCoreDropdownOption.shadowRootOptions.mode = 'open';
8
7
  it('focuses the button when `focus` is called', async () => {
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './dropdown.option.js';
2
3
  import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
3
4
  import GlideCoreDropdown from './dropdown.js';
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './dropdown.option.js';
2
3
  import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
3
4
  import GlideCoreDropdown from './dropdown.js';
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './dropdown.option.js';
2
3
  import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
3
4
  import GlideCoreDropdown from './dropdown.js';
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import { assert, elementUpdated, expect, fixture, html, } from '@open-wc/testing';
2
3
  import { sendKeys } from '@web/test-runner-commands';
3
4
  import GlideCoreDropdown from './dropdown.js';
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import { assert, expect, fixture, html } from '@open-wc/testing';
2
3
  import { sendKeys, sendMouse } from '@web/test-runner-commands';
3
4
  import GlideCoreDropdown from './dropdown.js';
@@ -1,9 +1,9 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import { assert, elementUpdated, expect, fixture, html, } from '@open-wc/testing';
2
3
  import { sendKeys } from '@web/test-runner-commands';
3
4
  import { sendMouse } from '@web/test-runner-commands';
4
5
  import GlideCoreDropdown from './dropdown.js';
5
6
  import GlideCoreDropdownOption from './dropdown.option.js';
6
- import GlideCoreTag from './tag.js';
7
7
  GlideCoreDropdown.shadowRootOptions.mode = 'open';
8
8
  GlideCoreDropdownOption.shadowRootOptions.mode = 'open';
9
9
  it('opens on click', async () => {
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import { ArgumentError } from 'ow';
2
3
  import { assert, elementUpdated, expect, fixture, html, } from '@open-wc/testing';
3
4
  import { sendKeys } from '@web/test-runner-commands';
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './dropdown.option.js';
2
3
  import { expect, fixture, html } from '@open-wc/testing';
3
4
  import GlideCoreDropdown from './dropdown.js';
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './checkbox.js';
2
3
  import './input.js';
3
4
  import { ArgumentError } from 'ow';
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './icon-button.js';
2
3
  import { ArgumentError } from 'ow';
3
4
  import { assert, expect, fixture, html } from '@open-wc/testing';
package/dist/input.d.ts CHANGED
@@ -61,7 +61,8 @@ export default class GlideCoreInput extends LitElement {
61
61
  get valueCharacterCount(): number;
62
62
  constructor();
63
63
  private hasFocus;
64
- private isCheckingValidity?;
64
+ private isBlurring;
65
+ private isCheckingValidity;
65
66
  private isReportValidityOrSubmit;
66
67
  private passwordVisible;
67
68
  }
package/dist/input.js CHANGED
@@ -1 +1 @@
1
- var __decorate=this&&this.__decorate||function(e,t,i,o){var r,s=arguments.length,a=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(r=e[l])&&(a=(s<3?r(a):s>3?r(t,i,a):r(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};import"./icon-button.js";import"./label.js";import{LitElement,html,nothing}from"lit";import{LocalizeController}from"./library/localize.js";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,queryAssignedNodes,state}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import magnifyingGlassIcon from"./icons/magnifying-glass.js";import ow from"./library/ow.js";import styles from"./input.styles.js";export const SUPPORTED_TYPES=["email","number","password","search","tel","text","url"];let GlideCoreInput=class GlideCoreInput extends LitElement{static{this.formAssociated=!0}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed",delegatesFocus:!0}}static{this.styles=styles}get form(){return this.#e.form}get validity(){return this.#e.validity}get willValidate(){return this.#e.willValidate}blur(){this.#t?.blur()}checkValidity(){return this.isCheckingValidity=!0,this.#e.checkValidity()}disconnectedCallback(){super.disconnectedCallback(),this.form?.removeEventListener("formdata",this.#i)}firstUpdated(){this.#o()}formAssociatedCallback(){this.form?.addEventListener("formdata",this.#i)}formResetCallback(){this.value=this.getAttribute("value")??""}get isTypeSearch(){return"search"===this.type}get hasClearIcon(){return this.clearable&&!this.disabled&&!this.readonly}get isClearIconVisible(){return this.hasClearIcon&&this.value.length>0}render(){return html`<glide-core-label class="${classMap({left:"left"===this.privateSplit,middle:"middle"===this.privateSplit})}" orientation="${this.orientation}" split="${ifDefined(this.privateSplit??void 0)}" ?disabled="${this.disabled}" ?error="${this.#r||this.#s}" ?hide="${this.hideLabel}" ?required="${this.required}"><slot name="tooltip" slot="tooltip"></slot><label for="input">${this.label}</label><div class="${classMap({"input-box":!0,focused:this.hasFocus,empty:""===this.value,disabled:this.disabled,readonly:this.readonly&&!this.disabled,error:this.#r||this.#s})}" slot="control"><slot name="prefix"></slot><input aria-describedby="meta" id="input" type="${"password"===this.type&&this.passwordVisible?"text":this.type}" .value="${this.value}" placeholder="${ifDefined(this.placeholder)}" autocapitalize="${ifDefined(this.autocapitalize)}" spellcheck="${this.spellcheck}" ?required="${this.required}" ?readonly="${this.readonly}" ?disabled="${this.disabled}" @focus="${this.#a}" @blur="${this.#l}" @change="${this.#n}" @input="${this.#d}" ${ref(this.#p)}> ${this.hasClearIcon?html`<glide-core-icon-button variant="tertiary" class="${classMap({"clear-icon-button":!0,"clear-icon-button--visible":this.isClearIconVisible})}" aria-label="${this.#h.term("clearEntry")}" @click="${this.#c}" tabindex="-1"><slot name="clear-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"><path d="M6 6L18 18" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M18 6L6 18" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></slot></glide-core-icon-button>`:""} ${"password"===this.type&&this.passwordToggle&&!this.disabled?html`<glide-core-icon-button variant="tertiary" class="password-toggle" aria-label="${this.passwordVisible?"Hide password":"Show password"}" aria-controls="input" aria-expanded="${this.passwordVisible?"true":"false"}" @click="${this.#u}" tabindex="-1">${this.passwordVisible?html`<svg width="16" height="16" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"/></svg>`:html`<svg width="16" height="16" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"/><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"/></svg>`}</glide-core-icon-button>`:""}<div class="suffix">${this.isTypeSearch?magnifyingGlassIcon:html`<slot name="suffix"></slot>`}</div></div><div class="meta" id="meta" slot="description"><slot class="description" name="description"></slot>${this.maxlength?html`<div class="${classMap({"character-count":!0,error:this.#s})}">${this.valueCharacterCount}/${this.maxlength}</div>`:nothing}</div></glide-core-label>`}reportValidity(){return this.#e.reportValidity()}get valueCharacterCount(){return this.value.length}constructor(){super(),this.type="text",this.value="",this.hideLabel=!1,this.orientation="horizontal",this.clearable=!1,this.spellcheck=!1,this.autocapitalize="on",this.passwordToggle=!1,this.required=!1,this.readonly=!1,this.disabled=!1,this.hasFocus=!1,this.isReportValidityOrSubmit=!1,this.passwordVisible=!1,this.#p=createRef(),this.#h=new LocalizeController(this),this.#i=({formData:e})=>{this.name&&this.value&&!this.disabled&&e.append(this.name,this.value)},this.#e=this.attachInternals(),this.addEventListener("invalid",(e=>{e?.preventDefault(),this.isCheckingValidity||(this.isReportValidityOrSubmit=!0,this.focus())}))}#p;#e;#h;#i;get#s(){return Boolean(this.maxlength&&this.valueCharacterCount>this.maxlength)}get#r(){return!this.disabled&&!this.validity?.valid&&this.isReportValidityOrSubmit}get#t(){return this.#p.value}#l(){this.hasFocus=!1}#n(e){ow(this.#t,ow.object.instanceOf(HTMLInputElement)),this.value=this.#t.value,this.#o(),this.dispatchEvent(new Event(e.type,e))}#c(e){this.value="",this.dispatchEvent(new Event("clear",{bubbles:!0})),this.#t?.focus(),this.#o(),e.stopPropagation()}#a(){this.hasFocus=!0}#d(){ow(this.#t,ow.object.instanceOf(HTMLInputElement)),this.value=this.#t.value,this.#o()}#u(){this.passwordVisible=!this.passwordVisible}async#o(){await this.updateComplete,this.#e.setValidity(this.#t?.validity,this.#t?.validationMessage,this.#t)}};__decorate([property()],GlideCoreInput.prototype,"type",void 0),__decorate([property({reflect:!0})],GlideCoreInput.prototype,"name",void 0),__decorate([property()],GlideCoreInput.prototype,"value",void 0),__decorate([property()],GlideCoreInput.prototype,"label",void 0),__decorate([property({attribute:"hide-label",type:Boolean})],GlideCoreInput.prototype,"hideLabel",void 0),__decorate([property({reflect:!0})],GlideCoreInput.prototype,"orientation",void 0),__decorate([property()],GlideCoreInput.prototype,"placeholder",void 0),__decorate([property({type:Boolean})],GlideCoreInput.prototype,"clearable",void 0),__decorate([property({type:Boolean})],GlideCoreInput.prototype,"spellcheck",void 0),__decorate([property()],GlideCoreInput.prototype,"autocapitalize",void 0),__decorate([property({attribute:"password-toggle",type:Boolean})],GlideCoreInput.prototype,"passwordToggle",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreInput.prototype,"required",void 0),__decorate([property({type:Boolean})],GlideCoreInput.prototype,"readonly",void 0),__decorate([property({type:Boolean})],GlideCoreInput.prototype,"disabled",void 0),__decorate([property()],GlideCoreInput.prototype,"privateSplit",void 0),__decorate([property({type:Number,converter:e=>e&&Number.parseInt(e,10)})],GlideCoreInput.prototype,"maxlength",void 0),__decorate([queryAssignedNodes({slot:"description"})],GlideCoreInput.prototype,"descriptionNodes",void 0),__decorate([queryAssignedNodes({slot:"prefix"})],GlideCoreInput.prototype,"prefixIconNodes",void 0),__decorate([queryAssignedNodes({slot:"suffix"})],GlideCoreInput.prototype,"suffixIconNodes",void 0),__decorate([state()],GlideCoreInput.prototype,"hasFocus",void 0),__decorate([state()],GlideCoreInput.prototype,"isCheckingValidity",void 0),__decorate([state()],GlideCoreInput.prototype,"isReportValidityOrSubmit",void 0),__decorate([state()],GlideCoreInput.prototype,"passwordVisible",void 0),GlideCoreInput=__decorate([customElement("glide-core-input")],GlideCoreInput);export default GlideCoreInput;
1
+ var __decorate=this&&this.__decorate||function(t,e,i,o){var r,s=arguments.length,a=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(r=t[l])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};import"./icon-button.js";import"./label.js";import{LitElement,html,nothing}from"lit";import{LocalizeController}from"./library/localize.js";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,queryAssignedNodes,state}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import magnifyingGlassIcon from"./icons/magnifying-glass.js";import ow from"./library/ow.js";import styles from"./input.styles.js";export const SUPPORTED_TYPES=["email","number","password","search","tel","text","url"];let GlideCoreInput=class GlideCoreInput extends LitElement{static{this.formAssociated=!0}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed",delegatesFocus:!0}}static{this.styles=styles}get form(){return this.#t.form}get validity(){return this.#t.validity}get willValidate(){return this.#t.willValidate}blur(){this.#e?.blur()}checkValidity(){this.isCheckingValidity=!0;const t=this.#t.checkValidity();return this.isCheckingValidity=!1,t}disconnectedCallback(){super.disconnectedCallback(),this.form?.removeEventListener("formdata",this.#i)}firstUpdated(){this.#o()}formAssociatedCallback(){this.form?.addEventListener("formdata",this.#i)}formResetCallback(){this.value=this.getAttribute("value")??""}get isTypeSearch(){return"search"===this.type}get hasClearIcon(){return this.clearable&&!this.disabled&&!this.readonly}get isClearIconVisible(){return this.hasClearIcon&&this.value.length>0}render(){return html`<glide-core-label class="${classMap({left:"left"===this.privateSplit,middle:"middle"===this.privateSplit})}" orientation="${this.orientation}" split="${ifDefined(this.privateSplit??void 0)}" ?disabled="${this.disabled}" ?error="${this.#r||this.#s}" ?hide="${this.hideLabel}" ?required="${this.required}"><slot name="tooltip" slot="tooltip"></slot><label for="input">${this.label}</label><div class="${classMap({"input-box":!0,focused:this.hasFocus,empty:""===this.value,disabled:this.disabled,readonly:this.readonly&&!this.disabled,error:this.#r||this.#s})}" slot="control"><slot name="prefix"></slot><input aria-describedby="meta" id="input" type="${"password"===this.type&&this.passwordVisible?"text":this.type}" .value="${this.value}" placeholder="${ifDefined(this.placeholder)}" autocapitalize="${ifDefined(this.autocapitalize)}" spellcheck="${this.spellcheck}" ?required="${this.required}" ?readonly="${this.readonly}" ?disabled="${this.disabled}" @focus="${this.#a}" @blur="${this.#l}" @change="${this.#n}" @input="${this.#d}" ${ref(this.#p)}> ${this.hasClearIcon?html`<glide-core-icon-button variant="tertiary" class="${classMap({"clear-icon-button":!0,"clear-icon-button--visible":this.isClearIconVisible})}" aria-label="${this.#h.term("clearEntry")}" @click="${this.#c}" tabindex="-1"><slot name="clear-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"><path d="M6 6L18 18" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M18 6L6 18" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></slot></glide-core-icon-button>`:""} ${"password"===this.type&&this.passwordToggle&&!this.disabled?html`<glide-core-icon-button variant="tertiary" class="password-toggle" aria-label="${this.passwordVisible?"Hide password":"Show password"}" aria-controls="input" aria-expanded="${this.passwordVisible?"true":"false"}" @click="${this.#u}" tabindex="-1">${this.passwordVisible?html`<svg width="16" height="16" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"/></svg>`:html`<svg width="16" height="16" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"/><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"/></svg>`}</glide-core-icon-button>`:""}<div class="suffix">${this.isTypeSearch?magnifyingGlassIcon:html`<slot name="suffix"></slot>`}</div></div><div class="meta" id="meta" slot="description"><slot class="description" name="description"></slot>${this.maxlength?html`<div class="${classMap({"character-count":!0,error:this.#s})}">${this.valueCharacterCount}/${this.maxlength}</div>`:nothing}</div></glide-core-label>`}reportValidity(){this.isReportValidityOrSubmit=!0;const t=this.#t.reportValidity();return this.requestUpdate(),t}get valueCharacterCount(){return this.value.length}constructor(){super(),this.type="text",this.value="",this.hideLabel=!1,this.orientation="horizontal",this.clearable=!1,this.spellcheck=!1,this.autocapitalize="on",this.passwordToggle=!1,this.required=!1,this.readonly=!1,this.disabled=!1,this.hasFocus=!1,this.isBlurring=!1,this.isCheckingValidity=!1,this.isReportValidityOrSubmit=!1,this.passwordVisible=!1,this.#p=createRef(),this.#h=new LocalizeController(this),this.#i=({formData:t})=>{this.name&&this.value&&!this.disabled&&t.append(this.name,this.value)},this.#t=this.attachInternals(),this.addEventListener("invalid",(t=>{if(t?.preventDefault(),this.isCheckingValidity||this.isBlurring)return;this.isReportValidityOrSubmit=!0;this.form?.querySelector(":invalid")===this&&this.focus()}))}#p;#t;#h;#i;get#s(){return Boolean(this.maxlength&&this.valueCharacterCount>this.maxlength)}get#r(){return!this.disabled&&!this.validity?.valid&&this.isReportValidityOrSubmit}get#e(){return this.#p.value}#l(){this.isBlurring=!0,this.reportValidity(),this.isBlurring=!1,this.hasFocus=!1}#n(t){ow(this.#e,ow.object.instanceOf(HTMLInputElement)),this.value=this.#e.value,this.#o(),this.dispatchEvent(new Event(t.type,t))}#c(t){this.value="",this.dispatchEvent(new Event("clear",{bubbles:!0})),this.#e?.focus(),this.#o(),t.stopPropagation()}#a(){this.hasFocus=!0}#d(){ow(this.#e,ow.object.instanceOf(HTMLInputElement)),this.value=this.#e.value,this.#o()}#u(){this.passwordVisible=!this.passwordVisible}async#o(){await this.updateComplete,this.#t.setValidity(this.#e?.validity,this.#e?.validationMessage,this.#e),this.isReportValidityOrSubmit&&this.reportValidity()}};__decorate([property()],GlideCoreInput.prototype,"type",void 0),__decorate([property({reflect:!0})],GlideCoreInput.prototype,"name",void 0),__decorate([property()],GlideCoreInput.prototype,"value",void 0),__decorate([property()],GlideCoreInput.prototype,"label",void 0),__decorate([property({attribute:"hide-label",type:Boolean})],GlideCoreInput.prototype,"hideLabel",void 0),__decorate([property({reflect:!0})],GlideCoreInput.prototype,"orientation",void 0),__decorate([property()],GlideCoreInput.prototype,"placeholder",void 0),__decorate([property({type:Boolean})],GlideCoreInput.prototype,"clearable",void 0),__decorate([property({type:Boolean})],GlideCoreInput.prototype,"spellcheck",void 0),__decorate([property()],GlideCoreInput.prototype,"autocapitalize",void 0),__decorate([property({attribute:"password-toggle",type:Boolean})],GlideCoreInput.prototype,"passwordToggle",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreInput.prototype,"required",void 0),__decorate([property({type:Boolean})],GlideCoreInput.prototype,"readonly",void 0),__decorate([property({type:Boolean})],GlideCoreInput.prototype,"disabled",void 0),__decorate([property()],GlideCoreInput.prototype,"privateSplit",void 0),__decorate([property({type:Number,converter:t=>t&&Number.parseInt(t,10)})],GlideCoreInput.prototype,"maxlength",void 0),__decorate([queryAssignedNodes({slot:"description"})],GlideCoreInput.prototype,"descriptionNodes",void 0),__decorate([queryAssignedNodes({slot:"prefix"})],GlideCoreInput.prototype,"prefixIconNodes",void 0),__decorate([queryAssignedNodes({slot:"suffix"})],GlideCoreInput.prototype,"suffixIconNodes",void 0),__decorate([state()],GlideCoreInput.prototype,"hasFocus",void 0),__decorate([state()],GlideCoreInput.prototype,"isBlurring",void 0),__decorate([state()],GlideCoreInput.prototype,"isCheckingValidity",void 0),__decorate([state()],GlideCoreInput.prototype,"isReportValidityOrSubmit",void 0),__decorate([state()],GlideCoreInput.prototype,"passwordVisible",void 0),GlideCoreInput=__decorate([customElement("glide-core-input")],GlideCoreInput);export default GlideCoreInput;
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import { expect, fixture, html } from '@open-wc/testing';
2
3
  import { sendKeys } from '@web/test-runner-commands';
3
4
  import GlideCoreInput from './input.js';
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './input.js';
2
3
  import * as sinon from 'sinon';
3
4
  import { aTimeout, expect, fixture, html, oneEvent } from '@open-wc/testing';
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './input.js';
2
3
  import { expect, fixture, html } from '@open-wc/testing';
3
4
  import Input from './input.js';
@@ -17,7 +18,7 @@ it('focuses the input after submit when required and no value', async () => {
17
18
  const inputElement = input.shadowRoot?.querySelector('input');
18
19
  expect(input.shadowRoot?.activeElement).to.be.equal(inputElement);
19
20
  });
20
- it('blurs the input if `blur` is called', async () => {
21
+ it('blurs the input and reports validity if `blur` is called', async () => {
21
22
  const input = await fixture(html `<glide-core-input required></glide-core-input>`);
22
23
  input.focus();
23
24
  const inputElement = input.shadowRoot?.querySelector('input');
@@ -25,6 +26,8 @@ it('blurs the input if `blur` is called', async () => {
25
26
  input.blur();
26
27
  await input.updateComplete;
27
28
  expect(input.shadowRoot?.activeElement).to.equal(null);
29
+ expect(input.validity.valid).to.equal(false);
30
+ expect(input.shadowRoot?.querySelector('glide-core-label')?.error).to.equal(true);
28
31
  });
29
32
  it('focuses the input after `reportValidity` is called when required and no value', async () => {
30
33
  const form = document.createElement('form');
@@ -42,7 +45,7 @@ it('focuses the input after `requestSubmit` is called when required and no value
42
45
  });
43
46
  form.requestSubmit();
44
47
  const inputElement = input.shadowRoot?.querySelector('input');
45
- expect(input.shadowRoot?.activeElement).to.equal(inputElement);
48
+ expect(input.shadowRoot?.activeElement === inputElement).to.be.true;
46
49
  });
47
50
  it('does not focus the input after `checkValidity` is called', async () => {
48
51
  const form = document.createElement('form');
@@ -50,5 +53,5 @@ it('does not focus the input after `checkValidity` is called', async () => {
50
53
  parentNode: form,
51
54
  });
52
55
  input.checkValidity();
53
- expect(input.shadowRoot?.activeElement).to.equal(null);
56
+ expect(input.shadowRoot?.activeElement === null).to.be.true;
54
57
  });
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './input.js';
2
3
  import { expect, fixture, html } from '@open-wc/testing';
3
4
  it('can be reset to initial value', async () => {
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './input.js';
2
3
  import { expect, fixture, html } from '@open-wc/testing';
3
4
  import { sendKeys } from '@web/test-runner-commands';
@@ -5,10 +5,10 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
5
5
  display: grid;
6
6
 
7
7
  /*
8
- Since 1fr is actually minmax(auto, 1fr), this explicit minmax will make it so
9
- the first column is sized to its content, and the second column fills the rest
10
- of the space.
11
- */
8
+ Since 1fr is actually minmax(auto, 1fr), this explicit minmax will make it so
9
+ the first column is sized to its content, and the second column fills the rest
10
+ of the space.
11
+ */
12
12
  grid-template-columns: auto minmax(0, 1fr);
13
13
  }
14
14
 
@@ -54,9 +54,9 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
54
54
 
55
55
  &.visible {
56
56
  /*
57
- The default is "display: content". But "order" does not work with
58
- "display: content" and "order" is needed above.
59
- */
57
+ The default is "display: content". But "order" does not work with
58
+ "display: content" and "order" is needed above.
59
+ */
60
60
  display: block;
61
61
  }
62
62
  }
@@ -68,10 +68,10 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
68
68
  color: var(--glide-core-text-body-1);
69
69
 
70
70
  /*
71
- Any "display" that's not inline-level will do. We don't want the button to
72
- acquire a line box, which will make it taller than its content and thus
73
- make it difficult to center vertically with the label.
74
- */
71
+ Any "display" that's not inline-level will do. We don't want the button to
72
+ acquire a line box, which will make it taller than its content and thus
73
+ make it difficult to center vertically with the label.
74
+ */
75
75
 
76
76
  display: flex;
77
77
  padding: 0;
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import { ArgumentError } from 'ow';
2
3
  import { expect, fixture, html, waitUntil } from '@open-wc/testing';
3
4
  import GlideCoreLabel from './label.js';
@@ -13,5 +13,7 @@ export interface Translation extends DefaultTranslation {
13
13
  clearEntry: string;
14
14
  moreInformation: string;
15
15
  notifications: string;
16
+ nextTab: string;
17
+ previousTab: string;
16
18
  removeTag: (name: string) => string;
17
19
  }
@@ -1,4 +1,5 @@
1
1
  import { LitElement } from 'lit';
2
2
  export default class GlideCoreSlot extends LitElement {
3
- render(): any;
3
+ static shadowRootOptions: ShadowRootInit;
4
+ render(): import("lit").TemplateResult<1>;
4
5
  }
@@ -1,24 +1,29 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
1
2
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
3
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
4
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
5
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
7
  };
7
- /* eslint-disable @crowdstrike/glide-core-eslint-plugin/prefer-closed-shadow-root */
8
- /* This is a test file that doesn't contain one of our components, so we don't need to enforce this rule. */
9
8
  import { LitElement } from 'lit';
10
9
  import { assert, expect, fixture, html } from '@open-wc/testing';
11
10
  import { customElement } from 'lit/decorators.js';
11
+ import { html as litHtml } from 'lit';
12
12
  import { owSlot, owSlotType } from './ow.js';
13
13
  let GlideCoreSlot = class GlideCoreSlot extends LitElement {
14
+ static { this.shadowRootOptions = {
15
+ ...LitElement.shadowRootOptions,
16
+ mode: 'closed',
17
+ }; }
14
18
  render() {
15
- return html `<slot></slot>`;
19
+ return litHtml `<slot></slot>`;
16
20
  }
17
21
  };
18
22
  GlideCoreSlot = __decorate([
19
23
  customElement('glide-core-slot')
20
24
  ], GlideCoreSlot);
21
25
  export default GlideCoreSlot;
26
+ GlideCoreSlot.shadowRootOptions.mode = 'open';
22
27
  it('throws when a slot lacks a node', async () => {
23
28
  const component = await fixture(html `<glide-core-slot></glide-core-slot>`);
24
29
  const slot = component.shadowRoot?.querySelector('slot');
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import { expect, fixture, html } from '@open-wc/testing';
2
3
  import GlideCoreMenuButton from './menu.button.js';
3
4
  GlideCoreMenuButton.shadowRootOptions.mode = 'open';
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import { expect, fixture, html } from '@open-wc/testing';
2
3
  import GlideCoreMenuLink from './menu.link.js';
3
4
  GlideCoreMenuLink.shadowRootOptions.mode = 'open';
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './menu.button.js';
2
3
  import './menu.link.js';
3
4
  import { ArgumentError } from 'ow';
@@ -31,10 +31,10 @@ import{css}from"lit";export default[css`
31
31
  visibility: hidden;
32
32
 
33
33
  /*
34
- ".container" is relative and many Menus may be stacked in a column.
35
- This ensures the ".menu" of Menus earlier in the column aren't obscured
36
- by the ".target-container" that come later.
37
- */
34
+ ".container" is relative and many Menus may be stacked in a column.
35
+ This ensures the ".menu" of Menus earlier in the column aren't obscured
36
+ by the ".target-container" that come later.
37
+ */
38
38
  z-index: 1;
39
39
 
40
40
  &.visible {
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './menu.button.js';
2
3
  import './menu.link.js';
3
4
  import { ArgumentError } from 'ow';
@@ -1,2 +1,3 @@
1
+ import './menu.js';
1
2
  import './menu.link.js';
2
3
  import './menu.options.js';
@@ -1,7 +1,8 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
2
+ import './menu.js';
1
3
  import './menu.link.js';
2
4
  import './menu.options.js';
3
5
  import { expect, fixture, html, oneEvent } from '@open-wc/testing';
4
- import GlideCoreMenu from './menu.js';
5
6
  it('dispatches a "click" event when a link is clicked', async () => {
6
7
  const component = await fixture(html `<glide-core-menu open>
7
8
  <button slot="target">Target</button>
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import './menu.link.js';
2
3
  import { assert, elementUpdated, expect, fixture, html, } from '@open-wc/testing';
3
4
  import { sendKeys } from '@web/test-runner-commands';
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
3
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
4
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
1
2
  import { ArgumentError } from 'ow';
2
3
  import { expect, fixture, html } from '@open-wc/testing';
3
4
  import GlideCoreModalIconButton from './modal.icon-button.js';