@crowdstrike/glide-core 0.26.1 → 0.28.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.
- package/dist/accordion.d.ts +2 -2
- package/dist/accordion.js +1 -1
- package/dist/button-group.button.d.ts +2 -2
- package/dist/button-group.button.js +1 -1
- package/dist/button-group.d.ts +3 -3
- package/dist/button-group.js +1 -1
- package/dist/button.d.ts +2 -2
- package/dist/button.js +1 -1
- package/dist/checkbox-group.d.ts +3 -3
- package/dist/checkbox-group.js +9 -9
- package/dist/checkbox.d.ts +2 -3
- package/dist/checkbox.js +3 -3
- package/dist/checkbox.styles.js +8 -16
- package/dist/drawer.d.ts +2 -2
- package/dist/drawer.js +1 -1
- package/dist/dropdown.d.ts +17 -22
- package/dist/dropdown.js +102 -107
- package/dist/dropdown.option.d.ts +9 -9
- package/dist/dropdown.option.js +1 -1
- package/dist/dropdown.option.styles.js +16 -79
- package/dist/dropdown.styles.js +57 -74
- package/dist/form-controls-layout.d.ts +3 -3
- package/dist/form-controls-layout.js +1 -1
- package/dist/icon-button.d.ts +2 -2
- package/dist/icon-button.js +1 -1
- package/dist/icons/checked.js +1 -1
- package/dist/inline-alert.d.ts +2 -2
- package/dist/inline-alert.js +1 -1
- package/dist/input.d.ts +2 -2
- package/dist/input.js +2 -2
- package/dist/input.styles.js +9 -7
- package/dist/label.d.ts +2 -2
- package/dist/label.js +1 -1
- package/dist/label.styles.js +5 -1
- package/dist/library/assert-slot.d.ts +1 -1
- package/dist/library/assert-slot.test.js +22 -22
- package/dist/library/expect-window-error.js +1 -1
- package/dist/library/final.test.js +9 -9
- package/dist/library/form-control.d.ts +1 -1
- package/dist/library/localize.d.ts +5 -0
- package/dist/library/localize.test.js +6 -6
- package/dist/library/required.test.js +5 -5
- package/dist/library/unique-id.d.ts +2 -0
- package/dist/library/unique-id.js +1 -0
- package/dist/link.d.ts +2 -3
- package/dist/link.js +1 -1
- package/dist/link.styles.js +1 -1
- package/dist/menu.button.d.ts +2 -2
- package/dist/menu.button.js +1 -1
- package/dist/menu.button.styles.js +3 -3
- package/dist/menu.d.ts +3 -9
- package/dist/menu.js +1 -1
- package/dist/menu.link.d.ts +2 -2
- package/dist/menu.link.js +1 -1
- package/dist/menu.link.styles.js +3 -3
- package/dist/menu.options.d.ts +3 -4
- package/dist/menu.options.js +1 -1
- package/dist/menu.options.styles.js +3 -20
- package/dist/modal.d.ts +6 -6
- package/dist/modal.icon-button.d.ts +2 -2
- package/dist/modal.icon-button.js +1 -1
- package/dist/modal.js +1 -1
- package/dist/popover.d.ts +2 -2
- package/dist/popover.js +1 -1
- package/dist/radio-group.d.ts +3 -3
- package/dist/radio-group.js +6 -6
- package/dist/radio-group.radio.d.ts +2 -2
- package/dist/radio-group.radio.js +1 -1
- package/dist/slider.d.ts +116 -0
- package/dist/slider.js +168 -0
- package/dist/slider.styles.d.ts +2 -0
- package/dist/slider.styles.js +168 -0
- package/dist/spinner.d.ts +2 -2
- package/dist/spinner.js +1 -1
- package/dist/split-button.d.ts +4 -10
- package/dist/split-button.js +1 -1
- package/dist/split-button.primary-button.d.ts +2 -2
- package/dist/split-button.primary-button.js +1 -1
- package/dist/split-button.primary-button.styles.js +4 -14
- package/dist/split-button.primary-link.d.ts +2 -2
- package/dist/split-button.primary-link.js +1 -1
- package/dist/split-button.secondary-button.d.ts +3 -4
- package/dist/split-button.secondary-button.js +1 -1
- package/dist/split-button.secondary-button.styles.js +4 -15
- package/dist/styles/variables.css +1 -1
- package/dist/tab.d.ts +12 -4
- package/dist/tab.group.d.ts +4 -5
- package/dist/tab.group.js +1 -1
- package/dist/tab.group.styles.js +14 -16
- package/dist/tab.js +1 -1
- package/dist/tab.panel.d.ts +12 -5
- package/dist/tab.panel.js +1 -1
- package/dist/tag.d.ts +2 -4
- package/dist/tag.js +1 -1
- package/dist/tag.styles.js +7 -52
- package/dist/textarea.d.ts +2 -2
- package/dist/textarea.js +7 -7
- package/dist/textarea.styles.js +17 -2
- package/dist/toast.d.ts +3 -3
- package/dist/toast.js +1 -1
- package/dist/toast.toasts.d.ts +9 -9
- package/dist/toast.toasts.js +17 -17
- package/dist/toggle.d.ts +2 -2
- package/dist/toggle.js +1 -1
- package/dist/tooltip.container.d.ts +2 -2
- package/dist/tooltip.container.js +1 -1
- package/dist/tooltip.d.ts +3 -3
- package/dist/tooltip.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/fr.d.ts +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/ja.d.ts +1 -1
- package/dist/translations/ja.js +1 -1
- package/package.json +19 -18
@@ -10,7 +10,7 @@ import { aTimeout, expect, fixture, html, waitUntil } from '@open-wc/testing';
|
|
10
10
|
import sinon from 'sinon';
|
11
11
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
12
12
|
import assertSlot from './assert-slot.js';
|
13
|
-
let
|
13
|
+
let WithSlot = class WithSlot extends LitElement {
|
14
14
|
constructor() {
|
15
15
|
super(...arguments);
|
16
16
|
this.optional = false;
|
@@ -25,32 +25,32 @@ let GlideCoreWithSlot = class GlideCoreWithSlot extends LitElement {
|
|
25
25
|
};
|
26
26
|
__decorate([
|
27
27
|
property()
|
28
|
-
],
|
28
|
+
], WithSlot.prototype, "name", void 0);
|
29
29
|
__decorate([
|
30
30
|
property({ type: Boolean })
|
31
|
-
],
|
31
|
+
], WithSlot.prototype, "optional", void 0);
|
32
32
|
__decorate([
|
33
33
|
property({ type: Array })
|
34
|
-
],
|
35
|
-
|
34
|
+
], WithSlot.prototype, "slotted", void 0);
|
35
|
+
WithSlot = __decorate([
|
36
36
|
customElement('glide-core-with-slot')
|
37
|
-
],
|
38
|
-
let
|
37
|
+
], WithSlot);
|
38
|
+
let WhenNotUsedOnSlot = class WhenNotUsedOnSlot extends LitElement {
|
39
39
|
render() {
|
40
40
|
return html `<div ${assertSlot()}></div>`;
|
41
41
|
}
|
42
42
|
};
|
43
|
-
|
43
|
+
WhenNotUsedOnSlot = __decorate([
|
44
44
|
customElement('glide-core-when-not-used-on-slot')
|
45
|
-
],
|
46
|
-
let
|
45
|
+
], WhenNotUsedOnSlot);
|
46
|
+
let WhenNotUsedInsideATag = class WhenNotUsedInsideATag extends LitElement {
|
47
47
|
render() {
|
48
48
|
return html `<slot>${assertSlot()}</slot>`;
|
49
49
|
}
|
50
50
|
};
|
51
|
-
|
51
|
+
WhenNotUsedInsideATag = __decorate([
|
52
52
|
customElement('glide-core-when-not-used-inside-tag')
|
53
|
-
],
|
53
|
+
], WhenNotUsedInsideATag);
|
54
54
|
it('throws when a required default slot is empty', async () => {
|
55
55
|
const stub = sinon.stub(console, 'error');
|
56
56
|
const spy = sinon.spy();
|
@@ -59,7 +59,7 @@ it('throws when a required default slot is empty', async () => {
|
|
59
59
|
await waitUntil(() => spy.callCount);
|
60
60
|
expect(spy.callCount).to.equal(1);
|
61
61
|
expect(spy.args.at(0)?.at(0) instanceof PromiseRejectionEvent).to.be.true;
|
62
|
-
expect(spy.args.at(0)?.at(0).reason.message).to.equal('Expected
|
62
|
+
expect(spy.args.at(0)?.at(0).reason.message).to.equal('Expected WithSlot to have a default slot.');
|
63
63
|
stub.restore();
|
64
64
|
});
|
65
65
|
it('throws when a required default slot is emptied', async () => {
|
@@ -87,7 +87,7 @@ it('throws when a required named slot is empty', async () => {
|
|
87
87
|
await waitUntil(() => spy.callCount);
|
88
88
|
expect(spy.callCount).to.equal(1);
|
89
89
|
expect(spy.args.at(0)?.at(0) instanceof PromiseRejectionEvent).to.be.true;
|
90
|
-
expect(spy.args.at(0)?.at(0).reason.message).to.equal('Expected
|
90
|
+
expect(spy.args.at(0)?.at(0).reason.message).to.equal('Expected WithSlot to have a "test" slot.');
|
91
91
|
stub.restore();
|
92
92
|
});
|
93
93
|
it('throws when a required named slot is emptied', async () => {
|
@@ -117,7 +117,7 @@ it('throws when a typed and required default slot is empty', async () => {
|
|
117
117
|
await waitUntil(() => spy.callCount);
|
118
118
|
expect(spy.callCount).to.equal(1);
|
119
119
|
expect(spy.args.at(0)?.at(0) instanceof PromiseRejectionEvent).to.be.true;
|
120
|
-
expect(spy.args.at(0)?.at(0).reason.message).to.equal('Expected
|
120
|
+
expect(spy.args.at(0)?.at(0).reason.message).to.equal('Expected WithSlot to have a slotted element that extends HTMLButtonElement.');
|
121
121
|
stub.restore();
|
122
122
|
});
|
123
123
|
it('throws when a typed and required default slot is emptied', async () => {
|
@@ -132,7 +132,7 @@ it('throws when a typed and required default slot is emptied', async () => {
|
|
132
132
|
host.innerHTML = '';
|
133
133
|
await waitUntil(() => spy.callCount);
|
134
134
|
expect(spy.callCount).to.equal(1);
|
135
|
-
expect(spy.args.at(0)?.at(0)).to.equal('Uncaught TypeError: Expected
|
135
|
+
expect(spy.args.at(0)?.at(0)).to.equal('Uncaught TypeError: Expected WithSlot to have a slotted element that extends HTMLButtonElement.');
|
136
136
|
// eslint-disable-next-line unicorn/prefer-add-event-listener
|
137
137
|
window.onerror = onerror;
|
138
138
|
stub.restore();
|
@@ -149,7 +149,7 @@ it('throws when a typed and required default slot has the wrong element', async
|
|
149
149
|
<a href="/">Link</a>
|
150
150
|
</glide-core-with-slot>`);
|
151
151
|
expect(spy.callCount).to.equal(1);
|
152
|
-
expect(spy.args.at(0)?.at(0)).to.equal('Uncaught TypeError: Expected
|
152
|
+
expect(spy.args.at(0)?.at(0)).to.equal('Uncaught TypeError: Expected WithSlot to have a slotted element that extends HTMLButtonElement or HTMLDivElement or Text. Extends HTMLAnchorElement instead.');
|
153
153
|
// eslint-disable-next-line unicorn/prefer-add-event-listener
|
154
154
|
window.onerror = onerror;
|
155
155
|
stub.restore();
|
@@ -164,7 +164,7 @@ it('throws when a typed and required default slot only contains text', async ()
|
|
164
164
|
Text
|
165
165
|
</glide-core-with-slot>`);
|
166
166
|
expect(spy.callCount).to.equal(1);
|
167
|
-
expect(spy.args.at(0)?.at(0)).to.equal('Uncaught TypeError: Expected
|
167
|
+
expect(spy.args.at(0)?.at(0)).to.equal('Uncaught TypeError: Expected WithSlot to have a slotted element that extends HTMLButtonElement.');
|
168
168
|
// eslint-disable-next-line unicorn/prefer-add-event-listener
|
169
169
|
window.onerror = onerror;
|
170
170
|
stub.restore();
|
@@ -180,7 +180,7 @@ it('throws when a typed and required named slot is empty', async () => {
|
|
180
180
|
await waitUntil(() => spy.callCount);
|
181
181
|
expect(spy.callCount).to.equal(1);
|
182
182
|
expect(spy.args.at(0)?.at(0) instanceof PromiseRejectionEvent).to.be.true;
|
183
|
-
expect(spy.args.at(0)?.at(0).reason.message).to.equal('Expected the "test" slot of
|
183
|
+
expect(spy.args.at(0)?.at(0).reason.message).to.equal('Expected the "test" slot of WithSlot to have a slotted element that extends HTMLButtonElement.');
|
184
184
|
stub.restore();
|
185
185
|
});
|
186
186
|
it('throws when a typed and required named slot is emptied', async () => {
|
@@ -195,7 +195,7 @@ it('throws when a typed and required named slot is emptied', async () => {
|
|
195
195
|
host.innerHTML = '';
|
196
196
|
await waitUntil(() => spy.callCount);
|
197
197
|
expect(spy.callCount).to.equal(1);
|
198
|
-
expect(spy.args.at(0)?.at(0)).to.equal('Uncaught TypeError: Expected the "test" slot of
|
198
|
+
expect(spy.args.at(0)?.at(0)).to.equal('Uncaught TypeError: Expected the "test" slot of WithSlot to have a slotted element that extends HTMLButtonElement.');
|
199
199
|
// eslint-disable-next-line unicorn/prefer-add-event-listener
|
200
200
|
window.onerror = onerror;
|
201
201
|
stub.restore();
|
@@ -213,7 +213,7 @@ it('throws when a typed and required named slot has the wrong element', async ()
|
|
213
213
|
<a slot="test" href="/">Link</a>
|
214
214
|
</glide-core-with-slot>`);
|
215
215
|
expect(spy.callCount).to.equal(1);
|
216
|
-
expect(spy.args.at(0)?.at(0)).to.equal('Uncaught TypeError: Expected the "test" slot of
|
216
|
+
expect(spy.args.at(0)?.at(0)).to.equal('Uncaught TypeError: Expected the "test" slot of WithSlot to have a slotted element that extends HTMLButtonElement or HTMLDivElement or Text. Extends HTMLAnchorElement instead.');
|
217
217
|
// eslint-disable-next-line unicorn/prefer-add-event-listener
|
218
218
|
window.onerror = onerror;
|
219
219
|
stub.restore();
|
@@ -254,7 +254,7 @@ it('throws when a typed optional slot has the wrong element', async () => {
|
|
254
254
|
<a href="/">Link</a>
|
255
255
|
</glide-core-with-slot>`);
|
256
256
|
expect(spy.callCount).to.equal(1);
|
257
|
-
expect(spy.args.at(0)?.at(0)).to.equal('Uncaught TypeError: Expected
|
257
|
+
expect(spy.args.at(0)?.at(0)).to.equal('Uncaught TypeError: Expected WithSlot to have a slotted element that extends HTMLButtonElement or HTMLDivElement or Text. Extends HTMLAnchorElement instead.');
|
258
258
|
// eslint-disable-next-line unicorn/prefer-add-event-listener
|
259
259
|
window.onerror = onerror;
|
260
260
|
stub.restore();
|
@@ -1 +1 @@
|
|
1
|
-
import{expect,waitUntil}from"@open-wc/testing";import sinon from"sinon";export default async function(o){const t=sinon.stub(console,"error"),n=sinon.spy(),r=window.onerror;window.onerror=n,await o.call(context),await waitUntil((()=>n.callCount)),expect(n.callCount).to.be.greaterThan(0),expect(n.args.at(0)?.at(4)instanceof
|
1
|
+
import{expect,waitUntil}from"@open-wc/testing";import sinon from"sinon";export default async function(o){const t=sinon.stub(console,"error"),n=sinon.spy(),r=window.onerror;window.onerror=n,await o.call(context),await waitUntil((()=>n.callCount)),expect(n.callCount).to.be.greaterThan(0),expect(n.args.at(0)?.at(4)instanceof Error).to.be.true,window.onerror=r,t.restore()}
|
@@ -9,33 +9,33 @@ import { customElement } from 'lit/decorators.js';
|
|
9
9
|
import { expect } from '@open-wc/testing';
|
10
10
|
import sinon from 'sinon';
|
11
11
|
import final from './final.js';
|
12
|
-
let
|
12
|
+
let Final = class Final extends LitElement {
|
13
13
|
};
|
14
|
-
|
14
|
+
Final = __decorate([
|
15
15
|
customElement('glide-core-final'),
|
16
16
|
final
|
17
|
-
],
|
18
|
-
let
|
17
|
+
], Final);
|
18
|
+
let Subclassed = class Subclassed extends Final {
|
19
19
|
};
|
20
|
-
|
20
|
+
Subclassed = __decorate([
|
21
21
|
customElement('glide-core-subclassed')
|
22
|
-
],
|
22
|
+
], Subclassed);
|
23
23
|
it('throws when a class is extended', async () => {
|
24
24
|
const spy = sinon.spy();
|
25
25
|
try {
|
26
|
-
new
|
26
|
+
new Subclassed();
|
27
27
|
}
|
28
28
|
catch (error) {
|
29
29
|
spy(error);
|
30
30
|
}
|
31
31
|
expect(spy.callCount).to.equal(1);
|
32
32
|
expect(spy.args.at(0)?.at(0) instanceof TypeError).to.be.true;
|
33
|
-
expect(spy.args.at(0)?.at(0).message).to.equal(`
|
33
|
+
expect(spy.args.at(0)?.at(0).message).to.equal(`Final doesn't allow extension. Please talk to us if a component doesn't meet your needs.`);
|
34
34
|
});
|
35
35
|
it('does not throw when a class is not extended', () => {
|
36
36
|
const spy = sinon.spy();
|
37
37
|
try {
|
38
|
-
new
|
38
|
+
new Final();
|
39
39
|
}
|
40
40
|
catch (error) {
|
41
41
|
spy(error);
|
@@ -10,7 +10,7 @@ export default interface FormControl {
|
|
10
10
|
summary?: string;
|
11
11
|
tooltip?: string;
|
12
12
|
validity: ValidityState;
|
13
|
-
value: string | string[];
|
13
|
+
value: string | string[] | number[];
|
14
14
|
checkValidity(): boolean;
|
15
15
|
formAssociatedCallback(): void;
|
16
16
|
formResetCallback(): void;
|
@@ -22,6 +22,7 @@ export interface Translation extends DefaultTranslation {
|
|
22
22
|
error: string;
|
23
23
|
informational: string;
|
24
24
|
loading: string;
|
25
|
+
add: string;
|
25
26
|
announcedCharacterCount: (current: number, maximum: number) => string;
|
26
27
|
displayedCharacterCount: (current: number, maximum: number) => string;
|
27
28
|
clearEntry: (label: string) => string;
|
@@ -29,4 +30,8 @@ export interface Translation extends DefaultTranslation {
|
|
29
30
|
editTag: (name: string) => string;
|
30
31
|
removeTag: (name: string) => string;
|
31
32
|
itemCount: (count: string) => string;
|
33
|
+
maximum: (label: string) => string;
|
34
|
+
setMaximum: (label: string) => string;
|
35
|
+
minimum: (label: string) => string;
|
36
|
+
setMinimum: (label: string) => string;
|
32
37
|
}
|
@@ -9,17 +9,17 @@ import { customElement } from 'lit/decorators.js';
|
|
9
9
|
import { expect, fixture, html } from '@open-wc/testing';
|
10
10
|
import en from '../translations/en.js';
|
11
11
|
import { LocalizeController } from './localize.js';
|
12
|
-
let
|
12
|
+
let Component = class Component extends LitElement {
|
13
13
|
constructor() {
|
14
14
|
super(...arguments);
|
15
15
|
this.localize = new LocalizeController(this);
|
16
16
|
}
|
17
17
|
};
|
18
|
-
|
19
|
-
customElement('
|
20
|
-
],
|
18
|
+
Component = __decorate([
|
19
|
+
customElement('glide-core-component')
|
20
|
+
], Component);
|
21
21
|
it('can call any term from en translation if locale is Japanese', async () => {
|
22
|
-
const host = await fixture(html `<
|
22
|
+
const host = await fixture(html `<glide-core-component></glide-core-component>`);
|
23
23
|
host.lang = 'ja';
|
24
24
|
expect(host.localize.lang()).to.equal('ja');
|
25
25
|
const keys = Object.keys(en);
|
@@ -28,7 +28,7 @@ it('can call any term from en translation if locale is Japanese', async () => {
|
|
28
28
|
}
|
29
29
|
});
|
30
30
|
it('can call any term from en translation if locale is French', async () => {
|
31
|
-
const host = await fixture(html `<
|
31
|
+
const host = await fixture(html `<glide-core-component></glide-core-component>`);
|
32
32
|
host.lang = 'fr';
|
33
33
|
expect(host.localize.lang()).to.equal('fr');
|
34
34
|
const keys = Object.keys(en);
|
@@ -14,16 +14,16 @@ import final from './final.js';
|
|
14
14
|
// used together. Using both decorators in tests allow us
|
15
15
|
// to verifying the component name is included in the
|
16
16
|
// message.
|
17
|
-
let
|
17
|
+
let WithRequiredProperty = class WithRequiredProperty extends LitElement {
|
18
18
|
};
|
19
19
|
__decorate([
|
20
20
|
property(),
|
21
21
|
required
|
22
|
-
],
|
23
|
-
|
22
|
+
], WithRequiredProperty.prototype, "label", void 0);
|
23
|
+
WithRequiredProperty = __decorate([
|
24
24
|
customElement('glide-core-with-required-property'),
|
25
25
|
final
|
26
|
-
],
|
26
|
+
], WithRequiredProperty);
|
27
27
|
it('throws when a required attribute is missing', async () => {
|
28
28
|
const stub = sinon.stub(console, 'error');
|
29
29
|
const spy = sinon.spy();
|
@@ -32,7 +32,7 @@ it('throws when a required attribute is missing', async () => {
|
|
32
32
|
await waitUntil(() => spy.callCount);
|
33
33
|
expect(spy.callCount).to.equal(1);
|
34
34
|
expect(spy.args.at(0)?.at(0) instanceof PromiseRejectionEvent).to.be.true;
|
35
|
-
expect(spy.args.at(0)?.at(0).reason.message).to.equal('Expected
|
35
|
+
expect(spy.args.at(0)?.at(0).reason.message).to.equal('Expected WithRequiredProperty to have a `label` property.');
|
36
36
|
stub.restore();
|
37
37
|
});
|
38
38
|
it('does not throw when a required attribute is not missing', async () => {
|
@@ -0,0 +1 @@
|
|
1
|
+
export default()=>`${Math.random().toString(36).slice(2)}${Math.random().toString(36).slice(2)}`;
|
package/dist/link.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { LitElement } from 'lit';
|
2
2
|
declare global {
|
3
3
|
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-link':
|
4
|
+
'glide-core-link': Link;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
/**
|
@@ -14,9 +14,8 @@ declare global {
|
|
14
14
|
* @readonly
|
15
15
|
* @attr {string} [version]
|
16
16
|
*/
|
17
|
-
export default class
|
17
|
+
export default class Link extends LitElement {
|
18
18
|
#private;
|
19
|
-
static formAssociated: boolean;
|
20
19
|
static shadowRootOptions: ShadowRootInit;
|
21
20
|
static styles: import("lit").CSSResult[];
|
22
21
|
label?: string;
|
package/dist/link.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,o,r){var i,s=arguments.length,l=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,r);else for(var
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,o,r){var i,s=arguments.length,l=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,r);else for(var n=e.length-1;n>=0;n--)(i=e[n])&&(l=(s<3?i(l):s>3?i(t,o,l):i(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{customElement,property}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import{createRef,ref}from"lit/directives/ref.js";import packageJson from"../package.json"with{type:"json"};import styles from"./link.styles.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";let Link=class Link extends LitElement{constructor(){super(...arguments),this.disabled=!1,this.version=packageJson.version,this.#e=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:shadowRootMode}}static{this.styles=styles}click(){this.#e.value?.click()}render(){return html`<a aria-disabled="${this.disabled}" class="${classMap({component:!0,disabled:this.disabled,href:Boolean(this.href)})}" data-test="component" download="${ifDefined(this.download)}" href="${ifDefined(this.href)}" target="${ifDefined(this.target)}" @click="${this.#t}" ${ref(this.#e)}>${this.label}</a>`}#e;#t(e){this.disabled&&(e.preventDefault(),e.stopPropagation())}};__decorate([property({reflect:!0}),required],Link.prototype,"label",void 0),__decorate([property({reflect:!0,type:Boolean})],Link.prototype,"disabled",void 0),__decorate([property({reflect:!0})],Link.prototype,"download",void 0),__decorate([property({reflect:!0})],Link.prototype,"href",void 0),__decorate([property({reflect:!0})],Link.prototype,"target",void 0),__decorate([property({reflect:!0})],Link.prototype,"version",void 0),Link=__decorate([customElement("glide-core-link"),final],Link);export default Link;
|
package/dist/link.styles.js
CHANGED
@@ -18,7 +18,7 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
|
|
18
18
|
cursor: not-allowed;
|
19
19
|
}
|
20
20
|
|
21
|
-
|
21
|
+
&.href:not(.disabled) {
|
22
22
|
color: var(--glide-core-color-interactive-text-link--hover);
|
23
23
|
text-decoration: underline;
|
24
24
|
}
|
package/dist/menu.button.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { LitElement } from 'lit';
|
2
2
|
declare global {
|
3
3
|
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-menu-button':
|
4
|
+
'glide-core-menu-button': MenuButton;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
/**
|
@@ -22,7 +22,7 @@ declare global {
|
|
22
22
|
*
|
23
23
|
* @slot {Element} [icon]
|
24
24
|
*/
|
25
|
-
export default class
|
25
|
+
export default class MenuButton extends LitElement {
|
26
26
|
#private;
|
27
27
|
static shadowRootOptions: ShadowRootInit;
|
28
28
|
static styles: import("lit").CSSResult[];
|
package/dist/menu.button.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s};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 packageJson from"../package.json"with{type:"json"};import styles from"./menu.button.styles.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";import uniqueId from"./library/unique-id.js";let MenuButton=class MenuButton extends LitElement{constructor(){super(...arguments),this.id=uniqueId(),this.privateActive=!1,this.role="menuitem",this.tabIndex=-1,this.version=packageJson.version,this.#e=createRef(),this.#t=!1}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:shadowRootMode}}static{this.styles=styles}get disabled(){return this.#t}set disabled(e){this.#t=e,e&&this.privateActive&&this.dispatchEvent(new Event("private-disabled",{bubbles:!0}))}click(){this.#e.value?.click()}render(){return html`<button class="${classMap({component:!0,active:this.privateActive,disabled:this.disabled})}" ?disabled="${this.disabled}" data-test="component" type="button" ${ref(this.#e)}><slot name="icon"></slot>${this.label}</button>`}#e;#t};__decorate([property({reflect:!0}),required],MenuButton.prototype,"label",void 0),__decorate([property({reflect:!0,type:Boolean})],MenuButton.prototype,"disabled",null),__decorate([property({reflect:!0})],MenuButton.prototype,"id",void 0),__decorate([property({type:Boolean})],MenuButton.prototype,"privateActive",void 0),__decorate([property({reflect:!0})],MenuButton.prototype,"role",void 0),__decorate([property({attribute:"tabindex",reflect:!0,type:Number})],MenuButton.prototype,"tabIndex",void 0),__decorate([property({reflect:!0})],MenuButton.prototype,"version",void 0),MenuButton=__decorate([customElement("glide-core-menu-button"),final],MenuButton);export default MenuButton;
|
@@ -6,10 +6,10 @@ import{css}from"lit";export default[css`
|
|
6
6
|
border-radius: var(--glide-core-spacing-base-sm);
|
7
7
|
display: flex;
|
8
8
|
font: inherit;
|
9
|
-
gap: var(--
|
9
|
+
gap: var(--glide-core-spacing-base-sm);
|
10
10
|
inline-size: 100%;
|
11
|
-
padding-block: var(--
|
12
|
-
padding-inline: var(--
|
11
|
+
padding-block: var(--glide-core-spacing-base-xxs);
|
12
|
+
padding-inline: var(--glide-core-spacing-base-sm);
|
13
13
|
transition: background-color 100ms ease-in-out;
|
14
14
|
user-select: none;
|
15
15
|
|
package/dist/menu.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { LitElement } from 'lit';
|
2
2
|
declare global {
|
3
3
|
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-menu':
|
4
|
+
'glide-core-menu': Menu;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
/**
|
@@ -9,17 +9,16 @@ declare global {
|
|
9
9
|
* @attr {number} [offset=4]
|
10
10
|
* @attr {boolean} [open=false]
|
11
11
|
* @attr {'bottom'|'left'|'right'|'top'|'bottom-start'|'bottom-end'|'left-start'|'left-end'|'right-start'|'right-end'|'top-start'|'top-end'} [placement='bottom-start']
|
12
|
-
* @attr {'large'|'small'} [size='large']
|
13
12
|
*
|
14
13
|
* @readonly
|
15
14
|
* @attr {string} [version]
|
16
15
|
*
|
17
|
-
* @slot {
|
16
|
+
* @slot {MenuOptions}
|
18
17
|
* @slot {Element} [target] - The element to which the popover will anchor. Can be any focusable element.
|
19
18
|
*
|
20
19
|
* @fires {Event} toggle
|
21
20
|
*/
|
22
|
-
export default class
|
21
|
+
export default class Menu extends LitElement {
|
23
22
|
#private;
|
24
23
|
static shadowRootOptions: ShadowRootInit;
|
25
24
|
static styles: import("lit").CSSResult[];
|
@@ -39,11 +38,6 @@ export default class GlideCoreMenu extends LitElement {
|
|
39
38
|
get open(): boolean;
|
40
39
|
set open(isOpen: boolean);
|
41
40
|
placement: 'bottom' | 'left' | 'right' | 'top' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end' | 'top-start' | 'top-end';
|
42
|
-
/**
|
43
|
-
* @default 'large'
|
44
|
-
*/
|
45
|
-
get size(): 'large' | 'small';
|
46
|
-
set size(size: 'large' | 'small');
|
47
41
|
readonly version: string;
|
48
42
|
connectedCallback(): void;
|
49
43
|
createRenderRoot(): ShadowRoot;
|
package/dist/menu.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,i,o){var n,s=arguments.length,a=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(n=t[l])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};import{html,LitElement}from"lit";import{autoUpdate,computePosition,flip,offset}from"@floating-ui/dom";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import packageJson from"../package.json"with{type:"json"};import MenuButton from"./menu.button.js";import{LocalizeController}from"./library/localize.js";import MenuLink from"./menu.link.js";import MenuOptions from"./menu.options.js";import assertSlot from"./library/assert-slot.js";import styles from"./menu.styles.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import uniqueId from"./library/unique-id.js";let Menu=class Menu extends LitElement{constructor(){super(...arguments),this.placement="bottom-start",this.version=packageJson.version,this.#t=createRef(),this.#e=createRef(),this.#i=!1,this.#o=!1,this.#n=!1,this.#s=!1,this.#a=new LocalizeController(this),this.#l=createRef(),this.#r=t=>{t.target===this.#e.value&&t.preventDefault()},this.#p=()=>{this.#i=!0},this.#c=()=>{this.#i?this.#i=!1:this.#s?this.#s=!1:(this.open=!1,this.#h&&(this.#h.ariaActivedescendant=""))},this.#d=()=>{this.#s=!0}}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:shadowRootMode}}static{this.styles=styles}get loading(){return this.#o}set loading(t){this.#o=t;const e=this.querySelector("glide-core-menu-options");e&&this.#u&&(e.privateLoading=t,this.#u.ariaDescription=t?this.#a.term("loading"):null)}get offset(){return this.#m??Number.parseFloat(window.getComputedStyle(document.body).getPropertyValue("--glide-core-spacing-base-xxs"))*Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)}set offset(t){this.#m=t}get open(){return this.#n}set open(t){const e=t!==this.#n;this.#n=t,t&&e&&!this.isTargetDisabled?(this.#f(),this.dispatchEvent(new Event("toggle",{bubbles:!0,composed:!0}))):e&&(this.#v(),this.dispatchEvent(new Event("toggle",{bubbles:!0,composed:!0})))}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.#c,{capture:!0})}createRenderRoot(){return this.#E=super.createRenderRoot(),this.#E}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.#c,{capture:!0})}firstUpdated(){const t=this.querySelector("glide-core-menu-options");t&&this.#u&&(t.privateLoading=this.loading,this.#u.ariaDescription=this.loading?this.#a.term("loading"):null),this.#e.value&&(this.#e.value.popover="manual",this.open&&!this.isTargetDisabled&&this.#f()),this.#l.value?.addEventListener("mouseup",this.#d),this.#e.value?.addEventListener("mousedown",this.#r),this.#e.value?.addEventListener("mouseup",this.#p)}get isTargetDisabled(){const t=this.#u&&"disabled"in this.#u&&this.#u.disabled,e=this.#u&&"true"===this.#u.ariaDisabled;return Boolean(t)||Boolean(e)}render(){return html`<div class="component" @focusout="${this.#g}" ${ref(this.#t)}><slot class="target-slot" name="target" @click="${this.#S}" @keydown="${this.#y}" @slotchange="${this.#b}" ${assertSlot([Element])} ${ref(this.#l)}></slot><slot class="default-slot" @click="${this.#D}" @focusin="${this.#M}" @keydown="${this.#y}" @mouseover="${this.#w}" @private-disabled="${this.#k}" @private-slot-change="${this.#R}" ${assertSlot([MenuOptions])} ${ref(this.#e)}></slot></div>`}#O;#t;#e;#i;#o;#n;#s;#a;#m;#E;#l;get#A(){return this.#L?.find((({privateActive:t})=>t))}#r;#p;#c;#d;#T(t){this.#u&&"focus"in this.#u&&this.#u?.focus(t)}#v(){this.#O?.(),this.#h&&(this.#h.ariaActivedescendant=""),this.#u&&(this.#u.ariaExpanded="false"),this.#e.value?.hidePopover()}#g(t){const e=t.relatedTarget instanceof HTMLElement&&this.#E?.contains(t.relatedTarget),i=t.relatedTarget instanceof MenuOptions,o=t.relatedTarget instanceof MenuButton||t.relatedTarget instanceof MenuLink;e||i||o||(this.open=!1)}#D(t){t.defaultPrevented||t.target===this.#e.value||(this.open=!1)}#M(t){(t.target instanceof MenuButton||t.target instanceof MenuLink)&&this.#A&&this.#h&&!t.target.disabled&&(this.#A.privateActive=!1,t.target.privateActive=!0,this.#h.ariaActivedescendant=t.target.id)}#w(t){if((t.target instanceof MenuLink||t.target instanceof MenuButton)&&!t.target.disabled){if(this.#L)for(const e of this.#L)e.privateActive=e===t.target;this.#h&&(this.#h.ariaActivedescendant=t.target.id)}}#k(){if(this.#L&&this.#A){const t=this.#L.indexOf(this.#A);this.#A.privateActive=!1;const e=this.#L?.find(((e,i)=>!e.disabled&&i>t));if(e)return void(e.privateActive=!0);const i=this.#L.findLast(((e,i)=>!e.disabled&&i<t));i&&(i.privateActive=!0)}}#R(){const t=this.#L?.find((t=>!t.disabled));!this.#A&&t&&(t.privateActive=!0)}#y(t){const e=this.#u instanceof HTMLSpanElement||this.#u instanceof HTMLDivElement;if([" ","Enter"].includes(t.key)&&this.open)return this.#i=!0,t.preventDefault()," "===t.key&&e&&t.preventDefault(),this.#T(),void this.#A?.click();if([" ","Enter"].includes(t.key)&&!this.open&&e)return t.preventDefault(),void(this.open=!0);if(["Escape"].includes(t.key)&&this.open)return t.preventDefault(),this.open=!1,void this.#T();if(["ArrowUp","ArrowDown"].includes(t.key)&&!this.open&&this.#A&&this.#h)return t.preventDefault(),this.open=!0,void(this.#h.ariaActivedescendant=this.#A.id);if(this.open&&this.#A&&this.#L){const e=this.#L.indexOf(this.#A);if("ArrowUp"===t.key&&!t.metaKey){t.preventDefault();const i=this.#L.findLast(((t,i)=>!t.disabled&&i<e));return void(i&&this.#h&&(this.#A.privateActive=!1,this.#h.ariaActivedescendant=i.id,i.privateActive=!0))}if("ArrowDown"===t.key&&!t.metaKey){t.preventDefault();const i=this.#L.find(((t,i)=>!t.disabled&&i>e));return void(i&&this.#h&&(this.#A.privateActive=!1,this.#h.ariaActivedescendant=i.id,i.privateActive=!0))}if("ArrowUp"===t.key&&t.metaKey||"Home"===t.key||"PageUp"===t.key){t.preventDefault();const e=[...this.#L].reverse().findLast((t=>!t.disabled));return void(e&&this.#h&&(this.#A.privateActive=!1,this.#h.ariaActivedescendant=e.id,e.privateActive=!0))}if("ArrowDown"===t.key&&t.metaKey||"End"===t.key||"PageDown"===t.key){t.preventDefault();const e=[...this.#L].findLast((t=>!t.disabled));return void(e&&this.#h&&(this.#A.privateActive=!1,this.#h.ariaActivedescendant=e.id,e.privateActive=!0))}}}#b(){const t=new MutationObserver((()=>{this.open&&!this.isTargetDisabled?this.#f():this.#v()}));this.#u&&this.#h&&(t.observe(this.#u,{attributes:!0,attributeFilter:["aria-disabled","disabled"]}),this.#u.ariaHasPopup="true",this.#u.id=uniqueId(),this.#u.setAttribute("aria-controls",this.#h.id),this.#h.ariaLabelledby=this.#u.id);(this.#u instanceof HTMLSpanElement||this.#u instanceof HTMLDivElement)&&this.#u instanceof HTMLElement&&(this.#u.tabIndex=0),this.open&&!this.isTargetDisabled?this.#f():this.#v()}#S(t){t.defaultPrevented||(this.isTargetDisabled?this.#v():this.#L&&this.#L.length>0&&(this.open=!this.open))}get#h(){const t=this.#e.value?.assignedElements().at(0);return t instanceof MenuOptions?t:null}get#L(){let t=this.#e.value?.assignedElements()?.at(0)?.children;const e=t?.[0];if(e instanceof HTMLSlotElement&&(t=e.assignedElements()),t)return[...t].filter((t=>t instanceof MenuLink||t instanceof MenuButton))}#f(){this.#O?.(),this.#u&&this.#e.value&&(this.#O=autoUpdate(this.#u,this.#e.value,(()=>{(async()=>{if(this.#u&&this.#e.value){const{x:t,y:e,placement:i}=await computePosition(this.#u,this.#e.value,{placement:this.placement,middleware:[offset(this.offset),flip()]});this.#e.value.dataset.placement=i,Object.assign(this.#e.value.style,{left:`${t}px`,top:`${e}px`})}this.#e.value?.showPopover(),this.#h&&this.#A?.id&&(this.#h.ariaActivedescendant=this.#A.id),this.#u&&(this.#u.ariaExpanded="true")})()})))}get#u(){return this.#l.value?.assignedElements().at(0)}};__decorate([property({reflect:!0,type:Boolean})],Menu.prototype,"loading",null),__decorate([property({reflect:!0,type:Number})],Menu.prototype,"offset",null),__decorate([property({reflect:!0,type:Boolean})],Menu.prototype,"open",null),__decorate([property({reflect:!0,useDefault:!0})],Menu.prototype,"placement",void 0),__decorate([property({reflect:!0})],Menu.prototype,"version",void 0),Menu=__decorate([customElement("glide-core-menu"),final],Menu);export default Menu;
|
package/dist/menu.link.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { LitElement } from 'lit';
|
2
2
|
declare global {
|
3
3
|
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-menu-link':
|
4
|
+
'glide-core-menu-link': MenuLink;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
/**
|
@@ -23,7 +23,7 @@ declare global {
|
|
23
23
|
*
|
24
24
|
* @slot {Element} [icon]
|
25
25
|
*/
|
26
|
-
export default class
|
26
|
+
export default class MenuLink extends LitElement {
|
27
27
|
#private;
|
28
28
|
static shadowRootOptions: ShadowRootInit;
|
29
29
|
static styles: import("lit").CSSResult[];
|
package/dist/menu.link.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,i,o){var r,
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,i,o){var r,s=arguments.length,n=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(n=(s<3?r(n):s>3?r(t,i,n):r(t,i))||n);return s>3&&n&&Object.defineProperty(t,i,n),n};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{ifDefined}from"lit/directives/if-defined.js";import packageJson from"../package.json"with{type:"json"};import styles from"./menu.link.styles.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";import uniqueId from"./library/unique-id.js";let MenuLink=class MenuLink extends LitElement{constructor(){super(...arguments),this.id=uniqueId(),this.privateActive=!1,this.role="menuitem",this.tabIndex=-1,this.version=packageJson.version,this.#e=createRef(),this.#t=!1}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:shadowRootMode}}static{this.styles=styles}get disabled(){return this.#t}set disabled(e){this.#t=e,e&&this.privateActive&&this.dispatchEvent(new Event("private-disabled",{bubbles:!0}))}click(){this.disabled||this.#e.value?.click()}render(){return html`<a aria-disabled="${this.disabled}" class="${classMap({component:!0,active:this.privateActive,disabled:this.disabled})}" data-test="component" href="${ifDefined(this.href)}" @click="${this.#i}" ${ref(this.#e)}><slot name="icon"></slot>${this.label}</a>`}#e;#t;#i(e){this.disabled&&(e.preventDefault(),e.stopPropagation())}};__decorate([property({reflect:!0}),required],MenuLink.prototype,"label",void 0),__decorate([property({reflect:!0,type:Boolean})],MenuLink.prototype,"disabled",null),__decorate([property({reflect:!0})],MenuLink.prototype,"href",void 0),__decorate([property({reflect:!0})],MenuLink.prototype,"id",void 0),__decorate([property({type:Boolean})],MenuLink.prototype,"privateActive",void 0),__decorate([property({reflect:!0})],MenuLink.prototype,"role",void 0),__decorate([property({attribute:"tabindex",reflect:!0,type:Number})],MenuLink.prototype,"tabIndex",void 0),__decorate([property({reflect:!0})],MenuLink.prototype,"version",void 0),MenuLink=__decorate([customElement("glide-core-menu-link"),final],MenuLink);export default MenuLink;
|
package/dist/menu.link.styles.js
CHANGED
@@ -7,10 +7,10 @@ import{css}from"lit";export default[css`
|
|
7
7
|
box-sizing: border-box;
|
8
8
|
display: flex;
|
9
9
|
font: inherit;
|
10
|
-
gap: var(--
|
10
|
+
gap: var(--glide-core-spacing-base-sm);
|
11
11
|
inline-size: 100%;
|
12
|
-
padding-block: var(--
|
13
|
-
padding-inline: var(--
|
12
|
+
padding-block: var(--glide-core-spacing-base-xxs);
|
13
|
+
padding-inline: var(--glide-core-spacing-base-sm);
|
14
14
|
text-decoration: none;
|
15
15
|
transition: background-color 100ms ease-in-out;
|
16
16
|
user-select: none;
|
package/dist/menu.options.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { LitElement } from 'lit';
|
2
2
|
declare global {
|
3
3
|
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-menu-options':
|
4
|
+
'glide-core-menu-options': MenuOptions;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
/**
|
@@ -20,9 +20,9 @@ declare global {
|
|
20
20
|
* @readonly
|
21
21
|
* @attr {string} [version]
|
22
22
|
*
|
23
|
-
* @slot {
|
23
|
+
* @slot {MenuButton | MenuLink}
|
24
24
|
*/
|
25
|
-
export default class
|
25
|
+
export default class MenuOptions extends LitElement {
|
26
26
|
#private;
|
27
27
|
static shadowRootOptions: ShadowRootInit;
|
28
28
|
static styles: import("lit").CSSResult[];
|
@@ -30,7 +30,6 @@ export default class GlideCoreMenuOptions extends LitElement {
|
|
30
30
|
ariaLabelledby: string;
|
31
31
|
readonly id: string;
|
32
32
|
privateLoading: boolean;
|
33
|
-
privateSize: 'large' | 'small';
|
34
33
|
readonly role = "menu";
|
35
34
|
readonly tabIndex = -1;
|
36
35
|
readonly version: string;
|
package/dist/menu.options.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,o,
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s};import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{customElement,property}from"lit/decorators.js";import{map}from"lit/directives/map.js";import{when}from"lit/directives/when.js";import{range}from"lit/directives/range.js";import packageJson from"../package.json"with{type:"json"};import MenuButton from"./menu.button.js";import MenuLink from"./menu.link.js";import styles from"./menu.options.styles.js";import assertSlot from"./library/assert-slot.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import uniqueId from"./library/unique-id.js";let MenuOptions=class MenuOptions extends LitElement{constructor(){super(...arguments),this.ariaActivedescendant="",this.ariaLabelledby="",this.id=uniqueId(),this.privateLoading=!1,this.role="menu",this.tabIndex=-1,this.version=packageJson.version}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:shadowRootMode}}static{this.styles=styles}render(){return html`<div class="component" role="none"><slot class="${classMap({"default-slot":!0,loading:this.privateLoading})}" ${assertSlot([MenuButton,MenuLink,Text])} @slotchange="${this.#e}"></slot>${when(this.privateLoading,(()=>html`<div class="loading-feedback" data-test="loading-feedback">${map(range(7),(()=>html`<div></div>`))}</div>`))}</div>`}#e(){this.dispatchEvent(new Event("private-slot-change",{bubbles:!0}))}};__decorate([property({attribute:"aria-activedescendant",reflect:!0,useDefault:!0})],MenuOptions.prototype,"ariaActivedescendant",void 0),__decorate([property({attribute:"aria-labelledby",reflect:!0,useDefault:!0})],MenuOptions.prototype,"ariaLabelledby",void 0),__decorate([property({reflect:!0})],MenuOptions.prototype,"id",void 0),__decorate([property({type:Boolean})],MenuOptions.prototype,"privateLoading",void 0),__decorate([property({reflect:!0})],MenuOptions.prototype,"role",void 0),__decorate([property({attribute:"tabindex",reflect:!0,type:Number})],MenuOptions.prototype,"tabIndex",void 0),__decorate([property({reflect:!0})],MenuOptions.prototype,"version",void 0),MenuOptions=__decorate([customElement("glide-core-menu-options"),final],MenuOptions);export default MenuOptions;
|
@@ -7,26 +7,9 @@ import{css}from"lit";import skeleton from"./styles/skeleton.js";export default[c
|
|
7
7
|
}
|
8
8
|
|
9
9
|
.component {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
--private-padding-block: var(--glide-core-spacing-base-xxs);
|
14
|
-
|
15
|
-
font-family: var(--glide-core-typography-family-primary);
|
16
|
-
font-size: var(--glide-core-typography-size-body-default);
|
17
|
-
font-weight: var(--glide-core-typography-weight-regular);
|
18
|
-
}
|
19
|
-
|
20
|
-
&.small {
|
21
|
-
--private-gap: var(--glide-core-spacing-base-xs);
|
22
|
-
--private-padding-inline: var(--glide-core-spacing-base-xs);
|
23
|
-
--private-padding-block: var(--glide-core-spacing-base-xxxs);
|
24
|
-
--private-size: 0.75rem;
|
25
|
-
|
26
|
-
font-family: var(--glide-core-typography-family-primary);
|
27
|
-
font-size: var(--glide-core-typography-size-body-small);
|
28
|
-
font-weight: var(--glide-core-typography-weight-regular);
|
29
|
-
}
|
10
|
+
font-family: var(--glide-core-typography-family-primary);
|
11
|
+
font-size: var(--glide-core-typography-size-body-default);
|
12
|
+
font-weight: var(--glide-core-typography-weight-regular);
|
30
13
|
}
|
31
14
|
|
32
15
|
.default-slot {
|