@kubex/zinc 1.1.0 → 1.1.2
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/custom-elements.json +92 -74
- package/dist/vscode.html-custom-data.json +11 -11
- package/dist/web-types.json +23 -23
- package/dist/zn.d.ts +8 -2
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +152 -152
- package/package.json +1 -1
- package/scss/shared/_table.scss +2 -2
- package/src/components/collapsible/collapsible.scss +4 -0
- package/src/components/data-table/data-table.scss +2 -2
- package/src/components/expanding-action/expanding-action.component.ts +38 -0
- package/src/components/expanding-action/expanding-action.scss +17 -9
- package/src/components/menu/menu.scss +2 -2
- package/src/components/navbar/navbar.scss +5 -7
- package/src/internal/zinc-element.ts +6 -1
package/package.json
CHANGED
package/scss/shared/_table.scss
CHANGED
|
@@ -39,12 +39,12 @@ table:not(.remarkd-table) {
|
|
|
39
39
|
|
|
40
40
|
thead tr th:first-of-type,
|
|
41
41
|
tbody tr td:first-of-type {
|
|
42
|
-
padding-left: 14px;
|
|
42
|
+
padding-left: var(--zn-base-gap, 14px);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
thead tr th:last-of-type,
|
|
46
46
|
tbody tr td:last-of-type {
|
|
47
|
-
padding-right: 14px;
|
|
47
|
+
padding-right: var(--zn-base-gap, 14px);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
th, td {
|
|
@@ -69,12 +69,12 @@ table {
|
|
|
69
69
|
|
|
70
70
|
thead tr th:first-of-type,
|
|
71
71
|
tbody tr td:first-of-type {
|
|
72
|
-
padding-left: 14px;
|
|
72
|
+
padding-left: var(--zn-base-gap, 14px);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
thead tr th:last-of-type,
|
|
76
76
|
tbody tr td:last-of-type {
|
|
77
|
-
padding-right: 14px;
|
|
77
|
+
padding-right: var(--zn-base-gap, 14px);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
th, td {
|
|
@@ -56,6 +56,7 @@ export default class ZnExpandingAction extends ZincElement {
|
|
|
56
56
|
private _actions: HTMLElement[] = [];
|
|
57
57
|
private _preload = true;
|
|
58
58
|
private _metaObserved = false;
|
|
59
|
+
private _placementObserver?: MutationObserver;
|
|
59
60
|
|
|
60
61
|
private readonly _countObserver = new MutationController(this, {
|
|
61
62
|
target: null,
|
|
@@ -241,6 +242,42 @@ export default class ZnExpandingAction extends ZincElement {
|
|
|
241
242
|
this.open = false;
|
|
242
243
|
}
|
|
243
244
|
|
|
245
|
+
private _updateTriggerSide = () => {
|
|
246
|
+
const trigger = this.shadowRoot?.querySelector('.expanding-action__dropdown zn-button[slot="trigger"]');
|
|
247
|
+
const content = this.shadowRoot?.querySelector('#content');
|
|
248
|
+
if (!trigger || !content) return;
|
|
249
|
+
|
|
250
|
+
const triggerRect = trigger.getBoundingClientRect();
|
|
251
|
+
const contentRect = content.getBoundingClientRect();
|
|
252
|
+
if (contentRect.width === 0) return;
|
|
253
|
+
|
|
254
|
+
const triggerCenter = (triggerRect.left + triggerRect.right) / 2;
|
|
255
|
+
const contentCenter = (contentRect.left + contentRect.right) / 2;
|
|
256
|
+
this.setAttribute('data-trigger-side', triggerCenter > contentCenter ? 'right' : 'left');
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
private _observePlacement() {
|
|
260
|
+
const dropdown = this.shadowRoot?.querySelector('.expanding-action__dropdown');
|
|
261
|
+
const popup = dropdown?.shadowRoot?.querySelector('.dropdown');
|
|
262
|
+
if (!popup) {
|
|
263
|
+
requestAnimationFrame(() => this._observePlacement());
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
this._updateTriggerSide();
|
|
268
|
+
|
|
269
|
+
if (this._placementObserver) return;
|
|
270
|
+
|
|
271
|
+
this._placementObserver = new MutationObserver(this._updateTriggerSide);
|
|
272
|
+
this._placementObserver.observe(popup, {attributes: true, attributeFilter: ['data-current-placement']});
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
disconnectedCallback() {
|
|
276
|
+
super.disconnectedCallback();
|
|
277
|
+
this._placementObserver?.disconnect();
|
|
278
|
+
this._placementObserver = undefined;
|
|
279
|
+
}
|
|
280
|
+
|
|
244
281
|
render() {
|
|
245
282
|
return html`
|
|
246
283
|
${this.method === 'fill' ? html`
|
|
@@ -274,6 +311,7 @@ export default class ZnExpandingAction extends ZincElement {
|
|
|
274
311
|
placement="bottom-end"
|
|
275
312
|
@zn-show="${() => {
|
|
276
313
|
this.open = true;
|
|
314
|
+
this._observePlacement();
|
|
277
315
|
}}"
|
|
278
316
|
@zn-hide="${() => {
|
|
279
317
|
this.open = false;
|
|
@@ -79,24 +79,31 @@
|
|
|
79
79
|
min-width: 300px;
|
|
80
80
|
width: var(--expanding-action-basis, var(--zn-container-smp, 320px));
|
|
81
81
|
max-width: 80vw;
|
|
82
|
-
max-height: min(60vh, var(--expanding-action-max-height, var(--auto-size-available-height, 50vh)));
|
|
83
82
|
background-color: rgb(var(--zn-panel));
|
|
84
83
|
box-shadow: 0 8px 16px -6px rgba(33, 33, 33, 0.18);
|
|
85
84
|
border: solid 1px rgb(var(--zn-border-color));
|
|
86
|
-
border-
|
|
87
|
-
border-radius: 0 0 var(--zn-border-radius) var(--zn-border-radius);
|
|
85
|
+
border-radius: var(--zn-border-radius) 0 var(--zn-border-radius) var(--zn-border-radius);
|
|
88
86
|
padding: 0;
|
|
89
87
|
height: 100%;
|
|
90
|
-
overflow: hidden;
|
|
91
|
-
overflow-y: auto;
|
|
92
88
|
|
|
93
89
|
&::before {
|
|
94
90
|
content: "";
|
|
95
91
|
position: absolute;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
92
|
+
top: -1px;
|
|
93
|
+
left: calc(100% - var(--expanding-action-trigger-width) + 2px); // Works with width of trigger button and borders
|
|
94
|
+
right: 0;
|
|
95
|
+
z-index: 1;
|
|
96
|
+
height: 2px;
|
|
97
|
+
background: rgb(var(--zn-panel));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:host([data-trigger-side="left"]) .expanding-action--drop .expanding-action__content {
|
|
102
|
+
border-radius: 0 var(--zn-border-radius) var(--zn-border-radius) var(--zn-border-radius);
|
|
103
|
+
|
|
104
|
+
&::before {
|
|
105
|
+
left: 0;
|
|
106
|
+
right: calc(100% - var(--expanding-action-trigger-width) + 2px); // Works with width of trigger button and borders
|
|
100
107
|
}
|
|
101
108
|
}
|
|
102
109
|
|
|
@@ -109,6 +116,7 @@
|
|
|
109
116
|
position: absolute;
|
|
110
117
|
inset: 0;
|
|
111
118
|
z-index: -1;
|
|
119
|
+
height: 41px;
|
|
112
120
|
background: rgb(var(--zn-panel));
|
|
113
121
|
border: solid 1px rgb(var(--zn-border-color));
|
|
114
122
|
border-bottom-color: rgb(var(--zn-panel));
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
:host([variant="shell"]) {
|
|
23
23
|
display: flex;
|
|
24
24
|
flex-direction: column;
|
|
25
|
-
gap: var(--zn-spacing-
|
|
26
|
-
padding: var(--zn-spacing-
|
|
25
|
+
gap: var(--zn-spacing-2x-small);
|
|
26
|
+
padding: var(--zn-spacing-2x-small);
|
|
27
27
|
border: 1px solid rgb(var(--zn-border-color));
|
|
28
28
|
border-radius: var(--zn-border-radius);
|
|
29
29
|
min-width: 245px;
|
|
@@ -25,19 +25,18 @@
|
|
|
25
25
|
transform: translateY(-100%);
|
|
26
26
|
|
|
27
27
|
ul.navbar {
|
|
28
|
-
|
|
28
|
+
position: relative;
|
|
29
29
|
|
|
30
30
|
li {
|
|
31
31
|
z-index: 2;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
position: relative;
|
|
35
|
-
|
|
36
34
|
&::after {
|
|
37
35
|
z-index: 1;
|
|
38
36
|
content: "";
|
|
39
37
|
position: absolute;
|
|
40
38
|
inset: 0;
|
|
39
|
+
border-radius: 6px 6px 0 0;
|
|
41
40
|
background-color: rgb(var(--zn-body));
|
|
42
41
|
}
|
|
43
42
|
|
|
@@ -49,7 +48,7 @@
|
|
|
49
48
|
right: -2px;
|
|
50
49
|
left: -2px;
|
|
51
50
|
bottom: 0;
|
|
52
|
-
border-radius:
|
|
51
|
+
border-radius: 10px;
|
|
53
52
|
backdrop-filter: blur(2px) opacity(0.8);
|
|
54
53
|
}
|
|
55
54
|
}
|
|
@@ -249,7 +248,7 @@ ul.navbar.navbar--stacked.navbar--icon-bar {
|
|
|
249
248
|
|
|
250
249
|
:host([icon-only]:not([stacked]):not([icon-bar])) {
|
|
251
250
|
ul.navbar {
|
|
252
|
-
height:
|
|
251
|
+
height: 36px;
|
|
253
252
|
}
|
|
254
253
|
}
|
|
255
254
|
|
|
@@ -277,7 +276,6 @@ ul.navbar.navbar--stacked.navbar--icon-bar {
|
|
|
277
276
|
|
|
278
277
|
&.active, &.zn-tb-active {
|
|
279
278
|
color: var(--zn-text-tab-link-active-color);
|
|
280
|
-
border-bottom: 1px solid rgb(var(--navbar-active-colour));
|
|
281
279
|
}
|
|
282
280
|
}
|
|
283
281
|
|
|
@@ -380,7 +378,7 @@ ul.navbar.navbar--stacked.navbar--icon-bar {
|
|
|
380
378
|
content: '';
|
|
381
379
|
left: 50%;
|
|
382
380
|
right: 50%;
|
|
383
|
-
bottom: -
|
|
381
|
+
bottom: -1px;
|
|
384
382
|
position: absolute;
|
|
385
383
|
background-color: rgb(var(--navbar-active-colour));
|
|
386
384
|
transition: all 300ms ease-in-out;
|
|
@@ -10,8 +10,13 @@ import type {
|
|
|
10
10
|
ValidEventTypeMap,
|
|
11
11
|
ZincEventInit
|
|
12
12
|
} from "./event";
|
|
13
|
+
import type {SignalWatcherApi} from "@lit-labs/signals";
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
type Constructor<T = NonNullable<unknown>> = new (...args: any[]) => T;
|
|
16
|
+
|
|
17
|
+
const ZincElementBase: typeof LitElement & Constructor<SignalWatcherApi> = SignalWatcher(LitElement);
|
|
18
|
+
|
|
19
|
+
export default class ZincElement extends ZincElementBase {
|
|
15
20
|
@property() dir: string; // LTR or RTL direction
|
|
16
21
|
@property() lang: string; // Language
|
|
17
22
|
@property({reflect: true}) t: string; // Theme (light or dark)
|