@crowdstrike/glide-core 0.32.1 → 0.32.2
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/accordion.js +0 -2
- package/dist/button.d.ts +2 -2
- package/dist/button.js +10 -2
- package/dist/button.styles.js +33 -2
- package/dist/checkbox.js +7 -5
- package/package.json +1 -1
- package/dist/library/localize.test.d.ts +0 -1
- package/dist/library/localize.test.js +0 -38
package/dist/accordion.js
CHANGED
@@ -135,7 +135,6 @@ let Accordion = class Accordion extends LitElement {
|
|
135
135
|
active: this.open || this.isClosing,
|
136
136
|
open: this.open,
|
137
137
|
})}
|
138
|
-
data-test="summary"
|
139
138
|
@click=${this.#onSummaryClick}
|
140
139
|
${ref(this.#summaryElementRef)}
|
141
140
|
>
|
@@ -181,7 +180,6 @@ let Accordion = class Accordion extends LitElement {
|
|
181
180
|
'default-slot': true,
|
182
181
|
indented: this.hasPrefixIcon,
|
183
182
|
})}
|
184
|
-
data-test="default-slot"
|
185
183
|
style=${styleMap({
|
186
184
|
'--private-close-duration': 'var(--glide-core-duration-fast-02)',
|
187
185
|
'--private-easing': 'var(--glide-core-animation-swoop)',
|
package/dist/button.d.ts
CHANGED
@@ -14,7 +14,7 @@ declare global {
|
|
14
14
|
* @attr {string} [tooltip]
|
15
15
|
* @attr {'button'|'submit'|'reset'} [type='button']
|
16
16
|
* @attr {string} [value='']
|
17
|
-
* @attr {'primary'|'secondary'|'tertiary'} [variant='primary']
|
17
|
+
* @attr {'primary'|'secondary'|'tertiary'|'link'} [variant='primary']
|
18
18
|
*
|
19
19
|
* @readonly
|
20
20
|
* @attr {string} [version]
|
@@ -42,7 +42,7 @@ export default class Button extends LitElement {
|
|
42
42
|
tooltip?: string;
|
43
43
|
type: 'button' | 'submit' | 'reset';
|
44
44
|
value: string;
|
45
|
-
variant: 'primary' | 'secondary' | 'tertiary';
|
45
|
+
variant: 'primary' | 'secondary' | 'tertiary' | 'link';
|
46
46
|
readonly version: string;
|
47
47
|
get form(): HTMLFormElement | null;
|
48
48
|
click(): void;
|
package/dist/button.js
CHANGED
@@ -23,7 +23,7 @@ import required from './library/required.js';
|
|
23
23
|
* @attr {string} [tooltip]
|
24
24
|
* @attr {'button'|'submit'|'reset'} [type='button']
|
25
25
|
* @attr {string} [value='']
|
26
|
-
* @attr {'primary'|'secondary'|'tertiary'} [variant='primary']
|
26
|
+
* @attr {'primary'|'secondary'|'tertiary'|'link'} [variant='primary']
|
27
27
|
*
|
28
28
|
* @readonly
|
29
29
|
* @attr {string} [version]
|
@@ -80,18 +80,22 @@ let Button = class Button extends LitElement {
|
|
80
80
|
primary: this.variant === 'primary',
|
81
81
|
secondary: this.variant === 'secondary',
|
82
82
|
tertiary: this.variant === 'tertiary',
|
83
|
+
link: this.variant === 'link',
|
83
84
|
large: this.size === 'large',
|
84
85
|
small: this.size === 'small',
|
85
86
|
disabled: this.disabled,
|
86
87
|
'prefix-icon': this.hasPrefixIcon,
|
87
88
|
'suffix-icon': this.hasSuffixIcon,
|
88
89
|
})}
|
89
|
-
data-test="button"
|
90
90
|
slot="target"
|
91
91
|
@click=${this.#onClick}
|
92
92
|
${ref(this.#buttonElementRef)}
|
93
93
|
>
|
94
94
|
<slot
|
95
|
+
class=${classMap({
|
96
|
+
'prefix-icon-slot': true,
|
97
|
+
hidden: this.variant === 'link',
|
98
|
+
})}
|
95
99
|
name="prefix-icon"
|
96
100
|
@slotchange=${this.#onPrefixIconSlotChange}
|
97
101
|
${ref(this.#prefixIconSlotElementRef)}
|
@@ -105,6 +109,10 @@ let Button = class Button extends LitElement {
|
|
105
109
|
${this.label}
|
106
110
|
|
107
111
|
<slot
|
112
|
+
class=${classMap({
|
113
|
+
'suffix-icon-slot': true,
|
114
|
+
hidden: this.variant === 'link',
|
115
|
+
})}
|
108
116
|
name="suffix-icon"
|
109
117
|
@slotchange=${this.#onSuffixIconSlotChange}
|
110
118
|
${ref(this.#suffixIconSlotElementRef)}
|
package/dist/button.styles.js
CHANGED
@@ -135,17 +135,48 @@ export default [
|
|
135
135
|
}
|
136
136
|
}
|
137
137
|
|
138
|
-
&.
|
138
|
+
&.link {
|
139
|
+
background-color: initial;
|
140
|
+
border: none;
|
141
|
+
border-radius: var(--glide-core-rounding-base-radius-xxs);
|
142
|
+
color: var(--glide-core-color-interactive-text-link);
|
143
|
+
font-size: var(--glide-core-typography-size-body-default);
|
144
|
+
font-weight: var(--glide-core-typography-weight-regular);
|
145
|
+
padding: 0;
|
146
|
+
|
147
|
+
&.disabled {
|
148
|
+
color: var(--glide-core-color-interactive-text-link--disabled);
|
149
|
+
}
|
150
|
+
|
151
|
+
&:not(:active):hover:not(.disabled) {
|
152
|
+
color: var(--glide-core-color-interactive-text-link--hover);
|
153
|
+
text-decoration: underline;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
&.large:not(.link) {
|
139
158
|
block-size: 2.125rem;
|
140
159
|
font-size: var(--glide-core-typography-size-body-large);
|
141
160
|
min-inline-size: 2.75rem;
|
142
161
|
}
|
143
162
|
|
144
|
-
&.small {
|
163
|
+
&.small:not(.link) {
|
145
164
|
block-size: 1.75rem;
|
146
165
|
font-size: var(--glide-core-typography-size-body-small);
|
147
166
|
min-inline-size: 2.5625rem;
|
148
167
|
}
|
149
168
|
}
|
169
|
+
|
170
|
+
.prefix-icon-slot {
|
171
|
+
&.hidden {
|
172
|
+
display: none;
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
.suffix-icon-slot {
|
177
|
+
&.hidden {
|
178
|
+
display: none;
|
179
|
+
}
|
180
|
+
}
|
150
181
|
`,
|
151
182
|
];
|
package/dist/checkbox.js
CHANGED
@@ -158,11 +158,13 @@ let Checkbox = class Checkbox extends LitElement {
|
|
158
158
|
});
|
159
159
|
this.#intersectionObserver.observe(this);
|
160
160
|
}
|
161
|
+
/* v8 ignore start */
|
161
162
|
disconnectedCallback() {
|
162
163
|
super.disconnectedCallback();
|
163
164
|
this.form?.removeEventListener('formdata', this.#onFormdata);
|
164
165
|
this.#intersectionObserver?.disconnect();
|
165
166
|
}
|
167
|
+
/* v8 ignore end */
|
166
168
|
get validity() {
|
167
169
|
// If we're in a Checkbox Group, `disabled`, `required`, and whether or not
|
168
170
|
// the form has been submitted don't apply because Checkbox Group handles those
|
@@ -201,7 +203,7 @@ let Checkbox = class Checkbox extends LitElement {
|
|
201
203
|
this.indeterminate = this.getAttribute('indeterminate') === '';
|
202
204
|
}
|
203
205
|
render() {
|
204
|
-
return html `<div class="component"
|
206
|
+
return html `<div class="component">
|
205
207
|
${when(this.privateVariant === 'minimal', () => html `
|
206
208
|
<label
|
207
209
|
class="label-and-input-and-checkbox"
|
@@ -289,7 +291,6 @@ let Checkbox = class Checkbox extends LitElement {
|
|
289
291
|
aria-describedby="summary description"
|
290
292
|
aria-invalid=${this.#isShowValidationFeedback}
|
291
293
|
class="input"
|
292
|
-
data-test="input"
|
293
294
|
id="input"
|
294
295
|
type="checkbox"
|
295
296
|
.checked=${this.checked}
|
@@ -343,8 +344,9 @@ let Checkbox = class Checkbox extends LitElement {
|
|
343
344
|
${when(this.#isShowValidationFeedback && this.validityMessage, () => html `<span
|
344
345
|
class="validity-message"
|
345
346
|
data-test="validity-message"
|
346
|
-
|
347
|
-
|
347
|
+
>
|
348
|
+
${unsafeHTML(this.validityMessage)}
|
349
|
+
</span>`)}
|
348
350
|
</div>
|
349
351
|
</glide-core-private-label>`)}
|
350
352
|
</div>`;
|
@@ -500,7 +502,7 @@ let Checkbox = class Checkbox extends LitElement {
|
|
500
502
|
if (event.target instanceof HTMLInputElement) {
|
501
503
|
this.checked = event.target.checked;
|
502
504
|
}
|
503
|
-
// If the input
|
505
|
+
// If the input has been interacted with it's no longer indeterminate.
|
504
506
|
this.indeterminate = false;
|
505
507
|
if (event.type === 'change') {
|
506
508
|
// Unlike "input" events, "change" events aren't composed. So we have to
|
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,38 +0,0 @@
|
|
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 { LitElement } from 'lit';
|
8
|
-
import { customElement } from 'lit/decorators.js';
|
9
|
-
import { expect, fixture, html } from '@open-wc/testing';
|
10
|
-
import en from '../translations/en.js';
|
11
|
-
import { LocalizeController } from './localize.js';
|
12
|
-
let Component = class Component extends LitElement {
|
13
|
-
constructor() {
|
14
|
-
super(...arguments);
|
15
|
-
this.localize = new LocalizeController(this);
|
16
|
-
}
|
17
|
-
};
|
18
|
-
Component = __decorate([
|
19
|
-
customElement('glide-core-component')
|
20
|
-
], Component);
|
21
|
-
it('can call any term from en translation if locale is Japanese', async () => {
|
22
|
-
const host = await fixture(html `<glide-core-component></glide-core-component>`);
|
23
|
-
host.lang = 'ja';
|
24
|
-
expect(host.localize.lang()).to.equal('ja');
|
25
|
-
const keys = Object.keys(en);
|
26
|
-
for (const key of keys) {
|
27
|
-
expect(host.localize.term(key)).to.be.ok;
|
28
|
-
}
|
29
|
-
});
|
30
|
-
it('can call any term from en translation if locale is French', async () => {
|
31
|
-
const host = await fixture(html `<glide-core-component></glide-core-component>`);
|
32
|
-
host.lang = 'fr';
|
33
|
-
expect(host.localize.lang()).to.equal('fr');
|
34
|
-
const keys = Object.keys(en);
|
35
|
-
for (const key of keys) {
|
36
|
-
expect(host.localize.term(key)).to.be.ok;
|
37
|
-
}
|
38
|
-
});
|