overview-components 1.0.78 → 1.0.79

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.
Files changed (49) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +6 -2
  2. package/dist/_virtual/air-datepicker.js +4 -0
  3. package/dist/index.d.ts +56 -11
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +105 -53
  6. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +285 -231
  7. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +48 -47
  8. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +39 -38
  9. package/dist/node_modules/air-datepicker/air-datepicker.js +1147 -0
  10. package/dist/node_modules/air-datepicker/index.es.js +4 -0
  11. package/dist/shared/filter-inputs.js +326 -0
  12. package/dist/shared/lit-case-variables-tab-cell.js +207 -0
  13. package/dist/shared/lit-custom-popper.js +99 -0
  14. package/dist/shared/lit-data-grid-action-buttons-popover.js +258 -0
  15. package/dist/shared/lit-data-grid-density-popover.js +79 -0
  16. package/dist/shared/lit-data-grid-export-popover.js +66 -0
  17. package/dist/shared/lit-data-grid-operators-popover.js +94 -0
  18. package/dist/shared/lit-data-grid-row-actions.js +73 -0
  19. package/dist/shared/lit-date-picker.js +525 -0
  20. package/dist/shared/lit-icon-button.d.ts +1 -1
  21. package/dist/shared/lit-icon-button.d.ts.map +1 -1
  22. package/dist/shared/lit-icon-button.js +91 -0
  23. package/dist/shared/lit-label.js +96 -0
  24. package/dist/shared/lit-loader.d.ts +1 -1
  25. package/dist/shared/lit-loader.d.ts.map +1 -1
  26. package/dist/shared/lit-loader.js +70 -0
  27. package/dist/shared/lit-loading-bar.d.ts +1 -1
  28. package/dist/shared/lit-loading-bar.d.ts.map +1 -1
  29. package/dist/shared/lit-loading-bar.js +94 -0
  30. package/dist/shared/lit-menu-item.d.ts +1 -1
  31. package/dist/shared/lit-menu-item.d.ts.map +1 -1
  32. package/dist/shared/lit-menu-item.js +94 -0
  33. package/dist/shared/lit-modal-body.js +28 -0
  34. package/dist/shared/lit-modal-footer.js +32 -0
  35. package/dist/shared/lit-modal-header.js +39 -0
  36. package/dist/shared/lit-overflow-tooltip.js +85 -0
  37. package/dist/shared/lit-responsive-button.js +84 -0
  38. package/dist/shared/lit-select-field.js +376 -0
  39. package/dist/shared/lit-settings.js +60 -0
  40. package/dist/shared/lit-text-field.d.ts +1 -1
  41. package/dist/shared/lit-text-field.d.ts.map +1 -1
  42. package/dist/shared/lit-text-field.js +205 -0
  43. package/dist/shared/lit-toggle.js +213 -0
  44. package/dist/shared/simple-popper.js +186 -0
  45. package/dist/shared/simple-tooltip.js +1 -1
  46. package/dist/style.css +1 -0
  47. package/dist/utils/localization.js +410 -25
  48. package/dist/utils/utils.js +11 -0
  49. package/package.json +1 -1
