@crowdstrike/glide-core 0.32.2 → 0.32.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.
- package/dist/button.js +2 -1
- package/dist/button.styles.js +14 -0
- package/dist/checkbox.d.ts +1 -0
- package/dist/checkbox.js +18 -10
- package/dist/input.js +2 -2
- package/dist/menu.js +22 -14
- package/dist/slider.js +4 -4
- package/dist/textarea.d.ts +1 -0
- package/dist/textarea.js +11 -3
- package/dist/toggle.d.ts +1 -0
- package/dist/toggle.js +10 -2
- package/package.json +1 -1
package/dist/button.js
CHANGED
@@ -70,6 +70,7 @@ let Button = class Button extends LitElement {
|
|
70
70
|
}
|
71
71
|
render() {
|
72
72
|
return html `<glide-core-tooltip
|
73
|
+
class="tooltip"
|
73
74
|
label=${this.tooltip ?? ''}
|
74
75
|
?disabled=${!this.disabled || !this.tooltip}
|
75
76
|
>
|
@@ -106,7 +107,7 @@ let Button = class Button extends LitElement {
|
|
106
107
|
-->
|
107
108
|
</slot>
|
108
109
|
|
109
|
-
|
110
|
+
<span class="label">${this.label}</span>
|
110
111
|
|
111
112
|
<slot
|
112
113
|
class=${classMap({
|
package/dist/button.styles.js
CHANGED
@@ -22,6 +22,7 @@ export default [
|
|
22
22
|
font-weight: var(--glide-core-typography-weight-bold);
|
23
23
|
gap: var(--glide-core-spacing-base-xs);
|
24
24
|
justify-content: center;
|
25
|
+
max-inline-size: 100%;
|
25
26
|
padding-block: var(--glide-core-spacing-base-xs);
|
26
27
|
padding-inline: var(--glide-core-spacing-base-md);
|
27
28
|
transition-duration: var(--glide-core-duration-moderate-02);
|
@@ -143,6 +144,7 @@ export default [
|
|
143
144
|
font-size: var(--glide-core-typography-size-body-default);
|
144
145
|
font-weight: var(--glide-core-typography-weight-regular);
|
145
146
|
padding: 0;
|
147
|
+
text-align: start;
|
146
148
|
|
147
149
|
&.disabled {
|
148
150
|
color: var(--glide-core-color-interactive-text-link--disabled);
|
@@ -167,12 +169,24 @@ export default [
|
|
167
169
|
}
|
168
170
|
}
|
169
171
|
|
172
|
+
.tooltip {
|
173
|
+
max-inline-size: 100%;
|
174
|
+
white-space: inherit;
|
175
|
+
}
|
176
|
+
|
170
177
|
.prefix-icon-slot {
|
171
178
|
&.hidden {
|
172
179
|
display: none;
|
173
180
|
}
|
174
181
|
}
|
175
182
|
|
183
|
+
.label {
|
184
|
+
min-inline-size: 3ch;
|
185
|
+
overflow: hidden;
|
186
|
+
text-overflow: ellipsis;
|
187
|
+
white-space: inherit;
|
188
|
+
}
|
189
|
+
|
176
190
|
.suffix-icon-slot {
|
177
191
|
&.hidden {
|
178
192
|
display: none;
|
package/dist/checkbox.d.ts
CHANGED
package/dist/checkbox.js
CHANGED
@@ -40,6 +40,7 @@ import required from './library/required.js';
|
|
40
40
|
* @slot {Element} [private-icon]
|
41
41
|
*
|
42
42
|
* @fires {Event} change
|
43
|
+
* @fires {Event} input
|
43
44
|
* @fires {Event} invalid
|
44
45
|
*
|
45
46
|
* @readonly
|
@@ -480,12 +481,12 @@ let Checkbox = class Checkbox extends LitElement {
|
|
480
481
|
this.reportValidity();
|
481
482
|
this.isBlurring = false;
|
482
483
|
}
|
483
|
-
// Only "change" would need to be handled if not for some consumers needing
|
484
|
-
//
|
484
|
+
// Only "change" would need to be handled if not for some consumers needing to
|
485
|
+
// force Checkbox checked or unchecked until the user has completed some action.
|
485
486
|
//
|
486
|
-
// The way
|
487
|
-
// "change" handler and then immediately set `checked` back to its desired
|
488
|
-
//
|
487
|
+
// The way they can force Checkbox to be checked or unchecked is to add an "input"
|
488
|
+
// or "change" handler and then immediately set `checked` back to its desired state
|
489
|
+
// inside that handler.
|
489
490
|
//
|
490
491
|
// To do that, consumers need to await `this.updateComplete` so `checked` isn't
|
491
492
|
// immediately reverted after Checkbox updates, which happens asynchronously and
|
@@ -495,18 +496,25 @@ let Checkbox = class Checkbox extends LitElement {
|
|
495
496
|
// why we're handling "input" as well: so that "input", like "change", results
|
496
497
|
// in an update that can be awaited.
|
497
498
|
//
|
498
|
-
// If "input" events were dispatched after "change" events, only handling
|
499
|
-
//
|
500
|
-
//
|
499
|
+
// If "input" events were dispatched after "change" events, only handling "change"
|
500
|
+
// here would suffice because an update from "change" would already be pending by
|
501
|
+
// the time "input" is dispatched.
|
501
502
|
#onInputChangeOrInput(event) {
|
502
503
|
if (event.target instanceof HTMLInputElement) {
|
503
504
|
this.checked = event.target.checked;
|
504
505
|
}
|
505
506
|
// If the input has been interacted with it's no longer indeterminate.
|
506
507
|
this.indeterminate = false;
|
508
|
+
// Our analyzer plugin (`add-events.ts`) doesn't and can't account for events that
|
509
|
+
// are implicitly dispatched by a native form control in a component. So we stop
|
510
|
+
// the original event and dispatch our own.
|
511
|
+
if (event.type === 'input') {
|
512
|
+
event.stopPropagation();
|
513
|
+
this.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
|
514
|
+
}
|
507
515
|
if (event.type === 'change') {
|
508
|
-
// Unlike "input" events, "change" events aren't composed. So we have to
|
509
|
-
//
|
516
|
+
// Unlike "input" events, "change" events aren't composed. So we have to manually
|
517
|
+
// dispatch them.
|
510
518
|
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
511
519
|
}
|
512
520
|
}
|
package/dist/input.js
CHANGED
@@ -453,8 +453,8 @@ let Input = class Input extends LitElement {
|
|
453
453
|
if (this.#inputElementRef.value?.value) {
|
454
454
|
this.value = this.#inputElementRef.value?.value;
|
455
455
|
}
|
456
|
-
// Unlike "input" events, "change" events aren't composed. So we have to
|
457
|
-
//
|
456
|
+
// Unlike "input" events, "change" events aren't composed. So we have to manually
|
457
|
+
// dispatch them.
|
458
458
|
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
459
459
|
}
|
460
460
|
#onInputFocus() {
|
package/dist/menu.js
CHANGED
@@ -416,20 +416,28 @@ let Menu = class Menu extends LitElement {
|
|
416
416
|
return this.closest('glide-core-option');
|
417
417
|
}
|
418
418
|
get #subMenus() {
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
419
|
+
const assignedElements = this.#defaultSlotElementRef.value?.assignedElements({ flatten: true });
|
420
|
+
if (!assignedElements) {
|
421
|
+
return [];
|
422
|
+
}
|
423
|
+
return assignedElements
|
424
|
+
.filter((element) => element instanceof Options)
|
425
|
+
.flatMap((element) => {
|
426
|
+
return [
|
427
|
+
...element.querySelectorAll(
|
428
|
+
// The "content" slot case.
|
429
|
+
':scope > glide-core-option > [slot="content"] > glide-core-menu'),
|
430
|
+
...element.querySelectorAll(
|
431
|
+
// The "content" slot and Options Group case.
|
432
|
+
':scope > glide-core-options-group > glide-core-option > [slot="content"] > glide-core-menu'),
|
433
|
+
...element.querySelectorAll(
|
434
|
+
// The "content" slot fallback case.
|
435
|
+
':scope > glide-core-option > [slot="submenu"]'),
|
436
|
+
...element.querySelectorAll(
|
437
|
+
// The "content" slot fallback and Options Group case.
|
438
|
+
':scope > glide-core-options-group > glide-core-option > [slot="submenu"]'),
|
439
|
+
];
|
440
|
+
});
|
433
441
|
}
|
434
442
|
get #targetElement() {
|
435
443
|
const element = this.#targetSlotElementRef.value
|
package/dist/slider.js
CHANGED
@@ -801,8 +801,8 @@ let Slider = class Slider extends LitElement {
|
|
801
801
|
const normalizedValue = Math.round(inputValue / this.step) * this.step;
|
802
802
|
this.maximumValue = Math.min(Math.max(normalizedValue, this.minimumValue + this.step), this.max);
|
803
803
|
this.#updateHandlesAndTrack();
|
804
|
-
// Unlike "input" events, "change" events aren't composed. So
|
805
|
-
//
|
804
|
+
// Unlike "input" events, "change" events aren't composed. So we have to manually
|
805
|
+
// dispatch them.
|
806
806
|
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
807
807
|
}
|
808
808
|
}
|
@@ -842,8 +842,8 @@ let Slider = class Slider extends LitElement {
|
|
842
842
|
// can't go higher than 70 (75-5).
|
843
843
|
this.maximumValue - this.step);
|
844
844
|
this.#updateHandlesAndTrack();
|
845
|
-
// Unlike "input" events, "change" events aren't composed. So
|
846
|
-
//
|
845
|
+
// Unlike "input" events, "change" events aren't composed. So we have to manually
|
846
|
+
// dispatch them.
|
847
847
|
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
848
848
|
}
|
849
849
|
}
|
package/dist/textarea.d.ts
CHANGED
package/dist/textarea.js
CHANGED
@@ -40,6 +40,7 @@ import required from './library/required.js';
|
|
40
40
|
* @slot {Element | string} [description] - Additional information or context
|
41
41
|
*
|
42
42
|
* @fires {Event} change
|
43
|
+
* @fires {Event} input
|
43
44
|
* @fires {Event} invalid
|
44
45
|
*
|
45
46
|
* @readonly
|
@@ -310,14 +311,21 @@ let Textarea = class Textarea extends LitElement {
|
|
310
311
|
if (this.#textareaElementRef.value) {
|
311
312
|
this.value = this.#textareaElementRef.value.value;
|
312
313
|
}
|
313
|
-
// Unlike "input" events, "change" events aren't composed. So we have to
|
314
|
-
//
|
314
|
+
// Unlike "input" events, "change" events aren't composed. So we have to manually
|
315
|
+
// dispatch them.
|
315
316
|
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
316
317
|
}
|
317
|
-
#onTextareaInput() {
|
318
|
+
#onTextareaInput(event) {
|
318
319
|
if (this.#textareaElementRef.value) {
|
319
320
|
this.value = this.#textareaElementRef.value.value;
|
320
321
|
}
|
322
|
+
// Our analyzer plugin (`add-events.ts`) doesn't and can't account for events that
|
323
|
+
// are implicitly dispatched by a native form control in a component. So we stop
|
324
|
+
// the original event and dispatch our own.
|
325
|
+
if (event.type === 'input') {
|
326
|
+
event.stopPropagation();
|
327
|
+
this.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
|
328
|
+
}
|
321
329
|
}
|
322
330
|
#onTextareaKeydown(event) {
|
323
331
|
if (event.key === 'Enter' && (event.metaKey || event.ctrlKey)) {
|
package/dist/toggle.d.ts
CHANGED
package/dist/toggle.js
CHANGED
@@ -30,6 +30,7 @@ import required from './library/required.js';
|
|
30
30
|
* @slot {Element | string} [description] - Additional information or context
|
31
31
|
*
|
32
32
|
* @fires {Event} change
|
33
|
+
* @fires {Event} input
|
33
34
|
*/
|
34
35
|
let Toggle = class Toggle extends LitElement {
|
35
36
|
constructor() {
|
@@ -136,9 +137,16 @@ let Toggle = class Toggle extends LitElement {
|
|
136
137
|
if (event.target instanceof HTMLInputElement) {
|
137
138
|
this.checked = event.target.checked;
|
138
139
|
}
|
140
|
+
// Our analyzer plugin (`add-events.ts`) doesn't and can't account for events that
|
141
|
+
// are implicitly dispatched by a native form control in a component. So we stop
|
142
|
+
// the original event and dispatch our own.
|
143
|
+
if (event.type === 'input') {
|
144
|
+
event.stopPropagation();
|
145
|
+
this.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
|
146
|
+
}
|
139
147
|
if (event.type === 'change') {
|
140
|
-
// Unlike "input" events, "change" events aren't composed. So we have to
|
141
|
-
//
|
148
|
+
// Unlike "input" events, "change" events aren't composed. So we have to manually
|
149
|
+
// dispatch them.
|
142
150
|
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
143
151
|
}
|
144
152
|
}
|