@aquera/nile-elements 2.0.6 → 2.0.7
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 +3 -0
- package/dist/index.js +15 -5
- package/dist/nile-side-bar-footer/nile-side-bar-footer.cjs.js +1 -1
- package/dist/nile-side-bar-footer/nile-side-bar-footer.cjs.js.map +1 -1
- package/dist/nile-side-bar-footer/nile-side-bar-footer.css.cjs.js +1 -1
- package/dist/nile-side-bar-footer/nile-side-bar-footer.css.cjs.js.map +1 -1
- package/dist/nile-side-bar-footer/nile-side-bar-footer.css.esm.js +5 -0
- package/dist/nile-side-bar-footer/nile-side-bar-footer.esm.js +2 -2
- package/dist/nile-side-bar-header/nile-side-bar-header.cjs.js +1 -1
- package/dist/nile-side-bar-header/nile-side-bar-header.cjs.js.map +1 -1
- package/dist/nile-side-bar-header/nile-side-bar-header.css.cjs.js +1 -1
- package/dist/nile-side-bar-header/nile-side-bar-header.css.cjs.js.map +1 -1
- package/dist/nile-side-bar-header/nile-side-bar-header.css.esm.js +5 -0
- package/dist/nile-side-bar-header/nile-side-bar-header.esm.js +2 -2
- package/dist/src/nile-side-bar-footer/nile-side-bar-footer.css.js +5 -0
- package/dist/src/nile-side-bar-footer/nile-side-bar-footer.css.js.map +1 -1
- package/dist/src/nile-side-bar-footer/nile-side-bar-footer.d.ts +10 -0
- package/dist/src/nile-side-bar-footer/nile-side-bar-footer.js +17 -1
- package/dist/src/nile-side-bar-footer/nile-side-bar-footer.js.map +1 -1
- package/dist/src/nile-side-bar-footer/nile-side-bar-footer.test.d.ts +1 -0
- package/dist/src/nile-side-bar-footer/nile-side-bar-footer.test.js +42 -0
- package/dist/src/nile-side-bar-footer/nile-side-bar-footer.test.js.map +1 -0
- package/dist/src/nile-side-bar-header/nile-side-bar-app-shell.test.d.ts +4 -0
- package/dist/src/nile-side-bar-header/nile-side-bar-app-shell.test.js +68 -0
- package/dist/src/nile-side-bar-header/nile-side-bar-app-shell.test.js.map +1 -0
- package/dist/src/nile-side-bar-header/nile-side-bar-header.css.js +5 -0
- package/dist/src/nile-side-bar-header/nile-side-bar-header.css.js.map +1 -1
- package/dist/src/nile-side-bar-header/nile-side-bar-header.d.ts +9 -0
- package/dist/src/nile-side-bar-header/nile-side-bar-header.js +17 -1
- package/dist/src/nile-side-bar-header/nile-side-bar-header.js.map +1 -1
- package/dist/src/nile-side-bar-header/nile-side-bar-header.test.d.ts +1 -0
- package/dist/src/nile-side-bar-header/nile-side-bar-header.test.js +42 -0
- package/dist/src/nile-side-bar-header/nile-side-bar-header.test.js.map +1 -0
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-side-bar-footer/nile-side-bar-footer.css.ts +5 -0
- package/src/nile-side-bar-footer/nile-side-bar-footer.test.ts +55 -0
- package/src/nile-side-bar-footer/nile-side-bar-footer.ts +12 -1
- package/src/nile-side-bar-header/nile-side-bar-app-shell.test.ts +78 -0
- package/src/nile-side-bar-header/nile-side-bar-header.css.ts +5 -0
- package/src/nile-side-bar-header/nile-side-bar-header.test.ts +55 -0
- package/src/nile-side-bar-header/nile-side-bar-header.ts +10 -0
- package/vscode-html-custom-data.json +30 -4
package/package.json
CHANGED
|
@@ -16,6 +16,11 @@ export const styles = css`
|
|
|
16
16
|
background: var(--nile-colors-neutral-100, var(--ng-colors-bg-primary));
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/* Opt-in: drop the surface color so the footer sits on whatever is behind it. */
|
|
20
|
+
:host([background='transparent']) {
|
|
21
|
+
background: transparent;
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
.footer {
|
|
20
25
|
display: flex;
|
|
21
26
|
flex-direction: column;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
|
2
|
+
import './nile-side-bar-footer';
|
|
3
|
+
import type { NileSideBarFooter } from './nile-side-bar-footer';
|
|
4
|
+
|
|
5
|
+
const TRANSPARENT = 'rgba(0, 0, 0, 0)';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The surface color comes from a design token, which a bare fixture does not
|
|
9
|
+
* load — so pin it on a wrapper to have something concrete to assert against.
|
|
10
|
+
*/
|
|
11
|
+
async function withToken(markup: unknown) {
|
|
12
|
+
const wrapper = await fixture<HTMLDivElement>(
|
|
13
|
+
html`<div style="--nile-colors-neutral-100: rgb(1, 2, 3)">${markup}</div>`
|
|
14
|
+
);
|
|
15
|
+
const el = wrapper.querySelector('nile-side-bar-footer') as NileSideBarFooter;
|
|
16
|
+
await el.updateComplete;
|
|
17
|
+
return el;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const backgroundOf = (el: NileSideBarFooter) => getComputedStyle(el).backgroundColor;
|
|
21
|
+
|
|
22
|
+
describe('NileSideBarFooter — background', () => {
|
|
23
|
+
it('1. defaults to "default" and reflects the attribute', async () => {
|
|
24
|
+
const el = await withToken(html`<nile-side-bar-footer></nile-side-bar-footer>`);
|
|
25
|
+
expect(el.background).to.equal('default');
|
|
26
|
+
expect(el.getAttribute('background')).to.equal('default');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('2. paints the sidebar surface color by default', async () => {
|
|
30
|
+
const el = await withToken(html`<nile-side-bar-footer></nile-side-bar-footer>`);
|
|
31
|
+
expect(backgroundOf(el)).to.equal('rgb(1, 2, 3)');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('3. background="transparent" removes the background', async () => {
|
|
35
|
+
const el = await withToken(
|
|
36
|
+
html`<nile-side-bar-footer background="transparent"></nile-side-bar-footer>`
|
|
37
|
+
);
|
|
38
|
+
expect(el.background).to.equal('transparent');
|
|
39
|
+
expect(backgroundOf(el)).to.equal(TRANSPARENT);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('4. setting the property at runtime reflects and re-styles both ways', async () => {
|
|
43
|
+
const el = await withToken(html`<nile-side-bar-footer></nile-side-bar-footer>`);
|
|
44
|
+
|
|
45
|
+
el.background = 'transparent';
|
|
46
|
+
await el.updateComplete;
|
|
47
|
+
expect(el.getAttribute('background')).to.equal('transparent');
|
|
48
|
+
expect(backgroundOf(el)).to.equal(TRANSPARENT);
|
|
49
|
+
|
|
50
|
+
el.background = 'default';
|
|
51
|
+
await el.updateComplete;
|
|
52
|
+
expect(el.getAttribute('background')).to.equal('default');
|
|
53
|
+
expect(backgroundOf(el)).to.equal('rgb(1, 2, 3)');
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { html, CSSResultArray, TemplateResult } from 'lit';
|
|
9
|
-
import { customElement } from 'lit/decorators.js';
|
|
9
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
10
10
|
import { styles } from './nile-side-bar-footer.css';
|
|
11
11
|
import NileElement from '../internal/nile-element';
|
|
12
12
|
|
|
@@ -17,9 +17,20 @@ import NileElement from '../internal/nile-element';
|
|
|
17
17
|
*
|
|
18
18
|
* @slot icon - Slot for footer icon
|
|
19
19
|
* @slot text - Slot for footer text
|
|
20
|
+
*
|
|
21
|
+
* @attr background - Background treatment of the footer ("default" | "transparent").
|
|
22
|
+
* Defaults to "default", which paints the sidebar surface color. Set to
|
|
23
|
+
* "transparent" to drop the background so whatever sits behind the footer shows
|
|
24
|
+
* through.
|
|
20
25
|
*/
|
|
21
26
|
@customElement('nile-side-bar-footer')
|
|
22
27
|
export class NileSideBarFooter extends NileElement {
|
|
28
|
+
/**
|
|
29
|
+
* Background treatment of the footer. `default` keeps the sidebar surface
|
|
30
|
+
* color; `transparent` removes it.
|
|
31
|
+
*/
|
|
32
|
+
@property({ type: String, reflect: true, attribute: true }) background: 'default' | 'transparent' = 'default';
|
|
33
|
+
|
|
23
34
|
public static get styles(): CSSResultArray {
|
|
24
35
|
return [styles];
|
|
25
36
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { expect, fixture, html, waitUntil } from '@open-wc/testing';
|
|
2
|
+
import '../nile-app-shell/nile-app-shell';
|
|
3
|
+
import '../nile-side-bar/nile-side-bar';
|
|
4
|
+
import './nile-side-bar-header';
|
|
5
|
+
import '../nile-side-bar-footer/nile-side-bar-footer';
|
|
6
|
+
import type { NileAppShell } from '../nile-app-shell/nile-app-shell';
|
|
7
|
+
import type { NileSideBarHeader } from './nile-side-bar-header';
|
|
8
|
+
import type { NileSideBarFooter } from '../nile-side-bar-footer/nile-side-bar-footer';
|
|
9
|
+
|
|
10
|
+
const TRANSPARENT = 'rgba(0, 0, 0, 0)';
|
|
11
|
+
const SURFACE = 'rgb(1, 2, 3)';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* nile-app-shell owns the nav track's surface, so it forces the slotted
|
|
15
|
+
* sidebar's own background off:
|
|
16
|
+
*
|
|
17
|
+
* ::slotted([slot='side-nav']) {
|
|
18
|
+
* background: var(--nile-app-shell-side-nav-bg, transparent) !important;
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* That reaches the `nile-side-bar` only. The header and footer live one level
|
|
22
|
+
* deeper — they are light-DOM children of the sidebar, slotted into ITS shadow
|
|
23
|
+
* root — so the shell cannot see them, and their own surface color survives.
|
|
24
|
+
* These tests pin that boundary down, because it is the whole reason
|
|
25
|
+
* `background="transparent"` exists.
|
|
26
|
+
*/
|
|
27
|
+
async function shellWithSidebar(headerBg?: string, footerBg?: string) {
|
|
28
|
+
const el = await fixture<NileAppShell>(html`
|
|
29
|
+
<nile-app-shell style="width: 1400px; height: 600px; --nile-colors-neutral-100: ${SURFACE};">
|
|
30
|
+
<nile-side-bar slot="side-nav">
|
|
31
|
+
<nile-side-bar-header slot="header" background="${headerBg ?? 'default'}">
|
|
32
|
+
<span slot="logo">Logo</span>
|
|
33
|
+
</nile-side-bar-header>
|
|
34
|
+
<nile-side-bar-footer slot="footer" background="${footerBg ?? 'default'}">
|
|
35
|
+
<span>Help</span>
|
|
36
|
+
</nile-side-bar-footer>
|
|
37
|
+
</nile-side-bar>
|
|
38
|
+
<span slot="top-bar">Title</span>
|
|
39
|
+
<p>page</p>
|
|
40
|
+
</nile-app-shell>
|
|
41
|
+
`);
|
|
42
|
+
await waitUntil(() => el.hasAttribute('has-side-nav'));
|
|
43
|
+
|
|
44
|
+
const sidebar = el.querySelector('nile-side-bar') as HTMLElement;
|
|
45
|
+
const header = el.querySelector('nile-side-bar-header') as NileSideBarHeader;
|
|
46
|
+
const footer = el.querySelector('nile-side-bar-footer') as NileSideBarFooter;
|
|
47
|
+
await header.updateComplete;
|
|
48
|
+
await footer.updateComplete;
|
|
49
|
+
return { el, sidebar, header, footer };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const bg = (el: HTMLElement) => getComputedStyle(el).backgroundColor;
|
|
53
|
+
|
|
54
|
+
describe('side-bar header/footer inside nile-app-shell', () => {
|
|
55
|
+
it('1. the shell strips the sidebar\'s own background', async () => {
|
|
56
|
+
const { sidebar } = await shellWithSidebar();
|
|
57
|
+
expect(bg(sidebar)).to.equal(TRANSPARENT);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('2. without the new property the header/footer keep painting a surface, which is the seam', async () => {
|
|
61
|
+
const { header, footer } = await shellWithSidebar();
|
|
62
|
+
expect(bg(header)).to.equal(SURFACE);
|
|
63
|
+
expect(bg(footer)).to.equal(SURFACE);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('3. background="transparent" closes the seam — nav track is one flat surface', async () => {
|
|
67
|
+
const { sidebar, header, footer } = await shellWithSidebar('transparent', 'transparent');
|
|
68
|
+
expect(bg(sidebar)).to.equal(TRANSPARENT);
|
|
69
|
+
expect(bg(header)).to.equal(TRANSPARENT);
|
|
70
|
+
expect(bg(footer)).to.equal(TRANSPARENT);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('4. the shell\'s !important rule does not override the header/footer either way', async () => {
|
|
74
|
+
const { header, footer } = await shellWithSidebar('default', 'transparent');
|
|
75
|
+
expect(bg(header)).to.equal(SURFACE);
|
|
76
|
+
expect(bg(footer)).to.equal(TRANSPARENT);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -23,6 +23,11 @@ export const styles = css`
|
|
|
23
23
|
background: var(--nile-colors-neutral-100, var(--ng-colors-bg-primary));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/* Opt-in: drop the surface color so the header sits on whatever is behind it. */
|
|
27
|
+
:host([background='transparent']) {
|
|
28
|
+
background: transparent;
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
.header-content {
|
|
27
32
|
display: flex;
|
|
28
33
|
align-items: center;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
|
2
|
+
import './nile-side-bar-header';
|
|
3
|
+
import type { NileSideBarHeader } from './nile-side-bar-header';
|
|
4
|
+
|
|
5
|
+
const TRANSPARENT = 'rgba(0, 0, 0, 0)';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The surface color comes from a design token, which a bare fixture does not
|
|
9
|
+
* load — so pin it on a wrapper to have something concrete to assert against.
|
|
10
|
+
*/
|
|
11
|
+
async function withToken(markup: unknown) {
|
|
12
|
+
const wrapper = await fixture<HTMLDivElement>(
|
|
13
|
+
html`<div style="--nile-colors-neutral-100: rgb(1, 2, 3)">${markup}</div>`
|
|
14
|
+
);
|
|
15
|
+
const el = wrapper.querySelector('nile-side-bar-header') as NileSideBarHeader;
|
|
16
|
+
await el.updateComplete;
|
|
17
|
+
return el;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const backgroundOf = (el: NileSideBarHeader) => getComputedStyle(el).backgroundColor;
|
|
21
|
+
|
|
22
|
+
describe('NileSideBarHeader — background', () => {
|
|
23
|
+
it('1. defaults to "default" and reflects the attribute', async () => {
|
|
24
|
+
const el = await withToken(html`<nile-side-bar-header></nile-side-bar-header>`);
|
|
25
|
+
expect(el.background).to.equal('default');
|
|
26
|
+
expect(el.getAttribute('background')).to.equal('default');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('2. paints the sidebar surface color by default', async () => {
|
|
30
|
+
const el = await withToken(html`<nile-side-bar-header></nile-side-bar-header>`);
|
|
31
|
+
expect(backgroundOf(el)).to.equal('rgb(1, 2, 3)');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('3. background="transparent" removes the background', async () => {
|
|
35
|
+
const el = await withToken(
|
|
36
|
+
html`<nile-side-bar-header background="transparent"></nile-side-bar-header>`
|
|
37
|
+
);
|
|
38
|
+
expect(el.background).to.equal('transparent');
|
|
39
|
+
expect(backgroundOf(el)).to.equal(TRANSPARENT);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('4. setting the property at runtime reflects and re-styles both ways', async () => {
|
|
43
|
+
const el = await withToken(html`<nile-side-bar-header></nile-side-bar-header>`);
|
|
44
|
+
|
|
45
|
+
el.background = 'transparent';
|
|
46
|
+
await el.updateComplete;
|
|
47
|
+
expect(el.getAttribute('background')).to.equal('transparent');
|
|
48
|
+
expect(backgroundOf(el)).to.equal(TRANSPARENT);
|
|
49
|
+
|
|
50
|
+
el.background = 'default';
|
|
51
|
+
await el.updateComplete;
|
|
52
|
+
expect(el.getAttribute('background')).to.equal('default');
|
|
53
|
+
expect(backgroundOf(el)).to.equal('rgb(1, 2, 3)');
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -16,10 +16,20 @@ import NileElement from '../internal/nile-element';
|
|
|
16
16
|
*
|
|
17
17
|
* @tag nile-side-bar-header
|
|
18
18
|
*
|
|
19
|
+
* @attr background - Background treatment of the header ("default" | "transparent").
|
|
20
|
+
* Defaults to "default", which paints the sidebar surface color. Set to
|
|
21
|
+
* "transparent" to drop the background so whatever sits behind the header shows
|
|
22
|
+
* through.
|
|
19
23
|
*/
|
|
20
24
|
@customElement('nile-side-bar-header')
|
|
21
25
|
export class NileSideBarHeader extends NileElement {
|
|
22
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Background treatment of the header. `default` keeps the sidebar surface
|
|
29
|
+
* color; `transparent` removes it.
|
|
30
|
+
*/
|
|
31
|
+
@property({ type: String, reflect: true, attribute: true }) background: 'default' | 'transparent' = 'default';
|
|
32
|
+
|
|
23
33
|
/**
|
|
24
34
|
* The styles for nile-side-bar-header
|
|
25
35
|
* @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
|
|
@@ -6850,8 +6850,21 @@
|
|
|
6850
6850
|
},
|
|
6851
6851
|
{
|
|
6852
6852
|
"name": "nile-side-bar-footer",
|
|
6853
|
-
"description": "Nile side-bar-footer component.\n\nSlots:\n\n * `icon` {} - Slot for footer icon\n\n * `text` {} - Slot for footer text\n\nProperties:\n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
|
6854
|
-
"attributes": [
|
|
6853
|
+
"description": "Nile side-bar-footer component.\n\nSlots:\n\n * `icon` {} - Slot for footer icon\n\n * `text` {} - Slot for footer text\n\nAttributes:\n\n * `background` {`\"default\" | \"transparent\"`} - Background treatment of the footer. `default` keeps the sidebar surface\ncolor; `transparent` removes it.\n\nProperties:\n\n * `background` {`\"default\" | \"transparent\"`} - Background treatment of the footer. `default` keeps the sidebar surface\ncolor; `transparent` removes it.\n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
|
6854
|
+
"attributes": [
|
|
6855
|
+
{
|
|
6856
|
+
"name": "background",
|
|
6857
|
+
"description": "`background` {`\"default\" | \"transparent\"`} - Background treatment of the footer. `default` keeps the sidebar surface\ncolor; `transparent` removes it.\n\nProperty: background\n\nDefault: default",
|
|
6858
|
+
"values": [
|
|
6859
|
+
{
|
|
6860
|
+
"name": "default"
|
|
6861
|
+
},
|
|
6862
|
+
{
|
|
6863
|
+
"name": "transparent"
|
|
6864
|
+
}
|
|
6865
|
+
]
|
|
6866
|
+
}
|
|
6867
|
+
]
|
|
6855
6868
|
},
|
|
6856
6869
|
{
|
|
6857
6870
|
"name": "nile-side-bar-group-item-icon",
|
|
@@ -6956,8 +6969,21 @@
|
|
|
6956
6969
|
},
|
|
6957
6970
|
{
|
|
6958
6971
|
"name": "nile-side-bar-header",
|
|
6959
|
-
"description": "Nile side-bar-header component.\n\nProperties:\n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
|
6960
|
-
"attributes": [
|
|
6972
|
+
"description": "Nile side-bar-header component.\n\nAttributes:\n\n * `background` {`\"default\" | \"transparent\"`} - Background treatment of the header. `default` keeps the sidebar surface\ncolor; `transparent` removes it.\n\nProperties:\n\n * `background` {`\"default\" | \"transparent\"`} - Background treatment of the header. `default` keeps the sidebar surface\ncolor; `transparent` removes it.\n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
|
6973
|
+
"attributes": [
|
|
6974
|
+
{
|
|
6975
|
+
"name": "background",
|
|
6976
|
+
"description": "`background` {`\"default\" | \"transparent\"`} - Background treatment of the header. `default` keeps the sidebar surface\ncolor; `transparent` removes it.\n\nProperty: background\n\nDefault: default",
|
|
6977
|
+
"values": [
|
|
6978
|
+
{
|
|
6979
|
+
"name": "default"
|
|
6980
|
+
},
|
|
6981
|
+
{
|
|
6982
|
+
"name": "transparent"
|
|
6983
|
+
}
|
|
6984
|
+
]
|
|
6985
|
+
}
|
|
6986
|
+
]
|
|
6961
6987
|
},
|
|
6962
6988
|
{
|
|
6963
6989
|
"name": "nile-side-bar-logo",
|