@crowdstrike/glide-core 0.12.2 → 0.12.3

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 (32) hide show
  1. package/dist/checkbox-group.styles.js +1 -1
  2. package/dist/dropdown.d.ts +4 -1
  3. package/dist/dropdown.js +107 -55
  4. package/dist/dropdown.option.js +1 -1
  5. package/dist/dropdown.option.styles.js +4 -2
  6. package/dist/dropdown.option.test.interactions.multiple.js +2 -2
  7. package/dist/dropdown.option.test.interactions.single.js +2 -2
  8. package/dist/dropdown.styles.js +108 -13
  9. package/dist/dropdown.test.basics.filterable.js +11 -54
  10. package/dist/dropdown.test.basics.js +24 -244
  11. package/dist/dropdown.test.basics.multiple.js +13 -60
  12. package/dist/dropdown.test.basics.single.js +2 -8
  13. package/dist/dropdown.test.events.filterable.js +12 -54
  14. package/dist/dropdown.test.events.js +75 -49
  15. package/dist/dropdown.test.events.multiple.js +17 -87
  16. package/dist/dropdown.test.events.single.js +12 -60
  17. package/dist/dropdown.test.focus.filterable.js +11 -58
  18. package/dist/dropdown.test.focus.js +62 -9
  19. package/dist/dropdown.test.focus.multiple.js +22 -38
  20. package/dist/dropdown.test.focus.single.js +22 -17
  21. package/dist/dropdown.test.interactions.filterable.js +83 -69
  22. package/dist/dropdown.test.interactions.js +225 -243
  23. package/dist/dropdown.test.interactions.multiple.js +78 -274
  24. package/dist/dropdown.test.interactions.single.js +20 -85
  25. package/dist/dropdown.test.validity.js +12 -49
  26. package/dist/label.js +1 -1
  27. package/dist/label.styles.js +7 -3
  28. package/dist/radio-group.styles.js +1 -1
  29. package/dist/tab.group.styles.js +0 -6
  30. package/dist/tab.panel.styles.js +0 -3
  31. package/dist/textarea.styles.js +1 -1
  32. package/package.json +1 -1
@@ -9,10 +9,7 @@ GlideCoreDropdown.shadowRootOptions.mode = 'open';
9
9
  GlideCoreDropdownOption.shadowRootOptions.mode = 'open';
