@crowdstrike/glide-core 0.29.2 → 0.30.1

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 (122) hide show
  1. package/dist/accordion.js +240 -1
  2. package/dist/accordion.styles.js +13 -7
  3. package/dist/button-group.button.js +143 -1
  4. package/dist/button-group.button.styles.js +43 -15
  5. package/dist/button-group.js +249 -1
  6. package/dist/button-group.styles.js +10 -5
  7. package/dist/button.js +206 -1
  8. package/dist/button.styles.js +12 -7
  9. package/dist/checkbox-group.js +479 -14
  10. package/dist/checkbox-group.styles.js +5 -2
  11. package/dist/checkbox.js +519 -32
  12. package/dist/checkbox.styles.js +10 -5
  13. package/dist/drawer.js +168 -1
  14. package/dist/drawer.styles.js +5 -2
  15. package/dist/dropdown.js +2423 -123
  16. package/dist/dropdown.option.js +536 -1
  17. package/dist/dropdown.option.styles.js +5 -2
  18. package/dist/dropdown.styles.js +15 -8
  19. package/dist/form-controls-layout.js +102 -1
  20. package/dist/form-controls-layout.styles.js +5 -2
  21. package/dist/icon-button.js +139 -1
  22. package/dist/icon-button.styles.js +19 -7
  23. package/dist/icons/checked.js +28 -1
  24. package/dist/icons/chevron.js +21 -1
  25. package/dist/icons/magnifying-glass.js +23 -1
  26. package/dist/icons/pencil.js +21 -1
  27. package/dist/icons/severity-critical.js +20 -1
  28. package/dist/icons/severity-informational.js +20 -1
  29. package/dist/icons/severity-medium.js +20 -1
  30. package/dist/icons/x.js +21 -1
  31. package/dist/inline-alert.js +118 -1
  32. package/dist/inline-alert.styles.js +5 -2
  33. package/dist/input.d.ts +8 -2
  34. package/dist/input.js +505 -41
  35. package/dist/input.styles.js +25 -4
  36. package/dist/label.js +303 -1
  37. package/dist/label.styles.js +11 -5
  38. package/dist/library/assert-slot.js +136 -1
  39. package/dist/library/expect-unhandled-rejection.js +14 -1
  40. package/dist/library/expect-window-error.js +26 -1
  41. package/dist/library/final.js +18 -1
  42. package/dist/library/form-control.js +1 -1
  43. package/dist/library/localize.js +10 -1
  44. package/dist/library/mouse.js +35 -1
  45. package/dist/library/on-resize.js +24 -1
  46. package/dist/library/required.js +35 -1
  47. package/dist/library/shadow-root-mode.js +4 -1
  48. package/dist/library/unique-id.js +3 -1
  49. package/dist/link.js +92 -1
  50. package/dist/link.styles.js +10 -5
  51. package/dist/menu.d.ts +3 -2
  52. package/dist/menu.js +1259 -1
  53. package/dist/menu.styles.js +35 -19
  54. package/dist/modal.d.ts +4 -0
  55. package/dist/modal.icon-button.js +60 -1
  56. package/dist/modal.icon-button.styles.js +5 -2
  57. package/dist/modal.js +473 -1
  58. package/dist/modal.styles.js +71 -22
  59. package/dist/option.d.ts +74 -0
  60. package/dist/option.js +498 -0
  61. package/dist/option.styles.js +140 -0
  62. package/dist/{menu.options.d.ts → options.d.ts} +5 -6
  63. package/dist/options.js +130 -0
  64. package/dist/options.styles.js +21 -0
  65. package/dist/popover.js +620 -1
  66. package/dist/popover.styles.js +11 -5
  67. package/dist/radio-group.js +624 -17
  68. package/dist/radio-group.radio.js +211 -1
  69. package/dist/radio-group.radio.styles.js +9 -4
  70. package/dist/radio-group.styles.js +5 -2
  71. package/dist/slider.js +1040 -61
  72. package/dist/slider.styles.js +9 -4
  73. package/dist/spinner.js +60 -1
  74. package/dist/spinner.styles.js +5 -2
  75. package/dist/split-button.js +116 -1
  76. package/dist/split-button.primary-button.js +100 -1
  77. package/dist/split-button.primary-button.styles.js +13 -6
  78. package/dist/split-button.primary-link.js +102 -1
  79. package/dist/split-button.secondary-button.d.ts +2 -3
  80. package/dist/split-button.secondary-button.js +121 -1
  81. package/dist/split-button.secondary-button.styles.js +12 -7
  82. package/dist/split-button.styles.js +9 -4
  83. package/dist/styles/focus-outline.js +9 -3
  84. package/dist/styles/fonts.css +6 -1
  85. package/dist/styles/opacity-and-scale-animation.js +6 -3
  86. package/dist/styles/skeleton.js +6 -3
  87. package/dist/styles/variables.css +410 -1
  88. package/dist/styles/visually-hidden.js +6 -3
  89. package/dist/tab.group.js +386 -1
  90. package/dist/tab.group.styles.js +5 -2
  91. package/dist/tab.js +133 -1
  92. package/dist/tab.panel.js +93 -1
  93. package/dist/tab.panel.styles.js +11 -5
  94. package/dist/tab.styles.js +9 -4
  95. package/dist/tag.js +207 -1
  96. package/dist/tag.styles.js +10 -5
  97. package/dist/textarea.js +353 -19
  98. package/dist/textarea.styles.js +23 -4
  99. package/dist/toast.js +130 -1
  100. package/dist/toast.toasts.js +248 -25
  101. package/dist/toast.toasts.styles.js +9 -4
  102. package/dist/toggle.js +178 -1
  103. package/dist/toggle.styles.js +25 -5
  104. package/dist/tooltip.container.js +130 -1
  105. package/dist/tooltip.container.styles.js +5 -2
  106. package/dist/tooltip.js +484 -1
  107. package/dist/tooltip.styles.js +21 -5
  108. package/dist/translations/en.js +36 -1
  109. package/dist/translations/fr.js +37 -1
  110. package/dist/translations/ja.js +37 -1
  111. package/package.json +8 -12
  112. package/dist/menu.button.d.ts +0 -42
  113. package/dist/menu.button.js +0 -1
  114. package/dist/menu.button.styles.js +0 -32
  115. package/dist/menu.link.d.ts +0 -44
  116. package/dist/menu.link.js +0 -1
  117. package/dist/menu.link.styles.js +0 -35
  118. package/dist/menu.options.js +0 -1
  119. package/dist/menu.options.styles.d.ts +0 -2
  120. package/dist/menu.options.styles.js +0 -20
  121. /package/dist/{menu.button.styles.d.ts → option.styles.d.ts} +0 -0
  122. /package/dist/{menu.link.styles.d.ts → options.styles.d.ts} +0 -0
