@crowdstrike/glide-core 0.32.3 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/accordion.js +3 -2
  2. package/dist/button-group.button.js +3 -2
  3. package/dist/button-group.js +3 -2
  4. package/dist/button.js +5 -10
  5. package/dist/button.styles.js +0 -12
  6. package/dist/checkbox-group.js +8 -7
  7. package/dist/checkbox.js +11 -9
  8. package/dist/checkbox.styles.js +1 -1
  9. package/dist/drawer.js +3 -2
  10. package/dist/dropdown.js +51 -45
  11. package/dist/dropdown.option.d.ts +2 -0
  12. package/dist/dropdown.option.js +26 -25
  13. package/dist/dropdown.styles.js +11 -2
  14. package/dist/form-controls-layout.js +3 -2
  15. package/dist/icon-button.js +2 -2
  16. package/dist/inline-alert.d.ts +4 -0
  17. package/dist/inline-alert.js +25 -6
  18. package/dist/input.js +7 -7
  19. package/dist/input.styles.js +3 -2
  20. package/dist/label.js +3 -2
  21. package/dist/library/assert-slot.js +2 -2
  22. package/dist/library/assert-slot.test.js +92 -0
  23. package/dist/library/localize.d.ts +1 -0
  24. package/dist/link.js +2 -2
  25. package/dist/menu.js +61 -30
  26. package/dist/menu.styles.js +1 -0
  27. package/dist/modal.icon-button.js +3 -2
  28. package/dist/modal.js +3 -2
  29. package/dist/option.d.ts +5 -0
  30. package/dist/option.js +28 -5
  31. package/dist/options.d.ts +2 -0
  32. package/dist/options.group.js +3 -2
  33. package/dist/options.js +7 -8
  34. package/dist/options.styles.js +0 -6
  35. package/dist/popover.js +3 -2
  36. package/dist/radio-group.js +4 -3
  37. package/dist/radio-group.radio.js +3 -2
  38. package/dist/select.d.ts +90 -0
  39. package/dist/select.js +532 -0
  40. package/dist/slider.js +3 -3
  41. package/dist/slider.styles.js +1 -3
  42. package/dist/spinner.js +2 -2
  43. package/dist/split-button.js +3 -2
  44. package/dist/split-button.primary-button.js +2 -2
  45. package/dist/split-button.primary-link.js +2 -2
  46. package/dist/split-button.secondary-button.js +2 -2
  47. package/dist/styles/opacity-and-scale-animation.js +2 -1
  48. package/dist/styles/variables.css +12 -8
  49. package/dist/tab.group.js +3 -2
  50. package/dist/tab.js +3 -2
  51. package/dist/tab.panel.js +3 -2
  52. package/dist/tag.d.ts +1 -0
  53. package/dist/tag.js +8 -2
  54. package/dist/tag.styles.js +9 -1
  55. package/dist/textarea.js +8 -7
  56. package/dist/textarea.styles.js +3 -2
  57. package/dist/toast.js +2 -2
  58. package/dist/toast.toasts.js +3 -2
  59. package/dist/toggle.js +3 -2
  60. package/dist/tooltip.container.js +3 -2
  61. package/dist/tooltip.js +6 -9
  62. package/dist/translations/en.js +1 -0
  63. package/dist/translations/fr.d.ts +1 -1
  64. package/dist/translations/fr.js +1 -0
  65. package/dist/translations/ja.d.ts +1 -1
  66. package/dist/translations/ja.js +1 -0
  67. package/package.json +4 -4
  68. package/dist/library/shadow-root-mode.d.ts +0 -2
  69. package/dist/library/shadow-root-mode.js +0 -4
package/dist/option.js CHANGED
@@ -15,7 +15,6 @@ import packageJson from '../package.json' with { type: 'json' };
15
15
  import styles from './option.styles.js';
16
16
  import assertSlot from './library/assert-slot.js';
17
17
  import checkedIcon from './icons/checked.js';