10
10
  it('opens on click', async () => {
11
11
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
12
- <glide-core-dropdown-option
13
- label="Label"
14
- value="value"
15
- ></glide-core-dropdown-option>
12
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
16
13
  </glide-core-dropdown>`);
17
14
  // Calling `click()` would be sweet. The problem is it sets `event.detail` to `0`,
18
15
  // which puts us in a guard in the event handler. `Event` has no `detail` property
@@ -29,10 +26,7 @@ it('opens on click', async () => {
29
26
  });
30
27
  it('toggles open and closed when the primary button is clicked', async () => {
31
28
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
32
- <glide-core-dropdown-option
33
- label="Label"
34
- value="value"
35
- ></glide-core-dropdown-option>
29
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
36
30
  </glide-core-dropdown>`);
37
31
  // Calling `click()` would be sweet. The problem is it sets `event.detail` to `0`,
38
32
  // which puts us in a guard in the event handler. `Event` has no `detail` property
@@ -48,10 +42,7 @@ it('toggles open and closed when the primary button is clicked', async () => {
48
42
  });
49
43
  it('does not toggle open and closed when the button overflow text is clicked', async () => {
50
44
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
51
- <glide-core-dropdown-option
52
- label="Label"
53
- value="value"
54
- ></glide-core-dropdown-option>
45
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
55
46
  </glide-core-dropdown>`);
56
47
  // Calling `click()` would be sweet. The problem is it sets `event.detail` to `0`,
57
48
  // which puts us in a guard in the event handler. `Event` has no `detail` property
@@ -68,10 +59,7 @@ it('does not toggle open and closed when the button overflow text is clicked', a
68
59
  });
69
60
  it('selects an option on click', async () => {
70
61
  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>
62
+ <glide-core-dropdown-option label="One"></glide-core-dropdown-option>
75
63
  </glide-core-dropdown>`);
76
64
  // Wait for it to open.
77
65
  await aTimeout(0);
@@ -139,10 +127,7 @@ it('does not deselect options on Space', async () => {
139
127
  });
140
128
  it('selects an option on Enter', async () => {
141
129
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
142
- <glide-core-dropdown-option
143
- label="One"
144
- value="one"
145
- ></glide-core-dropdown-option>
130
+ <glide-core-dropdown-option label="One"></glide-core-dropdown-option>
146
131
  </glide-core-dropdown>`);
147
132
  // Wait for it to open.
148
133
  await aTimeout(0);
@@ -153,15 +138,9 @@ it('selects an option on Enter', async () => {
153
138
  });
154
139
  it('deactivates all other options on "mouseover"', async () => {
155
140
  const component = await fixture(html `<glide-core-dropdown open>
156
- <glide-core-dropdown-option
157
- label="One"
158
- value="one"
159
- ></glide-core-dropdown-option>
141
+ <glide-core-dropdown-option label="One"></glide-core-dropdown-option>
160
142
 
161
- <glide-core-dropdown-option
162
- label="Two"
163
- value="two"
164
- ></glide-core-dropdown-option>
143
+ <glide-core-dropdown-option label="Two"></glide-core-dropdown-option>
165
144
  </glide-core-dropdown>`);
166
145
  const options = component.querySelectorAll('glide-core-dropdown-option');
167
146
  options[0]?.dispatchEvent(new MouseEvent('mouseover', { bubbles: true }));
@@ -171,10 +150,7 @@ it('deactivates all other options on "mouseover"', async () => {
171
150
  });
172
151
  it('closes when an option is selected via click', async () => {
173
152
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
174
- <glide-core-dropdown-option
175
- label="Label"
176
- value="value"
177
- ></glide-core-dropdown-option>
153
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
178
154
  </glide-core-dropdown>`);
179
155
  // Wait for it to open.
180
156
  await aTimeout(0);
@@ -183,10 +159,7 @@ it('closes when an option is selected via click', async () => {
183
159
  });
184
160
  it('closes when an option is selected via Space', async () => {
185
161
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
186
- <glide-core-dropdown-option
187
- label="Label"
188
- value="value"
189
- ></glide-core-dropdown-option>
162
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
190
163
  </glide-core-dropdown>`);
191
164
  // Wait for it to open.
192
165
  await aTimeout(0);
@@ -196,10 +169,7 @@ it('closes when an option is selected via Space', async () => {
196
169
  });
197
170
  it('closes when an option is selected via Enter', async () => {
198
171
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
199
- <glide-core-dropdown-option
200
- label="Label"
201
- value="value"
202
- ></glide-core-dropdown-option>
172
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
203
173
  </glide-core-dropdown>`);
204
174
  // Wait for it to open.
205
175
  await aTimeout(0);
@@ -209,10 +179,7 @@ it('closes when an option is selected via Enter', async () => {
209
179
  });
210
180
  it('closes when an option is selected via Enter', async () => {
211
181
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
212
- <glide-core-dropdown-option
213
- label="Label"
214
- value="value"
215
- ></glide-core-dropdown-option>
182
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
216
183
  </glide-core-dropdown>`);
217
184
  // Wait for it to open.
218
185
  await aTimeout(0);
@@ -222,10 +189,7 @@ it('closes when an option is selected via Enter', async () => {
222
189
  });
223
190
  it('closes when an option is selected via Space', async () => {
224
191
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
225
- <glide-core-dropdown-option
226
- label="Label"
227
- value="value"
228
- ></glide-core-dropdown-option>
192
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
229
193
  </glide-core-dropdown>`);
230
194
  // Wait for it to open.
231
195
  await aTimeout(0);
@@ -265,19 +229,11 @@ it('deselects all other options when one is newly selected', async () => {
265
229
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
266
230
  <glide-core-dropdown-option
267
231
  label="One"
268
- value="one"
269
232
  selected
270
233
  ></glide-core-dropdown-option>
271
234
 
272
- <glide-core-dropdown-option
273
- label="Two"
274
- value="two"
275
- ></glide-core-dropdown-option>
276
-
277
- <glide-core-dropdown-option
278
- label="Three"
279
- value="three"
280
- ></glide-core-dropdown-option>
235
+ <glide-core-dropdown-option label="Two"></glide-core-dropdown-option>
236
+ <glide-core-dropdown-option label="Three"></glide-core-dropdown-option>
281
237
  </glide-core-dropdown>`);
282
238
  component.shadowRoot
283
239
  ?.querySelector('[data-test="primary-button"]')
@@ -566,39 +522,25 @@ it('hides Select All', async () => {
566
522
  >
567
523
  <glide-core-dropdown-option
568
524
  label="One"
569
- value="one"
570
525
  selected
571
526
  ></glide-core-dropdown-option>
572
527
 
573
- <glide-core-dropdown-option
574
- label="Two"
575
- value="two"
576
- ></glide-core-dropdown-option>
528
+ <glide-core-dropdown-option label="Two"></glide-core-dropdown-option>
577
529
  </glide-core-dropdown>`);
578
530
  const selectAll = component.shadowRoot?.querySelector('[data-test="select-all"]');
579
531
  expect(selectAll?.checkVisibility()).to.not.be.ok;
580
532
  });
581
533
  it('cannot be tabbed to when `disabled`', async () => {
582
534
  await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" disabled>
583
- <glide-core-dropdown-option
584
- label="One"
585
- value="one"
586
- ></glide-core-dropdown-option>
587
-
588
- <glide-core-dropdown-option
589
- label="Two"
590
- value="two"
591
- ></glide-core-dropdown-option>
535
+ <glide-core-dropdown-option label="One"></glide-core-dropdown-option>
536
+ <glide-core-dropdown-option label="Two"></glide-core-dropdown-option>
592
537
  </glide-core-dropdown>`);
593
538
  await sendKeys({ down: 'Tab' });
594
539
  expect(document.activeElement).to.equal(document.body);
595
540
  });
596
541
  it('clicks the primary button when `click()` is called', async () => {
597
542
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
598
- <glide-core-dropdown-option
599
- label="Label"
600
- value="value"
601
- ></glide-core-dropdown-option>
543
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
602
544
  </glide-core-dropdown>`);
603
545
  const button = component.shadowRoot?.querySelector('[data-test="primary-button"]');
604
546
  assert(button);
@@ -614,15 +556,8 @@ it('unhides its options when made unfilterable', async () => {
614
556
  placeholder="Placeholder"
615
557
  filterable
616
558
  >
617
- <glide-core-dropdown-option
618
- label="One"
619
- value="one"
620
- ></glide-core-dropdown-option>
621
-
622
- <glide-core-dropdown-option
623
- label="Two"
624
- value="two"
625
- ></glide-core-dropdown-option>
559
+ <glide-core-dropdown-option label="One"></glide-core-dropdown-option>
560
+ <glide-core-dropdown-option label="Two"></glide-core-dropdown-option>
626
561
  </glide-core-dropdown>`);
627
562
  component.focus();
628
563
  await sendKeys({ type: 'one' });
@@ -7,7 +7,6 @@ it('is valid if not required and no option is selected', async () => {
7
7
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
8
8
  <glide-core-dropdown-option
9
9
  label="Label"
10
- value="value"
11
10
  selected
12
11
  ></glide-core-dropdown-option>
13
12
  </glide-core-dropdown>`);
@@ -18,10 +17,7 @@ it('is valid if not required and no option is selected', async () => {
18
17
  });
19
18
  it('is invalid if required and no option is selected', async () => {
20
19
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" required>
21
- <glide-core-dropdown-option
22
- label="Label"
23
- value="value"
24
- ></glide-core-dropdown-option>
20
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
25
21
  </glide-core-dropdown>`);
26
22
  expect(component.validity.valid).to.be.false;
27
23
  expect(component.validity?.valueMissing).to.be.true;
@@ -35,10 +31,7 @@ it('is invalid if required and no option is selected when `filterable`', async (
35
31
  filterable
36
32
  required
37
33
  >
38
- <glide-core-dropdown-option
39
- label="Label"
40
- value="value"
41
- ></glide-core-dropdown-option>
34
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
42
35
  </glide-core-dropdown>`);
43
36
  expect(component.validity.valid).to.be.false;
44
37
  expect(component.validity?.valueMissing).to.be.true;
@@ -52,10 +45,7 @@ it('is both invalid and valid if required but disabled and no option is selected
52
45
  disabled
53
46
  required
54
47
  >
55
- <glide-core-dropdown-option
56
- label="Label"
57
- value="value"
58
- ></glide-core-dropdown-option>
48
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
59
49
  </glide-core-dropdown>`);
60
50
  expect(component.validity.valid).to.be.false;
61
51
  expect(component.validity?.valueMissing).to.be.true;
@@ -64,10 +54,7 @@ it('is both invalid and valid if required but disabled and no option is selected
64
54
  });
65
55
  it('sets the validity message with `setCustomValidity()`', async () => {
66
56
  const component = await fixture(html `<glide-core-dropdown label="Label">
67
- <glide-core-dropdown-option
68
- label="Label"
69
- value="value"
70
- ></glide-core-dropdown-option>
57
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
71
58
  </glide-core-dropdown>`);
72
59
  component.setCustomValidity('validity message');
73
60
  expect(component.validity?.valid).to.be.false;
@@ -84,10 +71,7 @@ it('sets the validity message with `setCustomValidity()`', async () => {
84
71
  });
85
72
  it('removes a validity message with an empty argument to `setCustomValidity()`', async () => {
86
73
  const component = await fixture(html `<glide-core-dropdown label="Label">
87
- <glide-core-dropdown-option
88
- label="Label"
89
- value="value"
90
- ></glide-core-dropdown-option>
74
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
91
75
  </glide-core-dropdown>`);
92
76
  component.setCustomValidity('validity message');
93
77
  component.reportValidity();
@@ -99,10 +83,7 @@ it('removes a validity message with an empty argument to `setCustomValidity()`',
99
83
  });
100
84
  it('is invalid when `setValidity()` is called', async () => {
101
85
  const component = await fixture(html `<glide-core-dropdown label="Label">
102
- <glide-core-dropdown-option
103
- label="Label"
104
- value="value"
105
- ></glide-core-dropdown-option>
86
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
106
87
  </glide-core-dropdown>`);
107
88
  component.setValidity({ customError: true }, 'validity message');
108
89
  expect(component.validity.valid).to.be.false;
@@ -118,10 +99,7 @@ it('is invalid when `setValidity()` is called', async () => {
118
99
  });
119
100
  it('is valid when `setValidity()` is called', async () => {
120
101
  const component = await fixture(html `<glide-core-dropdown label="Label">
121
- <glide-core-dropdown-option
122
- label="Label"
123
- value="value"
124
- ></glide-core-dropdown-option>
102
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
125
103
  </glide-core-dropdown>`);
126
104
  component.setValidity({ customError: true }, 'validity message');
127
105
  component.setValidity({});
@@ -135,10 +113,7 @@ it('is valid when `setValidity()` is called', async () => {
135
113
  });
136
114
  it('sets the validity message with `setCustomValidity()` when `filterable`', async () => {
137
115
  const component = await fixture(html `<glide-core-dropdown label="Label" filterable>
138
- <glide-core-dropdown-option
139
- label="Label"
140
- value="value"
141
- ></glide-core-dropdown-option>
116
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
142
117
  </glide-core-dropdown>`);
143
118
  component.setCustomValidity('validity message');
144
119
  expect(component.validity?.valid).to.be.false;
@@ -155,10 +130,7 @@ it('sets the validity message with `setCustomValidity()` when `filterable`', asy
155
130
  });
156
131
  it('removes a validity message with an empty argument to `setCustomValidity()` when `filterable`', async () => {
157
132
  const component = await fixture(html `<glide-core-dropdown label="Label" filterable>
158
- <glide-core-dropdown-option
159
- label="Label"
160
- value="value"
161
- ></glide-core-dropdown-option>
133
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
162
134
  </glide-core-dropdown>`);
163
135
  component.setCustomValidity('validity message');
164
136
  component.reportValidity();
@@ -170,10 +142,7 @@ it('removes a validity message with an empty argument to `setCustomValidity()` w
170
142
  });
171
143
  it('is invalid when `setValidity()` is called when `filterable`', async () => {
172
144
  const component = await fixture(html `<glide-core-dropdown label="Label" filterable>
173
- <glide-core-dropdown-option
174
- label="Label"
175
- value="value"
176
- ></glide-core-dropdown-option>
145
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
177
146
  </glide-core-dropdown>`);
178
147
  component.setValidity({ customError: true }, 'validity message');
179
148
  expect(component.validity.valid).to.be.false;
@@ -189,10 +158,7 @@ it('is invalid when `setValidity()` is called when `filterable`', async () => {
189
158
  });
190
159
  it('is valid when `setValidity()` is called when `filterable`', async () => {
191
160
  const component = await fixture(html `<glide-core-dropdown label="Label" filterable>
192
- <glide-core-dropdown-option
193
- label="Label"
194
- value="value"
195
- ></glide-core-dropdown-option>
161
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
196
162
  </glide-core-dropdown>`);
197
163
  component.setValidity({ customError: true }, 'validity message');
198
164
  component.setValidity({});
@@ -206,10 +172,7 @@ it('is valid when `setValidity()` is called when `filterable`', async () => {
206
172
  });
207
173
  it('retains existing validity state when `setCustomValidity()` is called', async () => {
208
174
  const component = await fixture(html `<glide-core-dropdown label="Label" required>
209
- <glide-core-dropdown-option
210
- label="Label"
211
- value="value"
212
- ></glide-core-dropdown-option>
175
+ <glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
213
176
  </glide-core-dropdown>`);
214
177
  component.setCustomValidity('validity message');
215
178
  expect(component.validity?.valid).to.be.false;
package/dist/label.js CHANGED
@@ -1 +1 @@
1
- var __decorate=this&&this.__decorate||function(e,t,o,l){var i,s=arguments.length,r=s<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,o):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,o,l);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(r=(s<3?i(r):s>3?i(t,o,r):i(t,o))||r);return s>3&&r&&Object.defineProperty(t,o,r),r};import"./tooltip.js";import{LitElement,html,svg}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,state}from"lit/decorators.js";import ow,{owSlot}from"./library/ow.js";import styles from"./label.styles.js";const infoCircleIcon=svg`<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2"><path d="M12 16L12 12" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="8" r="1" fill="currentColor">`;let GlideCoreLabel=class GlideCoreLabel extends LitElement{constructor(){super(...arguments),this.disabled=!1,this.error=!1,this.hide=!1,this.orientation="horizontal",this.required=!1,this.hasDescription=!1,this.hasSummarySlot=!1,this.hasTooltipSlot=!1,this.isLabelTooltip=!1,this.label="",this.#e=createRef(),this.#t=createRef(),this.#o=createRef(),this.#l=createRef(),this.#i=new LocalizeController(this),this.#s=createRef(),this.#r=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}firstUpdated(){owSlot(this.#t.value),owSlot(this.#e.value);const e=new ResizeObserver((()=>{this.hasDescription=Boolean(this.#o.value&&this.#o.value.offsetHeight>0)}));this.#o.value&&e.observe(this.#o.value)}render(){return html`<div class="${classMap({component:!0,horizontal:"horizontal"===this.orientation,vertical:"vertical"===this.orientation,left:"left"===this.split,middle:"middle"===this.split,"hidden-label":this.hide})}"><div class="${classMap({"tooltips-and-label":!0,hidden:this.hide,left:"left"===this.split,middle:"middle"===this.split})}" part="tooltips-and-label"><glide-core-tooltip class="${classMap({"optional-tooltip":!0,vertical:"vertical"===this.orientation,visible:this.hasTooltipSlot})}" placement="${"vertical"===this.orientation?"right":"bottom"}"><span class="optional-tooltip-target" slot="target" tabindex="0"><svg aria-label="${this.#i.term("moreInformation")}" width="16" height="16" viewBox="0 0 24 24" fill="none">${infoCircleIcon}</svg></span><slot name="tooltip" @slotchange="${this.#a}" ${ref(this.#r)}></slot></glide-core-tooltip><glide-core-tooltip class="label-tooltip" placement="right" ?disabled="${!this.isLabelTooltip}"><div class="${classMap({label:!0,disabled:this.disabled})}" data-test="label" slot="target" ${ref(this.#l)}><slot @slotchange="${this.#n}" ${ref(this.#t)}></slot>${this.required?html`<span aria-hidden="true" class="required-symbol">*</span>`:""}</div><div aria-hidden="true">${this.label}</div></glide-core-tooltip></div><div class="control-and-summary"><slot class="${classMap({control:!0,error:this.error,disabled:this.disabled,vertical:"vertical"===this.orientation,summaryless:!this.hasSummarySlot,"hidden-label":this.hide})}" name="control" @slotchange="${this.#d}" ${ref(this.#e)}></slot><slot class="${classMap({summary:!0,error:this.error})}" name="summary" @slotchange="${this.#c}" ${ref(this.#s)}></slot></div><slot class="${classMap({description:!0,content:this.hasDescription,error:this.error,tooltip:this.hasTooltipSlot})}" id="description" name="description" ${ref(this.#o)}></slot></div>`}#e;#t;#o;#l;#i;#s;#r;#d(){owSlot(this.#e.value)}#n(){owSlot(this.#t.value);const e=this.#t.value?.assignedElements().at(0),t=this.#l.value;ow(e,ow.object.instanceOf(Element)),ow(t,ow.object.instanceOf(HTMLElement)),e.textContent&&(this.label=e.textContent);new ResizeObserver((()=>{this.isLabelTooltip=e.getBoundingClientRect().width>t.getBoundingClientRect().width})).observe(t)}#c(){const e=this.#s.value?.assignedNodes({flatten:!0});this.hasSummarySlot=Boolean(e&&e.length>0)}#a(){const e=this.#r.value?.assignedNodes({flatten:!0});this.hasTooltipSlot=Boolean(e&&e.length>0)}};__decorate([property({reflect:!0,type:Boolean})],GlideCoreLabel.prototype,"disabled",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreLabel.prototype,"error",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreLabel.prototype,"hide",void 0),__decorate([property({reflect:!0})],GlideCoreLabel.prototype,"orientation",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreLabel.prototype,"required",void 0),__decorate([property()],GlideCoreLabel.prototype,"split",void 0),__decorate([state()],GlideCoreLabel.prototype,"hasDescription",void 0),__decorate([state()],GlideCoreLabel.prototype,"hasSummarySlot",void 0),__decorate([state()],GlideCoreLabel.prototype,"hasTooltipSlot",void 0),__decorate([state()],GlideCoreLabel.prototype,"isLabelTooltip",void 0),__decorate([state()],GlideCoreLabel.prototype,"label",void 0),GlideCoreLabel=__decorate([customElement("glide-core-private-label")],GlideCoreLabel);export default GlideCoreLabel;
1
+ var __decorate=this&&this.__decorate||function(e,t,o,l){var i,s=arguments.length,r=s<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,o):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,o,l);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(r=(s<3?i(r):s>3?i(t,o,r):i(t,o))||r);return s>3&&r&&Object.defineProperty(t,o,r),r};import"./tooltip.js";import{LitElement,html,svg}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,state}from"lit/decorators.js";import ow,{owSlot}from"./library/ow.js";import styles from"./label.styles.js";const infoCircleIcon=svg`<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2"><path d="M12 16L12 12" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="8" r="1" fill="currentColor">`;let GlideCoreLabel=class GlideCoreLabel extends LitElement{constructor(){super(...arguments),this.disabled=!1,this.error=!1,this.hide=!1,this.orientation="horizontal",this.required=!1,this.hasDescription=!1,this.hasSummarySlot=!1,this.hasTooltipSlot=!1,this.isLabelTooltip=!1,this.label="",this.#e=createRef(),this.#t=createRef(),this.#o=createRef(),this.#l=createRef(),this.#i=new LocalizeController(this),this.#s=createRef(),this.#r=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}firstUpdated(){owSlot(this.#t.value),owSlot(this.#e.value);const e=new ResizeObserver((()=>{this.hasDescription=Boolean(this.#o.value&&this.#o.value.offsetHeight>0)}));this.#o.value&&e.observe(this.#o.value)}render(){return html`<div class="${classMap({component:!0,horizontal:"horizontal"===this.orientation,vertical:"vertical"===this.orientation,left:"left"===this.split,middle:"middle"===this.split,"hidden-label":this.hide})}"><div class="${classMap({tooltips:!0,hidden:this.hide,left:"left"===this.split,middle:"middle"===this.split})}" part="private-tooltips"><glide-core-tooltip class="${classMap({"optional-tooltip":!0,vertical:"vertical"===this.orientation,visible:this.hasTooltipSlot})}" placement="${"vertical"===this.orientation?"right":"bottom"}"><span class="optional-tooltip-target" slot="target" tabindex="0"><svg aria-label="${this.#i.term("moreInformation")}" width="16" height="16" viewBox="0 0 24 24" fill="none">${infoCircleIcon}</svg></span><slot name="tooltip" @slotchange="${this.#a}" ${ref(this.#r)}></slot></glide-core-tooltip><glide-core-tooltip class="label-tooltip" placement="right" ?disabled="${!this.isLabelTooltip}"><div class="${classMap({label:!0,disabled:this.disabled})}" data-test="label" slot="target" ${ref(this.#l)}><slot @slotchange="${this.#n}" ${ref(this.#t)}></slot>${this.required?html`<span aria-hidden="true" class="required-symbol">*</span>`:""}</div><div aria-hidden="true">${this.label}</div></glide-core-tooltip></div><div class="control-and-summary" part="private-control-and-summary"><slot class="${classMap({control:!0,error:this.error,disabled:this.disabled,vertical:"vertical"===this.orientation,summaryless:!this.hasSummarySlot,"hidden-label":this.hide})}" name="control" @slotchange="${this.#d}" ${ref(this.#e)}></slot><slot class="${classMap({summary:!0,error:this.error})}" name="summary" @slotchange="${this.#c}" ${ref(this.#s)}></slot></div><slot class="${classMap({description:!0,content:this.hasDescription,error:this.error,tooltip:this.hasTooltipSlot})}" id="description" name="description" ${ref(this.#o)}></slot></div>`}#e;#t;#o;#l;#i;#s;#r;#d(){owSlot(this.#e.value)}#n(){owSlot(this.#t.value);const e=this.#t.value?.assignedElements().at(0),t=this.#l.value;ow(e,ow.object.instanceOf(Element)),ow(t,ow.object.instanceOf(HTMLElement)),e.textContent&&(this.label=e.textContent);new ResizeObserver((()=>{this.isLabelTooltip=e.getBoundingClientRect().width>t.getBoundingClientRect().width})).observe(t)}#c(){const e=this.#s.value?.assignedNodes({flatten:!0});this.hasSummarySlot=Boolean(e&&e.length>0)}#a(){const e=this.#r.value?.assignedNodes({flatten:!0});this.hasTooltipSlot=Boolean(e&&e.length>0)}};__decorate([property({reflect:!0,type:Boolean})],GlideCoreLabel.prototype,"disabled",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreLabel.prototype,"error",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreLabel.prototype,"hide",void 0),__decorate([property({reflect:!0})],GlideCoreLabel.prototype,"orientation",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreLabel.prototype,"required",void 0),__decorate([property()],GlideCoreLabel.prototype,"split",void 0),__decorate([state()],GlideCoreLabel.prototype,"hasDescription",void 0),__decorate([state()],GlideCoreLabel.prototype,"hasSummarySlot",void 0),__decorate([state()],GlideCoreLabel.prototype,"hasTooltipSlot",void 0),__decorate([state()],GlideCoreLabel.prototype,"isLabelTooltip",void 0),__decorate([state()],GlideCoreLabel.prototype,"label",void 0),GlideCoreLabel=__decorate([customElement("glide-core-private-label")],GlideCoreLabel);export default GlideCoreLabel;
@@ -1,6 +1,6 @@
1
1
  import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import visuallyHidden from"./styles/visually-hidden.js";export default[css`
2
2
  ${focusOutline(".optional-tooltip-target:focus-visible ")}
3
- ${visuallyHidden(".tooltips-and-label.hidden")}
3
+ ${visuallyHidden(".tooltips.hidden")}
4
4
  `,css`
5
5
  .component {
6
6
  &.horizontal {
@@ -8,7 +8,7 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
8
8
 
9
9
  column-gap: var(--glide-core-spacing-sm);
10
10
  display: grid;
11
- grid-template-columns: auto minmax(min-content, 1fr);
11
+ grid-template-columns: auto minmax(auto, 1fr);
12
12
  }
13
13
 
14
14
  &.vertical {
@@ -32,7 +32,7 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
32
32
  }
33
33
  }
34
34
 
35
- .tooltips-and-label {
35
+ .tooltips {
36
36
  align-items: center;
37
37
  column-gap: var(--glide-core-spacing-xs);
38
38
  display: flex;
@@ -129,10 +129,14 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
129
129
  align-items: center;
130
130
  display: flex;
131
131
  gap: var(--glide-core-spacing-sm);
132
+
133
+ /* https://css-tricks.com/flexbox-truncated-text/#aa-the-solution-is-min-width-0-on-the-flex-child */
134
+ min-inline-size: 0;
132
135
  }
133
136
 
134
137
  .control {
135
138
  display: block;
139
+ max-inline-size: 100%;
136
140
 
137
141
  &.summaryless {
138
142
  flex-grow: 1;
@@ -30,7 +30,7 @@ import{css}from"lit";export default[css`
30
30
  }
31
31
  }
32
32
 
33
- glide-core-private-label::part(tooltips-and-label) {
33
+ glide-core-private-label::part(private-tooltips) {
34
34
  align-items: flex-start;
35
35
  }
36
36
 
@@ -9,14 +9,8 @@ import{css}from"lit";export default[css`
9
9
  box-sizing: border-box;
10
10
  display: flex;
11
11
  padding-block-end: var(--tabs-padding-block-end);
12
-
13
- /* Better to be explicit with start and end than using the shorthand property */
14
- /* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties */
15
12
  padding-block-start: var(--tabs-padding-block-start);
16
13
  padding-inline-end: var(--tabs-padding-inline-end);
17
-
18
- /* Better to be explicit with start and end than using the shorthand property */
19
- /* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties */
20
14
  padding-inline-start: var(--tabs-padding-inline-start);
21
15
  }
22
16
 
@@ -23,9 +23,6 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
23
23
  and it will apply to all child panels for convenience.
24
24
  */
25
25
  padding-inline-end: var(--panel-padding-inline-end);
26
-
27
- /* Better to be explicit with start and end than using the shorthand property */
28
- /* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties */
29
26
  padding-inline-start: var(--panel-padding-inline-start);
30
27
  }
31
28
  `];
@@ -1,7 +1,7 @@
1
1
  import{css,unsafeCSS}from"lit";import visuallyHidden from"./styles/visually-hidden.js";const fieldSizingContent=unsafeCSS("\n field-sizing: content;\n");export default[css`
2
2
  ${visuallyHidden(".character-count .hidden")}
3
3
  `,css`
4
- glide-core-private-label::part(tooltips-and-label) {
4
+ glide-core-private-label::part(private-tooltips) {
5
5
  align-items: flex-start;
6
6
  margin-block-start: var(--glide-core-spacing-sm);
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdstrike/glide-core",
3
- "version": "0.12.2",
3
+ "version": "0.12.3",
4
4
  "description": "CrowdStrike's Glide Design System components package for providing web components",
5
5
  "author": "CrowdStrike UX Team",
6
6
  "license": "Apache-2.0",