overview-components 1.0.76 → 1.0.77

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.
@@ -0,0 +1,86 @@
1
+ import { customElement as c } from "../node_modules/@lit/reactive-element/decorators/custom-element.js";
2
+ import { property as d } from "../node_modules/@lit/reactive-element/decorators/property.js";
3
+ import "../node_modules/@lit/reactive-element/reactive-element.js";
4
+ import { html as a } from "../node_modules/lit-html/lit-html.js";
5
+ import { LitElement as m } from "../node_modules/lit-element/lit-element.js";
6
+ import { css as u } from "../node_modules/@lit/reactive-element/css-tag.js";
7
+ var f = Object.defineProperty, h = Object.getOwnPropertyDescriptor, p = (t, r, o, s) => {
8
+ for (var i = s > 1 ? void 0 : s ? h(r, o) : r, n = t.length - 1, l; n >= 0; n--)
9
+ (l = t[n]) && (i = (s ? l(r, o, i) : l(i)) || i);
10
+ return s && i && f(r, o, i), i;
11
+ };
12
+ let e = class extends m {
13
+ constructor() {
14
+ super(...arguments), this.loading = !1;
15
+ }
16
+ render() {
17
+ const t = this.count !== void 0 && this.count !== null && this.count >= 0, r = this.loading, o = this.count && this.count < 100 ? this.count : "99+";
18
+ return t || r ? a`
19
+ <div class="pill--wrapper">
20
+ ${t ? a` <div class="pill">${o}</div> ` : ""}
21
+ ${r ? a` <div class="pill__loading-spinner"></div> ` : ""}
22
+ </div>
23
+ ` : null;
24
+ }
25
+ };
26
+ e.styles = [
27
+ // styles,
28
+ u`
29
+ .pill--wrapper {
30
+ display: flex;
31
+ justify-content: center;
32
+ align-items: center;
33
+ height: 20px;
34
+ min-width: 20px;
35
+ background-color: var(--color-success-main, #76b703);
36
+ border-radius: 50px;
37
+ }
38
+
39
+ .pill {
40
+ padding: 0 0.375rem;
41
+ font-size: 0.6875rem;
42
+ font-weight: 600;
43
+ color: white;
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ white-space: nowrap;
48
+ transition: background-color 0.3s ease;
49
+ }
50
+
51
+ .pill:disabled {
52
+ background-color: var(--color-primary-disabled, #d0d3db);
53
+ }
54
+
55
+ .pill__loading-spinner {
56
+ width: 20px;
57
+ height: 20px;
58
+ border: 2px solid var(--color-divider, #d0d3db);
59
+ border-top: 2px solid var(--color-primary-main, #76b703);
60
+ border-radius: 50%;
61
+ animation: spin 1s linear infinite;
62
+ position: absolute;
63
+ }
64
+
65
+ @keyframes spin {
66
+ 0% {
67
+ transform: rotate(0deg);
68
+ }
69
+ 100% {
70
+ transform: rotate(360deg);
71
+ }
72
+ }
73
+ `
74
+ ];
75
+ p([
76
+ d({ type: Number })
77
+ ], e.prototype, "count", 2);
78
+ p([
79
+ d({ type: Boolean })
80
+ ], e.prototype, "loading", 2);
81
+ e = p([
82
+ c("lit-pill")
83
+ ], e);
84
+ export {
85
+ e as LitPill
86
+ };
@@ -0,0 +1,339 @@
1
+ import "../node_modules/@lit/reactive-element/reactive-element.js";
2
+ import { html as c } from "../node_modules/lit-html/lit-html.js";
3
+ import { LitElement as d } from "../node_modules/lit-element/lit-element.js";
4
+ import { msg as m } from "../node_modules/@lit/localize/init/install.js";
5
+ import "../node_modules/@lit/localize/init/runtime.js";
6
+ import { classMap as u } from "../node_modules/lit-html/directives/class-map.js";
7
+ import { customElement as y } from "../node_modules/@lit/reactive-element/decorators/custom-element.js";
8
+ import { property as l } from "../node_modules/@lit/reactive-element/decorators/property.js";
9
+ import { state as h } from "../node_modules/@lit/reactive-element/decorators/state.js";
10
+ import { query as f } from "../node_modules/@lit/reactive-element/decorators/query.js";
11
+ import { css as v } from "../node_modules/@lit/reactive-element/css-tag.js";
12
+ var b = Object.defineProperty, g = Object.getOwnPropertyDescriptor, o = (e, t, r, n) => {
13
+ for (var i = n > 1 ? void 0 : n ? g(t, r) : t, a = e.length - 1, p; a >= 0; a--)
14
+ (p = e[a]) && (i = (n ? p(t, r, i) : p(i)) || i);
15
+ return n && i && b(t, r, i), i;
16
+ };
17
+ let s = class extends d {
18
+ constructor() {
19
+ super(...arguments), this.id = "", this.value = "", this.options = [], this.onChange = () => {
20
+ }, this.multiple = !1, this.disableClearButton = !1, this.disabled = !1, this.server = !1, this.setOperator = (e) => {
21
+ }, this.filterOperators = [], this.isOpen = !1, this.searchQuery = null, this.selectedIndex = -1, this.typeBuffer = "", this.typeTimeout = null, this.handleOutsideClick = (e) => {
22
+ const t = e.composedPath();
23
+ !t.includes(this) && !t.some(
24
+ (r) => r instanceof HTMLElement && r.tagName === "SIMPLE-POPPER"
25
+ ) && this.closePopover();
26
+ };
27
+ }
28
+ connectedCallback() {
29
+ super.connectedCallback(), this.addEventListener("focus", () => this.focus()), document.addEventListener("click", this.handleOutsideClick);
30
+ }
31
+ disconnectedCallback() {
32
+ super.disconnectedCallback(), this.removeEventListener("focus", () => this.focus()), document.removeEventListener("click", this.handleOutsideClick), this.closePopover();
33
+ }
34
+ firstUpdated() {
35
+ this.server && this.multiple && this.setOperator("isAnyOfValue");
36
+ }
37
+ async toggleCustomPopover() {
38
+ var e;
39
+ if (this.isOpen = !this.isOpen, !this.multiple) {
40
+ await this.updateComplete;
41
+ const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("input");
42
+ this.selectedIndex = this.options.findIndex((r) => r.value === this.value), t && (t.focus(), t.select(), this.scrollToVisible());
43
+ }
44
+ }
45
+ scrollToVisible() {
46
+ const e = document.getElementById(`${this.id}-${this.selectedIndex}`);
47
+ e == null || e.scrollIntoView({ block: "center" });
48
+ }
49
+ closePopover() {
50
+ this.isOpen = !1, this.searchQuery = null, this.selectedIndex = -1;
51
+ }
52
+ selectOption(e) {
53
+ if (this.selectedIndex = this.options.findIndex((t) => t.value === e), this.multiple)
54
+ if (Array.isArray(this.value) && this.value.includes(e))
55
+ this.value = this.value.filter((t) => t !== e), this.onChange(this.value);
56
+ else {
57
+ const t = [...this.value, e];
58
+ this.value = t, this.onChange(this.value), this.searchQuery = null;
59
+ }
60
+ else
61
+ this.value = String(e), this.onChange(this.value), this.closePopover();
62
+ }
63
+ clearValue(e) {
64
+ e.stopPropagation(), this.value = [], this.onChange([]), this.searchQuery = null;
65
+ }
66
+ handleInput(e) {
67
+ this.searchQuery = e.target.value, this.isOpen = !0, this.selectedIndex = -1;
68
+ }
69
+ getFilteredOptions() {
70
+ return this.searchQuery ? this.options.filter(
71
+ (e) => {
72
+ var t, r;
73
+ return ((r = e.label) == null ? void 0 : r.toLowerCase().includes(((t = this.searchQuery) == null ? void 0 : t.toLowerCase()) || "")) && (!this.multiple || !this.value.includes(e.value));
74
+ }
75
+ ) : this.options;
76
+ }
77
+ async handleKeyDown(e) {
78
+ if (e.key === "Tab" || e.key === "Escape")
79
+ this.closePopover();
80
+ else if (e.key === "ArrowDown")
81
+ e.preventDefault(), this.isOpen ? this.selectedIndex = Math.min(
82
+ this.selectedIndex + 1,
83
+ this.getFilteredOptions().length - 1
84
+ ) : this.toggleCustomPopover();
85
+ else if (e.key === "ArrowUp")
86
+ e.preventDefault(), this.isOpen || this.toggleCustomPopover(), this.selectedIndex = Math.max(this.selectedIndex - 1, 0);
87
+ else if (e.key === "Enter")
88
+ this.selectedIndex >= 0 && this.selectOption(this.getFilteredOptions()[this.selectedIndex].value);
89
+ else if (/^[a-z0-9]$/i.test(e.key)) {
90
+ this.typeBuffer += e.key.toLowerCase(), this.typeTimeout && clearTimeout(this.typeTimeout), this.typeTimeout = window.setTimeout(() => {
91
+ this.typeBuffer = "";
92
+ }, 500);
93
+ const t = this.options.findIndex(
94
+ (r) => {
95
+ var n;
96
+ return (n = r.label) == null ? void 0 : n.toLowerCase().startsWith(this.typeBuffer);
97
+ }
98
+ );
99
+ t !== -1 && (this.selectedIndex = t);
100
+ }
101
+ this.scrollToVisible(), this.requestUpdate();
102
+ }
103
+ focus() {
104
+ var t;
105
+ const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("input");
106
+ e == null || e.focus();
107
+ }
108
+ _isTrulyEmpty(e) {
109
+ return e == null ? !0 : typeof e == "string" || Array.isArray(e) ? e.length === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1;
110
+ }
111
+ render() {
112
+ var n;
113
+ const e = this.multiple ? this.options : this.getFilteredOptions(), t = {
114
+ "dropdown-icon": !0,
115
+ "dropdown-icon--rotate": this.isOpen,
116
+ "dropdown-icon--no-filter": !this.server || this.server && this.multiple
117
+ }, r = this._isTrulyEmpty(this.value) ? "" : Array.isArray(this.value) ? this.value.map((i) => {
118
+ var a;
119
+ return ((a = this.options.find((p) => p.value == i)) == null ? void 0 : a.label) || i;
120
+ }).join(", ") : ((n = this.options.find((i) => i.value == this.value)) == null ? void 0 : n.label) || "";
121
+ return c`
122
+ <div class="custom-icon-wrapper" slot="reference">
123
+ <input
124
+ ?readonly=${this.multiple}
125
+ type="text"
126
+ .value="${this.searchQuery ?? r ?? ""}"
127
+ @input=${this.handleInput}
128
+ @click="${this.toggleCustomPopover}"
129
+ @keydown=${this.handleKeyDown}
130
+ .disabled="${this.disabled}"
131
+ />
132
+ ${!this._isTrulyEmpty(this.value) && !this.disableClearButton ? c`
133
+ <div
134
+ class=${u({
135
+ "custom-icon": !0,
136
+ "custom-icon--no-filter": !this.server || this.server && this.multiple
137
+ // Trieda ak filter nie je
138
+ })}
139
+ @click="${this.clearValue}"
140
+ >
141
+ <lit-icon-button
142
+ icon="close"
143
+ size="small"
144
+ variant="text"
145
+ ></lit-icon-button>
146
+ </div>
147
+ ` : ""}
148
+ <div class="${u(t)}">
149
+ <lit-icon
150
+ class="${this.disabled ? "dropdown-icon-disabled" : null}"
151
+ icon="chevrondown"
152
+ size="17px"
153
+ ></lit-icon>
154
+ </div>
155
+ ${this.server && !this.multiple ? c`<lit-data-grid-operators-popover
156
+ class="filter-icon"
157
+ .type="${this.multiple ? "multiselect" : "select"}"
158
+ .setOperator="${(i) => {
159
+ this.setOperator(i);
160
+ }}"
161
+ .operator="${this.operator}"
162
+ .disabled="${this.disabled}"
163
+ .filterOperators="${this.filterOperators}"
164
+ ></lit-data-grid-operators-popover>` : null}
165
+ </div>
166
+ <simple-popper
167
+ .showing=${this.isOpen}
168
+ placement="bottom-start"
169
+ @close="${this.closePopover}"
170
+ manualOpening=${!0}
171
+ maxWidthAsTarget=${!0}
172
+ @keydown=${this.handleKeyDown}
173
+ >
174
+ <lit-menu tabindex="0" id="menu">
175
+ ${(e == null ? void 0 : e.length) === 0 ? c`<lit-menu-item disabledButtons=${!0}>
176
+ ${m("Nenalezeno")}</lit-menu-item
177
+ > ` : e == null ? void 0 : e.map((i, a) => {
178
+ const p = Array.isArray(this.value) ? this.value.includes(i.value) : this.value === i.value;
179
+ return c`
180
+ <lit-menu-item
181
+ id="${this.id}-${a}"
182
+ .isActive=${this.selectedIndex === a || p && !this.multiple}
183
+ .onClick="${() => this.selectOption(i.value)}"
184
+ >
185
+ <span class="menu-item--multiple">
186
+ ${this.multiple ? c`<lit-checkbox
187
+ class="cursor"
188
+ .checked=${p}
189
+ ></lit-checkbox>` : ""}
190
+ ${i.label}
191
+ </span>
192
+ </lit-menu-item>
193
+ `;
194
+ })}
195
+ </lit-menu>
196
+ </simple-popper>
197
+ `;
198
+ }
199
+ };
200
+ s.styles = v`
201
+ .custom-icon-wrapper {
202
+ position: relative;
203
+ width: 100%;
204
+ display: inline-block;
205
+ color: var(--text-primary, #111827);
206
+ }
207
+
208
+ input {
209
+ padding: 0.5rem;
210
+ border: 0.0625rem solid var(--color-divider, #d0d3db);
211
+ border-radius: 0.25rem;
212
+ min-width: 70px;
213
+ width: -webkit-fill-available;
214
+ width: -moz-available;
215
+ width: fill-available;
216
+ background-color: var(--background-paper, #fff);
217
+ color: var(--text-primary, #111827);
218
+ }
219
+
220
+ input:hover {
221
+ border: 0.0625rem solid var(--color-secondary-main, #111827);
222
+ cursor: pointer;
223
+ }
224
+
225
+ input:disabled {
226
+ cursor: inherit;
227
+ }
228
+
229
+ input:focus {
230
+ outline: none;
231
+ border: 0.0625rem solid var(--color-secondary-dark, #010204);
232
+ }
233
+
234
+ .custom-icon-wrapper:hover .custom-icon {
235
+ display: inline-block;
236
+ }
237
+
238
+ .custom-icon-wrapper .custom-icon {
239
+ display: none;
240
+ position: absolute;
241
+ right: 51px;
242
+ top: 50%;
243
+ transform: translateY(-50%);
244
+ cursor: pointer;
245
+ pointer-events: auto;
246
+ }
247
+
248
+ .custom-icon-wrapper .custom-icon--no-filter {
249
+ right: 27px;
250
+ }
251
+
252
+ .custom-icon-wrapper .filter-icon {
253
+ display: block;
254
+ position: absolute;
255
+ right: 10px;
256
+ top: 50%;
257
+ transform: translateY(-50%);
258
+ cursor: pointer;
259
+ pointer-events: auto;
260
+ }
261
+
262
+ .custom-icon-wrapper .dropdown-icon {
263
+ position: absolute;
264
+ right: 34px;
265
+ top: 50%;
266
+ transform: translateY(-50%);
267
+ pointer-events: none;
268
+ }
269
+
270
+ .custom-icon-wrapper .dropdown-icon--no-filter {
271
+ right: 10px;
272
+ }
273
+
274
+ .custom-icon-wrapper .dropdown-icon--rotate {
275
+ transform: translateY(-55%) rotate(180deg);
276
+ }
277
+
278
+ .dropdown-icon-disabled {
279
+ background: #f8f8f8;
280
+ color: #5d6371;
281
+ }
282
+
283
+ .menu-item--multiple {
284
+ display: flex;
285
+ align-items: center;
286
+ }
287
+ `;
288
+ o([
289
+ l({ type: String })
290
+ ], s.prototype, "id", 2);
291
+ o([
292
+ l({ type: Array })
293
+ ], s.prototype, "value", 2);
294
+ o([
295
+ l({ type: Array })
296
+ ], s.prototype, "options", 2);
297
+ o([
298
+ l({ type: Function })
299
+ ], s.prototype, "onChange", 2);
300
+ o([
301
+ l({ type: Boolean })
302
+ ], s.prototype, "multiple", 2);
303
+ o([
304
+ l({ type: Boolean })
305
+ ], s.prototype, "disableClearButton", 2);
306
+ o([
307
+ l({ type: Boolean })
308
+ ], s.prototype, "disabled", 2);
309
+ o([
310
+ l({ type: Boolean })
311
+ ], s.prototype, "server", 2);
312
+ o([
313
+ l({ type: String })
314
+ ], s.prototype, "operator", 2);
315
+ o([
316
+ l({ type: Function })
317
+ ], s.prototype, "setOperator", 2);
318
+ o([
319
+ l({ type: Array })
320
+ ], s.prototype, "filterOperators", 2);
321
+ o([
322
+ l({ reflect: !0, type: Boolean }),
323
+ h()
324
+ ], s.prototype, "isOpen", 2);
325
+ o([
326
+ h()
327
+ ], s.prototype, "searchQuery", 2);
328
+ o([
329
+ h()
330
+ ], s.prototype, "selectedIndex", 2);
331
+ o([
332
+ f("#menu")
333
+ ], s.prototype, "menu", 2);
334
+ s = o([
335
+ y("lit-select")
336
+ ], s);
337
+ export {
338
+ s as LitSelect
339
+ };
@@ -0,0 +1,137 @@
1
+ import "../node_modules/@lit/reactive-element/reactive-element.js";
2
+ import { html as c } from "../node_modules/lit-html/lit-html.js";
3
+ import { LitElement as f } from "../node_modules/lit-element/lit-element.js";
4
+ import { customElement as g } from "../node_modules/@lit/reactive-element/decorators/custom-element.js";
5
+ import { property as v } from "../node_modules/@lit/reactive-element/decorators/property.js";
6
+ import { query as h } from "../node_modules/@lit/reactive-element/decorators/query.js";
7
+ import { autoUpdate as T, computePosition as w, offset as x, flip as y, shift as b, arrow as H } from "../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
8
+ import { css as E } from "../node_modules/@lit/reactive-element/css-tag.js";
9
+ var L = Object.defineProperty, S = Object.getOwnPropertyDescriptor, n = (e, t, i, s) => {
10
+ for (var o = s > 1 ? void 0 : s ? S(t, i) : t, a = e.length - 1, l; a >= 0; a--)
11
+ (l = e[a]) && (o = (s ? l(t, i, o) : l(o)) || o);
12
+ return s && o && L(t, i, o), o;
13
+ };
14
+ let r = class extends f {
15
+ constructor() {
16
+ super(...arguments), this.placement = "top", this.cleanup = null, this.isHoveringTrigger = !1, this.isHoveringTooltip = !1, this.hideTimeout = null;
17
+ }
18
+ firstUpdated() {
19
+ const e = this.triggerSlot.assignedElements()[0], t = this.tooltipSlot.assignedElements()[0];
20
+ !e || !t || (e.addEventListener("mouseenter", () => {
21
+ this.isHoveringTrigger = !0, this.clearHideTimeout(), this.showTooltip(e, t);
22
+ }), e.addEventListener("mouseleave", () => {
23
+ this.isHoveringTrigger = !1, this.startHideTimeout();
24
+ }), e.addEventListener("focus", () => this.showTooltip(e, t)), e.addEventListener("blur", () => this.hideTooltip(t)), e.addEventListener("keydown", (i) => {
25
+ i.key === "Escape" && this.hideTooltip(t);
26
+ }), t.addEventListener("mouseenter", () => {
27
+ this.isHoveringTooltip = !0, this.clearHideTimeout();
28
+ }), t.addEventListener("mouseleave", () => {
29
+ this.isHoveringTooltip = !1, this.startHideTimeout();
30
+ }));
31
+ }
32
+ startHideTimeout() {
33
+ this.clearHideTimeout(), this.hideTimeout = window.setTimeout(() => {
34
+ if (!this.isHoveringTrigger && !this.isHoveringTooltip) {
35
+ const e = this.tooltipSlot.assignedElements()[0];
36
+ e && this.hideTooltip(e);
37
+ }
38
+ }, 200);
39
+ }
40
+ clearHideTimeout() {
41
+ this.hideTimeout !== null && (clearTimeout(this.hideTimeout), this.hideTimeout = null);
42
+ }
43
+ async showTooltip(e, t) {
44
+ t.setAttribute("data-visible", "");
45
+ let i = t.querySelector(".arrow");
46
+ i || (i = document.createElement("div"), i.classList.add("arrow"), t.appendChild(i)), this.cleanup = T(e, t, async () => {
47
+ const s = await w(e, t, {
48
+ placement: this.placement,
49
+ middleware: [x(8), y(), b({ padding: 5 }), H({ element: i })]
50
+ }), { x: o, y: a, placement: l, middlewareData: u } = s, { arrow: p } = u;
51
+ if (Object.assign(t.style, {
52
+ left: `${o}px`,
53
+ top: `${a}px`
54
+ }), p) {
55
+ const { x: d, y: m } = p;
56
+ Object.assign(i.style, {
57
+ left: d != null ? `${d}px` : "",
58
+ top: m != null ? `${m}px` : ""
59
+ });
60
+ }
61
+ i.setAttribute("data-placement", l);
62
+ });
63
+ }
64
+ hideTooltip(e) {
65
+ var t;
66
+ e.removeAttribute("data-visible"), (t = this.cleanup) == null || t.call(this), this.cleanup = null;
67
+ }
68
+ render() {
69
+ return c`
70
+ <slot name="trigger"></slot>
71
+ <slot name="tooltip"></slot>
72
+ `;
73
+ }
74
+ };
75
+ r.styles = E`
76
+ :host {
77
+ position: relative;
78
+ display: inline-block;
79
+ }
80
+
81
+ ::slotted([slot='tooltip']) {
82
+ position: absolute;
83
+ z-index: 9999;
84
+ background: #111;
85
+ color: #fff;
86
+ padding: 6px 10px;
87
+ border-radius: 4px;
88
+ font-size: 12px;
89
+ opacity: 0;
90
+ transition: opacity 0.2s ease;
91
+ pointer-events: none;
92
+ }
93
+
94
+ ::slotted([slot='tooltip'][data-visible]) {
95
+ opacity: 1;
96
+ pointer-events: auto;
97
+ }
98
+
99
+ .arrow {
100
+ position: absolute;
101
+ width: 8px;
102
+ height: 8px;
103
+ background: inherit;
104
+ transform: rotate(45deg);
105
+ }
106
+
107
+ .arrow[data-placement^='top'] {
108
+ bottom: -4px;
109
+ }
110
+
111
+ .arrow[data-placement^='bottom'] {
112
+ top: -4px;
113
+ }
114
+
115
+ .arrow[data-placement^='left'] {
116
+ right: -4px;
117
+ }
118
+
119
+ .arrow[data-placement^='right'] {
120
+ left: -4px;
121
+ }
122
+ `;
123
+ n([
124
+ v({ type: String })
125
+ ], r.prototype, "placement", 2);
126
+ n([
127
+ h('slot[name="trigger"]')
128
+ ], r.prototype, "triggerSlot", 2);
129
+ n([
130
+ h('slot[name="tooltip"]')
131
+ ], r.prototype, "tooltipSlot", 2);
132
+ r = n([
133
+ g("perf-tooltip")
134
+ ], r);
135
+ export {
136
+ r as PerfTooltip
137
+ };