overview-components 1.0.41 → 1.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/lit-case-variables-tab.d.ts +5 -2
- package/dist/components/lit-case-variables-tab.d.ts.map +1 -1
- package/dist/components/lit-case-variables-tab.js +102 -81
- package/dist/components/lit-case-variables-tab.js.map +1 -1
- package/dist/components/lit-data-grid-tanstack.d.ts +0 -2
- package/dist/components/lit-data-grid-tanstack.d.ts.map +1 -1
- package/dist/components/lit-data-grid-tanstack.js +1 -17
- package/dist/components/lit-data-grid-tanstack.js.map +1 -1
- package/dist/components/lit-filter-modal.d.ts.map +1 -1
- package/dist/components/lit-filter-modal.js +0 -5
- package/dist/components/lit-filter-modal.js.map +1 -1
- package/dist/components/lit-section-tab.d.ts +4 -2
- package/dist/components/lit-section-tab.d.ts.map +1 -1
- package/dist/components/lit-section-tab.js +66 -62
- package/dist/components/lit-section-tab.js.map +1 -1
- package/dist/shared/lit-data-grid-row-actions.js +1 -1
- package/dist/shared/lit-date-picker.d.ts.map +1 -1
- package/dist/shared/lit-date-picker.js +19 -24
- package/dist/shared/lit-date-picker.js.map +1 -1
- package/dist/shared/lit-icon-button.js +2 -2
- package/dist/shared/lit-input.js +1 -1
- package/dist/shared/lit-select-field.d.ts +41 -0
- package/dist/shared/lit-select-field.d.ts.map +1 -0
- package/dist/shared/lit-select-field.js +486 -0
- package/dist/shared/lit-select-field.js.map +1 -0
- package/dist/shared/lit-select.d.ts +0 -2
- package/dist/shared/lit-select.d.ts.map +1 -1
- package/dist/shared/lit-select.js +1 -5
- package/dist/shared/lit-select.js.map +1 -1
- package/dist/shared/lit-text-field.d.ts +21 -0
- package/dist/shared/lit-text-field.d.ts.map +1 -0
- package/dist/shared/lit-text-field.js +243 -0
- package/dist/shared/lit-text-field.js.map +1 -0
- package/dist/shared/lit-tooltip.d.ts.map +1 -1
- package/dist/shared/lit-tooltip.js +44 -49
- package/dist/shared/lit-tooltip.js.map +1 -1
- package/dist/shared/simple-popper.d.ts +3 -2
- package/dist/shared/simple-popper.d.ts.map +1 -1
- package/dist/shared/simple-popper.js +81 -49
- package/dist/shared/simple-popper.js.map +1 -1
- package/package.json +11 -11
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html, css } from 'lit-element';
|
|
8
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
9
|
+
import './lit-icon';
|
|
10
|
+
import { tooltip } from './simple-tooltip.js';
|
|
11
|
+
let TextInput = class TextInput extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.label = '';
|
|
15
|
+
this.value = '';
|
|
16
|
+
this.disabled = false;
|
|
17
|
+
this.readonly = false;
|
|
18
|
+
this.error = false;
|
|
19
|
+
this.helperText = '';
|
|
20
|
+
this.placeholder = '';
|
|
21
|
+
this.size = 'medium';
|
|
22
|
+
this.focused = false;
|
|
23
|
+
this.required = false;
|
|
24
|
+
}
|
|
25
|
+
onInput(e) {
|
|
26
|
+
const val = e.target.value;
|
|
27
|
+
this.value = val;
|
|
28
|
+
this.dispatchEvent(new CustomEvent('input', { detail: val }));
|
|
29
|
+
}
|
|
30
|
+
onFocus() {
|
|
31
|
+
this.focused = true;
|
|
32
|
+
}
|
|
33
|
+
onBlur() {
|
|
34
|
+
this.focused = false;
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
const inputClass = [this.size, this.error ? 'error' : ''].join(' ');
|
|
38
|
+
const labelClass = [
|
|
39
|
+
'label',
|
|
40
|
+
this.error ? 'error' : '',
|
|
41
|
+
this.focused ? 'focused' : '',
|
|
42
|
+
this.disabled ? 'disabled' : '',
|
|
43
|
+
].join(' ');
|
|
44
|
+
const helperClass = ['helper-text', this.error ? 'error' : ''].join(' ');
|
|
45
|
+
return html `
|
|
46
|
+
<div class="container">
|
|
47
|
+
${this.label
|
|
48
|
+
? html `
|
|
49
|
+
<label class="${labelClass}">
|
|
50
|
+
${this.required
|
|
51
|
+
? html `<span
|
|
52
|
+
aria-hidden="true"
|
|
53
|
+
style="color:var(--color-error-main); font-size: 18px; line-height: 1;"
|
|
54
|
+
>*</span
|
|
55
|
+
>`
|
|
56
|
+
: ''}${this.label}
|
|
57
|
+
${this.tooltip
|
|
58
|
+
? html `<lit-icon
|
|
59
|
+
icon="help1"
|
|
60
|
+
size="1rem"
|
|
61
|
+
style="top: 0.0625rem"
|
|
62
|
+
@tooltip=${tooltip(this.tooltip, 'left')}
|
|
63
|
+
></lit-icon>`
|
|
64
|
+
: ''}
|
|
65
|
+
</label>
|
|
66
|
+
`
|
|
67
|
+
: ''}
|
|
68
|
+
<div class="input-wrap">
|
|
69
|
+
<input
|
|
70
|
+
?required=${this.required}
|
|
71
|
+
class="${inputClass}"
|
|
72
|
+
.value=${this.value}
|
|
73
|
+
?disabled=${this.disabled}
|
|
74
|
+
?readonly=${this.readonly}
|
|
75
|
+
placeholder=${this.placeholder}
|
|
76
|
+
@input=${this.onInput}
|
|
77
|
+
@focus=${this.onFocus}
|
|
78
|
+
@blur=${this.onBlur}
|
|
79
|
+
aria-required="${this.required ? 'true' : 'false'}"
|
|
80
|
+
aria-invalid="${this.error ? 'true' : 'false'}"
|
|
81
|
+
aria-label="${this.label || 'text input'}"
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
${this.helperText && this.error
|
|
85
|
+
? html `
|
|
86
|
+
<div
|
|
87
|
+
class="${helperClass}"
|
|
88
|
+
style="display:flex;align-items:center;gap:0.375rem;"
|
|
89
|
+
>
|
|
90
|
+
<lit-icon
|
|
91
|
+
icon="dangerFilled"
|
|
92
|
+
size="1.125rem"
|
|
93
|
+
style="padding-top: 2px"
|
|
94
|
+
></lit-icon>
|
|
95
|
+
|
|
96
|
+
<span>${this.helperText}</span>
|
|
97
|
+
</div>
|
|
98
|
+
`
|
|
99
|
+
: this.helperText
|
|
100
|
+
? html ` <div class="${helperClass}">${this.helperText}</div> `
|
|
101
|
+
: html `<div class="helper-text"> </div>`}
|
|
102
|
+
</div>
|
|
103
|
+
`;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
TextInput.styles = css `
|
|
107
|
+
:host {
|
|
108
|
+
display: block;
|
|
109
|
+
font-family: inherit;
|
|
110
|
+
}
|
|
111
|
+
.container {
|
|
112
|
+
display: flex;
|
|
113
|
+
flex-direction: column;
|
|
114
|
+
}
|
|
115
|
+
.label {
|
|
116
|
+
font-size: 1rem;
|
|
117
|
+
margin-left: 0.875rem;
|
|
118
|
+
color: var(--text-secondary, #777);
|
|
119
|
+
transition: color 0.2s;
|
|
120
|
+
user-select: none;
|
|
121
|
+
font-weight: 500;
|
|
122
|
+
font-size: 0.875rem;
|
|
123
|
+
line-height: 160%;
|
|
124
|
+
letter-spacing: 0rem;
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
gap: 0.625rem;
|
|
128
|
+
}
|
|
129
|
+
.input-wrap {
|
|
130
|
+
position: relative;
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
}
|
|
134
|
+
input {
|
|
135
|
+
width: 100%;
|
|
136
|
+
border: 1px solid var(--border-color, #d0d3db);
|
|
137
|
+
border-radius: var(--border-radius-small, 0.25rem);
|
|
138
|
+
background: var(--background-paper, #fff);
|
|
139
|
+
color: var(--text-primary, #111);
|
|
140
|
+
padding: 0.625rem 0.875rem;
|
|
141
|
+
font-size: 0.875rem;
|
|
142
|
+
outline: none;
|
|
143
|
+
transition:
|
|
144
|
+
border-color 0.2s,
|
|
145
|
+
box-shadow 0.2s,
|
|
146
|
+
background 0.2s,
|
|
147
|
+
color 0.2s;
|
|
148
|
+
}
|
|
149
|
+
input.small {
|
|
150
|
+
font-size: 0.875rem;
|
|
151
|
+
padding: 8px 12px;
|
|
152
|
+
}
|
|
153
|
+
input.large {
|
|
154
|
+
font-size: 1.125rem;
|
|
155
|
+
padding: 12px 16px;
|
|
156
|
+
}
|
|
157
|
+
input:focus:not(:disabled):not([readonly]) {
|
|
158
|
+
border-color: var(--text-primary, #111827);
|
|
159
|
+
// box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.15);
|
|
160
|
+
}
|
|
161
|
+
.input-wrap:hover input:not(:disabled):not([readonly]) {
|
|
162
|
+
border-color: var(--text-primary, #d0d3db);
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
}
|
|
165
|
+
input:disabled {
|
|
166
|
+
background: var(--background-paper, #fff);
|
|
167
|
+
border: 1px dashed var(--border-color, #d0d3db);
|
|
168
|
+
color: var(--border-color, #d0d3db);
|
|
169
|
+
cursor: not-allowed;
|
|
170
|
+
}
|
|
171
|
+
input[readonly]:not(:disabled) {
|
|
172
|
+
background: var(--background-paper, #fff);
|
|
173
|
+
border-color: transparent;
|
|
174
|
+
color: var(--text-primary, #d0d3db);
|
|
175
|
+
cursor: default;
|
|
176
|
+
}
|
|
177
|
+
input.error {
|
|
178
|
+
border-color: var(--color-error-main, #d32f2f);
|
|
179
|
+
}
|
|
180
|
+
input.error:focus {
|
|
181
|
+
// box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.15);
|
|
182
|
+
}
|
|
183
|
+
.helper-text {
|
|
184
|
+
margin-left: 0.875rem;
|
|
185
|
+
color: var(--text-secondary, #777);
|
|
186
|
+
min-height: 1em;
|
|
187
|
+
font-weight: 400;
|
|
188
|
+
font-size: 0.75rem;
|
|
189
|
+
line-height: 185%;
|
|
190
|
+
letter-spacing: 0px;
|
|
191
|
+
vertical-align: middle;
|
|
192
|
+
}
|
|
193
|
+
.helper-text.error {
|
|
194
|
+
color: var(--color-error-main, #d32f2f);
|
|
195
|
+
}
|
|
196
|
+
.label.error {
|
|
197
|
+
color: var(--color-error-main, #d32f2f);
|
|
198
|
+
}
|
|
199
|
+
.label.disabled {
|
|
200
|
+
color: var(--text-disabled, #777);
|
|
201
|
+
}
|
|
202
|
+
.label.focused {
|
|
203
|
+
color: var(--text-secondary, #111);
|
|
204
|
+
}
|
|
205
|
+
`;
|
|
206
|
+
__decorate([
|
|
207
|
+
property({ type: String })
|
|
208
|
+
], TextInput.prototype, "label", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
property({ type: String })
|
|
211
|
+
], TextInput.prototype, "value", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
property({ type: Boolean })
|
|
214
|
+
], TextInput.prototype, "disabled", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
property({ type: Boolean })
|
|
217
|
+
], TextInput.prototype, "readonly", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
property({ type: Boolean })
|
|
220
|
+
], TextInput.prototype, "error", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
property({ type: String })
|
|
223
|
+
], TextInput.prototype, "helperText", void 0);
|
|
224
|
+
__decorate([
|
|
225
|
+
property({ type: String })
|
|
226
|
+
], TextInput.prototype, "placeholder", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
property({ type: String })
|
|
229
|
+
], TextInput.prototype, "size", void 0);
|
|
230
|
+
__decorate([
|
|
231
|
+
property({ type: Boolean })
|
|
232
|
+
], TextInput.prototype, "focused", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
property({ type: Boolean })
|
|
235
|
+
], TextInput.prototype, "required", void 0);
|
|
236
|
+
__decorate([
|
|
237
|
+
property({ type: String })
|
|
238
|
+
], TextInput.prototype, "tooltip", void 0);
|
|
239
|
+
TextInput = __decorate([
|
|
240
|
+
customElement('lit-text-field')
|
|
241
|
+
], TextInput);
|
|
242
|
+
export { TextInput };
|
|
243
|
+
//# sourceMappingURL=lit-text-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lit-text-field.js","sourceRoot":"","sources":["../../src/shared/lit-text-field.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,YAAY,CAAC;AACpB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEvC,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QACyB,UAAK,GAAG,EAAE,CAAC;QACX,UAAK,GAAG,EAAE,CAAC;QACV,aAAQ,GAAG,KAAK,CAAC;QACjB,aAAQ,GAAG,KAAK,CAAC;QACjB,UAAK,GAAG,KAAK,CAAC;QACf,eAAU,GAAG,EAAE,CAAC;QAChB,gBAAW,GAAG,EAAE,CAAC;QACjB,SAAI,GAAiC,QAAQ,CAAC;QAC7C,YAAO,GAAG,KAAK,CAAC;QAChB,aAAQ,GAAG,KAAK,CAAC;IA4LlD,CAAC;IApFW,OAAO,CAAC,CAAQ;QACpB,MAAM,GAAG,GAAI,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC;QACjD,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;QACjB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC;IAEO,OAAO;QACX,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;IAEO,MAAM;QACV,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACzB,CAAC;IAED,MAAM;QACF,MAAM,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AC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAiB;AAChB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CAAkB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAkB;AAXpC,SAAS;IADrB,aAAa,CAAC,gBAAgB,CAAC;GACnB,SAAS,CAsMrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lit-tooltip.d.ts","sourceRoot":"","sources":["../../src/shared/lit-tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAE5D,OAAO,
|
|
1
|
+
{"version":3,"file":"lit-tooltip.d.ts","sourceRoot":"","sources":["../../src/shared/lit-tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAE5D,OAAO,EAOH,SAAS,EAEZ,MAAM,kBAAkB,CAAC;AAE1B,qBACa,WAAY,SAAQ,UAAU;IACvC,MAAM,CAAC,MAAM,0BA+CX;IAE0B,SAAS,EAAE,SAAS,CAAS;IAE1B,WAAW,EAAG,eAAe,CAAC;IAC9B,WAAW,EAAG,eAAe,CAAC;IAE7D,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,WAAW,CAAuB;IAE1C,YAAY,IAAI,IAAI;IAiCpB,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,gBAAgB;YAOV,WAAW;IAoCzB,OAAO,CAAC,WAAW;IAMnB,MAAM,IAAI,cAAc;CAM3B"}
|
|
@@ -72,12 +72,7 @@ let PerfTooltip = class PerfTooltip extends LitElement {
|
|
|
72
72
|
this.cleanup = autoUpdate(triggerEl, tooltipEl, async () => {
|
|
73
73
|
const position = await computePosition(triggerEl, tooltipEl, {
|
|
74
74
|
placement: this.placement,
|
|
75
|
-
middleware: [
|
|
76
|
-
offset(8),
|
|
77
|
-
flip(),
|
|
78
|
-
shift({ padding: 5 }),
|
|
79
|
-
arrow({ element: arrowEl }),
|
|
80
|
-
],
|
|
75
|
+
middleware: [offset(8), flip(), shift({ padding: 5 }), arrow({ element: arrowEl })],
|
|
81
76
|
});
|
|
82
77
|
const { x, y, placement, middlewareData } = position;
|
|
83
78
|
const { arrow: arrowData } = middlewareData;
|
|
@@ -102,59 +97,59 @@ let PerfTooltip = class PerfTooltip extends LitElement {
|
|
|
102
97
|
}
|
|
103
98
|
render() {
|
|
104
99
|
return html `
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
100
|
+
<slot name="trigger"></slot>
|
|
101
|
+
<slot name="tooltip"></slot>
|
|
102
|
+
`;
|
|
108
103
|
}
|
|
109
104
|
};
|
|
110
105
|
PerfTooltip.styles = css `
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
106
|
+
:host {
|
|
107
|
+
position: relative;
|
|
108
|
+
display: inline-block;
|
|
109
|
+
}
|
|
115
110
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
111
|
+
::slotted([slot='tooltip']) {
|
|
112
|
+
position: absolute;
|
|
113
|
+
z-index: 9999;
|
|
114
|
+
background: #111;
|
|
115
|
+
color: #fff;
|
|
116
|
+
padding: 6px 10px;
|
|
117
|
+
border-radius: 4px;
|
|
118
|
+
font-size: 12px;
|
|
119
|
+
opacity: 0;
|
|
120
|
+
transition: opacity 0.2s ease;
|
|
121
|
+
pointer-events: none;
|
|
122
|
+
}
|
|
128
123
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
::slotted([slot='tooltip'][data-visible]) {
|
|
125
|
+
opacity: 1;
|
|
126
|
+
pointer-events: auto;
|
|
127
|
+
}
|
|
133
128
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
129
|
+
.arrow {
|
|
130
|
+
position: absolute;
|
|
131
|
+
width: 8px;
|
|
132
|
+
height: 8px;
|
|
133
|
+
background: inherit;
|
|
134
|
+
transform: rotate(45deg);
|
|
135
|
+
}
|
|
141
136
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
137
|
+
.arrow[data-placement^='top'] {
|
|
138
|
+
bottom: -4px;
|
|
139
|
+
}
|
|
145
140
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
141
|
+
.arrow[data-placement^='bottom'] {
|
|
142
|
+
top: -4px;
|
|
143
|
+
}
|
|
149
144
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
145
|
+
.arrow[data-placement^='left'] {
|
|
146
|
+
right: -4px;
|
|
147
|
+
}
|
|
153
148
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
149
|
+
.arrow[data-placement^='right'] {
|
|
150
|
+
left: -4px;
|
|
151
|
+
}
|
|
152
|
+
`;
|
|
158
153
|
__decorate([
|
|
159
154
|
property({ type: String })
|
|
160
155
|
], PerfTooltip.prototype, "placement", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lit-tooltip.js","sourceRoot":"","sources":["../../src/shared/lit-tooltip.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAkB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,
|
|
1
|
+
{"version":3,"file":"lit-tooltip.js","sourceRoot":"","sources":["../../src/shared/lit-tooltip.ts"],"names":[],"mappings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AS,CAAC;gBAC3C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE;oBACzB,IAAI,EAAE,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,EAAE;oBACzC,GAAG,EAAE,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,EAAE;iBAC3C,CAAC,CAAC;YACP,CAAC;YAED,OAAO,CAAC,YAAY,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,WAAW,CAAC,SAAsB;QACtC,SAAS,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;IAED,MAAM;QACF,OAAO,IAAI,CAAA;;;SAGV,CAAC;IACN,CAAC;;AA5JM,kBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+ClB,AA/CY,CA+CX;AAE0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAA8B;AAE1B;IAA9B,KAAK,CAAC,sBAAsB,CAAC;gDAA+B;AAC9B;IAA9B,KAAK,CAAC,sBAAsB,CAAC;gDAA+B;AArDpD,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA8JvB"}
|
|
@@ -6,10 +6,10 @@ export declare class SimplePopper extends LitElement {
|
|
|
6
6
|
static styles: import("lit").CSSResult;
|
|
7
7
|
showing: boolean;
|
|
8
8
|
manualOpening: boolean;
|
|
9
|
-
appendToBody: boolean;
|
|
10
9
|
maxWidthAsTarget: boolean;
|
|
11
10
|
placement: 'top' | 'right' | 'bottom' | 'left' | 'top-start' | 'top-end' | 'right-start' | 'right-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end';
|
|
12
11
|
offset: number;
|
|
12
|
+
onClose: () => void;
|
|
13
13
|
private arrowElement;
|
|
14
14
|
constructor();
|
|
15
15
|
firstUpdated(): void;
|
|
@@ -18,10 +18,11 @@ export declare class SimplePopper extends LitElement {
|
|
|
18
18
|
_target: Element | null;
|
|
19
19
|
get target(): Element | null;
|
|
20
20
|
set target(target: Element | null);
|
|
21
|
+
private cleanupAutoUpdate;
|
|
21
22
|
show: () => void;
|
|
23
|
+
hide: () => void;
|
|
22
24
|
hideOnOutsideClick: (event: Event) => void;
|
|
23
25
|
hideOnSlotClick: (event: Event) => void;
|
|
24
|
-
hide: () => void;
|
|
25
26
|
finishHide: () => void;
|
|
26
27
|
render(): import("lit-html").TemplateResult<1>;
|
|
27
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-popper.d.ts","sourceRoot":"","sources":["../../src/shared/simple-popper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAa,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAU,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"simple-popper.d.ts","sourceRoot":"","sources":["../../src/shared/simple-popper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAa,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAU,MAAM,KAAK,CAAC;AAkB1C,qBACa,YAAa,SAAQ,UAAU;IAExC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI;IAYrE,MAAM,CAAC,MAAM,0BAgCX;IAIF,OAAO,UAAS;IAEhB,aAAa,UAAS;IAEtB,gBAAgB,UAAS;IAEzB,SAAS,EACH,KAAK,GACL,OAAO,GACP,QAAQ,GACR,MAAM,GACN,WAAW,GACX,SAAS,GACT,aAAa,GACb,WAAW,GACX,cAAc,GACd,YAAY,GACZ,YAAY,GACZ,UAAU,CAAS;IAIzB,MAAM,SAAK;IAEX,OAAO,aAAY;IAEnB,OAAO,CAAC,YAAY,CAAwC;;IAQ5D,YAAY;IAGZ,SAAS,CAAC,OAAO,CAAC,kBAAkB,EAAE,cAAc,GAAG,IAAI;IAO3D,iBAAiB;IASjB,OAAO,EAAE,OAAO,GAAG,IAAI,CAAQ;IAC/B,IAAI,MAAM,IAGS,OAAO,GAAG,IAAI,CADhC;IACD,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,EAYhC;IACD,OAAO,CAAC,iBAAiB,CAA6B;IAEtD,IAAI,aAiGF;IAEF,IAAI,aASF;IAEF,kBAAkB,GAAI,OAAO,KAAK,UAMhC;IAEF,eAAe,GAAI,OAAO,KAAK,UAG7B;IAEF,UAAU,aAIR;IAEF,MAAM;CAIT;AAED,cAAM,eAAgB,SAAQ,SAAS;IACnC,YAAY,UAAS;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,aAAa,GAAE,OAAY;IAClC,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,aAAa,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC;IAUpE,SAAS;IAOT,oBAAoB;CAGvB;AAED,eAAO,MAAM,MAAM,mGAA6B,CAAC"}
|
|
@@ -9,9 +9,9 @@ import { customElement, property } from 'lit/decorators.js';
|
|
|
9
9
|
import { Directive, directive } from 'lit/directive.js';
|
|
10
10
|
import { render } from 'lit';
|
|
11
11
|
// Positioning library
|
|
12
|
-
import { computePosition, offset, shift, arrow, size } from '@floating-ui/dom';
|
|
12
|
+
import { computePosition, autoUpdate, offset, shift, arrow, size, hide, flip, } from '@floating-ui/dom';
|
|
13
13
|
// Events to turn on/off the popper
|
|
14
|
-
const enterEvents = ['click'
|
|
14
|
+
const enterEvents = ['click'];
|
|
15
15
|
const leaveEvents = ['blur'];
|
|
16
16
|
let SimplePopper = class SimplePopper extends LitElement {
|
|
17
17
|
// Lazy creation
|
|
@@ -31,64 +31,101 @@ let SimplePopper = class SimplePopper extends LitElement {
|
|
|
31
31
|
// Attribute for styling "showing"
|
|
32
32
|
this.showing = false;
|
|
33
33
|
this.manualOpening = false;
|
|
34
|
-
this.appendToBody = false;
|
|
35
34
|
this.maxWidthAsTarget = false;
|
|
36
35
|
this.placement = 'top';
|
|
37
36
|
// Position offset
|
|
38
37
|
this.offset = 4;
|
|
38
|
+
this.onClose = () => { };
|
|
39
39
|
this.arrowElement = null;
|
|
40
40
|
// Target for which to show tooltip
|
|
41
41
|
this._target = null;
|
|
42
|
+
this.cleanupAutoUpdate = null;
|
|
42
43
|
this.show = () => {
|
|
44
|
+
document.addEventListener('click', this.hideOnOutsideClick, { capture: true });
|
|
43
45
|
if (!this.manualOpening) {
|
|
44
|
-
document.addEventListener('click', this.hideOnOutsideClick, { capture: true });
|
|
45
46
|
this.addEventListener('click', this.hideOnSlotClick);
|
|
46
47
|
}
|
|
47
|
-
// document.body.appendChild(tooltip);
|
|
48
48
|
this.style.cssText = '';
|
|
49
49
|
this.style.zIndex = '1500';
|
|
50
50
|
this.style.width = `${this.maxWidthAsTarget ? `${this.target?.clientWidth}px` || '0px' : undefined}`;
|
|
51
51
|
this.style.maxWidth = `${this.maxWidthAsTarget ? undefined : 'max-content'}`;
|
|
52
|
+
// Setup autoUpdate to follow parent scroll/resize
|
|
52
53
|
if (this.target && this.arrowElement) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
54
|
+
if (this.cleanupAutoUpdate) {
|
|
55
|
+
this.cleanupAutoUpdate();
|
|
56
|
+
this.cleanupAutoUpdate = null;
|
|
57
|
+
}
|
|
58
|
+
this.cleanupAutoUpdate = autoUpdate(this.target, this, () => {
|
|
59
|
+
computePosition(this.target, this, {
|
|
60
|
+
placement: this.placement,
|
|
61
|
+
strategy: 'absolute',
|
|
62
|
+
middleware: [
|
|
63
|
+
offset(this.offset),
|
|
64
|
+
shift(),
|
|
65
|
+
flip(),
|
|
66
|
+
hide(),
|
|
67
|
+
size({
|
|
68
|
+
padding: 20,
|
|
69
|
+
apply({ availableWidth, availableHeight, elements }) {
|
|
70
|
+
// Clamp maxWidth to availableWidth
|
|
71
|
+
elements.floating.style.maxWidth = `${Math.max(0, availableWidth)}px`;
|
|
72
|
+
// Determine the maximum allowed height
|
|
73
|
+
const computedMaxHeight = Math.min(400, Math.max(0, availableHeight));
|
|
74
|
+
// If everything fits, remove maxHeight restriction. Otherwise, apply the clamp.
|
|
75
|
+
if (elements.floating.scrollHeight <= computedMaxHeight) {
|
|
76
|
+
elements.floating.style.maxHeight = '';
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
elements.floating.style.maxHeight = `${computedMaxHeight}px`;
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
}),
|
|
83
|
+
arrow({ element: this.arrowElement }),
|
|
84
|
+
],
|
|
85
|
+
}).then(({ x, y, middlewareData, placement, }) => {
|
|
86
|
+
if (middlewareData.hide) {
|
|
87
|
+
Object.assign(this.style, {
|
|
88
|
+
display: middlewareData.hide.referenceHidden ? 'none' : 'block',
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
this.style.left = `${x}px`;
|
|
92
|
+
this.style.top = `${y}px`;
|
|
93
|
+
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
94
|
+
const staticSide = {
|
|
95
|
+
top: 'bottom',
|
|
96
|
+
right: 'left',
|
|
97
|
+
bottom: 'top',
|
|
98
|
+
left: 'right',
|
|
99
|
+
}[placement.split('-')[0]] || 'top';
|
|
100
|
+
if (this.arrowElement) {
|
|
101
|
+
Object.assign(this.arrowElement.style, {
|
|
102
|
+
left: arrowX != null ? `${arrowX}px` : '',
|
|
103
|
+
top: arrowY != null ? `${arrowY}px` : '',
|
|
104
|
+
right: '',
|
|
105
|
+
bottom: '',
|
|
106
|
+
[staticSide]: '-4px',
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
});
|
|
83
110
|
});
|
|
84
111
|
}
|
|
85
112
|
this.showing = true;
|
|
86
|
-
|
|
87
|
-
|
|
113
|
+
document.body.appendChild(this);
|
|
114
|
+
};
|
|
115
|
+
this.hide = () => {
|
|
116
|
+
this.showing = false;
|
|
117
|
+
if (this.cleanupAutoUpdate) {
|
|
118
|
+
this.cleanupAutoUpdate();
|
|
119
|
+
this.cleanupAutoUpdate = null;
|
|
88
120
|
}
|
|
121
|
+
document.removeEventListener('click', this.hideOnOutsideClick, { capture: true });
|
|
122
|
+
this.removeEventListener('click', this.hideOnSlotClick);
|
|
123
|
+
this.onClose?.();
|
|
89
124
|
};
|
|
90
125
|
this.hideOnOutsideClick = (event) => {
|
|
91
|
-
if
|
|
126
|
+
// Use composedPath to reliably detect if click was inside popper or target
|
|
127
|
+
const path = (event.composedPath && event.composedPath()) || [];
|
|
128
|
+
if (!path.includes(this) && !path.includes(this.target)) {
|
|
92
129
|
this.hide();
|
|
93
130
|
}
|
|
94
131
|
};
|
|
@@ -96,11 +133,6 @@ let SimplePopper = class SimplePopper extends LitElement {
|
|
|
96
133
|
event.stopPropagation(); // Prevent click bubbling
|
|
97
134
|
this.hide();
|
|
98
135
|
};
|
|
99
|
-
this.hide = () => {
|
|
100
|
-
this.showing = false;
|
|
101
|
-
document.removeEventListener('click', this.hideOnOutsideClick, { capture: true });
|
|
102
|
-
this.removeEventListener('click', this.hideOnSlotClick);
|
|
103
|
-
};
|
|
104
136
|
this.finishHide = () => {
|
|
105
137
|
if (!this.showing) {
|
|
106
138
|
this.style.display = 'none';
|
|
@@ -165,7 +197,7 @@ SimplePopper.styles = css `
|
|
|
165
197
|
color: var(--text-primary, #111827);
|
|
166
198
|
overflow-y: auto;
|
|
167
199
|
overflow-x: hidden;
|
|
168
|
-
border:
|
|
200
|
+
border: 0.0625rem solid var(--color-divider, #e5e7eb);
|
|
169
201
|
}
|
|
170
202
|
|
|
171
203
|
:host([showing]) {
|
|
@@ -175,8 +207,8 @@ SimplePopper.styles = css `
|
|
|
175
207
|
#arrow {
|
|
176
208
|
position: absolute;
|
|
177
209
|
background: var(--background-paper, #fff);
|
|
178
|
-
width:
|
|
179
|
-
height:
|
|
210
|
+
width: 0.5rem;
|
|
211
|
+
height: 0.5rem;
|
|
180
212
|
transform: rotate(45deg);
|
|
181
213
|
}
|
|
182
214
|
`;
|
|
@@ -186,9 +218,6 @@ __decorate([
|
|
|
186
218
|
__decorate([
|
|
187
219
|
property({ reflect: true, type: Boolean })
|
|
188
220
|
], SimplePopper.prototype, "manualOpening", void 0);
|
|
189
|
-
__decorate([
|
|
190
|
-
property({ reflect: true, type: Boolean })
|
|
191
|
-
], SimplePopper.prototype, "appendToBody", void 0);
|
|
192
221
|
__decorate([
|
|
193
222
|
property({ reflect: true, type: Boolean })
|
|
194
223
|
], SimplePopper.prototype, "maxWidthAsTarget", void 0);
|
|
@@ -198,6 +227,9 @@ __decorate([
|
|
|
198
227
|
__decorate([
|
|
199
228
|
property({ type: Number })
|
|
200
229
|
], SimplePopper.prototype, "offset", void 0);
|
|
230
|
+
__decorate([
|
|
231
|
+
property({ type: Function })
|
|
232
|
+
], SimplePopper.prototype, "onClose", void 0);
|
|
201
233
|
SimplePopper = __decorate([
|
|
202
234
|
customElement('simple-popper')
|
|
203
235
|
], SimplePopper);
|