kempo-ui 0.0.41 → 0.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Accordion.js +1 -1
- package/dist/components/ContentSlider.js +2 -2
- package/dist/components/Icon.js +34 -2
- package/dist/components/Main.js +24 -0
- package/dist/components/PhotoViewer.js +2 -2
- package/dist/components/ShowMore.js +8 -8
- package/dist/components/SidePanel.js +225 -0
- package/dist/components/Table.js +1 -1
- package/dist/components/tableControls/FirstPage.js +1 -1
- package/dist/components/tableControls/LastPage.js +1 -1
- package/dist/components/tableControls/NextPage.js +1 -1
- package/dist/components/tableControls/PrevPage.js +1 -1
- package/dist/utils/theme.js +1 -1
- package/docs/components/accordion.html +0 -1
- package/docs/components/card.html +0 -1
- package/docs/components/content-slider.html +0 -1
- package/docs/components/dialog.html +0 -1
- package/docs/components/dropdown.html +0 -1
- package/docs/components/focus-capture.html +0 -1
- package/docs/components/hybrid-component.html +0 -1
- package/docs/components/icon.html +50 -5
- package/docs/components/import.html +0 -1
- package/docs/components/light-component.html +0 -1
- package/docs/components/photo-viewer.html +0 -1
- package/docs/components/resize.html +0 -1
- package/docs/components/shadow-component.html +0 -1
- package/docs/components/show-more.html +0 -1
- package/docs/components/side-menu.html +0 -1
- package/docs/components/side-panel-basic.html +44 -0
- package/docs/components/side-panel-menu.html +50 -0
- package/docs/components/side-panel.html +186 -0
- package/docs/components/sortable.html +0 -1
- package/docs/components/spinner.html +0 -1
- package/docs/components/split.html +0 -1
- package/docs/components/table.html +24 -25
- package/docs/components/tableControls.html +0 -1
- package/docs/components/tableCustomFields.html +0 -1
- package/docs/components/tableFetchRecords.html +0 -1
- package/docs/components/tableFieldSortHide.html +0 -1
- package/docs/components/tablePagination.html +0 -1
- package/docs/components/tableRecordEditing.html +0 -1
- package/docs/components/tableRecordFiltering.html +0 -1
- package/docs/components/tableRecordHiding.html +0 -1
- package/docs/components/tableRecordSearching.html +0 -1
- package/docs/components/tableRecordSelection.html +0 -1
- package/docs/components/tableRowControls.html +0 -1
- package/docs/components/tableSorting.html +0 -1
- package/docs/components/tabs.html +0 -1
- package/docs/components/tags.html +0 -1
- package/docs/components/theme-switcher.html +0 -1
- package/docs/components/timestamp.html +0 -1
- package/docs/components/toast.html +0 -1
- package/docs/components/toggle.html +0 -1
- package/docs/components/tree.html +0 -1
- package/docs/dev.config.json +8 -1
- package/docs/icons/account-circle.svg +1 -0
- package/docs/icons/arrow-circle.svg +1 -0
- package/docs/icons/arrow-line.svg +1 -0
- package/docs/icons/arrow-menu-close.svg +1 -0
- package/docs/icons/arrow-menu-open.svg +1 -0
- package/docs/icons/arrow.svg +1 -0
- package/docs/icons/chevron-double.svg +1 -0
- package/docs/icons/chevron-line.svg +1 -0
- package/docs/icons/chevron-up.svg +1 -0
- package/docs/icons/key.svg +1 -0
- package/docs/icons/login.svg +1 -0
- package/docs/icons/logout.svg +1 -0
- package/docs/index.html +6 -1
- package/docs/nav-1.inc.html +1 -0
- package/docs/nav.inc.html +1 -0
- package/docs/prod.config.json +4 -0
- package/docs/src/components/Accordion.js +1 -1
- package/docs/src/components/ContentSlider.js +2 -2
- package/docs/src/components/Icon.js +34 -2
- package/docs/src/components/Main.js +24 -0
- package/docs/src/components/PhotoViewer.js +2 -2
- package/docs/src/components/ShowMore.js +8 -8
- package/docs/src/components/SidePanel.js +225 -0
- package/docs/src/components/Table.js +1 -1
- package/docs/src/components/tableControls/FirstPage.js +1 -1
- package/docs/src/components/tableControls/LastPage.js +1 -1
- package/docs/src/components/tableControls/NextPage.js +1 -1
- package/docs/src/components/tableControls/PrevPage.js +1 -1
- package/docs/src/utils/theme.js +1 -1
- package/docs/utils/context.html +0 -1
- package/docs/utils/debounce.html +0 -1
- package/docs/utils/drag.html +0 -1
- package/docs/utils/formatTimestamp.html +0 -1
- package/docs/utils/object.html +0 -1
- package/docs/utils/propConverters.html +0 -1
- package/docs/utils/string.html +0 -1
- package/docs/utils/theme.html +0 -1
- package/docs/utils/toTitleCase.html +0 -1
- package/docs/utils/type.html +0 -1
- package/docs/utils/wait.html +0 -1
- package/icons/account-circle.svg +1 -0
- package/icons/arrow-circle.svg +1 -0
- package/icons/arrow-line.svg +1 -0
- package/icons/arrow.svg +1 -0
- package/icons/chevron-double.svg +1 -0
- package/icons/chevron-line.svg +1 -0
- package/icons/chevron.svg +1 -0
- package/icons/key.svg +1 -0
- package/icons/login.svg +1 -0
- package/icons/logout.svg +1 -0
- package/package.json +1 -1
- package/scripts/build.js +0 -7
- package/src/components/Accordion.js +1 -1
- package/src/components/ContentSlider.js +2 -2
- package/src/components/Icon.js +64 -4
- package/src/components/Main.js +87 -0
- package/src/components/PhotoViewer.js +2 -2
- package/src/components/ShowMore.js +8 -8
- package/src/components/SidePanel.js +454 -0
- package/src/components/Table.js +1 -1
- package/src/components/tableControls/FirstPage.js +1 -1
- package/src/components/tableControls/LastPage.js +1 -1
- package/src/components/tableControls/NextPage.js +1 -1
- package/src/components/tableControls/PrevPage.js +1 -1
- package/src/utils/theme.js +22 -9
- package/tests/components/Icon.browser-test.js +205 -0
- package/tests/components/Main.browser-test.js +345 -0
- package/tests/components/SidePanel.browser-test.js +466 -0
- package/tests/components/tableControls/PaginationControls.browser-test.js +10 -10
- package/dist/kempo-vars.css +0 -1
- package/docs/init-1.js +0 -4
- package/docs/init.js +0 -4
- package/docs/src/kempo-vars.css +0 -1
- package/icons/arrow-back.svg +0 -1
- package/icons/arrow-down-double.svg +0 -1
- package/icons/arrow-down.svg +0 -1
- package/icons/arrow-up-double.svg +0 -1
- package/icons/arrow-up.svg +0 -1
- package/icons/chevron-left.svg +0 -1
- package/src/kempo-vars.css +0 -1
- /package/{icons/arrow-forward.svg → docs/icons/arrow-right.svg} +0 -0
- /package/{icons/chevron-right.svg → docs/icons/chevron.svg} +0 -0
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import ShadowComponent from './ShadowComponent.js';
|
|
2
|
+
import { html, css } from '../lit-all.min.js';
|
|
3
|
+
import './Icon.js';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
SidePanel
|
|
7
|
+
*/
|
|
8
|
+
class SidePanel extends ShadowComponent {
|
|
9
|
+
static properties = {
|
|
10
|
+
collapsed: { type: Boolean, reflect: true },
|
|
11
|
+
side: { type: String, reflect: true }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
this.collapsed = false;
|
|
17
|
+
this.side = 'left';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
toggleClick = () => this.toggle();
|
|
21
|
+
|
|
22
|
+
updated(changedProperties) {
|
|
23
|
+
super.updated(changedProperties);
|
|
24
|
+
|
|
25
|
+
if(changedProperties.has('collapsed')) {
|
|
26
|
+
const eventName = this.collapsed ? 'collapse' : 'expand';
|
|
27
|
+
this.dispatchEvent(new CustomEvent(eventName));
|
|
28
|
+
this.dispatchEvent(new CustomEvent('change', { detail: eventName }));
|
|
29
|
+
|
|
30
|
+
window.dispatchEvent(new CustomEvent('side-panel-change', {
|
|
31
|
+
detail: {
|
|
32
|
+
collapsed: this.collapsed,
|
|
33
|
+
width: this.collapsed ? '3.5rem' : '16rem',
|
|
34
|
+
side: this.side
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
expand = () => this.collapsed = false;
|
|
41
|
+
collapse = () => this.collapsed = true;
|
|
42
|
+
toggle() {
|
|
43
|
+
this.collapsed = !this.collapsed;
|
|
44
|
+
this.dispatchEvent(new CustomEvent('toggle'));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
render() {
|
|
48
|
+
return html`
|
|
49
|
+
<div id="header">
|
|
50
|
+
<slot name="logo"></slot>
|
|
51
|
+
<button id="toggle" @click=${this.toggleClick} aria-label="${this.collapsed ? 'Expand panel' : 'Collapse panel'}">
|
|
52
|
+
<k-icon name="arrow-line" direction="${this.collapsed ? 'right' : 'left'}"></k-icon>
|
|
53
|
+
</button>
|
|
54
|
+
</div>
|
|
55
|
+
<div id="content">
|
|
56
|
+
<slot></slot>
|
|
57
|
+
</div>
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static styles = css`
|
|
62
|
+
:host {
|
|
63
|
+
--bg: var(--c_bg);
|
|
64
|
+
--width-expanded: 16rem;
|
|
65
|
+
--width-collapsed: 3.5rem;
|
|
66
|
+
--transition-duration: var(--animation_ms, 256ms);
|
|
67
|
+
display: block;
|
|
68
|
+
position: fixed;
|
|
69
|
+
top: 0;
|
|
70
|
+
left: 0;
|
|
71
|
+
height: 100vh;
|
|
72
|
+
width: var(--width-expanded);
|
|
73
|
+
transition: width var(--transition-duration);
|
|
74
|
+
background: var(--bg);
|
|
75
|
+
border-right: 1px solid var(--c_border);
|
|
76
|
+
z-index: 1000;
|
|
77
|
+
}
|
|
78
|
+
:host([collapsed]) {
|
|
79
|
+
width: var(--width-collapsed);
|
|
80
|
+
}
|
|
81
|
+
:host([side="right"]) {
|
|
82
|
+
left: auto;
|
|
83
|
+
right: 0;
|
|
84
|
+
border-right: none;
|
|
85
|
+
border-left: 1px solid var(--c_border);
|
|
86
|
+
}
|
|
87
|
+
#header {
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: flex-end;
|
|
91
|
+
gap: var(--spacer_h);
|
|
92
|
+
padding: var(--spacer_h);
|
|
93
|
+
border-bottom: 1px solid var(--c_border);
|
|
94
|
+
}
|
|
95
|
+
::slotted([slot="logo"]) {
|
|
96
|
+
margin-right: auto;
|
|
97
|
+
}
|
|
98
|
+
::slotted([slot="logo"]) {
|
|
99
|
+
flex: 1;
|
|
100
|
+
min-width: 0;
|
|
101
|
+
opacity: 1;
|
|
102
|
+
transition: opacity var(--transition-duration);
|
|
103
|
+
}
|
|
104
|
+
:host([collapsed]) ::slotted([slot="logo"]) {
|
|
105
|
+
opacity: 0;
|
|
106
|
+
width: 0;
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
}
|
|
109
|
+
#toggle {
|
|
110
|
+
flex-shrink: 0;
|
|
111
|
+
width: 2rem;
|
|
112
|
+
height: 2rem;
|
|
113
|
+
border: none;
|
|
114
|
+
background: transparent;
|
|
115
|
+
color: var(--c_text);
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
justify-content: center;
|
|
120
|
+
border-radius: var(--radius);
|
|
121
|
+
}
|
|
122
|
+
#toggle:hover {
|
|
123
|
+
background: var(--c_bg_hover);
|
|
124
|
+
}
|
|
125
|
+
#content {
|
|
126
|
+
height: calc(100% - 3rem);
|
|
127
|
+
overflow-y: auto;
|
|
128
|
+
overflow-x: hidden;
|
|
129
|
+
display: flex;
|
|
130
|
+
flex-direction: column;
|
|
131
|
+
}
|
|
132
|
+
`;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/*
|
|
136
|
+
SidePanelItem
|
|
137
|
+
*/
|
|
138
|
+
class SidePanelItem extends ShadowComponent {
|
|
139
|
+
static properties = {
|
|
140
|
+
icon: { type: String },
|
|
141
|
+
href: { type: String },
|
|
142
|
+
active: { type: Boolean, reflect: true }
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
constructor() {
|
|
146
|
+
super();
|
|
147
|
+
this.icon = '';
|
|
148
|
+
this.href = '#';
|
|
149
|
+
this.active = false;
|
|
150
|
+
this.collapsed = false;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
connectedCallback() {
|
|
154
|
+
super.connectedCallback();
|
|
155
|
+
this.panel = this.closest('k-side-panel');
|
|
156
|
+
if(this.panel) {
|
|
157
|
+
this.collapsed = this.panel.collapsed;
|
|
158
|
+
this.panel.addEventListener('collapse', this.handleCollapse);
|
|
159
|
+
this.panel.addEventListener('expand', this.handleExpand);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
disconnectedCallback() {
|
|
164
|
+
super.disconnectedCallback();
|
|
165
|
+
if(this.panel) {
|
|
166
|
+
this.panel.removeEventListener('collapse', this.handleCollapse);
|
|
167
|
+
this.panel.removeEventListener('expand', this.handleExpand);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
handleCollapse = () => {
|
|
172
|
+
this.collapsed = true;
|
|
173
|
+
this.requestUpdate();
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
handleExpand = () => {
|
|
177
|
+
this.collapsed = false;
|
|
178
|
+
this.requestUpdate();
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
render() {
|
|
182
|
+
return html`
|
|
183
|
+
<a href="${this.href}" class="item ${this.active ? 'active bg-primary' : ''}">
|
|
184
|
+
${this.icon ? html`<k-icon name="${this.icon}"></k-icon>` : ''}
|
|
185
|
+
<span class="label ${this.collapsed ? 'hidden' : ''}">
|
|
186
|
+
<slot></slot>
|
|
187
|
+
</span>
|
|
188
|
+
</a>
|
|
189
|
+
`;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
static styles = css`
|
|
193
|
+
:host {
|
|
194
|
+
display: block;
|
|
195
|
+
}
|
|
196
|
+
.item {
|
|
197
|
+
display: flex;
|
|
198
|
+
align-items: center;
|
|
199
|
+
gap: var(--spacer_h);
|
|
200
|
+
padding: var(--spacer_h);
|
|
201
|
+
color: var(--c_text);
|
|
202
|
+
text-decoration: none;
|
|
203
|
+
border-radius: var(--radius);
|
|
204
|
+
margin: 0 var(--spacer_h);
|
|
205
|
+
transition: background var(--animation_ms), color var(--animation_ms);
|
|
206
|
+
white-space: nowrap;
|
|
207
|
+
}
|
|
208
|
+
.item:hover {
|
|
209
|
+
background: var(--c_bg_hover);
|
|
210
|
+
}
|
|
211
|
+
.item.active {
|
|
212
|
+
color: var(--tc_on_primary);
|
|
213
|
+
}
|
|
214
|
+
.item.active:hover {
|
|
215
|
+
background: var(--c_primary);
|
|
216
|
+
filter: brightness(1.1);
|
|
217
|
+
}
|
|
218
|
+
k-icon {
|
|
219
|
+
flex-shrink: 0;
|
|
220
|
+
}
|
|
221
|
+
.label {
|
|
222
|
+
min-width: 0;
|
|
223
|
+
overflow: hidden;
|
|
224
|
+
text-overflow: ellipsis;
|
|
225
|
+
opacity: 1;
|
|
226
|
+
transition: opacity var(--animation_ms);
|
|
227
|
+
}
|
|
228
|
+
.label.hidden {
|
|
229
|
+
opacity: 0;
|
|
230
|
+
width: 0;
|
|
231
|
+
}
|
|
232
|
+
`;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/*
|
|
236
|
+
SidePanelLabel
|
|
237
|
+
*/
|
|
238
|
+
class SidePanelLabel extends ShadowComponent {
|
|
239
|
+
constructor() {
|
|
240
|
+
super();
|
|
241
|
+
this.collapsed = false;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
connectedCallback() {
|
|
245
|
+
super.connectedCallback();
|
|
246
|
+
this.panel = this.closest('k-side-panel');
|
|
247
|
+
if(this.panel) {
|
|
248
|
+
this.collapsed = this.panel.collapsed;
|
|
249
|
+
this.panel.addEventListener('collapse', this.handleCollapse);
|
|
250
|
+
this.panel.addEventListener('expand', this.handleExpand);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
disconnectedCallback() {
|
|
255
|
+
super.disconnectedCallback();
|
|
256
|
+
if(this.panel) {
|
|
257
|
+
this.panel.removeEventListener('collapse', this.handleCollapse);
|
|
258
|
+
this.panel.removeEventListener('expand', this.handleExpand);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
handleCollapse = () => {
|
|
263
|
+
this.collapsed = true;
|
|
264
|
+
this.requestUpdate();
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
handleExpand = () => {
|
|
268
|
+
this.collapsed = false;
|
|
269
|
+
this.requestUpdate();
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
render() {
|
|
273
|
+
return this.collapsed
|
|
274
|
+
? html`<hr>`
|
|
275
|
+
: html`<div class="label"><slot></slot></div>`;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
static styles = css`
|
|
279
|
+
:host {
|
|
280
|
+
display: block;
|
|
281
|
+
margin: var(--spacer_h) 0;
|
|
282
|
+
}
|
|
283
|
+
.label {
|
|
284
|
+
padding: 0 var(--spacer);
|
|
285
|
+
font-size: 0.75rem;
|
|
286
|
+
font-weight: 600;
|
|
287
|
+
text-transform: uppercase;
|
|
288
|
+
color: var(--c_text_muted);
|
|
289
|
+
letter-spacing: 0.05em;
|
|
290
|
+
}
|
|
291
|
+
hr {
|
|
292
|
+
border: none;
|
|
293
|
+
border-top: 1px solid var(--c_border);
|
|
294
|
+
margin: var(--spacer_h) var(--spacer);
|
|
295
|
+
}
|
|
296
|
+
`;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/*
|
|
300
|
+
SidePanelMenu
|
|
301
|
+
*/
|
|
302
|
+
class SidePanelMenu extends ShadowComponent {
|
|
303
|
+
static properties = {
|
|
304
|
+
icon: { type: String },
|
|
305
|
+
label: { type: String },
|
|
306
|
+
open: { type: Boolean, reflect: true }
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
constructor() {
|
|
310
|
+
super();
|
|
311
|
+
this.icon = '';
|
|
312
|
+
this.label = '';
|
|
313
|
+
this.open = false;
|
|
314
|
+
this.collapsed = false;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
connectedCallback() {
|
|
318
|
+
super.connectedCallback();
|
|
319
|
+
this.panel = this.closest('k-side-panel');
|
|
320
|
+
if(this.panel) {
|
|
321
|
+
this.collapsed = this.panel.collapsed;
|
|
322
|
+
this.panel.addEventListener('collapse', this.handleCollapse);
|
|
323
|
+
this.panel.addEventListener('expand', this.handleExpand);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
disconnectedCallback() {
|
|
328
|
+
super.disconnectedCallback();
|
|
329
|
+
if(this.panel) {
|
|
330
|
+
this.panel.removeEventListener('collapse', this.handleCollapse);
|
|
331
|
+
this.panel.removeEventListener('expand', this.handleExpand);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
handleCollapse = () => {
|
|
336
|
+
this.collapsed = true;
|
|
337
|
+
this.open = false;
|
|
338
|
+
this.requestUpdate();
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
handleExpand = () => {
|
|
342
|
+
this.collapsed = false;
|
|
343
|
+
this.requestUpdate();
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
toggleMenu = () => {
|
|
347
|
+
if(!this.collapsed) {
|
|
348
|
+
this.open = !this.open;
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
render() {
|
|
353
|
+
return html`
|
|
354
|
+
<div class="menu-container">
|
|
355
|
+
<button class="menu-header ${this.open ? 'open' : ''}" @click=${this.toggleMenu}>
|
|
356
|
+
${this.icon ? html`<k-icon name="${this.icon}"></k-icon>` : ''}
|
|
357
|
+
<span class="label ${this.collapsed ? 'hidden' : ''}">${this.label}</span>
|
|
358
|
+
${!this.collapsed ? html`<k-icon class="chevron" name="chevron" direction="${this.open ? 'down' : 'right'}"></k-icon>` : ''}
|
|
359
|
+
</button>
|
|
360
|
+
<div class="menu-content ${this.open && !this.collapsed ? 'open' : ''}">
|
|
361
|
+
<slot></slot>
|
|
362
|
+
</div>
|
|
363
|
+
</div>
|
|
364
|
+
`;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
static styles = css`
|
|
368
|
+
:host {
|
|
369
|
+
display: block;
|
|
370
|
+
}
|
|
371
|
+
.menu-container {
|
|
372
|
+
margin: 0;
|
|
373
|
+
}
|
|
374
|
+
.menu-header {
|
|
375
|
+
display: flex !important;
|
|
376
|
+
align-items: center;
|
|
377
|
+
gap: var(--spacer_h);
|
|
378
|
+
padding-top: var(--spacer_h) !important;
|
|
379
|
+
padding-bottom: var(--spacer_h) !important;
|
|
380
|
+
padding-left: var(--spacer_h) !important;
|
|
381
|
+
padding-right: var(--spacer_h) !important;
|
|
382
|
+
color: var(--c_text);
|
|
383
|
+
background: transparent;
|
|
384
|
+
border: none;
|
|
385
|
+
border-radius: var(--radius);
|
|
386
|
+
margin: 0 var(--spacer_h);
|
|
387
|
+
width: calc(100% - var(--spacer));
|
|
388
|
+
cursor: pointer;
|
|
389
|
+
text-align: left;
|
|
390
|
+
white-space: nowrap;
|
|
391
|
+
transition: background var(--animation_ms);
|
|
392
|
+
}
|
|
393
|
+
.menu-header:hover {
|
|
394
|
+
background: var(--c_bg_hover);
|
|
395
|
+
}
|
|
396
|
+
k-icon {
|
|
397
|
+
flex-shrink: 0;
|
|
398
|
+
}
|
|
399
|
+
.label {
|
|
400
|
+
flex: 1;
|
|
401
|
+
min-width: 0;
|
|
402
|
+
overflow: hidden;
|
|
403
|
+
text-overflow: ellipsis;
|
|
404
|
+
opacity: 1;
|
|
405
|
+
transition: opacity var(--animation_ms);
|
|
406
|
+
}
|
|
407
|
+
.label.hidden {
|
|
408
|
+
opacity: 0;
|
|
409
|
+
width: 0;
|
|
410
|
+
}
|
|
411
|
+
.chevron {
|
|
412
|
+
transition: transform var(--animation_ms);
|
|
413
|
+
}
|
|
414
|
+
.menu-content {
|
|
415
|
+
max-height: 0;
|
|
416
|
+
overflow: hidden;
|
|
417
|
+
transition: max-height var(--animation_ms);
|
|
418
|
+
padding-left: calc(var(--spacer_h) * 2);
|
|
419
|
+
}
|
|
420
|
+
.menu-content.open {
|
|
421
|
+
max-height: 500px;
|
|
422
|
+
}
|
|
423
|
+
::slotted(*) {
|
|
424
|
+
margin: 0.25rem 0;
|
|
425
|
+
}
|
|
426
|
+
`;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/*
|
|
430
|
+
SidePanelSpacer
|
|
431
|
+
*/
|
|
432
|
+
class SidePanelSpacer extends ShadowComponent {
|
|
433
|
+
render() {
|
|
434
|
+
return html`<div class="spacer"></div>`;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
static styles = css`
|
|
438
|
+
:host {
|
|
439
|
+
display: block;
|
|
440
|
+
flex: 1;
|
|
441
|
+
}
|
|
442
|
+
.spacer {
|
|
443
|
+
height: 100%;
|
|
444
|
+
}
|
|
445
|
+
`;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
customElements.define('k-side-panel', SidePanel);
|
|
449
|
+
customElements.define('k-side-panel-item', SidePanelItem);
|
|
450
|
+
customElements.define('k-side-panel-label', SidePanelLabel);
|
|
451
|
+
customElements.define('k-side-panel-menu', SidePanelMenu);
|
|
452
|
+
customElements.define('k-side-panel-spacer', SidePanelSpacer);
|
|
453
|
+
|
|
454
|
+
export default SidePanel;
|
package/src/components/Table.js
CHANGED
|
@@ -148,7 +148,7 @@ export default class Table extends ShadowComponent {
|
|
|
148
148
|
@click=${this.enableSorting ? () => this.handleFieldClick(name) : null}
|
|
149
149
|
>
|
|
150
150
|
${label}
|
|
151
|
-
${isCurrentSort ? html`<k-icon name="${sortItem.asc ? '
|
|
151
|
+
${isCurrentSort ? html`<k-icon name="arrow" direction="${sortItem.asc ? 'down' : 'up'}" class="icon-sort"></k-icon>` : ''}
|
|
152
152
|
</div>
|
|
153
153
|
`);
|
|
154
154
|
});
|
package/src/utils/theme.js
CHANGED
|
@@ -15,9 +15,17 @@ const getInitialTheme = () => {
|
|
|
15
15
|
|
|
16
16
|
const themeContext = createContext('theme', getInitialTheme());
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const applyTheme = theme => {
|
|
19
|
+
localStorage.setItem('theme', theme);
|
|
20
|
+
document.documentElement.setAttribute('theme', theme);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
themeContext.subscribe(applyTheme);
|
|
24
|
+
|
|
25
|
+
window.addEventListener('storage', event => {
|
|
26
|
+
if(event.key === 'theme' && event.newValue){
|
|
27
|
+
themeContext.set(event.newValue);
|
|
28
|
+
}
|
|
21
29
|
});
|
|
22
30
|
|
|
23
31
|
export const setTheme = theme => themeContext.set(theme);
|
|
@@ -26,7 +34,11 @@ export const getTheme = () => themeContext.get();
|
|
|
26
34
|
|
|
27
35
|
export const subscribeToTheme = callback => themeContext.subscribe(callback);
|
|
28
36
|
|
|
29
|
-
export const
|
|
37
|
+
export const initTheme = () => {
|
|
38
|
+
const theme = getInitialTheme();
|
|
39
|
+
applyTheme(theme);
|
|
40
|
+
themeContext.set(theme);
|
|
41
|
+
};export const getCalculatedTheme = () => {
|
|
30
42
|
const theme = getTheme();
|
|
31
43
|
if(theme === 'auto'){
|
|
32
44
|
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
@@ -43,8 +55,9 @@ colorSchemeQuery.addEventListener('change', colorSchemeChangeHandler);
|
|
|
43
55
|
colorSchemeChangeHandler(colorSchemeQuery);
|
|
44
56
|
|
|
45
57
|
export default {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
get: getTheme,
|
|
59
|
+
set: setTheme,
|
|
60
|
+
subscribe: subscribeToTheme,
|
|
61
|
+
getCalculated: getCalculatedTheme,
|
|
62
|
+
init: initTheme
|
|
63
|
+
};
|