@@ -0,0 +1,376 @@
1
+ import "../node_modules/@lit/reactive-element/reactive-element.js";
2
+ import { html as n } from "../node_modules/lit-html/lit-html.js";
3
+ import { LitElement as c } from "../node_modules/lit-element/lit-element.js";
4
+ import { computePosition as u, autoUpdate as m, offset as g, flip as b, shift as f } from "../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
5
+ import { customElement as v } from "../node_modules/@lit/reactive-element/decorators/custom-element.js";
6
+ import { property as l } from "../node_modules/@lit/reactive-element/decorators/property.js";
7
+ import { query as p } from "../node_modules/@lit/reactive-element/decorators/query.js";
8
+ import { css as y } from "../node_modules/@lit/reactive-element/css-tag.js";
9
+ var x = Object.defineProperty, w = Object.getOwnPropertyDescriptor, r = (e, t, a, i) => {
10
+ for (var s = i > 1 ? void 0 : i ? w(t, a) : t, d = e.length - 1, h; d >= 0; d--)
11
+ (h = e[d]) && (s = (i ? h(t, a, s) : h(s)) || s);
12
+ return i && s && x(t, a, s), s;
13
+ };
14
+ let o = class extends c {
15
+ constructor() {
16
+ super(...arguments), this.label = "", this.value = "", this.disabled = !1, this.error = !1, this.required = !1, this.helperText = "", this.size = "medium", this.placeholder = "", this.options = [], this.open = !1, this.highlighted = -1, this.typedFilter = "", this.onDocumentClick = (e) => {
17
+ this.open && (this.contains(e.target) || this.closeDropdown());
18
+ };
19
+ }
20
+ updated(e) {
21
+ var t;
22
+ e.has("open") && (this.open ? (this.positionDropdown(), this.listenFloating()) : ((t = this.cleanupFloating) == null || t.call(this), this.cleanupFloating = void 0));
23
+ }
24
+ async positionDropdown() {
25
+ !this.anchorEl || !this.menuEl || await u(this.anchorEl, this.menuEl, {
26
+ middleware: [g(4), b(), f()],
27
+ placement: "bottom-start"
28
+ }).then(({ x: e, y: t }) => {
29
+ Object.assign(this.menuEl.style, {
30
+ left: `${e}px`,
31
+ top: `${t}px`
32
+ });
33
+ });
34
+ }
35
+ listenFloating() {
36
+ this.anchorEl && this.menuEl && (this.cleanupFloating = m(
37
+ this.anchorEl,
38
+ this.menuEl,
39
+ () => this.positionDropdown()
40
+ ));
41
+ }
42
+ toggleDropdown() {
43
+ this.disabled || (this.open ? this.closeDropdown() : this.openDropdown());
44
+ }
45
+ openDropdown() {
46
+ this.disabled || this.open || (this.open = !0, this.highlighted = this.options.findIndex((e) => e.value === this.value), setTimeout(() => {
47
+ var e;
48
+ return (e = this.menuEl) == null ? void 0 : e.focus();
49
+ }, 0), document.addEventListener("mousedown", this.onDocumentClick));
50
+ }
51
+ closeDropdown() {
52
+ this.open && (this.open = !1, this.typedFilter = "", document.removeEventListener("mousedown", this.onDocumentClick));
53
+ }
54
+ onSelect(e) {
55
+ var t;
56
+ (t = this.options[e]) != null && t.disabled || (this.value = this.options[e].value, this.dispatchEvent(new CustomEvent("onChange", { detail: this.value })), this.closeDropdown());
57
+ }
58
+ onKeyDown(e) {
59
+ var a, i;
60
+ if (!this.open) return;
61
+ if (e.key.length === 1 && // character keys only
62
+ !e.ctrlKey && !e.metaKey && !e.altKey) {
63
+ this.typedFilter += e.key, clearTimeout(this.typedTimer), this.typedTimer = window.setTimeout(() => this.typedFilter = "", 500);
64
+ const s = this.options.findIndex(
65
+ (d) => !d.disabled && d.label.toLowerCase().includes(this.typedFilter.toLowerCase())
66
+ );
67
+ s !== -1 && (this.highlighted = s, this.scrollIntoView());
68
+ return;
69
+ }
70
+ const t = this.options.length;
71
+ if (["ArrowDown", "ArrowUp", "Home", "End", "Enter", "Escape"].includes(e.key) && e.preventDefault(), e.key === "ArrowDown") {
72
+ do
73
+ this.highlighted = (this.highlighted + 1) % t;
74
+ while ((a = this.options[this.highlighted]) != null && a.disabled);
75
+ this.scrollOptionIntoView();
76
+ } else if (e.key === "ArrowUp") {
77
+ do
78
+ this.highlighted = (this.highlighted - 1 + t) % t;
79
+ while ((i = this.options[this.highlighted]) != null && i.disabled);
80
+ this.scrollOptionIntoView();
81
+ } else e.key === "Home" ? (this.highlighted = 0, this.scrollOptionIntoView()) : e.key === "End" ? (this.highlighted = t - 1, this.scrollOptionIntoView()) : e.key === "Enter" ? this.highlighted >= 0 && this.onSelect(this.highlighted) : e.key === "Escape" && this.closeDropdown();
82
+ }
83
+ scrollOptionIntoView() {
84
+ var t;
85
+ const e = (t = this.menuEl) == null ? void 0 : t.querySelectorAll(".option")[this.highlighted];
86
+ e && e.scrollIntoView({ block: "nearest" });
87
+ }
88
+ onBlur(e) {
89
+ const t = e.relatedTarget;
90
+ this.contains(t) || this.closeDropdown();
91
+ }
92
+ onClear(e) {
93
+ e.stopPropagation(), this.value = "", this.dispatchEvent(new CustomEvent("onChange", { detail: "" }));
94
+ }
95
+ render() {
96
+ const e = [
97
+ "select-box",
98
+ this.size,
99
+ this.error ? "error" : "",
100
+ this.disabled ? "disabled" : ""
101
+ ].join(" "), t = ["helper-text", this.error ? "error" : ""].join(" "), a = this.options.find((i) => i.value === this.value);
102
+ return n`
103
+ <div class="container">
104
+ ${this.label ? n`
105
+ <lit-label
106
+ label="${this.label}"
107
+ .tooltip=${this.tooltip}
108
+ ?disabled=${this.disabled}
109
+ ?error=${this.error}
110
+ ?required=${this.required}
111
+ >
112
+ </lit-label>
113
+ ` : ""}
114
+ <div class="input-wrap">
115
+ <div
116
+ class="${e} dropdown-anchor"
117
+ tabindex=${this.disabled ? -1 : 0}
118
+ aria-disabled=${this.disabled ? "true" : "false"}
119
+ aria-invalid=${this.error ? "true" : "false"}
120
+ aria-expanded=${this.open ? "true" : "false"}
121
+ aria-haspopup="listbox"
122
+ @click=${() => this.toggleDropdown()}
123
+ @keydown=${(i) => this.onKeyDown(i)}
124
+ >
125
+ <span class="selected">
126
+ ${a ? a.label : n`<span class="placeholder"
127
+ >${this.placeholder || "Select..."}</span
128
+ >`}
129
+ </span>
130
+ ${this.value && !this.disabled ? n`
131
+ <lit-icon-button
132
+ tabindex="0"
133
+ icon="close"
134
+ variant="text"
135
+ size="small"
136
+ aria-label="Clear"
137
+ @click=${this.onClear}
138
+ @mousedown=${(i) => i.stopPropagation()}
139
+ >
140
+ </lit-icon-button>
141
+ ` : null}
142
+ <span class="chevron ${this.open ? "open" : ""}">
143
+ <lit-icon icon="chevronDownFilled" size="1.2em"></lit-icon>
144
+ </span>
145
+ </div>
146
+ ${this.open ? n`
147
+ <div
148
+ class="dropdown-menu"
149
+ tabindex="0"
150
+ @keydown=${(i) => this.onKeyDown(i)}
151
+ role="listbox"
152
+ style="left:0;top:0;"
153
+ >
154
+ ${this.options.length === 0 ? n`<div class="option disabled">No options</div>` : this.options.map(
155
+ (i, s) => n`
156
+ <div
157
+ class="option
158
+ ${i.value === this.value ? "selected" : ""}
159
+ ${s === this.highlighted ? "highlighted" : ""}
160
+ ${i.disabled ? "disabled" : ""}
161
+ "
162
+ role="option"
163
+ aria-selected=${i.value === this.value}
164
+ @mousedown=${() => !i.disabled && this.onSelect(s)}
165
+ @mouseenter=${() => this.highlighted = s}
166
+ tabindex="-1"
167
+ >
168
+ ${i.label}
169
+ </div>
170
+ `
171
+ )}
172
+ </div>
173
+ ` : ""}
174
+ </div>
175
+ ${this.helperText && this.error ? n`
176
+ <div class="${t}">
177
+ <lit-icon
178
+ icon="dangerFilled"
179
+ size="1.125rem"
180
+ style="padding-top: 2px"
181
+ ></lit-icon>
182
+ <span>${this.helperText}</span>
183
+ </div>
184
+ ` : this.helperText ? n`<div class="${t}">${this.helperText}</div>` : n`<div class="helper-text">&nbsp;</div>`}
185
+ </div>
186
+ `;
187
+ }
188
+ };
189
+ o.styles = y`
190
+ :host {
191
+ display: block;
192
+ font-family: inherit;
193
+ }
194
+ .container {
195
+ display: flex;
196
+ flex-direction: column;
197
+ }
198
+ .input-wrap {
199
+ position: relative;
200
+ display: flex;
201
+ align-items: center;
202
+ }
203
+ .select-box {
204
+ width: 100%;
205
+ border: 1px solid var(--border-color, #d0d3db);
206
+ border-radius: var(--border-radius-small, 0.25rem);
207
+ background: var(--background-paper, #fff);
208
+ color: var(--text-primary, #111);
209
+ padding: 0.625rem 0.875rem;
210
+ font-size: 0.875rem;
211
+ outline: none;
212
+ transition:
213
+ border-color 0.2s,
214
+ background 0.2s,
215
+ color 0.2s;
216
+ display: flex;
217
+ align-items: center;
218
+ cursor: pointer;
219
+ // min-height: 40px;
220
+ position: relative;
221
+ gap: 0.5rem;
222
+ user-select: none;
223
+ }
224
+ .select-box:hover:not(.disabled) {
225
+ border-color: var(--text-primary, #76b703);
226
+ }
227
+ .select-box.small {
228
+ font-size: 0.875rem;
229
+ padding: 8px 12px;
230
+ min-height: 32px;
231
+ }
232
+ .select-box.large {
233
+ font-size: 1.125rem;
234
+ padding: 12px 16px;
235
+ min-height: 48px;
236
+ }
237
+ .select-box.error {
238
+ border-color: var(--color-error-main, #d32f2f);
239
+ }
240
+ .select-box.disabled {
241
+ background: var(--background-paper, #fff);
242
+ border: 1px dashed var(--border-color, #d0d3db);
243
+ color: var(--border-color, #d0d3db);
244
+ cursor: not-allowed;
245
+ }
246
+ .select-box:focus-visible {
247
+ border-color: var(--text-primary, #111827);
248
+ }
249
+ .chevron {
250
+ margin-left: auto;
251
+ transition: transform 0.2s;
252
+ display: flex;
253
+ }
254
+ .chevron.open {
255
+ transform: rotate(180deg);
256
+ }
257
+ .selected {
258
+ flex: 1 1 0%;
259
+ white-space: nowrap;
260
+ text-overflow: ellipsis;
261
+ }
262
+ .placeholder {
263
+ color: #aaa;
264
+ }
265
+
266
+ .dropdown-menu {
267
+ width: 98%;
268
+ background: var(--background-paper, #fff);
269
+ border: 1px solid var(--border-color, #d0d3db);
270
+ border-radius: var(--border-radius-small, 0.25rem);
271
+ //box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
272
+ max-height: 240px;
273
+ overflow-y: auto;
274
+ outline: none;
275
+ padding: 0.375rem;
276
+ position: absolute;
277
+ z-index: 10;
278
+ left: 0;
279
+ display: flex;
280
+ flex-direction: column;
281
+ gap: 0.125rem;
282
+ top: 0; /* will be set inline */
283
+ }
284
+ .option {
285
+ padding: 0.375rem 0.625rem;
286
+ font-size: 0.875rem;
287
+ cursor: pointer;
288
+ color: var(--text-primary, #111);
289
+ background: none;
290
+ border: none;
291
+ width: 98%;
292
+ text-align: left;
293
+ display: flex;
294
+ align-items: center;
295
+ transition: background 0.12s;
296
+ border-radius: var(--border-radius-small, 0.25rem);
297
+ }
298
+ .option.selected {
299
+ background: var(--color-primary-light, #e3e8f5);
300
+ color: var(--text-primary, #111);
301
+ font-weight: 500;
302
+ }
303
+ .option.highlighted {
304
+ background: var(--color-primary-light, #e3e8f5);
305
+ }
306
+ .option.disabled {
307
+ color: var(--text-disabled, #aaa);
308
+ cursor: not-allowed;
309
+ }
310
+
311
+ .helper-text {
312
+ margin-left: 0.875rem;
313
+ color: var(--text-secondary, #777);
314
+ min-height: 1em;
315
+ font-weight: 400;
316
+ font-size: 0.75rem;
317
+ line-height: 185%;
318
+ display: flex;
319
+ align-items: center;
320
+ gap: 0.375rem;
321
+ }
322
+ .helper-text.error {
323
+ color: var(--color-error-main, #d32f2f);
324
+ }
325
+ `;
326
+ r([
327
+ l({ type: String })
328
+ ], o.prototype, "label", 2);
329
+ r([
330
+ l({ type: String })
331
+ ], o.prototype, "value", 2);
332
+ r([
333
+ l({ type: Boolean })
334
+ ], o.prototype, "disabled", 2);
335
+ r([
336
+ l({ type: Boolean })
337
+ ], o.prototype, "error", 2);
338
+ r([
339
+ l({ type: Boolean })
340
+ ], o.prototype, "required", 2);
341
+ r([
342
+ l({ type: String })
343
+ ], o.prototype, "helperText", 2);
344
+ r([
345
+ l({ type: String })
346
+ ], o.prototype, "size", 2);
347
+ r([
348
+ l({ type: String })
349
+ ], o.prototype, "placeholder", 2);
350
+ r([
351
+ l({ type: String })
352
+ ], o.prototype, "tooltip", 2);
353
+ r([
354
+ l({ type: Array })
355
+ ], o.prototype, "options", 2);
356
+ r([
357
+ l({ type: Boolean })
358
+ ], o.prototype, "open", 2);
359
+ r([
360
+ l({ type: Number })
361
+ ], o.prototype, "highlighted", 2);
362
+ r([
363
+ l({ type: String })
364
+ ], o.prototype, "typedFilter", 2);
365
+ r([
366
+ p(".dropdown-anchor")
367
+ ], o.prototype, "anchorEl", 2);
368
+ r([
369
+ p(".dropdown-menu")
370
+ ], o.prototype, "menuEl", 2);
371
+ o = r([
372
+ v("lit-select-field")
373
+ ], o);
374
+ export {
375
+ o as LitSelectField
376
+ };
@@ -0,0 +1,60 @@
1
+ import { customElement as o } from "../node_modules/@lit/reactive-element/decorators/custom-element.js";
2
+ import { property as u } from "../node_modules/@lit/reactive-element/decorators/property.js";
3
+ import "../node_modules/@lit/reactive-element/reactive-element.js";
4
+ import { html as s } 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 v } from "../node_modules/@lit/reactive-element/css-tag.js";
7
+ var d = Object.defineProperty, y = Object.getOwnPropertyDescriptor, n = (p, e, t, r) => {
8
+ for (var l = r > 1 ? void 0 : r ? y(e, t) : e, a = p.length - 1, c; a >= 0; a--)
9
+ (c = p[a]) && (l = (r ? c(e, t, l) : c(l)) || l);
10
+ return r && l && d(e, t, l), l;
11
+ };
12
+ let i = class extends m {
13
+ constructor() {
14
+ super(...arguments), this.value = {};
15
+ }
16
+ connectedCallback() {
17
+ super.connectedCallback();
18
+ }
19
+ render() {
20
+ var e;
21
+ const p = ((e = this.schema) == null ? void 0 : e.properties) || {};
22
+ return s`
23
+ <div class="settings-container">
24
+ ${Object.entries(p).map(([t, r]) => s`
25
+ <div class="setting-field">
26
+ <div class="setting-label">${t}</div>
27
+ <div class="setting-input">${this.renderField(t, r)}</div>
28
+ </div>
29
+ `)}
30
+ </div>
31
+ `;
32
+ }
33
+ renderField(p, e) {
34
+ var r;
35
+ const t = (r = this.value) == null ? void 0 : r[p];
36
+ return e.type === "boolean" ? s` <lit-checkbox .checked=${!!t}></lit-checkbox> ` : e.type === "string" ? e.enum ? s`
37
+ <lit-select
38
+ .options=${e.enum}
39
+ .value=${t}
40
+ .multiple=${e.multiple || !1}
41
+ ></lit-select>
42
+ ` : e.format === "date" ? s` <lit-date-picker .value=${t}></lit-date-picker> ` : s` <lit-input .value=${t ?? ""}></lit-input> ` : e.type === "number" || e.type === "integer" ? s` <lit-input type="number" .value=${t ?? ""}></lit-input> ` : s`<div>Unsupported type: ${e.type}</div>`;
43
+ }
44
+ };
45
+ i.styles = [v``];
46
+ n([
47
+ u({ type: Object })
48
+ ], i.prototype, "schema", 2);
49
+ n([
50
+ u({ type: Object })
51
+ ], i.prototype, "value", 2);
52
+ n([
53
+ u({ type: Function })
54
+ ], i.prototype, "onSettingsChanged", 2);
55
+ i = n([
56
+ o("lit-settings")
57
+ ], i);
58
+ export {
59
+ i as LitSettings
60
+ };
@@ -1,7 +1,7 @@
1
1
  import { LitElement } from 'lit-element';
