@crowdstrike/glide-core 0.5.1 → 0.6.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/README.md +11 -1
- package/dist/accordion.js +1 -1
- package/dist/accordion.styles.js +5 -4
- package/dist/accordion.test.basics.js +109 -0
- package/dist/accordion.test.events.js +39 -0
- package/dist/button-group.button.js +1 -1
- package/dist/button-group.button.styles.js +6 -5
- package/dist/button-group.button.test.basics.js +169 -0
- package/dist/button-group.button.test.events.js +73 -0
- package/dist/button-group.js +1 -1
- package/dist/button-group.styles.js +3 -3
- package/dist/button-group.test.basics.js +268 -0
- package/dist/button-group.test.events.js +291 -0
- package/dist/button.d.ts +3 -2
- package/dist/button.js +1 -1
- package/dist/button.styles.js +5 -5
- package/dist/button.test.basics.js +202 -0
- package/dist/button.test.events.js +25 -0
- package/dist/button.test.form.js +49 -0
- package/dist/checkbox-group.js +1 -1
- package/dist/checkbox-group.styles.js +2 -2
- package/dist/checkbox-group.test.basics.js +119 -0
- package/dist/checkbox-group.test.events.js +110 -0
- package/dist/checkbox-group.test.focus.js +45 -0
- package/dist/checkbox-group.test.form.js +130 -0
- package/dist/checkbox-group.test.validity.js +75 -0
- package/dist/checkbox.js +1 -1
- package/dist/checkbox.styles.js +7 -4
- package/dist/checkbox.test.basics.js +89 -0
- package/dist/checkbox.test.events.js +87 -0
- package/dist/checkbox.test.focus.js +38 -0
- package/dist/checkbox.test.form.js +115 -0
- package/dist/checkbox.test.states.js +62 -0
- package/dist/checkbox.test.validity.js +51 -0
- package/dist/drawer.d.ts +2 -2
- package/dist/drawer.js +1 -15
- package/dist/drawer.styles.js +14 -4
- package/dist/drawer.test.accessibility.js +22 -0
- package/dist/drawer.test.basics.js +43 -0
- package/dist/drawer.test.closing.js +37 -0
- package/dist/drawer.test.events.js +52 -0
- package/dist/drawer.test.floating-components.d.ts +1 -0
- package/dist/drawer.test.floating-components.js +51 -0
- package/dist/drawer.test.methods.js +34 -0
- package/dist/dropdown.d.ts +4 -2
- package/dist/dropdown.js +1 -1
- package/dist/dropdown.option.d.ts +0 -2
- package/dist/dropdown.option.js +1 -1
- package/dist/dropdown.option.styles.js +2 -2
- package/dist/dropdown.option.test.basics.js +59 -0
- package/dist/dropdown.option.test.basics.multiple.js +26 -0
- package/dist/dropdown.option.test.basics.single.js +20 -0
- package/dist/dropdown.option.test.events.js +27 -0
- package/dist/dropdown.option.test.focus.js +11 -0
- package/dist/dropdown.option.test.interactions.multiple.js +82 -0
- package/dist/dropdown.option.test.interactions.single.js +22 -0
- package/dist/dropdown.styles.js +26 -6
- package/dist/dropdown.test.basics.filterable.js +84 -0
- package/dist/dropdown.test.basics.js +233 -0
- package/dist/dropdown.test.basics.multiple.js +270 -0
- package/dist/dropdown.test.basics.single.js +79 -0
- package/dist/dropdown.test.events.js +268 -0
- package/dist/dropdown.test.events.multiple.js +130 -0
- package/dist/dropdown.test.focus.d.ts +1 -0
- package/dist/dropdown.test.focus.filterable.js +154 -0
- package/dist/dropdown.test.focus.js +28 -0
- package/dist/dropdown.test.focus.multiple.js +181 -0
- package/dist/dropdown.test.focus.single.js +53 -0
- package/dist/dropdown.test.form.js +140 -0
- package/dist/dropdown.test.form.multiple.js +149 -0
- package/dist/dropdown.test.form.single.js +128 -0
- package/dist/dropdown.test.interactions.filterable.js +449 -0
- package/dist/dropdown.test.interactions.js +446 -0
- package/dist/dropdown.test.interactions.multiple.js +908 -0
- package/dist/dropdown.test.interactions.single.js +466 -0
- package/dist/dropdown.test.validity.js +46 -0
- package/dist/icon-button.d.ts +3 -2
- package/dist/icon-button.js +1 -1
- package/dist/icon-button.styles.js +12 -12
- package/dist/icon-button.test.basics.js +110 -0
- package/dist/icons/checked.js +1 -1
- package/dist/icons/magnifying-glass.js +1 -1
- package/dist/input.js +1 -1
- package/dist/input.styles.js +4 -3
- package/dist/input.test.basics.js +169 -0
- package/dist/input.test.events.js +97 -0
- package/dist/input.test.focus.js +54 -0
- package/dist/input.test.form.js +56 -0
- package/dist/input.test.validity.js +50 -0
- package/dist/label.js +1 -1
- package/dist/label.styles.js +13 -15
- package/dist/label.test.basics.js +129 -0
- package/dist/library/expect-argument-error.js +1 -1
- package/dist/library/localize.d.ts +17 -0
- package/dist/library/localize.js +1 -0
- package/dist/library/ow.js +1 -1
- package/dist/library/ow.test.js +55 -0
- package/dist/library/set-containing-block.d.ts +15 -0
- package/dist/library/set-containing-block.js +1 -0
- package/dist/menu.button.d.ts +1 -2
- package/dist/menu.button.js +1 -1
- package/dist/menu.button.styles.js +3 -3
- package/dist/menu.button.test.basics.js +42 -0
- package/dist/menu.d.ts +7 -2
- package/dist/menu.js +1 -1
- package/dist/menu.link.d.ts +1 -2
- package/dist/menu.link.js +1 -1
- package/dist/menu.link.styles.js +3 -3
- package/dist/menu.link.test.basics.js +46 -0
- package/dist/menu.options.d.ts +22 -0
- package/dist/menu.options.js +1 -0
- package/dist/menu.options.styles.d.ts +2 -0
- package/dist/menu.options.styles.js +33 -0
- package/dist/menu.options.test.basics.d.ts +2 -0
- package/dist/menu.options.test.basics.js +43 -0
- package/dist/menu.stories.d.ts +1 -0
- package/dist/menu.styles.js +7 -31
- package/dist/menu.test.basics.d.ts +1 -0
- package/dist/menu.test.basics.js +183 -0
- package/dist/menu.test.focus.d.ts +0 -1
- package/dist/menu.test.focus.js +84 -0
- package/dist/menu.test.interactions.d.ts +1 -1
- package/dist/menu.test.interactions.js +664 -0
- package/dist/modal.icon-button.js +1 -1
- package/dist/modal.icon-button.styles.js +2 -2
- package/dist/modal.icon-button.test.basics.js +45 -0
- package/dist/modal.js +1 -15
- package/dist/modal.styles.js +4 -7
- package/dist/modal.tertiary-icon.d.ts +1 -0
- package/dist/modal.tertiary-icon.js +1 -1
- package/dist/modal.tertiary-icon.test.basics.js +59 -0
- package/dist/modal.test.accessibility.js +48 -0
- package/dist/modal.test.basics.js +203 -0
- package/dist/modal.test.close.js +38 -0
- package/dist/modal.test.events.js +110 -0
- package/dist/modal.test.floating-components.d.ts +1 -0
- package/dist/modal.test.floating-components.js +62 -0
- package/dist/modal.test.lock-scroll.js +76 -0
- package/dist/modal.test.methods.js +23 -0
- package/dist/modal.test.scrollbars.js +19 -0
- package/dist/radio-group.js +1 -1
- package/dist/radio-group.styles.js +20 -24
- package/dist/radio-group.test.basics.js +323 -0
- package/dist/radio-group.test.events.js +277 -0
- package/dist/radio-group.test.focus.js +75 -0
- package/dist/radio-group.test.form.js +104 -0
- package/dist/radio-group.test.validity.js +228 -0
- package/dist/radio.js +1 -1
- package/dist/radio.styles.js +14 -31
- package/dist/split-button.d.ts +27 -0
- package/dist/split-button.js +1 -0
- package/dist/split-button.stories.d.ts +17 -0
- package/dist/split-button.styles.d.ts +2 -0
- package/dist/split-button.styles.js +102 -0
- package/dist/split-button.test.basics.d.ts +1 -0
- package/dist/split-button.test.basics.js +99 -0
- package/dist/split-container.d.ts +31 -0
- package/dist/split-container.js +1 -0
- package/dist/split-container.styles.d.ts +2 -0
- package/dist/split-container.styles.js +134 -0
- package/dist/split-container.test.basics.d.ts +3 -0
- package/dist/split-container.test.basics.js +440 -0
- package/dist/split-container.test.interactions.d.ts +1 -0
- package/dist/split-container.test.interactions.js +20 -0
- package/dist/split-link.d.ts +25 -0
- package/dist/split-link.js +1 -0
- package/dist/split-link.test.basics.d.ts +1 -0
- package/dist/split-link.test.basics.js +92 -0
- package/dist/split-link.test.interactions.d.ts +1 -0
- package/dist/split-link.test.interactions.js +19 -0
- package/dist/status-indicator.js +1 -1
- package/dist/status-indicator.styles.js +2 -2
- package/dist/status-indicator.test.basics.js +102 -0
- package/dist/styles/focus-outline.js +1 -4
- package/dist/styles/variables.css +1 -1
- package/dist/styles/visually-hidden.js +1 -11
- package/dist/tab.group.js +1 -1
- package/dist/tab.group.styles.js +2 -2
- package/dist/tab.group.test.basics.js +185 -0
- package/dist/tab.js +1 -1
- package/dist/tab.panel.js +1 -1
- package/dist/tab.panel.styles.js +3 -3
- package/dist/tab.styles.js +80 -55
- package/dist/tab.test.basics.js +71 -0
- package/dist/tag.js +1 -1
- package/dist/tag.styles.js +4 -3
- package/dist/tag.test.basics.js +118 -0
- package/dist/tag.test.events.js +16 -0
- package/dist/tag.test.focus.js +11 -0
- package/dist/tag.test.translations.d.ts +1 -0
- package/dist/tag.test.translations.js +25 -0
- package/dist/textarea.js +2 -2
- package/dist/textarea.styles.js +5 -4
- package/dist/textarea.test.basics.js +140 -0
- package/dist/textarea.test.events.js +204 -0
- package/dist/textarea.test.form.js +70 -0
- package/dist/textarea.test.validity.js +83 -0
- package/dist/toasts.js +1 -1
- package/dist/toasts.styles.js +2 -2
- package/dist/toasts.test.basics.js +94 -0
- package/dist/toasts.toast.js +1 -1
- package/dist/toasts.toast.styles.js +5 -2
- package/dist/toasts.toast.test.basics.js +139 -0
- package/dist/toggle.js +1 -1
- package/dist/toggle.styles.js +3 -3
- package/dist/toggle.test.basics.js +68 -0
- package/dist/toggle.test.events.js +29 -0
- package/dist/toggle.test.focus.js +9 -0
- package/dist/toggle.test.states.js +43 -0
- package/dist/tooltip.d.ts +2 -0
- package/dist/tooltip.js +1 -1
- package/dist/tooltip.styles.js +5 -3
- package/dist/tooltip.test.basics.js +64 -0
- package/dist/tooltip.test.interactions.js +78 -0
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +1 -0
- package/dist/translations/fr.d.ts +3 -0
- package/dist/translations/fr.js +1 -0
- package/dist/translations/ja.d.ts +3 -0
- package/dist/translations/ja.js +1 -0
- package/dist/tree.d.ts +1 -0
- package/dist/tree.item.d.ts +3 -1
- package/dist/tree.item.icon-button.js +1 -1
- package/dist/tree.item.icon-button.styles.js +2 -2
- package/dist/tree.item.icon-button.test.basics.js +13 -0
- package/dist/tree.item.js +1 -1
- package/dist/tree.item.menu.d.ts +2 -0
- package/dist/tree.item.menu.js +1 -1
- package/dist/tree.item.menu.styles.js +2 -2
- package/dist/tree.item.menu.test.basics.js +33 -0
- package/dist/tree.item.styles.js +23 -8
- package/dist/tree.item.test.basics.js +102 -0
- package/dist/tree.js +1 -1
- package/dist/tree.stories.d.ts +1 -0
- package/dist/tree.styles.js +2 -2
- package/dist/tree.test.aria.js +86 -0
- package/dist/tree.test.basics.js +123 -0
- package/dist/tree.test.events.js +19 -0
- package/dist/tree.test.focus.js +261 -0
- package/package.json +25 -18
- /package/dist/{dropdown.option.test.focus.multiple.d.ts → dropdown.option.test.focus.d.ts} +0 -0
- /package/dist/{dropdown.option.test.focus.single.d.ts → dropdown.test.events.multiple.d.ts} +0 -0
@@ -1,8 +1,9 @@
|
|
1
|
-
|
1
|
+
import{css}from"lit";export default[css`
|
2
2
|
.component {
|
3
3
|
align-items: center;
|
4
4
|
border-radius: var(--glide-core-spacing-sm);
|
5
5
|
box-shadow: var(--glide-core-shadow-lg);
|
6
|
+
color: var(--glide-core-text-body-2);
|
6
7
|
column-gap: var(--glide-core-spacing-xs);
|
7
8
|
display: grid;
|
8
9
|
font-family: var(--glide-core-body-xs-font-family);
|
@@ -51,10 +52,12 @@
|
|
51
52
|
}
|
52
53
|
|
53
54
|
.close-button {
|
55
|
+
--icon-color: var(--glide-core-icon-default2);
|
56
|
+
|
54
57
|
grid-column: 3;
|
55
58
|
}
|
56
59
|
|
57
60
|
.description {
|
58
61
|
grid-column: 2;
|
59
62
|
}
|
60
|
-
`];
|
63
|
+
`];
|
@@ -0,0 +1,139 @@
|
|
1
|
+
import { assert, expect, fixture, html } from '@open-wc/testing';
|
2
|
+
import GlideCoreToast from './toasts.toast.js';
|
3
|
+
import sinon from 'sinon';
|
4
|
+
GlideCoreToast.shadowRootOptions.mode = 'open';
|
5
|
+
// NOTE: Due to https://github.com/modernweb-dev/web/issues/2520, we sometimes need
|
6
|
+
// to manually dispatch the `transitionend` event in tests.
|
7
|
+
it('registers', async () => {
|
8
|
+
expect(window.customElements.get('glide-core-toast')).to.equal(GlideCoreToast);
|
9
|
+
});
|
10
|
+
it('is accessible', async () => {
|
11
|
+
const component = await fixture(html `<glide-core-toast
|
12
|
+
variant="informational"
|
13
|
+
label="Label"
|
14
|
+
description="Toast description"
|
15
|
+
></glide-core-toast>`);
|
16
|
+
await expect(component).to.be.accessible();
|
17
|
+
});
|
18
|
+
it('sets correct role', async () => {
|
19
|
+
const component = await fixture(html `<glide-core-toast
|
20
|
+
variant="informational"
|
21
|
+
label="Label"
|
22
|
+
description="Toast description"
|
23
|
+
></glide-core-toast>`);
|
24
|
+
expect(component.shadowRoot?.firstElementChild?.getAttribute('role')).to.equal('alert');
|
25
|
+
});
|
26
|
+
it('sets correct aria labelling', async () => {
|
27
|
+
const component = await fixture(html `<glide-core-toast
|
28
|
+
variant="informational"
|
29
|
+
label="Label"
|
30
|
+
description="Toast description"
|
31
|
+
></glide-core-toast>`);
|
32
|
+
expect(component.shadowRoot?.firstElementChild?.getAttribute('aria-labelledby')).to.equal('label description');
|
33
|
+
expect(component.shadowRoot?.firstElementChild?.querySelector('#label')
|
34
|
+
?.textContent).to.equal('Label');
|
35
|
+
expect(component.shadowRoot?.firstElementChild?.querySelector('#description')
|
36
|
+
?.textContent).to.equal('Toast description');
|
37
|
+
});
|
38
|
+
it('sets variant, label, and description', async () => {
|
39
|
+
const component = await fixture(html `<glide-core-toast
|
40
|
+
variant="informational"
|
41
|
+
label="Label"
|
42
|
+
description="Toast description"
|
43
|
+
></glide-core-toast>`);
|
44
|
+
await expect(component.variant).to.equal('informational');
|
45
|
+
await expect(component.label).to.equal('Label');
|
46
|
+
await expect(component.description).to.equal('Toast description');
|
47
|
+
});
|
48
|
+
it('opens and closes by default', async () => {
|
49
|
+
const clock = sinon.useFakeTimers();
|
50
|
+
const component = await fixture(html `<glide-core-toast
|
51
|
+
variant="informational"
|
52
|
+
label="Label"
|
53
|
+
description="Toast description"
|
54
|
+
></glide-core-toast>`);
|
55
|
+
clock.tick(3000);
|
56
|
+
const shadowElement = component.shadowRoot.firstElementChild;
|
57
|
+
await expect([...shadowElement.classList]).to.deep.equal([
|
58
|
+
'component',
|
59
|
+
'informational',
|
60
|
+
'open',
|
61
|
+
]);
|
62
|
+
clock.tick(3000);
|
63
|
+
shadowElement?.dispatchEvent(new TransitionEvent('transitionend'));
|
64
|
+
await expect([
|
65
|
+
...component.shadowRoot.firstElementChild.classList,
|
66
|
+
]).to.deep.equal(['component', 'informational', 'closed']);
|
67
|
+
clock.restore();
|
68
|
+
});
|
69
|
+
it('responds to duration', async () => {
|
70
|
+
const clock = sinon.useFakeTimers();
|
71
|
+
const component = await fixture(html `<glide-core-toast
|
72
|
+
variant="informational"
|
73
|
+
label="Label"
|
74
|
+
description="Toast description"
|
75
|
+
duration="10000"
|
76
|
+
></glide-core-toast>`);
|
77
|
+
clock.tick(9500);
|
78
|
+
const shadowElement = component.shadowRoot.firstElementChild;
|
79
|
+
await expect([...shadowElement.classList]).to.deep.equal([
|
80
|
+
'component',
|
81
|
+
'informational',
|
82
|
+
'open',
|
83
|
+
]);
|
84
|
+
clock.tick(1000);
|
85
|
+
shadowElement?.dispatchEvent(new TransitionEvent('transitionend'));
|
86
|
+
await expect([
|
87
|
+
...component.shadowRoot.firstElementChild.classList,
|
88
|
+
]).to.deep.equal(['component', 'informational', 'closed']);
|
89
|
+
clock.restore();
|
90
|
+
});
|
91
|
+
it('responds to duration of Infinity', async () => {
|
92
|
+
const clock = sinon.useFakeTimers();
|
93
|
+
const component = await fixture(html `<glide-core-toast
|
94
|
+
variant="informational"
|
95
|
+
label="Label"
|
96
|
+
description="Toast description"
|
97
|
+
duration="Infinity"
|
98
|
+
></glide-core-toast>`);
|
99
|
+
clock.tick(9500);
|
100
|
+
const shadowElement = component.shadowRoot.firstElementChild;
|
101
|
+
await expect([...shadowElement.classList]).to.deep.equal([
|
102
|
+
'component',
|
103
|
+
'informational',
|
104
|
+
'open',
|
105
|
+
]);
|
106
|
+
clock.restore();
|
107
|
+
});
|
108
|
+
it('does not allow less than 5000 duration', async () => {
|
109
|
+
const clock = sinon.useFakeTimers();
|
110
|
+
const component = await fixture(html `<glide-core-toast
|
111
|
+
variant="informational"
|
112
|
+
label="Label"
|
113
|
+
description="Toast description"
|
114
|
+
duration="3000"
|
115
|
+
></glide-core-toast>`);
|
116
|
+
clock.tick(4000);
|
117
|
+
const shadowElement = component.shadowRoot.firstElementChild;
|
118
|
+
await expect([...shadowElement.classList]).to.deep.equal([
|
119
|
+
'component',
|
120
|
+
'informational',
|
121
|
+
'open',
|
122
|
+
]);
|
123
|
+
clock.restore();
|
124
|
+
});
|
125
|
+
it('can be closed by clicking on the x icon', async () => {
|
126
|
+
const component = await fixture(html `<glide-core-toast
|
127
|
+
variant="informational"
|
128
|
+
label="Label"
|
129
|
+
description="Toast description"
|
130
|
+
></glide-core-toast>`);
|
131
|
+
const shadowElement = component.shadowRoot.firstElementChild;
|
132
|
+
const closeButton = shadowElement?.querySelector('glide-core-icon-button[label="Close"]');
|
133
|
+
assert(closeButton);
|
134
|
+
closeButton.click();
|
135
|
+
shadowElement?.dispatchEvent(new TransitionEvent('transitionend'));
|
136
|
+
await expect([
|
137
|
+
...component.shadowRoot.firstElementChild.classList,
|
138
|
+
]).to.deep.equal(['component', 'informational', 'closed']);
|
139
|
+
});
|
package/dist/toggle.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,o,i){var l,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,i);else for(var d=e.length-1;d>=0;d--)(l=e[d])&&(s=(r<3?l(s):r>3?l(t,o,s):l(t,o))||s);return r>3&&s&&Object.defineProperty(t,o,s),s};import"./label.js";import{LitElement,html}from"lit";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import styles from"./toggle.styles.js";let GlideCoreToggle=class GlideCoreToggle extends LitElement{constructor(){super(...arguments),this.checked=!1,this.disabled=!1,this.hideLabel=!1,this.orientation="horizontal",this.#e=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}click(){this.#e.value?.click()}focus(e){this.#e.value?.focus(e)}render(){return html`<div data-test="component"><glide-core-label orientation="${this.orientation}" ?disabled="${this.disabled}" ?hide="${this.hideLabel}"><slot name="tooltip" slot="tooltip"></slot><label for="input">${this.label}</label><div class="toggle-and-input" slot="control"><input aria-checked="${this.checked}" aria-describedby="summary description" data-test="input" id="input" role="switch" type="checkbox" ?checked="${this.checked}" ?disabled="${this.disabled}" @change="${this.#t}" ${ref(this.#e)}></div><div slot="summary" id="summary">${this.summary}</div><slot class="description" id="description" name="description" slot="description"></slot></glide-core-label></div>`}#e;#t(e){e.target instanceof HTMLInputElement&&(this.checked=e.target.checked),this.dispatchEvent(new Event(e.type,e))}};__decorate([property({type:Boolean})],GlideCoreToggle.prototype,"checked",void 0),__decorate([property({reflect:!0,type:Boolean})],GlideCoreToggle.prototype,"disabled",void 0),__decorate([property({attribute:"hide-label",type:Boolean})],GlideCoreToggle.prototype,"hideLabel",void 0),__decorate([property({reflect:!0})],GlideCoreToggle.prototype,"label",void 0),__decorate([property({reflect:!0})],GlideCoreToggle.prototype,"orientation",void 0),__decorate([property({reflect:!0})],GlideCoreToggle.prototype,"name",void 0),__decorate([property({reflect:!0})],GlideCoreToggle.prototype,"summary",void 0),GlideCoreToggle=__decorate([customElement("glide-core-toggle")],GlideCoreToggle);export default GlideCoreToggle;
|
package/dist/toggle.styles.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export default[css`
|
2
2
|
/*
|
3
3
|
Most states are handled on the host. But ":checked" is handled on the input
|
4
4
|
because browsers don't support that class on the host. And using attribute
|
@@ -30,7 +30,7 @@ Use the ":checked" pseudo class on the host and throughout when browsers support
|
|
30
30
|
position: relative;
|
31
31
|
|
32
32
|
&:has(input:focus-visible) {
|
33
|
-
${
|
33
|
+
${focusOutline};
|
34
34
|
outline-offset: 4px;
|
35
35
|
}
|
36
36
|
|
@@ -78,4 +78,4 @@ Use the ":checked" pseudo class on the host and throughout when browsers support
|
|
78
78
|
opacity: 0;
|
79
79
|
position: absolute;
|
80
80
|
}
|
81
|
-
`];
|
81
|
+
`];
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
2
|
+
import GlideCoreToggle from './toggle.js';
|
3
|
+
GlideCoreToggle.shadowRootOptions.mode = 'open';
|
4
|
+
it('registers', async () => {
|
5
|
+
expect(window.customElements.get('glide-core-toggle')).to.equal(GlideCoreToggle);
|
6
|
+
});
|
7
|
+
it('has defaults', async () => {
|
8
|
+
const component = await fixture(html `<glide-core-toggle label="Label"></glide-core-toggle>`);
|
9
|
+
expect(component.hasAttribute('checked')).to.be.false;
|
10
|
+
expect(component.checked).to.be.false;
|
11
|
+
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
12
|
+
expect(input?.getAttribute('aria-checked')).to.equal('false');
|
13
|
+
expect(component.hasAttribute('disabled')).to.be.false;
|
14
|
+
expect(component.disabled).to.be.false;
|
15
|
+
expect(component.hasAttribute('hide-label')).to.be.false;
|
16
|
+
expect(component.hideLabel).to.be.false;
|
17
|
+
expect(component.getAttribute('orientation')).to.equal('horizontal');
|
18
|
+
expect(component.orientation).to.equal('horizontal');
|
19
|
+
expect(component.getAttribute('summary')).to.be.null;
|
20
|
+
expect(component.summary).to.equal(undefined);
|
21
|
+
});
|
22
|
+
it('is accessible', async () => {
|
23
|
+
const component = await fixture(html `<glide-core-toggle label="Label">
|
24
|
+
<div slot="tooltip">Tooltip</div>
|
25
|
+
<div slot="description">Description</div>
|
26
|
+
</glide-core-toggle>`);
|
27
|
+
await expect(component).to.be.accessible();
|
28
|
+
});
|
29
|
+
it('can have a label', async () => {
|
30
|
+
const component = await fixture(html `<glide-core-toggle label="Label"></glide-core-toggle> `);
|
31
|
+
expect(component.getAttribute('label')).to.equal('Label');
|
32
|
+
expect(component.label).to.equal('Label');
|
33
|
+
});
|
34
|
+
it('can have a description', async () => {
|
35
|
+
const component = await fixture(html `<glide-core-toggle label="Label">
|
36
|
+
<div slot="description">Description</div>
|
37
|
+
</glide-core-toggle>`);
|
38
|
+
const assignedElements = component.shadowRoot
|
39
|
+
?.querySelector('slot[name="description"]')
|
40
|
+
?.assignedElements();
|
41
|
+
expect(assignedElements?.at(0)?.textContent).to.equal('Description');
|
42
|
+
});
|
43
|
+
it('can have a summary', async () => {
|
44
|
+
const component = await fixture(html `<glide-core-toggle summary="Summary"></glide-core-toggle> `);
|
45
|
+
expect(component.getAttribute('summary')).to.equal('Summary');
|
46
|
+
expect(component.summary).to.equal('Summary');
|
47
|
+
});
|
48
|
+
it('can have a tooltip', async () => {
|
49
|
+
const component = await fixture(html `<glide-core-toggle label="Label">
|
50
|
+
<div slot="tooltip">Tooltip</div>
|
51
|
+
</glide-core-toggle>`);
|
52
|
+
const assignedElements = component.shadowRoot
|
53
|
+
?.querySelector('slot[name="tooltip"]')
|
54
|
+
?.assignedElements();
|
55
|
+
expect(assignedElements?.at(0)?.textContent).to.equal('Tooltip');
|
56
|
+
});
|
57
|
+
it('can be checked', async () => {
|
58
|
+
const component = await fixture(html `<glide-core-toggle checked></glide-core-toggle> `);
|
59
|
+
expect(component.hasAttribute('checked')).to.be.true;
|
60
|
+
expect(component.checked).to.equal(true);
|
61
|
+
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
62
|
+
expect(input?.getAttribute('aria-checked')).to.equal('true');
|
63
|
+
});
|
64
|
+
it('can be disabled', async () => {
|
65
|
+
const component = await fixture(html `<glide-core-toggle disabled></glide-core-toggle> `);
|
66
|
+
expect(component.hasAttribute('disabled')).to.be.true;
|
67
|
+
expect(component.disabled).to.equal(true);
|
68
|
+
});
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { expect, fixture, html, oneEvent } from '@open-wc/testing';
|
2
|
+
import GlideCoreToggle from './toggle.js';
|
3
|
+
GlideCoreToggle.shadowRootOptions.mode = 'open';
|
4
|
+
// `await aTimeout(0)` is used throughout. Using `oneEvent` instead and
|
5
|
+
// expecting it to throw would work. But it wouldn't throw until its
|
6
|
+
// timeout, which would make for a slow test. Its timeout can likely be
|
7
|
+
// configured. But waiting a turn of the event loop, after which the event
|
8
|
+
// will have been dispatched, gets the job done as well.
|
9
|
+
it('dispatches a "click" event when clicked', async () => {
|
10
|
+
const component = await fixture(html `<glide-core-toggle label="Label"></glide-core-toggle>`);
|
11
|
+
setTimeout(() => component.click());
|
12
|
+
const event = await oneEvent(component, 'click');
|
13
|
+
expect(event instanceof PointerEvent).to.be.true;
|
14
|
+
expect(event.bubbles).to.be.true;
|
15
|
+
});
|
16
|
+
it('dispatches a "change" event when clicked', async () => {
|
17
|
+
const component = await fixture(html `<glide-core-toggle label="Label"></glide-core-toggle>`);
|
18
|
+
setTimeout(() => component.click());
|
19
|
+
const event = await oneEvent(component, 'change');
|
20
|
+
expect(event instanceof Event).to.be.true;
|
21
|
+
expect(event.bubbles).to.be.true;
|
22
|
+
});
|
23
|
+
it('dispatches an "input" event when clicked', async () => {
|
24
|
+
const component = await fixture(html `<glide-core-toggle label="Label"></glide-core-toggle>`);
|
25
|
+
setTimeout(() => component.click());
|
26
|
+
const event = await oneEvent(component, 'input');
|
27
|
+
expect(event instanceof Event).to.be.true;
|
28
|
+
expect(event.bubbles).to.be.true;
|
29
|
+
});
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
2
|
+
import GlideCoreToggle from './toggle.js';
|
3
|
+
GlideCoreToggle.shadowRootOptions.mode = 'open';
|
4
|
+
it('focuses the input when `focus` is called', async () => {
|
5
|
+
const component = await fixture(html `<glide-core-toggle label="Label"></glide-core-toggle>`);
|
6
|
+
component.focus();
|
7
|
+
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
8
|
+
expect(component.shadowRoot?.activeElement).to.equal(input);
|
9
|
+
});
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
|
2
|
+
import GlideCoreToggle from './toggle.js';
|
3
|
+
GlideCoreToggle.shadowRootOptions.mode = 'open';
|
4
|
+
it('is checked after being clicked', async () => {
|
5
|
+
const component = await fixture(html `<glide-core-toggle label="Label"></glide-core-toggle>`);
|
6
|
+
component.click();
|
7
|
+
await elementUpdated(component);
|
8
|
+
expect(component.checked).to.equal(true);
|
9
|
+
expect(component.hasAttribute('checked')).to.be.false;
|
10
|
+
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
11
|
+
expect(input?.getAttribute('aria-checked')).to.equal('true');
|
12
|
+
});
|
13
|
+
it('is unchecked after being clicked', async () => {
|
14
|
+
const component = await fixture(html `<glide-core-toggle label="Label" checked></glide-core-toggle>`);
|
15
|
+
component.click();
|
16
|
+
await elementUpdated(component);
|
17
|
+
expect(component.checked).to.equal(false);
|
18
|
+
expect(component.hasAttribute('checked')).to.be.true;
|
19
|
+
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
20
|
+
expect(input?.getAttribute('aria-checked')).to.equal('false');
|
21
|
+
});
|
22
|
+
it('is still checked after being clicked when checked but disabled', async () => {
|
23
|
+
const component = await fixture(html `<glide-core-toggle
|
24
|
+
label="Label"
|
25
|
+
checked
|
26
|
+
disabled
|
27
|
+
></glide-core-toggle>`);
|
28
|
+
component.click();
|
29
|
+
await elementUpdated(component);
|
30
|
+
expect(component.checked).to.equal(true);
|
31
|
+
expect(component.hasAttribute('checked')).to.be.true;
|
32
|
+
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
33
|
+
expect(input?.getAttribute('aria-checked')).to.equal('true');
|
34
|
+
});
|
35
|
+
it('is still unchecked after being clicked when unchecked and disabled', async () => {
|
36
|
+
const component = await fixture(html `<glide-core-toggle label="Label" disabled></glide-core-toggle>`);
|
37
|
+
component.click();
|
38
|
+
await elementUpdated(component);
|
39
|
+
expect(component.hasAttribute('checked')).to.be.false;
|
40
|
+
expect(component.checked).to.equal(false);
|
41
|
+
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
42
|
+
expect(input?.getAttribute('aria-checked')).to.equal('false');
|
43
|
+
});
|
package/dist/tooltip.d.ts
CHANGED
@@ -13,9 +13,11 @@ export default class GlideCoreTooltip extends LitElement {
|
|
13
13
|
static shadowRootOptions: ShadowRootInit;
|
14
14
|
static styles: import("lit").CSSResult[];
|
15
15
|
placement?: 'bottom' | 'left' | 'right' | 'top';
|
16
|
+
containingBlock?: Element;
|
16
17
|
firstUpdated(): void;
|
17
18
|
private get isVisible();
|
18
19
|
private set isVisible(value);
|
19
20
|
render(): import("lit").TemplateResult<1>;
|
21
|
+
setContainingBlock(containingBlock: Element): void;
|
20
22
|
private effectivePlacement?;
|
21
23
|
}
|
package/dist/tooltip.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,o,i){var l,s=arguments.length,a=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,i);else for(var r=t.length-1;r>=0;r--)(l=t[r])&&(a=(s<3?l(a):s>3?l(e,o,a):l(e,o))||a);return s>3&&a&&Object.defineProperty(e,o,a),a};import{LitElement,html}from"lit";import{arrow,autoUpdate,computePosition,flip,offset,platform,shift}from"@floating-ui/dom";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,state}from"lit/decorators.js";import{offsetParent}from"composed-offset-position";import{owSlot}from"./library/ow.js";import styles from"./tooltip.styles.js";let GlideCoreTooltip=class GlideCoreTooltip extends LitElement{static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:"closed"}}static{this.styles=styles}firstUpdated(){owSlot(this.#t.value),owSlot(this.#e.value),this.#o()}get isVisible(){return this.#i}set isVisible(t){this.#i=t,this.isVisible?this.#o():this.#l?.()}render(){return html`<div class="component" @mouseover="${this.#s}" @mouseout="${this.#a}"><div aria-labelledby="tooltip" class="target" slot="target" @focusin="${this.#r}" @focusout="${this.#n}" @keydown="${this.#f}" ${ref(this.#c)}><slot @slotchange="${this.#p}" ${ref(this.#e)} name="target"></slot></div><div class="${classMap({tooltip:!0,visible:this.isVisible})}" id="tooltip" role="tooltip" ${ref(this.#m)}><span aria-label="Tooltip: "></span><slot @slotchange="${this.#h}" ${ref(this.#t)}></slot><div class="arrow" ${ref(this.#d)}></div></div></div>`}setContainingBlock(t){this.containingBlock=t}#d=createRef();#l;#u;#t=createRef();#i=!1;#c=createRef();#e=createRef();#m=createRef();#g(){clearTimeout(this.#u)}#h(){owSlot(this.#t.value)}#r(){this.isVisible=!0}#n(){this.isVisible=!1}#f(t){"Escape"===t.key&&(this.isVisible=!1)}#a(){this.#v()}#s(){this.#g(),this.isVisible=!0}#p(){owSlot(this.#e.value)}#v(){this.#u=setTimeout((()=>{this.isVisible=!1}),200)}#o(){this.#c.value&&this.#m.value&&(this.#l=autoUpdate(this.#c.value,this.#m.value,(()=>{(async()=>{if(this.#c.value&&this.#m.value){const t=this.#d.value,{placement:e,x:o,y:i,middlewareData:l}=await computePosition(this.#c.value,this.#m.value,{platform:{...platform,getOffsetParent:t=>this.containingBlock&&t!==this.#d.value?this.containingBlock:platform.getOffsetParent(t,offsetParent)},placement:this.placement,strategy:"fixed",middleware:[offset(6),flip({fallbackStrategy:"initialPlacement"}),shift(),arrow({element:t})]});Object.assign(this.#m.value.style,{left:`${o}px`,top:`${i}px`});const s=l.arrow?.x??null,a=l.arrow?.y??null,r={top:"bottom",right:"left",bottom:"top",left:"right"}[e.split("-")[0]];Object.assign(t.style,{left:null===s?"":`${s}px`,top:null===a?"":`${a}px`,right:"",bottom:"",[r]:"-3px"}),this.effectivePlacement=e}})()})))}};__decorate([property()],GlideCoreTooltip.prototype,"placement",void 0),__decorate([state()],GlideCoreTooltip.prototype,"containingBlock",void 0),__decorate([state()],GlideCoreTooltip.prototype,"isVisible",null),__decorate([state()],GlideCoreTooltip.prototype,"effectivePlacement",void 0),GlideCoreTooltip=__decorate([customElement("glide-core-tooltip")],GlideCoreTooltip);export default GlideCoreTooltip;
|
package/dist/tooltip.styles.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export default[css`
|
2
2
|
.component {
|
3
3
|
/* https://github.com/CrowdStrike/glide-core/pull/119#issuecomment-2113314591 */
|
4
4
|
display: flex;
|
@@ -19,7 +19,7 @@
|
|
19
19
|
}
|
20
20
|
|
21
21
|
&:focus-visible {
|
22
|
-
${
|
22
|
+
${focusOutline};
|
23
23
|
}
|
24
24
|
|
25
25
|
::slotted svg {
|
@@ -39,6 +39,8 @@
|
|
39
39
|
inset-block-start: 50%;
|
40
40
|
inset-block-start: 0;
|
41
41
|
inset-inline-start: 0;
|
42
|
+
max-inline-size: 11.25rem;
|
43
|
+
overflow-wrap: break-word;
|
42
44
|
padding: var(--glide-core-spacing-xs) var(--glide-core-spacing-sm);
|
43
45
|
position: fixed;
|
44
46
|
z-index: 1;
|
@@ -63,4 +65,4 @@
|
|
63
65
|
position: absolute;
|
64
66
|
transform: rotate(45deg);
|
65
67
|
}
|
66
|
-
`];
|
68
|
+
`];
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import './tooltip.js';
|
2
|
+
import { ArgumentError } from 'ow';
|
3
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
4
|
+
import GlideCoreTooltip from './tooltip.js';
|
5
|
+
import sinon from 'sinon';
|
6
|
+
GlideCoreTooltip.shadowRootOptions.mode = 'open';
|
7
|
+
it('registers', async () => {
|
8
|
+
expect(window.customElements.get('glide-core-tooltip')).to.equal(GlideCoreTooltip);
|
9
|
+
});
|
10
|
+
it('is accessible', async () => {
|
11
|
+
const component = await fixture(html `<glide-core-tooltip>
|
12
|
+
Tooltip
|
13
|
+
<span slot="target" tabindex="0">Target</span>
|
14
|
+
</glide-core-tooltip>`);
|
15
|
+
// See the comment in the component's `render` method for an explanation.
|
16
|
+
await expect(component).to.be.accessible({
|
17
|
+
ignoredRules: ['aria-tooltip-name'],
|
18
|
+
});
|
19
|
+
});
|
20
|
+
it('can have a tooltip', async () => {
|
21
|
+
const component = await fixture(html `<glide-core-tooltip aria-label="Label">
|
22
|
+
Tooltip
|
23
|
+
<span slot="target" tabindex="0">Target</span>
|
24
|
+
</glide-core-tooltip>`);
|
25
|
+
const tooltip = component?.shadowRoot
|
26
|
+
?.querySelector('slot:not([name])')
|
27
|
+
?.assignedNodes()
|
28
|
+
.at(0);
|
29
|
+
expect(tooltip?.textContent?.trim()).to.equal('Tooltip');
|
30
|
+
});
|
31
|
+
it('can have a target', async () => {
|
32
|
+
const component = await fixture(html `<glide-core-tooltip>
|
33
|
+
Tooltip
|
34
|
+
<span slot="target" tabindex="0">Target</span>
|
35
|
+
</glide-core-tooltip>`);
|
36
|
+
const assignedElements = component.shadowRoot
|
37
|
+
?.querySelector('slot[name="target"]')
|
38
|
+
?.assignedElements();
|
39
|
+
expect(assignedElements?.at(0)?.textContent).to.equal('Target');
|
40
|
+
});
|
41
|
+
it('throws if it does not have a default slot', async () => {
|
42
|
+
const spy = sinon.spy();
|
43
|
+
try {
|
44
|
+
await fixture(html `<glide-core-tooltip></glide-core-tooltip>`);
|
45
|
+
}
|
46
|
+
catch (error) {
|
47
|
+
if (error instanceof ArgumentError) {
|
48
|
+
spy();
|
49
|
+
}
|
50
|
+
}
|
51
|
+
expect(spy.called).to.be.true;
|
52
|
+
});
|
53
|
+
it('throws if it does not have a "target" slot', async () => {
|
54
|
+
const spy = sinon.spy();
|
55
|
+
try {
|
56
|
+
await fixture(html `<glide-core-tooltip> Tooltip </glide-core-tooltip>`);
|
57
|
+
}
|
58
|
+
catch (error) {
|
59
|
+
if (error instanceof ArgumentError) {
|
60
|
+
spy();
|
61
|
+
}
|
62
|
+
}
|
63
|
+
expect(spy.called).to.be.true;
|
64
|
+
});
|
@@ -0,0 +1,78 @@
|
|
1
|
+
import './tooltip.js';
|
2
|
+
import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
|
3
|
+
import { sendKeys } from '@web/test-runner-commands';
|
4
|
+
import GlideCoreTooltip from './tooltip.js';
|
5
|
+
import sinon from 'sinon';
|
6
|
+
GlideCoreTooltip.shadowRootOptions.mode = 'open';
|
7
|
+
it('is visible on "focusin"', async () => {
|
8
|
+
const component = await fixture(html `<glide-core-tooltip>
|
9
|
+
Tooltip
|
10
|
+
<span slot="target" tabindex="0">Target</span>
|
11
|
+
</glide-core-tooltip>`);
|
12
|
+
component.shadowRoot
|
13
|
+
?.querySelector('[aria-labelledby="tooltip"]')
|
14
|
+
?.dispatchEvent(new FocusEvent('focusin'));
|
15
|
+
await elementUpdated(component);
|
16
|
+
expect(component.shadowRoot?.querySelector('[role="tooltip"]')?.checkVisibility()).to.be.true;
|
17
|
+
});
|
18
|
+
it('is hidden on "blur"', async () => {
|
19
|
+
const component = await fixture(html `<glide-core-tooltip>
|
20
|
+
Tooltip
|
21
|
+
<span slot="target" tabindex="0">Target</span>
|
22
|
+
</glide-core-tooltip>`);
|
23
|
+
component.shadowRoot
|
24
|
+
?.querySelector('[aria-labelledby="tooltip"]')
|
25
|
+
?.dispatchEvent(new FocusEvent('focusin'));
|
26
|
+
await elementUpdated(component);
|
27
|
+
component.shadowRoot
|
28
|
+
?.querySelector('[aria-labelledby="tooltip"]')
|
29
|
+
?.dispatchEvent(new FocusEvent('focusout'));
|
30
|
+
await elementUpdated(component);
|
31
|
+
expect(component.shadowRoot?.querySelector('[role="tooltip"]')?.checkVisibility()).to.be.false;
|
32
|
+
});
|
33
|
+
it('is hidden on Escape', async () => {
|
34
|
+
const component = await fixture(html `<glide-core-tooltip>
|
35
|
+
Tooltip
|
36
|
+
<span slot="target" tabindex="0">Target</span>
|
37
|
+
</glide-core-tooltip>`);
|
38
|
+
component.shadowRoot
|
39
|
+
?.querySelector('[aria-labelledby="tooltip"]')
|
40
|
+
?.dispatchEvent(new FocusEvent('focusin'));
|
41
|
+
await elementUpdated(component);
|
42
|
+
// So the key is sent to the component instead of `<body>`. It's not
|
43
|
+
// clear why `component.focus()` doesn't focus the span when using
|
44
|
+
// Playwright.
|
45
|
+
component.querySelector('span')?.focus();
|
46
|
+
await sendKeys({ press: 'Escape' });
|
47
|
+
await elementUpdated(component);
|
48
|
+
expect(component.shadowRoot?.querySelector('[role="tooltip"]')?.checkVisibility()).to.be.false;
|
49
|
+
});
|
50
|
+
it('is visible on "mouseover"', async () => {
|
51
|
+
const component = await fixture(html `<glide-core-tooltip>
|
52
|
+
Tooltip
|
53
|
+
<span slot="target" tabindex="0">Target</span>
|
54
|
+
</glide-core-tooltip>`);
|
55
|
+
component.shadowRoot
|
56
|
+
?.querySelector('.component')
|
57
|
+
?.dispatchEvent(new MouseEvent('mouseover'));
|
58
|
+
await elementUpdated(component);
|
59
|
+
expect(component.shadowRoot?.querySelector('[role="tooltip"]')?.checkVisibility()).to.be.true;
|
60
|
+
});
|
61
|
+
it('is hidden on "mouseout"', async () => {
|
62
|
+
const clock = sinon.useFakeTimers();
|
63
|
+
const component = await fixture(html `<glide-core-tooltip>
|
64
|
+
Tooltip
|
65
|
+
<span slot="target" tabindex="0">Target</span>
|
66
|
+
</glide-core-tooltip>`);
|
67
|
+
component.shadowRoot
|
68
|
+
?.querySelector('.component')
|
69
|
+
?.dispatchEvent(new MouseEvent('mouseover'));
|
70
|
+
await elementUpdated(component);
|
71
|
+
component.shadowRoot
|
72
|
+
?.querySelector('.component')
|
73
|
+
?.dispatchEvent(new MouseEvent('mouseout'));
|
74
|
+
clock.tick(300);
|
75
|
+
await elementUpdated(component);
|
76
|
+
expect(component.shadowRoot?.querySelector('[role="tooltip"]')?.checkVisibility()).to.be.false;
|
77
|
+
clock.restore();
|
78
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
const translation={$code:"en",$name:"English",$dir:"ltr",close:"Close",dismiss:"Dismiss",open:"Open",selectAll:"Select all",clearEntry:"Clear entry",moreInformation:"More information",notifications:"Notifications",removeTag:e=>`Remove tag: ${e}`};export default translation;
|
@@ -0,0 +1 @@
|
|
1
|
+
const translation={$code:"fr",$name:"French",$dir:"ltr",close:"Fermer",dismiss:"Congédier",open:"Ouvrir",selectAll:"Tout sélectionner",clearEntry:"Effacer l’entrée",moreInformation:"Plus d’informations",notifications:"Notifications",removeTag:e=>`Supprimer la balise : ${e}`};export default translation;
|
@@ -0,0 +1 @@
|
|
1
|
+
const translation={$code:"ja",$name:"Japanese",$dir:"ltr",close:"閉じる",dismiss:"無視",open:"オープン",selectAll:"すべて選択",clearEntry:"入力のクリア",moreInformation:"詳細情報",notifications:"通知",removeTag:e=>`タグを削除: ${e}`};export default translation;
|
package/dist/tree.d.ts
CHANGED
package/dist/tree.item.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import './tree.item.menu.js';
|
2
2
|
import { LitElement } from 'lit';
|
3
|
+
import GlideCoreMenu from './menu.js';
|
3
4
|
declare global {
|
4
5
|
interface HTMLElementTagNameMap {
|
5
6
|
'glide-core-tree-item': GlideCoreTreeItem;
|
@@ -21,7 +22,7 @@ export default class GlideCoreTreeItem extends LitElement {
|
|
21
22
|
label: string;
|
22
23
|
level: number;
|
23
24
|
selected: boolean;
|
24
|
-
menuSlotAssignedElements:
|
25
|
+
menuSlotAssignedElements: GlideCoreMenu[];
|
25
26
|
prefixSlotAssignedElements: HTMLElement[];
|
26
27
|
slotElements: GlideCoreTreeItem[];
|
27
28
|
suffixSlotAssignedElements: HTMLElement[];
|
@@ -35,6 +36,7 @@ export default class GlideCoreTreeItem extends LitElement {
|
|
35
36
|
* Returns the selected item
|
36
37
|
*/
|
37
38
|
selectItem(item: GlideCoreTreeItem): GlideCoreTreeItem | undefined;
|
39
|
+
setContainingBlock(containingBlock: Element): void;
|
38
40
|
toggleExpand(): void;
|
39
41
|
private childTreeItems;
|
40
42
|
private hasMenuSlot;
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,o,r){var l,n=arguments.length,i=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(l=e[s])&&(i=(n<3?l(i):n>3?l(t,o,i):l(t,o))||i);return n>3&&i&&Object.defineProperty(t,o,i),i};import"./icon-button.js";import{LitElement,html}from"lit";import{createRef,ref}from"lit/directives/ref.js";import{customElement}from"lit/decorators.js";import{owSlot}from"./library/ow.js";import styles from"./tree.item.icon-button.styles.js";let GlideCoreTreeItemIconButton=class GlideCoreTreeItemIconButton extends LitElement{static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:"closed"}}static{this.styles=styles}firstUpdated(){owSlot(this.#e.value)}render(){return html`<glide-core-icon-button class="component" variant="tertiary"><slot @slotchange="${this.#t}" ${ref(this.#e)}></slot></glide-core-icon-button>`}#e=createRef();#t(){owSlot(this.#e.value)}};GlideCoreTreeItemIconButton=__decorate([customElement("glide-core-tree-item-icon-button")],GlideCoreTreeItemIconButton);export default GlideCoreTreeItemIconButton;
|