@aquera/nile-elements 2.0.5 → 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 +7 -0
- package/demo/nxtgen-classes.css +15 -12
- package/demo/nxtgen-dark.css +24 -24
- package/demo/nxtgen-properties.css +27 -24
- package/demo/nxtgen-utilities.css +39 -36
- package/demo/nxtgen.css +15 -12
- package/demo/utilities.css +3 -0
- package/demo/variables.css +3 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1363 -340
- package/dist/internal/glyph.cjs.js +1 -1
- package/dist/internal/glyph.cjs.js.map +1 -1
- package/dist/internal/glyph.esm.js +6 -5
- package/dist/nile-app-shell/index.cjs.js +2 -0
- package/dist/nile-app-shell/index.cjs.js.map +1 -0
- package/dist/nile-app-shell/index.esm.js +1 -0
- package/dist/nile-app-shell/nile-app-shell.cjs.js +2 -0
- package/dist/nile-app-shell/nile-app-shell.cjs.js.map +1 -0
- package/dist/nile-app-shell/nile-app-shell.css.cjs.js +2 -0
- package/dist/nile-app-shell/nile-app-shell.css.cjs.js.map +1 -0
- package/dist/nile-app-shell/nile-app-shell.css.esm.js +554 -0
- package/dist/nile-app-shell/nile-app-shell.esm.js +155 -0
- package/dist/nile-app-shell/shell-controller.cjs.js +2 -0
- package/dist/nile-app-shell/shell-controller.cjs.js.map +1 -0
- package/dist/nile-app-shell/shell-controller.esm.js +1 -0
- package/dist/nile-app-shell-main/index.cjs.js +2 -0
- package/dist/nile-app-shell-main/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-main/index.esm.js +1 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.cjs.js +2 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.cjs.js.map +1 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.css.cjs.js +2 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.css.esm.js +18 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.esm.js +1 -0
- package/dist/nile-app-shell-nav-toggle/index.cjs.js +2 -0
- package/dist/nile-app-shell-nav-toggle/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-nav-toggle/index.esm.js +1 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.cjs.js +2 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.cjs.js.map +1 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.cjs.js +2 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.esm.js +29 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.esm.js +16 -0
- package/dist/nile-app-shell-panel/index.cjs.js +2 -0
- package/dist/nile-app-shell-panel/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-panel/index.esm.js +1 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.cjs.js +2 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.cjs.js.map +1 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js +2 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.esm.js +103 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.esm.js +33 -0
- package/dist/nile-app-shell-side-nav/index.cjs.js +2 -0
- package/dist/nile-app-shell-side-nav/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-side-nav/index.esm.js +1 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.cjs.js +2 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.cjs.js.map +1 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.css.cjs.js +2 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.css.esm.js +55 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.esm.js +5 -0
- package/dist/nile-floating-panel/nile-floating-panel.cjs.js +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.cjs.js.map +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.css.cjs.js +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.css.cjs.js.map +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.css.esm.js +46 -8
- package/dist/nile-floating-panel/nile-floating-panel.esm.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js.map +1 -1
- package/dist/nile-popover/nile-popover.css.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.css.cjs.js.map +1 -1
- package/dist/nile-popover/nile-popover.css.esm.js +32 -17
- package/dist/nile-popover/nile-popover.esm.js +1 -1
- 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/nile-wysiwyg-editor/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.esm.js +2 -2
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-menu.esm.js +4 -4
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +1 -1
- package/dist/src/index.d.ts +7 -2
- package/dist/src/index.js +6 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal/glyph.d.ts +6 -1
- package/dist/src/internal/glyph.js +8 -1
- package/dist/src/internal/glyph.js.map +1 -1
- package/dist/src/nile-app-shell/index.d.ts +7 -0
- package/dist/src/nile-app-shell/index.js +8 -0
- package/dist/src/nile-app-shell/index.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.d.ts +4 -0
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.js +177 -0
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell.css.d.ts +18 -0
- package/dist/src/nile-app-shell/nile-app-shell.css.js +572 -0
- package/dist/src/nile-app-shell/nile-app-shell.css.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell.d.ts +292 -0
- package/dist/src/nile-app-shell/nile-app-shell.js +796 -0
- package/dist/src/nile-app-shell/nile-app-shell.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell.test.d.ts +3 -0
- package/dist/src/nile-app-shell/nile-app-shell.test.js +454 -0
- package/dist/src/nile-app-shell/nile-app-shell.test.js.map +1 -0
- package/dist/src/nile-app-shell/shell-controller.d.ts +34 -0
- package/dist/src/nile-app-shell/shell-controller.js +80 -0
- package/dist/src/nile-app-shell/shell-controller.js.map +1 -0
- package/dist/src/nile-app-shell-main/index.d.ts +7 -0
- package/dist/src/nile-app-shell-main/index.js +8 -0
- package/dist/src/nile-app-shell-main/index.js.map +1 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.css.d.ts +9 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.css.js +27 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.css.js.map +1 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.d.ts +38 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.js +51 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.js.map +1 -0
- package/dist/src/nile-app-shell-nav-toggle/index.d.ts +7 -0
- package/dist/src/nile-app-shell-nav-toggle/index.js +8 -0
- package/dist/src/nile-app-shell-nav-toggle/index.js.map +1 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.d.ts +13 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.js +42 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.js.map +1 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.d.ts +56 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.js +126 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.js.map +1 -0
- package/dist/src/nile-app-shell-panel/index.d.ts +7 -0
- package/dist/src/nile-app-shell-panel/index.js +8 -0
- package/dist/src/nile-app-shell-panel/index.js.map +1 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.d.ts +9 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js +112 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js.map +1 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.d.ts +73 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.js +158 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.js.map +1 -0
- package/dist/src/nile-app-shell-side-nav/index.d.ts +7 -0
- package/dist/src/nile-app-shell-side-nav/index.js +8 -0
- package/dist/src/nile-app-shell-side-nav/index.js.map +1 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.d.ts +13 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.js +68 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.js.map +1 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.d.ts +54 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.js +83 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.js.map +1 -0
- package/dist/src/nile-floating-panel/nile-floating-panel.css.js +46 -8
- package/dist/src/nile-floating-panel/nile-floating-panel.css.js.map +1 -1
- package/dist/src/nile-floating-panel/nile-floating-panel.js +13 -1
- package/dist/src/nile-floating-panel/nile-floating-panel.js.map +1 -1
- package/dist/src/nile-popover/nile-popover.css.js +30 -15
- package/dist/src/nile-popover/nile-popover.css.js.map +1 -1
- package/dist/src/nile-popover/nile-popover.js +1 -1
- package/dist/src/nile-popover/nile-popover.js.map +1 -1
- package/dist/src/nile-popover/nile-popover.test.js +1 -1
- package/dist/src/nile-popover/nile-popover.test.js.map +1 -1
- 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.d.ts +11 -1
- package/dist/src/version.js +51 -8
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/version.cjs.js +1 -1
- package/dist/version.cjs.js.map +1 -1
- package/dist/version.esm.js +1 -1
- package/package.json +7 -2
- package/src/index.ts +16 -4
- package/src/internal/glyph.ts +12 -1
- package/src/nile-app-shell/index.ts +8 -0
- package/src/nile-app-shell/nile-app-shell-regions.test.ts +215 -0
- package/src/nile-app-shell/nile-app-shell.css.ts +574 -0
- package/src/nile-app-shell/nile-app-shell.test.ts +536 -0
- package/src/nile-app-shell/nile-app-shell.ts +838 -0
- package/src/nile-app-shell/shell-controller.ts +100 -0
- package/src/nile-app-shell-main/index.ts +8 -0
- package/src/nile-app-shell-main/nile-app-shell-main.css.ts +29 -0
- package/src/nile-app-shell-main/nile-app-shell-main.ts +52 -0
- package/src/nile-app-shell-nav-toggle/index.ts +8 -0
- package/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.ts +44 -0
- package/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.ts +138 -0
- package/src/nile-app-shell-panel/index.ts +8 -0
- package/src/nile-app-shell-panel/nile-app-shell-panel.css.ts +114 -0
- package/src/nile-app-shell-panel/nile-app-shell-panel.ts +161 -0
- package/src/nile-app-shell-side-nav/index.ts +8 -0
- package/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.ts +70 -0
- package/src/nile-app-shell-side-nav/nile-app-shell-side-nav.ts +86 -0
- package/src/nile-floating-panel/nile-floating-panel.css.ts +46 -8
- package/src/nile-floating-panel/nile-floating-panel.ts +19 -1
- package/src/nile-popover/nile-popover.css.ts +30 -15
- package/src/nile-popover/nile-popover.test.ts +1 -1
- package/src/nile-popover/nile-popover.ts +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/src/version.ts +55 -7
- package/vscode-html-custom-data.json +246 -9
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Aquera Inc 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { css } from 'lit';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* AppShellSideNav CSS. The shell owns the track width; this owns what happens
|
|
12
|
+
* inside it — a pinned header, a scrolling body, a pinned footer.
|
|
13
|
+
*/
|
|
14
|
+
export const styles = css`
|
|
15
|
+
:host {
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
/* The nav and the page share one surface. */
|
|
23
|
+
background: var(--nile-app-shell-side-nav-bg, transparent);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host([hidden]) {
|
|
27
|
+
display: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.header,
|
|
31
|
+
.footer {
|
|
32
|
+
flex: 0 0 auto;
|
|
33
|
+
display: block;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.body {
|
|
37
|
+
flex: 1 1 auto;
|
|
38
|
+
min-height: 0;
|
|
39
|
+
overflow-y: auto;
|
|
40
|
+
overflow-x: hidden;
|
|
41
|
+
padding: var(
|
|
42
|
+
--nile-app-shell-side-nav-padding,
|
|
43
|
+
var(--nile-spacing-lg, var(--ng-spacing-lg))
|
|
44
|
+
);
|
|
45
|
+
scrollbar-width: thin;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.body::-webkit-scrollbar {
|
|
49
|
+
width: 6px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.body::-webkit-scrollbar-track {
|
|
53
|
+
background: transparent;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.body::-webkit-scrollbar-thumb {
|
|
57
|
+
background-color: var(
|
|
58
|
+
--nile-colors-neutral-500,
|
|
59
|
+
var(--ng-colors-border-primary)
|
|
60
|
+
);
|
|
61
|
+
border-radius: 10px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* A rail has no room for a horizontal scrollbar or for wide children. */
|
|
65
|
+
:host([collapsed]) .body {
|
|
66
|
+
overflow-x: hidden;
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
export default [styles];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Aquera Inc 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { html, CSSResultArray, TemplateResult } from 'lit';
|
|
9
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
10
|
+
import { styles } from './nile-app-shell-side-nav.css';
|
|
11
|
+
import { AppShellController } from '../nile-app-shell/shell-controller';
|
|
12
|
+
import NileElement from '../internal/nile-element';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @summary The shell's left region — the navigation track. Assigns itself to the
|
|
16
|
+
* shell's `side-nav` slot and mirrors the shell's rail state, so nav content can
|
|
17
|
+
* style against it.
|
|
18
|
+
*
|
|
19
|
+
* @status stable
|
|
20
|
+
* @since 2.0
|
|
21
|
+
*
|
|
22
|
+
* @tag nile-app-shell-side-nav
|
|
23
|
+
*
|
|
24
|
+
* @dependency nile-app-shell
|
|
25
|
+
*
|
|
26
|
+
* @slot - The nav body. Scrolls.
|
|
27
|
+
* @slot header - Pinned above the scroll region — a wordmark or product switcher.
|
|
28
|
+
* @slot footer - Pinned below it — an account row or help link.
|
|
29
|
+
*
|
|
30
|
+
* @csspart header - The pinned header.
|
|
31
|
+
* @csspart body - The scrolling nav body.
|
|
32
|
+
* @csspart footer - The pinned footer.
|
|
33
|
+
*
|
|
34
|
+
* @cssproperty [--nile-app-shell-side-nav-padding=12px] - Body inset. 12 + 40 +
|
|
35
|
+
* 12 is what makes a 64px rail.
|
|
36
|
+
* @cssproperty [--nile-app-shell-side-nav-bg=transparent] - Surface behind the
|
|
37
|
+
* nav. Transparent by default: the nav and the page share one.
|
|
38
|
+
*/
|
|
39
|
+
@customElement('nile-app-shell-side-nav')
|
|
40
|
+
export class NileAppShellSideNav extends NileElement {
|
|
41
|
+
public static get styles(): CSSResultArray {
|
|
42
|
+
return [styles];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private shellLink = new AppShellController(this);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Mirrors the shell's effective rail state — the user's preference, or a rail
|
|
49
|
+
* forced by the shell's width. Set by the shell; treat it as read-only and
|
|
50
|
+
* style against it (`nile-app-shell-side-nav[collapsed] .label`).
|
|
51
|
+
*/
|
|
52
|
+
@property({ type: Boolean, reflect: true })
|
|
53
|
+
collapsed: boolean = false;
|
|
54
|
+
|
|
55
|
+
/** Id of the shell to follow. Defaults to the nearest ancestor. */
|
|
56
|
+
@property({ type: String })
|
|
57
|
+
shell?: string;
|
|
58
|
+
|
|
59
|
+
public connectedCallback(): void {
|
|
60
|
+
super.connectedCallback();
|
|
61
|
+
// Claim the shell's left region unless the author placed it elsewhere.
|
|
62
|
+
if (!this.hasAttribute('slot')) this.setAttribute('slot', 'side-nav');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
protected willUpdate(): void {
|
|
66
|
+
this.shellLink.shellId = this.shell;
|
|
67
|
+
const shell = this.shellLink.shell;
|
|
68
|
+
if (shell) this.collapsed = shell.rail;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public render(): TemplateResult {
|
|
72
|
+
return html`
|
|
73
|
+
<slot name="header" part="header" class="header"></slot>
|
|
74
|
+
<div class="body" part="body"><slot></slot></div>
|
|
75
|
+
<slot name="footer" part="footer" class="footer"></slot>
|
|
76
|
+
`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default NileAppShellSideNav;
|
|
81
|
+
|
|
82
|
+
declare global {
|
|
83
|
+
interface HTMLElementTagNameMap {
|
|
84
|
+
'nile-app-shell-side-nav': NileAppShellSideNav;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -81,26 +81,24 @@ export const styles = css`
|
|
|
81
81
|
display: none;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/* Offset arrow by 0.5px so its outline aligns with the panel border and its fill fully covers it. */
|
|
84
85
|
.tippy-box[data-theme~='floating-panel'][data-placement^='top'] > .tippy-svg-arrow { bottom: 0; }
|
|
85
|
-
.tippy-box[data-theme~='floating-panel'][data-placement^='top'] > .tippy-svg-arrow:after,
|
|
86
86
|
.tippy-box[data-theme~='floating-panel'][data-placement^='top'] > .tippy-svg-arrow > svg {
|
|
87
|
-
top:
|
|
87
|
+
top: 15.5px;
|
|
88
88
|
transform: rotate(180deg);
|
|
89
89
|
}
|
|
90
90
|
.tippy-box[data-theme~='floating-panel'][data-placement^='bottom'] > .tippy-svg-arrow { top: 0; }
|
|
91
|
-
.tippy-box[data-theme~='floating-panel'][data-placement^='bottom'] > .tippy-svg-arrow > svg { bottom:
|
|
91
|
+
.tippy-box[data-theme~='floating-panel'][data-placement^='bottom'] > .tippy-svg-arrow > svg { bottom: 15.5px; }
|
|
92
92
|
.tippy-box[data-theme~='floating-panel'][data-placement^='left'] > .tippy-svg-arrow { right: 0; }
|
|
93
|
-
.tippy-box[data-theme~='floating-panel'][data-placement^='left'] > .tippy-svg-arrow:after,
|
|
94
93
|
.tippy-box[data-theme~='floating-panel'][data-placement^='left'] > .tippy-svg-arrow > svg {
|
|
95
94
|
transform: rotate(90deg);
|
|
96
|
-
top: calc(50% -
|
|
95
|
+
top: calc(50% - 3.5px);
|
|
97
96
|
left: 11px;
|
|
98
97
|
}
|
|
99
98
|
.tippy-box[data-theme~='floating-panel'][data-placement^='right'] > .tippy-svg-arrow { left: 0; }
|
|
100
|
-
.tippy-box[data-theme~='floating-panel'][data-placement^='right'] > .tippy-svg-arrow:after,
|
|
101
99
|
.tippy-box[data-theme~='floating-panel'][data-placement^='right'] > .tippy-svg-arrow > svg {
|
|
102
100
|
transform: rotate(-90deg);
|
|
103
|
-
top: calc(50% -
|
|
101
|
+
top: calc(50% - 3.5px);
|
|
104
102
|
right: 11px;
|
|
105
103
|
}
|
|
106
104
|
|
|
@@ -113,6 +111,14 @@ export const styles = css`
|
|
|
113
111
|
|
|
114
112
|
.tippy-box[data-theme~='floating-panel'] > .tippy-svg-arrow > svg {
|
|
115
113
|
position: absolute;
|
|
114
|
+
overflow: visible;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.tippy-box[data-theme~='floating-panel'] > .tippy-svg-arrow > svg > .nile-floating-panel__arrow-outline {
|
|
118
|
+
fill: none;
|
|
119
|
+
stroke: var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));
|
|
120
|
+
stroke-width: 1;
|
|
121
|
+
vector-effect: non-scaling-stroke;
|
|
116
122
|
}
|
|
117
123
|
|
|
118
124
|
.tippy-box[data-theme~='floating-panel'][data-placement^='top'] > .tippy-arrow {
|
|
@@ -123,6 +129,13 @@ export const styles = css`
|
|
|
123
129
|
border-width: 8px 8px 0;
|
|
124
130
|
border-top-color: initial;
|
|
125
131
|
}
|
|
132
|
+
.tippy-box[data-theme~='floating-panel'][data-placement^='top'] > .tippy-arrow:after {
|
|
133
|
+
bottom: -8px;
|
|
134
|
+
left: -1px;
|
|
135
|
+
border-width: 9px 9px 0;
|
|
136
|
+
border-top-color: var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));
|
|
137
|
+
clip-path: inset(2px 0 0 0);
|
|
138
|
+
}
|
|
126
139
|
.tippy-box[data-theme~='floating-panel'][data-placement^='bottom'] > .tippy-arrow {
|
|
127
140
|
top: 0;
|
|
128
141
|
}
|
|
@@ -131,6 +144,13 @@ export const styles = css`
|
|
|
131
144
|
border-width: 0 8px 8px;
|
|
132
145
|
border-bottom-color: initial;
|
|
133
146
|
}
|
|
147
|
+
.tippy-box[data-theme~='floating-panel'][data-placement^='bottom'] > .tippy-arrow:after {
|
|
148
|
+
top: -8px;
|
|
149
|
+
left: -1px;
|
|
150
|
+
border-width: 0 9px 9px;
|
|
151
|
+
border-bottom-color: var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));
|
|
152
|
+
clip-path: inset(0 0 2px 0);
|
|
153
|
+
}
|
|
134
154
|
.tippy-box[data-theme~='floating-panel'][data-placement^='left'] > .tippy-arrow {
|
|
135
155
|
right: 0;
|
|
136
156
|
}
|
|
@@ -139,6 +159,13 @@ export const styles = css`
|
|
|
139
159
|
border-width: 8px 0 8px 8px;
|
|
140
160
|
border-left-color: initial;
|
|
141
161
|
}
|
|
162
|
+
.tippy-box[data-theme~='floating-panel'][data-placement^='left'] > .tippy-arrow:after {
|
|
163
|
+
right: -8px;
|
|
164
|
+
top: -1px;
|
|
165
|
+
border-width: 9px 0 9px 9px;
|
|
166
|
+
border-left-color: var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));
|
|
167
|
+
clip-path: inset(0 0 0 2px);
|
|
168
|
+
}
|
|
142
169
|
.tippy-box[data-theme~='floating-panel'][data-placement^='right'] > .tippy-arrow {
|
|
143
170
|
left: 0;
|
|
144
171
|
}
|
|
@@ -147,18 +174,29 @@ export const styles = css`
|
|
|
147
174
|
border-width: 8px 8px 8px 0;
|
|
148
175
|
border-right-color: initial;
|
|
149
176
|
}
|
|
177
|
+
.tippy-box[data-theme~='floating-panel'][data-placement^='right'] > .tippy-arrow:after {
|
|
178
|
+
left: -8px;
|
|
179
|
+
top: -1px;
|
|
180
|
+
border-width: 9px 9px 9px 0;
|
|
181
|
+
border-right-color: var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));
|
|
182
|
+
clip-path: inset(0 2px 0 0);
|
|
183
|
+
}
|
|
150
184
|
|
|
151
185
|
.tippy-box[data-theme~='floating-panel'] > .tippy-arrow {
|
|
152
186
|
width: 16px;
|
|
153
187
|
height: 16px;
|
|
154
188
|
color: var(--nile-colors-white-base, var(--ng-colors-bg-primary));
|
|
155
189
|
}
|
|
156
|
-
|
|
190
|
+
/* :after is a 1px-larger triangle in the border colour, stacked behind :before, so the border continues around the arrow. */
|
|
191
|
+
.tippy-box[data-theme~='floating-panel'] > .tippy-arrow:before,
|
|
192
|
+
.tippy-box[data-theme~='floating-panel'] > .tippy-arrow:after {
|
|
157
193
|
content: '';
|
|
158
194
|
position: absolute;
|
|
159
195
|
border-color: transparent;
|
|
160
196
|
border-style: solid;
|
|
161
197
|
}
|
|
198
|
+
.tippy-box[data-theme~='floating-panel'] > .tippy-arrow:before { z-index: 1; }
|
|
199
|
+
.tippy-box[data-theme~='floating-panel'] > .tippy-arrow:after { z-index: 0; }
|
|
162
200
|
`;
|
|
163
201
|
|
|
164
202
|
export function injectGlobalFloatingPanelStyles(): void {
|
|
@@ -21,6 +21,24 @@ import {
|
|
|
21
21
|
} from '../nile-lite-tooltip/utils';
|
|
22
22
|
import { VisibilityManager } from '../utilities/visibility-manager.js';
|
|
23
23
|
|
|
24
|
+
const TIPPY_ROUND_ARROW =
|
|
25
|
+
/^<svg width="(\d+)" height="(\d+)"[^>]*><path d="(.+?)H0z"/.exec(roundArrow);
|
|
26
|
+
|
|
27
|
+
const NILE_ROUND_ARROW = ((): string => {
|
|
28
|
+
if (!TIPPY_ROUND_ARROW) return roundArrow;
|
|
29
|
+
|
|
30
|
+
const [, rawWidth, rawHeight, curve] = TIPPY_ROUND_ARROW;
|
|
31
|
+
const width = Number(rawWidth);
|
|
32
|
+
const height = Number(rawHeight) + 1; // + the skirt that covers the border
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
`<svg width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg">` +
|
|
36
|
+
`<path d="${curve}V${height}H0Z"></path>` +
|
|
37
|
+
`<path class="nile-floating-panel__arrow-outline" d="${curve}"></path>` +
|
|
38
|
+
`</svg>`
|
|
39
|
+
);
|
|
40
|
+
})();
|
|
41
|
+
|
|
24
42
|
/**
|
|
25
43
|
* Nile floating-panel component.
|
|
26
44
|
*
|
|
@@ -482,7 +500,7 @@ export class NileFloatingPanel extends NileElement {
|
|
|
482
500
|
|
|
483
501
|
private _resolveArrow() {
|
|
484
502
|
switch (this.arrow) {
|
|
485
|
-
case 'round': return
|
|
503
|
+
case 'round': return NILE_ROUND_ARROW;
|
|
486
504
|
case 'none': return false as const;
|
|
487
505
|
default: return true as const;
|
|
488
506
|
}
|
|
@@ -40,10 +40,6 @@ export const styles = css`
|
|
|
40
40
|
background-color: var(--nile-colors-white-base, var(--ng-colors-bg-primary));
|
|
41
41
|
border: solid 1px var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));
|
|
42
42
|
box-shadow: var(--nile-box-shadow-2, var(--ng-shadow-lg));
|
|
43
|
-
--arrow-size: 18px;
|
|
44
|
-
--arrow-size-diagonal: calc(var(--arrow-size) * 0.7071);
|
|
45
|
-
--arrow-padding-offset: calc(var(--arrow-size-diagonal) - var(--arrow-size));
|
|
46
|
-
--arrow-color: var(--nile-colors-white-base, var(--ng-colors-text-white));
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
.popover__action {
|
|
@@ -52,19 +48,38 @@ export const styles = css`
|
|
|
52
48
|
}
|
|
53
49
|
|
|
54
50
|
nile-popup {
|
|
55
|
-
--arrow-size:
|
|
56
|
-
--arrow-color: var(--nile-colors-white-base, var(--ng-colors-
|
|
51
|
+
--arrow-size: 10px;
|
|
52
|
+
--arrow-color: var(--nile-colors-white-base, var(--ng-colors-bg-primary));
|
|
53
|
+
--arrow-border-color: var(
|
|
54
|
+
--nile-colors-dark-200,
|
|
55
|
+
var(--ng-colors-border-secondary-alt)
|
|
56
|
+
);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
border: solid 1px var(--
|
|
67
|
-
|
|
59
|
+
nile-popup::part(arrow) {
|
|
60
|
+
z-index: 1;
|
|
61
|
+
border: none;
|
|
62
|
+
box-shadow: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
nile-popup[data-current-placement^='bottom']::part(arrow) {
|
|
66
|
+
border-top: solid 1px var(--arrow-border-color);
|
|
67
|
+
border-left: solid 1px var(--arrow-border-color);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
nile-popup[data-current-placement^='top']::part(arrow) {
|
|
71
|
+
border-bottom: solid 1px var(--arrow-border-color);
|
|
72
|
+
border-right: solid 1px var(--arrow-border-color);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
nile-popup[data-current-placement^='left']::part(arrow) {
|
|
76
|
+
border-top: solid 1px var(--arrow-border-color);
|
|
77
|
+
border-right: solid 1px var(--arrow-border-color);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
nile-popup[data-current-placement^='right']::part(arrow) {
|
|
81
|
+
border-bottom: solid 1px var(--arrow-border-color);
|
|
82
|
+
border-left: solid 1px var(--arrow-border-color);
|
|
68
83
|
}
|
|
69
84
|
`;
|
|
70
85
|
|
|
@@ -7,7 +7,7 @@ describe('NilePopover', () => {
|
|
|
7
7
|
it('2. shadow root', async () => { const el = await fixture<NilePopover>(html`<nile-popover></nile-popover>`); expect(el.shadowRoot).to.not.be.null; });
|
|
8
8
|
it('3. tag name', async () => { const el = await fixture<NilePopover>(html`<nile-popover></nile-popover>`); expect(el.tagName.toLowerCase()).to.equal('nile-popover'); });
|
|
9
9
|
it('4. placement defaults top', async () => { const el = await fixture<NilePopover>(html`<nile-popover></nile-popover>`); expect(el.placement).to.equal('top'); });
|
|
10
|
-
it('5. distance defaults
|
|
10
|
+
it('5. distance defaults 12', async () => { const el = await fixture<NilePopover>(html`<nile-popover></nile-popover>`); expect(el.distance).to.equal(12); });
|
|
11
11
|
it('6. preventOverlayClose defaults false', async () => { const el = await fixture<NilePopover>(html`<nile-popover></nile-popover>`); expect(el.preventOverlayClose).to.equal(false); });
|
|
12
12
|
it('7. arrow defaults true', async () => { const el = await fixture<NilePopover>(html`<nile-popover></nile-popover>`); expect(el.arrow).to.equal(true); });
|
|
13
13
|
it('8. title defaults empty', async () => { const el = await fixture<NilePopover>(html`<nile-popover></nile-popover>`); expect(el.title).to.equal(''); });
|
|
@@ -56,7 +56,7 @@ export class NilePopover extends NileElement {
|
|
|
56
56
|
| 'left-end' = 'top';
|
|
57
57
|
|
|
58
58
|
/** The distance in pixels from which to offset the popover away from its target. */
|
|
59
|
-
@property({ type: Number }) distance =
|
|
59
|
+
@property({ type: Number }) distance = 12;
|
|
60
60
|
|
|
61
61
|
@property({ type: Boolean, reflect: true }) preventOverlayClose = false;
|
|
62
62
|
|
|
@@ -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]`
|