@internetarchive/ia-item-navigator 1.0.2 → 1.0.4-a1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/src/item-navigator.d.ts +1 -1
- package/dist/src/item-navigator.js +1 -1
- package/dist/src/item-navigator.js.map +1 -1
- package/dist/src/menu-slider/ia-menu-slider.d.ts +30 -0
- package/dist/src/menu-slider/ia-menu-slider.js +160 -0
- package/dist/src/menu-slider/ia-menu-slider.js.map +1 -0
- package/dist/src/menu-slider/menu-button.d.ts +19 -0
- package/dist/src/menu-slider/menu-button.js +91 -0
- package/dist/src/menu-slider/menu-button.js.map +1 -0
- package/dist/src/menu-slider/styles/menu-button.d.ts +2 -0
- package/dist/src/menu-slider/styles/menu-button.js +79 -0
- package/dist/src/menu-slider/styles/menu-button.js.map +1 -0
- package/dist/src/menu-slider/styles/menu-slider.d.ts +2 -0
- package/dist/src/menu-slider/styles/menu-slider.js +129 -0
- package/dist/src/menu-slider/styles/menu-slider.js.map +1 -0
- package/index.ts +2 -0
- package/package.json +3 -3
- package/src/item-navigator.ts +2 -2
- package/src/menu-slider/ia-menu-slider.ts +161 -0
- package/src/menu-slider/menu-button.ts +80 -0
- package/src/menu-slider/styles/menu-button.ts +79 -0
- package/src/menu-slider/styles/menu-slider.ts +130 -0
- package/test/ia-menu-slider.test.js +273 -0
- package/dist/src/event-interfaces.d.ts +0 -37
- package/dist/src/event-interfaces.js +0 -2
- package/dist/src/event-interfaces.js.map +0 -1
- package/dist/src/grouped-files-provider.d.ts +0 -0
- package/dist/src/grouped-files-provider.js +0 -2
- package/dist/src/grouped-files-provider.js.map +0 -1
- package/dist/src/interfaces/nav-controller-interface.d.ts +0 -20
- package/dist/src/interfaces/nav-controller-interface.js +0 -2
- package/dist/src/interfaces/nav-controller-interface.js.map +0 -1
- package/dist/src/item-inspector/files-by-type/files-by-type-provider.d.ts +0 -14
- package/dist/src/item-inspector/files-by-type/files-by-type-provider.js +0 -29
- package/dist/src/item-inspector/files-by-type/files-by-type-provider.js.map +0 -1
- package/dist/src/item-inspector/files-by-type/ia-files-by-type.d.ts +0 -16
- package/dist/src/item-inspector/files-by-type/ia-files-by-type.js +0 -95
- package/dist/src/item-inspector/files-by-type/ia-files-by-type.js.map +0 -1
- package/dist/src/item-inspector/files-by-type/ia-grouped-files-by-type.d.ts +0 -0
- package/dist/src/item-inspector/files-by-type/ia-grouped-files-by-type.js +0 -2
- package/dist/src/item-inspector/files-by-type/ia-grouped-files-by-type.js.map +0 -1
- package/dist/src/item-inspector/grouped-files/files-by-type-provider.d.ts +0 -15
- package/dist/src/item-inspector/grouped-files/files-by-type-provider.js +0 -33
- package/dist/src/item-inspector/grouped-files/files-by-type-provider.js.map +0 -1
- package/dist/src/item-inspector/grouped-files/grouped-files-provider.d.ts +0 -15
- package/dist/src/item-inspector/grouped-files/grouped-files-provider.js +0 -33
- package/dist/src/item-inspector/grouped-files/grouped-files-provider.js.map +0 -1
- package/dist/src/item-inspector/grouped-files/ia-grouped-files-by-type.d.ts +0 -0
- package/dist/src/item-inspector/grouped-files/ia-grouped-files-by-type.js +0 -2
- package/dist/src/item-inspector/grouped-files/ia-grouped-files-by-type.js.map +0 -1
- package/dist/src/item-inspector/grouped-files/ia-grouped-files.d.ts +0 -0
- package/dist/src/item-inspector/grouped-files/ia-grouped-files.js +0 -2
- package/dist/src/item-inspector/grouped-files/ia-grouped-files.js.map +0 -1
- package/dist/src/item-inspector/grouped-files-provider.d.ts +0 -15
- package/dist/src/item-inspector/grouped-files-provider.js +0 -33
- package/dist/src/item-inspector/grouped-files-provider.js.map +0 -1
- package/dist/src/item-inspector/item-inspector.d.ts +0 -0
- package/dist/src/item-inspector/item-inspector.js +0 -254
- package/dist/src/item-inspector/item-inspector.js.map +0 -1
- package/dist/src/item-inspector/share-provider.d.ts +0 -15
- package/dist/src/item-inspector/share-provider.js +0 -35
- package/dist/src/item-inspector/share-provider.js.map +0 -1
- package/dist/src/item-inspector/visual-mod-provider.d.ts +0 -19
- package/dist/src/item-inspector/visual-mod-provider.js +0 -46
- package/dist/src/item-inspector/visual-mod-provider.js.map +0 -1
- package/dist/src/item-inspector.d.ts +0 -24
- package/dist/src/item-inspector.js +0 -92
- package/dist/src/item-inspector.js.map +0 -1
- package/dist/src/menu-interfaces.d.ts +0 -16
- package/dist/src/menu-interfaces.js +0 -2
- package/dist/src/menu-interfaces.js.map +0 -1
- package/dist/src/nav-controller-interface.d.ts +0 -9
- package/dist/src/nav-controller-interface.js +0 -2
- package/dist/src/nav-controller-interface.js.map +0 -1
- package/dist/src/your-webcomponent.d.ts +0 -8
- package/dist/src/your-webcomponent.js +0 -37
- package/dist/src/your-webcomponent.js.map +0 -1
- package/dist/test/book-nav-stub.d.ts +0 -22
- package/dist/test/book-nav-stub.js +0 -49
- package/dist/test/book-nav-stub.js.map +0 -1
- package/dist/test/ia-stub-goody.d.ts +0 -210
- package/dist/test/ia-stub-goody.js +0 -276
- package/dist/test/ia-stub-goody.js.map +0 -1
- package/dist/test/your-webcomponent.test.d.ts +0 -0
- package/dist/test/your-webcomponent.test.js +0 -33
- package/dist/test/your-webcomponent.test.js.map +0 -1
@@ -0,0 +1,129 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
const menuButtonWidth = css `42px`;
|
3
|
+
const sliderWidth = css `var(--menuWidth, 320px)`;
|
4
|
+
const transitionTiming = css `var(--animationTiming, 200ms)`;
|
5
|
+
export default css `
|
6
|
+
.main {
|
7
|
+
overflow: hidden;
|
8
|
+
width: 100%;
|
9
|
+
height: 100%;
|
10
|
+
}
|
11
|
+
|
12
|
+
.animate {
|
13
|
+
transition: transform ${transitionTiming} ease-out;
|
14
|
+
}
|
15
|
+
|
16
|
+
.menu {
|
17
|
+
position: absolute;
|
18
|
+
top: 0;
|
19
|
+
left: 0;
|
20
|
+
bottom: 0;
|
21
|
+
width: ${sliderWidth};
|
22
|
+
padding: 0.5rem 0.5rem 0 0;
|
23
|
+
box-sizing: border-box;
|
24
|
+
font-size: 1.4rem;
|
25
|
+
color: var(--primaryTextColor);
|
26
|
+
background: var(--menuSliderBg);
|
27
|
+
transform: translateX(calc(${sliderWidth} * -1));
|
28
|
+
}
|
29
|
+
|
30
|
+
.menu > button.close {
|
31
|
+
right: 0.7rem;
|
32
|
+
}
|
33
|
+
|
34
|
+
button {
|
35
|
+
outline: none;
|
36
|
+
cursor: pointer;
|
37
|
+
}
|
38
|
+
|
39
|
+
header {
|
40
|
+
margin: 0 0 0.5rem 0;
|
41
|
+
}
|
42
|
+
|
43
|
+
header * {
|
44
|
+
margin: 0;
|
45
|
+
display: inline-block;
|
46
|
+
}
|
47
|
+
header button {
|
48
|
+
outline: none;
|
49
|
+
cursor: pointer;
|
50
|
+
}
|
51
|
+
|
52
|
+
header.with-secondary-action .details {
|
53
|
+
width: 80%;
|
54
|
+
}
|
55
|
+
|
56
|
+
header .details {
|
57
|
+
font-weight: bold;
|
58
|
+
width: 88%;
|
59
|
+
}
|
60
|
+
|
61
|
+
header .custom-action > *,
|
62
|
+
button.close {
|
63
|
+
padding: 0;
|
64
|
+
background-color: transparent;
|
65
|
+
border: 0;
|
66
|
+
--iconWidth: var(--menuSliderHeaderIconWidth);
|
67
|
+
--iconHeight: var(--menuSliderHeaderIconHeight);
|
68
|
+
}
|
69
|
+
|
70
|
+
header .custom-action,
|
71
|
+
button.close {
|
72
|
+
position: absolute;
|
73
|
+
}
|
74
|
+
button.close {
|
75
|
+
right: 0.5rem;
|
76
|
+
}
|
77
|
+
|
78
|
+
button.close * {
|
79
|
+
float: right;
|
80
|
+
}
|
81
|
+
|
82
|
+
.content {
|
83
|
+
position: absolute;
|
84
|
+
top: 0;
|
85
|
+
right: 0;
|
86
|
+
bottom: 0;
|
87
|
+
left: ${menuButtonWidth};
|
88
|
+
z-index: 1;
|
89
|
+
transform: translateX(calc(${sliderWidth} * -1));
|
90
|
+
transition: transform ${transitionTiming} ease-out;
|
91
|
+
background: var(--activeButtonBg);
|
92
|
+
border-right: 0.2rem solid;
|
93
|
+
border-color: var(--subpanelRightBorderColor);
|
94
|
+
padding: 0.5rem 0 0 0.5rem;
|
95
|
+
}
|
96
|
+
|
97
|
+
.open {
|
98
|
+
transform: translateX(0);
|
99
|
+
}
|
100
|
+
|
101
|
+
.menu-list {
|
102
|
+
padding: 0;
|
103
|
+
margin: 0;
|
104
|
+
list-style: none;
|
105
|
+
background: var(--menuSliderBg);
|
106
|
+
}
|
107
|
+
.menu-list li {
|
108
|
+
margin-bottom: 0.2rem;
|
109
|
+
}
|
110
|
+
|
111
|
+
.content section {
|
112
|
+
height: 100%;
|
113
|
+
position: relative;
|
114
|
+
width: 100%;
|
115
|
+
}
|
116
|
+
|
117
|
+
.content .selected-menu {
|
118
|
+
overflow: auto;
|
119
|
+
height: inherit;
|
120
|
+
position: relative;
|
121
|
+
}
|
122
|
+
|
123
|
+
.content .selected-menu > * {
|
124
|
+
display: block;
|
125
|
+
padding-bottom: 3rem;
|
126
|
+
position: relative;
|
127
|
+
}
|
128
|
+
`;
|
129
|
+
//# sourceMappingURL=menu-slider.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"menu-slider.js","sourceRoot":"","sources":["../../../../src/menu-slider/styles/menu-slider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,eAAe,GAAG,GAAG,CAAA,MAAM,CAAC;AAClC,MAAM,WAAW,GAAG,GAAG,CAAA,yBAAyB,CAAC;AACjD,MAAM,gBAAgB,GAAG,GAAG,CAAA,+BAA+B,CAAC;AAE5D,eAAe,GAAG,CAAA;;;;;;;;4BAQU,gBAAgB;;;;;;;;aAQ/B,WAAW;;;;;;iCAMS,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA4DhC,eAAe;;iCAEM,WAAW;4BAChB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsC3C,CAAC","sourcesContent":["import { css } from 'lit';\n\nconst menuButtonWidth = css`42px`;\nconst sliderWidth = css`var(--menuWidth, 320px)`;\nconst transitionTiming = css`var(--animationTiming, 200ms)`;\n\nexport default css`\n .main {\n overflow: hidden;\n width: 100%;\n height: 100%;\n }\n\n .animate {\n transition: transform ${transitionTiming} ease-out;\n }\n\n .menu {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n width: ${sliderWidth};\n padding: 0.5rem 0.5rem 0 0;\n box-sizing: border-box;\n font-size: 1.4rem;\n color: var(--primaryTextColor);\n background: var(--menuSliderBg);\n transform: translateX(calc(${sliderWidth} * -1));\n }\n\n .menu > button.close {\n right: 0.7rem;\n }\n\n button {\n outline: none;\n cursor: pointer;\n }\n\n header {\n margin: 0 0 0.5rem 0;\n }\n\n header * {\n margin: 0;\n display: inline-block;\n }\n header button {\n outline: none;\n cursor: pointer;\n }\n\n header.with-secondary-action .details {\n width: 80%;\n }\n\n header .details {\n font-weight: bold;\n width: 88%;\n }\n\n header .custom-action > *,\n button.close {\n padding: 0;\n background-color: transparent;\n border: 0;\n --iconWidth: var(--menuSliderHeaderIconWidth);\n --iconHeight: var(--menuSliderHeaderIconHeight);\n }\n\n header .custom-action,\n button.close {\n position: absolute;\n }\n button.close {\n right: 0.5rem;\n }\n\n button.close * {\n float: right;\n }\n\n .content {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: ${menuButtonWidth};\n z-index: 1;\n transform: translateX(calc(${sliderWidth} * -1));\n transition: transform ${transitionTiming} ease-out;\n background: var(--activeButtonBg);\n border-right: 0.2rem solid;\n border-color: var(--subpanelRightBorderColor);\n padding: 0.5rem 0 0 0.5rem;\n }\n\n .open {\n transform: translateX(0);\n }\n\n .menu-list {\n padding: 0;\n margin: 0;\n list-style: none;\n background: var(--menuSliderBg);\n }\n .menu-list li {\n margin-bottom: 0.2rem;\n }\n\n .content section {\n height: 100%;\n position: relative;\n width: 100%;\n }\n\n .content .selected-menu {\n overflow: auto;\n height: inherit;\n position: relative;\n }\n\n .content .selected-menu > * {\n display: block;\n padding-bottom: 3rem;\n position: relative;\n }\n`;\n"]}
|
package/index.ts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@internetarchive/ia-item-navigator",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.4-a1",
|
4
4
|
"description": "Internet Archive's Item Navigator, visually explore an item's contents.",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -25,7 +25,7 @@
|
|
25
25
|
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
|
26
26
|
},
|
27
27
|
"dependencies": {
|
28
|
-
"@internetarchive/
|
28
|
+
"@internetarchive/icon-collapse-sidebar": "^1.3.4",
|
29
29
|
"@internetarchive/icon-ellipses": "^1.3.4",
|
30
30
|
"@internetarchive/icon-share": "^1.3.4",
|
31
31
|
"@internetarchive/icon-visual-adjustment": "^1.3.4",
|
@@ -75,7 +75,7 @@
|
|
75
75
|
],
|
76
76
|
"import/no-unresolved": "off",
|
77
77
|
"import/extensions": [
|
78
|
-
"
|
78
|
+
"off",
|
79
79
|
{
|
80
80
|
"js": "never",
|
81
81
|
"ts": "never"
|
package/src/item-navigator.ts
CHANGED
@@ -13,10 +13,10 @@ import {
|
|
13
13
|
SharedResizeObserver,
|
14
14
|
SharedResizeObserverResizeHandlerInterface,
|
15
15
|
} from '@internetarchive/shared-resize-observer';
|
16
|
-
import '@internetarchive/ia-menu-slider';
|
17
|
-
|
18
16
|
import { ModalManager } from '@internetarchive/modal-manager';
|
19
17
|
import '@internetarchive/icon-ellipses/icon-ellipses';
|
18
|
+
|
19
|
+
import './menu-slider/ia-menu-slider';
|
20
20
|
import './loader';
|
21
21
|
|
22
22
|
import {
|
@@ -0,0 +1,161 @@
|
|
1
|
+
import { LitElement, html, nothing } from 'lit';
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
3
|
+
import menuSliderCSS from './styles/menu-slider';
|
4
|
+
import '@internetarchive/icon-collapse-sidebar';
|
5
|
+
import './menu-button';
|
6
|
+
|
7
|
+
const sliderEvents = {
|
8
|
+
closeDrawer: 'menuSliderClosed',
|
9
|
+
};
|
10
|
+
|
11
|
+
@customElement('ia-menu-slider')
|
12
|
+
export class IaMenuSlider extends LitElement {
|
13
|
+
static get styles() {
|
14
|
+
return menuSliderCSS;
|
15
|
+
}
|
16
|
+
|
17
|
+
@property({ type: Array }) menus = [];
|
18
|
+
|
19
|
+
@property({ type: Boolean }) open = false;
|
20
|
+
|
21
|
+
@property({ type: Boolean }) manuallyHandleClose = false;
|
22
|
+
|
23
|
+
@property({ type: String }) selectedMenu = '';
|
24
|
+
|
25
|
+
@property({ type: Object }) selectedMenuAction = nothing;
|
26
|
+
|
27
|
+
@property({ type: Boolean }) animateMenuOpen = false;
|
28
|
+
|
29
|
+
updated() {
|
30
|
+
const { actionButton } =
|
31
|
+
this.selectedMenuDetails || ({} as Record<string, any>);
|
32
|
+
const actionButtonHasChanged = actionButton !== this.selectedMenuAction;
|
33
|
+
if (actionButtonHasChanged) {
|
34
|
+
this.selectedMenuAction = actionButton || nothing;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Event handler, captures state of selected menu
|
40
|
+
*/
|
41
|
+
setSelectedMenu({ detail }: CustomEvent) {
|
42
|
+
const { id } = detail;
|
43
|
+
this.selectedMenu = this.selectedMenu === id ? '' : id;
|
44
|
+
const { actionButton } =
|
45
|
+
this.selectedMenuDetails || ({} as Record<string, any>);
|
46
|
+
this.selectedMenuAction = actionButton || nothing;
|
47
|
+
}
|
48
|
+
|
49
|
+
/**
|
50
|
+
* closes menu drawer
|
51
|
+
*/
|
52
|
+
closeMenu() {
|
53
|
+
if (!this.manuallyHandleClose) {
|
54
|
+
this.open = false;
|
55
|
+
}
|
56
|
+
const { closeDrawer } = sliderEvents;
|
57
|
+
const drawerClosed = new CustomEvent(closeDrawer, {
|
58
|
+
detail: this.selectedMenuDetails,
|
59
|
+
});
|
60
|
+
this.dispatchEvent(drawerClosed);
|
61
|
+
}
|
62
|
+
|
63
|
+
get selectedMenuDetails() {
|
64
|
+
const selectedMenu = this.menus.find(
|
65
|
+
menu => (menu as any).id === this.selectedMenu
|
66
|
+
);
|
67
|
+
return selectedMenu;
|
68
|
+
}
|
69
|
+
|
70
|
+
get selectedMenuComponent() {
|
71
|
+
const menuItem = this.selectedMenuDetails;
|
72
|
+
return menuItem && (menuItem as any)?.component
|
73
|
+
? (menuItem as any).component
|
74
|
+
: html``;
|
75
|
+
}
|
76
|
+
|
77
|
+
/* render */
|
78
|
+
|
79
|
+
get sliderDetailsClass() {
|
80
|
+
const animate = this.animateMenuOpen ? 'animate' : '';
|
81
|
+
const state = this.open ? 'open' : '';
|
82
|
+
return `${animate} ${state}`;
|
83
|
+
}
|
84
|
+
|
85
|
+
get selectedMenuClass() {
|
86
|
+
return this.selectedMenu ? 'open' : '';
|
87
|
+
}
|
88
|
+
|
89
|
+
get menuItems() {
|
90
|
+
return this.menus.map(
|
91
|
+
(menu: Record<string, any>) =>
|
92
|
+
html`
|
93
|
+
<li>
|
94
|
+
<menu-button
|
95
|
+
@menuTypeSelected=${this.setSelectedMenu}
|
96
|
+
.icon=${menu.icon}
|
97
|
+
.label=${menu.label}
|
98
|
+
.menuDetails=${menu.menuDetails}
|
99
|
+
.id=${menu.id}
|
100
|
+
.selected=${menu.id === this.selectedMenu}
|
101
|
+
.followable=${menu.followable}
|
102
|
+
.href=${menu.href}
|
103
|
+
></menu-button>
|
104
|
+
</li>
|
105
|
+
`
|
106
|
+
);
|
107
|
+
}
|
108
|
+
|
109
|
+
get renderMenuHeader() {
|
110
|
+
const { label = '', menuDetails = '' } =
|
111
|
+
this.selectedMenuDetails || ({} as Record<string, any>);
|
112
|
+
const headerClass = this.selectedMenuAction ? 'with-secondary-action' : '';
|
113
|
+
const actionBlock = this.selectedMenuAction
|
114
|
+
? html`<span class="custom-action">${this.selectedMenuAction}</span>`
|
115
|
+
: nothing;
|
116
|
+
return html`
|
117
|
+
<header class="${headerClass}">
|
118
|
+
<div class="details">
|
119
|
+
<h3>${label}</h3>
|
120
|
+
<span class="extra-details">${menuDetails}</span>
|
121
|
+
</div>
|
122
|
+
${actionBlock} ${this.closeButton}
|
123
|
+
</header>
|
124
|
+
`;
|
125
|
+
}
|
126
|
+
|
127
|
+
get closeButton() {
|
128
|
+
return html`
|
129
|
+
<button
|
130
|
+
class="close"
|
131
|
+
aria-label="Close this menu"
|
132
|
+
@click=${this.closeMenu}
|
133
|
+
>
|
134
|
+
<ia-icon-collapse-sidebar></ia-icon-collapse-sidebar>
|
135
|
+
</button>
|
136
|
+
`;
|
137
|
+
}
|
138
|
+
|
139
|
+
/** @inheritdoc */
|
140
|
+
render() {
|
141
|
+
return html`
|
142
|
+
<div class="main">
|
143
|
+
<div class="menu ${this.sliderDetailsClass}">
|
144
|
+
${this.closeButton}
|
145
|
+
<ul class="menu-list">
|
146
|
+
${this.menuItems}
|
147
|
+
</ul>
|
148
|
+
<div
|
149
|
+
class="content ${this.selectedMenuClass}"
|
150
|
+
@menuTypeSelected=${this.setSelectedMenu}
|
151
|
+
>
|
152
|
+
${this.renderMenuHeader}
|
153
|
+
<section>
|
154
|
+
<div class="selected-menu">${this.selectedMenuComponent}</div>
|
155
|
+
</section>
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
`;
|
160
|
+
}
|
161
|
+
}
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import { html, LitElement } from 'lit';
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
3
|
+
import menuButtonCSS from './styles/menu-button';
|
4
|
+
|
5
|
+
@customElement('menu-button')
|
6
|
+
export class MenuButton extends LitElement {
|
7
|
+
static get styles() {
|
8
|
+
return menuButtonCSS;
|
9
|
+
}
|
10
|
+
|
11
|
+
@property({ type: String }) icon = '';
|
12
|
+
|
13
|
+
@property({ type: String }) href = '';
|
14
|
+
|
15
|
+
@property({ type: String }) label = '';
|
16
|
+
|
17
|
+
@property({ type: String }) menuDetails = '';
|
18
|
+
|
19
|
+
@property({ type: String }) id = '';
|
20
|
+
|
21
|
+
@property({ type: Boolean }) selected = false;
|
22
|
+
|
23
|
+
@property({ type: Boolean }) followable = false;
|
24
|
+
|
25
|
+
onClick(e: Event) {
|
26
|
+
e.preventDefault();
|
27
|
+
this.dispatchMenuTypeSelectedEvent();
|
28
|
+
}
|
29
|
+
|
30
|
+
dispatchMenuTypeSelectedEvent() {
|
31
|
+
this.dispatchEvent(
|
32
|
+
new CustomEvent('menuTypeSelected', {
|
33
|
+
bubbles: true,
|
34
|
+
composed: true,
|
35
|
+
detail: {
|
36
|
+
id: this.id,
|
37
|
+
},
|
38
|
+
})
|
39
|
+
);
|
40
|
+
}
|
41
|
+
|
42
|
+
get buttonClass() {
|
43
|
+
return this.selected ? 'selected' : '';
|
44
|
+
}
|
45
|
+
|
46
|
+
get iconClass() {
|
47
|
+
return this.selected ? 'active' : '';
|
48
|
+
}
|
49
|
+
|
50
|
+
get menuItem() {
|
51
|
+
return html`
|
52
|
+
<span class="icon ${this.iconClass}"> ${this.icon} </span>
|
53
|
+
<span class="label">${this.label}</span>
|
54
|
+
<span class="menu-details">${this.menuDetails}</span>
|
55
|
+
`;
|
56
|
+
}
|
57
|
+
|
58
|
+
get linkButton() {
|
59
|
+
return html`
|
60
|
+
<a
|
61
|
+
href="${this.href}"
|
62
|
+
class="menu-item ${this.buttonClass}"
|
63
|
+
@click=${this.followable ? undefined : this.onClick}
|
64
|
+
>${this.menuItem}</a
|
65
|
+
>
|
66
|
+
`;
|
67
|
+
}
|
68
|
+
|
69
|
+
get clickButton() {
|
70
|
+
return html`
|
71
|
+
<button class="menu-item ${this.buttonClass}" @click=${this.onClick}>
|
72
|
+
${this.menuItem}
|
73
|
+
</button>
|
74
|
+
`;
|
75
|
+
}
|
76
|
+
|
77
|
+
render() {
|
78
|
+
return this.href ? this.linkButton : this.clickButton;
|
79
|
+
}
|
80
|
+
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
|
3
|
+
export default css`
|
4
|
+
a {
|
5
|
+
display: inline-block;
|
6
|
+
text-decoration: none;
|
7
|
+
}
|
8
|
+
|
9
|
+
.menu-item {
|
10
|
+
display: inline-flex;
|
11
|
+
width: 100%;
|
12
|
+
padding: 0;
|
13
|
+
font-size: 1.6rem;
|
14
|
+
text-align: left;
|
15
|
+
background: transparent;
|
16
|
+
-webkit-box-align: center;
|
17
|
+
-ms-flex-align: center;
|
18
|
+
align-items: center;
|
19
|
+
border: none;
|
20
|
+
cursor: pointer;
|
21
|
+
}
|
22
|
+
|
23
|
+
button.menu-item {
|
24
|
+
-webkit-appearance: none;
|
25
|
+
appearance: none;
|
26
|
+
border-radius: 0;
|
27
|
+
}
|
28
|
+
|
29
|
+
.menu-item:focus {
|
30
|
+
outline: none;
|
31
|
+
}
|
32
|
+
|
33
|
+
.label {
|
34
|
+
display: var(--menuButtonLabelDisplay, none);
|
35
|
+
padding: 0;
|
36
|
+
font-weight: 400;
|
37
|
+
color: var(--primaryTextColor);
|
38
|
+
text-align: left;
|
39
|
+
vertical-align: middle;
|
40
|
+
margin-left: 1rem;
|
41
|
+
}
|
42
|
+
|
43
|
+
.menu-details {
|
44
|
+
color: var(--primaryTextColor);
|
45
|
+
display: inline-block;
|
46
|
+
margin-left: 0.5rem;
|
47
|
+
font-style: italic;
|
48
|
+
font-size: 1.5rem;
|
49
|
+
}
|
50
|
+
|
51
|
+
.menu-item > .icon {
|
52
|
+
position: relative;
|
53
|
+
display: inline-flex;
|
54
|
+
z-index: 2;
|
55
|
+
min-width: 4.2rem;
|
56
|
+
max-width: 4.2rem;
|
57
|
+
height: 4.2rem;
|
58
|
+
vertical-align: middle;
|
59
|
+
-webkit-box-align: center;
|
60
|
+
-ms-flex-align: center;
|
61
|
+
align-items: center;
|
62
|
+
-webkit-box-pack: center;
|
63
|
+
-ms-flex-pack: center;
|
64
|
+
justify-content: center;
|
65
|
+
}
|
66
|
+
|
67
|
+
.menu-item.selected .icon {
|
68
|
+
background-color: var(--activeButtonBg);
|
69
|
+
border-radius: 1rem 0 0 1rem;
|
70
|
+
}
|
71
|
+
|
72
|
+
.icon .fill-color {
|
73
|
+
fill: #999;
|
74
|
+
}
|
75
|
+
|
76
|
+
.icon.active .fill-color {
|
77
|
+
fill: #fff;
|
78
|
+
}
|
79
|
+
`;
|
@@ -0,0 +1,130 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
|
3
|
+
const menuButtonWidth = css`42px`;
|
4
|
+
const sliderWidth = css`var(--menuWidth, 320px)`;
|
5
|
+
const transitionTiming = css`var(--animationTiming, 200ms)`;
|
6
|
+
|
7
|
+
export default css`
|
8
|
+
.main {
|
9
|
+
overflow: hidden;
|
10
|
+
width: 100%;
|
11
|
+
height: 100%;
|
12
|
+
}
|
13
|
+
|
14
|
+
.animate {
|
15
|
+
transition: transform ${transitionTiming} ease-out;
|
16
|
+
}
|
17
|
+
|
18
|
+
.menu {
|
19
|
+
position: absolute;
|
20
|
+
top: 0;
|
21
|
+
left: 0;
|
22
|
+
bottom: 0;
|
23
|
+
width: ${sliderWidth};
|
24
|
+
padding: 0.5rem 0.5rem 0 0;
|
25
|
+
box-sizing: border-box;
|
26
|
+
font-size: 1.4rem;
|
27
|
+
color: var(--primaryTextColor);
|
28
|
+
background: var(--menuSliderBg);
|
29
|
+
transform: translateX(calc(${sliderWidth} * -1));
|
30
|
+
}
|
31
|
+
|
32
|
+
.menu > button.close {
|
33
|
+
right: 0.7rem;
|
34
|
+
}
|
35
|
+
|
36
|
+
button {
|
37
|
+
outline: none;
|
38
|
+
cursor: pointer;
|
39
|
+
}
|
40
|
+
|
41
|
+
header {
|
42
|
+
margin: 0 0 0.5rem 0;
|
43
|
+
}
|
44
|
+
|
45
|
+
header * {
|
46
|
+
margin: 0;
|
47
|
+
display: inline-block;
|
48
|
+
}
|
49
|
+
header button {
|
50
|
+
outline: none;
|
51
|
+
cursor: pointer;
|
52
|
+
}
|
53
|
+
|
54
|
+
header.with-secondary-action .details {
|
55
|
+
width: 80%;
|
56
|
+
}
|
57
|
+
|
58
|
+
header .details {
|
59
|
+
font-weight: bold;
|
60
|
+
width: 88%;
|
61
|
+
}
|
62
|
+
|
63
|
+
header .custom-action > *,
|
64
|
+
button.close {
|
65
|
+
padding: 0;
|
66
|
+
background-color: transparent;
|
67
|
+
border: 0;
|
68
|
+
--iconWidth: var(--menuSliderHeaderIconWidth);
|
69
|
+
--iconHeight: var(--menuSliderHeaderIconHeight);
|
70
|
+
}
|
71
|
+
|
72
|
+
header .custom-action,
|
73
|
+
button.close {
|
74
|
+
position: absolute;
|
75
|
+
}
|
76
|
+
button.close {
|
77
|
+
right: 0.5rem;
|
78
|
+
}
|
79
|
+
|
80
|
+
button.close * {
|
81
|
+
float: right;
|
82
|
+
}
|
83
|
+
|
84
|
+
.content {
|
85
|
+
position: absolute;
|
86
|
+
top: 0;
|
87
|
+
right: 0;
|
88
|
+
bottom: 0;
|
89
|
+
left: ${menuButtonWidth};
|
90
|
+
z-index: 1;
|
91
|
+
transform: translateX(calc(${sliderWidth} * -1));
|
92
|
+
transition: transform ${transitionTiming} ease-out;
|
93
|
+
background: var(--activeButtonBg);
|
94
|
+
border-right: 0.2rem solid;
|
95
|
+
border-color: var(--subpanelRightBorderColor);
|
96
|
+
padding: 0.5rem 0 0 0.5rem;
|
97
|
+
}
|
98
|
+
|
99
|
+
.open {
|
100
|
+
transform: translateX(0);
|
101
|
+
}
|
102
|
+
|
103
|
+
.menu-list {
|
104
|
+
padding: 0;
|
105
|
+
margin: 0;
|
106
|
+
list-style: none;
|
107
|
+
background: var(--menuSliderBg);
|
108
|
+
}
|
109
|
+
.menu-list li {
|
110
|
+
margin-bottom: 0.2rem;
|
111
|
+
}
|
112
|
+
|
113
|
+
.content section {
|
114
|
+
height: 100%;
|
115
|
+
position: relative;
|
116
|
+
width: 100%;
|
117
|
+
}
|
118
|
+
|
119
|
+
.content .selected-menu {
|
120
|
+
overflow: auto;
|
121
|
+
height: inherit;
|
122
|
+
position: relative;
|
123
|
+
}
|
124
|
+
|
125
|
+
.content .selected-menu > * {
|
126
|
+
display: block;
|
127
|
+
padding-bottom: 3rem;
|
128
|
+
position: relative;
|
129
|
+
}
|
130
|
+
`;
|