@@ -1,6 +1,10 @@
1
- import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export default[css`
2
- ${focusOutline(":host(:focus-visible) .container")}
3
- `,css`
1
+ import { css } from 'lit';
2
+ import focusOutline from './styles/focus-outline.js';
3
+ export default [
4
+ css `
5
+ ${focusOutline(':host(:focus-visible) .container')}
6
+ `,
7
+ css `
4
8
  :host {
5
9
  outline: none;
6
10
  }
@@ -42,4 +46,5 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
42
46
  gap: var(--glide-core-spacing-base-xs);
43
47
  white-space: nowrap;
44
48
  }
45
- `];
49
+ `,
50
+ ];
package/dist/tag.js CHANGED
@@ -1 +1,207 @@
1
- var __decorate=this&&this.__decorate||function(e,t,o,i){var a,s=arguments.length,l=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,i);else for(var n=e.length-1;n>=0;n--)(a=e[n])&&(l=(s<3?a(l):s>3?a(t,o,l):a(t,o))||l);return s>3&&l&&Object.defineProperty(t,o,l),l};import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import{when}from"lit/directives/when.js";import packageJson from"../package.json"with{type:"json"};import{LocalizeController}from"./library/localize.js";import pencilIcon from"./icons/pencil.js";import styles from"./tag.styles.js";import xIcon from"./icons/x.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";let Tag=class Tag extends LitElement{constructor(){super(...arguments),this.disabled=!1,this.privateEditable=!1,this.removable=!1,this.version=packageJson.version,this.#e=100,this.#t=createRef(),this.#o=!1,this.#i=new LocalizeController(this),this.#a=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:shadowRootMode}}static{this.styles=styles}click(){this.#a.value?.click()}firstUpdated(){this.#t.value?.addEventListener("animationend",(()=>{this.#t.value?.classList.remove("added")}),{once:!0})}focus(){this.#a.value?.focus()}render(){return html`<div class="${classMap({component:!0,added:!0,disabled:this.disabled})}" data-test="component" data-animation-duration="${this.#e}" style="--private-animation-duration: ${this.#e}ms" ${ref(this.#t)}><slot class="icon-slot" name="icon"></slot><div class="label">${this.label}</div>${when(this.privateEditable,(()=>html`<button aria-label="${this.#i.term("editTag",this.label)}" class="${classMap({"edit-button":!0,disabled:this.disabled})}" data-test="edit-button" type="button" ?disabled="${this.disabled}" @click="${this.#s}" @keydown="${this.#l}">${pencilIcon}</button>`))} ${when(this.removable,(()=>html`<button aria-label="${this.#i.term("removeTag",this.label)}" class="${classMap({"removal-button":!0,disabled:this.disabled})}" data-test="removal-button" type="button" ?disabled="${this.disabled}" @click="${this.#n}" @keydown="${this.#r}" ${ref(this.#a)}>${xIcon}</button>`))}</div>`}#e;#t;#o;#i;#a;#s(){this.#o?this.#o=!1:this.dispatchEvent(new Event("edit",{bubbles:!0,composed:!0}))}#l(e){["Enter"," "].includes(e.key)&&(this.#o=!0,this.dispatchEvent(new Event("edit",{bubbles:!0,composed:!0})))}#n(){this.#o?this.#o=!1:(setTimeout((()=>{this.remove()}),this.#e),this.#t.value?.classList.add("removed"),this.dispatchEvent(new Event("remove",{bubbles:!0,composed:!0})))}#r(e){["Enter"," "].includes(e.key)&&(this.#o=!0,setTimeout((()=>{this.remove()}),this.#e),this.#t.value?.classList.add("removed"),this.dispatchEvent(new Event("remove",{bubbles:!0,composed:!0})))}};__decorate([property({reflect:!0}),required],Tag.prototype,"label",void 0),__decorate([property({reflect:!0,type:Boolean})],Tag.prototype,"disabled",void 0),__decorate([property({attribute:"private-editable",reflect:!0,type:Boolean})],Tag.prototype,"privateEditable",void 0),__decorate([property({reflect:!0,type:Boolean})],Tag.prototype,"removable",void 0),__decorate([property({reflect:!0})],Tag.prototype,"version",void 0),Tag=__decorate([customElement("glide-core-tag"),final],Tag);export default Tag;
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { html, LitElement } from 'lit';
8
+ import { classMap } from 'lit/directives/class-map.js';
9
+ import { createRef, ref } from 'lit/directives/ref.js';
10
+ import { customElement, property } from 'lit/decorators.js';
11
+ import { when } from 'lit/directives/when.js';
12
+ import packageJson from '../package.json' with { type: 'json' };
13
+ import { LocalizeController } from './library/localize.js';
14
+ import pencilIcon from './icons/pencil.js';
15
+ import styles from './tag.styles.js';
16
+ import xIcon from './icons/x.js';
17
+ import shadowRootMode from './library/shadow-root-mode.js';
18
+ import final from './library/final.js';
19
+ import required from './library/required.js';
20
+ /**
21
+ * @attr {string} label
22
+ * @attr {boolean} [disabled=false]
23
+ * @attr {boolean} [removable=false]
24
+ *
25
+ * @readonly
26
+ * @attr {string} [version]
27
+ *
28
+ * @slot {Element} [icon]
29
+ *
30
+ * @fires {Event} edit
31
+ * @fires {Event} remove
32
+ */
33
+ let Tag = class Tag extends LitElement {
34
+ constructor() {
35
+ super(...arguments);
36
+ this.disabled = false;
37
+ // Private because it's only meant to be used by Dropdown.
38
+ this.privateEditable = false;
39
+ this.removable = false;
40
+ this.version = packageJson.version;
41
+ this.#animationDuration = 100;
42
+ this.#componentElementRef = createRef();
43
+ // Guards against dispatching "edit" and "remove" on click when the click came
44
+ // from Enter or Space so the event isn't dispatched twice. Using
45
+ // `event.detail !==0` instead would work. But it would exclude clicks via
46
+ // `this.click()`.
47
+ //
48
+ // Why not just dispatch those events on "click"? Because Dropdown has a "click"
49
+ // handler of its own that opens Dropdown except when the click came from Tag's
50
+ // edit or removal buttons. It needs to know if an "edit" or "remove" event was
51
+ // dispatched before its "click" handler is called to determine in that handler
52
+ // if it should return early instead of opening.
53
+ this.#isKeyboardClick = false;
54
+ this.#localize = new LocalizeController(this);
55
+ this.#removalButtonElementRef = createRef();
56
+ }
57
+ static { this.shadowRootOptions = {
58
+ ...LitElement.shadowRootOptions,
59
+ delegatesFocus: true,
60
+ mode: shadowRootMode,
61
+ }; }
62
+ static { this.styles = styles; }
63
+ click() {
64
+ this.#removalButtonElementRef.value?.click();
65
+ }
66
+ firstUpdated() {
67
+ this.#componentElementRef.value?.addEventListener('animationend', () => {
68
+ this.#componentElementRef.value?.classList.remove('added');
69
+ }, { once: true });
70
+ }
71
+ focus() {
72
+ this.#removalButtonElementRef.value?.focus();
73
+ }
74
+ render() {
75
+ return html `
76
+ <div
77
+ class=${classMap({
78
+ component: true,
79
+ added: true,
80
+ disabled: this.disabled,
81
+ })}
82
+ data-test="component"
83
+ data-animation-duration=${this.#animationDuration}
84
+ style="--private-animation-duration: ${this.#animationDuration}ms"
85
+ ${ref(this.#componentElementRef)}
86
+ >
87
+ <slot class="icon-slot" name="icon">
88
+ <!-- @type {Element} -->
89
+ </slot>
90
+
91
+ <div class="label">${this.label}</div>
92
+
93
+ ${when(this.privateEditable, () => {
94
+ return html `<button
95
+ aria-label=${this.#localize.term('editTag',
96
+ // `this.label` is always defined because it's a required attribute.
97
+ //
98
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
99
+ this.label)}
100
+ class=${classMap({
101
+ 'edit-button': true,
102
+ disabled: this.disabled,
103
+ })}
104
+ data-test="edit-button"
105
+ type="button"
106
+ ?disabled=${this.disabled}
107
+ @click=${this.#onEditButtonClick}
108
+ @keydown=${this.#onEditButtonKeydown}
109
+ >
110
+ ${pencilIcon}
111
+ </button>`;
112
+ })}
113
+ ${when(this.removable, () => html `<button
114
+ aria-label=${this.#localize.term('removeTag',
115
+ // `this.label` is always defined because it's a required attribute.
116
+ //
117
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
118
+ this.label)}
119
+ class=${classMap({
120
+ 'removal-button': true,
121
+ disabled: this.disabled,
122
+ })}
123
+ data-test="removal-button"
124
+ type="button"
125
+ ?disabled=${this.disabled}
126
+ @click=${this.#onRemovalButtonClick}
127
+ @keydown=${this.#onRemovalButtonKeydown}
128
+ ${ref(this.#removalButtonElementRef)}
129
+ >
130
+ ${xIcon}
131
+ </button>`)}
132
+ </div>
133
+ `;
134
+ }
135
+ #animationDuration;
136
+ #componentElementRef;
137
+ // Guards against dispatching "edit" and "remove" on click when the click came
138
+ // from Enter or Space so the event isn't dispatched twice. Using
139
+ // `event.detail !==0` instead would work. But it would exclude clicks via
140
+ // `this.click()`.
141
+ //
142
+ // Why not just dispatch those events on "click"? Because Dropdown has a "click"
143
+ // handler of its own that opens Dropdown except when the click came from Tag's
144
+ // edit or removal buttons. It needs to know if an "edit" or "remove" event was
145
+ // dispatched before its "click" handler is called to determine in that handler
146
+ // if it should return early instead of opening.
147
+ #isKeyboardClick;
148
+ #localize;
149
+ #removalButtonElementRef;
150
+ #onEditButtonClick() {
151
+ if (this.#isKeyboardClick) {
152
+ this.#isKeyboardClick = false;
153
+ }
154
+ else {
155
+ this.dispatchEvent(new Event('edit', { bubbles: true, composed: true }));
156
+ }
157
+ }
158
+ #onEditButtonKeydown(event) {
159
+ if (['Enter', ' '].includes(event.key)) {
160
+ this.#isKeyboardClick = true;
161
+ this.dispatchEvent(new Event('edit', { bubbles: true, composed: true }));
162
+ }
163
+ }
164
+ #onRemovalButtonClick() {
165
+ if (this.#isKeyboardClick) {
166
+ this.#isKeyboardClick = false;
167
+ }
168
+ else {
169
+ setTimeout(() => {
170
+ this.remove();
171
+ }, this.#animationDuration);
172
+ this.#componentElementRef.value?.classList.add('removed');
173
+ this.dispatchEvent(new Event('remove', { bubbles: true, composed: true }));
174
+ }
175
+ }
176
+ #onRemovalButtonKeydown(event) {
177
+ if (['Enter', ' '].includes(event.key)) {
178
+ this.#isKeyboardClick = true;
179
+ setTimeout(() => {
180
+ this.remove();
181
+ }, this.#animationDuration);
182
+ this.#componentElementRef.value?.classList.add('removed');
183
+ this.dispatchEvent(new Event('remove', { bubbles: true, composed: true }));
184
+ }
185
+ }
186
+ };
187
+ __decorate([
188
+ property({ reflect: true }),
189
+ required
190
+ ], Tag.prototype, "label", void 0);
191
+ __decorate([
192
+ property({ reflect: true, type: Boolean })
193
+ ], Tag.prototype, "disabled", void 0);
194
+ __decorate([
195
+ property({ attribute: 'private-editable', reflect: true, type: Boolean })
196
+ ], Tag.prototype, "privateEditable", void 0);
197
+ __decorate([
198
+ property({ reflect: true, type: Boolean })
199
+ ], Tag.prototype, "removable", void 0);
200
+ __decorate([
201
+ property({ reflect: true })
202
+ ], Tag.prototype, "version", void 0);
203
+ Tag = __decorate([
204
+ customElement('glide-core-tag'),
205
+ final
206
+ ], Tag);
207
+ export default Tag;
@@ -1,7 +1,11 @@
1
- import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export default[css`
2
- ${focusOutline(".edit-button:focus-visible")}
3
- ${focusOutline(".removal-button:focus-visible")}
4
- `,css`
1
+ import { css } from 'lit';
2
+ import focusOutline from './styles/focus-outline.js';
3
+ export default [
4
+ css `
5
+ ${focusOutline('.edit-button:focus-visible')}
6
+ ${focusOutline('.removal-button:focus-visible')}
7
+ `,
8
+ css `
5
9
  @keyframes fade-in {
6
10
  0% {
7
11
  opacity: 0;
@@ -138,4 +142,5 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
138
142
  color: var(--glide-core-color-interactive-icon-active--hover);
139
143
  }
140
144
  }
141
- `];
145
+ `,
146
+ ];