2
2
  import './lit-icon.js';
3
3
  import './lit-label.js';
4
- export declare class TextInput extends LitElement {
4
+ export declare class LitTextField extends LitElement {
5
5
  label: string;
6
6
  value: string;
7
7
  disabled: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"lit-text-field.d.ts","sourceRoot":"","sources":["../../src/shared/lit-text-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,aAAa,CAAC;AAEpD,OAAO,eAAe,CAAC;AACvB,OAAO,gBAAgB,CAAC;AACxB,qBACa,SAAU,SAAQ,UAAU;IACT,KAAK,SAAM;IACX,KAAK,SAAM;IACV,QAAQ,UAAS;IACjB,QAAQ,UAAS;IACjB,KAAK,UAAS;IACf,UAAU,SAAM;IAChB,WAAW,SAAM;IACjB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAY;IAC7C,OAAO,UAAS;IAChB,QAAQ,UAAS;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAU;IAE9D,MAAM,CAAC,MAAM,kCAqFX;IAEF,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,MAAM;IAMd,MAAM;CAyDT"}
1
+ {"version":3,"file":"lit-text-field.d.ts","sourceRoot":"","sources":["../../src/shared/lit-text-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,aAAa,CAAC;AAEpD,OAAO,eAAe,CAAC;AACvB,OAAO,gBAAgB,CAAC;AACxB,qBACa,YAAa,SAAQ,UAAU;IACZ,KAAK,SAAM;IACX,KAAK,SAAM;IACV,QAAQ,UAAS;IACjB,QAAQ,UAAS;IACjB,KAAK,UAAS;IACf,UAAU,SAAM;IAChB,WAAW,SAAM;IACjB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAY;IAC7C,OAAO,UAAS;IAChB,QAAQ,UAAS;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAU;IAE9D,MAAM,CAAC,MAAM,kCAqFX;IAEF,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,MAAM;IAMd,MAAM;CAyDT"}
@@ -0,0 +1,205 @@
1
+ import "../node_modules/@lit/reactive-element/reactive-element.js";
2
+ import { html as a } from "../node_modules/lit-html/lit-html.js";
3
+ import { LitElement as c } from "../node_modules/lit-element/lit-element.js";
4
+ import { customElement as h } from "../node_modules/@lit/reactive-element/decorators/custom-element.js";
5
+ import { property as t } from "../node_modules/@lit/reactive-element/decorators/property.js";
6
+ import { css as u } from "../node_modules/@lit/reactive-element/css-tag.js";
7
+ var b = Object.defineProperty, f = Object.getOwnPropertyDescriptor, r = (i, o, p, s) => {
8
+ for (var l = s > 1 ? void 0 : s ? f(o, p) : o, d = i.length - 1, n; d >= 0; d--)
9
+ (n = i[d]) && (l = (s ? n(o, p, l) : n(l)) || l);
10
+ return s && l && b(o, p, l), l;
11
+ };
12
+ let e = class extends c {
13
+ constructor() {
14
+ super(...arguments), this.label = "", this.value = "", this.disabled = !1, this.readonly = !1, this.error = !1, this.helperText = "", this.placeholder = "", this.size = "medium", this.focused = !1, this.required = !1, this.type = "text";
15
+ }
16
+ onInput(i) {
17
+ const o = i.target.value;
18
+ this.dispatchEvent(new CustomEvent("onChange", { detail: o }));
19
+ }
20
+ onFocus() {
21
+ this.focused = !0;
22
+ }
23
+ onBlur(i) {
24
+ this.focused = !1;
25
+ const o = i.target.value;
26
+ this.dispatchEvent(new CustomEvent("onBlur", { detail: o }));
27
+ }
28
+ render() {
29
+ const i = [this.size, this.error ? "error" : ""].join(" "), o = ["helper-text", this.error ? "error" : ""].join(" ");
30
+ return a`
31
+ <div class="container">
32
+ ${this.label ? a`
33
+ <lit-label
34
+ .label=${this.label}
35
+ .tooltip=${this.tooltip}
36
+ ?disabled=${this.disabled}
37
+ ?error=${this.error}
38
+ ?required=${this.required}
39
+ >
40
+ </lit-label>
41
+ ` : ""}
42
+ <div class="input-wrap">
43
+ <input
44
+ ?required=${this.required}
45
+ class="${i}"
46
+ .value=${this.value}
47
+ ?disabled=${this.disabled}
48
+ ?readonly=${this.readonly}
49
+ placeholder=${this.placeholder}
50
+ @input=${this.onInput}
51
+ @focus=${this.onFocus}
52
+ @blur=${this.onBlur}
53
+ type="${this.type}"
54
+ step="0.1"
55
+ aria-required="${this.required ? "true" : "false"}"
56
+ aria-invalid="${this.error ? "true" : "false"}"
57
+ aria-label="${this.label || "text input"}"
58
+ />
59
+ </div>
60
+ ${this.helperText && this.error ? a`
61
+ <div
62
+ class="${o}"
63
+ style="display:flex;align-items:center;gap:0.375rem;"
64
+ >
65
+ <lit-icon
66
+ icon="dangerFilled"
67
+ size="1.125rem"
68
+ style="padding-top: 2px"
69
+ ></lit-icon>
70
+
71
+ <span>${this.helperText}</span>
72
+ </div>
73
+ ` : this.helperText ? a` <div class="${o}">${this.helperText}</div> ` : a`<div class="helper-text">&nbsp;</div>`}
74
+ </div>
75
+ `;
76
+ }
77
+ };
78
+ e.styles = u`
79
+ :host {
80
+ display: block;
81
+ font-family: inherit;
82
+ }
83
+ .container {
84
+ display: flex;
85
+ flex-direction: column;
86
+ }
87
+ .input-wrap {
88
+ position: relative;
89
+ display: flex;
90
+ align-items: center;
91
+ }
92
+ input {
93
+ width: 100%;
94
+ border: 1px solid var(--border-color, #d0d3db);
95
+ border-radius: var(--border-radius-small, 0.25rem);
96
+ background: var(--background-paper, #fff);
97
+ color: var(--text-primary, #111);
98
+ padding: 0.625rem 0.875rem;
99
+ font-size: 0.875rem;
100
+ outline: none;
101
+ transition:
102
+ border-color 0.2s,
103
+ box-shadow 0.2s,
104
+ background 0.2s,
105
+ color 0.2s;
106
+ }
107
+ input.small {
108
+ font-size: 0.875rem;
109
+ padding: 8px 12px;
110
+ }
111
+ input.large {
112
+ font-size: 1.125rem;
113
+ padding: 12px 16px;
114
+ }
115
+ input:focus:not(:disabled):not([readonly]) {
116
+ border-color: var(--text-primary, #111827);
117
+ // box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.15);
118
+ }
119
+ .input-wrap:hover input:not(:disabled):not([readonly]) {
120
+ border-color: var(--text-primary, #d0d3db);
121
+ cursor: pointer;
122
+ }
123
+ input:disabled {
124
+ background: var(--background-paper, #fff);
125
+ border: 1px dashed var(--border-color, #d0d3db);
126
+ color: var(--border-color, #d0d3db);
127
+ cursor: not-allowed;
128
+ }
129
+ input[readonly]:not(:disabled) {
130
+ background: var(--background-paper, #fff);
131
+ border-color: transparent;
132
+ color: var(--text-primary, #d0d3db);
133
+ cursor: default;
134
+ }
135
+ input.error {
136
+ border-color: var(--color-error-main, #d32f2f);
137
+ }
138
+ input.error:focus {
139
+ // box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.15);
140
+ }
141
+ .helper-text {
142
+ margin-left: 0.875rem;
143
+ color: var(--text-secondary, #777);
144
+ min-height: 1em;
145
+ font-weight: 400;
146
+ font-size: 0.75rem;
147
+ line-height: 185%;
148
+ letter-spacing: 0px;
149
+ vertical-align: middle;
150
+ }
151
+ .helper-text.error {
152
+ color: var(--color-error-main, #d32f2f);
153
+ }
154
+ .label.error {
155
+ color: var(--color-error-main, #d32f2f);
156
+ }
157
+ .label.disabled {
158
+ color: var(--text-disabled, #777);
159
+ }
160
+ .label.focused {
161
+ color: var(--text-secondary, #111);
162
+ }
163
+ `;
164
+ r([
165
+ t({ type: String })
166
+ ], e.prototype, "label", 2);
167
+ r([
168
+ t({ type: String })
169
+ ], e.prototype, "value", 2);
170
+ r([
171
+ t({ type: Boolean })
172
+ ], e.prototype, "disabled", 2);
173
+ r([
174
+ t({ type: Boolean })
175
+ ], e.prototype, "readonly", 2);
176
+ r([
177
+ t({ type: Boolean })
178
+ ], e.prototype, "error", 2);
179
+ r([
180
+ t({ type: String })
181
+ ], e.prototype, "helperText", 2);
182
+ r([
183
+ t({ type: String })
184
+ ], e.prototype, "placeholder", 2);
185
+ r([
186
+ t({ type: String })
187
+ ], e.prototype, "size", 2);
188
+ r([
189
+ t({ type: Boolean })
190
+ ], e.prototype, "focused", 2);
191
+ r([
192
+ t({ type: Boolean })
193
+ ], e.prototype, "required", 2);
194
+ r([
195
+ t({ type: String })
196
+ ], e.prototype, "tooltip", 2);
197
+ r([
198
+ t({ type: String })
199
+ ], e.prototype, "type", 2);
200
+ e = r([
201
+ h("lit-text-field")
202
+ ], e);
203
+ export {
204
+ e as LitTextField
205
+ };