18
- import shadowRootMode from './library/shadow-root-mode.js';
19
18
  import final from './library/final.js';
20
19
  import uniqueId from './library/unique-id.js';
21
20
  import Menu from './menu.js';
@@ -45,6 +44,11 @@ import required from './library/required.js';
45
44
  * @slot {Element | Text} [content] - This is the unhappy path. It's the escape hatch where you can render arbitrary content and lay it out however you need to. If you go this route, `slot="icon"` and `slot="submenu"` will become unavailable. And the `label` and `description` attributes won't be rendered. The `label` attribute is still required. We'll show it in a tooltip when your content overflows. If you need a second line of text in the tooltip, provide you can provide it via the `description` attribute.
46
45
  * @slot {Element} [icon]
47
46
  * @slot {Menu} [submenu]
47
+ *
48
+ * @fires {Event} deselected
49
+ * @fires {Event} disabled
50
+ * @fires {Event} enabled
51
+ * @fires {Event} selected
48
52
  */
49
53
  let Option = class Option extends LitElement {
50
54
  constructor() {
@@ -61,8 +65,8 @@ let Option = class Option extends LitElement {
61
65
  this.hasIconSlot = false;
62
66
  this.hasSubMenuSlot = false;
63
67
  this.isContentSlotOverflow = false;
64
- // Set in `#onSubmenuToggle()`. Used to toggle the sub-Menu's target as open
65
- // or closed visually.
68
+ // Set in `#onSubmenuToggle()`. Used to toggle the sub-Menu's target as open or
69
+ // closed visually.
66
70
  this.isSubmenuOpen = false;
67
71
  this.#containerElementRef = createRef();
68
72
  this.#contentSlotElementRef = createRef();
@@ -73,10 +77,12 @@ let Option = class Option extends LitElement {
73
77
  this.#labelElementRef = createRef();
74
78
  this.#tooltipElementRef = createRef();
75
79
  }
80
+ /* c8 ignore start */
76
81
  static { this.shadowRootOptions = {
77
82
  ...LitElement.shadowRootOptions,
78
- mode: shadowRootMode,
83
+ mode: window.navigator.webdriver ? 'open' : 'closed',
79
84
  }; }
85
+ /* c8 ignore end */
80
86
  static { this.styles = styles; }
81
87
  // Consumers may chose not to take the happy path and instead use the "content"
82
88
  // slot. In that case, we don't render `label`. But `label` still needs to be
@@ -116,9 +122,15 @@ let Option = class Option extends LitElement {
116
122
  return this.#isDisabled;
117
123
  }
118
124
  set disabled(isDisabled) {
125
+ const hasChanged = isDisabled !== this.#isDisabled;
119
126
  this.#isDisabled = isDisabled;
120
127
  this.ariaDisabled = isDisabled ? 'true' : 'false';
121
- this.dispatchEvent(new Event('private-disabled-change', { bubbles: true }));
128
+ if (hasChanged && isDisabled) {
129
+ this.dispatchEvent(new Event('disabled', { bubbles: true }));
130
+ }
131
+ else if (hasChanged) {
132
+ this.dispatchEvent(new Event('enabled', { bubbles: true }));
133
+ }
122
134
  }
123
135
  get privateActive() {
124
136
  return this.#isActive;
@@ -142,8 +154,19 @@ let Option = class Option extends LitElement {
142
154
  return this.#isSelected;
143
155
  }
144
156
  set selected(isSelected) {
157
+ const hasChanged = isSelected !== this.#isSelected;
145
158
  this.ariaSelected = isSelected.toString();
146
159
  this.#isSelected = isSelected;
160
+ if (hasChanged && isSelected) {
161
+ this.dispatchEvent(new Event('selected', {
162
+ bubbles: true,
163
+ }));
164
+ }
165
+ else if (hasChanged) {
166
+ this.dispatchEvent(new Event('deselected', {
167
+ bubbles: true,
168
+ }));
169
+ }
147
170
  }
148
171
  click() {
149
172
  // You'd think this condition wouldn't be needed because `#onTooltipClick()` has a
package/dist/options.d.ts CHANGED
@@ -20,6 +20,8 @@ declare global {
20
20
  * @attr {string} [version]
21
21
  *
22
22
  * @slot {Option | Text}
23
+ *
24
+ * @fires {Event} slotchange
23
25
  */
24
26
  export default class Options extends LitElement {
25
27
  #private;
@@ -9,7 +9,6 @@ import { customElement, property } from 'lit/decorators.js';
9
9
  import { classMap } from 'lit/directives/class-map.js';
10
10
  import packageJson from '../package.json' with { type: 'json' };
11
11
  import styles from './options.group.styles.js';
12
- import shadowRootMode from './library/shadow-root-mode.js';
13
12
  import final from './library/final.js';
14
13
  import assertSlot from './library/assert-slot.js';
15
14
  import Option from './option.js';
@@ -31,10 +30,12 @@ let OptionsGroup = class OptionsGroup extends LitElement {
31
30
  this.role = 'group';
32
31
  this.version = packageJson.version;
33
32
  }
33
+ /* c8 ignore start */
34
34
  static { this.shadowRootOptions = {
35
35
  ...LitElement.shadowRootOptions,
36
- mode: shadowRootMode,
36
+ mode: window.navigator.webdriver ? 'open' : 'closed',
37
37
  }; }
38
+ /* c8 ignore end */
38
39
  static { this.styles = styles; }
39
40
  /**
40
41
  * @default undefined
package/dist/options.js CHANGED
@@ -5,14 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { html, LitElement } from 'lit';
8
- import { classMap } from 'lit/directives/class-map.js';
9
8
  import { customElement, property } from 'lit/decorators.js';
10
9
  import { map } from 'lit/directives/map.js';
11
10
  import { when } from 'lit/directives/when.js';
12
11
  import { range } from 'lit/directives/range.js';
13
12
  import packageJson from '../package.json' with { type: 'json' };
14
13
  import styles from './options.styles.js';
15
- import shadowRootMode from './library/shadow-root-mode.js';
16
14
  import final from './library/final.js';
17
15
  import uniqueId from './library/unique-id.js';
18
16
  import assertSlot from './library/assert-slot.js';
@@ -47,6 +45,8 @@ import OptionsGroup from './options.group.js';
47
45
  * @attr {string} [version]
48
46
  *
49
47
  * @slot {Option | Text}
48
+ *
49
+ * @fires {Event} slotchange
50
50
  */
51
51
  let Options = class Options extends LitElement {
52
52
  constructor() {
@@ -66,10 +66,12 @@ let Options = class Options extends LitElement {
66
66
  this.tabIndex = -1;
67
67
  this.version = packageJson.version;
68
68
  }
69
+ /* c8 ignore start */
69
70
  static { this.shadowRootOptions = {
70
71
  ...LitElement.shadowRootOptions,
71
- mode: shadowRootMode,
72
+ mode: window.navigator.webdriver ? 'open' : 'closed',
72
73
  }; }
74
+ /* c8 ignore end */
73
75
  static { this.styles = styles; }
74
76
  render() {
75
77
  // Without `role="none"` VoiceOver doesn't announce how many options are available.
@@ -78,10 +80,7 @@ let Options = class Options extends LitElement {
78
80
  // `role="option"`).
79
81
  return html `<div class="component" role="none">
80
82
  <slot
81
- class=${classMap({
82
- 'default-slot': true,
83
- loading: this.privateLoading,
84
- })}
83
+ ?hidden=${this.privateLoading}
85
84
  @slotchange=${this.#onDefaultSlotChange}
86
85
  ${assertSlot([OptionsGroup, Option, Text], true)}
87
86
  >
@@ -96,7 +95,7 @@ let Options = class Options extends LitElement {
96
95
  </div>`;
97
96
  }
98
97
  #onDefaultSlotChange() {
99
- this.dispatchEvent(new Event('private-slot-change', { bubbles: true }));
98
+ this.dispatchEvent(new Event('slotchange', { bubbles: true }));
100
99
  }
101
100
  };
102
101
  __decorate([
@@ -11,11 +11,5 @@ export default [
11
11
  */
12
12
  display: block;
13
13
  }
14
-
15
- .default-slot {
16
- &.loading {
17
- display: none;
18
- }
19
- }
20
14
  `,
21
15
  ];
package/dist/popover.js CHANGED
@@ -13,7 +13,6 @@ import { customElement, property, state } from 'lit/decorators.js';
13
13
  import packageJson from '../package.json' with { type: 'json' };
14
14
  import styles from './popover.styles.js';
15
15
  import assertSlot from './library/assert-slot.js';
16
- import shadowRootMode from './library/shadow-root-mode.js';
17
16
  import final from './library/final.js';
18
17
  /**
19
18
  * @attr {boolean} [disabled=false]
@@ -76,10 +75,12 @@ let Popover = class Popover extends LitElement {
76
75
  this.open = false;
77
76
  };
78
77
  }
78
+ /* c8 ignore start */
79
79
  static { this.shadowRootOptions = {
80
80
  ...LitElement.shadowRootOptions,
81
- mode: shadowRootMode,
81
+ mode: window.navigator.webdriver ? 'open' : 'closed',
82
82
  }; }
83
+ /* c8 ignore end */
83
84
  static { this.styles = styles; }
84
85
  /**
85
86
  * @default false
@@ -17,7 +17,6 @@ import packageJson from '../package.json' with { type: 'json' };
17
17
  import RadioGroupRadio from './radio-group.radio.js';
18
18
  import styles from './radio-group.styles.js';
19
19
  import assertSlot from './library/assert-slot.js';
20
- import shadowRootMode from './library/shadow-root-mode.js';
21
20
  import final from './library/final.js';
22
21
  import required from './library/required.js';
23
22
  /**
@@ -64,10 +63,12 @@ import required from './library/required.js';
64
63
  */
65
64
  let RadioGroup = class RadioGroup extends LitElement {
66
65
  static { this.formAssociated = true; }
66
+ /* c8 ignore start */
67
67
  static { this.shadowRootOptions = {
68
68
  ...LitElement.shadowRootOptions,
69
- mode: shadowRootMode,
69
+ mode: window.navigator.webdriver ? 'open' : 'closed',
70
70
  }; }
71
+ /* c8 ignore end */
71
72
  static { this.styles = styles; }
72
73
  /**
73
74
  * @default false
@@ -334,7 +335,7 @@ let RadioGroup = class RadioGroup extends LitElement {
334
335
  reportValidity() {
335
336
  this.isReportValidityOrSubmit = true;
336
337
  const isValid = this.#internals.reportValidity();
337
- // Ensures that getters referencing `this.validity.valid` are updated.
338
+ // Ensures getters referencing `this.validity.valid` re-run.
338
339
  this.requestUpdate();
339
340
  return isValid;
340
341
  }
@@ -9,7 +9,6 @@ import { classMap } from 'lit/directives/class-map.js';
9
9
  import { customElement, property, state } from 'lit/decorators.js';
10
10
  import packageJson from '../package.json' with { type: 'json' };
11
11
  import styles from './radio-group.radio.styles.js';
12
- import shadowRootMode from './library/shadow-root-mode.js';
13
12
  import final from './library/final.js';
14
13
  import required from './library/required.js';
15
14
  /**
@@ -34,10 +33,12 @@ let RadioGroupRadio = class RadioGroupRadio extends LitElement {
34
33
  this.#privateRequired = false;
35
34
  this.#value = '';
36
35
  }
36
+ /* c8 ignore start */
37
37
  static { this.shadowRootOptions = {
38
38
  ...LitElement.shadowRootOptions,
39
- mode: shadowRootMode,
39
+ mode: window.navigator.webdriver ? 'open' : 'closed',
40
40
  }; }
41
+ /* c8 ignore end */
41
42
  static { this.styles = styles; }
42
43
  /**
43
44
  * @default undefined
@@ -0,0 +1,90 @@
1
+ import { LitElement } from 'lit';
2
+ import type FormControl from './library/form-control.js';
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ 'glide-core-select': Select;
6
+ }
7
+ }
8
+ /**
9
+ * @attr {boolean} [disabled=false]
10
+ * @attr {boolean} [loading=false]
11
+ * @attr {string} [name='']
12
+ * @attr {number} [offset=4]
13
+ * @attr {boolean} [open=false]
14
+ * @attr {'bottom'|'left'|'right'|'top'|'bottom-start'|'bottom-end'|'left-start'|'left-end'|'right-start'|'right-end'|'top-start'|'top-end'} [placement='bottom-start'] - Select will try to move itself to the opposite of this value if not doing so would result in overflow. For example, if "bottom" results in overflow Menu will try "top" but not "right" or "left".
15
+ * @attr {boolean} [required=false]
16
+ * @attr {string[]} [value=[]]
17
+ *
18
+ * @readonly
19
+ * @attr {string} [version]
20
+ *
21
+ * @slot {Element}
22
+ * @slot {Element} target - The element to which Select will anchor. Can be any focusable element. If you want Select to be filterable, put an Input in this slot. Listen for Input's "input" event, then add and remove Option(s) from Select's default slot based on Input's value.
23
+ *
24
+ * @fires {Event} change
25
+ * @fires {Event} input
26
+ *
27
+ * @readonly
28
+ * @prop {HTMLFormElement | null} form
29
+ *
30
+ * @readonly
31
+ * @prop {ValidityState} validity
32
+ *
33
+ * @method checkValidity
34
+ * @returns boolean
35
+ *
36
+ * @method formAssociatedCallback
37
+ * @method formResetCallback
38
+ *
39
+ * @method reportValidity
40
+ * @returns boolean
41
+ *
42
+ * @method setValidity
43
+ * @param {ValidityStateFlags} [flags]
44
+ */
45
+ export default class Select extends LitElement implements Omit<FormControl, 'hideLabel' | 'orientation' | 'resetValidityFeedback' | 'setCustomValidity'> {
46
+ #private;
47
+ static formAssociated: boolean;
48
+ static shadowRootOptions: ShadowRootInit;
49
+ static styles: import("lit").CSSResult[];
50
+ disabled: boolean;
51
+ loading: boolean;
52
+ name: string;
53
+ /**
54
+ * @default 4
55
+ */
56
+ get offset(): number;
57
+ set offset(offset: number);
58
+ /**
59
+ * @default false
60
+ */
61
+ get open(): boolean;
62
+ set open(isOpen: boolean);
63
+ /**
64
+ * Select will try to move itself to the opposite of this value if not doing so would result in overflow.
65
+ * For example, if "bottom" results in overflow Menu will try "top" but not "right" or "left".
66
+ */
67
+ placement: 'bottom' | 'left' | 'right' | 'top' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end' | 'top-start' | 'top-end';
68
+ /**
69
+ * @default false
70
+ */
71
+ get required(): boolean;
72
+ set required(isRequired: boolean);
73
+ /**
74
+ * @default []
75
+ */
76
+ get value(): string[];
77
+ set value(value: string[]);
78
+ readonly version: string;
79
+ get form(): HTMLFormElement | null;
80
+ checkValidity(): boolean;
81
+ firstUpdated(): void;
82
+ formAssociatedCallback(): void;
83
+ formResetCallback(): void;
84
+ render(): import("lit").TemplateResult<1>;
85
+ reportValidity(): boolean;
86
+ setValidity(flags?: ValidityStateFlags): void;
87
+ get validity(): ValidityState;
88
+ constructor();
89
+ private isCheckingValidity;
90
+ }